diff --git a/source/mini/audio/jail_audio.cpp b/source/backends/SDL3/audio.cpp similarity index 99% rename from source/mini/audio/jail_audio.cpp rename to source/backends/SDL3/audio.cpp index 36f7da6..60d3fcb 100644 --- a/source/mini/audio/jail_audio.cpp +++ b/source/backends/SDL3/audio.cpp @@ -1,6 +1,6 @@ -#ifndef JA_USESDLMIXER -#include "jail_audio.h" +#if BACKEND == SDL3 +#include "backends/backend.h" #include "external/stb_vorbis.h" #include "other/log.h" @@ -11,7 +11,7 @@ // structs i variables // ============================= -namespace jail +namespace backend { namespace audio { @@ -83,7 +83,7 @@ namespace jail // Funcions // ================== -namespace jail +namespace backend { namespace audio { diff --git a/source/backends/backend.h b/source/backends/backend.h index ccf1a2b..fc9d3c7 100644 --- a/source/backends/backend.h +++ b/source/backends/backend.h @@ -33,13 +33,6 @@ namespace backend void cursor(const bool value); } - namespace audio - { - void init(); - void quit(); - void render(); - } - namespace input { void reset(); @@ -74,4 +67,53 @@ namespace backend int press(); } } + + namespace audio + { + void init(); + void quit(); + + namespace music + { + enum state { invalid, playing, paused, stopped, disabled }; + + int load(const char* filename); + int load(const uint8_t* buffer, uint32_t length); + void play(int mus, int loop = -1); + void pause(); + void resume(); + void stop(); + void fadeOut(int milliseconds); + state getState(); + void destroy(int mus); + float setVolume(float vol); + void setPosition(float value); + float getPosition(); + void enable(bool value); + bool isEnabled(); + } + + namespace sound + { + int create(uint8_t* buffer, uint32_t length); + int load(uint8_t* buffer, uint32_t length); + int load(const char* filename); + int play(int snd, int loop = 0); + int playOnChannel(int snd, int chan, int loop = 0); + void destroy(int snd); + float setVolume(float vol); + void enable(bool value); + bool isEnabled(); + + namespace channel + { + enum state { invalid, free, playing, paused, disabled }; + void pause(int chan); + void resume(int chan); + void stop(int chan); + state getState(int chan); + } + } + } + } diff --git a/source/mini/audio/audio.cpp b/source/mini/audio/audio.cpp index 17e5979..5a23d89 100644 --- a/source/mini/audio/audio.cpp +++ b/source/mini/audio/audio.cpp @@ -1,5 +1,5 @@ #include "audio.h" -#include "jail_audio.h" +#include "backends/backend.h" #include "mini/file/file.h" namespace mini @@ -7,18 +7,13 @@ namespace mini namespace audio { int current_music = -1; - //#define MAX_SOUNDS 50 - //JA_Sound_t *sounds[MAX_SOUNDS]; void init() { - jail::audio::init(); - //for (int i=0;i - -namespace jail -{ - namespace audio - { - void init(/*const int freq, const SDL_AudioFormat format, const int channels*/); - void quit(); - - namespace music - { - //struct JA_Music_t; - enum state { invalid, playing, paused, stopped, disabled }; - - int load(const char* filename); - int load(const uint8_t* buffer, uint32_t length); - void play(int mus, int loop = -1); - void pause(); - void resume(); - void stop(); - void fadeOut(int milliseconds); - state getState(); - void destroy(int mus); - float setVolume(float vol); - void setPosition(float value); - float getPosition(); - void enable(bool value); - bool isEnabled(); - } - - namespace sound - { - //struct JA_Sound_t; - int create(uint8_t* buffer, uint32_t length); - int load(uint8_t* buffer, uint32_t length); - int load(const char* filename); - int play(int snd, int loop = 0); - int playOnChannel(int snd, int chan, int loop = 0); - void destroy(int snd); - float setVolume(float vol); - void enable(bool value); - bool isEnabled(); - - namespace channel - { - enum state { invalid, free, playing, paused, disabled }; - void pause(int chan); - void resume(int chan); - void stop(int chan); - state getState(int chan); - } - } - } -} - - diff --git a/source/mini/version.h b/source/mini/version.h index efebd08..4a8368a 100644 --- a/source/mini/version.h +++ b/source/mini/version.h @@ -1,3 +1,3 @@ #pragma once -#define MINI_VERSION "1.5.8" +#define MINI_VERSION "1.5.9" diff --git a/source/mini/win/win.cpp b/source/mini/win/win.cpp index 02049ac..3e35932 100644 --- a/source/mini/win/win.cpp +++ b/source/mini/win/win.cpp @@ -2,7 +2,7 @@ #include "other/log.h" #include "mini/file/file.h" #include "mini/shader/shader.h" -#include +#include "backends/backend.h" #include