1 /* AHX originally by Pink/Abyss and bigup Xeron for Hivelytracker! */
4 typedef unsigned char uint8
;
6 typedef unsigned short uint16
;
8 typedef unsigned int uint32
;
9 typedef double float64
;
17 #define MAX_CHANNELS 16
19 #define Period2Freq(period) ((3546897.f * 65536.f) / (period))
21 #define HIVELY_LEN FREQ/50
22 #define OUTPUT_LEN 4096
26 int16 aFrames
, aVolume
;
27 int16 dFrames
, dVolume
;
29 int16 rFrames
, rVolume
;
46 struct hvl_plsentry
*pls_Entries
;
54 uint8 ins_FilterLowerLimit
;
55 uint8 ins_FilterUpperLimit
;
56 uint8 ins_FilterSpeed
;
57 uint8 ins_SquareLowerLimit
;
58 uint8 ins_SquareUpperLimit
;
59 uint8 ins_SquareSpeed
;
60 uint8 ins_VibratoDelay
;
61 uint8 ins_VibratoSpeed
;
62 uint8 ins_VibratoDepth
;
63 uint8 ins_HardCutRelease
;
64 uint8 ins_HardCutReleaseFrames
;
65 struct hvl_envelope ins_Envelope
;
66 struct hvl_plist ins_PList
;
71 uint8 pos_Track
[MAX_CHANNELS
];
72 int8 pos_Transpose
[MAX_CHANNELS
];
90 int16 vc_NextTranspose
;
91 int16 vc_OverrideTranspose
; // 1.5
93 struct hvl_envelope vc_ADSR
;
94 struct hvl_instrument
*vc_Instrument
;
97 uint16 vc_InstrPeriod
;
98 uint16 vc_TrackPeriod
;
99 uint16 vc_VibratoPeriod
;
100 uint16 vc_WaveLength
;
101 int16 vc_NoteMaxVolume
;
102 uint16 vc_PerfSubVolume
;
103 uint8 vc_NewWaveform
;
105 uint8 vc_PlantPeriod
;
106 uint8 vc_VoiceVolume
;
107 uint8 vc_PlantSquare
;
108 uint8 vc_IgnoreSquare
;
110 int16 vc_VolumeSlideUp
;
111 int16 vc_VolumeSlideDown
;
113 uint8 vc_HardCutRelease
;
114 int16 vc_HardCutReleaseF
;
115 uint8 vc_PeriodSlideOn
;
116 int16 vc_PeriodSlideSpeed
;
117 int16 vc_PeriodSlidePeriod
;
118 int16 vc_PeriodSlideLimit
;
119 int16 vc_PeriodSlideWithLimit
;
120 int16 vc_PeriodPerfSlideSpeed
;
121 int16 vc_PeriodPerfSlidePeriod
;
122 uint8 vc_PeriodPerfSlideOn
;
123 int16 vc_VibratoDelay
;
124 int16 vc_VibratoSpeed
;
125 int16 vc_VibratoCurrent
;
126 int16 vc_VibratoDepth
;
130 int16 vc_SquareLowerLimit
;
131 int16 vc_SquareUpperLimit
;
134 int16 vc_SquareSlidingIn
;
135 int16 vc_SquareReverse
;
139 int16 vc_FilterSpeed
;
140 int16 vc_FilterUpperLimit
;
141 int16 vc_FilterLowerLimit
;
144 int16 vc_FilterSlidingIn
;
145 int16 vc_IgnoreFilter
;
146 int16 vc_PerfCurrent
;
149 struct hvl_plist
*vc_PerfList
;
150 int8
*vc_AudioPointer
;
151 int8
*vc_AudioSource
;
152 uint8 vc_NoteDelayOn
;
154 int16 vc_NoteDelayWait
;
155 int16 vc_NoteCutWait
;
156 int16 vc_AudioPeriod
;
157 int16 vc_AudioVolume
;
160 int8 vc_SquareTempBuffer
[0x80];
161 int8 vc_VoiceBuffer
[0x282*4];
163 uint8 vc_TrackMasterVolume
;
165 int16 vc_VoicePeriod
;
167 uint32 vc_SetPan
; // New for 1.4
168 uint32 vc_PanMultLeft
;
169 uint32 vc_PanMultRight
;
170 uint32 vc_RingSamplePos
;
172 int8
*vc_RingMixSource
;
173 uint8 vc_RingPlantPeriod
;
174 int16 vc_RingInstrPeriod
;
175 int16 vc_RingBasePeriod
;
176 int16 vc_RingAudioPeriod
;
177 int8
*vc_RingAudioSource
;
178 uint8 vc_RingNewWaveform
;
179 uint8 vc_RingWaveform
;
180 uint8 vc_RingFixedPeriod
;
181 int8 vc_RingVoiceBuffer
[0x282*4];
190 int8
*ht_WaveformTab
[MAX_CHANNELS
];
192 uint16 ht_PositionNr
;
193 uint8 ht_SpeedMultiplier
;
194 uint8 ht_TrackLength
;
196 uint8 ht_InstrumentNr
;
199 uint32 ht_PlayingTime
;
202 int16 ht_StepWaitFrames
;
204 uint16 ht_PosJumpNote
;
205 uint8 ht_GetNewPosition
;
206 uint8 ht_PatternBreak
;
207 uint8 ht_SongEndReached
;
211 struct hvl_position
*ht_Positions
;
212 struct hvl_step ht_Tracks
[256][64];
213 struct hvl_instrument
*ht_Instruments
;
214 struct hvl_voice ht_Voices
[MAX_CHANNELS
];
217 int32 ht_defpanright
;
220 //added for pineappletracker
223 int16 hivelyLeft
[HIVELY_LEN
], hivelyRight
[HIVELY_LEN
];
226 void hvl_DecodeFrame( struct hvl_tune
*ht
, int8
*buf1
, int8
*buf2
, int32 bufmod
);
227 void hvl_InitReplayer( void );
228 BOOL
hvl_InitSubsong( struct hvl_tune
*ht
, uint32 nr
);
229 struct hvl_tune
*hvl_LoadTune( TEXT
*name
, uint32 freq
, uint32 defstereo
);
230 void hvl_FreeTune( struct hvl_tune
*ht
);
232 void hvl_process_step( struct hvl_tune
*ht
, struct hvl_voice
*voice
);
233 void hvl_process_frame( struct hvl_tune
*ht
, struct hvl_voice
*voice
);
234 void hvl_set_audio( struct hvl_voice
*voice
, float64 freqf
);
235 //void hvl_playNote(struct hvl_tune *ht, int8 *buf1, int8 *buf2, int32 bufmod, struct hvl_voice *voice);
236 void hvl_iedplonk(int note
, int instr
, void *t
);
238 void hvl_play_irq( struct hvl_tune
*ht
);
239 void hvl_mixchunk( struct hvl_tune
*ht
, uint32 samples
, int8
*buf1
, int8
*buf2
, int32 bufmod
);
241 struct hvl_tune
*htTune
;
243 void hvlSdlCallBack( struct hvl_tune
*ht
, uint8
*stream
, int length
);
246 //int16 hivelyLeft[HIVELY_LEN], hivelyRight[HIVELY_LEN];