mirror of
https://github.com/VARCem/munt.git
synced 2026-07-08 18:16:13 +00:00
- Updated the actual patch file for DOSBox
This commit is contained in:
@@ -106,8 +106,8 @@ diff -Nru dosbox-0.74/src/gui/midi.cpp dosbox-0.74-mt32/src/gui/midi.cpp
|
||||
Bitu cmd_len;
|
||||
diff -Nru dosbox-0.74/src/gui/midi_mt32.h dosbox-0.74-mt32/src/gui/midi_mt32.h
|
||||
--- dosbox-0.74/src/gui/midi_mt32.h 1970-01-01 00:00:00 +0000
|
||||
+++ dosbox-0.74-mt32/src/gui/midi_mt32.h 2012-04-21 12:47:26 +0000
|
||||
@@ -0,0 +1,272 @@
|
||||
+++ dosbox-0.74-mt32/src/gui/midi_mt32.h 2012-12-22 18:50:30 +0000
|
||||
@@ -0,0 +1,276 @@
|
||||
+#include <mt32emu/mt32emu.h>
|
||||
+#include <SDL_thread.h>
|
||||
+#include <SDL_timer.h>
|
||||
@@ -153,7 +153,7 @@ diff -Nru dosbox-0.74/src/gui/midi_mt32.h dosbox-0.74-mt32/src/gui/midi_mt32.h
|
||||
+
|
||||
+static class MidiHandler_mt32 : public MidiHandler {
|
||||
+private:
|
||||
+ static const Bitu SAMPLE_RATE = 32000;
|
||||
+ static const Bitu SAMPLE_RATE = MT32Emu::SAMPLE_RATE;
|
||||
+ static const Bitu MILLIS_PER_SECOND = 1000;
|
||||
+ static const Bitu MINIMUM_RENDER_FRAMES = (16 * SAMPLE_RATE) / MILLIS_PER_SECOND;
|
||||
+ static const Bitu AUDIO_BUFFER_SIZE = MIXER_BUFSIZE >> 1;
|
||||
@@ -167,9 +167,25 @@ diff -Nru dosbox-0.74/src/gui/midi_mt32.h dosbox-0.74-mt32/src/gui/midi_mt32.h
|
||||
+ volatile bool stopProcessing;
|
||||
+ bool open, noise, reverseStereo, renderInThread;
|
||||
+
|
||||
+static void printDebug(void *userData, const char *fmt, va_list list);
|
||||
+static void mixerCallBack(Bitu len);
|
||||
+static int processingThread(void *);
|
||||
+ class MT32ReportHandler : public MT32Emu::ReportHandler {
|
||||
+ protected:
|
||||
+ virtual void onErrorControlROM() {
|
||||
+ LOG_MSG("MT32: Couldn't open Control ROM file");
|
||||
+ }
|
||||
+
|
||||
+ virtual void onErrorPCMROM() {
|
||||
+ LOG_MSG("MT32: Couldn't open PCM ROM file");
|
||||
+ }
|
||||
+
|
||||
+ virtual void showLCDMessage(const char *message) {
|
||||
+ LOG_MSG("MT32: LCD-Message: %s", message);
|
||||
+ }
|
||||
+
|
||||
+ virtual void printDebug(const char *fmt, va_list list);
|
||||
+ } reportHandler;
|
||||
+
|
||||
+ static void mixerCallBack(Bitu len);
|
||||
+ static int processingThread(void *);
|
||||
+
|
||||
+public:
|
||||
+ MidiHandler_mt32() : open(false), chan(NULL), synth(NULL), thread(NULL), synthMutex(NULL) {}
|
||||
@@ -183,20 +199,25 @@ diff -Nru dosbox-0.74/src/gui/midi_mt32.h dosbox-0.74-mt32/src/gui/midi_mt32.h
|
||||
+ }
|
||||
+
|
||||
+ bool Open(const char *conf) {
|
||||
+ MT32Emu::SynthProperties tmpProp = {0};
|
||||
+ tmpProp.sampleRate = SAMPLE_RATE;
|
||||
+ MT32Emu::FileStream controlROMFile;
|
||||
+ MT32Emu::FileStream pcmROMFile;
|
||||
+
|
||||
+ tmpProp.useDefaultReverb = false;
|
||||
+ tmpProp.useReverb = true;
|
||||
+ tmpProp.reverbType = 0;
|
||||
+ tmpProp.reverbTime = 5;
|
||||
+ tmpProp.reverbLevel = 3;
|
||||
+ tmpProp.userData = this;
|
||||
+ tmpProp.printDebug = printDebug;
|
||||
+ tmpProp.report = &report;
|
||||
+
|
||||
+ synth = new MT32Emu::Synth();
|
||||
+ if (!synth->open(tmpProp)) {
|
||||
+ if (!controlROMFile.open("CM32L_CONTROL.ROM")) {
|
||||
+ if (!controlROMFile.open("MT32_CONTROL.ROM")) {
|
||||
+ LOG_MSG("MT32: Control ROM file not found");
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ if (!pcmROMFile.open("CM32L_PCM.ROM")) {
|
||||
+ if (!pcmROMFile.open("MT32_PCM.ROM")) {
|
||||
+ LOG_MSG("MT32: PCM ROM file not found");
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ const MT32Emu::ROMImage *controlROMImage = MT32Emu::ROMImage::makeROMImage(&controlROMFile);
|
||||
+ const MT32Emu::ROMImage *pcmROMImage = MT32Emu::ROMImage::makeROMImage(&pcmROMFile);
|
||||
+ synth = new MT32Emu::Synth(&reportHandler);
|
||||
+ if (!synth->open(*controlROMImage, *pcmROMImage)) {
|
||||
+ LOG_MSG("MT32: Error initialising emulation");
|
||||
+ return false;
|
||||
+ }
|
||||
@@ -220,9 +241,9 @@ diff -Nru dosbox-0.74/src/gui/midi_mt32.h dosbox-0.74-mt32/src/gui/midi_mt32.h
|
||||
+ reverseStereo = strcmp(section->Get_string("mt32.reverse.stereo"), "on") == 0;
|
||||
+ noise = strcmp(section->Get_string("mt32.verbose"), "on") == 0;
|
||||
+ renderInThread = strcmp(section->Get_string("mt32.thread"), "on") == 0;
|
||||
+
|
||||
+
|
||||
+ playPos = 0;
|
||||
+ chan = MIXER_AddChannel(mixerCallBack, tmpProp.sampleRate, "MT32");
|
||||
+ chan = MIXER_AddChannel(mixerCallBack, MT32Emu::SAMPLE_RATE, "MT32");
|
||||
+ if (renderInThread) {
|
||||
+ stopProcessing = false;
|
||||
+ renderPos = 0;
|
||||
@@ -265,24 +286,6 @@ diff -Nru dosbox-0.74/src/gui/midi_mt32.h dosbox-0.74-mt32/src/gui/midi_mt32.h
|
||||
+ }
|
||||
+
|
||||
+private:
|
||||
+ static int report(void *userData, MT32Emu::ReportType type, const void *reportData) {
|
||||
+ switch (type) {
|
||||
+ case MT32Emu::ReportType_errorControlROM:
|
||||
+ LOG_MSG("MT32: Couldn't find Control ROM file");
|
||||
+ break;
|
||||
+ case MT32Emu::ReportType_errorPCMROM:
|
||||
+ LOG_MSG("MT32: Couldn't open PCM ROM file");
|
||||
+ break;
|
||||
+ case MT32Emu::ReportType_lcdMessage:
|
||||
+ LOG_MSG("MT32: LCD-Message: %s", reportData);
|
||||
+ break;
|
||||
+ default:
|
||||
+ //LOG(LOG_ALL,LOG_NORMAL)("MT32: Report %d",type);
|
||||
+ break;
|
||||
+ }
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ void render(const Bitu len, Bit16s *buf) {
|
||||
+ Bitu framesTotal = len;
|
||||
+ Bitu renderPos = this->renderPos;
|
||||
@@ -322,11 +325,12 @@ diff -Nru dosbox-0.74/src/gui/midi_mt32.h dosbox-0.74-mt32/src/gui/midi_mt32.h
|
||||
+ }
|
||||
+} midiHandler_mt32;
|
||||
+
|
||||
+void MidiHandler_mt32::printDebug(void *userData, const char *fmt, va_list list) {
|
||||
+void MidiHandler_mt32::MT32ReportHandler::printDebug(const char *fmt, va_list list) {
|
||||
+ if (midiHandler_mt32.noise) {
|
||||
+ printf("MT32: ");
|
||||
+ vprintf(fmt, list);
|
||||
+ printf("\n");
|
||||
+ char s[1024];
|
||||
+ strcpy(s, "MT32: ");
|
||||
+ vsnprintf(s + 6, 1017, fmt, list);
|
||||
+ LOG_MSG(s);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
|
||||
Reference in New Issue
Block a user