DS: Update the MaxMod callback manually

This commit is contained in:
Cameron Cawley 2021-06-15 23:24:46 +01:00 committed by Eugene Sandulenko
parent ac596de969
commit 0a9bf3708f
4 changed files with 19 additions and 4 deletions

View File

@ -26,6 +26,9 @@
#include "backends/platform/ds/osystem_ds.h"
bool DSEventSource::pollEvent(Common::Event &event) {
// Ensure the mixer and timers are updated frequently
g_system->delayMillis(0);
if (_eventQueue.empty()) {
if (!_firstPoll) {
_firstPoll = true;

View File

@ -70,7 +70,7 @@ void MaxModMixerManager::init() {
_stream.callback = on_stream_request;
_stream.format = MM_STREAM_16BIT_STEREO;
_stream.timer = MM_TIMER2;
_stream.manual = 0;
_stream.manual = 1;
mmStreamOpen( &_stream );
@ -91,4 +91,9 @@ int MaxModMixerManager::resumeAudio() {
return 0;
}
void MaxModMixerManager::updateAudio() {
if (!_audioSuspended)
mmStreamUpdate();
}
#endif

View File

@ -52,6 +52,11 @@ public:
*/
virtual int resumeAudio();
/**
* Updates the audio system
*/
void updateAudio();
protected:
mm_stream _stream;
int _freq, _bufSize;

View File

@ -85,7 +85,7 @@ void OSystem_DS::initBackend() {
_timerManager = new DefaultTimerManager();
timerStart(0, ClockDivider_1, (u16)TIMER_FREQ(1000), timerTickHandler);
_mixerManager = new MaxModMixerManager(11025, 4096);
_mixerManager = new MaxModMixerManager(11025, 32768);
_mixerManager->init();
BaseBackend::initBackend();
@ -102,9 +102,11 @@ uint32 OSystem_DS::getMillis(bool skipRecord) {
void OSystem_DS::delayMillis(uint msecs) {
int st = getMillis();
while (st + msecs >= getMillis());
doTimerCallback();
if (_mixerManager)
((MaxModMixerManager *)_mixerManager)->updateAudio();
while (st + msecs >= getMillis());
}
void OSystem_DS::doTimerCallback(int interval) {