mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 20:13:36 +00:00
Added missing IBuffer::Destroy(), added IEnvironment::GetBuffer(), and
bumped SDK revision.
This commit is contained in:
parent
26edd36087
commit
0ed02330f8
@ -70,6 +70,7 @@ class DrainBuffer :
|
||||
virtual void SetSamples(long samples) { this->samples = samples; }
|
||||
virtual long Bytes() const { return this->samples * sizeof(float); }
|
||||
virtual void OnBufferProcessed(IBuffer *buffer) { }
|
||||
virtual void Destroy() { delete this; }
|
||||
|
||||
private:
|
||||
int channels, samples, rate;
|
||||
|
@ -56,16 +56,17 @@ namespace musik { namespace core { namespace audio {
|
||||
|
||||
virtual ~Buffer();
|
||||
|
||||
virtual long SampleRate() const;
|
||||
virtual void SetSampleRate(long sampleRate);
|
||||
virtual int Channels() const;
|
||||
virtual void SetChannels(int channels);
|
||||
virtual float* BufferPointer() const;
|
||||
virtual long Samples() const;
|
||||
virtual void SetSamples(long samples);
|
||||
virtual long Bytes() const;
|
||||
virtual double Position() const;
|
||||
virtual long SampleRate() const override;
|
||||
virtual void SetSampleRate(long sampleRate) override;
|
||||
virtual int Channels() const override;
|
||||
virtual void SetChannels(int channels) override;
|
||||
virtual float* BufferPointer() const override;
|
||||
virtual long Samples() const override;
|
||||
virtual void SetSamples(long samples) override;
|
||||
virtual long Bytes() const override;
|
||||
virtual void Destroy() override { delete this; }
|
||||
|
||||
double Position() const;
|
||||
void SetPosition(double position);
|
||||
void Copy(float* buffer, long samples);
|
||||
void Append(float* buffer, long samples);
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <core/support/Preferences.h>
|
||||
|
||||
#include <core/io/DataStreamFactory.h>
|
||||
#include <core/audio/Buffer.h>
|
||||
#include <core/audio/Streams.h>
|
||||
|
||||
#include <core/library/LocalSimpleDataProvider.h>
|
||||
@ -73,6 +74,14 @@ static class Environment : public IEnvironment {
|
||||
virtual IDecoder* GetDecoder(IDataStream* stream) override {
|
||||
return streams::GetDecoderForDataStream(stream);
|
||||
}
|
||||
|
||||
virtual IBuffer* GetBuffer(size_t samples, size_t rate = 44100, size_t channels = 2) override {
|
||||
musik::core::audio::Buffer* buffer = new Buffer();
|
||||
buffer->SetChannels(2);
|
||||
buffer->SetSampleRate(rate);
|
||||
buffer->SetSamples(samples);
|
||||
return buffer;
|
||||
}
|
||||
} environment;
|
||||
|
||||
typedef void(*SetEnvironment)(IEnvironment*);
|
||||
|
@ -46,6 +46,7 @@ namespace musik { namespace core { namespace sdk {
|
||||
virtual long Samples() const = 0;
|
||||
virtual void SetSamples(long samples) = 0;
|
||||
virtual long Bytes() const = 0;
|
||||
virtual void Destroy() = 0;
|
||||
};
|
||||
|
||||
} } }
|
||||
|
@ -45,6 +45,7 @@ namespace musik { namespace core { namespace sdk {
|
||||
virtual size_t GetPath(PathType type, char* dst, int size) = 0;
|
||||
virtual IDataStream* GetDataStream(const char* uri) = 0;
|
||||
virtual IDecoder* GetDecoder(IDataStream* stream) = 0;
|
||||
virtual IBuffer* GetBuffer(size_t samples, size_t rate = 44100, size_t channels = 2) = 0;
|
||||
};
|
||||
|
||||
} } }
|
||||
|
@ -133,5 +133,5 @@ namespace musik {
|
||||
static const char* ExternalId = "external_id";
|
||||
}
|
||||
|
||||
static const int SdkVersion = 6;
|
||||
static const int SdkVersion = 7;
|
||||
} } }
|
||||
|
Loading…
Reference in New Issue
Block a user