Commit 24344009 authored by falkTX's avatar falkTX
Browse files

Fix alsa_in/out for freewheel

parent 695c9d78
......@@ -72,6 +72,7 @@ volatile int output_new_delay = 0;
volatile float output_offset = 0.0;
volatile float output_integral = 0.0;
volatile float output_diff = 0.0;
volatile int running_freewheel = 0;
snd_pcm_uframes_t real_buffer_size;
snd_pcm_uframes_t real_period_size;
......@@ -306,12 +307,35 @@ double hann( double x )
return 0.5 * (1.0 - cos( 2*M_PI * x ) );
}
/**
* The freewheel callback.
*/
void freewheel (int starting, void* arg) {
running_freewheel = starting;
}
/**
* The process callback for this JACK application.
* It is called by JACK at the appropriate times.
*/
int process (jack_nframes_t nframes, void *arg) {
if (running_freewheel) {
JSList *node = capture_ports;
while ( node != NULL)
{
jack_port_t *port = (jack_port_t *) node->data;
float *buf = jack_port_get_buffer (port, nframes);
memset(buf, 0, sizeof(float)*nframes);
node = jack_slist_next (node);
}
return 0;
}
int rlen;
int err;
snd_pcm_sframes_t delay = target_delay;
......@@ -681,6 +705,12 @@ int main (int argc, char *argv[]) {
jack_set_process_callback (client, process, 0);
/* tell the JACK server to call `freewheel()' whenever
freewheel mode changes.
*/
jack_set_freewheel_callback (client, freewheel, 0);
/* tell the JACK server to call `jack_shutdown()' if
it ever shuts down, either entirely, or if it
just decides to stop calling us.
......
......@@ -72,6 +72,7 @@ volatile int output_new_delay = 0;
volatile float output_offset = 0.0;
volatile float output_integral = 0.0;
volatile float output_diff = 0.0;
volatile int running_freewheel = 0;
snd_pcm_uframes_t real_buffer_size;
snd_pcm_uframes_t real_period_size;
......@@ -311,12 +312,35 @@ double hann( double x )
return 0.5 * (1.0 - cos( 2*M_PI * x ) );
}
/**
* The freewheel callback.
*/
void freewheel (int starting, void* arg) {
running_freewheel = starting;
}
/**
* The process callback for this JACK application.
* It is called by JACK at the appropriate times.
*/
int process (jack_nframes_t nframes, void *arg) {
if (running_freewheel) {
JSList *node = playback_ports;
while ( node != NULL)
{
jack_port_t *port = (jack_port_t *) node->data;
float *buf = jack_port_get_buffer (port, nframes);
memset(buf, 0, sizeof(float)*nframes);
node = jack_slist_next (node);
}
return 0;
}
int rlen;
int err;
snd_pcm_sframes_t delay = target_delay;
......@@ -684,6 +708,12 @@ int main (int argc, char *argv[]) {
jack_set_process_callback (client, process, 0);
/* tell the JACK server to call `freewheel()' whenever
freewheel mode changes.
*/
jack_set_freewheel_callback (client, freewheel, 0);
/* tell the JACK server to call `jack_shutdown()' if
it ever shuts down, either entirely, or if it
just decides to stop calling us.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment