comparison src/audio/dummy/SDL_dummyaudio.c @ 3792:866c310e2cb5 SDL-ryan-multiple-audio-device

Changed some 1.3 audio symbol names.
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 03 Oct 2006 22:17:59 +0000
parents 37c9c4590689
children b19680c84cdf
comparison
equal deleted inserted replaced
3791:be33495e4d97 3792:866c310e2cb5
35 35
36 /* The tag name used by DUMMY audio */ 36 /* The tag name used by DUMMY audio */
37 #define DUMMYAUD_DRIVER_NAME "dummy" 37 #define DUMMYAUD_DRIVER_NAME "dummy"
38 38
39 /* Audio driver functions */ 39 /* Audio driver functions */
40 static int DUMMYAUD_OpenAudio(_THIS, const char *devname, int iscapture); 40 static int DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture);
41 static void DUMMYAUD_WaitAudio(_THIS); 41 static void DUMMYAUD_WaitDevice(_THIS);
42 static void DUMMYAUD_PlayAudio(_THIS); 42 static void DUMMYAUD_PlayDevice(_THIS);
43 static Uint8 *DUMMYAUD_GetAudioBuf(_THIS); 43 static Uint8 *DUMMYAUD_GetDeviceBuf(_THIS);
44 static void DUMMYAUD_CloseAudio(_THIS); 44 static void DUMMYAUD_CloseDevice(_THIS);
45 45
46 /* Audio driver bootstrap functions */ 46 /* Audio driver bootstrap functions */
47 static int 47 static int
48 DUMMYAUD_Available(void) 48 DUMMYAUD_Available(void)
49 { 49 {
58 58
59 static int 59 static int
60 DUMMYAUD_Init(SDL_AudioDriverImpl *impl) 60 DUMMYAUD_Init(SDL_AudioDriverImpl *impl)
61 { 61 {
62 /* Set the function pointers */ 62 /* Set the function pointers */
63 impl->OpenAudio = DUMMYAUD_OpenAudio; 63 impl->OpenDevice = DUMMYAUD_OpenDevice;
64 impl->WaitAudio = DUMMYAUD_WaitAudio; 64 impl->WaitDevice = DUMMYAUD_WaitDevice;
65 impl->PlayAudio = DUMMYAUD_PlayAudio; 65 impl->PlayDevice = DUMMYAUD_PlayDevice;
66 impl->GetAudioBuf = DUMMYAUD_GetAudioBuf; 66 impl->GetDeviceBuf = DUMMYAUD_GetDeviceBuf;
67 impl->CloseAudio = DUMMYAUD_CloseAudio; 67 impl->CloseDevice = DUMMYAUD_CloseDevice;
68 68
69 return 1; 69 return 1;
70 } 70 }
71 71
72 AudioBootStrap DUMMYAUD_bootstrap = { 72 AudioBootStrap DUMMYAUD_bootstrap = {
74 DUMMYAUD_Available, DUMMYAUD_Init 74 DUMMYAUD_Available, DUMMYAUD_Init
75 }; 75 };
76 76
77 /* This function waits until it is possible to write a full sound buffer */ 77 /* This function waits until it is possible to write a full sound buffer */
78 static void 78 static void
79 DUMMYAUD_WaitAudio(_THIS) 79 DUMMYAUD_WaitDevice(_THIS)
80 { 80 {
81 /* Don't block on first calls to simulate initial fragment filling. */ 81 /* Don't block on first calls to simulate initial fragment filling. */
82 if (this->hidden->initial_calls) 82 if (this->hidden->initial_calls)
83 this->hidden->initial_calls--; 83 this->hidden->initial_calls--;
84 else 84 else
85 SDL_Delay(this->hidden->write_delay); 85 SDL_Delay(this->hidden->write_delay);
86 } 86 }
87 87
88 static void 88 static void
89 DUMMYAUD_PlayAudio(_THIS) 89 DUMMYAUD_PlayDevice(_THIS)
90 { 90 {
91 /* no-op...this is a null driver. */ 91 /* no-op...this is a null driver. */
92 } 92 }
93 93
94 static Uint8 * 94 static Uint8 *
95 DUMMYAUD_GetAudioBuf(_THIS) 95 DUMMYAUD_GetDeviceBuf(_THIS)
96 { 96 {
97 return (this->hidden->mixbuf); 97 return (this->hidden->mixbuf);
98 } 98 }
99 99
100 static void 100 static void
101 DUMMYAUD_CloseAudio(_THIS) 101 DUMMYAUD_CloseDevice(_THIS)
102 { 102 {
103 if (this->hidden->mixbuf != NULL) { 103 if (this->hidden->mixbuf != NULL) {
104 SDL_FreeAudioMem(this->hidden->mixbuf); 104 SDL_FreeAudioMem(this->hidden->mixbuf);
105 this->hidden->mixbuf = NULL; 105 this->hidden->mixbuf = NULL;
106 } 106 }
107 SDL_free(this->hidden); 107 SDL_free(this->hidden);
108 this->hidden = NULL; 108 this->hidden = NULL;
109 } 109 }
110 110
111 static int 111 static int
112 DUMMYAUD_OpenAudio(_THIS, const char *devname, int iscapture) 112 DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture)
113 { 113 {
114 float bytes_per_sec = 0.0f; 114 float bytes_per_sec = 0.0f;
115 115
116 /* Initialize all variables that we clean on shutdown */ 116 /* Initialize all variables that we clean on shutdown */
117 this->hidden = (struct SDL_PrivateAudioData *) 117 this->hidden = (struct SDL_PrivateAudioData *)
124 124
125 /* Allocate mixing buffer */ 125 /* Allocate mixing buffer */
126 this->hidden->mixlen = this->spec.size; 126 this->hidden->mixlen = this->spec.size;
127 this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); 127 this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
128 if (this->hidden->mixbuf == NULL) { 128 if (this->hidden->mixbuf == NULL) {
129 DUMMYAUD_CloseAudio(this); 129 DUMMYAUD_CloseDevice(this);
130 return 0; 130 return 0;
131 } 131 }
132 SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); 132 SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
133 133
134 bytes_per_sec = (float) (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * 134 bytes_per_sec = (float) (SDL_AUDIO_BITSIZE(this->spec.format) / 8) *