Move SDL_CloseAudioDevice() audio.c + rename audio device pause
function.
This commit is contained in:
parent
c7b35b705d
commit
ebc1a4e1ac
12
audio.c
12
audio.c
@ -18,7 +18,7 @@ int audio_init(audio_state* state)
|
|||||||
|
|
||||||
SDL_zero(recording_spec);
|
SDL_zero(recording_spec);
|
||||||
recording_spec.freq = 44100;
|
recording_spec.freq = 44100;
|
||||||
recording_spec.format = AUDIO_S16;
|
recording_spec.format = AUDIO_S32;
|
||||||
recording_spec.channels = 2;
|
recording_spec.channels = 2;
|
||||||
recording_spec.samples = 4096;
|
recording_spec.samples = 4096;
|
||||||
recording_spec.callback = audio_recording_callback;
|
recording_spec.callback = audio_recording_callback;
|
||||||
@ -26,7 +26,7 @@ int audio_init(audio_state* state)
|
|||||||
|
|
||||||
SDL_zero(playback_spec);
|
SDL_zero(playback_spec);
|
||||||
playback_spec.freq = 44100;
|
playback_spec.freq = 44100;
|
||||||
playback_spec.format = AUDIO_S16;
|
playback_spec.format = AUDIO_S32;
|
||||||
playback_spec.channels = 2;
|
playback_spec.channels = 2;
|
||||||
playback_spec.samples = 4096;
|
playback_spec.samples = 4096;
|
||||||
playback_spec.callback = audio_playback_callback;
|
playback_spec.callback = audio_playback_callback;
|
||||||
@ -84,12 +84,18 @@ int audio_playback_init(audio_state* state)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio_playback_pause(audio_state* state, int is_recording, int is_pause)
|
void audio_device_pause(audio_state* state, int is_recording, int is_pause)
|
||||||
{
|
{
|
||||||
int device_id = is_recording ? state->recording_device_id : state->playback_device_id;
|
int device_id = is_recording ? state->recording_device_id : state->playback_device_id;
|
||||||
SDL_PauseAudioDevice(device_id, is_pause);
|
SDL_PauseAudioDevice(device_id, is_pause);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void audio_device_close(audio_state* state, int is_recording)
|
||||||
|
{
|
||||||
|
int device_id = is_recording ? state->recording_device_id : state->playback_device_id;
|
||||||
|
SDL_CloseAudioDevice(device_id);
|
||||||
|
}
|
||||||
|
|
||||||
void audio_buffer_reset(audio_state* state)
|
void audio_buffer_reset(audio_state* state)
|
||||||
{
|
{
|
||||||
memset(state->recording_buffer, 0, state->recording_buffer_size);
|
memset(state->recording_buffer, 0, state->recording_buffer_size);
|
||||||
|
3
audio.h
3
audio.h
@ -16,7 +16,8 @@ int audio_init(audio_state* state);
|
|||||||
void audio_destroy(audio_state* state);
|
void audio_destroy(audio_state* state);
|
||||||
int audio_recording_init(audio_state* state, int index);
|
int audio_recording_init(audio_state* state, int index);
|
||||||
int audio_playback_init(audio_state* state);
|
int audio_playback_init(audio_state* state);
|
||||||
void audio_playback_pause(audio_state* state, int is_recording, int pause);
|
void audio_device_pause(audio_state* state, int is_recording, int pause);
|
||||||
|
void audio_device_close(audio_state* state, int is_recording);
|
||||||
void audio_buffer_reset(audio_state* state);
|
void audio_buffer_reset(audio_state* state);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user