dmuratshin 8 年之前
父節點
當前提交
d4a7a914bf

+ 0 - 7
src/sound/oal/SoundSystemOAL.cpp

@@ -106,13 +106,6 @@ namespace oxygine
     void SoundSystemOAL::pause()
     {
         log::messageln("SoundSystemOAL::pause");
-        /*
-        for (channels::iterator i = _channels.begin(); i != _channels.end(); ++i)
-        {
-            ChannelOAL& channel = *i;
-            channel.pause();
-        }
-        */
 
         StreamingOggSoundHandleOAL::clearThreadQueue();
 

+ 0 - 135
src/sound/s3e/SoundSystem_s3e.cpp

@@ -1,135 +0,0 @@
-#include "SoundSystem_s3e.h"
-#include "Channel_s3e.h"
-#include "core/log.h"
-#include "DebugActor.h"
-
-namespace oxygine
-{
-    SoundSystem* SoundSystem::instance = 0;
-    void check();
-
-    SoundSystemS3E::SoundSystemS3E(): _volume(1.0)
-    {
-
-    }
-
-    SoundSystemS3E::~SoundSystemS3E()
-    {
-
-    }
-
-
-    void SoundSystemS3E::pause()
-    {
-        for (channels::iterator i = _channels.begin(); i != _channels.end(); ++i)
-        {
-            ChannelS3E* channel = *i;
-            //channel->G
-            channel->pause();
-        }
-        check();
-    }
-
-    void SoundSystemS3E::resume()
-    {
-        for (channels::iterator i = _channels.begin(); i != _channels.end(); ++i)
-        {
-            ChannelS3E* channel = *i;
-            channel->resume();
-        }
-        check();
-    }
-
-    void SoundSystemS3E::setVolume(float v)
-    {
-        _volume = v;
-
-        for (channels::iterator i = _channels.begin(); i != _channels.end(); ++i)
-        {
-            ChannelS3E* channel = *i;
-            channel->_updateMasterVolume(v);
-        }
-        check();
-    }
-
-    void SoundSystemS3E::init(int channels_num)
-    {
-        _channels.reserve(channels_num);
-        for (int i = 0; i < channels_num; ++i)
-        {
-            ChannelS3E* channel = new ChannelS3E(this, i);
-            _channels.push_back(channel);
-        }
-        check();
-
-        log::messageln("S3E_SOUND_OUTPUT_FREQ: %d", s3eSoundGetInt(S3E_SOUND_OUTPUT_FREQ));
-    }
-
-    void SoundSystemS3E::release()
-    {
-    }
-
-    SoundS3E* SoundSystemS3E::createSound(std::vector<unsigned char>& buffer, bool swap)
-    {
-        SoundS3E* sound = 0;
-        sound = new SoundS3E();
-        sound->init(buffer, swap);
-        check();
-
-        return sound;
-    }
-
-    SoundS3E* SoundSystemS3E::createSound(const char* path)
-    {
-        SoundS3E* sound = 0;
-        sound = new SoundS3E();
-        sound->init(path);
-        check();
-
-        return sound;
-    }
-
-    void SoundSystemS3E::update()
-    {
-        for (channels::iterator i = _channels.begin(); i != _channels.end(); ++i)
-        {
-            ChannelS3E* channel = *i;
-            channel->update();
-        }
-
-        if (DebugActor::instance)
-            DebugActor::instance->addDebugString("free channels: %d/%d", getFreeChannelsNum(), (int)_channels.size());
-        check();
-    }
-
-    int SoundSystemS3E::getFreeChannelsNum()
-    {
-        int freeNum = 0;
-        for (channels::iterator i = _channels.begin(); i != _channels.end(); ++i)
-        {
-            ChannelS3E* channel = *i;
-
-            if (channel->_free)
-                ++freeNum;
-        }
-
-        return freeNum;
-    }
-
-    ChannelS3E* SoundSystemS3E::getFreeChannel()
-    {
-        for (channels::iterator i = _channels.begin(); i != _channels.end(); ++i)
-        {
-            ChannelS3E* channel = *i;
-
-            if (channel->_free)
-            {
-                check();
-                return channel;
-            }
-        }
-
-        check();
-        return 0;
-    }
-}

+ 0 - 41
src/sound/s3e/SoundSystem_s3e.h

@@ -1,41 +0,0 @@
-#pragma once
-#include "SoundSystem.h"
-#include "Channel_s3e.h"
-namespace oxygine
-{
-    typedef std::vector<ChannelS3E*> channels;
-    class SoundSystemS3E : public SoundSystem
-    {
-    public:
-        SoundSystemS3E();
-        ~SoundSystemS3E();
-
-        void init(int channels_num);
-        void release();
-
-        void pause();
-        void resume();
-
-        SoundS3E* createSound(std::vector<unsigned char>& buffer, bool swap);
-        SoundS3E* createSound(const char* path);
-
-        bool        isAvailable() const {return true;}
-        float       getVolume() const {return _volume;}
-        int         getFreeChannelsNum();
-        ChannelS3E* getFreeChannel();
-
-        void setVolume(float v);
-
-        void update();
-
-        const channels& getChannels() { return _channels; };
-
-    private:
-
-        channels _channels;
-
-        channels _pausedChannels;
-
-        float _volume;
-    };
-}

+ 0 - 112
src/sound/s3e/Sound_s3e.cpp

@@ -1,112 +0,0 @@
-#include "Sound_s3e.h"
-#include "OggStream.h"
-
-namespace oxygine
-{
-    using namespace std;
-
-    void check();
-
-    SoundS3E::SoundS3E():/*_format(AL_FORMAT_MONO16), */_timeMS(0), _rate(0), _channels(0)
-    {
-
-    }
-
-    bool SoundS3E::_init(OggStream& stream)
-    {
-        int channels = 0;
-        unsigned int pcm = 0;
-        stream.getDetails(&pcm, &_channels, &_rate, &_timeMS);
-
-        /*
-        if (channels == 1)
-            _format = AL_FORMAT_MONO16;
-        if (channels == 2)
-            _format = AL_FORMAT_STEREO16;
-        */
-        check();
-
-        int len = pcm / _rate;//len in seconds
-        //todo, fix, use only pcm?
-
-        //return;
-
-        int sizeAll = pcm * 2 * _channels;
-
-        if (sizeAll > MAX_ALLOC) //this sound would be streamed
-            return true;
-
-        vector<unsigned char>& buff = _unpackedBuffer;
-        buff.resize(sizeAll);
-
-        void* data = &buff.front();
-        size_t size = buff.size();
-
-        stream.decodeAll(data, size);
-
-        /*
-        const std::vector<unsigned char> &decoded = stream.getDecodedBuffer();
-        _unpackedBuffer = decoded;
-        */
-
-        /*
-
-        alGenBuffers(1, &_alBuffer);
-
-        alBufferData(_alBuffer, _format, &decoded.front(), (ALsizei)decoded.size(), rate);
-        check();
-        */
-
-        return false;
-    }
-
-    void SoundS3E::init(std::vector<unsigned char>& buffer, bool swap)
-    {
-        OggStream stream;
-        stream.init(&buffer.front(), buffer.size());
-
-        bool streaming = _init(stream);
-        if (streaming)
-        {
-            if (swap)
-                buffer.swap(_fileBuffer);
-            else
-                _fileBuffer = buffer;
-        }
-    }
-
-    void SoundS3E::init(const char* path)
-    {
-        _fileName = path;
-
-        OggStream stream;
-        stream.init(path);
-
-        _init(stream);
-    }
-
-    int SoundS3E::getDuration() const
-    {
-        return _timeMS;
-    }
-
-    void SoundS3E::initStream(OggStream& stream)
-    {
-        if (_fileName.empty())
-            stream.init(&_fileBuffer.front(), (unsigned int)_fileBuffer.size());
-        else
-            stream.init(_fileName.c_str());
-    }
-
-    SoundS3E::~SoundS3E()
-    {
-        /*
-        if (_alBuffer)
-        {
-            alDeleteBuffers(1, &_alBuffer);
-            _alBuffer = 0;
-        }
-        check();
-        */
-    }
-}

+ 0 - 45
src/sound/s3e/Sound_s3e.h

@@ -1,45 +0,0 @@
-#pragma once
-#include "Sound.h"
-#include <vector>
-#include <string>
-#include "s3eSound.h"
-
-namespace oxygine
-{
-    class OggStream;
-
-    class SoundS3E: public Sound
-    {
-    public:
-        SoundS3E();
-        ~SoundS3E();
-
-        void init(std::vector<unsigned char>& buffer, bool swap);
-        void init(const char* path);
-
-
-        //unsigned int  getAlBuffer() const {return _alBuffer;}
-        const std::vector<unsigned char>&   getDecodedBuffer() const {return _unpackedBuffer;}
-        int             getDuration() const;
-        int             getRate() const {return _rate;}
-        unsigned int    getFormat() const {return _format;}
-        unsigned int    getChannels() const {return _channels;}
-
-
-        void initStream(OggStream& stream);
-
-
-    private:
-        bool _init(OggStream& stream);
-
-        unsigned int _format;
-        int _rate;
-        int _timeMS;
-        int _channels;
-
-        std::string _fileName;
-
-        std::vector<unsigned char> _unpackedBuffer;
-        std::vector<unsigned char> _fileBuffer;
-    };
-}