Implement audio filters

Use Source:setFilter(type, params...) to set a filter.
Use Source:setFilter() to detach the current filter.
Use Source:getFilter() to get the currently set filter (or nil).

Squashed from pull request 27, and the clean-pr27 branch in love-experiments.

--HG--
branch : minor
This commit is contained in:
Raidho
2016-12-03 20:54:48 +01:00
parent e5aad03f2d
commit 332ba76e62
15 changed files with 667 additions and 2 deletions
+9
View File
@@ -25,8 +25,11 @@
#include "common/config.h"
#include "common/Object.h"
#include "audio/Source.h"
#include "audio/Filter.h"
#include "sound/SoundData.h"
#include "sound/Decoder.h"
#include "Audio.h"
#include "Filter.h"
// STL
#include <vector>
@@ -141,6 +144,10 @@ public:
virtual float getMaxDistance() const;
virtual int getChannels() const;
virtual bool setFilter(love::audio::Filter::Type type, std::vector<float> &params);
virtual bool setFilter();
virtual bool getFilter(love::audio::Filter::Type &type, std::vector<float> &params);
virtual int getFreeBufferCount() const;
virtual bool queue(void *data, size_t length, int dataSampleRate, int dataBitDepth, int dataChannels);
virtual bool queueAtomic(void *data, ALsizei length);
@@ -214,6 +221,8 @@ private:
int unusedBufferTop = -1;
ALsizei bufferedBytes = 0;
Filter *filter = nullptr;
}; // Source
} // openal