Update function names + use new function

This commit is contained in:
Sheldon Lee 2024-11-04 23:11:42 +08:00
parent ebc1a4e1ac
commit 1b5e58d95a

10
main.c
View File

@ -143,7 +143,7 @@ int handle_input(SDL_Event* event, state* state)
if (state->device_index == -1 || !state->audio.recording_device_id) break;
audio_buffer_reset(&state->audio);
state->audio.recording_buffer_position = 0;
audio_playback_pause(&state->audio, 1, 0);
audio_device_pause(&state->audio, 1, 0);
state->application_state = RECORDING;
state->update_ui = 1;
break;
@ -156,7 +156,7 @@ int handle_input(SDL_Event* event, state* state)
if (device_index_new == -1) break;
if (device_index_new == state->device_index) break;
state->device_index = device_index_new;
SDL_CloseAudioDevice(state->audio.recording_device_id);
audio_device_close(&state->audio, 1);
audio_recording_init(&state->audio, state->device_index);
state->update_ui = 1;
@ -166,7 +166,7 @@ int handle_input(SDL_Event* event, state* state)
switch (keysym) {
case SDLK_q:
case SDLK_ESCAPE:
audio_playback_pause(&state->audio, 1, 1);
audio_device_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;
audio_playback_pause(&state->audio, 0, 0);
audio_device_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:
audio_playback_pause(&state->audio, 0, 1);
audio_device_pause(&state->audio, 0, 1);
state->application_state = RECORDED;
state->update_ui = 1;
break;