Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-05-18 09:21:20 +0000
committerStijn Buys <ingar@osirion.org>2008-05-18 09:21:20 +0000
commit4a2bad92171ff8a9a248599f47087cfe39e93653 (patch)
treeb8a4fe7f616b3e4f707d89a35fff5e8b5fdcfcc8 /src/audio/pcm.cc
parenta185c11f2397c0296a4b62cc266b4fa00a63c1e2 (diff)
OpenAL support
Diffstat (limited to 'src/audio/pcm.cc')
-rw-r--r--src/audio/pcm.cc49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/audio/pcm.cc b/src/audio/pcm.cc
new file mode 100644
index 0000000..b485199
--- /dev/null
+++ b/src/audio/pcm.cc
@@ -0,0 +1,49 @@
+/*
+ audio/pcm.cc
+ This file is part of the Osirion project and is distributed under
+ the terms of the GNU General Public License version 2
+*/
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "audio/pcm.h"
+#include "audio/wav.h"
+
+namespace audio {
+
+PCM::PCM(unsigned int samplerate, unsigned int bitspersample, unsigned int channels, size_t size)
+{
+ pcm_bitspersample = bitspersample;
+ pcm_samplerate = samplerate;
+ pcm_size = size;
+ pcm_channels = channels;
+
+ pcm_data = (unsigned char *) malloc(pcm_size);
+ clear();
+}
+
+PCM::~PCM()
+{
+ free(pcm_data);
+}
+
+void PCM::clear()
+{
+ memset(pcm_data, 0, pcm_size);
+}
+
+void PCM::load(const char *name)
+{
+ PCM *pcm = Wav::load(name);
+ if (pcm) {
+ delete pcm;
+ }
+}
+
+void PCM::load(std::string const & name)
+{
+ load(name.c_str());
+}
+
+}