Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ControlDoublePrivate: log warning before assert fails. #4236

Merged
merged 2 commits into from
Aug 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/control/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,12 @@ QSharedPointer<ControlDoublePrivate> ControlDoublePrivate::getControl(
auto pControl = it.value().lock();
if (pControl) {
// Control object already exists
VERIFY_OR_DEBUG_ASSERT(!pCreatorCO) {
if (pCreatorCO) {
qWarning()
<< "ControlObject"
<< key.group << key.item
<< "already created";
DEBUG_ASSERT(!"pCreatorCO != nullptr, ControlObject already created");
return nullptr;
}
return pControl;
Expand Down Expand Up @@ -311,26 +312,29 @@ double ControlDoublePrivate::getParameterForValue(double value) const {

double ControlDoublePrivate::getParameterForMidi(double midiParam) const {
QSharedPointer<ControlNumericBehavior> pBehavior = m_pBehavior;
VERIFY_OR_DEBUG_ASSERT(pBehavior) {
qWarning() << "Cannot set" << m_key << "by Midi";
if (!pBehavior) {
qWarning() << "Cannot get" << m_key << "for Midi";
DEBUG_ASSERT(!"pBehavior == nullptr, getParameterForMidi is returning 0");
return 0;
}
return pBehavior->midiToParameter(midiParam);
}

void ControlDoublePrivate::setValueFromMidi(MidiOpCode opcode, double midiParam) {
QSharedPointer<ControlNumericBehavior> pBehavior = m_pBehavior;
VERIFY_OR_DEBUG_ASSERT(pBehavior) {
qWarning() << "Cannot set" << m_key << "by Midi";
if (!pBehavior) {
qWarning() << "Cannot set" << m_key << "from Midi";
DEBUG_ASSERT(!"pBehavior == nullptr, abort setValueFromMidi()");
return;
}
pBehavior->setValueFromMidi(opcode, midiParam, this);
}

double ControlDoublePrivate::getMidiParameter() const {
QSharedPointer<ControlNumericBehavior> pBehavior = m_pBehavior;
VERIFY_OR_DEBUG_ASSERT(pBehavior) {
qWarning() << "Cannot get" << m_key << "by Midi";
if (!pBehavior) {
qWarning() << "Cannot get" << m_key << "as Midi";
DEBUG_ASSERT(!"pBehavior == nullptr, getMidiParameter() is returning 0");
return 0;
}
return pBehavior->valueToMidiParameter(get());
Expand Down