Skip to content

Commit 08bb433

Browse files
committed
Less invasive version
1 parent 28620ba commit 08bb433

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

include/AutomationPattern.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ class EXPORT AutomationPattern : public TrackContentObject
7979
MidiTime putValue( const MidiTime & _time, const float _value,
8080
const bool _quant_pos = true );
8181

82-
void removeValue( const MidiTime & time );
82+
void removeValue( const MidiTime & _time,
83+
const bool _quant_pos = true );
8384

8485
MidiTime setDragValue( const MidiTime & _time, const float _value,
8586
const bool _quant_pos = true );

src/core/AutomationPattern.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,19 @@ MidiTime AutomationPattern::putValue( const MidiTime & _time,
237237

238238

239239

240-
void AutomationPattern::removeValue( const MidiTime & time )
240+
void AutomationPattern::removeValue( const MidiTime & _time,
241+
const bool _quant_pos )
241242
{
242243
cleanObjects();
243244

244-
m_timeMap.remove( time );
245-
m_tangents.remove( time );
246-
timeMap::const_iterator it = m_timeMap.lowerBound( time );
245+
MidiTime newTime = _quant_pos ?
246+
Note::quantized( _time,
247+
DefaultTicksPerTact / 64 ) : // finest quantization
248+
_time;
249+
250+
m_timeMap.remove( newTime );
251+
m_tangents.remove( newTime );
252+
timeMap::const_iterator it = m_timeMap.lowerBound( newTime );
247253
if( it != m_timeMap.begin() )
248254
{
249255
--it;
@@ -643,7 +649,7 @@ void AutomationPattern::processMidiTime( const MidiTime & time )
643649
}
644650
else if( valueAt( time ) != value )
645651
{
646-
removeValue( time );
652+
removeValue( time, false );
647653
}
648654
}
649655
}

0 commit comments

Comments
 (0)