MIDI range MKII (extracted from microtonal PR) (#5868)
* Update MIDI range to match MIDI specification Co-authored-by: IanCaio <iancaio_dev@hotmail.com> Co-authored-by: Kevin Zander <veratil@gmail.com> Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com> Co-authored-by: Spekular <Spekular@users.noreply.github.com>
This commit is contained in:
@@ -120,6 +120,7 @@ private:
|
||||
void upgrade_1_3_0();
|
||||
void upgrade_noHiddenClipNames();
|
||||
void upgrade_automationNodes();
|
||||
void upgrade_extendedNoteRange();
|
||||
|
||||
// List of all upgrade methods
|
||||
static const std::vector<UpgradeMethod> UPGRADE_METHODS;
|
||||
|
||||
@@ -174,7 +174,19 @@ public:
|
||||
return &m_baseNoteModel;
|
||||
}
|
||||
|
||||
IntModel *firstKeyModel()
|
||||
{
|
||||
return &m_firstKeyModel;
|
||||
}
|
||||
|
||||
IntModel *lastKeyModel()
|
||||
{
|
||||
return &m_lastKeyModel;
|
||||
}
|
||||
|
||||
int baseNote() const;
|
||||
int firstKey() const;
|
||||
int lastKey() const;
|
||||
|
||||
Piano *pianoModel()
|
||||
{
|
||||
@@ -265,11 +277,13 @@ private:
|
||||
|
||||
bool m_previewMode;
|
||||
|
||||
IntModel m_baseNoteModel; //!< The "A4" or "440 Hz" key (default 69)
|
||||
IntModel m_firstKeyModel; //!< First key the instrument reacts to
|
||||
IntModel m_lastKeyModel; //!< Last key the instrument reacts to
|
||||
|
||||
bool m_hasAutoMidiDev;
|
||||
static InstrumentTrack *s_autoAssignedTrack;
|
||||
|
||||
IntModel m_baseNoteModel;
|
||||
|
||||
NotePlayHandleList m_processHandles;
|
||||
|
||||
FloatModel m_volumeModel;
|
||||
@@ -282,7 +296,6 @@ private:
|
||||
IntModel m_effectChannelModel;
|
||||
BoolModel m_useMasterPitchModel;
|
||||
|
||||
|
||||
Instrument * m_instrument;
|
||||
InstrumentSoundShaping m_soundShaping;
|
||||
InstrumentFunctionArpeggio m_arpeggio;
|
||||
|
||||
@@ -55,6 +55,7 @@ enum Keys
|
||||
|
||||
enum Octaves
|
||||
{
|
||||
Octave_m1, // MIDI standard starts at C-1
|
||||
Octave_0,
|
||||
Octave_1,
|
||||
Octave_2,
|
||||
@@ -64,15 +65,19 @@ enum Octaves
|
||||
Octave_6,
|
||||
Octave_7,
|
||||
Octave_8,
|
||||
Octave_9, // incomplete octave, MIDI only goes up to G9
|
||||
NumOctaves
|
||||
} ;
|
||||
};
|
||||
|
||||
const int FirstOctave = -1;
|
||||
const int KeysPerOctave = 12;
|
||||
const int DefaultKey = DefaultOctave * KeysPerOctave + Key_A;
|
||||
//! Number of physical keys, limited to MIDI range (valid for both MIDI 1.0 and 2.0)
|
||||
const int NumKeys = 128;
|
||||
|
||||
const int WhiteKeysPerOctave = 7;
|
||||
const int BlackKeysPerOctave = 5;
|
||||
const int KeysPerOctave = WhiteKeysPerOctave + BlackKeysPerOctave;
|
||||
const int NumKeys = NumOctaves * KeysPerOctave;
|
||||
const int DefaultKey = DefaultOctave*KeysPerOctave + Key_A;
|
||||
const int DefaultMiddleKey = Octave_4 * KeysPerOctave + Key_C;
|
||||
const int DefaultBaseKey = Octave_4 * KeysPerOctave + Key_A;
|
||||
const float DefaultBaseFreq = 440.f;
|
||||
|
||||
const float MaxDetuning = 4 * 12.0f;
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
/*! Returns whether the play handle plays on a certain track */
|
||||
bool isFromTrack( const Track* _track ) const override;
|
||||
|
||||
/*! Releases the note (and plays release frames */
|
||||
/*! Releases the note (and plays release frames) */
|
||||
void noteOff( const f_cnt_t offset = 0 );
|
||||
|
||||
/*! Returns number of frames to be played until the note is going to be released */
|
||||
|
||||
@@ -65,6 +65,10 @@ public:
|
||||
static bool isWhiteKey(int key);
|
||||
static bool isBlackKey(int key);
|
||||
|
||||
static const unsigned int WhiteKeysPerOctave = 7;
|
||||
static const unsigned int BlackKeysPerOctave = 5;
|
||||
static const unsigned int NumWhiteKeys = 75;
|
||||
static const unsigned int NumBlackKeys = 53;
|
||||
|
||||
private:
|
||||
static bool isValidKey( int key )
|
||||
|
||||
@@ -86,10 +86,12 @@ class PianoRoll : public QWidget
|
||||
Q_PROPERTY(QColor whiteKeyActiveTextColor MEMBER m_whiteKeyActiveTextColor)
|
||||
Q_PROPERTY(QColor whiteKeyActiveTextShadow MEMBER m_whiteKeyActiveTextShadow)
|
||||
Q_PROPERTY(QBrush whiteKeyActiveBackground MEMBER m_whiteKeyActiveBackground)
|
||||
Q_PROPERTY(QBrush whiteKeyDisabledBackground MEMBER m_whiteKeyDisabledBackground)
|
||||
/* black key properties */
|
||||
Q_PROPERTY(int blackKeyWidth MEMBER m_blackKeyWidth)
|
||||
Q_PROPERTY(QBrush blackKeyInactiveBackground MEMBER m_blackKeyInactiveBackground)
|
||||
Q_PROPERTY(QBrush blackKeyActiveBackground MEMBER m_blackKeyActiveBackground)
|
||||
Q_PROPERTY(QBrush blackKeyDisabledBackground MEMBER m_blackKeyDisabledBackground)
|
||||
public:
|
||||
enum EditModes
|
||||
{
|
||||
@@ -398,7 +400,6 @@ private:
|
||||
int m_pianoKeysVisible;
|
||||
|
||||
int m_keyLineHeight;
|
||||
int m_octaveHeight;
|
||||
int m_whiteKeySmallHeight;
|
||||
int m_whiteKeyBigHeight;
|
||||
int m_blackKeyHeight;
|
||||
@@ -475,10 +476,12 @@ private:
|
||||
QColor m_whiteKeyInactiveTextColor;
|
||||
QColor m_whiteKeyInactiveTextShadow;
|
||||
QBrush m_whiteKeyInactiveBackground;
|
||||
QBrush m_whiteKeyDisabledBackground;
|
||||
/* black key properties */
|
||||
int m_blackKeyWidth;
|
||||
QBrush m_blackKeyActiveBackground;
|
||||
QBrush m_blackKeyInactiveBackground;
|
||||
QBrush m_blackKeyDisabledBackground;
|
||||
|
||||
signals:
|
||||
void positionChanged( const TimePos & );
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <QPixmap>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "AutomatableModel.h"
|
||||
#include "ModelView.h"
|
||||
|
||||
class Piano;
|
||||
@@ -63,17 +64,24 @@ protected:
|
||||
private:
|
||||
int getKeyFromMouse( const QPoint & _p ) const;
|
||||
int getKeyX( int _key_num ) const;
|
||||
int getKeyWidth(int key_num) const;
|
||||
int getKeyHeight(int key_num) const;
|
||||
IntModel *getNearestMarker(int key, QString* title = nullptr);
|
||||
|
||||
static QPixmap * s_whiteKeyPm;
|
||||
static QPixmap * s_blackKeyPm;
|
||||
static QPixmap * s_whiteKeyPressedPm;
|
||||
static QPixmap * s_blackKeyPressedPm;
|
||||
static QPixmap * s_whiteKeyDisabledPm;
|
||||
static QPixmap * s_blackKeyDisabledPm;
|
||||
|
||||
Piano * m_piano;
|
||||
|
||||
QScrollBar * m_pianoScroll;
|
||||
int m_startKey; // first key when drawing
|
||||
int m_lastKey;
|
||||
int m_startKey; //!< first key when drawing
|
||||
int m_lastKey; //!< previously pressed key
|
||||
IntModel *m_movedNoteModel; //!< note marker which is being moved
|
||||
|
||||
|
||||
|
||||
private slots:
|
||||
@@ -87,4 +95,3 @@ signals:
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user