joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.65k stars 376 forks source link

When to add openglnb support to SDL2? #1007

Open legionpheonix opened 5 years ago

joncampbell123 commented 5 years ago

As far as I know most of the existing OpenGL code could compile in SDL2, however there's some GL context setup that needs to be ported to SDL2 to work.

legionpheonix commented 5 years ago

Насколько я знаю, большая часть существующего кода OpenGL может скомпилироваться в SDL2, однако есть некоторая настройка контекста GL, которую необходимо перенести в SDL2 для работы.

Then there is another question. I installed and launched WarCraft 1. Set up DosBox-X(SDL1). I usually put openglnb and everything is fine, but not this time. With these settings, the sound clicks. If you set the surface, then everything is fine. How to fix this?

joncampbell123 commented 5 years ago

Is emulation able to keep up? Sound will click if it can't run full speed.

When OpenGL is involved does your system provide hardware acceleration?

legionpheonix commented 5 years ago

Способна ли эмуляция идти в ногу? Звук будет щелкать, если он не может работать на полной скорости.

You about CPU?

Когда задействован OpenGL, обеспечивает ли ваша система аппаратное ускорение?

When I turn on OpenGL, the picture gets better.

By the way, on the Dosbox ECE emulator everything goes well with the same settings.

joncampbell123 commented 5 years ago

Can you compile from source? If so, can you try doing a "git checkout" of prior commits to determine at what point the slowdown happened?

I haven't changed the OpenGL code much at all recently, except to fix a problem with a failure to set fullscreen mode.

I also need to ask what OS and hardware configuration you're running this on.

legionpheonix commented 5 years ago

image My config.

Can you compile from source? If so, can you try doing a "git checkout" of prior commits to determine at what point the slowdown happened?

I do not understand. What should be done? Do you want me to compile a previous version of dosbox-x?

joncampbell123 commented 5 years ago

I see you're on Windows 10.

Are you using the MinGW builds, which default to OpenGL?

You might consider using Direct3D instead.

joncampbell123 commented 5 years ago

I'll pull out my Windows 10 dev system tonight and see if OpenGL performance is still good.

My Windows 10 dev system has an Intel GPU for the display and an nVidia GPU for other tasks, which may cause different results than yours.

joncampbell123 commented 5 years ago

To answer your question, one way to figure out when something broke in the code is to git checkout older commits. For each commit you check, compile the code and see if it functions as it used to. You go back and forth until you find the commit where the behavior changed or broke, then look at the commit to see what changed.

joncampbell123 commented 5 years ago

I'm not seeing any particular slowdowns with OpenGL on Windows 10.

legionpheonix commented 5 years ago

Then I will continue to customize. Maybe something I did wrong. Most likely a problem in the CPU setting. Tell me, when will you have support for third-party MT-32 and CM-32L roms? I tried to add them as a folder path, but the sound did not change.

legionpheonix commented 5 years ago

Here are the options in DosBox ECE

[midi]
#                  mpu401: Type of MPU-401 to emulate.
#                            Possible values: intelligent, uart, none.
#              mididevice: Device that will receive the MIDI data from MPU-401.
#                            Possible values: default, win32, alsa, oss, coreaudio, coremidi, mt32, fluidsynth, none.
#              midiconfig: Special configuration options for the device driver. This is usually the id or part of the name of the device you want to use (find the id/name with mixer/listmidi).
#                            Or in the case of coreaudio, you can specify a soundfont here.
#                            When using a Roland MT-32 rev. 0 as midi output device, some games may require a delay in order to prevent 'buffer overflow' issues.
#                            In that case, add 'delaysysex', for example: midiconfig=2 delaysysex
#                            See the README/Manual for more details.
#            fluid.driver: Driver to use with Fluidsynth, not needed under Windows. Available drivers depend on what Fluidsynth was compiled with
#                            Possible values: pulseaudio, alsa, oss, coreaudio, dsound, portaudio, sndman, jack, file, default.
#         fluid.soundfont: Soundfont to use with Fluidsynth. One must be specified.
#        fluid.samplerate: Sample rate to use with Fluidsynth.
#              fluid.gain: Fluidsynth gain.
#         fluid.polyphony: Fluidsynth polyphony.
#             fluid.cores: Fluidsynth CPU cores to use, default.
#           fluid.periods: Fluidsynth periods.
#        fluid.periodsize: Fluidsynth period size.
#            fluid.reverb: Fluidsynth use reverb.
#                            Possible values: no, yes.
#            fluid.chorus: Fluidsynth use chorus.
#                            Possible values: no, yes.
#   fluid.reverb,roomsize: Fluidsynth reverb room size.
#    fluid.reverb.damping: Fluidsynth reverb damping.
#      fluid.reverb.width: Fluidsynth reverb width.
#      fluid.reverb.level: Fluidsynth reverb level.
#     fluid.chorus.number: Fluidsynth chorus voices
#      fluid.chorus.level: Fluidsynth chorus level.
#      fluid.chorus.speed: Fluidsynth chorus speed.
#      fluid.chorus.depth: Fluidsynth chorus depth.
#       fluid.chorus.type: Fluidsynth chorus type. 0 is sine wave, 1 is triangle wave.
#                            Possible values: 0, 1.
#             mt32.romdir: Name of the directory where MT-32 Control and PCM ROM files can be found. Emulation requires these files to work.
#                              Accepted file names are as follows:
#                                MT32_CONTROL.ROM or CM32L_CONTROL.ROM - control ROM file.
#                                MT32_PCM.ROM or CM32L_PCM.ROM - PCM ROM file.
#     mt32.reverse.stereo: Reverse stereo channels for MT-32 output
#            mt32.verbose: MT-32 debug logging
#             mt32.thread: MT-32 rendering in separate thread
#              mt32.chunk: Minimum milliseconds of data to render at once.
#                            Increasing this value reduces rendering overhead which may improve performance but also increases audio lag.
#                            Valid for rendering in separate thread only.
#                            Possible values: 2, 3, 16, 99, 100.
#          mt32.prebuffer: How many milliseconds of data to render ahead.
#                            Increasing this value may help to avoid underruns but also increases audio lag.
#                            Cannot be set less than or equal to mt32.chunk value.
#                            Valid for rendering in separate thread only.
#                            Possible values: 3, 4, 32, 199, 200.
#           mt32.partials: The maximum number of partials playing simultaneously.
#                            Possible values: 8, 9, 32, 255, 256.
#                mt32.dac: MT-32 DAC input emulation mode
#                            Nice = 0 - default
#                            Produces samples at double the volume, without tricks.
#                            Higher quality than the real devices
#                            
#                            Pure = 1
#                            Produces samples that exactly match the bits output from the emulated LA32.
#                            Nicer overdrive characteristics than the DAC hacks (it simply clips samples within range)
#                            Much less likely to overdrive than any other mode.
#                            Half the volume of any of the other modes.
#                            Perfect for developers while debugging :)
#                            
#                            GENERATION1 = 2
#                            Re-orders the LA32 output bits as in early generation MT-32s (according to Wikipedia).
#                            Bit order at DAC (where each number represents the original LA32 output bit number, and XX means the bit is always low):
#                            15 13 12 11 10 09 08 07 06 05 04 03 02 01 00 XX
#                            
#                            GENERATION2 = 3
#                            Re-orders the LA32 output bits as in later generations (personally confirmed on my CM-32L - KG).
#                            Bit order at DAC (where each number represents the original LA32 output bit number):
#                            15 13 12 11 10 09 08 07 06 05 04 03 02 01 00 14
#                            Possible values: 0, 1, 2, 3.
#             mt32.analog: MT-32 analogue output emulation mode
#                            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.
#                            Possible values: 0, 1, 2, 3.
#        mt32.output.gain: Output gain of MT-32 emulation in percent, 100 is the default value, the allowed maximum is 1000.
#        mt32.reverb.mode: MT-32 reverb mode
#                            Possible values: 0, 1, 2, 3, auto.
# mt32.reverb.output.gain: Reverb output gain of MT-32 emulation in percent, 100 is the default value, the allowed maximum is 1000.
#        mt32.reverb.time: MT-32 reverb decaying time
#                            Possible values: 0, 1, 2, 3, 4, 5, 6, 7.
#       mt32.reverb.level: MT-32 reverb level
#                            Possible values: 0, 1, 2, 3, 4, 5, 6, 7.
#               mt32.rate: Sample rate of MT-32 emulation.
#                            Possible values: 44100, 48000, 32000, 22050, 16000, 11025, 8000, 49716.
#        mt32.src.quality: MT-32 sample rate conversion quality
#                            Value '0' is for the fastest conversion, value '3' provides for the best conversion quality. Default is 2.
#                            Possible values: 0, 1, 2, 3.
#        mt32.niceampramp: Toggles "Nice Amp Ramp" mode that improves amplitude ramp for sustaining instruments.
#                            Quick changes of volume or expression on a MIDI channel may result in amp jumps on real hardware.
#                            When "Nice Amp Ramp" mode is enabled, amp changes gradually instead.
#                            Otherwise, the emulation accuracy is preserved.
#                            Default is true.

mpu401                  = intelligent
mididevice              = mt32
midiconfig              = 
fluid.driver            = default
fluid.soundfont         = "..\WarCraft\DosBox_ECE\Soundfont\Roland_SCC-1.sf2"
fluid.samplerate        = 48000
fluid.gain              = .6
fluid.polyphony         = 256
fluid.cores             = default
fluid.periods           = 8
fluid.periodsize        = 512
fluid.reverb            = yes
fluid.chorus            = yes
fluid.reverb,roomsize   = .61
fluid.reverb.damping    = .23
fluid.reverb.width      = .76
fluid.reverb.level      = .57
fluid.chorus.number     = 3
fluid.chorus.level      = 1.2
fluid.chorus.speed      = .3
fluid.chorus.depth      = 8.0
fluid.chorus.type       = 0
mt32.romdir             = "..\WarCraft\DosBox_ECE\CM-32L"
mt32.reverse.stereo     = true
mt32.verbose            = true
mt32.thread             = true
mt32.chunk              = 64
mt32.prebuffer          = 128
mt32.partials           = 128
mt32.dac                = 0
mt32.analog             = 2
mt32.output.gain        = 100
mt32.reverb.mode        = auto
mt32.reverb.output.gain = 100
mt32.reverb.time        = 7
mt32.reverb.level       = 7
mt32.rate               = 48000
mt32.src.quality        = 3
mt32.niceampramp        = true
legionpheonix commented 5 years ago

Source code

Windows https://dosbox.yesterplay80.net/DOSBox%20ECE%20r4191%20(source).7z

Linux https://dosbox.yesterplay80.net/DOSBox%20ECE%20r4191%20(Linux%20source).7z