Refactor and move more audio specific code to audio.c
This commit is contained in:
@@ -141,9 +141,9 @@ int handle_input(SDL_Event* event, state* state)
|
||||
case SDLK_y:
|
||||
case SDLK_RETURN:
|
||||
if (state->device_index == -1 || !state->audio.recording_device_id) break;
|
||||
memset(state->audio.recording_buffer, 0, state->audio.recording_buffer_size);
|
||||
audio_buffer_reset(&state->audio);
|
||||
state->audio.recording_buffer_position = 0;
|
||||
SDL_PauseAudioDevice(state->audio.recording_device_id, 0);
|
||||
audio_playback_pause(&state->audio, 1, 0);
|
||||
state->application_state = RECORDING;
|
||||
state->update_ui = 1;
|
||||
break;
|
||||
@@ -166,7 +166,7 @@ int handle_input(SDL_Event* event, state* state)
|
||||
switch (keysym) {
|
||||
case SDLK_q:
|
||||
case SDLK_ESCAPE:
|
||||
SDL_PauseAudioDevice(state->audio.recording_device_id, 1);
|
||||
audio_playback_pause(&state->audio, 1, 1);
|
||||
state->application_state = SELECTING_DEVICE;
|
||||
state->update_ui = 1;
|
||||
break;
|
||||
@@ -180,7 +180,7 @@ int handle_input(SDL_Event* event, state* state)
|
||||
if (!state->audio.playback_device_id)
|
||||
audio_playback_init(&state->audio);
|
||||
state->audio.recording_buffer_position = 0;
|
||||
SDL_PauseAudioDevice(state->audio.playback_device_id, 0);
|
||||
audio_playback_pause(&state->audio, 0, 0);
|
||||
state->application_state = PLAYBACK;
|
||||
state->update_ui = 1;
|
||||
break;
|
||||
@@ -196,7 +196,7 @@ int handle_input(SDL_Event* event, state* state)
|
||||
switch (keysym) {
|
||||
case SDLK_q:
|
||||
case SDLK_ESCAPE:
|
||||
SDL_PauseAudioDevice(state->audio.playback_device_id, 1);
|
||||
audio_playback_pause(&state->audio, 0, 1);
|
||||
state->application_state = RECORDED;
|
||||
state->update_ui = 1;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user