Fix master pitch behavior to transpose instead of detune (#6544)

This commit is contained in:
Lost Robot
2022-11-05 15:42:33 -07:00
committed by GitHub
parent 993c09fd4b
commit 8bf86573f6
3 changed files with 14 additions and 13 deletions

View File

@@ -527,13 +527,13 @@ void NotePlayHandle::updateFrequency()
if (m_instrumentTrack->m_microtuner.enabled())
{
// custom key mapping and scale: get frequency from the microtuner
const float detuneMaster = detune + masterPitch;
const auto transposedKey = key() + masterPitch;
if (m_instrumentTrack->isKeyMapped(key()))
if (m_instrumentTrack->isKeyMapped(transposedKey))
{
const auto frequency = m_instrumentTrack->m_microtuner.keyToFreq(key(), baseNote);
m_frequency = frequency * powf(2.f, (detuneMaster + instrumentPitch / 100) / 12.f);
m_unpitchedFrequency = frequency * powf(2.f, detuneMaster / 12.f);
const auto frequency = m_instrumentTrack->m_microtuner.keyToFreq(transposedKey, baseNote);
m_frequency = frequency * powf(2.f, (detune + instrumentPitch / 100) / 12.f);
m_unpitchedFrequency = frequency * powf(2.f, detune / 12.f);
}
else
{
@@ -668,4 +668,4 @@ void NotePlayHandleManager::free()
}
} // namespace lmms
} // namespace lmms

View File

@@ -184,14 +184,14 @@ SongEditor::SongEditor( Song * song ) :
master_pitch_lbl->setPixmap( embed::getIconPixmap( "master_pitch" ) );
master_pitch_lbl->setFixedHeight( 64 );
m_masterPitchSlider = new AutomatableSlider( tb, tr( "Master pitch" ) );
m_masterPitchSlider = new AutomatableSlider( tb, tr( "Global transposition" ) );
m_masterPitchSlider->setModel( &m_song->m_masterPitchModel );
m_masterPitchSlider->setOrientation( Qt::Vertical );
m_masterPitchSlider->setPageStep( 1 );
m_masterPitchSlider->setTickPosition( QSlider::TicksLeft );
m_masterPitchSlider->setFixedSize( 26, 60 );
m_masterPitchSlider->setTickInterval( 12 );
m_masterPitchSlider->setToolTip(tr("Master pitch"));
m_masterPitchSlider->setToolTip(tr("Global transposition"));
connect( m_masterPitchSlider, SIGNAL(logicValueChanged(int)), this,
SLOT(setMasterPitch(int)));
connect( m_masterPitchSlider, SIGNAL(sliderPressed()), this,
@@ -202,7 +202,7 @@ SongEditor::SongEditor( Song * song ) :
SLOT(hideMasterPitchFloat()));
m_mpsStatus = new TextFloat;
m_mpsStatus->setTitle( tr( "Master pitch" ) );
m_mpsStatus->setTitle( tr( "Global transposition" ) );
m_mpsStatus->setPixmap( embed::getIconPixmap( "master_pitch" ) );
getGUI()->mainWindow()->addWidgetToToolBar( master_pitch_lbl );
@@ -723,7 +723,7 @@ void SongEditor::showMasterPitchFloat( void )
void SongEditor::updateMasterPitchFloat( int new_val )
{
m_mpsStatus->setText( tr( "Value: %1 semitones").arg( new_val ) );
m_mpsStatus->setText( tr( "Value: %1 keys").arg( new_val ) );
}

View File

@@ -47,14 +47,15 @@ InstrumentMiscView::InstrumentMiscView(InstrumentTrack *it, QWidget *parent) :
layout->setMargin(5);
// Master pitch toggle
m_pitchGroupBox = new GroupBox(tr("MASTER PITCH"));
m_pitchGroupBox = new GroupBox(tr("GLOBAL TRANSPOSITION"));
m_pitchGroupBox->setModel(&it->m_useMasterPitchModel);
layout->addWidget(m_pitchGroupBox);
auto masterPitchLayout = new QHBoxLayout(m_pitchGroupBox);
masterPitchLayout->setContentsMargins(8, 18, 8, 8);
auto tlabel = new QLabel(tr("Enables the use of master pitch"));
auto tlabel = new QLabel(tr("Enables the use of global transposition"));
tlabel->setWordWrap(true);
tlabel->setFont(pointSize<8>(tlabel->font()));
masterPitchLayout->addWidget(tlabel);
@@ -91,4 +92,4 @@ InstrumentMiscView::InstrumentMiscView(InstrumentTrack *it, QWidget *parent) :
}
} // namespace lmms::gui
} // namespace lmms::gui