mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-23 21:19:11 +00:00
audio: Rename SDL_GetAudioStreamBinding to SDL_GetAudioStreamDevice.
This commit is contained in:
parent
efd2023a72
commit
58c859f64d
11 changed files with 18 additions and 18 deletions
|
@ -94,7 +94,7 @@ In SDL2, you might have done something like this to play audio...
|
||||||
/* ...somewhere near startup... */
|
/* ...somewhere near startup... */
|
||||||
const SDL_AudioSpec spec = { SDL_AUDIO_S16, 2, 44100 };
|
const SDL_AudioSpec spec = { SDL_AUDIO_S16, 2, 44100 };
|
||||||
SDL_AudioStream *stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_OUTPUT, &spec, MyAudioCallback, &my_audio_callback_user_data);
|
SDL_AudioStream *stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_OUTPUT, &spec, MyAudioCallback, &my_audio_callback_user_data);
|
||||||
SDL_ResumeAudioDevice(SDL_GetAudioStreamBinding(stream));
|
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream));
|
||||||
```
|
```
|
||||||
|
|
||||||
If you used SDL_QueueAudio instead of a callback in SDL2, this is also straightforward.
|
If you used SDL_QueueAudio instead of a callback in SDL2, this is also straightforward.
|
||||||
|
@ -103,7 +103,7 @@ If you used SDL_QueueAudio instead of a callback in SDL2, this is also straightf
|
||||||
/* ...somewhere near startup... */
|
/* ...somewhere near startup... */
|
||||||
const SDL_AudioSpec spec = { SDL_AUDIO_S16, 2, 44100 };
|
const SDL_AudioSpec spec = { SDL_AUDIO_S16, 2, 44100 };
|
||||||
SDL_AudioStream *stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_OUTPUT, &spec, NULL, NULL);
|
SDL_AudioStream *stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_OUTPUT, &spec, NULL, NULL);
|
||||||
SDL_ResumeAudioDevice(SDL_GetAudioStreamBinding(stream));
|
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream));
|
||||||
|
|
||||||
/* ...in your main loop... */
|
/* ...in your main loop... */
|
||||||
/* calculate a little more audio into `buf`, add it to `stream` */
|
/* calculate a little more audio into `buf`, add it to `stream` */
|
||||||
|
|
|
@ -549,7 +549,7 @@ extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid);
|
||||||
* \sa SDL_BindAudioStreams
|
* \sa SDL_BindAudioStreams
|
||||||
* \sa SDL_UnbindAudioStreams
|
* \sa SDL_UnbindAudioStreams
|
||||||
* \sa SDL_UnbindAudioStream
|
* \sa SDL_UnbindAudioStream
|
||||||
* \sa SDL_GetAudioStreamBinding
|
* \sa SDL_GetAudioStreamDevice
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams);
|
extern DECLSPEC int SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams);
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ extern DECLSPEC int SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_Au
|
||||||
* \sa SDL_BindAudioStreams
|
* \sa SDL_BindAudioStreams
|
||||||
* \sa SDL_UnbindAudioStreams
|
* \sa SDL_UnbindAudioStreams
|
||||||
* \sa SDL_UnbindAudioStream
|
* \sa SDL_UnbindAudioStream
|
||||||
* \sa SDL_GetAudioStreamBinding
|
* \sa SDL_GetAudioStreamDevice
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream *stream);
|
extern DECLSPEC int SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream *stream);
|
||||||
|
|
||||||
|
@ -595,7 +595,7 @@ extern DECLSPEC int SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_Aud
|
||||||
* \sa SDL_BindAudioStreams
|
* \sa SDL_BindAudioStreams
|
||||||
* \sa SDL_BindAudioStream
|
* \sa SDL_BindAudioStream
|
||||||
* \sa SDL_UnbindAudioStream
|
* \sa SDL_UnbindAudioStream
|
||||||
* \sa SDL_GetAudioStreamBinding
|
* \sa SDL_GetAudioStreamDevice
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_UnbindAudioStreams(SDL_AudioStream **streams, int num_streams);
|
extern DECLSPEC void SDLCALL SDL_UnbindAudioStreams(SDL_AudioStream **streams, int num_streams);
|
||||||
|
|
||||||
|
@ -614,7 +614,7 @@ extern DECLSPEC void SDLCALL SDL_UnbindAudioStreams(SDL_AudioStream **streams, i
|
||||||
* \sa SDL_BindAudioStream
|
* \sa SDL_BindAudioStream
|
||||||
* \sa SDL_BindAudioStreams
|
* \sa SDL_BindAudioStreams
|
||||||
* \sa SDL_UnbindAudioStreams
|
* \sa SDL_UnbindAudioStreams
|
||||||
* \sa SDL_GetAudioStreamBinding
|
* \sa SDL_GetAudioStreamDevice
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_UnbindAudioStream(SDL_AudioStream *stream);
|
extern DECLSPEC void SDLCALL SDL_UnbindAudioStream(SDL_AudioStream *stream);
|
||||||
|
|
||||||
|
@ -638,7 +638,7 @@ extern DECLSPEC void SDLCALL SDL_UnbindAudioStream(SDL_AudioStream *stream);
|
||||||
* \sa SDL_UnbindAudioStream
|
* \sa SDL_UnbindAudioStream
|
||||||
* \sa SDL_UnbindAudioStreams
|
* \sa SDL_UnbindAudioStreams
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_GetAudioStreamBinding(SDL_AudioStream *stream);
|
extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_GetAudioStreamDevice(SDL_AudioStream *stream);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1498,7 +1498,7 @@ void SDL_UnbindAudioStream(SDL_AudioStream *stream)
|
||||||
SDL_UnbindAudioStreams(&stream, 1);
|
SDL_UnbindAudioStreams(&stream, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_AudioDeviceID SDL_GetAudioStreamBinding(SDL_AudioStream *stream)
|
SDL_AudioDeviceID SDL_GetAudioStreamDevice(SDL_AudioStream *stream)
|
||||||
{
|
{
|
||||||
SDL_AudioDeviceID retval = 0;
|
SDL_AudioDeviceID retval = 0;
|
||||||
if (stream) {
|
if (stream) {
|
||||||
|
|
|
@ -886,7 +886,7 @@ SDL3_0.0.0 {
|
||||||
SDL_PauseAudioDevice;
|
SDL_PauseAudioDevice;
|
||||||
SDL_ResumeAudioDevice;
|
SDL_ResumeAudioDevice;
|
||||||
SDL_IsAudioDevicePaused;
|
SDL_IsAudioDevicePaused;
|
||||||
SDL_GetAudioStreamBinding;
|
SDL_GetAudioStreamDevice;
|
||||||
SDL_ShowWindowSystemMenu;
|
SDL_ShowWindowSystemMenu;
|
||||||
SDL_ReadS16LE;
|
SDL_ReadS16LE;
|
||||||
SDL_ReadS16BE;
|
SDL_ReadS16BE;
|
||||||
|
|
|
@ -911,7 +911,7 @@
|
||||||
#define SDL_PauseAudioDevice SDL_PauseAudioDevice_REAL
|
#define SDL_PauseAudioDevice SDL_PauseAudioDevice_REAL
|
||||||
#define SDL_ResumeAudioDevice SDL_ResumeAudioDevice_REAL
|
#define SDL_ResumeAudioDevice SDL_ResumeAudioDevice_REAL
|
||||||
#define SDL_IsAudioDevicePaused SDL_IsAudioDevicePaused_REAL
|
#define SDL_IsAudioDevicePaused SDL_IsAudioDevicePaused_REAL
|
||||||
#define SDL_GetAudioStreamBinding SDL_GetAudioStreamBinding_REAL
|
#define SDL_GetAudioStreamDevice SDL_GetAudioStreamDevice_REAL
|
||||||
#define SDL_ShowWindowSystemMenu SDL_ShowWindowSystemMenu_REAL
|
#define SDL_ShowWindowSystemMenu SDL_ShowWindowSystemMenu_REAL
|
||||||
#define SDL_ReadS16LE SDL_ReadS16LE_REAL
|
#define SDL_ReadS16LE SDL_ReadS16LE_REAL
|
||||||
#define SDL_ReadS16BE SDL_ReadS16BE_REAL
|
#define SDL_ReadS16BE SDL_ReadS16BE_REAL
|
||||||
|
|
|
@ -955,7 +955,7 @@ SDL_DYNAPI_PROC(int,SDL_LoadWAV,(const char *a, SDL_AudioSpec *b, Uint8 **c, Uin
|
||||||
SDL_DYNAPI_PROC(int,SDL_PauseAudioDevice,(SDL_AudioDeviceID a),(a),return)
|
SDL_DYNAPI_PROC(int,SDL_PauseAudioDevice,(SDL_AudioDeviceID a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_ResumeAudioDevice,(SDL_AudioDeviceID a),(a),return)
|
SDL_DYNAPI_PROC(int,SDL_ResumeAudioDevice,(SDL_AudioDeviceID a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_IsAudioDevicePaused,(SDL_AudioDeviceID a),(a),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_IsAudioDevicePaused,(SDL_AudioDeviceID a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_AudioDeviceID,SDL_GetAudioStreamBinding,(SDL_AudioStream *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_AudioDeviceID,SDL_GetAudioStreamDevice,(SDL_AudioStream *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_ShowWindowSystemMenu,(SDL_Window *a, int b, int c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_ShowWindowSystemMenu,(SDL_Window *a, int b, int c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS16LE,(SDL_RWops *a, Sint16 *b),(a,b),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS16LE,(SDL_RWops *a, Sint16 *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS16BE,(SDL_RWops *a, Sint16 *b),(a,b),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS16BE,(SDL_RWops *a, Sint16 *b),(a,b),return)
|
||||||
|
|
|
@ -72,7 +72,7 @@ open_audio(void)
|
||||||
SDL_free(wave.sound);
|
SDL_free(wave.sound);
|
||||||
quit(2);
|
quit(2);
|
||||||
}
|
}
|
||||||
SDL_ResumeAudioDevice(SDL_GetAudioStreamBinding(stream));
|
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@ static int done = 0;
|
||||||
|
|
||||||
static void loop(void)
|
static void loop(void)
|
||||||
{
|
{
|
||||||
const SDL_AudioDeviceID devid_in = SDL_GetAudioStreamBinding(stream_in);
|
const SDL_AudioDeviceID devid_in = SDL_GetAudioStreamDevice(stream_in);
|
||||||
const SDL_AudioDeviceID devid_out = SDL_GetAudioStreamBinding(stream_out);
|
const SDL_AudioDeviceID devid_out = SDL_GetAudioStreamDevice(stream_out);
|
||||||
SDL_bool please_quit = SDL_FALSE;
|
SDL_bool please_quit = SDL_FALSE;
|
||||||
SDL_Event e;
|
SDL_Event e;
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ static void iteration(void)
|
||||||
/* !!! FIXME: laziness, this used to loop the audio, but we'll just play it once for now on each connect. */
|
/* !!! FIXME: laziness, this used to loop the audio, but we'll just play it once for now on each connect. */
|
||||||
SDL_PutAudioStreamData(stream, sound, soundlen);
|
SDL_PutAudioStreamData(stream, sound, soundlen);
|
||||||
SDL_FlushAudioStream(stream);
|
SDL_FlushAudioStream(stream);
|
||||||
SDL_ResumeAudioDevice(SDL_GetAudioStreamBinding(stream));
|
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream));
|
||||||
/* !!! FIXME: this is leaking the stream for now. We'll wire it up to a dictionary or whatever later. */
|
/* !!! FIXME: this is leaking the stream for now. We'll wire it up to a dictionary or whatever later. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ test_multi_audio(SDL_AudioDeviceID *devices, int devcount)
|
||||||
if ((stream = SDL_OpenAudioDeviceStream(devices[i], &spec, NULL, NULL)) == NULL) {
|
if ((stream = SDL_OpenAudioDeviceStream(devices[i], &spec, NULL, NULL)) == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Audio stream creation failed: %s", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Audio stream creation failed: %s", SDL_GetError());
|
||||||
} else {
|
} else {
|
||||||
SDL_ResumeAudioDevice(SDL_GetAudioStreamBinding(stream));
|
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream));
|
||||||
SDL_PutAudioStreamData(stream, sound, soundlen);
|
SDL_PutAudioStreamData(stream, sound, soundlen);
|
||||||
SDL_FlushAudioStream(stream);
|
SDL_FlushAudioStream(stream);
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
|
@ -107,7 +107,7 @@ test_multi_audio(SDL_AudioDeviceID *devices, int devcount)
|
||||||
/* try to start all the devices about the same time. SDL does not guarantee sync across physical devices. */
|
/* try to start all the devices about the same time. SDL does not guarantee sync across physical devices. */
|
||||||
for (i = 0; i < devcount; i++) {
|
for (i = 0; i < devcount; i++) {
|
||||||
if (streams[i]) {
|
if (streams[i]) {
|
||||||
SDL_ResumeAudioDevice(SDL_GetAudioStreamBinding(streams[i]));
|
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(streams[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ int main(int argc, char *argv[])
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_OpenAudioDeviceStream() failed: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_OpenAudioDeviceStream() failed: %s\n", SDL_GetError());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
SDL_ResumeAudioDevice(SDL_GetAudioStreamBinding(stream));
|
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream));
|
||||||
|
|
||||||
for (j = 0; j < total_channels; j++) {
|
for (j = 0; j < total_channels; j++) {
|
||||||
const int sine_freq = is_lfe_channel(j, total_channels) ? LFE_SINE_FREQ_HZ : SINE_FREQ_HZ;
|
const int sine_freq = is_lfe_channel(j, total_channels) ? LFE_SINE_FREQ_HZ : SINE_FREQ_HZ;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue