Mercurial > sdl-ios-xcode
comparison src/audio/dma/SDL_dmaaudio.c @ 3816:9d070c1a45fa SDL-ryan-multiple-audio-device
Moved AudioBootstrap section in converted drivers to bottom of source, so I
could delete the predeclarations (one more thing to forget to update when
changing the API, otherwise). There're a few other cleanups that snuck into
this commit, too.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Fri, 06 Oct 2006 04:46:58 +0000 |
parents | 2c5387c0a642 |
children | 103bbe13f5eb |
comparison
equal
deleted
inserted
replaced
3815:3234d6eee011 | 3816:9d070c1a45fa |
---|---|
60 | 60 |
61 /* Open the audio device for playback, and don't block if busy */ | 61 /* Open the audio device for playback, and don't block if busy */ |
62 #define OPEN_FLAGS_INPUT (O_RDWR|O_NONBLOCK) | 62 #define OPEN_FLAGS_INPUT (O_RDWR|O_NONBLOCK) |
63 #define OPEN_FLAGS_OUTPUT (O_RDWR|O_NONBLOCK) | 63 #define OPEN_FLAGS_OUTPUT (O_RDWR|O_NONBLOCK) |
64 | 64 |
65 /* Audio driver functions */ | |
66 static int DMA_DetectDevices(int iscapture); | |
67 static const char *DMA_GetDeviceName(int index, int iscapture); | |
68 static int DMA_OpenDevice(_THIS, const char *devname, int iscapture); | |
69 static void DMA_WaitDevice(_THIS); | |
70 static void DMA_PlayDevice(_THIS); | |
71 static Uint8 *DMA_GetDeviceBuf(_THIS); | |
72 static void DMA_CloseDevice(_THIS); | |
73 static void DMA_Deinitialize(void); | |
74 | |
75 /* Audio driver bootstrap functions */ | |
76 | |
77 static char **outputDevices = NULL; | 65 static char **outputDevices = NULL; |
78 static int outputDeviceCount = 0; | 66 static int outputDeviceCount = 0; |
79 static char **inputDevices = NULL; | 67 static char **inputDevices = NULL; |
80 static int inputDeviceCount = 0; | 68 static int inputDeviceCount = 0; |
81 | 69 |
135 build_device_lists(); | 123 build_device_lists(); |
136 available = ((outputDeviceCount > 0) || (inputDeviceCount > 0)); | 124 available = ((outputDeviceCount > 0) || (inputDeviceCount > 0)); |
137 free_device_lists(); | 125 free_device_lists(); |
138 return available; | 126 return available; |
139 } | 127 } |
140 | |
141 | |
142 static int | |
143 DMA_Init(SDL_AudioDriverImpl *impl) | |
144 { | |
145 /* Set the function pointers */ | |
146 impl->DetectDevices = DMA_DetectDevices; | |
147 impl->GetDeviceName = DMA_GetDeviceName; | |
148 impl->OpenDevice = DMA_OpenDevice; | |
149 impl->WaitDevice = DMA_WaitDevice; | |
150 impl->PlayDevice = DMA_PlayDevice; | |
151 impl->GetDeviceBuf = DMA_GetDeviceBuf; | |
152 impl->CloseDevice = DMA_CloseDevice; | |
153 impl->Deinitialize = DMA_Deinitialize; | |
154 | |
155 build_device_lists(); | |
156 return 1; | |
157 } | |
158 | |
159 AudioBootStrap DMA_bootstrap = { | |
160 DMA_DRIVER_NAME, "OSS /dev/dsp DMA audio", | |
161 DMA_Available, DMA_Init, 0 | |
162 }; | |
163 | 128 |
164 static void DMA_Deinitialize(void) | 129 static void DMA_Deinitialize(void) |
165 { | 130 { |
166 free_device_lists(); | 131 free_device_lists(); |
167 } | 132 } |
555 SDL_free(this->hidden); | 520 SDL_free(this->hidden); |
556 this->hidden = NULL; | 521 this->hidden = NULL; |
557 } | 522 } |
558 } | 523 } |
559 | 524 |
525 static int | |
526 DMA_Init(SDL_AudioDriverImpl *impl) | |
527 { | |
528 /* Set the function pointers */ | |
529 impl->DetectDevices = DMA_DetectDevices; | |
530 impl->GetDeviceName = DMA_GetDeviceName; | |
531 impl->OpenDevice = DMA_OpenDevice; | |
532 impl->WaitDevice = DMA_WaitDevice; | |
533 impl->PlayDevice = DMA_PlayDevice; | |
534 impl->GetDeviceBuf = DMA_GetDeviceBuf; | |
535 impl->CloseDevice = DMA_CloseDevice; | |
536 impl->Deinitialize = DMA_Deinitialize; | |
537 | |
538 build_device_lists(); | |
539 return 1; | |
540 } | |
541 | |
542 AudioBootStrap DMA_bootstrap = { | |
543 DMA_DRIVER_NAME, "OSS /dev/dsp DMA audio", | |
544 DMA_Available, DMA_Init, 0 | |
545 }; | |
546 | |
560 /* vi: set ts=4 sw=4 expandtab: */ | 547 /* vi: set ts=4 sw=4 expandtab: */ |