18 #ifndef MT32EMU_LA32_WAVE_GENERATOR_H 19 #define MT32EMU_LA32_WAVE_GENERATOR_H 22 #include "internals.h" 50 static Bit16u interpolateExp(
const Bit16u fract);
51 static Bit16s unlog(
const LogSample &logSample);
71 bool sawtoothWaveform;
92 const Bit16s *pcmWaveAddress;
101 bool pcmWaveInterpolated;
116 Bit32u squareWavePosition;
123 Bit32u resonanceSinePosition;
127 Bit32u resonanceAmpSubtraction;
130 Bit32u resAmpDecayFactor;
133 Bit32u pcmInterpolationFactor;
137 POSITIVE_RISING_SINE_SEGMENT,
138 POSITIVE_LINEAR_SEGMENT,
139 POSITIVE_FALLING_SINE_SEGMENT,
140 NEGATIVE_FALLING_SINE_SEGMENT,
141 NEGATIVE_LINEAR_SEGMENT,
142 NEGATIVE_RISING_SINE_SEGMENT
146 enum ResonancePhase {
147 POSITIVE_RISING_RESONANCE_SINE_SEGMENT,
148 POSITIVE_FALLING_RESONANCE_SINE_SEGMENT,
149 NEGATIVE_FALLING_RESONANCE_SINE_SEGMENT,
150 NEGATIVE_RISING_RESONANCE_SINE_SEGMENT
165 Bit32u getSampleStep();
166 Bit32u getResonanceWaveLengthFactor(Bit32u effectiveCutoffValue);
167 Bit32u getHighLinearLength(Bit32u effectiveCutoffValue);
169 void computePositions(Bit32u highLinearLength, Bit32u lowLinearLength, Bit32u resonanceWaveLengthFactor);
170 void advancePosition();
172 void generateNextSquareWaveLogSample();
173 void generateNextResonanceWaveLogSample();
174 void generateNextSawtoothCosineLogSample(
LogSample &logSample)
const;
176 void pcmSampleToLogSample(
LogSample &logSample,
const Bit16s pcmSample)
const;
177 void generateNextPCMWaveLogSamples();
181 void initSynth(
const bool sawtoothWaveform,
const Bit8u pulseWidth,
const Bit8u resonance);
184 void initPCM(
const Bit16s *
const pcmWaveAddress,
const Bit32u pcmWaveLength,
const bool pcmWaveLooped,
const bool pcmWaveInterpolated);
187 void generateNextSample(
const Bit32u amp,
const Bit16u pitch,
const Bit32u cutoff);
190 LogSample getOutputLogSample(
const bool first)
const;
196 bool isActive()
const;
199 bool isPCMWave()
const;
202 Bit32u getPCMInterpolationFactor()
const;
218 virtual void init(
const bool ringModulated,
const bool mixed) = 0;
221 virtual void initSynth(
const PairType master,
const bool sawtoothWaveform,
const Bit8u pulseWidth,
const Bit8u resonance) = 0;
224 virtual void initPCM(
const PairType master,
const Bit16s *
const pcmWaveAddress,
const Bit32u pcmWaveLength,
const bool pcmWaveLooped) = 0;
227 virtual void deactivate(
const PairType master) = 0;
242 void init(
const bool ringModulated,
const bool mixed);
245 void initSynth(
const PairType master,
const bool sawtoothWaveform,
const Bit8u pulseWidth,
const Bit8u resonance);
248 void initPCM(
const PairType master,
const Bit16s *
const pcmWaveAddress,
const Bit32u pcmWaveLength,
const bool pcmWaveLooped);
251 void generateNextSample(
const PairType master,
const Bit32u amp,
const Bit16u pitch,
const Bit32u cutoff);
255 Bit16s nextOutSample();
258 void deactivate(
const PairType master);
261 bool isActive(
const PairType master)
const;
266 #endif // #ifndef MT32EMU_LA32_WAVE_GENERATOR_H Definition: LA32WaveGenerator.h:230
Definition: LA32WaveGenerator.h:206
Definition: LA32WaveGenerator.h:48
Definition: LA32WaveGenerator.h:63
Definition: LA32WaveGenerator.h:37