DOSBox ECE (for Windows)

Developer's Forum, for discussion of bugs, code, and other developmental aspects of DOSBox.

Re: DOSBox ECE (Windows, Linux)

Postby James-F » 2017-5-01 @ 13:24

A Diff patch to the current SVN 4008 that adds "oplvol=2.0" right under "oplrate=" would be absolutely fantastic.
Hope I'm not asking too much... :sweatdrop:

There is no need to make it permanent, the adjustable patch can live in ECE, but a more accurate permanent value can be decided for the vanilla DOSBox.
User avatar
James-F
Oldbie
 
Posts: 1405
Joined: 2015-11-30 @ 04:10

Re: DOSBox ECE (Windows, Linux)

Postby Qbix » 2017-5-01 @ 13:44

something like this:
Code: Select all
Index: src/dosbox.cpp
===================================================================
--- src/dosbox.cpp   (revision 4008)
+++ src/dosbox.cpp   (working copy)
@@ -551,6 +560,9 @@
    Pint->Set_values(oplrates);
    Pint->Set_help("Sample rate of OPL music emulation. Use 49716 for highest quality (set the mixer rate accordingly).");
 
+   Pint = secprop->Add_int("fmstrength",Property::Changeable::WhenIdle,200);
+   Pint->SetMinMax(1,1000);
+   Pint->Set_help("percentage of fm vs pcm");
 
    secprop=control->AddSection_prop("gus",&GUS_Init,true); //done
    Pbool = secprop->Add_bool("gus",Property::Changeable::WhenIdle,false);    
Index: src/hardware/adlib.cpp
===================================================================
--- src/hardware/adlib.cpp   (revision 4008)
+++ src/hardware/adlib.cpp   (working copy)
@@ -699,6 +699,7 @@
    Section_prop * section=static_cast<Section_prop *>(configuration);
    Bitu base = section->Get_hex("sbbase");
    Bitu rate = section->Get_int("oplrate");
+   Bitu strength = section->Get_int("fmstrength");
    //Make sure we can't select lower than 8000 to prevent fixed point issues
    if ( rate < 8000 )
       rate = 8000;
@@ -706,7 +707,8 @@
    ctrl.mixer = section->Get_bool("sbmixer");
 
    mixerChan = mixerObject.Install(OPL_CallBack,rate,"FM");
-   mixerChan->SetScale( 2.0 );
+   float scale = ((float)strength)/100.0;
+   mixerChan->SetScale( scale );
    if (oplemu == "fast") {
       handler = new DBOPL::Handler();
    } else if (oplemu == "compat") {


I hope it applies. I had to manually edit it to remove some other changes that I have in my tree.
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10375
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: DOSBox ECE (Windows, Linux)

Postby James-F » 2017-5-01 @ 14:05

Thank you so much Qbix.
Even if it doesn't compile, adding a few lines manually is not a problem.

I'm positive this patch will produce a "golden" value after I'm done with it. :blush:
User avatar
James-F
Oldbie
 
Posts: 1405
Joined: 2015-11-30 @ 04:10

Re: DOSBox ECE (Windows, Linux)

Postby Yesterplay80 » 2017-5-02 @ 08:55

OK, I managed to edit the Qbixs patch so it works with ECE, thanks for that Qbix! If I get this right, to get a result that sounds more like a true SB card, the value for the value "fmstrenght" should be between 150 and 130, where 150 is the measured value and 130 is the value based on James-Fs hearing. Right?
My full-featured DOSBox SVN builds (without debugger) for Windows: Vanilla DOSBox and DOSBox ECE (Enhanced Community Edition)
User avatar
Yesterplay80
Member
 
Posts: 252
Joined: 2016-2-23 @ 11:02
Location: Germany

Re: DOSBox ECE (Windows, Linux)

Postby Qbix » 2017-5-02 @ 09:04

It might even depend on the type of sb card emulated, based on what I read in the other thread.
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10375
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: DOSBox ECE (Windows, Linux)

Postby James-F » 2017-5-02 @ 09:43

Thank you Yesterplay80 for including this.

Yesterplay80 wrote: the value for the value "fmstrenght" should be between 150 and 130, where 150 is the measured value and 130 is the value based on James-Fs hearing. Right?

Yes, but I'll have to test it first to be sure.

Report #1.
The fmstrength setting does nothing, it doesn't work.
User avatar
James-F
Oldbie
 
Posts: 1405
Joined: 2015-11-30 @ 04:10

Re: DOSBox ECE (Windows, Linux)

Postby Yesterplay80 » 2017-5-02 @ 09:53

I just made some cosmetic changes (just the description) to the patch, set the default value to 150 and adjusted the lines so it works with ECE, so that hopefully doesn't affect it?

Code: Select all
Index: src/dosbox.cpp
===================================================================
--- src/dosbox.cpp   (revision 4008)
+++ src/dosbox.cpp   (working copy for ECE)
@@ -578,6 +578,10 @@
    Pint->Set_values(oplrates);
    Pint->Set_help("Sample rate of OPL music emulation. Use 49716 for highest quality (set the mixer rate accordingly).");
 
+   Pint = secprop->Add_int("fmstrength",Property::Changeable::WhenIdle,150);
+   Pint->SetMinMax(1,1000);
+   Pint->Set_help("Strength of the FM playback volume in percent, in relation to PCM playback volume. Default is 150.\n"
+   "Possible Values: 1 to 1000 (0,01x to 10x)");
 
    secprop=control->AddSection_prop("gus",&GUS_Init,true); //done
    Pbool = secprop->Add_bool("gus",Property::Changeable::WhenIdle,false);   
Index: src/hardware/adlib.cpp
===================================================================
--- src/hardware/adlib.cpp   (revision 4008)
+++ src/hardware/adlib.cpp   (working copy for ECE)
@@ -731,6 +731,7 @@
    Section_prop * section=static_cast<Section_prop *>(configuration);
    Bitu base = section->Get_hex("sbbase");
    Bitu rate = section->Get_int("oplrate");
+   Bitu strength = section->Get_int("fmstrength");
    //Make sure we can't select lower than 8000 to prevent fixed point issues
    if ( rate < 8000 )
    rate = 8000;

@@ -738,7 +739,8 @@
    ctrl.mixer = section->Get_bool("sbmixer");
 
    mixerChan = mixerObject.Install(OPL_CallBack,rate,"FM");
-   mixerChan->SetScale( 2.0 );
+   float scale = ((float)strength)/100.0;
+   mixerChan->SetScale( scale );
    if (oplemu == "fast") {
       handler = new DBOPL::Handler();
    } else if (oplemu == "compat") {
Last edited by Yesterplay80 on 2017-5-02 @ 09:59, edited 1 time in total.
My full-featured DOSBox SVN builds (without debugger) for Windows: Vanilla DOSBox and DOSBox ECE (Enhanced Community Edition)
User avatar
Yesterplay80
Member
 
Posts: 252
Joined: 2016-2-23 @ 11:02
Location: Germany

Re: DOSBox ECE (Windows, Linux)

Postby James-F » 2017-5-02 @ 09:58

I'm sure it's not the cosmetic changes.
Something is wrong with the code, Qbix?

Get value from "fmstrength" and put it in "strength".
Divide "strength" by 100 and put it in "scale"
Put "scale" instead of "2.0".

Everything looks correct...
User avatar
James-F
Oldbie
 
Posts: 1405
Joined: 2015-11-30 @ 04:10

Re: DOSBox ECE (Windows, Linux)

Postby Qbix » 2017-5-02 @ 10:42

let me investigate. Maybe I was thinking too simple.
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10375
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: DOSBox ECE (Windows, Linux)

Postby Qbix » 2017-5-02 @ 10:58

It works fine here. Tested it with the intro sound of Space Quest 4. (tested 1,50,100,200,400 and they had a noticeable effect on the volume.)

Be sure to change the setting in the configuration file and restart dosbox.



edit: Maybe it is something else in my code. My mixer code is far from pristine.
However can you check if it works with restarting dosbox and setting it to a very low value, like 1
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10375
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: DOSBox ECE (Windows, Linux)

Postby Qbix » 2017-5-02 @ 11:39

I have pm-ed you my build.
It works there without a problem.

Code: Select all
===================================================================
--- src/hardware/adlib.cpp      (revision 4008)
+++ src/hardware/adlib.cpp      (working copy)
@@ -699,6 +699,7 @@
        Section_prop * section=static_cast<Section_prop *>(configuration);
        Bitu base = section->Get_hex("sbbase");
        Bitu rate = section->Get_int("oplrate");
+       Bitu strength = section->Get_int("fmstrength");
        //Make sure we can't select lower than 8000 to prevent fixed point issues
        if ( rate < 8000 )
                rate = 8000;
@@ -706,7 +707,8 @@
        ctrl.mixer = section->Get_bool("sbmixer");

        mixerChan = mixerObject.Install(OPL_CallBack,rate,"FM");
-       mixerChan->SetScale( 2.0 );
+       float scale = ((float)strength)/100.0;
+       mixerChan->SetScale( scale );
        if (oplemu == "fast") {
                handler = new DBOPL::Handler();
        } else if (oplemu == "compat") {
Index: src/dosbox.cpp
===================================================================
--- src/dosbox.cpp      (revision 4008)
+++ src/dosbox.cpp      (working copy)
@@ -551,6 +551,9 @@
        Pint->Set_values(oplrates);
        Pint->Set_help("Sample rate of OPL music emulation. Use 49716 for highest quality (set the mixer rate accordingly).");

+       Pint = secprop->Add_int("fmstrength",Property::Changeable::WhenIdle,200);
+       Pint->SetMinMax(1,1000);
+       Pint->Set_help("percentage of fm vs pcm");

        secprop=control->AddSection_prop("gus",&GUS_Init,true); //done
        Pbool = secprop->Add_bool("gus",Property::Changeable::WhenIdle,false);
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10375
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: DOSBox ECE (Windows, Linux)

Postby Qbix » 2017-5-02 @ 11:47

I checked the ECE source code and you are missing a change, which is odd, as it is in your patch that you posted. Maybe you used the wrong file for your build ?

ECE code wrote:
Code: Select all
   Bitu strength = section->Get_int("fmstrength");
   //Make sure we can't select lower than 8000 to prevent fixed point issues
   if ( rate < 8000 )
      rate = 8000;
   std::string oplemu( section->Get_string( "oplemu" ) );
   ctrl.mixer = section->Get_bool("sbmixer");

   mixerChan = mixerObject.Install(OPL_CallBack,rate,"FM");
   mixerChan->SetScale( 2.0 );
   if (oplemu == "fast") {


The calculation part is missing.

specificly this:
Code: Select all
@@ -706,7 +707,8 @@
        ctrl.mixer = section->Get_bool("sbmixer");

        mixerChan = mixerObject.Install(OPL_CallBack,rate,"FM");
-       mixerChan->SetScale( 2.0 );
+       float scale = ((float)strength)/100.0;
+       mixerChan->SetScale( scale );
        if (oplemu == "fast") {
                handler = new DBOPL::Handler();
        } else if (oplemu == "compat") {
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10375
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: DOSBox ECE (Windows, Linux)

Postby Yesterplay80 » 2017-5-02 @ 12:24

Holy crap, you're right! I didn't think to check that because patching doesn't return any errors. But it seems as if the second hunk is completely ignored, even if I write something erroneous in there on purpose there's no error message.

I recreated the patch for adlib.cpp by manually making the necessary changes and it should work now (Though it keeps telling me the "patch unexpectedly ends in middle of line"). New build is compiling as I type, should be online in some minutes.

UPDATE: Jup, I can now hear the difference in the intro of "DUNE 2" with different values for "fmstrength".
Last edited by Yesterplay80 on 2017-5-03 @ 11:13, edited 1 time in total.
My full-featured DOSBox SVN builds (without debugger) for Windows: Vanilla DOSBox and DOSBox ECE (Enhanced Community Edition)
User avatar
Yesterplay80
Member
 
Posts: 252
Joined: 2016-2-23 @ 11:02
Location: Germany

Re: DOSBox ECE (Windows, Linux)

Postby James-F » 2017-5-02 @ 13:35

My calculations were correct, 150 equals to 75, and 130 equals to 65.

150 is the correct value if I match to 440Hz as with the hardware sound blaster at that frequency.
But in DOSBox 150 still sounds just a little louder than a SB1.0 13020B because it has no filtering on top of the FM sounds.

Using games that mix FM and PCM as reference: https://www.vogons.org/viewtopic.php?f=46&t=51514
For DOSBox to audibly match a Sound Blaster 1.0 or 2.0 (CT1320C or CT1350B respectively) I need to set to 130 (mixer FM 65).
I chose SB1/2 as reference because DOSBox filter resembles the filter on these cards, the SBPro is much too filtered compared to DOSBox and the SB16 has completely different kind of filter.
Moreover, Adlib games that don't have in-game volume controls for music/audio usually belong to the SB1.0 or 2.0 era.

I use quality studio monitors and studio headphones for critical listening, they usually have more treble than typical desktop speakers, or should I say more "correct" treble.
Behringer Truth B3030A
Audio Technica ATH-M40X

I suggest keeping it at 150 for typical desktop speakers (Creative, Logitech, etc...), ones that have tone controls on the speakers.
But lower to 130 if you have speakers with flat frequency response that go up to 20kHz, at ear level, or headphones.
Once DOSBox incorporate filtering on the FM sounds it would be much more straight forward comparison and 150 should be the default setting.
On my setup I use 130.

I should mention once again than the difference between 130 and 150 is only 1.25db, so most people will not notice the difference at all.
But vanilla DOSBox default 200 and 130 is -3.75db difference which is undoubtedly audible.
A 3.75db quieter music might make all the difference between intelligible speech vs drowned-under-music speech.
User avatar
James-F
Oldbie
 
Posts: 1405
Joined: 2015-11-30 @ 04:10

Re: DOSBox ECE (Windows, Linux)

Postby James-F » 2017-5-03 @ 04:45

Another set of ears (and speakers) would be great.
Which DOSBox sounds closest to a CT1320C on your setup?
Attachments
DOSBox 200.mp3
(1.43 MiB) Downloaded 13 times
DOSBox 150.mp3
(1.41 MiB) Downloaded 13 times
DOSBox 130.mp3
(1.41 MiB) Downloaded 12 times
SB1 CT1320C.mp3
(1.33 MiB) Downloaded 14 times
User avatar
James-F
Oldbie
 
Posts: 1405
Joined: 2015-11-30 @ 04:10

Re: DOSBox ECE (Windows, Linux)

Postby valnar » 2017-5-03 @ 10:44

I think the 130 sounds the closest, but it's very tough to tell. You might want to normalize all files and compare amplitudes of various peaks and spots on an audio program. My speakers are Altec Lansing 621 with sub.
valnar
Oldbie
 
Posts: 640
Joined: 2002-7-17 @ 13:50

Re: DOSBox ECE (Windows, Linux)

Postby James-F » 2017-5-03 @ 11:15

Thanks for the feedback.
Yes, it is tough to tell between 150 and 130 because there is only 1.25db difference, but from 200 to 130 it should be pretty clear.
The files are normalized to PCM (voice) content, it's FM volume that differ between them.

We can accurately calibrate to 440Hz where the filters don't affect the sound, but on different SB cards there are various amounts of different filtering on PCM and FM.
This is a big factor on how the sound card sounds and how balanced it is between its own PCM and FM.
Our ears more sensitive to high frequencies therefor the final adjustment should be done by ear if the filters in DOSBox are not exactly the same as the SB card.
User avatar
James-F
Oldbie
 
Posts: 1405
Joined: 2015-11-30 @ 04:10

Re: DOSBox ECE (Windows, Linux)

Postby KainXVIII » 2017-5-06 @ 18:58

Can somebody try new dosbox ECE with Goblins 2 or Ween: The Prophecy? I get garbled sound effects now, maybe its because of new opl volume patch? :dead:
User avatar
KainXVIII
Member
 
Posts: 218
Joined: 2015-5-20 @ 15:04
Location: Yaroslavl

Re: DOSBox ECE (Windows, Linux)

Postby James-F » 2017-5-06 @ 19:20

Nope, it's not the OPL patch, adlib sounds fine, only PCM affected.
Happens in Vanilla 4008 (Feb 2017).

https://drive.google.com/drive/folders/0BxEUSpZ8xHkvS2tCbEJRUXpnNTg
Please rollback from 4007 to 4000 one by one to find where the problem began.
User avatar
James-F
Oldbie
 
Posts: 1405
Joined: 2015-11-30 @ 04:10

Re: DOSBox ECE (Windows, Linux)

Postby gdjacobs » 2017-5-06 @ 20:21

This is where keeping your source in GIT is highly useful. You can perform the same function as git bisect by testing 4003. If 4003 works, test 4005. If not, test 4001.
User avatar
gdjacobs
l33t
 
Posts: 4178
Joined: 2015-11-03 @ 05:51
Location: The Great White North

PreviousNext

Return to DOSBox Development

Who is online

Users browsing this forum: No registered users and 3 guests