pitch wheel recording in the detune pattern (#6297)

This commit is contained in:
Andrés
2023-08-31 12:17:00 -03:00
committed by GitHub
parent 4804ab6785
commit 005ee47d43
5 changed files with 22 additions and 12 deletions

View File

@@ -557,14 +557,20 @@ void NotePlayHandle::updateFrequency()
void NotePlayHandle::processTimePos( const TimePos& time )
void NotePlayHandle::processTimePos(const TimePos& time, float pitchValue, bool isRecording)
{
if( detuning() && time >= songGlobalParentOffset()+pos() )
if (!detuning() || time < songGlobalParentOffset() + pos()) { return; }
if (isRecording && m_origin == Origin::MidiInput)
{
const float v = detuning()->automationClip()->valueAt( time - songGlobalParentOffset() - pos() );
if( !typeInfo<float>::isEqual( v, m_baseDetuning->value() ) )
detuning()->automationClip()->recordValue(time - songGlobalParentOffset() - pos(), pitchValue / 100);
}
else
{
const float v = detuning()->automationClip()->valueAt(time - songGlobalParentOffset() - pos());
if (!typeInfo<float>::isEqual(v, m_baseDetuning->value()))
{
m_baseDetuning->setValue( v );
m_baseDetuning->setValue(v);
updateFrequency();
}
}

View File

@@ -4134,9 +4134,9 @@ void PianoRoll::finishRecordNote(const Note & n )
{
if( it->key() == n.key() )
{
Note n1( n.length(), it->pos(),
Note n1(n.length(), it->pos(),
it->key(), it->getVolume(),
it->getPanning() );
it->getPanning(), n.detuning());
n1.quantizeLength( quantization() );
m_midiClip->addNote( n1 );
update();

View File

@@ -28,6 +28,7 @@
#include "ConfigManager.h"
#include "ControllerConnection.h"
#include "DataFile.h"
#include "GuiApplication.h"
#include "Mixer.h"
#include "InstrumentTrackView.h"
#include "Instrument.h"
@@ -37,6 +38,7 @@
#include "MixHelpers.h"
#include "PatternStore.h"
#include "PatternTrack.h"
#include "PianoRoll.h"
#include "Pitch.h"
#include "Song.h"
@@ -72,6 +74,7 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) :
m_microtuner()
{
m_pitchModel.setCenterValue( 0 );
m_pitchModel.setStrictStepSize(true);
m_panningModel.setCenterValue( DefaultPanning );
m_baseNoteModel.setInitValue( DefaultKey );
m_firstKeyModel.setInitValue(0);
@@ -341,9 +344,10 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const TimePos& tim
NotePlayHandleManager::acquire(
this, offset,
typeInfo<f_cnt_t>::max() / 2,
Note( TimePos(), TimePos(), event.key(), event.volume( midiPort()->baseVelocity() ) ),
Note(TimePos(), Engine::getSong()->getPlayPos(Engine::getSong()->playMode()),
event.key(), event.volume(midiPort()->baseVelocity())),
nullptr, event.channel(),
NotePlayHandle::Origin::MidiInput );
NotePlayHandle::Origin::MidiInput);
m_notes[event.key()] = nph;
if( ! Engine::audioEngine()->addPlayHandle( nph ) )
{
@@ -710,7 +714,7 @@ bool InstrumentTrack::play( const TimePos & _start, const fpp_t _frames,
// Handle automation: detuning
for (const auto& processHandle : m_processHandles)
{
processHandle->processTimePos(_start);
processHandle->processTimePos(_start, m_pitchModel.value(), gui::GuiApplication::instance()->pianoRoll()->isRecording());
}
if ( clips.size() == 0 )