Changeset bccac6b
- Timestamp:
- Sep 25, 2009, 6:56:58 AM (15 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- c3f4173
- Parents:
- 52ecf09
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/utils.c
r52ecf09 rbccac6b 364 364 debug("Jack init ...\n"); 365 365 jack_setup = new_aubio_jack(channels, channels, 366 1, 1, 366 367 (aubio_process_func_t)process_func); 367 368 if (usepitch) { -
ext/jackio.c
r52ecf09 rbccac6b 54 54 smpl_t **sobufs; 55 55 #endif 56 /** jack input channels */56 /** jack input audio channels */ 57 57 uint_t ichan; 58 /** jack output channels */58 /** jack output audio channels */ 59 59 uint_t ochan; 60 /** jack input midi channels */ 61 uint_t imidichan; 62 /** jack output midi channels */ 63 uint_t omidichan; 60 64 /** jack samplerate (Hz) */ 61 65 uint_t samplerate; … … 65 69 66 70 /* static memory management */ 67 static aubio_jack_t *aubio_jack_alloc (uint_t ichan, uint_t ochan); 71 static aubio_jack_t *aubio_jack_alloc (uint_t ichan, uint_t ochan, 72 uint_t imidichan, uint_t omidichan); 68 73 static uint_t aubio_jack_free (aubio_jack_t * jack_setup); 69 74 /* jack callback functions */ … … 72 77 73 78 aubio_jack_t * 74 new_aubio_jack (uint_t ichan, uint_t ochan, aubio_process_func_t callback) 75 { 76 aubio_jack_t *jack_setup = aubio_jack_alloc (ichan, ochan); 79 new_aubio_jack (uint_t ichan, uint_t ochan, 80 uint_t imidichan, uint_t omidichan, 81 aubio_process_func_t callback) 82 { 83 aubio_jack_t *jack_setup = aubio_jack_alloc (ichan, ochan, 84 imidichan, omidichan); 77 85 uint_t i; 78 86 char *client_name = "aubio"; 87 char *jack_port_type; 79 88 char name[64]; 80 89 /* initial jack client setup */ … … 90 99 (void *) jack_setup); 91 100 92 /* register jack output ports */ 93 for (i = 0; i < ochan; i++) { 94 AUBIO_SPRINTF (name, "out_%d", i + 1); 95 AUBIO_MSG ("%s\n", name); 101 /* register jack output audio and midi ports */ 102 for (i = 0; i < ochan + omidichan; i++) { 103 if (i < ochan) { 104 jack_port_type = JACK_DEFAULT_AUDIO_TYPE; 105 AUBIO_SPRINTF (name, "out_%d", i + 1); 106 } else { 107 jack_port_type = JACK_DEFAULT_MIDI_TYPE; 108 AUBIO_SPRINTF (name, "midi_out_%d", i - ochan + 1); 109 } 96 110 if ((jack_setup->oports[i] = 97 111 jack_port_register (jack_setup->client, name, 98 JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0)) == 0) { 99 AUBIO_ERR ("failed registering output port \"%s\"!\n", name); 100 jack_client_close (jack_setup->client); 101 AUBIO_QUIT (AUBIO_FAIL); 102 } 103 } 104 105 /* register jack input ports */ 106 for (i = 0; i < ichan; i++) { 107 AUBIO_SPRINTF (name, "in_%d", i + 1); 108 AUBIO_MSG ("%s\n", name); 112 jack_port_type, JackPortIsOutput, 0)) == 0) { 113 goto beach; 114 } 115 AUBIO_DBG ("%s:%s\n", client_name, name); 116 } 117 118 /* register jack input audio ports */ 119 for (i = 0; i < ichan + imidichan; i++) { 120 if (i < ichan) { 121 jack_port_type = JACK_DEFAULT_AUDIO_TYPE; 122 AUBIO_SPRINTF (name, "in_%d", i + 1); 123 } else { 124 jack_port_type = JACK_DEFAULT_MIDI_TYPE; 125 AUBIO_SPRINTF (name, "midi_in_%d", i - ichan + 1); 126 } 109 127 if ((jack_setup->iports[i] = 110 128 jack_port_register (jack_setup->client, name, 111 JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0)) == 0) { 112 AUBIO_ERR ("failed registering input port \"%s\"!\n", name); 113 jack_client_close (jack_setup->client); 114 AUBIO_QUIT (AUBIO_FAIL); 115 } 129 jack_port_type, JackPortIsInput, 0)) == 0) { 130 goto beach; 131 } 132 AUBIO_DBG ("%s:%s\n", client_name, name); 116 133 } 117 134 … … 119 136 jack_setup->callback = callback; 120 137 return jack_setup; 138 139 beach: 140 AUBIO_ERR ("failed registering port \"%s:%s\"!\n", 141 client_name, name); 142 jack_client_close (jack_setup->client); 143 AUBIO_QUIT (AUBIO_FAIL); 121 144 } 122 145 … … 144 167 /* memory management */ 145 168 static aubio_jack_t * 146 aubio_jack_alloc (uint_t ichan, uint_t ochan) 169 aubio_jack_alloc (uint_t ichan, uint_t ochan, 170 uint_t imidichan, uint_t omidichan) 147 171 { 148 172 aubio_jack_t *jack_setup = AUBIO_NEW (aubio_jack_t); 149 173 jack_setup->ichan = ichan; 150 174 jack_setup->ochan = ochan; 151 jack_setup->oports = AUBIO_ARRAY (jack_port_t *, ichan );152 jack_setup->iports = AUBIO_ARRAY (jack_port_t *, ochan );175 jack_setup->oports = AUBIO_ARRAY (jack_port_t *, ichan + imidichan); 176 jack_setup->iports = AUBIO_ARRAY (jack_port_t *, ochan + omidichan); 153 177 jack_setup->ibufs = AUBIO_ARRAY (jack_sample_t *, ichan); 154 178 jack_setup->obufs = AUBIO_ARRAY (jack_sample_t *, ochan); 155 179 #ifdef AUBIO_JACK_NEEDS_CONVERSION 180 /* allocate arrays for data conversion */ 156 181 jack_setup->sibufs = AUBIO_ARRAY (smpl_t *, ichan); 157 182 uint_t i; -
ext/jackio.h
r52ecf09 rbccac6b 42 42 /** jack device creation function */ 43 43 aubio_jack_t *new_aubio_jack (uint_t inchannels, uint_t outchannels, 44 uint_t imidichan, uint_t omidichan, 44 45 aubio_process_func_t callback); 45 46 /** activate jack client (run jackprocess function) */
Note: See TracChangeset
for help on using the changeset viewer.