Author: lkrotowski                   Date: Wed Sep 30 17:19:13 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- dropped ppunpack (mainline replaced it with PD version)
- fmopl up to 0.60
- up to 2.7.1

---- Files affected:
packages/xmp:
   xmp-nondfsg.patch (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: packages/xmp/xmp-nondfsg.patch
diff -u packages/xmp/xmp-nondfsg.patch:1.1 packages/xmp/xmp-nondfsg.patch:1.2
--- packages/xmp/xmp-nondfsg.patch:1.1  Thu Jul 24 00:54:29 2003
+++ packages/xmp/xmp-nondfsg.patch      Wed Sep 30 19:19:08 2009
@@ -1,1770 +1,3409 @@
---- xmp-2.0.5-pre3/src/player/fmopl.c.orig     2001-02-26 01:39:24.000000000 
+0100
-+++ xmp-2.0.5-pre3/src/player/fmopl.c  2001-01-13 21:10:53.000000000 +0100
-@@ -1,36 +1,1341 @@
+diff --git a/src/player/fmopl.c b/src/player/fmopl.c
+index 607bf9f..c573ffa 100644
+--- a/src/player/fmopl.c
++++ b/src/player/fmopl.c
+@@ -1,17 +1,52 @@
  /*
-- * Dummy DFSG-compliant replacement for fmopl.c
-- *
-- * $Id$
-- */
-+**
-+** File: fmopl.c -- software implementation of FM sound generator
-+**
-+** Copyright (C) 1999 Tatsuyuki Satoh , MultiArcadeMachineEmurator development
-+**
-+** Version 0.36f
-+**
-+*/
+ **
+-** File: fmopl.c -- software implementation of FM sound generator
++** File: fmopl.c - software implementation of FM sound generator
++**                                            types OPL and OPL2
+ **
+-** Copyright (C) 1999 Tatsuyuki Satoh , MultiArcadeMachineEmurator development
++** Copyright (C) 1999,2000 Tatsuyuki Satoh , MultiArcadeMachineEmulator 
development
++** Copyright (C) 2002 Jarek Burczynski
+ **
+-** Version 0.36f
++** Version 0.60
+ **
+-*/
  
-+/*
-+      preliminary :
-+      Problem :
-+      note:
-+*/
-+
-+#include <stdio.h>
- #include <stdlib.h>
-+#include <string.h>
-+#include <stdarg.h>
-+#include <math.h>
-+#include "driver.h"           /* use M.A.M.E. */
-+
-+/*** For xmp ***/
-+#define HAS_YM3812 1
-+#define INLINE inline
-+/* $Id$ */
-+
+-/*
+-      preliminary :
+-      Problem :
+-      note:
++Revision History:
++
++04-28-2002 Jarek Burczynski:
++ - binary exact Envelope Generator (verified on real YM3812);
++   compared to YM2151: the EG clock is equal to internal_clock,
++   rates are 2 times slower and volume resolution is one bit less
++ - modified interface functions (they no longer return pointer -
++   that's internal to the emulator now):
++    - new wrapper functions for OPLCreate: YM3526Init(), YM3812Init() and 
Y8950Init()
++ - corrected 'off by one' error in feedback calculations (when feedback is 
off)
++ - enabled waveform usage (credit goes to Vlad Romascanu and zazzal22)
++ - speeded up noise generator calculations (Nicola Salmoria)
++
++03-24-2002 Jarek Burczynski (thanks to Dox for the YM3812 chip)
++ Complete rewrite (all verified on real YM3812):
++ - corrected sin_tab and tl_tab data
++ - corrected operator output calculations
++ - corrected waveform_select_enable register;
++   simply: ignore all writes to waveform_select register when
++   waveform_select_enable == 0 and do not change the waveform previously 
selected.
++ - corrected KSR handling
++ - corrected Envelope Generator: attack shape, Sustain mode and
++   Percussive/Non-percussive modes handling
++ - Envelope Generator rates are two times slower now
++ - LFO amplitude (tremolo) and phase modulation (vibrato)
++ - rhythm sounds phase generation
++ - white noise generator (big thanks to Olivier Galibert for mentioning 
Berlekamp-Massey algorithm)
++ - corrected key on/off handling (the 'key' signal is ORed from three 
sources: FM, rhythm and CSM)
++ - funky details (like ignoring output of operator 1 in BD rhythm sound when 
connect == 1)
++
++12-28-2001 Acho A. Tang
++ - reflected Delta-T EOS status on Y8950 status port.
++ - fixed subscription range of attack/decay tables
++
++
++      To do:
++              add delay before key off in CSM mode (see CSMKeyControll)
++              verify volume of the FM part on the Y8950
+ */
+ 
+ #include <stdio.h>
+@@ -19,80 +54,235 @@
+ #include <string.h>
+ #include <stdarg.h>
+ #include <math.h>
+-#include "driver.h"           /* use M.A.M.E. */
+-
+-/*** For xmp ***/
+-#define HAS_YM3812 1
+-#define INLINE inline
+-/* $Id$ */
+-
  #include "fmopl.h"
  
-+#ifndef PI
-+#define PI 3.14159265358979323846
+ #ifndef PI
+ #define PI 3.14159265358979323846
+ #endif
+ 
++#ifdef _MSC_VER
++#  define INLINE __inline
++#elif defined(__GNUC__)
++#  define INLINE inline
++#else
++#  define INLINE
++#endif
+ 
+-/* -------------------- preliminary define section --------------------- */
+-/* attack/decay rate time rate */
+-#define OPL_ARRATE     141280  /* RATE 4 =  2826.24ms @ 3.6MHz */
+-#define OPL_DRRATE    1956000  /* RATE 4 = 39280.64ms @ 3.6MHz */
+-
+-#define DELTAT_MIXING_LEVEL (1) /* DELTA-T ADPCM MIXING LEVEL */
+-
+-#define FREQ_BITS 24                  /* frequency turn          */
+-
+-/* counter bits = 20 , octerve 7 */
+-#define FREQ_RATE   (1<<(FREQ_BITS-20))
+-#define TL_BITS    (FREQ_BITS+2)
++/* output final shift */
++#if (OPL_SAMPLE_BITS==16)
++      #define FINAL_SH        (0)
++      #define MAXOUT          (+32767)
++      #define MINOUT          (-32768)
++#else
++      #define FINAL_SH        (8)
++      #define MAXOUT          (+127)
++      #define MINOUT          (-128)
++#endif
+ 
+-/* final output shift , limit minimum and maximum */
+-#define OPL_OUTSB   (TL_BITS+3-16)            /* OPL output final shift 16bit 
*/
+-#define OPL_MAXOUT (0x7fff<<OPL_OUTSB)
+-#define OPL_MINOUT (-0x8000<<OPL_OUTSB)
+ 
+-/* -------------------- quality selection --------------------- */
++#define FREQ_SH                       16  /* 16.16 fixed point (frequency 
calculations) */
++#define EG_SH                 16  /* 16.16 fixed point (EG timing)            
  */
++#define LFO_SH                        24  /*  8.24 fixed point (LFO 
calculations)       */
++#define TIMER_SH              16  /* 16.16 fixed point (timers calculations)  
  */
+ 
+-/* sinwave entries */
+-/* used static memory = SIN_ENT * 4 (byte) */
+-#define SIN_ENT 2048
++#define FREQ_MASK             ((1<<FREQ_SH)-1)
+ 
+-/* output level entries (envelope,sinwave) */
+-/* envelope counter lower bits */
+-#define ENV_BITS 16
+ /* envelope output entries */
+-#define EG_ENT   4096
+-/* used dynamic memory = EG_ENT*4*4(byte)or EG_ENT*6*4(byte) */
+-/* used static  memory = EG_ENT*4 (byte)                     */
++#define ENV_BITS              10
++#define ENV_LEN                       (1<<ENV_BITS)
++#define ENV_STEP              (128.0/ENV_LEN)
+ 
+-#define EG_OFF   ((2*EG_ENT)<<ENV_BITS)  /* OFF          */
+-#define EG_DED   EG_OFF
+-#define EG_DST   (EG_ENT<<ENV_BITS)      /* DECAY  START */
+-#define EG_AED   EG_DST
+-#define EG_AST   0                       /* ATTACK START */
++#define MAX_ATT_INDEX ((1<<(ENV_BITS-1))-1) /*511*/
++#define MIN_ATT_INDEX (0)
+ 
+-#define EG_STEP (96.0/EG_ENT) /* OPL is 0.1875 dB step  */
++/* sinwave entries */
++#define SIN_BITS              10
++#define SIN_LEN                       (1<<SIN_BITS)
++#define SIN_MASK              (SIN_LEN-1)
+ 
+-/* LFO table entries */
+-#define VIB_ENT 512
+-#define VIB_SHIFT (32-9)
+-#define AMS_ENT 512
+-#define AMS_SHIFT (32-9)
++#define TL_RES_LEN            (256)   /* 8 bits addressing (real chip) */
+ 
+-#define VIB_RATE 256
+ 
+-/* -------------------- local defines , macros --------------------- */
+ 
+ /* register number to channel number , slot offset */
+ #define SLOT1 0
+ #define SLOT2 1
+ 
+-/* envelope phase */
+-#define ENV_MOD_RR  0x00
+-#define ENV_MOD_DR  0x01
+-#define ENV_MOD_AR  0x02
++/* Envelope Generator phases */
++
++#define EG_ATT                        4
++#define EG_DEC                        3
++#define EG_SUS                        2
++#define EG_REL                        1
++#define EG_OFF                        0
++
++
++/* save output as raw 16-bit sample */
++
++/*#define SAVE_SAMPLE*/
++
++#ifdef SAVE_SAMPLE
++static FILE *sample[1];
++      #if 1   /*save to MONO file */
++              #define SAVE_ALL_CHANNELS \
++              {       signed int pom = lt; \
++                      fputc((unsigned short)pom&0xff,sample[0]); \
++                      fputc(((unsigned short)pom>>8)&0xff,sample[0]); \
++              }
++      #else   /*save to STEREO file */
++              #define SAVE_ALL_CHANNELS \
++              {       signed int pom = lt; \
++                      fputc((unsigned short)pom&0xff,sample[0]); \
++                      fputc(((unsigned short)pom>>8)&0xff,sample[0]); \
++                      pom = rt; \
++                      fputc((unsigned short)pom&0xff,sample[0]); \
++                      fputc(((unsigned short)pom>>8)&0xff,sample[0]); \
++              }
++      #endif
++#endif
++
++/* #define LOG_CYM_FILE */
++#ifdef LOG_CYM_FILE
++      FILE * cymfile = NULL;
 +#endif
 +
 +
-+/* -------------------- preliminary define section --------------------- */
-+/* attack/decay rate time rate */
-+#define OPL_ARRATE     141280  /* RATE 4 =  2826.24ms @ 3.6MHz */
-+#define OPL_DRRATE    1956000  /* RATE 4 = 39280.64ms @ 3.6MHz */
 +
-+#define DELTAT_MIXING_LEVEL (1) /* DELTA-T ADPCM MIXING LEVEL */
++#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                  */
++
++/* ---------- 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)
++
 +
-+#define FREQ_BITS 24                  /* frequency turn          */
 +
-+/* counter bits = 20 , octerve 7 */
-+#define FREQ_RATE   (1<<(FREQ_BITS-20))
-+#define TL_BITS    (FREQ_BITS+2)
++/* Saving is necessary for member of the 'R' mark for suspend/resume */
 +
-+/* final output shift , limit minimum and maximum */
-+#define OPL_OUTSB   (TL_BITS+3-16)            /* OPL output final shift 16bit 
*/
-+#define OPL_MAXOUT (0x7fff<<OPL_OUTSB)
-+#define OPL_MINOUT (-0x8000<<OPL_OUTSB)
++typedef struct{
++      UINT32  ar;                     /* attack rate: AR<<2                   
*/
++      UINT32  dr;                     /* decay rate:  DR<<2                   
*/
++      UINT32  rr;                     /* release rate:RR<<2                   
*/
++      UINT8   KSR;            /* key scale rate                               
*/
++      UINT8   ksl;            /* keyscale level                               
*/
++      UINT8   ksr;            /* key scale rate: kcode>>KSR   */
++      UINT8   mul;            /* multiple: mul_tab[ML]                */
++
++      /* Phase Generator */
++      UINT32  Cnt;            /* frequency counter                    */
++      UINT32  Incr;           /* frequency counter step               */
++      UINT8   FB;                     /* feedback shift value                 
*/
++      INT32   *connect1;      /* slot1 output pointer                 */
++      INT32   op1_out[2];     /* slot1 output for feedback    */
++      UINT8   CON;            /* connection (algorithm) type  */
++
++      /* Envelope Generator */
++      UINT8   eg_type;        /* percussive/non-percussive mode */
++      UINT8   state;          /* phase type                                   
*/
++      UINT32  TL;                     /* total level: TL << 2                 
*/
++      INT32   TLL;            /* adjusted now TL                              
*/
++      INT32   volume;         /* envelope counter                             
*/
++      UINT32  sl;                     /* sustain level: sl_tab[SL]    */
++
++      UINT8   eg_sh_ar;       /* (attack state)                               
*/
++      UINT8   eg_sel_ar;      /* (attack state)                               
*/
++      UINT8   eg_sh_dr;       /* (decay state)                                
*/
++      UINT8   eg_sel_dr;      /* (decay state)                                
*/
++      UINT8   eg_sh_rr;       /* (release state)                              
*/
++      UINT8   eg_sel_rr;      /* (release state)                              
*/
 +
-+/* -------------------- quality selection --------------------- */
++      UINT32  key;            /* 0 = KEY OFF, >0 = KEY ON             */
 +
-+/* sinwave entries */
-+/* used static memory = SIN_ENT * 4 (byte) */
-+#define SIN_ENT 2048
++      /* LFO */
++      UINT32  AMmask;         /* LFO Amplitude Modulation enable mask */
++      UINT8   vib;            /* LFO Phase Modulation enable flag (active 
high)*/
++
++      /* waveform select */
++      unsigned int wavetable;
++} OPL_SLOT;
++
++typedef struct{
++      OPL_SLOT SLOT[2];
++      /* phase generator state */
++      UINT32  block_fnum;     /* block+fnum                                   
*/
++      UINT32  fc;                     /* Freq. Increment base                 
*/
++      UINT32  ksl_base;       /* KeyScaleLevel Base step              */
++      UINT8   kcode;          /* key code (for key scaling)   */
++} OPL_CH;
++
++/* OPL state */
++typedef struct fm_opl_f {
++      /* FM channel slots */
++      OPL_CH  P_CH[9];                                /* OPL/OPL2 chips have 
9 channels*/
++
++      UINT32  eg_cnt;                                 /* global envelope 
generator counter    */
++      UINT32  eg_timer;                               /* global envelope 
generator counter works at frequency = chipclock/72 */
++      UINT32  eg_timer_add;                   /* step of eg_timer             
                                */
++      UINT32  eg_timer_overflow;              /* envelope generator timer 
overlfows every 1 sample (on real chip) */
++
++      UINT8   rhythm;                                 /* Rhythm mode          
                        */
++
++      UINT32  fn_tab[1024];                   /* fnumber->increment counter   
*/
++
++      /* LFO */
++      UINT8   lfo_am_depth;
++      UINT8   lfo_pm_depth_range;
++      UINT32  lfo_am_cnt;
++      UINT32  lfo_am_inc;
++      UINT32  lfo_pm_cnt;
++      UINT32  lfo_pm_inc;
++
++      UINT32  noise_rng;                              /* 23 bit noise shift 
register  */
++      UINT32  noise_p;                                /* current noise 
'phase'                */
++      UINT32  noise_f;                                /* current noise period 
                */
 +
-+/* output level entries (envelope,sinwave) */
-+/* envelope counter lower bits */
-+#define ENV_BITS 16
-+/* envelope output entries */
-+#define EG_ENT   4096
-+/* used dynamic memory = EG_ENT*4*4(byte)or EG_ENT*6*4(byte) */
-+/* used static  memory = EG_ENT*4 (byte)                     */
-+
-+#define EG_OFF   ((2*EG_ENT)<<ENV_BITS)  /* OFF          */
-+#define EG_DED   EG_OFF
-+#define EG_DST   (EG_ENT<<ENV_BITS)      /* DECAY  START */
-+#define EG_AED   EG_DST
-+#define EG_AST   0                       /* ATTACK START */
-+
-+#define EG_STEP (96.0/EG_ENT) /* OPL is 0.1875 dB step  */
-+
-+/* LFO table entries */
-+#define VIB_ENT 512
-+#define VIB_SHIFT (32-9)
-+#define AMS_ENT 512
-+#define AMS_SHIFT (32-9)
-+
-+#define VIB_RATE 256
-+
-+/* -------------------- local defines , macros --------------------- */
-+
-+/* register number to channel number , slot offset */
-+#define SLOT1 0
-+#define SLOT2 1
-+
-+/* envelope phase */
-+#define ENV_MOD_RR  0x00
-+#define ENV_MOD_DR  0x01
-+#define ENV_MOD_AR  0x02
-+
-+/* -------------------- tables --------------------- */
-+static const int slot_array[32]=
-+{
-+       0, 2, 4, 1, 3, 5,-1,-1,
-+       6, 8,10, 7, 9,11,-1,-1,
-+      12,14,16,13,15,17,-1,-1,
-+      -1,-1,-1,-1,-1,-1,-1,-1
++      UINT8   wavesel;                                /* waveform select 
enable flag  */
++
++      int             T[2];                                   /* timer 
counters                               */
++      UINT8   st[2];                                  /* timer enable         
                        */
++
++#if BUILD_Y8950
++      /* Delta-T ADPCM unit (Y8950) */
++
++      YM_DELTAT *deltat;
++
++      /* Keyboard / I/O interface unit*/
++      UINT8   portDirection;
++      UINT8   portLatch;
++      OPL_PORTHANDLER_R porthandler_r;
++      OPL_PORTHANDLER_W porthandler_w;
++      int             port_param;
++      OPL_PORTHANDLER_R keyboardhandler_r;
++      OPL_PORTHANDLER_W keyboardhandler_w;
++      int             keyboard_param;
++#endif
++
++      /* external event callback handlers */
++      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              */
++
++      UINT8 type;                                             /* chip type    
                                */
++      UINT8 address;                                  /* address register     
                        */
++      UINT8 status;                                   /* status flag          
                        */
++      UINT8 statusmask;                               /* status mask          
                        */
++      UINT8 mode;                                             /* Reg.08 : 
CSM,notesel,etc.    */
++
++      int clock;                                              /* master clock 
 (Hz)                   */
++      int rate;                                               /* sampling 
rate (Hz)                   */
++      double freqbase;                                /* frequency base       
                        */
++      double TimerBase;                               /* Timer base time 
(==sampling time)*/
++} FM_OPL;
++
++
+ 
+-/* -------------------- tables --------------------- */
++/* mapping of register number (offset) to slot number used by the emulator */
+ static const int slot_array[32]=
+ {
+        0, 2, 4, 1, 3, 5,-1,-1,
+@@ -102,135 +292,322 @@ static const int slot_array[32]=
+ };
+ 
+ /* key scale level */
+-#define ML (0.1875*2/EG_STEP)
+-static const UINT32 KSL_TABLE[8*16]=
++/* table is 3dB/octave , DV converts this into 6dB/octave */
++/* 0.1875 is bit 0 weight of the envelope counter (volume) expressed in the 
'decibel' scale */
++#define DV (0.1875/2.0)
++static const UINT32 ksl_tab[8*16]=
+ {
+       /* OCT 0 */
+-       0.000*ML, 0.000*ML, 0.000*ML, 0.000*ML,
+-       0.000*ML, 0.000*ML, 0.000*ML, 0.000*ML,
+-       0.000*ML, 0.000*ML, 0.000*ML, 0.000*ML,
+-       0.000*ML, 0.000*ML, 0.000*ML, 0.000*ML,
++       0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV,
++       0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV,
++       0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV,
++       0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV,
+       /* OCT 1 */
+-       0.000*ML, 0.000*ML, 0.000*ML, 0.000*ML,
+-       0.000*ML, 0.000*ML, 0.000*ML, 0.000*ML,
+-       0.000*ML, 0.750*ML, 1.125*ML, 1.500*ML,
+-       1.875*ML, 2.250*ML, 2.625*ML, 3.000*ML,
++       0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV,
++       0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV,
++       0.000/DV, 0.750/DV, 1.125/DV, 1.500/DV,
++       1.875/DV, 2.250/DV, 2.625/DV, 3.000/DV,
+       /* OCT 2 */
+-       0.000*ML, 0.000*ML, 0.000*ML, 0.000*ML,
+-       0.000*ML, 1.125*ML, 1.875*ML, 2.625*ML,
+-       3.000*ML, 3.750*ML, 4.125*ML, 4.500*ML,
+-       4.875*ML, 5.250*ML, 5.625*ML, 6.000*ML,
++       0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV,
++       0.000/DV, 1.125/DV, 1.875/DV, 2.625/DV,
++       3.000/DV, 3.750/DV, 4.125/DV, 4.500/DV,
++       4.875/DV, 5.250/DV, 5.625/DV, 6.000/DV,
+       /* OCT 3 */
+-       0.000*ML, 0.000*ML, 0.000*ML, 1.875*ML,
+-       3.000*ML, 4.125*ML, 4.875*ML, 5.625*ML,
+-       6.000*ML, 6.750*ML, 7.125*ML, 7.500*ML,
+-       7.875*ML, 8.250*ML, 8.625*ML, 9.000*ML,
++       0.000/DV, 0.000/DV, 0.000/DV, 1.875/DV,
++       3.000/DV, 4.125/DV, 4.875/DV, 5.625/DV,
++       6.000/DV, 6.750/DV, 7.125/DV, 7.500/DV,
++       7.875/DV, 8.250/DV, 8.625/DV, 9.000/DV,
+       /* OCT 4 */
+-       0.000*ML, 0.000*ML, 3.000*ML, 4.875*ML,
+-       6.000*ML, 7.125*ML, 7.875*ML, 8.625*ML,
+-       9.000*ML, 9.750*ML,10.125*ML,10.500*ML,
+-      10.875*ML,11.250*ML,11.625*ML,12.000*ML,
++       0.000/DV, 0.000/DV, 3.000/DV, 4.875/DV,
++       6.000/DV, 7.125/DV, 7.875/DV, 8.625/DV,
++       9.000/DV, 9.750/DV,10.125/DV,10.500/DV,
++      10.875/DV,11.250/DV,11.625/DV,12.000/DV,
+       /* OCT 5 */
+-       0.000*ML, 3.000*ML, 6.000*ML, 7.875*ML,
+-       9.000*ML,10.125*ML,10.875*ML,11.625*ML,
+-      12.000*ML,12.750*ML,13.125*ML,13.500*ML,
+-      13.875*ML,14.250*ML,14.625*ML,15.000*ML,
++       0.000/DV, 3.000/DV, 6.000/DV, 7.875/DV,
++       9.000/DV,10.125/DV,10.875/DV,11.625/DV,
++      12.000/DV,12.750/DV,13.125/DV,13.500/DV,
++      13.875/DV,14.250/DV,14.625/DV,15.000/DV,
+       /* OCT 6 */
+-       0.000*ML, 6.000*ML, 9.000*ML,10.875*ML,
+-      12.000*ML,13.125*ML,13.875*ML,14.625*ML,
+-      15.000*ML,15.750*ML,16.125*ML,16.500*ML,
+-      16.875*ML,17.250*ML,17.625*ML,18.000*ML,
++       0.000/DV, 6.000/DV, 9.000/DV,10.875/DV,
++      12.000/DV,13.125/DV,13.875/DV,14.625/DV,
++      15.000/DV,15.750/DV,16.125/DV,16.500/DV,
++      16.875/DV,17.250/DV,17.625/DV,18.000/DV,
+       /* OCT 7 */
+-       0.000*ML, 9.000*ML,12.000*ML,13.875*ML,
+-      15.000*ML,16.125*ML,16.875*ML,17.625*ML,
+-      18.000*ML,18.750*ML,19.125*ML,19.500*ML,
+-      19.875*ML,20.250*ML,20.625*ML,21.000*ML
++       0.000/DV, 9.000/DV,12.000/DV,13.875/DV,
++      15.000/DV,16.125/DV,16.875/DV,17.625/DV,
++      18.000/DV,18.750/DV,19.125/DV,19.500/DV,
++      19.875/DV,20.250/DV,20.625/DV,21.000/DV
+ };
+-#undef ML
++#undef DV
+ 
+-/* sustain lebel table (3db per step) */
++/* sustain level table (3dB per step) */
+ /* 0 - 15: 0, 3, 6, 9,12,15,18,21,24,27,30,33,36,39,42,93 (dB)*/
+-#define SC(db) (db*((3/EG_STEP)*(1<<ENV_BITS)))+EG_DST
+-static const INT32 SL_TABLE[16]={
++#define SC(db) (UINT32) ( db * (2.0/ENV_STEP) )
++static const UINT32 sl_tab[16]={
+  SC( 0),SC( 1),SC( 2),SC(3 ),SC(4 ),SC(5 ),SC(6 ),SC( 7),
+  SC( 8),SC( 9),SC(10),SC(11),SC(12),SC(13),SC(14),SC(31)
+ };
+ #undef SC
+ 
+-#define TL_MAX (EG_ENT*2) /* limit(tl + ksr + envelope) + sinwave */
+-/* TotalLevel : 48 24 12  6  3 1.5 0.75 (dB) */
+-/* TL_TABLE[ 0      to TL_MAX          ] : plus  section */
+-/* TL_TABLE[ TL_MAX to TL_MAX+TL_MAX-1 ] : minus section */
+-static INT32 *TL_TABLE;
+ 
+-/* pointers to TL_TABLE with sinwave output offset */
+-static INT32 **SIN_TABLE;
++#define RATE_STEPS (8)
++static const unsigned char eg_inc[15*RATE_STEPS]={
++
++/*cycle:0 1  2 3  4 5  6 7*/
++
++/* 0 */ 0,1, 0,1, 0,1, 0,1, /* rates 00..12 0 (increment by 0 or 1) */
++/* 1 */ 0,1, 0,1, 1,1, 0,1, /* rates 00..12 1 */
++/* 2 */ 0,1, 1,1, 0,1, 1,1, /* rates 00..12 2 */
++/* 3 */ 0,1, 1,1, 1,1, 1,1, /* rates 00..12 3 */
++
++/* 4 */ 1,1, 1,1, 1,1, 1,1, /* rate 13 0 (increment by 1) */
++/* 5 */ 1,1, 1,2, 1,1, 1,2, /* rate 13 1 */
++/* 6 */ 1,2, 1,2, 1,2, 1,2, /* rate 13 2 */
++/* 7 */ 1,2, 2,2, 1,2, 2,2, /* rate 13 3 */
++
++/* 8 */ 2,2, 2,2, 2,2, 2,2, /* rate 14 0 (increment by 2) */
++/* 9 */ 2,2, 2,4, 2,2, 2,4, /* rate 14 1 */
++/*10 */ 2,4, 2,4, 2,4, 2,4, /* rate 14 2 */
++/*11 */ 2,4, 4,4, 2,4, 4,4, /* rate 14 3 */
++
++/*12 */ 4,4, 4,4, 4,4, 4,4, /* rates 15 0, 15 1, 15 2, 15 3 (increment by 4) 
*/
++/*13 */ 8,8, 8,8, 8,8, 8,8, /* rates 15 2, 15 3 for attack */
++/*14 */ 0,0, 0,0, 0,0, 0,0, /* infinity rates for attack and decay(s) */
 +};
 +
-+/* key scale level */
-+#define ML (0.1875*2/EG_STEP)
-+static const UINT32 KSL_TABLE[8*16]=
-+{
-+      /* OCT 0 */
-+       0.000*ML, 0.000*ML, 0.000*ML, 0.000*ML,
-+       0.000*ML, 0.000*ML, 0.000*ML, 0.000*ML,
-+       0.000*ML, 0.000*ML, 0.000*ML, 0.000*ML,
-+       0.000*ML, 0.000*ML, 0.000*ML, 0.000*ML,
-+      /* OCT 1 */
-+       0.000*ML, 0.000*ML, 0.000*ML, 0.000*ML,
-+       0.000*ML, 0.000*ML, 0.000*ML, 0.000*ML,
-+       0.000*ML, 0.750*ML, 1.125*ML, 1.500*ML,
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/xmp/xmp-nondfsg.patch?r1=1.1&r2=1.2&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to