From 4d83eef351cd4b3bfeb766bace3d7cb5b07a2e07 Mon Sep 17 00:00:00 2001 From: Kari Salminen Date: Wed, 15 Aug 2007 15:55:38 +0000 Subject: 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 --- engines/agi/sound.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'engines/agi/sound.h') 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; -- cgit v1.2.3