fix(free): remember last fret chord in expert and free modes
Shared last-chord memory; no-fret pick in free mode plays that chord. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
9ae3f5ec5e
commit
3c01dc8c28
|
|
@ -105,7 +105,7 @@ int16_t MIC_VOL_MAP[11]= {-9000,-7000,-5000,-3000,-1000,1000,3000,5000,7000,9000
|
|||
|
||||
uint8_t TOUCH_AREA_NUM = (sizeof(Touch_Areas)/sizeof(Touch_AreaTypeDef));
|
||||
|
||||
const uint8_t Version[3] = {0,2,24}; /* major.minor.patch — 0.2.24: 普通无指板也可拨片起奏(用专业停键调性)+偶拍停 */
|
||||
const uint8_t Version[3] = {0,2,25}; /* major.minor.patch — 0.2.25: 普通无指板拨片沿用专业最后指板和弦 */
|
||||
uint8_t Led = 8;
|
||||
bool PressFlag = 0;
|
||||
|
||||
|
|
@ -647,16 +647,16 @@ void Accomp_ApplyDefaultIChord(void)
|
|||
PressFlag = 0;
|
||||
}
|
||||
|
||||
/* 专业模式:记住停键时的移调,以及最后一次指板和弦(供普通无指板拨片)。
|
||||
* transpose: 0xFF=尚未在专业停过;移调合法值 0~11。
|
||||
/* 专业/普通共用:最后一次指板和弦(供普通无指板拨片)。
|
||||
* 另记专业停键时的移调:0xFF=尚未在专业停过;移调合法值 0~11。
|
||||
* chord: 0=无记录;1~21=指板键。 */
|
||||
static uint8_t s_expert_stop_transpose = 0xFFu;
|
||||
static uint8_t s_expert_last_chord = 0;
|
||||
static uint8_t s_last_fret_chord = 0;
|
||||
|
||||
static void Expert_RememberLastChord(uint8_t key)
|
||||
static void Accomp_RememberLastFretChord(uint8_t key)
|
||||
{
|
||||
if (key >= 1u && key <= 21u)
|
||||
s_expert_last_chord = key;
|
||||
s_last_fret_chord = key;
|
||||
}
|
||||
|
||||
static void Expert_RememberStopContext(void)
|
||||
|
|
@ -667,12 +667,16 @@ static void Expert_RememberStopContext(void)
|
|||
if (tab == 1 || (tab == 3 && last == 1))
|
||||
{
|
||||
s_expert_stop_transpose = (uint8_t)mGuiData[GUI_TRANSPOSE].Current;
|
||||
Expert_RememberLastChord(KEY_ID_1629);
|
||||
Accomp_RememberLastFretChord(KEY_ID_1629);
|
||||
}
|
||||
else if (tab == 2 || (tab == 3 && last == 2))
|
||||
{
|
||||
Accomp_RememberLastFretChord(KEY_ID_1629);
|
||||
}
|
||||
}
|
||||
|
||||
/* 普通无指板拨片:移调用专业停键值;和弦优先当前 KEY,否则专业最后指板,再否则一级 */
|
||||
static void FreeMode_ApplyExpertChordForNoFretPick(void)
|
||||
/* 普通无指板拨片:移调用专业停键值;和弦用专业/普通记下的最后指板,否则一级 */
|
||||
static void FreeMode_ApplyLastFretChordForNoFretPick(void)
|
||||
{
|
||||
if (s_expert_stop_transpose != 0xFFu &&
|
||||
(uint8_t)mGuiData[GUI_TRANSPOSE].Current != s_expert_stop_transpose)
|
||||
|
|
@ -683,13 +687,13 @@ static void FreeMode_ApplyExpertChordForNoFretPick(void)
|
|||
|
||||
if (KEY_ID_1629 >= 1u && KEY_ID_1629 <= 21u)
|
||||
{
|
||||
Expert_RememberLastChord(KEY_ID_1629);
|
||||
Accomp_RememberLastFretChord(KEY_ID_1629);
|
||||
PressFlag = 0;
|
||||
return;
|
||||
}
|
||||
if (s_expert_last_chord >= 1u && s_expert_last_chord <= 21u)
|
||||
if (s_last_fret_chord >= 1u && s_last_fret_chord <= 21u)
|
||||
{
|
||||
KEY_ID_1629 = s_expert_last_chord;
|
||||
KEY_ID_1629 = s_last_fret_chord;
|
||||
PressFlag = 0;
|
||||
return;
|
||||
}
|
||||
|
|
@ -1478,11 +1482,14 @@ void TM1629_Handle(uint8_t key)
|
|||
}
|
||||
uint8_t group = (key - 1) / 3; /* 1~3→0, 4~6→1, ..., 19~21→6 */
|
||||
KEY_ID_1629 = key;
|
||||
/* 专业(及设置页来自专业):记下指板和弦,供切普通后无指板拨片沿用 */
|
||||
if (mGuiData[GUI_TAB_INDEX].Current == 1 ||
|
||||
(mGuiData[GUI_TAB_INDEX].Current == 3 &&
|
||||
mGuiData[GUI_TAB_LAST_INDEX].Current == 1))
|
||||
Expert_RememberLastChord(key);
|
||||
/* 专业/普通(及对应设置页):记下最后指板和弦,供普通无指板拨片沿用 */
|
||||
{
|
||||
uint8_t tab = (uint8_t)mGuiData[GUI_TAB_INDEX].Current;
|
||||
uint8_t last = (uint8_t)mGuiData[GUI_TAB_LAST_INDEX].Current;
|
||||
if (tab == 1 || tab == 2 ||
|
||||
(tab == 3 && (last == 1 || last == 2)))
|
||||
Accomp_RememberLastFretChord(key);
|
||||
}
|
||||
MIDI = (STRING_MIDI *)Chord_Midi_Table[group];
|
||||
ORGAN_MIDI = OrganChord_Midi_Table[group];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue