-/* $Id$
-
-This file is part of libmspal
-Copyright © 2008 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
+#include <msp/io/memory.h>
#include "buffer.h"
-#include "sound.h"
+#include "waveform.h"
using namespace std;
alBufferData(id, fmt, dt, size, freq);
}
+void Buffer::data(const Waveform &wave)
+{
+ data(wave.get_format(), wave.get_data(), wave.get_size(), wave.get_frequency());
+}
+
void Buffer::load_data(const string &fn)
{
- Sound sound;
- sound.load(fn);
+ Waveform wave;
+ wave.load_file(fn);
+
+ data(wave);
+}
+
+
+Buffer::Loader::Loader(Buffer &b):
+ buf(b)
+{
+ add("sound_data", &Loader::sound_data);
+}
+
+void Buffer::Loader::sound_data(const string &data)
+{
+ Waveform wave;
+ IO::Memory mem(data.data(), data.size());
+ wave.load_io(mem);
- data(sound.get_format(), sound.get_data(), sound.get_size(), sound.get_frequency());
+ buf.data(wave);
}
} // namespace AL