Mercurial > hg > dmlib
comparison jssplr.h @ 55:e0e470c3fc8e
Initial round of cleaning up the player code a bit.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 01 Oct 2012 06:28:29 +0300 |
parents | 32250b436bca |
children | 2884a611042b |
comparison
equal
deleted
inserted
replaced
54:65cdb4de6fd8 | 55:e0e470c3fc8e |
---|---|
27 #define cdfNewPanPos (0x10) // Set a new panning position | 27 #define cdfNewPanPos (0x10) // Set a new panning position |
28 #define cdfNewGlobalVol (0x20) // Set a new global volume | 28 #define cdfNewGlobalVol (0x20) // Set a new global volume |
29 #define cdfStop (0x80) // Stop channel playing | 29 #define cdfStop (0x80) // Stop channel playing |
30 | 30 |
31 | 31 |
32 // Typedefs for channel structures | 32 // Player channel structure |
33 typedef int JDInt[jsetNChannels]; | |
34 typedef BOOL JDBool[jsetNChannels]; | |
35 typedef JSSInstrument * JDInst[jsetNChannels]; | |
36 typedef JSSExtInstrument * JDEInst[jsetNChannels]; | |
37 | |
38 | |
39 // Struct holding all player related information | |
40 typedef struct | 33 typedef struct |
41 { | 34 { |
42 // General variables | 35 int iPatLoopRow, // Pattern loop start row |
43 int iTempo, // Current values | 36 iPatLoopCount, // Pattern loop count |
44 iSpeed, | |
45 iTick, | |
46 iOrder, | |
47 iPattern, | |
48 iRow, | |
49 iGlobalVol, | |
50 iOptions; // Playing option flags | |
51 BOOL isPlaying; // Are we playing? | |
52 | |
53 int iNewOrder, // NEW order number | |
54 iNewRow; // NEW row number | |
55 BOOL newOrderSet, // TRUE if new order has been set | |
56 newRowSet; // TRUE if new row has been set | |
57 | |
58 // Parameters for effects, etc | |
59 BOOL jumpFlag, // Pattern jump flag | |
60 breakFlag; // Pattern break flag | |
61 int iPatternDelay, // Pattern delay tick-counter | |
62 iLastPatLoopRow; // Latest set pattern loop row (any channel) | |
63 | |
64 JDInt iPatLoopRow, // Pattern loop start row for each channel | |
65 iPatLoopCount, // Pattern loop count for each channel | |
66 | 37 |
67 iLastPortaParam, // Last portamento effect parameter | 38 iLastPortaParam, // Last portamento effect parameter |
68 iLastPortaToNoteParam, // Last porta-to-note parameter | 39 iLastPortaToNoteParam, // Last porta-to-note parameter |
69 iLastPortaToNotePitch, // Last porta-to-note pitch | 40 iLastPortaToNotePitch, // Last porta-to-note pitch |
70 | 41 |
87 | 58 |
88 iRetrigNDFlags, // For retrig-effect | 59 iRetrigNDFlags, // For retrig-effect |
89 iSaveNDFlags; // For notedelay-effect | 60 iSaveNDFlags; // For notedelay-effect |
90 | 61 |
91 // Current channel data | 62 // Current channel data |
92 JDInst iCInstrument; // Instruments | 63 JSSInstrument *iCInstrument; // Instrument |
93 JDEInst iCExtInstrument; // ExtInstruments | 64 JSSExtInstrument *iCExtInstrument; // ExtInstrument |
94 JDInt iCInstrumentN, | 65 int iCInstrumentN, |
95 iCExtInstrumentN, | 66 iCExtInstrumentN, |
67 iCNote, // Current note | |
68 iCPitch, // Pitch (NOT actual frequency!) | |
69 iCOldPitch, | |
70 iCPosition, // Sample position | |
71 iCVolume, // Volume | |
72 iCPanning, // Panning position | |
73 | |
96 iCNewDataFlags, // New data flags | 74 iCNewDataFlags, // New data flags |
97 iCNote, // Current notes | |
98 iCPitch, // Pitches (NOT actual frequencies!) | |
99 iCOldPitch, | |
100 iCPosition, // Sample positions | |
101 iCVolume, // Volumes | |
102 iCPanning, // Panning positions | |
103 | 75 |
104 iCFadeOutVol, | 76 iCFadeOutVol, |
105 | 77 |
106 iCPanEnv, | 78 iCPanEnv, |
107 iCVolEnv, | 79 iCVolEnv, |
115 iCLastExtraFinePortamentoUpParam, | 87 iCLastExtraFinePortamentoUpParam, |
116 iCLastExtraFinePortamentoDownParam, | 88 iCLastExtraFinePortamentoDownParam, |
117 iCLastFinePortamentoUpParam, | 89 iCLastFinePortamentoUpParam, |
118 iCLastFinePortamentoDownParam; | 90 iCLastFinePortamentoDownParam; |
119 | 91 |
120 JDBool iCPanEnv_Exec, | 92 BOOL iCPanEnv_Exec, |
121 iCVolEnv_Exec, | 93 iCVolEnv_Exec, |
122 iCKeyOff; | 94 iCKeyOff; |
95 } JSSPlayerChannel; | |
96 | |
97 | |
98 // Struct holding all player related information | |
99 typedef struct | |
100 { | |
101 // General variables | |
102 int tempo, // Current values | |
103 speed, | |
104 tick, | |
105 order, | |
106 npattern, | |
107 row, | |
108 globalVol, | |
109 options; // Playing option flags | |
110 BOOL isPlaying; // Are we playing? | |
111 | |
112 int newOrder, // NEW order number | |
113 newRow; // NEW row number | |
114 BOOL newOrderSet, // TRUE if new order has been set | |
115 newRowSet; // TRUE if new row has been set | |
116 | |
117 int patternDelay, // Pattern delay tick-counter | |
118 lastPatLoopRow; // Latest set pattern loop row (any channel) | |
119 | |
120 | |
121 // All channels for this player | |
122 // int nchannels; | |
123 JSSPlayerChannel channels[jsetNChannels]; | |
124 | |
125 // Parameters for effects, etc | |
126 BOOL jumpFlag, // Pattern jump flag | |
127 breakFlag; // Pattern break flag | |
123 | 128 |
124 // Module and sounddevice specific | 129 // Module and sounddevice specific |
125 JSSModule *pModule; // Current module in this player | 130 JSSModule *module; // Current module in this player |
126 JSSPattern *pPattern; // Current pattern | 131 JSSPattern *pattern; // Current pattern |
127 JSSMixer *pDevice; // Pointer to mixing device structure | 132 JSSMixer *device; // Pointer to mixing device structure |
128 | 133 |
129 #ifdef JSS_SUP_THREADS | 134 #ifdef JSS_SUP_THREADS |
130 DMMutex *mutex; | 135 DMMutex *mutex; |
131 #endif | 136 #endif |
132 | 137 |
146 | 151 |
147 | 152 |
148 /* Helper macros | 153 /* Helper macros |
149 */ | 154 */ |
150 #define JMPMAKEPARAM(AIVAL, AVALX, AVALY) { AVALX = (((AIVAL) >> 4) & 0x0f); AVALY = ((AIVAL) & 0x0f); } | 155 #define JMPMAKEPARAM(AIVAL, AVALX, AVALY) { AVALX = (((AIVAL) >> 4) & 0x0f); AVALY = ((AIVAL) & 0x0f); } |
151 #define JMPSETNDFLAGS(IVAL) mp->iCNewDataFlags[channel] |= IVAL | 156 #define JMPSETNDFLAGS(IVAL) chn->iCNewDataFlags |= IVAL |
152 #define JMPUNSETNDFLAGS(IVAL) mp->iCNewDataFlags[channel] &= (~(IVAL)) | 157 #define JMPUNSETNDFLAGS(IVAL) chn->iCNewDataFlags &= (~(IVAL)) |
153 #define JMPGETNOTE(MNOTE, MROW, MCHAN) assert(mp); assert(mp->pPattern); assert((MROW) >= 0); assert((MROW) < mp->pPattern->nrows); MNOTE = &mp->pPattern->data[(mp->pPattern->nchannels * MROW) + (MCHAN)] | 158 #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)] |
154 #define JMPGETEFFECT(MEFF, MIEFF) if ((MIEFF >= 0) && (MIEFF < jmpNMODEffectTable)) MEFF = jmpMODEffectTable[MIEFF]; else MEFF = 0 | 159 #define JMPGETEFFECT(MEFF, MIEFF) if ((MIEFF >= 0) && (MIEFF < jmpNMODEffectTable)) MEFF = jmpMODEffectTable[MIEFF]; else MEFF = 0 |
155 #define JMPGETMODFLAGS(Q, Z) ((Q->pModule->defFlags & (Z)) == (Z)) | 160 #define JMPGETMODFLAGS(Q, Z) ((Q->module->defFlags & (Z)) == (Z)) |
156 | 161 |
157 | 162 |
158 /* Debugging macros | 163 /* Debugging macros |
159 */ | 164 */ |
160 #if !defined(JSS_LIGHT) && defined(JSS_DEBUG) | 165 #if !defined(JSS_LIGHT) && defined(JSS_DEBUG) |