diff options
Diffstat (limited to 'drumgizmo/output/wavfile')
-rw-r--r-- | drumgizmo/output/wavfile/wavfile.cc | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/drumgizmo/output/wavfile/wavfile.cc b/drumgizmo/output/wavfile/wavfile.cc index cb95715..fa4128e 100644 --- a/drumgizmo/output/wavfile/wavfile.cc +++ b/drumgizmo/output/wavfile/wavfile.cc @@ -44,6 +44,7 @@ public: void pre(size_t size); void run(int channel, sample_t* data, size_t size); void post(size_t size); + size_t samplerate(); private: SF_INFO sf_info; @@ -58,6 +59,10 @@ WavFile::WavFile() { fh = NULL; filename = "output"; + + sf_info.channels = 1;//channels; + sf_info.format = SF_FORMAT_WAV | SF_FORMAT_FLOAT; + sf_info.samplerate = 44100; } WavFile::~WavFile() @@ -74,10 +79,6 @@ WavFile::~WavFile() bool WavFile::init(int channels, char *cnames[]) { this->channels = channels; - - sf_info.channels = 1;//channels; - sf_info.format = SF_FORMAT_WAV | SF_FORMAT_FLOAT; - sf_info.samplerate = 44100; fh = (SNDFILE **)malloc(sizeof(SNDFILE *)*channels); @@ -102,6 +103,7 @@ bool WavFile::init(int channels, char *cnames[]) void WavFile::setParm(std::string parm, std::string value) { if(parm == "file") filename = value; + if(parm == "srate") sf_info.samplerate = atoi(value.c_str()); } bool WavFile::start() @@ -126,6 +128,11 @@ void WavFile::post(size_t size) { } +size_t WavFile::samplerate() +{ + return sf_info.samplerate; +} + extern "C" { void *create() { @@ -179,21 +186,10 @@ extern "C" { WavFile *sndfile = (WavFile*)h; sndfile->post(s); } -} - -#ifdef TEST_AUDIOOUTPUTENGINESNDFILE -//Additional dependency files -//deps: -//Required cflags (autoconf vars may be used) -//cflags: -//Required link options (autoconf vars may be used) -//libs: -#include "test.h" - -TEST_BEGIN; - -// TODO: Put some testcode here (see test.h for usable macros). -TEST_END; - -#endif/*TEST_AUDIOOUTPUTENGINESNDFILE*/ + size_t samplerate(void *h) + { + WavFile *wavfile = (WavFile*)h; + return wavfile->samplerate(); + } +} |