Changeset 362
- Timestamp:
- 02/20/06 09:52:57 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sweep/branches/sweep-jack-testing/src/driver_jack.c
r293 r362 20 20 21 21 /* 22 * ALSA 0.6 support by Paul Davis 23 * ALSA 0.9 updates by Zenaan Harkness 22 * jack driver by Torben Hohn 2006 24 23 */ 25 24 … … 59 58 } sw_jack_handle_t; 60 59 61 //void print_pcm_state (snd_pcm_t * pcm)62 //{63 // switch (snd_pcm_state(pcm)) {64 // case SND_PCM_STATE_OPEN:65 // fprintf (stderr, "sweep: print_pcm_state: state is OPEN\n");66 // break;67 // case SND_PCM_STATE_SETUP:68 // fprintf (stderr, "sweep: print_pcm_state: state is SETUP\n");69 // break;70 // case SND_PCM_STATE_PREPARED:71 // fprintf (stderr, "sweep: print_pcm_state: state is PREPARED\n");72 // break;73 // case SND_PCM_STATE_RUNNING:74 // fprintf (stderr, "sweep: print_pcm_state: state is RUNNING\n");75 // break;76 // case SND_PCM_STATE_XRUN:77 // fprintf (stderr, "sweep: print_pcm_state: state is XRUN\n");78 // break;79 // case SND_PCM_STATE_DRAINING:80 // fprintf (stderr, "sweep: print_pcm_state: state is DRAINING\n");81 // break;82 // case SND_PCM_STATE_PAUSED:83 // fprintf (stderr, "sweep: print_pcm_state: state is PAUSED\n");84 // break;85 // case SND_PCM_STATE_SUSPENDED:86 // fprintf (stderr, "sweep: print_pcm_state: state is SUSPENDED\n");87 // break;88 // default:89 // fprintf (stderr, "sweep: print_pcm_state: state is unknown! THIS SHOULD NEVER HAPPEN!\n");90 // }91 //}92 93 60 static GList * 94 alsa_get_names (void)61 jack_get_names (void) 95 62 { 96 63 GList * names = NULL; 97 //char * name;98 99 // if ((name = getenv ("SWEEP_ALSA_PCM")) != 0) {100 // names = g_list_append (names, name);101 // }102 103 /* The standard command line options for this are -D or --device.104 * The default fallback should be plughw.105 */106 // names = g_list_append (names, "plughw:0,0");107 // names = g_list_append (names, "plughw:0,1");108 // names = g_list_append (names, "plughw:1,0");109 64 names = g_list_append (names, "alsa_playback"); 110 65 … … 113 68 114 69 static sw_handle * 115 alsa_device_open (int monitoring, int flags)70 jack_device_open (int monitoring, int flags) 116 71 { 117 72 //int err; … … 155 110 // FIXME: check the ports.... 156 111 157 158 112 handle = g_malloc0 (sizeof (sw_handle)); 159 113 … … 161 115 handle->custom_data = jack_data; 162 116 163 164 165 117 return handle; 166 167 } 168 169 // /src/alsa/alsaplayer-0.99.72/output/alsa-final/alsa.c 170 // /src/alsa/alsa-lib-0.9.0rc3/test/pcm.c 171 static void 172 alsa_device_setup (sw_handle * handle, sw_format * format) 118 } 119 120 static void 121 jack_device_setup (sw_handle * handle, sw_format * format) 173 122 { 174 123 //int err; … … 195 144 196 145 static int 197 alsa_device_wait (sw_handle * handle) 198 { 146 jack_device_wait (sw_handle * handle) 147 { 148 return -1; 199 149 } 200 150 … … 202 152 203 153 static ssize_t 204 alsa_device_read (sw_handle * handle, sw_audio_t * buf, size_t count)154 jack_device_read (sw_handle * handle, sw_audio_t * buf, size_t count) 205 155 { 206 156 sw_jack_handle_t * pcm_handle = (sw_jack_handle_t *)handle->custom_data; … … 219 169 220 170 static ssize_t 221 alsa_device_write (sw_handle * handle, sw_audio_t * buf, size_t count,171 jack_device_write (sw_handle * handle, sw_audio_t * buf, size_t count, 222 172 sw_framecount_t offset) 223 173 { … … 237 187 238 188 sw_framecount_t 239 alsa_device_offset (sw_handle * handle) 240 { 241 /*printf ("sweep: alsa_offset\n");*/ 189 jack_device_offset (sw_handle * handle) 190 { 242 191 return -1; 243 192 } 244 193 245 194 static void 246 alsa_device_reset (sw_handle * handle) 247 { 248 /*printf ("sweep: alsa_reset\n");*/ 249 } 250 251 static void 252 alsa_device_flush (sw_handle * handle) 253 { 254 /*printf ("sweep: alsa_flush\n");*/ 255 } 256 257 /* 258 * alsa lib provides: 259 * int snd_pcm_drop (snd_pcm_t *pcm) // Stop a PCM dropping pending frames. 260 * int snd_pcm_drain (snd_pcm_t *pcm) // Stop a PCM preserving pending frames. 261 */ 262 static void 263 alsa_device_drain (sw_handle * handle) 264 { 265 } 266 267 static void 268 alsa_device_close (sw_handle * handle) 269 { 270 // snd_pcm_t * pcm_handle = (snd_pcm_t *)handle->custom_data; 271 // 272 // snd_pcm_close (pcm_handle); 195 jack_device_reset (sw_handle * handle) 196 { 197 } 198 199 static void 200 jack_device_flush (sw_handle * handle) 201 { 202 } 203 204 static void 205 jack_device_drain (sw_handle * handle) 206 { 207 } 208 209 static void 210 jack_device_close (sw_handle * handle) 211 { 212 273 213 } 274 214 275 215 static sw_driver _driver_jack = { 276 alsa_get_names,277 alsa_device_open,278 alsa_device_setup,279 alsa_device_wait,280 alsa_device_read,281 alsa_device_write,282 alsa_device_offset,283 alsa_device_reset,284 alsa_device_flush,285 alsa_device_drain,286 alsa_device_close216 jack_get_names, 217 jack_device_open, 218 jack_device_setup, 219 jack_device_wait, 220 jack_device_read, 221 jack_device_write, 222 jack_device_offset, 223 jack_device_reset, 224 jack_device_flush, 225 jack_device_drain, 226 jack_device_close 287 227 }; 288 228
