[win] bug #1658288 - crashes when sound is disabled
This commit is contained in:
parent
fa5503ef9a
commit
67956c9f2c
|
@ -249,12 +249,40 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//todo - a properly synchronized method ShouldntTouchSound() which is totally safe (use mutexes) and use that to guard all sound code
|
||||||
|
//also add an alternate timer-based throttler for when sound is disabled
|
||||||
|
|
||||||
|
|
||||||
static Player *player;
|
static Player *player;
|
||||||
static Player8 *player8;
|
static Player8 *player8;
|
||||||
|
|
||||||
|
static bool trashPending = false;
|
||||||
|
|
||||||
|
void TrashSound() {
|
||||||
|
trashPending = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoTrashSound() {
|
||||||
|
if(dsout) delete dsout;
|
||||||
|
if(player) delete player;
|
||||||
|
dsout = 0;
|
||||||
|
player = 0;
|
||||||
|
trashPending = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CheckTrashSound() {
|
||||||
|
if(trashPending)
|
||||||
|
{
|
||||||
|
DoTrashSound();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
void win_Throttle() {
|
void win_Throttle() {
|
||||||
player->throttle();
|
if(CheckTrashSound()) return;
|
||||||
|
if(player)
|
||||||
|
player->throttle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_SoundInit(int bits) {
|
void win_SoundInit(int bits) {
|
||||||
|
@ -277,14 +305,6 @@ void win_SoundInit(int bits) {
|
||||||
dsout->unlock();
|
dsout->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrashSound() {
|
|
||||||
if(dsout) delete dsout;
|
|
||||||
if(player) delete player;
|
|
||||||
dsout = 0;
|
|
||||||
player = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int InitSound() {
|
int InitSound() {
|
||||||
if(soundoptions&SO_FORCE8BIT)
|
if(soundoptions&SO_FORCE8BIT)
|
||||||
|
@ -308,14 +328,15 @@ int InitSound() {
|
||||||
|
|
||||||
|
|
||||||
void win_SoundSetScale(int scale) {
|
void win_SoundSetScale(int scale) {
|
||||||
player->scale = scale;
|
if(CheckTrashSound()) return;
|
||||||
|
if(player)
|
||||||
|
player->scale = scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_SoundWriteData(int32 *buffer, int count) {
|
void win_SoundWriteData(int32 *buffer, int count) {
|
||||||
|
//mbg 8/30/07 - this used to be done here, but now its gtting called from somewhere else...
|
||||||
//todo..
|
//FCEUI_AviSoundUpdate((void*)MBuffer, Count);
|
||||||
// FCEUI_AviSoundUpdate((void*)MBuffer, Count);
|
if(CheckTrashSound()) return;
|
||||||
|
|
||||||
void *tempbuf = alloca(2*count);
|
void *tempbuf = alloca(2*count);
|
||||||
short *sbuf = (short *)tempbuf;
|
short *sbuf = (short *)tempbuf;
|
||||||
for(int i=0;i<count;i++)
|
for(int i=0;i<count;i++)
|
||||||
|
|
Loading…
Reference in New Issue