Update log statements

This commit is contained in:
2024-10-17 03:16:41 +08:00
parent f9cf93eaee
commit 9a5486c03c
2 changed files with 27 additions and 22 deletions
+4 -10
View File
@@ -83,13 +83,11 @@ int audio_playback_init(audio_state* state)
void audio_recording_callback(void* userdata, uint8_t* stream, int len)
{
char string[64];
audio_state* state = userdata;
int space_left = state->recording_buffer_size - state->recording_buffer_position;
if (space_left <= 0) {
sprintf(string, "Stopping recording ID: %i", state->recording_device_id);
log_message(LOG_INFO, string);
log_message(LOG_INFO, "Stopping recording ID: %i", state->recording_device_id);
SDL_PauseAudioDevice(state->recording_device_id, 1);
return;
}
@@ -101,19 +99,16 @@ void audio_recording_callback(void* userdata, uint8_t* stream, int len)
memcpy(&state->recording_buffer[state->recording_buffer_position], stream, len);
state->recording_buffer_position += len;
sprintf(string, "Record pos: %u/%u (%u)", state->recording_buffer_position, state->recording_buffer_size, len);
log_message(LOG_INFO, string);
log_message(LOG_INFO, "Record pos: %u/%u (%u)", state->recording_buffer_position, state->recording_buffer_size, len);
}
void audio_playback_callback(void* userdata, uint8_t* stream, int len)
{
char string[64];
audio_state* state = userdata;
int space_left = state->recording_buffer_size - state->recording_buffer_position;
if (space_left <= 0) {
sprintf(string, "Stopping playback ID: %i", state->recording_device_id);
log_message(LOG_INFO, string);
log_message(LOG_INFO, "Stopping playback ID: %i", state->recording_device_id);
SDL_PauseAudioDevice(state->playback_device_id, 1);
return;
}
@@ -125,6 +120,5 @@ void audio_playback_callback(void* userdata, uint8_t* stream, int len)
memcpy(stream, &state->recording_buffer[state->recording_buffer_position], len);
state->recording_buffer_position += len;
sprintf(string, "Playback pos: %u/%u (%u)", state->recording_buffer_position, state->recording_buffer_size, len);
log_message(LOG_INFO, string);
log_message(LOG_INFO, "Playback pos: %u/%u (%u)", state->recording_buffer_position, state->recording_buffer_size, len);
}