diff jssplr.h @ 183:a65f0c3deaa7

Some more player logic cleanups and variable renames.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 06 Oct 2012 14:58:29 +0300
parents 9024d249e47a
children 47c327fb321a
line wrap: on
line diff
--- a/jssplr.h	Sat Oct 06 13:25:37 2012 +0300
+++ b/jssplr.h	Sat Oct 06 14:58:29 2012 +0300
@@ -31,27 +31,60 @@
 #define cdfStop             (0x80)    // Stop channel playing
 
 
+// Player envelope data
+typedef struct
+{
+    int frame, value;
+    BOOL exec;
+} JSSPlayerEnvelope;
+
+
+typedef struct
+{
+    int pos, speed, depth, wc;
+} JSSPlayerVData;
+
+
 // Player channel structure
 typedef struct
 {
-    int     iPatLoopRow,            // Pattern loop start row
+    JSSPlayerEnvelope volumeEnv, panningEnv;
+
+    JSSPlayerVData vibrato, tremolo;
+        
+    BOOL    keyOff;
+
+    JSSInstrument  *instrument;           // Instrument
+    JSSExtInstrument *extInstrument;       // ExtInstrument
+    int     ninstrument,
+            nextInstrument,
+            note,                 // Current note
+            pitch,                // Pitch (NOT actual frequency!)
+            oldPitch,
+            position,             // Sample position
+            volume,               // Volume
+            panning,              // Panning position
+
+            newDataFlags,         // New data flags
+
+            fadeOutVol,
+
+            iCAutoVib_Frame,
+
+            iCLastFineVolumeslideUpParam,
+            iCLastFineVolumeslideDownParam,
+            iCLastExtraFinePortamentoUpParam,
+            iCLastExtraFinePortamentoDownParam,
+            iCLastFinePortamentoUpParam,
+            iCLastFinePortamentoDownParam,
+
+            iPatLoopRow,            // Pattern loop start row
             iPatLoopCount,          // Pattern loop count
         
             iLastPortaParam,        // Last portamento effect parameter
             iLastPortaToNoteParam,  // Last porta-to-note parameter
             iLastPortaToNotePitch,  // Last porta-to-note pitch
 
-            iVibratoPos,            // Vibrato waveform position
-            iVibratoSpeed,          // Vibrato speed
-            iVibratoDepth,          // Vibrato depth
-            iVibratoWC,             // Vibrato wave control
-
-            iTremoloPos,            // Tremolo waveform position
-            iTremoloSpeed,          // Tremolo speed
-            iTremoloDepth,          // Tremolo depth
-
-            iTremoloWC,             // Tremolo wave control
-
             iLastTremorParam,
             iTremorCount,
             iLastSampleOffset,
@@ -60,40 +93,6 @@
         
             iRetrigNDFlags,         // For retrig-effect
             iSaveNDFlags;           // For notedelay-effect
-
-    // Current channel data
-    JSSInstrument  *iCInstrument;           // Instrument
-    JSSExtInstrument *iCExtInstrument;       // ExtInstrument
-    int     iCInstrumentN,
-            iCExtInstrumentN,
-            iCNote,                 // Current note
-            iCPitch,                // Pitch (NOT actual frequency!)
-            iCOldPitch,
-            iCPosition,             // Sample position
-            iCVolume,               // Volume
-            iCPanning,              // Panning position
-
-            iCNewDataFlags,         // New data flags
-
-            iCFadeOutVol,
-
-            iCPanEnv,
-            iCVolEnv,
-
-            iCAutoVib_Frames,
-            iCPanEnv_Frames,
-            iCVolEnv_Frames,
-
-            iCLastFineVolumeslideUpParam,
-            iCLastFineVolumeslideDownParam,
-            iCLastExtraFinePortamentoUpParam,
-            iCLastExtraFinePortamentoDownParam,
-            iCLastFinePortamentoUpParam,
-            iCLastFinePortamentoDownParam;
-    
-    BOOL    iCPanEnv_Exec,
-            iCVolEnv_Exec,
-            iCKeyOff;
 } JSSPlayerChannel;
 
 
@@ -119,14 +118,13 @@
     int     patternDelay,       // Pattern delay tick-counter
             lastPatLoopRow;     // Latest set pattern loop row (any channel)
 
+    BOOL    jumpFlag,           // Pattern jump flag
+            breakFlag;          // Pattern break flag
 
     // All channels for this player
 //    int     nchannels;
     JSSPlayerChannel channels[jsetNChannels];
 
-    // Parameters for effects, etc
-    BOOL    jumpFlag,           // Pattern jump flag
-            breakFlag;          // Pattern break flag
 
     // Module and sounddevice specific
     JSSModule *module;          // Current module in this player
@@ -158,8 +156,8 @@
 /* Helper macros
  */
 #define JMPMAKEPARAM(AIVAL, AVALX, AVALY) { AVALX = (((AIVAL) >> 4) & 0x0f); AVALY = ((AIVAL) & 0x0f); }
-#define JMPSETNDFLAGS(IVAL) chn->iCNewDataFlags |= IVAL
-#define JMPUNSETNDFLAGS(IVAL) chn->iCNewDataFlags &= (~(IVAL))
+#define JMPSETNDFLAGS(IVAL) chn->newDataFlags |= IVAL
+#define JMPUNSETNDFLAGS(IVAL) chn->newDataFlags &= (~(IVAL))
 #define JMPGETNOTE(MNOTE, MROW, MCHAN) assert(mp); assert(mp->pattern); assert((MROW) >= 0); assert((MROW) < mp->pattern->nrows); MNOTE = &mp->pattern->data[(mp->pattern->nchannels * MROW) + (MCHAN)]
 #define JMPGETEFFECT(MEFF, MIEFF) if ((MIEFF >= 0) && (MIEFF < jmpNMODEffectTable)) MEFF = jmpMODEffectTable[MIEFF]; else MEFF = 0
 #define JMPGETMODFLAGS(Q, Z) ((Q->module->defFlags & (Z)) == (Z))