more capturing

This commit is contained in:
2026-05-03 19:08:41 +02:00
parent 38dcca3730
commit 3cbf074bc2
+31 -3
View File
@@ -95,6 +95,8 @@ typedef struct {
typedef struct { typedef struct {
float mpx_power; float mpx_power;
float bs412_gain;
float agc_gain;
} FM95_RunResult; } FM95_RunResult;
bool compare_dvs(const FM95_DeviceNames *a, const FM95_DeviceNames *b) { bool compare_dvs(const FM95_DeviceNames *a, const FM95_DeviceNames *b) {
@@ -209,6 +211,7 @@ int run_fm95(const FM95_Config config, FM95_Runtime* runtime, FM95_RunResult* re
float agc_gain = process_agc(&runtime->agc, 0.5f * (fabsf(l) + fabsf(r))); float agc_gain = process_agc(&runtime->agc, 0.5f * (fabsf(l) + fabsf(r)));
l *= agc_gain; l *= agc_gain;
r *= agc_gain; r *= agc_gain;
temp_result.agc_gain = agc_gain;
} }
float mod_l, mod_r; float mod_l, mod_r;
@@ -243,6 +246,7 @@ int run_fm95(const FM95_Config config, FM95_Runtime* runtime, FM95_RunResult* re
} }
mpx = bs412_compress(&runtime->bs412, audio, mpx+mpx_in[i], &temp_result.mpx_power); mpx = bs412_compress(&runtime->bs412, audio, mpx+mpx_in[i], &temp_result.mpx_power);
result->bs412_gain = runtime->bs412.gain;
output[i] = tanhf(mpx)*config.master_volume; // Ensure peak deviation of 75 khz (or the set deviation), assuming we're calibrated correctly output[i] = tanhf(mpx)*config.master_volume; // Ensure peak deviation of 75 khz (or the set deviation), assuming we're calibrated correctly
advance_oscillator(&runtime->osc); advance_oscillator(&runtime->osc);
@@ -259,7 +263,6 @@ int run_fm95(const FM95_Config config, FM95_Runtime* runtime, FM95_RunResult* re
return 0; return 0;
} }
int parse_arguments(int argc, char **argv, FM95_Config* config) { int parse_arguments(int argc, char **argv, FM95_Config* config) {
int opt; int opt;
const char *short_opt = "c:h"; const char *short_opt = "c:h";
@@ -481,28 +484,53 @@ static void *handle_client(ipc_client_arg_t *arg) {
ssize_t n; ssize_t n;
while ((n = recv(fd, buf, sizeof(buf) - 1, 0)) > 0) { while ((n = recv(fd, buf, sizeof(buf) - 1, 0)) > 0) {
reply = 0; reply = 0xff;
buf[n] = '\0'; buf[n] = '\0';
switch (buf[0]) { switch (buf[0]) {
case 1: case 1:
// Reload // Reload
to_run = 0; to_run = 0;
to_reload = 1; to_reload = 1;
reply = 0;
break; break;
case 2: case 2:
// Quit // Quit
to_run = 0; to_run = 0;
to_reload = 0; to_reload = 0;
reply = 0;
break; break;
case 100: case 100:
// Toggle stereo // Toggle stereo
data->config->stereo ^= 1; data->config->stereo ^= 1;
reply = 0;
break; break;
case 101: case 101:
// Set makeup // Set makeup
float val; float val;
memcpy(&val, buf + 1, sizeof(float)); memcpy(&val, buf + 1, sizeof(float));
data->config->volumes.makeup = val; data->config->volumes.makeup = val;
reply = 0;
break;
case 102:
// Set drive
float val;
memcpy(&val, buf + 1, sizeof(float));
data->config->volumes.drive = val;
reply = 0;
break;
case 103:
// Set audio preamp
float val;
memcpy(&val, buf + 1, sizeof(float));
data->config->audio_preamp = val;
reply = 0;
break;
case 104:
// Set master volume
float val;
memcpy(&val, buf + 1, sizeof(float));
data->config->master_volume = val;
reply = 0;
break; break;
case 0xff: case 0xff:
// Fetch data // Fetch data
@@ -513,7 +541,7 @@ static void *handle_client(ipc_client_arg_t *arg) {
break; break;
} }
send(fd, &reply, 1, 0); if(reply != 0xff) send(fd, &reply, 1, 0);
} }
printf("[client fd=%d] disconnected\n", fd); printf("[client fd=%d] disconnected\n", fd);