aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/sound.h
diff options
context:
space:
mode:
authorKari Salminen2007-08-15 15:55:38 +0000
committerKari Salminen2007-08-15 15:55:38 +0000
commit4d83eef351cd4b3bfeb766bace3d7cb5b07a2e07 (patch)
treec8d1a546c507c558d1edcc9151f0bf2755cbfec0 /engines/agi/sound.h
parent429af74320ceb9d1e1c79bff9e868ecfc87a971a (diff)
downloadscummvm-rg350-4d83eef351cd4b3bfeb766bace3d7cb5b07a2e07.tar.gz
scummvm-rg350-4d83eef351cd4b3bfeb766bace3d7cb5b07a2e07.tar.bz2
scummvm-rg350-4d83eef351cd4b3bfeb766bace3d7cb5b07a2e07.zip
Made AGI's 4-channel PCjr sound not need structure packing pragmas anymore. Also added more use of little endian reading macros.
svn-id: r28624
Diffstat (limited to 'engines/agi/sound.h')
-rw-r--r--engines/agi/sound.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/engines/agi/sound.h b/engines/agi/sound.h
index b2201a3f67..6d7e71ef8e 100644
--- a/engines/agi/sound.h
+++ b/engines/agi/sound.h
@@ -177,21 +177,25 @@ struct IIgsSampleHeader {
bool finalize(Common::SeekableReadStream &uint8Wave);
};
-#include "common/pack-start.h"
-
/**
* AGI sound note structure.
*/
struct AgiNote {
- uint8 durLo; /**< LSB of note duration */
- uint8 durHi; /**< MSB of note duration */
- uint8 frq0; /**< LSB of note frequency */
- uint8 frq1; /**< MSB of note frequency */
- uint8 vol; /**< note volume */
+ uint16 duration; ///< Note duration
+ uint16 freqDiv; ///< Note frequency divisor (10-bit)
+ uint8 attenuation; ///< Note volume attenuation (4-bit)
+
+ /** Reads an AgiNote through the given pointer. */
+ void read(uint8 *ptr) {
+ duration = READ_LE_UINT16(ptr);
+ uint16 freqByte0 = *(ptr + 2); // Bits 4-9 of the frequency divisor
+ uint16 freqByte1 = *(ptr + 3); // Bits 0-3 of the frequency divisor
+ // Merge the frequency divisor's bits together into a single variable
+ freqDiv = ((freqByte0 & 0x3F) << 4) | (freqByte1 & 0x0F);
+ attenuation = *(ptr + 4) & 0x0F;
+ }
};
-#include "common/pack-end.h"
-
/**
* AGI engine sound channel structure.
*/
@@ -200,7 +204,7 @@ struct ChannelInfo {
#define AGI_SOUND_MIDI 0x0002
#define AGI_SOUND_4CHN 0x0008
uint32 type;
- struct AgiNote *ptr;
+ uint8 *ptr; // Pointer to the AgiNote data
int16 *ins;
int32 size;
uint32 phase;