-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjack_funcs.cpp
36 lines (29 loc) · 1.05 KB
/
jack_funcs.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "engine.h"
int process (jack_nframes_t nframes, void *arg)
{
//jack_default_audio_sample_t *out = (jack_default_audio_sample_t *) jack_port_get_buffer (output_port, nframes);
jack_default_audio_sample_t *in = (jack_default_audio_sample_t *) jack_port_get_buffer (input_port, nframes);
int start = (WINDOW_SIZE-1+current_window)*FRAME_SIZE;
int start2 = (current_window-1)*FRAME_SIZE;
for ( int i = 0 ; i < nframes ; i++ ) {
//data_array[i] = (float)out[(pos+i)%DATA_SIZE];
fftw_in[start+i][0] = (double)in[i];
if ( current_window > 0 ) {
fftw_in[start2+i][0] = (double)in[i];
}
}
//pos = (pos + nframes)%DATA_SIZE;
//printf("Number of frames: %d.\n", (int)nframes);
//memcpy (out, in, sizeof (jack_default_audio_sample_t) * nframes);
current_window = (current_window + 1)%WINDOW_SIZE;
return 0;
}
/**
* This is the shutdown callback for this JACK application.
* It is called by JACK if the server ever shuts down or
* decides to disconnect the client.
*/
void jack_shutdown (void *arg)
{
exit (1);
}