VOGONS


DOSBox ECE (for Windows & Linux)

Topic actions

Reply 80 of 1565, by James-F

User metadata
Rank Oldbie
Rank
Oldbie

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... 😅

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.


my important / useful posts are here

Reply 81 of 1565, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

something like this:

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!

Reply 82 of 1565, by James-F

User metadata
Rank Oldbie
Rank
Oldbie

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. 😊


my important / useful posts are here

Reply 83 of 1565, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie

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 for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 84 of 1565, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

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!

Reply 85 of 1565, by James-F

User metadata
Rank Oldbie
Rank
Oldbie

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.


my important / useful posts are here

Reply 86 of 1565, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie

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?

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-05-02, 09:59. Edited 1 time in total.

My full-featured DOSBox SVN builds for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 87 of 1565, by James-F

User metadata
Rank Oldbie
Rank
Oldbie

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...


my important / useful posts are here

Reply 88 of 1565, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

let me investigate. Maybe I was thinking too simple.

Water flows down the stream
How to ask questions the smart way!

Reply 89 of 1565, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

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!

Reply 90 of 1565, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

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

===================================================================
--- 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!

Reply 91 of 1565, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

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:
[…]
Show full quote
	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:

@@ -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!

Reply 92 of 1565, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie

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-05-03, 11:13. Edited 1 time in total.

My full-featured DOSBox SVN builds for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 93 of 1565, by James-F

User metadata
Rank Oldbie
Rank
Oldbie

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: SB1.5, SB2.0, SBPro2, SB16 - Audio Comparison
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.


my important / useful posts are here

Reply 94 of 1565, by James-F

User metadata
Rank Oldbie
Rank
Oldbie

Another set of ears (and speakers) would be great.
Which DOSBox sounds closest to a CT1320C on your setup?


my important / useful posts are here

Reply 95 of 1565, by valnar

User metadata
Rank Oldbie
Rank
Oldbie

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.

Reply 96 of 1565, by James-F

User metadata
Rank Oldbie
Rank
Oldbie

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.


my important / useful posts are here

Reply 97 of 1565, by KainXVIII

User metadata
Rank Oldbie
Rank
Oldbie

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? 😵

Reply 99 of 1565, by gdjacobs

User metadata
Rank l33t++
Rank
l33t++

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.

All hail the Great Capacitor Brand Finder