annotate minijss/jssplr.h @ 2298:b5abfff07ca9

Add new DMGrowBuf helper functions dmGrowBufCopyOffsSize() and dmGrowBufConstCopyOffsSize().
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 04 Jul 2019 10:54:16 +0300
parents ffa540ec354d
children 9807ae37ad69
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 * miniJSS - Module playing routines
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 * Programmed and designed by Matti 'ccr' Hamalainen
1163
aa3738b121d1 Bump copyright years.
Matti Hamalainen <ccr@tnsp.org>
parents: 1127
diff changeset
4 * (C) Copyright 2006-2015 Tecnic Software productions (TNSP)
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 */
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 #ifndef JSSPLR_H
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 #define JSSPLR_H
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 #include "jss.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 #include "jssmod.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 #include "jssmix.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12
358
3bdc776a4b33 Add C++ guards.
Matti Hamalainen <ccr@tnsp.org>
parents: 271
diff changeset
13 #ifdef __cplusplus
3bdc776a4b33 Add C++ guards.
Matti Hamalainen <ccr@tnsp.org>
parents: 271
diff changeset
14 extern "C" {
3bdc776a4b33 Add C++ guards.
Matti Hamalainen <ccr@tnsp.org>
parents: 271
diff changeset
15 #endif
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 // Player general constants
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 #define mpMinVol (0)
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 #define mpMaxVol (64)
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 #define mpPanCenter (0)
143
17a1c46db7eb It would seem, based on tests, that the actual starting value for XM ext
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
21 //#define mpMaxFadeoutVol (65535)
191
0e02b81b05e1 Initial fadeout volume changed to 32767.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
22 #define mpMaxFadeoutVol (32767)
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 // Channel New-Data flags
193
b778cc2fe7c8 Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 191
diff changeset
26 #define cdfNONE (0x000) // Set nothing
b778cc2fe7c8 Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 191
diff changeset
27 #define cdfNewInstr (0x001) // Set a new instrument
b778cc2fe7c8 Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 191
diff changeset
28 #define cdfNewPitch (0x002) // Set a new pitch
b778cc2fe7c8 Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 191
diff changeset
29 #define cdfNewPos (0x004) // Set a new position
b778cc2fe7c8 Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 191
diff changeset
30 #define cdfNewVolume (0x008) // Set a new volume
b778cc2fe7c8 Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 191
diff changeset
31 #define cdfNewPanPos (0x010) // Set a new panning position
b778cc2fe7c8 Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 191
diff changeset
32 #define cdfNewGlobalVol (0x020) // Set a new global volume
b778cc2fe7c8 Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 191
diff changeset
33 #define cdfNewFreq (0x040) // New frequency
b778cc2fe7c8 Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 191
diff changeset
34 #define cdfPlay (0x100) // Start or restart playing sample
b778cc2fe7c8 Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 191
diff changeset
35 #define cdfStop (0x200) // Stop channel playing
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37
183
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
38 // Player envelope data
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
39 typedef struct
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
40 {
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
41 int frame, value;
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
42 BOOL exec;
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
43 } JSSPlayerEnvelope;
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
44
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
45
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
46 typedef struct
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
47 {
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
48 int pos, speed, depth, wc;
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
49 } JSSPlayerVData;
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
50
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
51
55
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
52 // Player channel structure
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 typedef struct
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 {
183
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
55 JSSPlayerEnvelope volumeEnv, panningEnv;
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
56
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
57 JSSPlayerVData vibrato, tremolo;
1127
e22d4ceb6414 Cosmetics pass, remove excess and trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 658
diff changeset
58
183
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
59 BOOL keyOff;
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
60
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
61 JSSInstrument *instrument; // Instrument
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
62 JSSExtInstrument *extInstrument; // ExtInstrument
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
63 int ninstrument,
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
64 nextInstrument,
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
65 note, // Current note
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
66 pitch, // Pitch (NOT actual frequency!)
193
b778cc2fe7c8 Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 191
diff changeset
67 freq, cfreq,
183
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
68 oldPitch,
224
81f3993412ae Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents: 223
diff changeset
69 oldNote,
183
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
70 position, // Sample position
365
5a003246a735 Refactor volume and panning handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 358
diff changeset
71 volume, cvolume, // Volume
183
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
72 panning, // Panning position
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
73
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
74 newDataFlags, // New data flags
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
75
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
76 fadeOutVol,
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
77
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
78 iCAutoVib_Frame,
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
79
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
80 iCLastFineVolumeslideUpParam,
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
81 iCLastFineVolumeslideDownParam,
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
82 iCLastExtraFinePortamentoUpParam,
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
83 iCLastExtraFinePortamentoDownParam,
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
84 iCLastFinePortamentoUpParam,
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
85 iCLastFinePortamentoDownParam,
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
86
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
87 iPatLoopRow, // Pattern loop start row
55
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
88 iPatLoopCount, // Pattern loop count
1127
e22d4ceb6414 Cosmetics pass, remove excess and trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 658
diff changeset
89
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 iLastPortaParam, // Last portamento effect parameter
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 iLastPortaToNoteParam, // Last porta-to-note parameter
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 iLastPortaToNotePitch, // Last porta-to-note pitch
224
81f3993412ae Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents: 223
diff changeset
93 lastPortaToNoteNote,
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 iLastTremorParam,
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 iTremorCount,
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 iLastSampleOffset,
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 iLastVolSlideParam,
223
9fa8e9326d18 Implement effect Rxy - multi retrig note.
Matti Hamalainen <ccr@tnsp.org>
parents: 193
diff changeset
99
9fa8e9326d18 Implement effect Rxy - multi retrig note.
Matti Hamalainen <ccr@tnsp.org>
parents: 193
diff changeset
100 lastMultiRetrigParamX,
9fa8e9326d18 Implement effect Rxy - multi retrig note.
Matti Hamalainen <ccr@tnsp.org>
parents: 193
diff changeset
101 lastMultiRetrigParamY,
271
6d9a3577741b XM effect '9xx' stores its last non-zero parameter.
Matti Hamalainen <ccr@tnsp.org>
parents: 224
diff changeset
102
6d9a3577741b XM effect '9xx' stores its last non-zero parameter.
Matti Hamalainen <ccr@tnsp.org>
parents: 224
diff changeset
103 lastSampleOffsetParam,
1127
e22d4ceb6414 Cosmetics pass, remove excess and trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 658
diff changeset
104
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105 iSaveNDFlags; // For notedelay-effect
55
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
106 } JSSPlayerChannel;
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
107
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
108
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
109 // Struct holding all player related information
136
8ac24d753304 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 97
diff changeset
110 typedef struct _JSSPlayer
55
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
111 {
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
112 // General variables
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
113 int tempo, // Current values
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
114 speed,
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
115 tick,
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
116 order,
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
117 npattern,
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
118 row,
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
119 globalVol,
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
120 options; // Playing option flags
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
121 BOOL isPlaying; // Are we playing?
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
122
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
123 int newOrder, // NEW order number
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
124 newRow; // NEW row number
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
125 BOOL newOrderSet, // TRUE if new order has been set
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
126 newRowSet; // TRUE if new row has been set
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
127
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
128 int patternDelay, // Pattern delay tick-counter
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
129 lastPatLoopRow; // Latest set pattern loop row (any channel)
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
130
183
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
131 BOOL jumpFlag, // Pattern jump flag
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
132 breakFlag; // Pattern break flag
55
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
133
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
134 // All channels for this player
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
135 // int nchannels;
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
136 JSSPlayerChannel channels[jsetNChannels];
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
137
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 // Module and sounddevice specific
55
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
140 JSSModule *module; // Current module in this player
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
141 JSSPattern *pattern; // Current pattern
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
142 JSSMixer *device; // Pointer to mixing device structure
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 #ifdef JSS_SUP_THREADS
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 DMMutex *mutex;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 #endif
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 } JSSPlayer;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 /* External functions for end users
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 */
1405
ffa540ec354d Clarify function prototypes in the header.
Matti Hamalainen <ccr@tnsp.org>
parents: 1163
diff changeset
153 int jmpPlayOrder(JSSPlayer *plr, int order);
ffa540ec354d Clarify function prototypes in the header.
Matti Hamalainen <ccr@tnsp.org>
parents: 1163
diff changeset
154 int jmpChangeOrder(JSSPlayer *plr, int order);
ffa540ec354d Clarify function prototypes in the header.
Matti Hamalainen <ccr@tnsp.org>
parents: 1163
diff changeset
155 int jmpPlayPattern(JSSPlayer *plr, int pattern);
ffa540ec354d Clarify function prototypes in the header.
Matti Hamalainen <ccr@tnsp.org>
parents: 1163
diff changeset
156 void jmpStop(JSSPlayer *plr);
ffa540ec354d Clarify function prototypes in the header.
Matti Hamalainen <ccr@tnsp.org>
parents: 1163
diff changeset
157 void jmpResume(JSSPlayer *plr);
ffa540ec354d Clarify function prototypes in the header.
Matti Hamalainen <ccr@tnsp.org>
parents: 1163
diff changeset
158 void jmpSetModule(JSSPlayer *plr, JSSModule *module);
ffa540ec354d Clarify function prototypes in the header.
Matti Hamalainen <ccr@tnsp.org>
parents: 1163
diff changeset
159 JSSPlayer * jmpInit(JSSMixer *mixer);
ffa540ec354d Clarify function prototypes in the header.
Matti Hamalainen <ccr@tnsp.org>
parents: 1163
diff changeset
160 int jmpClose(JSSPlayer *plr);
ffa540ec354d Clarify function prototypes in the header.
Matti Hamalainen <ccr@tnsp.org>
parents: 1163
diff changeset
161 void jmpExec(void *dev, void *plr);
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 /* Helper macros
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 */
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166 #define JMPMAKEPARAM(AIVAL, AVALX, AVALY) { AVALX = (((AIVAL) >> 4) & 0x0f); AVALY = ((AIVAL) & 0x0f); }
183
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
167 #define JMPSETNDFLAGS(IVAL) chn->newDataFlags |= IVAL
a65f0c3deaa7 Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
168 #define JMPUNSETNDFLAGS(IVAL) chn->newDataFlags &= (~(IVAL))
55
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
169 #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)]
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 #define JMPGETEFFECT(MEFF, MIEFF) if ((MIEFF >= 0) && (MIEFF < jmpNMODEffectTable)) MEFF = jmpMODEffectTable[MIEFF]; else MEFF = 0
55
e0e470c3fc8e Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
171 #define JMPGETMODFLAGS(Q, Z) ((Q->module->defFlags & (Z)) == (Z))
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174 /* Debugging macros
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 */
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176 #if !defined(JSS_LIGHT) && defined(JSS_DEBUG)
97
2884a611042b Fix building with debug mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
177 # define JMPDEBUG(QQ) { fprintf(stderr, "[o=%03d:p=%03d:r=%03d] (%c/%x:%x) %s\n", mp->order, mp->npattern, mp->row, effect, currNote->effect, currNote->param, QQ ); }
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178 #else
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179 # define JMPDEBUG(QQ) // stub
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180 #endif
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181
358
3bdc776a4b33 Add C++ guards.
Matti Hamalainen <ccr@tnsp.org>
parents: 271
diff changeset
182 #ifdef __cplusplus
3bdc776a4b33 Add C++ guards.
Matti Hamalainen <ccr@tnsp.org>
parents: 271
diff changeset
183 }
3bdc776a4b33 Add C++ guards.
Matti Hamalainen <ccr@tnsp.org>
parents: 271
diff changeset
184 #endif
3bdc776a4b33 Add C++ guards.
Matti Hamalainen <ccr@tnsp.org>
parents: 271
diff changeset
185
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 #endif // JSSPLR_H