1
0
Fork 0

Remove old opl.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3490
This commit is contained in:
Peter Veenstra 2009-11-03 20:17:42 +00:00
parent 360608e2ba
commit 98efcf62b2
7 changed files with 8 additions and 5546 deletions

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dosbox.cpp,v 1.149 2009-05-20 18:07:06 qbix79 Exp $ */
/* $Id: dosbox.cpp,v 1.150 2009-11-03 20:17:42 qbix79 Exp $ */
#include <stdlib.h>
#include <stdarg.h>
@ -130,10 +130,10 @@ static Bitu Normal_Loop(void) {
while (1) {
if (PIC_RunQueue()) {
ret=(*cpudecoder)();
if (ret<0) return 1;
if (GCC_UNLIKELY(ret<0)) return 1;
if (ret>0) {
Bitu blah=(*CallBack_Handlers[ret])();
if (blah) return blah;
if (GCC_UNLIKELY(blah)) return blah;
}
#if C_DEBUG
if (DEBUG_ExitLoop()) return 0;
@ -509,10 +509,10 @@ 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", "compat", "fast", "old", 0};
const char* oplemus[]={ "default", "compat", "fast", 0};
Pstring = secprop->Add_string("oplemu",Property::Changeable::WhenIdle,"default");
Pstring->Set_values(oplemus);
Pstring->Set_help("Provider for the OPL emulation. compat or old might provide better quality (see oplrate as well).");
Pstring->Set_help("Provider for the OPL emulation. compat might provide better quality (see oplrate as well).");
Pint = secprop->Add_int("oplrate",Property::Changeable::WhenIdle,22050);
Pint->Set_values(oplrates);

View file

@ -2,7 +2,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include
SUBDIRS = serialport
EXTRA_DIST = opl.cpp opl.h fmopl.c fmopl.h ymf262.h ymf262.c adlib.h dbopl.h
EXTRA_DIST = opl.cpp opl.h adlib.h dbopl.h
noinst_LIBRARIES = libhardware.a

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: adlib.cpp,v 1.41 2009-05-16 08:29:05 harekiet Exp $ */
/* $Id: adlib.cpp,v 1.42 2009-11-03 20:17:42 qbix79 Exp $ */
#include <stdlib.h>
#include <string.h>
@ -29,32 +29,6 @@
#include "mem.h"
#include "dbopl.h"
/*
Thanks to vdmsound for nice simple way to implement this
*/
#ifdef _MSC_VER
/* Disable recurring warnings */
# pragma warning ( disable : 4018 )
# pragma warning ( disable : 4244 )
#endif
#define logerror
struct __MALLOCPTR {
void* m_ptr;
__MALLOCPTR(void) : m_ptr(NULL) { }
__MALLOCPTR(void* src) : m_ptr(src) { }
void* operator=(void* rhs) { return (m_ptr = rhs); }
operator int*() const { return (int*)m_ptr; }
operator int**() const { return (int**)m_ptr; }
operator char*() const { return (char*)m_ptr; }
};
namespace OPL2 {
#include "opl.cpp"
@ -112,78 +86,6 @@ namespace OPL3 {
};
}
namespace old_OPL2 {
#define OPL2_INTERNAL_FREQ 3579545 // The OPL2 operates at ~3.6MHz
#define HAS_YM3812 1
#include "fmopl.c"
struct Handler : public Adlib::Handler {
virtual void WriteReg( Bit32u reg, Bit8u val ) {
OPLWriteReg( OPL_YM3812[ 0 ], reg, val );
}
virtual Bit32u WriteAddr( Bit32u port, Bit8u val ) {
OPL_YM3812[ 0 ]->address = val;
return val;
}
virtual void Generate( MixerChannel* chan, Bitu samples ) {
Bit16s buf[1024];
while( samples > 0 ) {
Bitu todo = samples > 1024 ? 1024 : samples;
samples -= todo;
YM3812UpdateOne( 0, buf, todo );
chan->AddSamples_m16( todo, buf );
}
}
virtual void Init( Bitu rate ) {
if ( YM3812Init( 1, OPL2_INTERNAL_FREQ, rate )) {
E_Exit("Can't create OPL2 Emulator");
};
}
~Handler() {
YM3812Shutdown();
}
};
}
#undef OSD_CPU_H
#undef TL_TAB_LEN
namespace old_OPL3 {
#define OPL3_INTERNAL_FREQ 14318180 // The OPL3 operates at ~14.3MHz
#define HAS_YMF262 1
#include "ymf262.c"
struct Handler : public Adlib::Handler {
virtual void WriteReg( Bit32u reg, Bit8u val ) {
OPL3WriteReg( YMF262[0], reg, val );
}
virtual Bit32u WriteAddr( Bit32u port, Bit8u val ) {
OPL3Write( YMF262[0], port, val );
return YMF262[0]->address;
}
virtual void Generate( MixerChannel* chan, Bitu samples ) {
Bit16s buf[2][1024];
while( samples > 0 ) {
Bitu todo = samples > 1024 ? 1024 : samples;
samples -= todo;
YMF262UpdateOne( 0, buf[0], todo );
chan->AddSamples_s16( todo, buf[0] );
}
}
virtual void Init( Bitu rate ) {
if ( YMF262Init( 1, OPL3_INTERNAL_FREQ, rate )) {
E_Exit("Can't create OPL3 Emulator");
};
}
~Handler() {
YMF262Shutdown();
}
};
}
#define RAW_SIZE 1024
@ -736,13 +638,7 @@ Module::Module( Section* configuration ) : Module_base(configuration) {
mixerChan = mixerObject.Install(OPL_CallBack,rate,"FM");
mixerChan->SetScale( 2.0 );
if (oplemu == "old") {
if ( oplmode == OPL_opl2 ) {
handler = new old_OPL2::Handler();
} else {
handler = new old_OPL3::Handler();
}
} else if (oplemu == "fast") {
if (oplemu == "fast") {
handler = new DBOPL::Handler();
} else if (oplemu == "compat") {
if ( oplmode == OPL_opl2 ) {

File diff suppressed because it is too large Load diff

View file

@ -1,111 +0,0 @@
#ifndef __FMOPL_H_
#define __FMOPL_H_
/* --- select emulation chips --- */
#define BUILD_YM3812 (HAS_YM3812)
#define BUILD_YM3526 (HAS_YM3526)
#define BUILD_Y8950 (HAS_Y8950)
/* select output bits size of output : 8 or 16 */
#define OPL_SAMPLE_BITS 16
/* compiler dependence */
#ifndef OSD_CPU_H
#define OSD_CPU_H
typedef unsigned char UINT8; /* unsigned 8bit */
typedef unsigned short UINT16; /* unsigned 16bit */
typedef unsigned int UINT32; /* unsigned 32bit */
typedef signed char INT8; /* signed 8bit */
typedef signed short INT16; /* signed 16bit */
typedef signed int INT32; /* signed 32bit */
#endif
#if (OPL_SAMPLE_BITS==16)
typedef INT16 OPLSAMPLE;
#endif
#if (OPL_SAMPLE_BITS==8)
typedef INT8 OPLSAMPLE;
#endif
typedef void (*OPL_TIMERHANDLER)(int channel,double interval_Sec);
typedef void (*OPL_IRQHANDLER)(int param,int irq);
typedef void (*OPL_UPDATEHANDLER)(int param,int min_interval_us);
typedef void (*OPL_PORTHANDLER_W)(int param,unsigned char data);
typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
#if BUILD_YM3812
int YM3812Init(int num, int clock, int rate);
void YM3812Shutdown(void);
void YM3812ResetChip(int which);
int YM3812Write(int which, int a, int v);
unsigned char YM3812Read(int which, int a);
int YM3812TimerOver(int which, int c);
void YM3812UpdateOne(int which, INT16 *buffer, int length);
void YM3812SetTimerHandler(int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
void YM3812SetIRQHandler(int which, OPL_IRQHANDLER IRQHandler, int param);
void YM3812SetUpdateHandler(int which, OPL_UPDATEHANDLER UpdateHandler, int param);
#endif
#if BUILD_YM3526
/*
** Initialize YM3526 emulator(s).
**
** 'num' is the number of virtual YM3526's to allocate
** 'clock' is the chip clock in Hz
** 'rate' is sampling rate
*/
int YM3526Init(int num, int clock, int rate);
/* shutdown the YM3526 emulators*/
void YM3526Shutdown(void);
void YM3526ResetChip(int which);
int YM3526Write(int which, int a, int v);
unsigned char YM3526Read(int which, int a);
int YM3526TimerOver(int which, int c);
/*
** Generate samples for one of the YM3526's
**
** 'which' is the virtual YM3526 number
** '*buffer' is the output buffer pointer
** 'length' is the number of samples that should be generated
*/
void YM3526UpdateOne(int which, INT16 *buffer, int length);
void YM3526SetTimerHandler(int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
void YM3526SetIRQHandler(int which, OPL_IRQHANDLER IRQHandler, int param);
void YM3526SetUpdateHandler(int which, OPL_UPDATEHANDLER UpdateHandler, int param);
#endif
#if BUILD_Y8950
#include "ymdeltat.h"
/* Y8950 port handlers */
void Y8950SetPortHandler(int which, OPL_PORTHANDLER_W PortHandler_w, OPL_PORTHANDLER_R PortHandler_r, int param);
void Y8950SetKeyboardHandler(int which, OPL_PORTHANDLER_W KeyboardHandler_w, OPL_PORTHANDLER_R KeyboardHandler_r, int param);
void Y8950SetDeltaTMemory(int which, void * deltat_mem_ptr, int deltat_mem_size );
int Y8950Init (int num, int clock, int rate);
void Y8950Shutdown (void);
void Y8950ResetChip (int which);
int Y8950Write (int which, int a, int v);
unsigned char Y8950Read (int which, int a);
int Y8950TimerOver (int which, int c);
void Y8950UpdateOne (int which, INT16 *buffer, int length);
void Y8950SetTimerHandler (int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
void Y8950SetIRQHandler (int which, OPL_IRQHANDLER IRQHandler, int param);
void Y8950SetUpdateHandler (int which, OPL_UPDATEHANDLER UpdateHandler, int param);
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,53 +0,0 @@
#ifndef YMF262_H
#define YMF262_H
#define BUILD_YMF262 (HAS_YMF262)
/* select number of output bits: 8 or 16 */
#define OPL3_SAMPLE_BITS 16
/* compiler dependence */
#ifndef OSD_CPU_H
#define OSD_CPU_H
typedef unsigned char UINT8; /* unsigned 8bit */
typedef unsigned short UINT16; /* unsigned 16bit */
typedef unsigned int UINT32; /* unsigned 32bit */
typedef signed char INT8; /* signed 8bit */
typedef signed short INT16; /* signed 16bit */
typedef signed int INT32; /* signed 32bit */
#endif
#if (OPL3_SAMPLE_BITS==16)
typedef INT16 OPL3SAMPLE;
#endif
#if (OPL3_SAMPLE_BITS==8)
typedef INT8 OPL3SAMPLE;
#endif
typedef void (*OPL3_TIMERHANDLER)(int channel,double interval_Sec);
typedef void (*OPL3_IRQHANDLER)(int param,int irq);
typedef void (*OPL3_UPDATEHANDLER)(int param,int min_interval_us);
#if BUILD_YMF262
int YMF262Init(int num, int clock, int rate);
void YMF262Shutdown(void);
void YMF262ResetChip(int which);
int YMF262Write(int which, int a, int v);
unsigned char YMF262Read(int which, int a);
int YMF262TimerOver(int which, int c);
void YMF262UpdateOne(int which, INT16 **buffers, int length);
void YMF262SetTimerHandler(int which, OPL3_TIMERHANDLER TimerHandler, int channelOffset);
void YMF262SetIRQHandler(int which, OPL3_IRQHANDLER IRQHandler, int param);
void YMF262SetUpdateHandler(int which, OPL3_UPDATEHANDLER UpdateHandler, int param);
#endif
#endif /* YMF262_H */