Correction in DOSBox-r3873-mt32 patch

Developer's Forum for discussion of bugs, code, and other developmental aspects of the Munt Project.

Correction in DOSBox-r3873-mt32 patch

Postby truth_deleted » 2014-12-02 @ 04:34

With thread=off, the DOSBox-r3873-mt32 patch causes a dosbox error; it occurs after the mt32 emulated device is opened. However, thread=on does work.

Modified code which corrects the error:
Code: Select all
--- midi_mt32.cpp   2014-12-01 23:07:00 -0500
+++ midi_mt32-NEW.cpp   2014-12-01 23:05:20 -0500
@@ -121,6 +121,13 @@ bool MidiHandler_mt32::Open(const char *
       playedBuffers = 1;
       thread = SDL_CreateThread(processingThread, NULL);
    }
+   else {
+      sampleRateRatio = MT32Emu::SAMPLE_RATE / (double)synth->getStereoOutputSampleRate();
+      minimumRenderFrames = (MINIMUM_RENDER_MILLIS * synth->getStereoOutputSampleRate()) / MILLIS_PER_SECOND;
+      framesPerAudioBuffer = (AUDIO_LATENCY_MILLIS * synth->getStereoOutputSampleRate()) / MILLIS_PER_SECOND;
+      audioBufferSize = framesPerAudioBuffer << 1;
+      audioBuffer = new Bit16s[audioBufferSize];
+   }
    chan->Enable(true);
 
    open = true;

I don't know for sure whether the above added code is the proper solution, but nearly all these lines are required to avoid the above dosbox error where thread=off (same as renderInThread set to false in the code). The above lines are already available where thread=on (renderInThread = true).
truth_deleted
 

Re: Correction in DOSBox-r3873-mt32 patch

Postby sergm » 2014-12-02 @ 07:40

Thanks, that's fixed now.
sergm
Oldbie
 
Posts: 736
Joined: 2011-2-23 @ 16:37

Re: Correction in DOSBox-r3873-mt32 patch

Postby truth_deleted » 2014-12-02 @ 08:12

I tried. :)

I can't wait to try your updated dosbox patch which enables the recent mt32 additions, especially the analog output emulation modes!
truth_deleted
 

Re: Correction in DOSBox-r3873-mt32 patch

Postby sergm » 2014-12-02 @ 08:24

Heh, it depends on your audio system quality... I expect you've got high-end stuff? I doubt something can be distinguished with a couple of cheap noisemakers :)
sergm
Oldbie
 
Posts: 736
Joined: 2011-2-23 @ 16:37

Re: Correction in DOSBox-r3873-mt32 patch

Postby truth_deleted » 2014-12-02 @ 10:02

Oh well. :( I guess my Creative T20s fall into the latter category, but I can always imagine!
truth_deleted
 

Re: Correction in DOSBox-r3873-mt32 patch

Postby marooned_on_mars » 2014-12-07 @ 01:47

Not sure if it's because of the new patch or it's at my end, but I'm getting this while compiling:

Code: Select all
make[3]: Entering directory '/home/andoru/sources/dosbox/src'
g++ -DHAVE_CONFIG_H -I. -I..  -I../include -I/home/andoru/include/ -I/home/andoru/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT  -g -O2 -mno-ms-bitfields  -MT dosbox.o -MD -MP -MF .deps/dosbox.Tpo -c -o dosbox.o dosbox.cpp
mv -f .deps/dosbox.Tpo .deps/dosbox.Po
g++  -g -O2 -mno-ms-bitfields    -o dosbox dosbox.o  cpu/libcpu.a debug/libdebug.a dos/libdos.a fpu/libfpu.a  hardware/libhardware.a gui/libgui.a ints/libints.a misc/libmisc.a shell/libshell.a hardware/serialport/libserial.a libs/gui_tk/libgui_tk.a -lasound -lm -ldl -lpthread -L/home/andoru/lib/ -L/home/andoru/lib -lSDL -lpng -lz -lX11 -lGL
gui/libgui.a(midi.o): In function `__static_initialization_and_destruction_0':
/home/andoru/sources/dosbox/src/gui/midi.cpp:95: undefined reference to `MidiHandler_mt32::GetInstance()'
collect2: error: ld returned 1 exit status
Makefile:296: recipe for target 'dosbox' failed


EDIT: Got munt source from git, latest commit at this time is 7e924b1
Last edited by marooned_on_mars on 2014-12-07 @ 02:13, edited 3 times in total.
I support Universal Basic Income, and so should you, here's why. Another reason why.
Commonly asked questions about UBI
Spread the word!
User avatar
marooned_on_mars
Member
 
Posts: 361
Joined: 2006-1-23 @ 18:47
Location: MoonBase2

Re: Correction in DOSBox-r3873-mt32 patch

Postby truth_deleted » 2014-12-07 @ 02:04

I've been compiling from source daily and haven't encountered a compiler/linker error in 32-bit Windows. Perhaps start from unchanged dosbox SVN code, apply patch, and see if error occurs again? Which version of gcc is used?

Edit: also verify that the newest MUNT header files were copied to directories seen by the compiler.
truth_deleted
 

Re: Correction in DOSBox-r3873-mt32 patch

Postby sergm » 2014-12-07 @ 09:41

Hmm, not sure why to compile it daily. Hopefully, neither munt nor DOSBox sources get updated so frequently :)
sergm
Oldbie
 
Posts: 736
Joined: 2011-2-23 @ 16:37

Re: Correction in DOSBox-r3873-mt32 patch

Postby truth_deleted » 2014-12-07 @ 10:07

Recently, I've noted your frequent updates and have tried to maintain a current build for testing. Fortunately, I don't have to rebuild based on your latest commits to the osx and winmm drivers. :)

I typically test with SC2000 by Maxis and found that one particular song doesn't play with mt32 driver and thought I built a faulty dosbox, but it turns out the sim was designed that way!

Also, thank you for the patches to dosbox which implement your new analog sound emulation!
truth_deleted
 

Re: Correction in DOSBox-r3873-mt32 patch

Postby sergm » 2014-12-07 @ 13:34

I've been waited for someone to be able to maintain that (completely despaired to see the lib integrated into DOSBox svn at least). At the end, I realized the better it looks the closer my goal. Btw, even if I still make the updates, this task is now way easier as the hog of release vs. svn patches reduced to absolute minimum (which is actually how it must be).
Now, upon finishing CoreAudio driver and at last saying good bye to disappointing portaudio, I'll add an external C interface - wrapper which allows the lib to be easily used out of C++ scope, e.g. from apps written in other languages like Java. Perhaps, this makes it closer to get the lib integrated if it isn't stuck due to licensing reasons of course...
sergm
Oldbie
 
Posts: 736
Joined: 2011-2-23 @ 16:37

Re: Correction in DOSBox-r3873-mt32 patch

Postby truth_deleted » 2014-12-07 @ 23:29

The interface wrapper would be a welcome feature! With time, I think there will be added pressure for gog.com to include mt-32 support for relevant games; although your emulation must appeal to music enthusiasts, too. Also, since scummvm includes the mt-32 emulation without issue, then it should be reasonable to include the same with vanilla dosbox.

I'm always glad to test your emulation additions (and share a build when it is ok). It never ceases to amaze me to hear the high quality midi output available from Munt, especially as compared to the other music options. :)
truth_deleted
 

Re: Correction in DOSBox-r3873-mt32 patch

Postby marooned_on_mars » 2014-12-08 @ 21:51

Yesterday I didn't have any time to test out if I can compile DOSBox, but today I cloned the latest git source (commit 59e4764443) and now it worked. Not sure what happened last time, but I don't remember running autogen.sh, so that might be what caused it, I'm not sure though. Will you be able to add any way of changing the analogue output type in the dosbox.conf?
I support Universal Basic Income, and so should you, here's why. Another reason why.
Commonly asked questions about UBI
Spread the word!
User avatar
marooned_on_mars
Member
 
Posts: 361
Joined: 2006-1-23 @ 18:47
Location: MoonBase2

Re: Correction in DOSBox-r3873-mt32 patch

Postby truth_deleted » 2014-12-08 @ 23:33

Did you recreate the dosbox configuration file with the latest dosbox build with mt-32 emulation? The new file has the analog output types.
Code: Select all
mt32.analog=

Digital = 0
Only digital path is emulated. The output samples correspond to the digital output signal appeared at the DAC entrance. Fastest mode.

Coarse = 1
Coarse emulation of LPF circuit. High frequencies are boosted, sample rate remains unchanged. A bit better sounding but also a bit slower.

Accurate = 2 - default
Finer emulation of LPF circuit. Output signal is upsampled to 48 kHz to allow emulation of audible mirror spectra above 16 kHz, which is passed through the LPF circuit without significant attenuation. Sounding is closer to the analog output from real hardware but also slower than the modes 0 and 1.

Oversampled = 3
Same as the default mode 2 but the output signal is 2x oversampled, i.e. the output sample rate is 96 kHz. Even slower than all the other modes but better retains highest frequencies while further resampled in DOSBox mixer.
truth_deleted
 

Re: Correction in DOSBox-r3873-mt32 patch

Postby bloodbat » 2014-12-11 @ 06:32

It should work (using digital) even with an out of date .conf file.
User avatar
bloodbat
Oldbie
 
Posts: 791
Joined: 2009-12-06 @ 07:11

Re: Correction in DOSBox-r3873-mt32 patch

Postby sergm » 2014-12-11 @ 07:46

It works whatever is in the conf file. To recreate the conf file "config -wc" or "config -wcp" (for SVN builds) may be used.
sergm
Oldbie
 
Posts: 736
Joined: 2011-2-23 @ 16:37

Re: Correction in DOSBox-r3873-mt32 patch

Postby SedrynTyros » 2015-1-08 @ 23:47

Tried patching the DOSBox SVN r3885 source with dosbox-SVN-r3873-mt32-patch.diff and there's now some drift when it patches dosbox.cpp:

"Hunk#1 succeeded at 491 (offset 8 lines)."
"Hunk#2 succeeded at 507 (offset 8 lines)."

It still works, though; this is just an FYI. When I tried patched DOSBox SVN r3876 with this same dosbox-SVN-r3873-mt32-patch.diff there were no such discrepancies with dosbox.cpp.
User avatar
SedrynTyros
Member
 
Posts: 103
Joined: 2012-7-24 @ 21:44

Re: Correction in DOSBox-r3873-mt32 patch

Postby truth_deleted » 2015-1-09 @ 01:10

The patch is working as intended. The patch command is designed to compensate for the offset, so it is not an issue.
truth_deleted
 

Re: Correction in DOSBox-r3873-mt32 patch

Postby SedrynTyros » 2015-1-09 @ 05:55

truth5678 wrote:The patch is working as intended. The patch command is designed to compensate for the offset, so it is not an issue.


Righto, hombre!
User avatar
SedrynTyros
Member
 
Posts: 103
Joined: 2012-7-24 @ 21:44


Return to MT-32 Development

Who is online

Users browsing this forum: No registered users and 2 guests