40 lines
871 B
C
40 lines
871 B
C
#ifndef CHANNEL_H
|
|
#define CHANNEL_H
|
|
|
|
#include <jack/jack.h>
|
|
#include <stdatomic.h>
|
|
|
|
#define LOOP_BUF_SIZE (5 * 48000)
|
|
#define MAX_CHANNELS 16
|
|
|
|
typedef enum {
|
|
STATE_IDLE,
|
|
STATE_RECORD,
|
|
STATE_LOOPING,
|
|
STATE_PAUSED
|
|
} looper_state;
|
|
|
|
struct channel_t {
|
|
atomic_int state;
|
|
int prev_state;
|
|
float loop_buffer[LOOP_BUF_SIZE];
|
|
int loop_count;
|
|
int record_pos;
|
|
int playback_pos;
|
|
int active;
|
|
jack_port_t *audio_in;
|
|
jack_port_t *audio_out;
|
|
};
|
|
|
|
/* Globals declared in looper.c */
|
|
extern struct channel_t channels[MAX_CHANNELS];
|
|
extern atomic_int channel_count;
|
|
extern int next_channel_id;
|
|
extern atomic_int cmd_add;
|
|
extern atomic_int cmd_remove;
|
|
|
|
void channel_add(jack_client_t *client, int idx);
|
|
void channel_remove(jack_client_t *client, int idx);
|
|
|
|
#endif
|