rds input via ipc - experimental (hence it is on 61.75 - the only unused frequncy

This commit is contained in:
2026-07-11 12:45:50 +02:00
parent da40c0ea02
commit fdab99d1fa
5 changed files with 92 additions and 18 deletions
+6 -9
View File
@@ -6,8 +6,7 @@
#include <pthread.h>
#include <sys/un.h>
static int make_server_socket(const char *path)
{
static int make_server_socket(const char *path) {
int fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd < 0) { perror("ipc: socket"); return -1; }
@@ -63,13 +62,11 @@ static void *listener_thread(void *arg) {
return NULL;
}
int create_ipc(ipc_ctx_t *ctx, ipc_client_fn handler,
const char *socket_path, void *user_data)
{
ctx->handler = handler;
ctx->user_data = user_data;
ctx->running = 1;
ctx->server_fd = make_server_socket(socket_path);
int create_ipc(ipc_ctx_t *ctx, ipc_client_fn handler, const char *socket_path, void *user_data) {
ctx->handler = handler;
ctx->user_data = user_data;
ctx->running = 1;
ctx->server_fd = make_server_socket(socket_path);
ctx->socket_path = strdup(socket_path);
if (ctx->server_fd < 0) return -1;
+5 -2
View File
@@ -30,7 +30,10 @@ float get_oscillator_cos_multiplier_ni(Oscillator *osc, float multiplier) {
return cosf(osc->phase * multiplier);
}
inline void advance_oscillator(Oscillator *osc) {
inline bool advance_oscillator(Oscillator *osc) {
osc->phase += osc->phase_increment;
if (osc->phase >= M_2PI) osc->phase -= M_2PI;
if (osc->phase >= M_2PI) {
osc->phase -= M_2PI;
return true;
} return false;
}
+2 -1
View File
@@ -1,6 +1,7 @@
#pragma once
#include "constants.h"
#include <stdbool.h>
#include <math.h>
typedef struct {
@@ -15,4 +16,4 @@ float get_oscillator_sin_sample(Oscillator *osc);
float get_oscillator_cos_sample(Oscillator *osc);
float get_oscillator_sin_multiplier_ni(Oscillator *osc, float multiplier);
float get_oscillator_cos_multiplier_ni(Oscillator *osc, float multiplier);
void advance_oscillator(Oscillator *osc);
bool advance_oscillator(Oscillator *osc);