[Scummvm-cvs-logs] CVS: scummvm/sound fmopl.cpp,1.10,1.10.2.1 fmopl.h,1.5,1.5.2.1
Max Horn
fingolfin at users.sourceforge.net
Mon May 5 08:57:17 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sky adlibchannel.cpp,1.2,1.2.2.1 adlibchannel.h,1.2,1.2.2.1 adlibmusic.cpp,1.2,1.2.2.1 adlibmusic.h,1.2,1.2.2.1
- Next message: [Scummvm-cvs-logs] CVS: scummvm Makefile.mingw,1.12,1.13 NEWS,1.14,1.15 README,1.83,1.84
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv22295/sound
Modified Files:
Tag: branch-0-4-0
fmopl.cpp fmopl.h
Log Message:
reverted to old fmopl code on the branch
Index: fmopl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/fmopl.cpp,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -u -d -r1.10 -r1.10.2.1
--- fmopl.cpp 4 May 2003 21:17:41 -0000 1.10
+++ fmopl.cpp 5 May 2003 15:56:00 -0000 1.10.2.1
@@ -1,288 +1,101 @@
-/*
-**
-** File: fmopl.c - software implementation of FM sound generator
-** types OPL and OPL2
-**
-** Copyright (C) 1999,2000 Tatsuyuki Satoh , MultiArcadeMachineEmulator development
-** Copyright (C) 2002 Jarek Burczynski
-**
-** Version 0.60
-**
-
[...3194 lines suppressed...]
-{
- FM_OPL *OPL = OPL_Y8950[which];
- OPL->porthandler_w = PortHandler_w;
- OPL->porthandler_r = PortHandler_r;
- OPL->port_param = param;
-}
-
-void Y8950SetKeyboardHandler(int which,OPL_PORTHANDLER_W KeyboardHandler_w,OPL_PORTHANDLER_R KeyboardHandler_r,int param)
-{
- FM_OPL *OPL = OPL_Y8950[which];
- OPL->keyboardhandler_w = KeyboardHandler_w;
- OPL->keyboardhandler_r = KeyboardHandler_r;
- OPL->keyboard_param = param;
+ if (OPL->TimerHandler)
+ (OPL->TimerHandler)(OPL->TimerParam + c, (double)OPL->T[c] * OPL->TimerBase);
+ return OPL->status >> 7;
}
-
-#endif
-
Index: fmopl.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/fmopl.h,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -d -r1.5 -r1.5.2.1
--- fmopl.h 4 May 2003 21:17:42 -0000 1.5
+++ fmopl.h 5 May 2003 15:56:01 -0000 1.5.2.1
@@ -18,120 +18,135 @@
*
* $Header$
*
- * LGPL licensed version of MAMEs fmopl (V0.60a modified) by
- * Tatsuyuki Satoh and Jarek Burczynski. Included from LGPL'ed AdPlug.
+ * LGPL licensed version of MAMEs fmopl (V0.37a modified) by
+ * Tatsuyuki Satoh. Included from LGPL'ed AdPlug.
*/
+
#ifndef __FMOPL_H_
#define __FMOPL_H_
-
-#define HAS_YM3812 1
-
-/* --- 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
-
+#include "scummsys.h"
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);
+#define OPL_TYPE_WAVESEL 0x01 /* waveform select */
-#endif
+/* Saving is necessary for member of the 'R' mark for suspend/resume */
+/* ---------- OPL one of slot ---------- */
+typedef struct fm_opl_slot {
+ int TL; /* total level :TL << 8 */
+ int TLL; /* adjusted now TL */
+ uint8 KSR; /* key scale rate :(shift down bit) */
+ int *AR; /* attack rate :&AR_TABLE[AR<<2] */
+ int *DR; /* decay rate :&DR_TABLE[DR<<2] */
+ int SL; /* sustain level :SL_TABLE[SL] */
+ int *RR; /* release rate :&DR_TABLE[RR<<2] */
+ uint8 ksl; /* keyscale level :(shift down bits) */
+ uint8 ksr; /* key scale rate :kcode>>KSR */
+ uint mul; /* multiple :ML_TABLE[ML] */
+ uint Cnt; /* frequency count */
+ uint Incr; /* frequency step */
+
+ /* envelope generator state */
+ uint8 eg_typ;/* envelope type flag */
+ uint8 evm; /* envelope phase */
+ int evc; /* envelope counter */
+ int eve; /* envelope counter end point */
+ int evs; /* envelope counter step */
+ int evsa; /* envelope step for AR :AR[ksr] */
+ int evsd; /* envelope step for DR :DR[ksr] */
+ int evsr; /* envelope step for RR :RR[ksr] */
+ /* LFO */
+ uint8 ams; /* ams flag */
+ uint8 vib; /* vibrate flag */
+ /* wave selector */
+ int **wavetable;
+} OPL_SLOT;
-#if BUILD_YM3526
+/* ---------- OPL one of channel ---------- */
+typedef struct fm_opl_channel {
+ OPL_SLOT SLOT[2];
+ uint8 CON; /* connection type */
+ uint8 FB; /* feed back :(shift down bit)*/
+ int *connect1; /* slot1 output pointer */
+ int *connect2; /* slot2 output pointer */
+ int op1_out[2]; /* slot1 output for selfeedback */
-/*
-** 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);
+ /* phase generator state */
+ uint block_fnum; /* block+fnum */
+ uint8 kcode; /* key code : KeyScaleCode */
+ uint fc; /* Freq. Increment base */
+ uint ksl_base; /* KeyScaleLevel Base step */
+ uint8 keyon; /* key on/off flag */
+} OPL_CH;
-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);
+/* OPL state */
+typedef struct fm_opl_f {
+ uint8 type; /* chip type */
+ int clock; /* master clock (Hz) */
+ int rate; /* sampling rate (Hz) */
+ double freqbase; /* frequency base */
+ double TimerBase; /* Timer base time (==sampling time) */
+ uint8 address; /* address register */
+ uint8 status; /* status flag */
+ uint8 statusmask; /* status mask */
+ uint mode; /* Reg.08 : CSM , notesel,etc. */
-#endif
+ /* Timer */
+ int T[2]; /* timer counter */
+ uint8 st[2]; /* timer enable */
+ /* FM channel slots */
+ OPL_CH *P_CH; /* pointer of CH */
+ int max_ch; /* maximum channel */
-#if BUILD_Y8950
+ /* Rythm sention */
+ uint8 rythm; /* Rythm mode , key flag */
+
+ /* time tables */
+ int AR_TABLE[75]; /* atttack rate tables */
+ int DR_TABLE[75]; /* decay rate tables */
+ uint FN_TABLE[1024];/* fnumber -> increment counter */
-#include "ymdeltat.h"
+ /* LFO */
+ int *ams_table;
+ int *vib_table;
+ int amsCnt;
+ int amsIncr;
+ int vibCnt;
+ int vibIncr;
-/* 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_rom, int deltat_rom_size );
+ /* wave selector enable flag */
+ uint8 wavesel;
-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);
+ /* external event callback handler */
+ OPL_TIMERHANDLER TimerHandler; /* TIMER handler */
+ int TimerParam; /* TIMER parameter */
+ OPL_IRQHANDLER IRQHandler; /* IRQ handler */
+ int IRQParam; /* IRQ parameter */
+ OPL_UPDATEHANDLER UpdateHandler; /* stream update handler */
+ int UpdateParam; /* stream update parameter */
+} FM_OPL;
-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);
+/* ---------- Generic interface section ---------- */
+#define OPL_TYPE_YM3526 (0)
+#define OPL_TYPE_YM3812 (OPL_TYPE_WAVESEL)
-#endif
+void OPLBuildTables(int ENV_BITS_PARAM, int EG_ENT_PARAM);
+FM_OPL *OPLCreate(int type, int clock, int rate);
+void OPLDestroy(FM_OPL *OPL);
+void OPLSetTimerHandler(FM_OPL *OPL, OPL_TIMERHANDLER TimerHandler, int channelOffset);
+void OPLSetIRQHandler(FM_OPL *OPL, OPL_IRQHANDLER IRQHandler, int param);
+void OPLSetUpdateHandler(FM_OPL *OPL, OPL_UPDATEHANDLER UpdateHandler, int param);
+void OPLResetChip(FM_OPL *OPL);
+int OPLWrite(FM_OPL *OPL, int a, int v);
+unsigned char OPLRead(FM_OPL *OPL, int a);
+int OPLTimerOver(FM_OPL *OPL, int c);
+void OPLWriteReg(FM_OPL *OPL, int r, int v);
+void YM3812UpdateOne(FM_OPL *OPL, int16 *buffer, int length);
#endif
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sky adlibchannel.cpp,1.2,1.2.2.1 adlibchannel.h,1.2,1.2.2.1 adlibmusic.cpp,1.2,1.2.2.1 adlibmusic.h,1.2,1.2.2.1
- Next message: [Scummvm-cvs-logs] CVS: scummvm Makefile.mingw,1.12,1.13 NEWS,1.14,1.15 README,1.83,1.84
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list