Skip to content

Commit

Permalink
Revert "Fix 2047 ("TripleOscillator: Oscillators are getting out of s…
Browse files Browse the repository at this point in the history
…ync") (LMMS#3145)"

This reverts commit 291942f in an
attempt to fix issue LMMS#3292.

The problem that's addressed is very elusive:
* It cannot be reproduced reliably.
* It seems to be more prone to appear in release builds.
* It only seems to appear when two or more instruments are mixed into
  one channel.
* If you solo a problematic Triple Osc it goes away.

The observations above seem to indicate that there's rather a problem
with the mixing (due to multithreading?) and that the changes made to
Triple Osc seem to trigger this deeper problem more quickly.
  • Loading branch information
michaelgregorius committed Feb 4, 2017
1 parent 65e6654 commit 70c3bc2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions include/Oscillator.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class EXPORT Oscillator
const IntModel * _mod_algo_model,
const float & _freq,
const float & _detuning,
const double & _phase_offset,
const float & _phase_offset,
const float & _volume,
Oscillator * _m_subOsc = NULL );
virtual ~Oscillator()
Expand Down Expand Up @@ -160,10 +160,10 @@ class EXPORT Oscillator
const float & m_freq;
const float & m_detuning;
const float & m_volume;
const double & m_ext_phaseOffset;
const float & m_ext_phaseOffset;
Oscillator * m_subOsc;
double m_phaseOffset;
double m_phase;
float m_phaseOffset;
float m_phase;
const SampleBuffer * m_userWave;


Expand Down
8 changes: 4 additions & 4 deletions src/core/Oscillator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Oscillator::Oscillator( const IntModel * _wave_shape_model,
const IntModel * _mod_algo_model,
const float & _freq,
const float & _detuning,
const double & _phase_offset,
const float & _phase_offset,
const float & _volume,
Oscillator * _sub_osc ) :
m_waveShapeModel( _wave_shape_model ),
Expand Down Expand Up @@ -310,7 +310,7 @@ void Oscillator::updateFM( sampleFrame * _ab, const fpp_t _frames,
// should be called every time phase-offset is changed...
inline void Oscillator::recalcPhase()
{
if( !typeInfo<double>::isEqual( m_phaseOffset, m_ext_phaseOffset ) )
if( !typeInfo<float>::isEqual( m_phaseOffset, m_ext_phaseOffset ) )
{
m_phase -= m_phaseOffset;
m_phaseOffset = m_ext_phaseOffset;
Expand All @@ -325,10 +325,10 @@ inline void Oscillator::recalcPhase()

inline bool Oscillator::syncOk( float _osc_coeff )
{
const double v1 = m_phase;
const float v1 = m_phase;
m_phase += _osc_coeff;
// check whether m_phase is in next period
return( floor( m_phase ) > floor( v1 ) );
return( floorf( m_phase ) > floorf( v1 ) );
}


Expand Down

0 comments on commit 70c3bc2

Please sign in to comment.