mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-29 21:24:53 +00:00
SCI: free channels for channel remapping on stop and pause, instead of dispose - fixes qfg3 demo going out of channels
svn-id: r50054
This commit is contained in:
parent
26e4e0e345
commit
ab4e02422c
@ -250,6 +250,14 @@ int16 SciMusic::tryToOwnChannel(MusicEntry *caller, int16 bestChannel) {
|
||||
error("no free channels");
|
||||
}
|
||||
|
||||
void SciMusic::freeChannels(MusicEntry *caller) {
|
||||
// Remove used channels
|
||||
for (int i = 0; i < 15; i++) {
|
||||
if (_usedChannel[i] == caller)
|
||||
_usedChannel[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void SciMusic::onTimer() {
|
||||
const MusicList::iterator end = _playList.end();
|
||||
for (MusicList::iterator i = _playList.begin(); i != end; ++i)
|
||||
@ -334,10 +342,12 @@ void SciMusic::soundStop(MusicEntry *pSnd) {
|
||||
if (pSnd->pStreamAud)
|
||||
_pMixer->stopHandle(pSnd->hCurrentAud);
|
||||
|
||||
_mutex.lock();
|
||||
if (pSnd->pMidiParser)
|
||||
if (pSnd->pMidiParser) {
|
||||
_mutex.lock();
|
||||
pSnd->pMidiParser->stop();
|
||||
_mutex.unlock();
|
||||
freeChannels(pSnd);
|
||||
_mutex.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
void SciMusic::soundSetVolume(MusicEntry *pSnd, byte volume) {
|
||||
@ -379,11 +389,6 @@ void SciMusic::soundKill(MusicEntry *pSnd) {
|
||||
|
||||
_mutex.lock();
|
||||
uint sz = _playList.size(), i;
|
||||
// Remove used channels
|
||||
for (i = 0; i < 15; i++) {
|
||||
if (_usedChannel[i] == pSnd)
|
||||
_usedChannel[i] = 0;
|
||||
}
|
||||
// Remove sound from playlist
|
||||
for (i = 0; i < sz; i++) {
|
||||
if (_playList[i] == pSnd) {
|
||||
@ -404,10 +409,12 @@ void SciMusic::soundPause(MusicEntry *pSnd) {
|
||||
if (pSnd->pStreamAud) {
|
||||
_pMixer->pauseHandle(pSnd->hCurrentAud, true);
|
||||
} else {
|
||||
_mutex.lock();
|
||||
if (pSnd->pMidiParser)
|
||||
if (pSnd->pMidiParser) {
|
||||
_mutex.lock();
|
||||
pSnd->pMidiParser->pause();
|
||||
_mutex.unlock();
|
||||
freeChannels(pSnd);
|
||||
_mutex.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,6 +195,7 @@ public:
|
||||
Common::Mutex _mutex;
|
||||
|
||||
int16 tryToOwnChannel(MusicEntry *caller, int16 bestChannel);
|
||||
void freeChannels(MusicEntry *caller);
|
||||
|
||||
protected:
|
||||
void sortPlayList();
|
||||
|
Loading…
Reference in New Issue
Block a user