diff --git a/pce_fast/blip/Blip_Buffer.cpp b/pce_fast/blip/Blip_Buffer.cpp index a1879d7..33f969b 100644 --- a/pce_fast/blip/Blip_Buffer.cpp +++ b/pce_fast/blip/Blip_Buffer.cpp @@ -173,14 +173,14 @@ void Blip_Buffer_remove_samples(Blip_Buffer* bbuf, long count) // Blip_Synth_ -Blip_Synth_Fast_::Blip_Synth_Fast_() +Blip_Synth::Blip_Synth() { buf = 0; last_amp = 0; delta_factor = 0; } -void Blip_Synth_Fast_::volume_unit(double new_unit) +void Blip_Synth::volume_unit(double new_unit) { delta_factor = int (new_unit * (1L << blip_sample_bits) + 0.5); } diff --git a/pce_fast/blip/Blip_Buffer.h b/pce_fast/blip/Blip_Buffer.h index 86eae70..4e609d2 100644 --- a/pce_fast/blip/Blip_Buffer.h +++ b/pce_fast/blip/Blip_Buffer.h @@ -157,38 +157,33 @@ int const blip_buffer_extra_ = blip_widest_impulse_ + 2; int const blip_res = 1 << BLIP_PHASE_BITS; class blip_eq_t; -class Blip_Synth_Fast_ -{ -public: - Blip_Buffer* buf; - int last_amp; - int delta_factor; - - void volume_unit(double); - Blip_Synth_Fast_(); -}; - // Range specifies the greatest expected change in amplitude. Calculate it // by finding the difference between the maximum and minimum expected // amplitudes (max - min). class Blip_Synth { public: + Blip_Buffer* buf; + int last_amp; + int delta_factor; + void volume_unit(double); + + Blip_Synth(); // Set overall volume of waveform void volume(double v, int range) { - impl.volume_unit(v * (1.0 / (range < 0 ? -range : range))); + volume_unit(v * (1.0 / (range < 0 ? -range : range))); } // Get/set Blip_Buffer used for output Blip_Buffer* output() const { - return impl.buf; + return buf; } void output(Blip_Buffer* b) { - impl.buf = b; - impl.last_amp = 0; + buf = b; + last_amp = 0; } // Update amplitude of waveform at given time. Using this requires a separate @@ -203,7 +198,7 @@ public: void offset(blip_time_t, int delta, Blip_Buffer*) const; void offset(blip_time_t t, int delta) const { - offset(t, delta, impl.buf); + offset(t, delta, buf); } // Works directly in terms of fractional output samples. Contact author for more info. @@ -216,11 +211,8 @@ public: } void offset_inline(blip_time_t t, int delta) const { - offset_resampled(t * impl.buf->factor + impl.buf->offset, delta, impl.buf); + offset_resampled(t * buf->factor + buf->offset, delta, buf); } - -private: - Blip_Synth_Fast_ impl; }; @@ -270,7 +262,7 @@ blip_inline void Blip_Synth::offset_resampled( // Fails if time is beyond end of Blip_Buffer, due to a bug in caller code or the // need for a longer buffer as set by set_sample_rate(). assert((blip_long)(time >> BLIP_BUFFER_ACCURACY) < blip_buf->buffer_size); - delta *= impl.delta_factor; + delta *= delta_factor; blip_long* buf = blip_buf->buffer + (time >> BLIP_BUFFER_ACCURACY); int phase = (int)(time >> (BLIP_BUFFER_ACCURACY - BLIP_PHASE_BITS) & @@ -300,9 +292,9 @@ blip_inline void Blip_Synth::offset(blip_time_t t, int delta, blip_inline void Blip_Synth::update(blip_time_t t, int amp) { - int delta = amp - impl.last_amp; - impl.last_amp = amp; - offset_resampled(t * impl.buf->factor + impl.buf->offset, delta, impl.buf); + int delta = amp - last_amp; + last_amp = amp; + offset_resampled(t * buf->factor + buf->offset, delta, buf); } blip_inline int Blip_Buffer_length(Blip_Buffer* bbuf)