- Fix for issue 699 (sound effects stop working after a few minutes on the PSP)

This commit is contained in:
wagic.the.homebrew
2011-07-10 07:51:03 +00:00
parent 0661918ed6
commit acca910248
2 changed files with 13 additions and 0 deletions

View File

@@ -61,6 +61,7 @@ void audioOutCallback_2(void* buf, unsigned int length, void *userdata);
char playWaveFile(int channel, char* fullName, unsigned long flag);
void stopWaveFile(int channel);
int playWaveMem(WAVDATA* p_wav, unsigned long flag);
void stopWaveMem(WAVDATA* p_wav);
void stopWaveMem(int channel);
void audioInit();
void audioDestroy();

View File

@@ -171,6 +171,9 @@ char loadWaveData(WAVDATA* p_wav, char* fileName, char memLoad) // WAVE加载,
///////////////////////////////////////////////////////////////////
void releaseWaveData(WAVDATA* p_wav) // WAVE释放
{
//stop channels playing this sample before doing anything
stopWaveMem(p_wav);
if (p_wav->fd==-1)
free(p_wav->buffer);
else
@@ -362,6 +365,15 @@ int playWaveMem(WAVDATA* p_wav, unsigned long flag) // 播放WAVE
return -1;
}
void stopWaveMem (WAVDATA * pWav)
{
for (int i = 0; i < NUMBER_WAV_CHANNELS; ++i)
{
if (p_currentWav[i] == pWav)
stopWaveMem(i);
}
}
///////////////////////////////////////////////////////////////////
void stopWaveMem(int channel) // 停止WAVE
{