4-implement-scene-switching-engine #4
13
src/looper.c
13
src/looper.c
@@ -514,10 +514,9 @@ void looper_process_commands(jack_client_t *client) {
|
||||
switch (cmd.type) {
|
||||
case CMD_ADD_CHANNEL: {
|
||||
int cap = atomic_load(&channel_capacity);
|
||||
struct channel_t *cur = get_channels_array();
|
||||
int idx;
|
||||
for (idx = 0; idx < cap; idx++)
|
||||
if (!atomic_load(&cur[idx].active))
|
||||
if (!atomic_load(&(get_channels_array()[idx].active)))
|
||||
break;
|
||||
if (idx == cap) {
|
||||
if (ensure_capacity(client, idx) != 0)
|
||||
@@ -528,10 +527,9 @@ void looper_process_commands(jack_client_t *client) {
|
||||
}
|
||||
case CMD_ADD_MIDI_CHANNEL: {
|
||||
int cap = atomic_load(&channel_capacity);
|
||||
struct channel_t *cur = get_channels_array();
|
||||
int idx;
|
||||
for (idx = 0; idx < cap; idx++)
|
||||
if (!atomic_load(&cur[idx].active))
|
||||
if (!atomic_load(&(get_channels_array()[idx].active)))
|
||||
break;
|
||||
if (idx == cap) {
|
||||
if (ensure_capacity(client, idx) != 0)
|
||||
@@ -542,10 +540,9 @@ void looper_process_commands(jack_client_t *client) {
|
||||
}
|
||||
case CMD_REMOVE_CHANNEL: {
|
||||
int cap = atomic_load(&channel_capacity);
|
||||
struct channel_t *cur = get_channels_array();
|
||||
int remove_idx = -1;
|
||||
for (int idx = 1; idx < cap; idx++)
|
||||
if (atomic_load(&cur[idx].active))
|
||||
if (atomic_load(&(get_channels_array()[idx].active)))
|
||||
remove_idx = idx;
|
||||
if (remove_idx != -1) {
|
||||
channel_remove(client, remove_idx);
|
||||
@@ -556,7 +553,6 @@ void looper_process_commands(jack_client_t *client) {
|
||||
}
|
||||
case CMD_ADD_SCENE: {
|
||||
int cap = atomic_load(&channel_capacity);
|
||||
struct channel_t *cur = get_channels_array();
|
||||
int bind = atomic_load(&bind_channel);
|
||||
int ch = bind;
|
||||
if (ch < cap) {
|
||||
@@ -566,7 +562,6 @@ void looper_process_commands(jack_client_t *client) {
|
||||
}
|
||||
case CMD_REMOVE_SCENE: {
|
||||
int cap = atomic_load(&channel_capacity);
|
||||
struct channel_t *cur = get_channels_array();
|
||||
int bind = atomic_load(&bind_channel);
|
||||
int ch = bind;
|
||||
if (ch < cap) {
|
||||
@@ -576,7 +571,6 @@ void looper_process_commands(jack_client_t *client) {
|
||||
}
|
||||
case CMD_NEXT_SCENE: {
|
||||
int cap = atomic_load(&channel_capacity);
|
||||
struct channel_t *cur = get_channels_array();
|
||||
int bind = atomic_load(&bind_channel);
|
||||
int ch = bind;
|
||||
if (ch < cap) {
|
||||
@@ -586,7 +580,6 @@ void looper_process_commands(jack_client_t *client) {
|
||||
}
|
||||
case CMD_PREV_SCENE: {
|
||||
int cap = atomic_load(&channel_capacity);
|
||||
struct channel_t *cur = get_channels_array();
|
||||
int bind = atomic_load(&bind_channel);
|
||||
int ch = bind;
|
||||
if (ch < cap) {
|
||||
|
||||
Reference in New Issue
Block a user