From f29456b04b2908201312c7f697b0f04d49b74072 Mon Sep 17 00:00:00 2001 From: rofl0r Date: Sun, 27 Apr 2014 12:37:46 +0000 Subject: [PATCH] make it possible to compile without audio/c-flod --- audio.c | 23 ++++++++++++++++------- audio.h | 14 +++++++++++++- wavesounds.c | 5 ++++- wavesounds.h | 12 ++++++++++-- 4 files changed, 43 insertions(+), 11 deletions(-) diff --git a/audio.c b/audio.c index 071e957..b73ea59 100644 --- a/audio.c +++ b/audio.c @@ -1,21 +1,20 @@ #include "audio.h" -#define AUDIO_BACKEND_AO 1 -#define AUDIO_BACKEND_SDL 2 -#ifndef AUDIO_BACKEND -#define AUDIO_BACKEND AUDIO_BACKEND_AO -#endif #if AUDIO_BACKEND == AUDIO_BACKEND_AO //RcB: SKIPON "AUDIO_BACKEND=AUDIO_BACKEND_SDL" +//RcB: SKIPON "AUDIO_BACKEND=AUDIO_BACKEND_NONE" #include "../c-flod/backends/aowriter.h" +//RcB: SKIPOFF "AUDIO_BACKEND=AUDIO_BACKEND_NONE" //RcB: SKIPOFF "AUDIO_BACKEND=AUDIO_BACKEND_SDL" #define BACKEND_STRUCT AoWriter #define BACKEND_INIT AoWriter_init #define BACKEND_CLOSE AoWriter_close #define BACKEND_WRITE AoWriter_write -#else +#elif AUDIO_BACKEND == AUDIO_BACKEND_SDL //RcB: SKIPON "AUDIO_BACKEND=AUDIO_BACKEND_AO" +//RcB: SKIPON "AUDIO_BACKEND=AUDIO_BACKEND_NONE" #include "../c-flod/backends/sdlwriter.h" +//RcB: SKIPOFF "AUDIO_BACKEND=AUDIO_BACKEND_NONE" //RcB: SKIPOFF "AUDIO_BACKEND=AUDIO_BACKEND_AO" #define BACKEND_STRUCT SdlWriter #define BACKEND_INIT SdlWriter_init @@ -23,11 +22,21 @@ #define BACKEND_WRITE SdlWriter_write #endif + +#if AUDIO_BACKEND == AUDIO_BACKEND_NONE +void audio_init(void) {} +int audio_open_music_resource(const unsigned char* data, size_t data_size, int track) { return 0; } +int audio_open_music(const char* filename, int track) { return 0; } +void audio_play_wave_resource(const WAVE_HEADER_COMPLETE* wave) {} +int audio_process(void) { return -1; } +#else +//RcB: SKIPON "AUDIO_BACKEND=AUDIO_BACKEND_NONE" #include "../c-flod/backends/wave_format.h" #include "../c-flod/neoart/flod/core/CorePlayer.h" #include "../c-flod/neoart/flod/whittaker/DWPlayer.h" #include "../c-flod/flashlib/ByteArray.h" #include "../c-flod/neoart/flod/core/Amiga.h" +//RcB: SKIPOFF "AUDIO_BACKEND=AUDIO_BACKEND_NONE" #include #include #include @@ -321,4 +330,4 @@ int audio_process(void) { return 0; } - +#endif /* AUDIO_BACKEND != AUDIO_BACKEND_NONE */ diff --git a/audio.h b/audio.h index 30da6b2..d441aa4 100644 --- a/audio.h +++ b/audio.h @@ -1,8 +1,21 @@ #ifndef AUDIO_H #define AUDIO_H +#define AUDIO_BACKEND_NONE 0 +#define AUDIO_BACKEND_AO 1 +#define AUDIO_BACKEND_SDL 2 +#ifndef AUDIO_BACKEND +#define AUDIO_BACKEND AUDIO_BACKEND_AO +#endif + #include +#if AUDIO_BACKEND != AUDIO_BACKEND_NONE +//RcB: SKIPON "AUDIO_BACKEND=AUDIO_BACKEND_NONE" #include "../c-flod/backends/wave_format.h" +//RcB: SKIPOFF "AUDIO_BACKEND=AUDIO_BACKEND_NONE" +#else +#define WAVE_HEADER_COMPLETE int +#endif void audio_init(void); int audio_open_music(const char* filename, int track); @@ -14,5 +27,4 @@ void audio_play_wave_resource(const WAVE_HEADER_COMPLETE* wave); void audio_close(void); //RcB: DEP "audio.c" - #endif diff --git a/wavesounds.c b/wavesounds.c index 8340711..136c77d 100644 --- a/wavesounds.c +++ b/wavesounds.c @@ -1,4 +1,7 @@ #include "wavesounds.h" +#if AUDIO_BACKEND == AUDIO_BACKEND_NONE +#define WAVSOUND(x, y) [x] = 0 +#else #include "sounds/pistol.c" #include "sounds/gun.c" #include "sounds/machinegun.c" @@ -11,8 +14,8 @@ #include "sounds/missionbonus.c" #include "sounds/fail.c" #include "sounds/success.c" - #define WAVSOUND(x, y) [x] = &(y .header) +#endif const WAVE_HEADER_COMPLETE* wavesounds[] = { [WS_NONE] = 0, WAVSOUND(WS_PISTOL, pistol), diff --git a/wavesounds.h b/wavesounds.h index 228bdb7..19d67d2 100644 --- a/wavesounds.h +++ b/wavesounds.h @@ -1,8 +1,6 @@ #ifndef WAVESOUNDS_H #define WAVESOUNDS_H -#include "../c-flod/backends/wave_format.h" - enum __attribute__((__packed__)) wavesound_id { WS_NONE = 0, WS_PISTOL, @@ -19,6 +17,16 @@ enum __attribute__((__packed__)) wavesound_id { WS_SUCCESS, }; +#include "audio.h" + +#if AUDIO_BACKEND != AUDIO_BACKEND_NONE +//RcB: SKIPON "AUDIO_BACKEND=AUDIO_BACKEND_NONE" +#include "../c-flod/backends/wave_format.h" +//RcB: SKIPOFF "AUDIO_BACKEND=AUDIO_BACKEND_NONE" +#else +#define WAVE_HEADER_COMPLETE int +#endif extern const WAVE_HEADER_COMPLETE* wavesounds[]; //RcB: DEP "wavesounds.c" + #endif -- 2.11.4.GIT