diff options
author | Filippos Karapetis | 2010-06-04 14:53:12 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-06-04 14:53:12 +0000 |
commit | fdc9bbcbf5cee1b5e0cca6838ff30b0133b882fa (patch) | |
tree | 588680d1a45aec64357e4c85d6258d1a9f2dc4ed | |
parent | 9906030312842ae3f3537824c36697c2f5eb60bf (diff) | |
download | scummvm-rg350-fdc9bbcbf5cee1b5e0cca6838ff30b0133b882fa.tar.gz scummvm-rg350-fdc9bbcbf5cee1b5e0cca6838ff30b0133b882fa.tar.bz2 scummvm-rg350-fdc9bbcbf5cee1b5e0cca6838ff30b0133b882fa.zip |
Simplified the channel monitoring code inside the SoundResource class
svn-id: r49429
-rw-r--r-- | engines/sci/resource.h | 6 | ||||
-rw-r--r-- | engines/sci/resource_audio.cpp | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/engines/sci/resource.h b/engines/sci/resource.h index 6d9da3c200..bc08154fed 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -512,7 +512,7 @@ public: Track *getDigitalTrack(); int getChannelFilterMask(int hardwareMask, bool wantsRhythm); byte getInitialVoiceCount(byte channel); - bool isChannelUsed(byte channel) { return _usedChannels[channel]; } + bool isChannelUsed(byte channel) const { return _channelsUsed & (1 << channel); } private: SciVersion _soundVersion; @@ -520,7 +520,9 @@ private: Track *_tracks; Resource *_innerResource; ResourceManager *_resMan; - bool _usedChannels[16]; + uint16 _channelsUsed; + + void setChannelUsed(byte channel) { _channelsUsed |= (1 << channel); } }; } // End of namespace Sci diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp index 6dfd190d97..67bac974fc 100644 --- a/engines/sci/resource_audio.cpp +++ b/engines/sci/resource_audio.cpp @@ -468,8 +468,7 @@ SoundResource::SoundResource(uint32 resNumber, ResourceManager *resMan, SciVersi byte *dataEnd; Channel *channel, *sampleChannel; - for (int i = 0; i < 16; i++) - _usedChannels[i] = false; + _channelsUsed = 0; switch (_soundVersion) { case SCI_VERSION_0_EARLY: @@ -560,7 +559,7 @@ SoundResource::SoundResource(uint32 resNumber, ResourceManager *resMan, SciVersi channel->data = resource->data + READ_LE_UINT16(data + 2) + 2; channel->size = READ_LE_UINT16(data + 4) - 2; // Not counting channel header channel->number = *(channel->data - 2); - _usedChannels[channel->number] = true; + setChannelUsed(channel->number); channel->poly = *(channel->data - 1); channel->time = channel->prev = 0; if (channel->number == 0xFE) { // Digital channel |