summaryrefslogtreecommitdiff
path: root/src/sample.cc
diff options
context:
space:
mode:
authordeva <deva>2011-03-01 19:19:02 +0000
committerdeva <deva>2011-03-01 19:19:02 +0000
commite190d38057892b69246391841b234a368bc2b4ad (patch)
tree34f946bc1c3b86997d4cd45e63c433ef07b36486 /src/sample.cc
parentc393edc920f8ee126d1bced3500b6bc1ecf86f83 (diff)
MAJOR rewrite of the internals. New input/output 'plugin' system. Still a lot missing.
Diffstat (limited to 'src/sample.cc')
-rw-r--r--src/sample.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/sample.cc b/src/sample.cc
index 5a06331..f0bb099 100644
--- a/src/sample.cc
+++ b/src/sample.cc
@@ -39,3 +39,35 @@ Sample::Sample(std::string name)
Sample::~Sample()
{
}
+
+void Sample::addAudioFile(Channel *c, AudioFile *a)
+{
+ audiofiles[c] = a;
+}
+
+AudioFile *Sample::getAudioFile(Channel *c)
+{
+ if(audiofiles.find(c) == audiofiles.end()) return NULL;
+ return audiofiles[c];
+}
+
+#ifdef TEST_SAMPLE
+//deps: channel.cc audiofile.cc
+//cflags: $(SNDFILE_CFLAGS)
+//libs: $(SNDFILE_LIBS)
+#include "test.h"
+
+TEST_BEGIN;
+
+Sample s;
+InstrumentChannel c;
+InstrumentChannel c2;
+AudioFile a("test");
+
+s.addAudioFile(&c, &a);
+TEST_EQUAL(s.getAudioFile(&c), &a, "?");
+TEST_EQUAL(s.getAudioFile(&c2), NULL, "?");
+
+TEST_END;
+
+#endif/*TEST_SAMPLE*/