static void Driver_Music_Play(int16 index, uint16 volume) { Driver *music = g_driverMusic; MSBuffer *musicBuffer = g_bufferMusic; if (index < 0 || index > 120 || g_gameConfig.music == 0) return; if (music->index == 0xFFFF) return; if (musicBuffer->index != 0xFFFF) { MPU_Stop(musicBuffer->index); MPU_ClearData(musicBuffer->index); musicBuffer->index = 0xFFFF; } musicBuffer->index = MPU_SetData(music->content, index, musicBuffer->buffer); MPU_Play(musicBuffer->index); MPU_SetVolume(musicBuffer->index, ((volume & 0xFF) * 90) / 256, 0); }
void Driver_Sound_Play(int16 index, int16 volume) { Driver *sound = g_driverSound; MSBuffer *soundBuffer = g_bufferSound[s_bufferSoundIndex]; if (index < 0 || index >= 120) return; if (g_gameConfig.sounds == 0 && index > 1) return; if (sound->index == 0xFFFF) return; if (soundBuffer->index != 0xFFFF) { MPU_Stop(soundBuffer->index); MPU_ClearData(soundBuffer->index); soundBuffer->index = 0xFFFF; } soundBuffer->index = MPU_SetData(sound->content, index, soundBuffer->buffer); MPU_Play(soundBuffer->index); MPU_SetVolume(soundBuffer->index, ((volume & 0xFF) * 90) / 256, 0); s_bufferSoundIndex = (s_bufferSoundIndex + 1) % 4; }