[Scummvm-cvs-logs] CVS: scummvm/sound fmopl.cpp,1.9,1.10 fmopl.h,1.3,1.4
James Brown
ender at users.sourceforge.net
Tue May 7 19:07:03 CEST 2002
- Previous message: [Scummvm-cvs-logs] CVS: scummvm gfx.cpp,1.86,1.87 gui.cpp,1.41,1.42 gui.h,1.19,1.20 guimaps.h,1.1,1.2 scummvm.cpp,1.143,1.144
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sound mididrv.cpp,1.20,1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sound
In directory usw-pr-cvs1:/tmp/cvs-serv3418
Modified Files:
fmopl.cpp fmopl.h
Log Message:
Major cleanup of fmopl, and change incorrect uint32 typecasting.
Midi Emulation driver sounds a lot better now.
Index: fmopl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/fmopl.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- fmopl.cpp 23 Apr 2002 17:55:02 -0000 1.9
+++ fmopl.cpp 8 May 2002 02:06:26 -0000 1.10
@@ -24,6 +24,7 @@
#include "stdafx.h"
+#include "scumm.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -35,23 +36,19 @@
#define PI 3.14159265358979323846
#endif
[...1474 lines suppressed...]
+ if( OPL->mode & 0x80 )
+ { /* CSM mode total level latch and auto key on */
int ch;
- if (OPL->UpdateHandler)
- OPL->UpdateHandler(OPL->UpdateParam, 0);
- for (ch = 0; ch < 9; ch++)
- CSMKeyControll(&OPL->P_CH[ch]);
+ if(OPL->UpdateHandler) OPL->UpdateHandler(OPL->UpdateParam,0);
+ for(ch=0;ch<9;ch++)
+ CSMKeyControll( &OPL->P_CH[ch] );
}
}
/* reload timer */
- if (OPL->TimerHandler)
- (OPL->TimerHandler) (OPL->TimerParam + c,
- (double)OPL->T[c] * OPL->TimerBase);
- return OPL->status >> 7;
+ if (OPL->TimerHandler) (OPL->TimerHandler)(OPL->TimerParam+c,(double)OPL->T[c]*OPL->TimerBase);
+ return OPL->status>>7;
}
Index: fmopl.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/fmopl.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- fmopl.h 23 Apr 2002 17:52:30 -0000 1.3
+++ fmopl.h 8 May 2002 02:06:26 -0000 1.4
@@ -22,74 +22,69 @@
* Tatsuyuki Satoh. Included from LGPL'ed AdPlug.
*/
+
#ifndef __FMOPL_H_
#define __FMOPL_H_
#include "scummsys.h"
-typedef int16 OPLSAMPLE;
-
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);
-
-/* !!!!! here is private section , do not access there member direct !!!!! */
#define OPL_TYPE_WAVESEL 0x01 /* waveform select */
-#define OPL_TYPE_ADPCM 0x02 /* DELTA-T ADPCM unit */
-#define OPL_TYPE_KEYBOARD 0x04 /* keyboard interface */
-#define OPL_TYPE_IO 0x08 /* I/O port */
/* Saving is necessary for member of the 'R' mark for suspend/resume */
/* ---------- OPL one of slot ---------- */
typedef struct fm_opl_slot {
- int32 TL; /* total level :TL << 8 */
- int32 TLL; /* adjusted now TL */
- uint8 KSR; /* key scale rate :(shift down bit) */
- int32 *AR; /* attack rate :&AR_TABLE[AR<<2] */
- int32 *DR; /* decay rate :&DR_TALBE[DR<<2] */
- int32 SL; /* sustin level :SL_TALBE[SL] */
- int32 *RR; /* release rate :&DR_TABLE[RR<<2] */
- uint8 ksl; /* keyscale level :(shift down bits) */
- uint8 ksr; /* key scale rate :kcode>>KSR */
- uint32 mul; /* multiple :ML_TABLE[ML] */
- uint32 Cnt; /* frequency count : */
- uint32 Incr; /* frequency step : */
+ 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 */
- int32 evc; /* envelope counter */
- int32 eve; /* envelope counter end point */
- int32 evs; /* envelope counter step */
- int32 evsa; /* envelope step for AR :AR[ksr] */
- int32 evsd; /* envelope step for DR :DR[ksr] */
- int32 evsr; /* envelope step for RR :RR[ksr] */
+ 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 */
- int32 **wavetable;
-}OPL_SLOT;
+ int **wavetable;
+} OPL_SLOT;
/* ---------- OPL one of channel ---------- */
typedef struct fm_opl_channel {
OPL_SLOT SLOT[2];
- uint8 CON; /* connection type */
- uint8 FB; /* feed back :(shift down bit) */
- int32 *connect1; /* slot1 output pointer */
- int32 *connect2; /* slot2 output pointer */
- int32 op1_out[2]; /* slot1 output for selfeedback */
+ 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 */
+
/* phase generator state */
- uint32 block_fnum; /* block+fnum : */
- uint8 kcode; /* key code : KeyScaleCode */
- uint32 fc; /* Freq. Increment base */
- uint32 ksl_base; /* KeyScaleLevel Base step */
- uint8 keyon; /* key on/off flag */
+ 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;
/* OPL state */
-struct FM_OPL {
+typedef struct fm_opl_f {
uint8 type; /* chip type */
int clock; /* master clock (Hz) */
int rate; /* sampling rate (Hz) */
@@ -98,25 +93,35 @@
uint8 address; /* address register */
uint8 status; /* status flag */
uint8 statusmask; /* status mask */
- uint32 mode; /* Reg.08 : CSM , notesel,etc. */
+ uint mode; /* Reg.08 : CSM , notesel,etc. */
+
/* 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 */
+
/* 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 */
+
/* LFO */
- int32 *ams_table;
- int32 *vib_table;
- int32 amsCnt;
- int32 amsIncr;
- int32 vibCnt;
- int32 vibIncr;
+ int *ams_table;
+ int *vib_table;
+ int amsCnt;
+ int amsIncr;
+ int vibCnt;
+ int vibIncr;
+
/* wave selector enable flag */
uint8 wavesel;
+
/* external event callback handler */
OPL_TIMERHANDLER TimerHandler; /* TIMER handler */
int TimerParam; /* TIMER parameter */
@@ -124,15 +129,11 @@
int IRQParam; /* IRQ parameter */
OPL_UPDATEHANDLER UpdateHandler; /* stream update handler */
int UpdateParam; /* stream update parameter */
- int32 AR_TABLE[75]; /* atttack rate tables */
- int32 DR_TABLE[75]; /* decay rate tables */
- uint32 FN_TABLE[1024]; /* fnumber -> increment counter */
-};
+} FM_OPL;
/* ---------- Generic interface section ---------- */
#define OPL_TYPE_YM3526 (0)
#define OPL_TYPE_YM3812 (OPL_TYPE_WAVESEL)
-#define OPL_TYPE_Y8950 (OPL_TYPE_ADPCM|OPL_TYPE_KEYBOARD|OPL_TYPE_IO)
FM_OPL *OPLCreate(int type, int clock, int rate);
void OPLDestroy(FM_OPL *OPL);
@@ -144,10 +145,6 @@
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);
-
-/* YM3626/YM3812 local section */
void YM3812UpdateOne(FM_OPL *OPL, int16 *buffer, int length);
-
#endif
- Previous message: [Scummvm-cvs-logs] CVS: scummvm gfx.cpp,1.86,1.87 gui.cpp,1.41,1.42 gui.h,1.19,1.20 guimaps.h,1.1,1.2 scummvm.cpp,1.143,1.144
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sound mididrv.cpp,1.20,1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list