Merge branch '8-add-tui' - tests not passing

This commit is contained in:
Loic Coenen
2026-05-17 19:02:03 +00:00
57 changed files with 2786 additions and 92 deletions

47
engine/src/channel.h Normal file
View File

@@ -0,0 +1,47 @@
#ifndef CHANNEL_H
#define CHANNEL_H
// cppcheck-suppress missingIncludeSystem
#include <jack/jack.h>
#include <stdatomic.h>
#define LOOP_BUF_SIZE (5 * 48000)
#define MAX_CHANNELS 16
#include "ringbuffer.h"
typedef enum {
STATE_IDLE,
STATE_RECORD,
STATE_LOOPING,
STATE_PAUSED
} looper_state;
struct channel_t {
atomic_int state;
atomic_int prev_state;
float loop_buffer[LOOP_BUF_SIZE];
atomic_int loop_count;
atomic_int record_pos;
atomic_int playback_pos;
atomic_int active;
jack_port_t *audio_in;
jack_port_t *audio_out;
_Atomic RingBuf *save_ring;
};
/* Globals declared in looper.c */
extern struct channel_t channels[MAX_CHANNELS];
extern atomic_int channel_count;
extern atomic_int channel_capacity;
extern int next_channel_id;
extern atomic_int cmd_add;
extern atomic_int cmd_remove;
extern atomic_int cmd_load;
extern atomic_int cmd_save;
void channel_add(jack_client_t *client, int idx);
void channel_remove(jack_client_t *client, int idx);
#endif