Implemented color output for loopstation
This commit is contained in:
@ -168,43 +168,48 @@ void DrumPadSampleWidget::unsendColor()
|
|||||||
.note = m_ui->pushButtonPlay->learnSetting().note,
|
.note = m_ui->pushButtonPlay->learnSetting().note,
|
||||||
.velocity = 0
|
.velocity = 0
|
||||||
});
|
});
|
||||||
|
m_lastMidiColor = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrumPadSampleWidget::sendColor()
|
void DrumPadSampleWidget::sendColor()
|
||||||
{
|
{
|
||||||
m_sendColors = true;
|
m_sendColors = true;
|
||||||
|
|
||||||
uint8_t velocity;
|
uint8_t newColor;
|
||||||
|
|
||||||
if (m_file && m_file->color && m_player.buffer().isValid())
|
if (m_file && m_file->color && m_player.buffer().isValid())
|
||||||
{
|
{
|
||||||
const auto &color = *m_file->color;
|
const auto &color = *m_file->color;
|
||||||
if (color == "purple")
|
if (color == "purple")
|
||||||
velocity = m_player.playing() ? 43 : 18;
|
newColor = m_player.playing() ? 43 : 18;
|
||||||
else if (color == "red")
|
else if (color == "red")
|
||||||
velocity = m_player.playing() ? 3 : 1;
|
newColor = m_player.playing() ? 3 : 1;
|
||||||
else if (color == "yellow")
|
else if (color == "yellow")
|
||||||
velocity = m_player.playing() ? 58 : 33;
|
newColor = m_player.playing() ? 58 : 33;
|
||||||
else if (color == "green")
|
else if (color == "green")
|
||||||
velocity = m_player.playing() ? 56 : 16;
|
newColor = m_player.playing() ? 56 : 16;
|
||||||
else if (color == "blue")
|
else if (color == "blue")
|
||||||
velocity = m_player.playing() ? 49 : 51;
|
newColor = m_player.playing() ? 49 : 51;
|
||||||
else
|
else
|
||||||
goto noColor;
|
goto noColor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
noColor:
|
noColor:
|
||||||
velocity = 0;
|
newColor = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit sendMidi(midi::MidiMessage {
|
if (newColor != m_lastMidiColor)
|
||||||
.channel = m_ui->pushButtonPlay->learnSetting().channel,
|
{
|
||||||
.cmd = m_ui->pushButtonPlay->learnSetting().cmd,
|
emit sendMidi(midi::MidiMessage {
|
||||||
.flag = true,
|
.channel = m_ui->pushButtonPlay->learnSetting().channel,
|
||||||
.note = m_ui->pushButtonPlay->learnSetting().note,
|
.cmd = m_ui->pushButtonPlay->learnSetting().cmd,
|
||||||
.velocity = velocity
|
.flag = true,
|
||||||
});
|
.note = m_ui->pushButtonPlay->learnSetting().note,
|
||||||
|
.velocity = newColor
|
||||||
|
});
|
||||||
|
m_lastMidiColor = newColor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrumPadSampleWidget::updateStatus()
|
void DrumPadSampleWidget::updateStatus()
|
||||||
|
@ -87,4 +87,5 @@ private:
|
|||||||
bool m_sendColors{};
|
bool m_sendColors{};
|
||||||
|
|
||||||
QColor m_lastColor;
|
QColor m_lastColor;
|
||||||
|
quint8 m_lastMidiColor{};
|
||||||
};
|
};
|
||||||
|
@ -106,19 +106,54 @@ void LoopStationSampleWidget::unsendColor()
|
|||||||
.note = m_ui->pushButtonPlay->learnSetting().note,
|
.note = m_ui->pushButtonPlay->learnSetting().note,
|
||||||
.velocity = 0
|
.velocity = 0
|
||||||
});
|
});
|
||||||
|
m_lastMidiColor = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoopStationSampleWidget::sendColor()
|
void LoopStationSampleWidget::sendColor()
|
||||||
{
|
{
|
||||||
m_sendColors = true;
|
m_sendColors = true;
|
||||||
|
|
||||||
emit sendMidi(midi::MidiMessage {
|
quint8 newColor;
|
||||||
.channel = m_ui->pushButtonPlay->learnSetting().channel,
|
|
||||||
.cmd = m_ui->pushButtonPlay->learnSetting().cmd,
|
if (false) // testing colors on launchpad mk2
|
||||||
.flag = true,
|
newColor = m_padNr;
|
||||||
.note = m_ui->pushButtonPlay->learnSetting().note,
|
else
|
||||||
.velocity = uint8_t(m_padNr+1)
|
{
|
||||||
});
|
if (m_player.buffer().isValid())
|
||||||
|
{
|
||||||
|
if (m_category == 0)
|
||||||
|
newColor = m_player.playing() ? 44 : 47; //dunkelblue
|
||||||
|
else if (m_category == 1)
|
||||||
|
newColor = m_player.playing() ? 16 : 19; // green
|
||||||
|
else if (m_category == 2)
|
||||||
|
newColor = m_player.playing() ? 48 : 51; // violet
|
||||||
|
else if (m_category == 3)
|
||||||
|
newColor = m_player.playing() ? 36 : 39; // hellblue
|
||||||
|
else if (m_category == 4)
|
||||||
|
newColor = m_player.playing() ? 8 : 11; // orange
|
||||||
|
else if (m_category == 5)
|
||||||
|
newColor = m_player.playing() ? 52 : 55; // pink
|
||||||
|
else
|
||||||
|
goto noColor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
noColor:
|
||||||
|
newColor = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newColor != m_lastMidiColor)
|
||||||
|
{
|
||||||
|
emit sendMidi(midi::MidiMessage {
|
||||||
|
.channel = m_ui->pushButtonPlay->learnSetting().channel,
|
||||||
|
.cmd = m_ui->pushButtonPlay->learnSetting().cmd,
|
||||||
|
.flag = true,
|
||||||
|
.note = m_ui->pushButtonPlay->learnSetting().note,
|
||||||
|
.velocity = newColor
|
||||||
|
});
|
||||||
|
m_lastMidiColor = newColor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoopStationSampleWidget::timeout()
|
void LoopStationSampleWidget::timeout()
|
||||||
|
@ -82,4 +82,5 @@ private:
|
|||||||
bool m_sendColors{};
|
bool m_sendColors{};
|
||||||
|
|
||||||
QColor m_lastColor;
|
QColor m_lastColor;
|
||||||
|
quint8 m_lastMidiColor{};
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user