introduce audio_model = "push" to twn.toml
This commit is contained in:
@ -259,9 +259,8 @@ void audio_play(const char *path,
|
||||
request.format = AUDIO_F32;
|
||||
request.channels = 2;
|
||||
request.samples = 4096;
|
||||
#ifndef TWN_FEATURE_PUSH_AUDIO
|
||||
request.callback = audio_callback;
|
||||
#endif
|
||||
if (!ctx.push_audio_model)
|
||||
request.callback = audio_callback;
|
||||
/* TODO: check for errors */
|
||||
ctx.audio_device = SDL_OpenAudioDevice(NULL, 0, &request, &got, 0);
|
||||
ctx.audio_stream_format = got.format;
|
||||
@ -279,6 +278,8 @@ void audio_play(const char *path,
|
||||
ctx.audio_initialized = true;
|
||||
}
|
||||
|
||||
SDL_LockAudioDevice(ctx.audio_device);
|
||||
|
||||
if (channel) {
|
||||
AudioChannelItem *pair = shgetp_null(ctx.audio_channels, channel);
|
||||
|
||||
@ -331,6 +332,8 @@ void audio_play(const char *path,
|
||||
|
||||
arrpush(ctx.unnamed_audio_channels, new_channel);
|
||||
}
|
||||
|
||||
SDL_UnlockAudioDevice(ctx.audio_device);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user