aboutsummaryrefslogtreecommitdiff
path: root/sound/mods/tfmx.h
diff options
context:
space:
mode:
authorNorbert Lange2009-08-02 00:03:42 +0000
committerNorbert Lange2009-08-02 00:03:42 +0000
commit92d292a3f66fa6b0e85ae5a870d44b4d9762f946 (patch)
tree93515cab0714fd6e6a4ccfbd235b8319e3ec2eed /sound/mods/tfmx.h
parent59395eb6b61aff29fe438ab4a56b10c94fdd9fc8 (diff)
downloadscummvm-rg350-92d292a3f66fa6b0e85ae5a870d44b4d9762f946.tar.gz
scummvm-rg350-92d292a3f66fa6b0e85ae5a870d44b4d9762f946.tar.bz2
scummvm-rg350-92d292a3f66fa6b0e85ae5a870d44b4d9762f946.zip
made MdatResource struct private and changed the signatures of functions which load the resources.
svn-id: r42982
Diffstat (limited to 'sound/mods/tfmx.h')
-rw-r--r--sound/mods/tfmx.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/sound/mods/tfmx.h b/sound/mods/tfmx.h
index 3f3d982ba6..f7905b70b9 100644
--- a/sound/mods/tfmx.h
+++ b/sound/mods/tfmx.h
@@ -31,6 +31,8 @@
namespace Audio {
class Tfmx : public Paula {
+private:
+ struct MdatResource;
public:
Tfmx(int rate, bool stereo);
virtual ~Tfmx();
@@ -44,23 +46,27 @@ public:
void setSignalPtr(uint16 *ptr, uint16 numSignals) { _playerCtx.signal = ptr; _playerCtx.numSignals = numSignals; }
void stopMacroEffect(int channel);
- struct MdatResource;
+ void freeResources() { _deleteResource = true; freeResourceDataImpl(); }
bool load(Common::SeekableReadStream &musicData, Common::SeekableReadStream &sampleData, bool autoDelete = true);
void setModuleData(Tfmx &otherPlayer);
- void setModuleData(const MdatResource *resource, const int8 *sampleData, uint32 sampleLen, bool autoDelete = true);
- static bool loadMdatFile(MdatResource &resource, Common::SeekableReadStream &musicData);
- static bool loadSampleFile(int8 *&sampleData, uint32 &sampleLen, Common::SeekableReadStream &sampleStream);
+ /* must be called with resources loaded by loadMdatFile */
+ void setModuleDataVoid(const void *resource, const int8 *sampleData, uint32 sampleLen, bool autoDelete = true) {
+ setModuleData((const MdatResource *)resource, sampleData, sampleLen, autoDelete);
+ }
+
+ static const MdatResource *loadMdatFile(Common::SeekableReadStream &musicData);
+ static const int8 *loadSampleFile(uint32 &sampleLen, Common::SeekableReadStream &sampleStream);
protected:
void interrupt();
private:
+ void setModuleData(const MdatResource *resource, const int8 *sampleData, uint32 sampleLen, bool autoDelete = true);
+
enum { kPalDefaultCiaVal = 11822, kNtscDefaultCiaVal = 14320, kCiaBaseInterval = 0x1B51F8 };
enum { kNumVoices = 4, kNumChannels = 8, kNumSubsongs = 32, kMaxPatternOffsets = 128, kMaxMacroOffsets = 128 };
-
static const uint16 noteIntervalls[64];
-public: // TODO change this to private somehow=
struct MdatResource {
const byte *mdatAlloc; //!< allocated Block of Memory
const byte *mdatData; //!< Start of mdat-File, might point before mdatAlloc to correct Offset
@@ -85,10 +91,7 @@ public: // TODO change this to private somehow=
void boundaryCheck(const void *address, size_t accessLen = 1) const {
assert(mdatAlloc <= address && (const byte *)address + accessLen <= (const byte *)mdatData + mdatLen);
}
- };
-
-private:
- const MdatResource *_resource;
+ } const *_resource;
struct SampleResource {
const int8 *sampleData; //!< The whole sample-File
@@ -300,7 +303,7 @@ private:
}
- void freeResourceData();
+ void freeResourceDataImpl();
void effects(ChannelContext &channel);
void macroRun(ChannelContext &channel);
void advancePatterns();