From 4ebdd5114a8024e57e33fba2104e6fbf59f05fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Strohh=C3=A4cker?= Date: Sun, 26 Apr 2009 15:37:04 +0000 Subject: [PATCH] add dbopl to vs project file; fix internal opl rate of dbopl; change opl provider selection and default Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3358 --- src/dosbox.cpp | 17 +++++++++-------- src/hardware/adlib.cpp | 8 +++++--- src/hardware/dbopl.cpp | 8 ++++---- visualc_net/dosbox.vcproj | 3 +++ 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/dosbox.cpp b/src/dosbox.cpp index e8d63d8b..19661808 100644 --- a/src/dosbox.cpp +++ b/src/dosbox.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dosbox.cpp,v 1.147 2009-04-17 17:24:47 c2woody Exp $ */ +/* $Id: dosbox.cpp,v 1.148 2009-04-26 15:37:04 c2woody Exp $ */ #include #include @@ -312,7 +312,8 @@ void DOSBOX_Init(void) { SDLNetInited = false; // Some frequently used option sets - const char *rates[] = { "22050", "44100", "48000", "32000", "16000", "11025", "8000", 0 }; + const char *rates[] = { "22050", "44100", "48000", "32000", "16000", "11025", "8000", "49716", 0 }; + const char *oplrates[] = { "22050", "49716", "44100", "48000", "32000", "16000", "11025", "8000", 0 }; const char *ios[] = { "220", "240", "260", "280", "2a0", "2c0", "2e0", "300", 0 }; const char *irqssb[] = { "7", "5", "3", "9", "10", "11", "12", 0 }; const char *dmassb[] = { "1", "5", "0", "3", "6", "7", 0 }; @@ -439,7 +440,7 @@ void DOSBOX_Init(void) { Pint = secprop->Add_int("rate",Property::Changeable::OnlyAtStart,22050); Pint->Set_values(rates); - Pint->Set_help("Mixer sample rate, setting any devices higher than this will probably lower their sound quality."); + Pint->Set_help("Mixer sample rate, setting any device's rate higher than this will probably lower their sound quality."); const char *blocksizes[] = { "2048", "4096", "8192", "1024", "512", "256", 0}; @@ -503,14 +504,14 @@ void DOSBOX_Init(void) { Pstring->Set_values(oplmodes); Pstring->Set_help("Type of OPL emulation. On 'auto' the mode is determined by sblaster type. All OPL modes are Adlib-compatible, except for 'cms'."); - const char* oplemus[]={ "default", "old", 0}; - Pstring = secprop->Add_string("oplemu",Property::Changeable::WhenIdle,"auto"); + const char* oplemus[]={ "default", "compat", "fast", "old", 0}; + Pstring = secprop->Add_string("oplemu",Property::Changeable::WhenIdle,"default"); Pstring->Set_values(oplemus); - Pstring->Set_help("Provider for the OPL emulation."); + Pstring->Set_help("Provider for the OPL emulation. compat or old might provide better quality (see oplrate as well)."); Pint = secprop->Add_int("oplrate",Property::Changeable::WhenIdle,22050); - Pint->Set_values(rates); - Pint->Set_help("Sample rate of OPL music emulation."); + Pint->Set_values(oplrates); + Pint->Set_help("Sample rate of OPL music emulation. Use 49716 for highest quality (set the mixer rate accordingly)."); secprop=control->AddSection_prop("gus",&GUS_Init,true); //done diff --git a/src/hardware/adlib.cpp b/src/hardware/adlib.cpp index 1943a50a..1a614214 100644 --- a/src/hardware/adlib.cpp +++ b/src/hardware/adlib.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2008 The DOSBox Team + * Copyright (C) 2002-2009 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: adlib.cpp,v 1.35 2009-04-25 09:55:50 harekiet Exp $ */ +/* $Id: adlib.cpp,v 1.36 2009-04-26 15:37:04 c2woody Exp $ */ #include #include @@ -742,12 +742,14 @@ Module::Module( Section* configuration ) : Module_base(configuration) { } } else if (oplemu == "fast") { handler = new DBOPL::Handler(); - } else { + } else if (oplemu == "compat") { if ( oplmode == OPL_opl2 ) { handler = new OPL2::Handler(); } else { handler = new OPL3::Handler(); } + } else { + handler = new DBOPL::Handler(); } handler->Init( rate ); Bit8u portRange = 4; //opl2 will set this to 2 diff --git a/src/hardware/dbopl.cpp b/src/hardware/dbopl.cpp index be8830cd..3c6b32cb 100644 --- a/src/hardware/dbopl.cpp +++ b/src/hardware/dbopl.cpp @@ -48,7 +48,7 @@ namespace DBOPL { #define MAX_SAMPLES 256 -#define OPLRATE 50000 +#define OPLRATE ((double)(14318180.0 / 288.0)) //Only need 4 valid bits at the top for vibrato #define VIBRATO_SH ( 32 - 4 ) @@ -1183,13 +1183,13 @@ void Chip::Setup( Bit32u rate ) { //10 bits of frequency counter //With higher octave this gets shifted up //-1 since the freqCreateTable = *2 - double scale = ((double)OPLRATE * (double)( 1 << ( WAVE_SH - 10 - 1))) / rate; + double scale = (OPLRATE * (double)( 1 << ( WAVE_SH - 10 - 1))) / rate; for ( int i = 0; i < 16; i++ ) { //Use rounding with 0.5 freqMul[i] = (Bit32u)( 0.5 + scale * FreqCreateTable[ i ] ); } - scale = (double)OPLRATE / rate; + scale = OPLRATE / rate; //-3 since the real envelope takes 8 steps to reach the single value we supply for ( Bit8u i = 0; i < 76; i++ ) { Bit8u index, shift; @@ -1464,4 +1464,4 @@ void Handler::Init( Bitu rate ) { } -}; //Namespace Kiet +}; //Namespace DBOPL diff --git a/visualc_net/dosbox.vcproj b/visualc_net/dosbox.vcproj index 28b0d83c..f6403e06 100644 --- a/visualc_net/dosbox.vcproj +++ b/visualc_net/dosbox.vcproj @@ -538,6 +538,9 @@ + +