Skip to content
Snippets Groups Projects
Commit 4a1b478f authored by SeeLook's avatar SeeLook
Browse files

Use 32 integer for note data in all kinds of instrument as additional parameter of setNote method

parent b8fdbfca
Branches
No related tags found
No related merge requests found
......@@ -214,7 +214,7 @@ void TbandoneonBg::setClosing(bool c) {
}
void TbandoneonBg::setNote(const Tnote& n) {
void TbandoneonBg::setNote(const Tnote& n, quint32 noteDataValue) {
if (!n.isValid() && !p_note.isValid())
return;
if (!n.isValid()) {
......@@ -267,8 +267,8 @@ void TbandoneonBg::setNote(const Tnote& n) {
}
void TbandoneonBg::askQuestion(const Tnote& n, int noteData) {
Q_UNUSED(noteData) // TODO
void TbandoneonBg::askQuestion(const Tnote& n, quint32 noteDataValue) {
Q_UNUSED(noteDataValue) // TODO
setNote(n);
}
......
......@@ -66,9 +66,9 @@ public:
bool closing() const { return m_closing; }
void setClosing(bool c);
void setNote(const Tnote& n) override;
void setNote(const Tnote& n, quint32 noteDataValue = 255) override;
void askQuestion(const Tnote& n, int noteData) override;
void askQuestion(const Tnote& n, quint32 noteDataValue) override;
int noteData() override;
......
......@@ -48,13 +48,13 @@ public:
bool outOfScale() const { return m_outOfScale; }
Tnote note() const { return p_note; }
virtual void setNote(const Tnote& n) = 0;
virtual void setNote(const Tnote& n, quint32 noteDataValue = 255) = 0;
/**
* @p noteData is extra information about note needed for some instruments (guitars, bandoneon).
* In case of guitar it is more important than note itself
*/
virtual void askQuestion(const Tnote& n, int noteData) = 0;
virtual void askQuestion(const Tnote& n, quint32 noteData) = 0;
/**
* Returns additional note data like position on the guitar or left/right hand on bandoneon
......
......@@ -61,7 +61,7 @@ QPointF TguitarBg::fretToPos(const TfingerPos& pos) {
}
void TguitarBg::setNote(const Tnote& n) {
void TguitarBg::setNote(const Tnote& n, quint32 noteDataValue) {
if (!p_note.compareNotes(n)) {
short noteNr = n.chromatic() - GLOB->transposition();
bool foundPos = false;
......@@ -276,9 +276,9 @@ void TguitarBg::paint(QPainter* painter) {
}
void TguitarBg::askQuestion(const Tnote& n, int noteData) {
void TguitarBg::askQuestion(const Tnote& n, quint32 noteDataValue) {
p_note = n;
TfingerPos fp(static_cast<quint8>(noteData));
TfingerPos fp(static_cast<quint8>(noteDataValue));
setFingerPos(fp);
}
......
/***************************************************************************
* Copyright (C) 2017 by Tomasz Bojczuk *
* Copyright (C) 2017-2018 by Tomasz Bojczuk *
* seelook@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
......@@ -61,13 +61,13 @@ public:
QPointF fingerPos() { return m_fingerPos; }
void setNote(const Tnote& n) override;
void setNote(const Tnote& n, quint32 noteDataValue = 255) override;
void setFingerPos(const TfingerPos& fp);
void paint(QPainter* painter) override;
void askQuestion(const Tnote& n, int noteData) override;
void askQuestion(const Tnote& n, quint32 noteDataValue) override;
int noteData() override { return static_cast<int>(m_selectedPos.data()); }
......
......@@ -52,7 +52,8 @@ void TpianoBg::setKeyWidth(qreal kw) {
}
void TpianoBg::setNote(const Tnote& n) {
void TpianoBg::setNote(const Tnote& n, quint32 noteDataValue) {
Q_UNUSED(noteDataValue)
if (!p_note.compareNotes(n)) {
if (n.isValid()) {
Tnote sharpNote = Tnote(n.chromatic());
......@@ -73,8 +74,8 @@ void TpianoBg::setNote(const Tnote& n) {
}
void TpianoBg::askQuestion(const Tnote& n, int noteData) {
Q_UNUSED(noteData)
void TpianoBg::askQuestion(const Tnote& n, quint32 noteDataValue) {
Q_UNUSED(noteDataValue)
setNote(n);
}
......
......@@ -45,9 +45,9 @@ public:
QRectF keyRect() const { return m_keyRect; }
void setNote(const Tnote& n) override;
void setNote(const Tnote& n, quint32 noteDataValue = 255) override;
void askQuestion(const Tnote& n, int noteData) override;
void askQuestion(const Tnote& n, quint32 noteDataValue) override;
int noteData() override { return 0; } // Fake - piano has no extra note data
......
......@@ -81,7 +81,8 @@ TsaxBg::~TsaxBg()
}
void TsaxBg::setNote(const Tnote& n) {
void TsaxBg::setNote(const Tnote& n, quint32 noteDataValue) {
Q_UNUSED(noteDataValue)
CHECKTIME (
bool out = false;
if (n.isValid()) {
......@@ -110,8 +111,8 @@ CHECKTIME (
}
void TsaxBg::askQuestion(const Tnote& n, int noteData) {
Q_UNUSED(noteData)
void TsaxBg::askQuestion(const Tnote& n, quint32 noteDataValue) {
Q_UNUSED(noteDataValue)
setNote(n);
}
......
......@@ -45,9 +45,9 @@ public:
TsaxBg(QQuickItem* parent = nullptr);
~TsaxBg();
void setNote(const Tnote& n) override;
void setNote(const Tnote& n, quint32 noteDataValue = 255) override;
void askQuestion(const Tnote& n, int noteData) override;
void askQuestion(const Tnote& n, quint32 noteDataValue) override;
int noteData() override { return 0; } // Fake - saxophone has no extra note data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment