mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-01 15:09:47 +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");
|
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() {
|
void SciMusic::onTimer() {
|
||||||
const MusicList::iterator end = _playList.end();
|
const MusicList::iterator end = _playList.end();
|
||||||
for (MusicList::iterator i = _playList.begin(); i != end; ++i)
|
for (MusicList::iterator i = _playList.begin(); i != end; ++i)
|
||||||
@ -334,10 +342,12 @@ void SciMusic::soundStop(MusicEntry *pSnd) {
|
|||||||
if (pSnd->pStreamAud)
|
if (pSnd->pStreamAud)
|
||||||
_pMixer->stopHandle(pSnd->hCurrentAud);
|
_pMixer->stopHandle(pSnd->hCurrentAud);
|
||||||
|
|
||||||
_mutex.lock();
|
if (pSnd->pMidiParser) {
|
||||||
if (pSnd->pMidiParser)
|
_mutex.lock();
|
||||||
pSnd->pMidiParser->stop();
|
pSnd->pMidiParser->stop();
|
||||||
_mutex.unlock();
|
freeChannels(pSnd);
|
||||||
|
_mutex.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SciMusic::soundSetVolume(MusicEntry *pSnd, byte volume) {
|
void SciMusic::soundSetVolume(MusicEntry *pSnd, byte volume) {
|
||||||
@ -379,11 +389,6 @@ void SciMusic::soundKill(MusicEntry *pSnd) {
|
|||||||
|
|
||||||
_mutex.lock();
|
_mutex.lock();
|
||||||
uint sz = _playList.size(), i;
|
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
|
// Remove sound from playlist
|
||||||
for (i = 0; i < sz; i++) {
|
for (i = 0; i < sz; i++) {
|
||||||
if (_playList[i] == pSnd) {
|
if (_playList[i] == pSnd) {
|
||||||
@ -404,10 +409,12 @@ void SciMusic::soundPause(MusicEntry *pSnd) {
|
|||||||
if (pSnd->pStreamAud) {
|
if (pSnd->pStreamAud) {
|
||||||
_pMixer->pauseHandle(pSnd->hCurrentAud, true);
|
_pMixer->pauseHandle(pSnd->hCurrentAud, true);
|
||||||
} else {
|
} else {
|
||||||
_mutex.lock();
|
if (pSnd->pMidiParser) {
|
||||||
if (pSnd->pMidiParser)
|
_mutex.lock();
|
||||||
pSnd->pMidiParser->pause();
|
pSnd->pMidiParser->pause();
|
||||||
_mutex.unlock();
|
freeChannels(pSnd);
|
||||||
|
_mutex.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,6 +195,7 @@ public:
|
|||||||
Common::Mutex _mutex;
|
Common::Mutex _mutex;
|
||||||
|
|
||||||
int16 tryToOwnChannel(MusicEntry *caller, int16 bestChannel);
|
int16 tryToOwnChannel(MusicEntry *caller, int16 bestChannel);
|
||||||
|
void freeChannels(MusicEntry *caller);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void sortPlayList();
|
void sortPlayList();
|
||||||
|
Loading…
Reference in New Issue
Block a user