#pragma once
#include <stdint.h>

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);
            }
        }
    }
}


