aboutsummaryrefslogtreecommitdiff
path: root/sound/mods
diff options
context:
space:
mode:
Diffstat (limited to 'sound/mods')
-rw-r--r--sound/mods/module.cpp10
-rw-r--r--sound/mods/module.h3
-rw-r--r--sound/mods/protracker.cpp8
-rw-r--r--sound/mods/protracker.h1
4 files changed, 20 insertions, 2 deletions
diff --git a/sound/mods/module.cpp b/sound/mods/module.cpp
index f7f343fde5..4c20c3a741 100644
--- a/sound/mods/module.cpp
+++ b/sound/mods/module.cpp
@@ -46,6 +46,14 @@ bool Module::load(const char *fn) {
Common::MemoryReadStream st(buf, bufsz);
+ bool result = loadStream(st);
+
+ delete[] buf;
+
+ return result;
+}
+
+bool Module::loadStream(Common::SeekableReadStream &st) {
st.read(songname, 20);
songname[0] = '\0';
@@ -155,8 +163,6 @@ bool Module::load(const char *fn) {
assert(st.eos());
- delete[] buf;
-
return true;
}
diff --git a/sound/mods/module.h b/sound/mods/module.h
index f16d3eb4f4..4073d5d4ec 100644
--- a/sound/mods/module.h
+++ b/sound/mods/module.h
@@ -24,6 +24,8 @@
#ifndef SOUND_MODS_MODULE_H
#define SOUND_MODS_MODULE_H
+#include "common/file.h"
+
namespace Modules {
/*
@@ -68,6 +70,7 @@ public:
~Module();
bool load(const char *fn);
+ bool loadStream(Common::SeekableReadStream &st);
};
} // End of namespace Modules
diff --git a/sound/mods/protracker.cpp b/sound/mods/protracker.cpp
index 2a308407e4..8948ae4c20 100644
--- a/sound/mods/protracker.cpp
+++ b/sound/mods/protracker.cpp
@@ -78,6 +78,14 @@ void ProtrackerPlayer::loadModule(const char *fn) {
_module->load(fn);
}
+void ProtrackerPlayer::loadModuleStream(Common::SeekableReadStream &fs) {
+ if (_module)
+ delete _module;
+
+ _module = new Module();
+ _module->loadStream(fs);
+}
+
void ProtrackerPlayer::generateSound() {
_generatedSamplesOverflow += 5.0 * 44100.0 / (2.0 * _bpm);
int samples = (int)floor(_generatedSamplesOverflow);
diff --git a/sound/mods/protracker.h b/sound/mods/protracker.h
index 070f972d4a..c6511e8a47 100644
--- a/sound/mods/protracker.h
+++ b/sound/mods/protracker.h
@@ -139,6 +139,7 @@ public:
void stop();
void loadModule(const char *fn);
+ void loadModuleStream(Common::SeekableReadStream &fs);
void mix(byte *buf, int len);