aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/music.h
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-12 21:02:28 -0400
committerPaul Gilbert2016-09-12 21:02:28 -0400
commitdd06b6fd7a98748d6a4c0f9f63519847dc6dd3f7 (patch)
treee41da3392fb2e9bcf67f09fa5fb1a273ea96fda5 /engines/xeen/music.h
parent48235c9055849e29e8aebf95a473bc607b398807 (diff)
downloadscummvm-rg350-dd06b6fd7a98748d6a4c0f9f63519847dc6dd3f7.tar.gz
scummvm-rg350-dd06b6fd7a98748d6a4c0f9f63519847dc6dd3f7.tar.bz2
scummvm-rg350-dd06b6fd7a98748d6a4c0f9f63519847dc6dd3f7.zip
XEEN: Implement Music playEffect method
Diffstat (limited to 'engines/xeen/music.h')
-rw-r--r--engines/xeen/music.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/engines/xeen/music.h b/engines/xeen/music.h
index 202f8ba982..40059be327 100644
--- a/engines/xeen/music.h
+++ b/engines/xeen/music.h
@@ -29,6 +29,8 @@
#include "common/mutex.h"
#include "common/queue.h"
+#define ADLIB_CHANNEL_COUNT 9
+
namespace OPL {
class OPL;
}
@@ -45,12 +47,31 @@ struct RegisterValue {
};
class Music {
+ struct Channel {
+ byte _outputLevel;
+ byte _scalingValue;
+
+ Channel() : _outputLevel(0), _scalingValue(0) {}
+ };
+private:
+ static const byte OPERATOR1_INDEXES[ADLIB_CHANNEL_COUNT];
+ static const byte OPERATOR2_INDEXES[ADLIB_CHANNEL_COUNT];
private:
OPL::OPL *_opl;
Common::Mutex _driverMutex;
+ Common::Array<Channel> _channels;
Common::Queue<RegisterValue> _queue;
const byte *_effectsData;
Common::Array<uint16> _effectsOffsets;
+ const byte *_musicPtr1, *_musicPtr2;
+ bool _fieldF;
+ int _field109;
+ int _field10B;
+ byte _field10D[7];
+ int _field114;
+ int _field115;
+ int _field117;
+ bool _lowMusicIgnored;
private:
/**
* Loads effects data that was embedded in the music driver
@@ -58,6 +79,12 @@ private:
void loadEffectsData();
/**
+ * Adds a register write to the pending queue that will be flushed
+ * out to the OPL on the next timer call
+ */
+ void write(int reg, int val);
+
+ /**
* Timer function for OPL
*/
void onTimer();
@@ -71,11 +98,31 @@ private:
* Updates any playing music
*/
void update();
+
+ /**
+ * Does a reset
+ */
+ void reset();
+
+ /**
+ * Sets the frequency for an operator
+ */
+ void setFrequency(byte operatorNum, uint frequency);
+
+ /**
+ * Sets the output level for a channel
+ */
+ void setOutputLevel(byte channelNum, uint level);
protected:
Audio::Mixer *_mixer;
public:
Music(Audio::Mixer *mixer);
~Music();
+
+ /**
+ * Starts an effect playing
+ */
+ void playEffect(uint effectId);
};
} // End of namespace Xeen