Added code to get which channels are used by a sound. Also, fixed a crash when using Sierra's GM patches, a regression from commit #49391.
svn-id: r49415
This commit is contained in:
parent
1973bd5a71
commit
ddf7449b00
2 changed files with 7 additions and 0 deletions
|
@ -512,6 +512,7 @@ public:
|
||||||
Track *getDigitalTrack();
|
Track *getDigitalTrack();
|
||||||
int getChannelFilterMask(int hardwareMask, bool wantsRhythm);
|
int getChannelFilterMask(int hardwareMask, bool wantsRhythm);
|
||||||
byte getInitialVoiceCount(byte channel);
|
byte getInitialVoiceCount(byte channel);
|
||||||
|
bool isChannelUsed(byte channel) { return _usedChannels[channel]; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SciVersion _soundVersion;
|
SciVersion _soundVersion;
|
||||||
|
@ -519,6 +520,7 @@ private:
|
||||||
Track *_tracks;
|
Track *_tracks;
|
||||||
Resource *_innerResource;
|
Resource *_innerResource;
|
||||||
ResourceManager *_resMan;
|
ResourceManager *_resMan;
|
||||||
|
bool _usedChannels[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End of namespace Sci
|
} // End of namespace Sci
|
||||||
|
|
|
@ -151,6 +151,7 @@ void ResourceManager::addNewGMPatch(const Common::String &gameId) {
|
||||||
if (!gmPatchFile.empty() && Common::File::exists(gmPatchFile)) {
|
if (!gmPatchFile.empty() && Common::File::exists(gmPatchFile)) {
|
||||||
ResourceSource *psrcPatch = new ResourceSource;
|
ResourceSource *psrcPatch = new ResourceSource;
|
||||||
psrcPatch->source_type = kSourcePatch;
|
psrcPatch->source_type = kSourcePatch;
|
||||||
|
psrcPatch->resourceFile = 0;
|
||||||
psrcPatch->location_name = gmPatchFile;
|
psrcPatch->location_name = gmPatchFile;
|
||||||
processPatch(psrcPatch, kResourceTypePatch, 4);
|
processPatch(psrcPatch, kResourceTypePatch, 4);
|
||||||
}
|
}
|
||||||
|
@ -467,6 +468,9 @@ SoundResource::SoundResource(uint32 resNumber, ResourceManager *resMan, SciVersi
|
||||||
byte *dataEnd;
|
byte *dataEnd;
|
||||||
Channel *channel, *sampleChannel;
|
Channel *channel, *sampleChannel;
|
||||||
|
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
_usedChannels[i] = false;
|
||||||
|
|
||||||
switch (_soundVersion) {
|
switch (_soundVersion) {
|
||||||
case SCI_VERSION_0_EARLY:
|
case SCI_VERSION_0_EARLY:
|
||||||
case SCI_VERSION_0_LATE:
|
case SCI_VERSION_0_LATE:
|
||||||
|
@ -556,6 +560,7 @@ SoundResource::SoundResource(uint32 resNumber, ResourceManager *resMan, SciVersi
|
||||||
channel->data = resource->data + READ_LE_UINT16(data + 2) + 2;
|
channel->data = resource->data + READ_LE_UINT16(data + 2) + 2;
|
||||||
channel->size = READ_LE_UINT16(data + 4) - 2; // Not counting channel header
|
channel->size = READ_LE_UINT16(data + 4) - 2; // Not counting channel header
|
||||||
channel->number = *(channel->data - 2);
|
channel->number = *(channel->data - 2);
|
||||||
|
_usedChannels[channel->number] = true;
|
||||||
channel->poly = *(channel->data - 1);
|
channel->poly = *(channel->data - 1);
|
||||||
channel->time = channel->prev = 0;
|
channel->time = channel->prev = 0;
|
||||||
if (channel->number == 0xFE) { // Digital channel
|
if (channel->number == 0xFE) { // Digital channel
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue