]> git.lizzy.rs Git - nothing.git/commitdiff
(#132) remove dead sound_sample entity
authorrexim <reximkut@gmail.com>
Thu, 29 Mar 2018 20:34:47 +0000 (03:34 +0700)
committerrexim <reximkut@gmail.com>
Thu, 29 Mar 2018 20:34:47 +0000 (03:34 +0700)
CMakeLists.txt
src/main.c
src/sound_sample.c [deleted file]
src/sound_sample.h [deleted file]

index ddd347840d9ebf4c755f3f045d828e9a8d28277e..0d6ef0570967a96fb9c28ce634d0d755d0a9df2e 100644 (file)
@@ -37,7 +37,6 @@ set(SOURCE_FILES
   src/lava.c
   src/wavy_rect.c
   src/sound_medium.c
-  src/sound_sample.c
   src/path.c
 )
 
@@ -62,7 +61,6 @@ set(HEADER_FILES
   src/lava.h
   src/wavy_rect.h
   src/sound_medium.h
-  src/sound_sample.h
   src/path.h
 )
 
index 84d2720856826602e784aa56aeb4bbe4afbf2e2c..0d6ba9006310f3aa8d29a6fab3d4120b2551510f 100644 (file)
@@ -11,7 +11,6 @@
 #include "./lt.h"
 #include "./path.h"
 #include "./point.h"
-#include "./sound_sample.h"
 #include "./sound_medium.h"
 
 #define SCREEN_WIDTH 800
diff --git a/src/sound_sample.c b/src/sound_sample.c
deleted file mode 100644 (file)
index 5e44deb..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-
-#include <SDL2/SDL.h>
-#include <SDL2/SDL_mixer.h>
-
-#include "./lt.h"
-#include "./sound_sample.h"
-#include "./error.h"
-
-struct sound_sample_t
-{
-    lt_t *lt;
-    Mix_Chunk *chunk;
-};
-
-sound_sample_t *create_sound_sample_from_file(const char *filepath)
-{
-    assert(filepath);
-
-    lt_t *lt = create_lt();
-    if (lt == NULL) {
-        return NULL;
-    }
-
-    sound_sample_t *sound_sample = PUSH_LT(lt, malloc(sizeof(sound_sample_t)), free);
-    if (sound_sample == NULL) {
-        throw_error(ERROR_TYPE_LIBC);
-        RETURN_LT(lt, NULL);
-    }
-
-    sound_sample->chunk = PUSH_LT(lt, Mix_LoadWAV(filepath), Mix_FreeChunk);
-    if (sound_sample->chunk == NULL) {
-        throw_error(ERROR_TYPE_SDL2_MIXER);
-        RETURN_LT(lt, NULL);
-    }
-
-    sound_sample->lt = lt;
-
-    return sound_sample;
-}
-
-void destroy_sound_sample(sound_sample_t *sound_sample)
-{
-    assert(sound_sample);
-    RETURN_LT0(sound_sample->lt);
-}
-
-int sound_sample_play(sound_sample_t *sound_sample, int channel)
-{
-    assert(sound_sample);
-    return Mix_PlayChannel(channel, sound_sample->chunk, 1);
-}
diff --git a/src/sound_sample.h b/src/sound_sample.h
deleted file mode 100644 (file)
index 839b462..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef SOUND_SAMPLE_H_
-#define SOUND_SAMPLE_H_
-
-typedef struct sound_sample_t sound_sample_t;
-
-sound_sample_t *create_sound_sample_from_file(const char *filepath);
-void destroy_sound_sample(sound_sample_t *sound_sample);
-int sound_sample_play(sound_sample_t *sound_sample, int channel);
-
-#endif  // SOUND_SAMPLE_H_