style: reformat code and update cppcheck suppressions

This commit is contained in:
Loic Coenen
2026-05-09 12:46:31 +00:00
committed by Loic Coenen (aider)
parent d2e39f3451
commit c2df024350
3 changed files with 127 additions and 122 deletions

View File

@@ -1,42 +1,39 @@
#include <stdio.h>
#include <string.h>
#include "channel.h"
#include <jack/jack.h>
#include <stdatomic.h>
#include "channel.h"
#include <stdio.h>
#include <string.h>
void channel_add(jack_client_t *client, int idx)
{
char in_name[64], out_name[64];
snprintf(in_name, sizeof(in_name), "channel%d_input", next_channel_id);
snprintf(out_name, sizeof(out_name), "channel%d_output", next_channel_id);
void channel_add(jack_client_t *client, int idx) {
char in_name[64], out_name[64];
snprintf(in_name, sizeof(in_name), "channel%d_input", next_channel_id);
snprintf(out_name, sizeof(out_name), "channel%d_output", next_channel_id);
channels[idx].audio_in = jack_port_register(client, in_name,
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsInput, 0);
channels[idx].audio_out = jack_port_register(client, out_name,
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput, 0);
if (!channels[idx].audio_in || !channels[idx].audio_out) {
fprintf(stderr, "Failed to register ports for channel %d\n", next_channel_id);
/* Do NOT mark channel active process loop will skip it */
atomic_store(&channels[idx].active, 0);
return;
}
atomic_store(&channels[idx].active, 1);
atomic_store(&channels[idx].state, STATE_IDLE);
channels[idx].prev_state = -1;
channels[idx].loop_count = 0;
channels[idx].record_pos = 0;
channels[idx].playback_pos = 0;
next_channel_id++;
channel_count++;
}
void channel_remove(jack_client_t *client, int idx)
{
(void)client;
channels[idx].audio_in = jack_port_register(
client, in_name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
channels[idx].audio_out = jack_port_register(
client, out_name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
if (!channels[idx].audio_in || !channels[idx].audio_out) {
fprintf(stderr, "Failed to register ports for channel %d\n",
next_channel_id);
/* Do NOT mark channel active process loop will skip it */
atomic_store(&channels[idx].active, 0);
channel_count--;
return;
}
atomic_store(&channels[idx].active, 1);
atomic_store(&channels[idx].state, STATE_IDLE);
channels[idx].prev_state = -1;
channels[idx].loop_count = 0;
channels[idx].record_pos = 0;
channels[idx].playback_pos = 0;
next_channel_id++;
channel_count++;
}
void channel_remove(jack_client_t *client, int idx) {
(void)client;
atomic_store(&channels[idx].active, 0);
channel_count--;
}