Skip to content

Commit f288137

Browse files
he29-netIanCaioVeratilPhysSongSpekular
authored
MIDI range MKII (extracted from microtonal PR) (#5868)
* Update MIDI range to match MIDI specification Co-authored-by: IanCaio <[email protected]> Co-authored-by: Kevin Zander <[email protected]> Co-authored-by: Hyunjin Song <[email protected]> Co-authored-by: Spekular <[email protected]>
1 parent fbea789 commit f288137

30 files changed

+480
-240
lines changed
2.11 KB
Loading

data/themes/classic/style.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,11 @@ PianoRoll {
165165
qproperty-whiteKeyInactiveTextColor: rgb( 128, 128, 128);
166166
qproperty-whiteKeyInactiveTextShadow: rgb( 240, 240, 240 );
167167
qproperty-whiteKeyInactiveBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #eeeeee, stop:1 #ffffff);
168+
qproperty-whiteKeyDisabledBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #a0a0a0, stop:1 #b0b0b0);
168169
qproperty-blackKeyWidth: 48;
169170
qproperty-blackKeyActiveBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #43e97b, stop:1 #3bcd6c);
170171
qproperty-blackKeyInactiveBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #333, stop:1 #000);
172+
qproperty-blackKeyDisabledBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #606060, stop:1 #505050);
171173
/* Grid colors */
172174
qproperty-lineColor: rgba( 128, 128, 128, 80 );
173175
qproperty-beatLineColor: rgba( 128, 128, 128, 160 );
1.17 KB
Loading
1.88 KB
Loading

data/themes/default/style.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,11 @@ PianoRoll {
197197
qproperty-whiteKeyInactiveTextColor: #000;
198198
qproperty-whiteKeyInactiveTextShadow: #fff;
199199
qproperty-whiteKeyInactiveBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #eeeeee, stop:1 #ffffff);
200+
qproperty-whiteKeyDisabledBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #a0a0a0, stop:1 #b0b0b0);
200201
qproperty-blackKeyWidth: 48;
201202
qproperty-blackKeyActiveBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #43e97b, stop:1 #3bcd6c);
202203
qproperty-blackKeyInactiveBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #333, stop:1 #000);
204+
qproperty-blackKeyDisabledBackground: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #606060, stop:1 #505050);
203205
/* Grid colors */
204206
qproperty-lineColor: #292929;
205207
qproperty-beatLineColor: #2d6b45;
1.03 KB
Loading

include/DataFile.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ class LMMS_EXPORT DataFile : public QDomDocument
120120
void upgrade_1_3_0();
121121
void upgrade_noHiddenClipNames();
122122
void upgrade_automationNodes();
123+
void upgrade_extendedNoteRange();
123124

124125
// List of all upgrade methods
125126
static const std::vector<UpgradeMethod> UPGRADE_METHODS;

include/InstrumentTrack.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,19 @@ class LMMS_EXPORT InstrumentTrack : public Track, public MidiEventProcessor
174174
return &m_baseNoteModel;
175175
}
176176

177+
IntModel *firstKeyModel()
178+
{
179+
return &m_firstKeyModel;
180+
}
181+
182+
IntModel *lastKeyModel()
183+
{
184+
return &m_lastKeyModel;
185+
}
186+
177187
int baseNote() const;
188+
int firstKey() const;
189+
int lastKey() const;
178190

179191
Piano *pianoModel()
180192
{
@@ -265,11 +277,13 @@ protected slots:
265277

266278
bool m_previewMode;
267279

280+
IntModel m_baseNoteModel; //!< The "A4" or "440 Hz" key (default 69)
281+
IntModel m_firstKeyModel; //!< First key the instrument reacts to
282+
IntModel m_lastKeyModel; //!< Last key the instrument reacts to
283+
268284
bool m_hasAutoMidiDev;
269285
static InstrumentTrack *s_autoAssignedTrack;
270286

271-
IntModel m_baseNoteModel;
272-
273287
NotePlayHandleList m_processHandles;
274288

275289
FloatModel m_volumeModel;
@@ -282,7 +296,6 @@ protected slots:
282296
IntModel m_effectChannelModel;
283297
BoolModel m_useMasterPitchModel;
284298

285-
286299
Instrument * m_instrument;
287300
InstrumentSoundShaping m_soundShaping;
288301
InstrumentFunctionArpeggio m_arpeggio;

include/Note.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ enum Keys
5555

5656
enum Octaves
5757
{
58+
Octave_m1, // MIDI standard starts at C-1
5859
Octave_0,
5960
Octave_1,
6061
Octave_2,
@@ -64,15 +65,19 @@ enum Octaves
6465
Octave_6,
6566
Octave_7,
6667
Octave_8,
68+
Octave_9, // incomplete octave, MIDI only goes up to G9
6769
NumOctaves
68-
} ;
70+
};
6971

72+
const int FirstOctave = -1;
73+
const int KeysPerOctave = 12;
74+
const int DefaultKey = DefaultOctave * KeysPerOctave + Key_A;
75+
//! Number of physical keys, limited to MIDI range (valid for both MIDI 1.0 and 2.0)
76+
const int NumKeys = 128;
7077

71-
const int WhiteKeysPerOctave = 7;
72-
const int BlackKeysPerOctave = 5;
73-
const int KeysPerOctave = WhiteKeysPerOctave + BlackKeysPerOctave;
74-
const int NumKeys = NumOctaves * KeysPerOctave;
75-
const int DefaultKey = DefaultOctave*KeysPerOctave + Key_A;
78+
const int DefaultMiddleKey = Octave_4 * KeysPerOctave + Key_C;
79+
const int DefaultBaseKey = Octave_4 * KeysPerOctave + Key_A;
80+
const float DefaultBaseFreq = 440.f;
7681

7782
const float MaxDetuning = 4 * 12.0f;
7883

include/NotePlayHandle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class LMMS_EXPORT NotePlayHandle : public PlayHandle, public Note
125125
/*! Returns whether the play handle plays on a certain track */
126126
bool isFromTrack( const Track* _track ) const override;
127127

128-
/*! Releases the note (and plays release frames */
128+
/*! Releases the note (and plays release frames) */
129129
void noteOff( const f_cnt_t offset = 0 );
130130

131131
/*! Returns number of frames to be played until the note is going to be released */

0 commit comments

Comments
 (0)