From f0606aa8f131b72bf76e08a82f6deb5016d5d8bb Mon Sep 17 00:00:00 2001 From: Walter van Niftrik Date: Thu, 26 Mar 2015 09:19:28 +0100 Subject: AUDIO: Reset OPL registers in ALSA driver --- audio/softsynth/opl/alsa.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'audio') diff --git a/audio/softsynth/opl/alsa.cpp b/audio/softsynth/opl/alsa.cpp index 79ff589bd2..6b9e48e987 100644 --- a/audio/softsynth/opl/alsa.cpp +++ b/audio/softsynth/opl/alsa.cpp @@ -179,9 +179,17 @@ bool OPL::init() { void OPL::reset() { snd_hwdep_ioctl(_opl, SNDRV_DM_FM_IOCTL_RESET, nullptr); - if (_iface != SND_HWDEP_IFACE_OPL2) + if (_iface == SND_HWDEP_IFACE_OPL3) snd_hwdep_ioctl(_opl, SNDRV_DM_FM_IOCTL_SET_MODE, (void *)SNDRV_DM_FM_MODE_OPL3); + clear(); + + // Sync up with the hardware + snd_hwdep_ioctl(_opl, SNDRV_DM_FM_IOCTL_SET_PARAMS, (void *)&_params); + for (uint i = 0; i < (_iface == SND_HWDEP_IFACE_OPL3 ? kVoices : kOpl2Voices); ++i) + snd_hwdep_ioctl(_opl, SNDRV_DM_FM_IOCTL_PLAY_NOTE, (void *)&_voice[i]); + for (uint i = 0; i < (_iface == SND_HWDEP_IFACE_OPL3 ? kOperators : kOpl2Operators); ++i) + snd_hwdep_ioctl(_opl, SNDRV_DM_FM_IOCTL_SET_VOICE, (void *)&_oper[i]); } void OPL::write(int port, int val) { -- cgit v1.2.3