Index: mptrack/PatternEditorDialogs.cpp =================================================================== --- mptrack/PatternEditorDialogs.cpp (revision 12033) +++ mptrack/PatternEditorDialogs.cpp (working copy) @@ -880,7 +880,7 @@ CMainFrame *pMainFrm; CDialog::OnInitDialog(); - m_Keyboard.Init(m_hWnd, 2); + m_Keyboard.Init(m_hWnd, 4); pMainFrm = CMainFrame::GetMainFrame(); if (!pMainFrm) return TRUE; // Fills the shortcut key combo box @@ -893,20 +893,20 @@ // Minor notes CString s; - for (int inotes=-1; inotes<24; inotes++) + for (int inotes = -25; inotes < 24; inotes++) { - if(inotes < 0) + if(inotes == -25) { s = _T("--"); } else { s = mpt::ToCString(CSoundFile::GetDefaultNoteName(inotes % 12)); - if(inotes >= 12) - s.AppendFormat(_T(" (+%d)"), inotes / 12); + if(inotes < 0 || inotes >= 12) + s.AppendFormat(_T(" (%c%d)"), inotes < 0 ? '-' : '+', inotes / 12); } - m_CbnNote1.AddString(s); - m_CbnNote2.AddString(s); - m_CbnNote3.AddString(s); + m_CbnNote1.SetItemData(m_CbnNote1.AddString(s), inotes); + m_CbnNote1.SetItemData(m_CbnNote2.AddString(s), inotes); + m_CbnNote1.SetItemData(m_CbnNote3.AddString(s), inotes); } // Update Dialog OnChordChanged(); @@ -932,11 +932,11 @@ chord.notes[0] = NOTE_NONE; chord.notes[1] = NOTE_NONE; chord.notes[2] = NOTE_NONE; - for(UINT i = 0; i < 2 * 12; i++) + for(UINT i = 0; i < 4 * 12; i++) { if(chord.key == MPTChord::relativeMode) { - if(!i) continue; + if(i == 2 * 12) continue; } else { if(i == chord.key % 12u) continue; @@ -949,7 +949,7 @@ if ((cnote < 3) || (i == (UINT)nKey)) { UINT k = (cnote < 3) ? cnote : 2; - chord.notes[k] = static_cast(i+1); + chord.notes[k] = static_cast(i + 1); if (cnote < 3) cnote++; } } Index: mptrack/TrackerSettings.cpp =================================================================== --- mptrack/TrackerSettings.cpp (revision 12033) +++ mptrack/TrackerSettings.cpp (working copy) @@ -393,15 +393,15 @@ if(ichord < 12) { // Major Chords - Chords[ichord].notes[0] = (uint8)(ichord+5); - Chords[ichord].notes[1] = (uint8)(ichord+8); - Chords[ichord].notes[2] = (uint8)(ichord+11); + Chords[ichord].notes[0] = (int8)(ichord+5); + Chords[ichord].notes[1] = (int8)(ichord+8); + Chords[ichord].notes[2] = (int8)(ichord+11); } else if(ichord < 24) { // Minor Chords - Chords[ichord].notes[0] = (uint8)(ichord-8); - Chords[ichord].notes[1] = (uint8)(ichord-4); - Chords[ichord].notes[2] = (uint8)(ichord-1); + Chords[ichord].notes[0] = (int8)(ichord-8); + Chords[ichord].notes[1] = (int8)(ichord-4); + Chords[ichord].notes[2] = (int8)(ichord-1); } } @@ -1238,9 +1238,9 @@ if((chord & 0xFFFFFFC0) || (!chords[i].notes[0])) { chords[i].key = (uint8)(chord & 0x3F); - chords[i].notes[0] = (uint8)((chord >> 6) & 0x3F); - chords[i].notes[1] = (uint8)((chord >> 12) & 0x3F); - chords[i].notes[2] = (uint8)((chord >> 18) & 0x3F); + chords[i].notes[0] = static_cast(((chord >> 6) & 0x3F) | (0xC0 * ((chord >> 11) & 1))); + chords[i].notes[1] = static_cast(((chord >> 12) & 0x3F) | (0xC0 * ((chord >> 17) & 1))); + chords[i].notes[2] = static_cast(((chord >> 18) & 0x3F) | (0xC0 * ((chord >> 23) & 1))); } } } @@ -1251,7 +1251,7 @@ { for(std::size_t i = 0; i < std::size(chords); i++) { - int32 s = (chords[i].key) | (chords[i].notes[0] << 6) | (chords[i].notes[1] << 12) | (chords[i].notes[2] << 18); + int32 s = (chords[i].key) | ((chords[i].notes[0] & 0x3F) << 6) | ((chords[i].notes[1] & 0x3F) << 12) | ((chords[i].notes[2] & 0x3F) << 18); mpt::ustring note = mpt::format(U_("%1%2"))(mpt::ustring(NoteNamesSharp[i % 12]), i / 12); conf.Write(U_("Chords"), note, s); } Index: mptrack/TrackerSettings.h =================================================================== --- mptrack/TrackerSettings.h (revision 12033) +++ mptrack/TrackerSettings.h (working copy) @@ -193,7 +193,7 @@ }; uint8 key; // Base note - uint8 notes[3]; // Additional chord notes + int8 notes[3]; // Additional chord notes }; using MPTChords = std::array; // 3 octaves Index: mptrack/View_pat.cpp =================================================================== --- mptrack/View_pat.cpp (revision 12033) +++ mptrack/View_pat.cpp (working copy) @@ -5195,7 +5195,7 @@ { if(cnote) { - ModCommand::NOTE chordNote = key - NOTE_MIN; + int32 chordNote = key - NOTE_MIN; if(!relativeMode) { // Only use octave information from the base key @@ -5202,9 +5202,9 @@ chordNote = (chordNote / 12) * 12; } chordNote += cnote; - if(specs.HasNote(chordNote)) + if(chordNote >= NOTE_MIN && chordNote <= NOTE_MAX && specs.HasNote(static_cast(chordNote))) { - outNotes[numNotes++] = chordNote; + outNotes[numNotes++] = static_cast(chordNote); } } }