diff --git a/audio.c b/audio.c index 5001dd8..f9d8a8a 100644 --- a/audio.c +++ b/audio.c @@ -1,8 +1,6 @@ #include "audio.h" #include "log.h" -const int MAX_RECORDING_SECONDS = 1; - static SDL_AudioSpec recording_spec; static SDL_AudioSpec playback_spec; static SDL_AudioSpec received_recording_spec; diff --git a/audio.h b/audio.h index d1afbfa..7575098 100644 --- a/audio.h +++ b/audio.h @@ -3,6 +3,8 @@ #include +#define MAX_RECORDING_SECONDS 2 + typedef struct audio_state { int recording_device_id; int playback_device_id; diff --git a/main.c b/main.c index e860762..48d588a 100644 --- a/main.c +++ b/main.c @@ -5,8 +5,8 @@ #include "texture.h" #include "audio.h" -const int SCREEN_WIDTH = 640; -const int SCREEN_HEIGHT = 480; +#define SCREEN_WIDTH 640 +#define SCREEN_HEIGHT 480 typedef enum { SELECTING_DEVICE, @@ -24,7 +24,6 @@ typedef struct state { int init(); void destroy(); int select_device(SDL_KeyboardEvent* key_event, int max_index); - void application_state_to_string(application_state state, char* string); SDL_Window* window = NULL; @@ -112,14 +111,16 @@ int main(int argc, char* argv[]) } cleanup: - printf("Cleanup\n"); + printf("Cleanup start\n"); audio_destroy(&state.audio); + printf("Audio done\n"); text_texture_free(&display_text_texture); for (int i = 0; i < num_devices; i++) { text_texture_free(&device_textures[i]); } + printf("Texture done\n"); destroy(); - + printf("Done\n"); return 0; } @@ -253,8 +254,11 @@ int init() void destroy() { SDL_DestroyRenderer(renderer); + printf("Renderer done\n"); SDL_DestroyWindow(window); + printf("Window done\n"); TTF_Quit(); + printf("TTF done\n"); SDL_Quit(); } @@ -286,13 +290,13 @@ void application_state_to_string(application_state state, char* string) sprintf(string, "Selecting Device [0-9] -> [y/RET], "); break; case RECORDING: - sprintf(string, "Recording [ESC] to cancel"); + sprintf(string, "Recording [ESC]: CANCEL"); break; case RECORDED: - sprintf(string, "Recorded [y/RET] to play [ESC] to Select"); + sprintf(string, "Recorded [y/RET]: PLAY | [ESC]: SELECT"); break; case PLAYBACK: - sprintf(string, "Playing"); + sprintf(string, "Playing [ESC]: CANCEL"); break; } } diff --git a/makefile b/makefile index e33dda6..433cbf8 100644 --- a/makefile +++ b/makefile @@ -21,13 +21,8 @@ $(OBJS): $(OBJD)/%.o: %.c mkdir -p $(@D) $(CC) $(CCFLAGS) -c $? -o $@ -TARGET1 = test - -$(TARGET1): example-test-code/audiotest.c - $(CC) $(CCFLAGS) $^ -o $(TARGET1) $(LDFLAGS) - clean: - rm -r $(TARGET) $(TARGET1) $(test) $(OBJD) + rm -r $(TARGET) $(TARGET1) $(OBJD) run: $(TARGET) ./$(TARGET)