2026-08-26 07:26:58 +08:00
|
|
|
|
#include "includes.h"
|
|
|
|
|
|
extern const Touch_AreaTypeDef *pCurrentTouch_Area;
|
2026-08-31 06:10:13 +08:00
|
|
|
|
static int8_t s_mixer_focus = -1;
|
2026-08-26 07:26:58 +08:00
|
|
|
|
|
2026-09-02 13:37:25 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> / <20><><EFBFBD><EFBFBD>̨(<28><>ҳ) / ģʽѡ<CABD><D1A1> */
|
|
|
|
|
|
const Touch_AreaTypeDef Touch_Mixer_Areas[] = {
|
|
|
|
|
|
{ 0, 79, 280, 319, 0, UI0902_NAV_SETTING, GUI_NAV_BAR, NULL },
|
|
|
|
|
|
{ 80, 159, 280, 319, 0, UI0902_NAV_MIXER, GUI_NAV_BAR, NULL },
|
|
|
|
|
|
{ 160, 239, 280, 319, 0, UI0902_NAV_MODE, GUI_NAV_BAR, NULL },
|
2026-08-26 07:26:58 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2026-09-02 13:37:25 +08:00
|
|
|
|
#define TOUCH_BTN_NUM (sizeof(Touch_Mixer_Areas)/sizeof(Touch_AreaTypeDef))
|
2026-08-26 07:26:58 +08:00
|
|
|
|
|
2026-09-02 13:37:25 +08:00
|
|
|
|
/* ÿ·<C3BF><C2B7><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD>ֱ<EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD>ⲿ Flash ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>id0 <20><><EFBFBD><EFBFBD> id1 <20><><EFBFBD><EFBFBD> id2 MIC id3 <20><><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7> */
|
|
|
|
|
|
static const uint32_t s_fader_label[4][3] = { /* addr, w, h */
|
|
|
|
|
|
{ UI0902_TXT_MIXER_BAND_ADDR, UI0902_TXT_MIXER_BAND_W, UI0902_TXT_MIXER_BAND_H },
|
|
|
|
|
|
{ UI0902_TXT_MIXER_GUITAR_ADDR, UI0902_TXT_MIXER_GUITAR_W, UI0902_TXT_MIXER_GUITAR_H },
|
|
|
|
|
|
{ UI0902_TXT_MIXER_MIC_ADDR, UI0902_TXT_MIXER_MIC_W, UI0902_TXT_MIXER_MIC_H },
|
|
|
|
|
|
{ UI0902_TXT_MIXER_VOCALFX_ADDR, UI0902_TXT_MIXER_VOCALFX_W, UI0902_TXT_MIXER_VOCALFX_H },
|
|
|
|
|
|
};
|
2026-08-26 07:26:58 +08:00
|
|
|
|
|
|
|
|
|
|
// ============================================================
|
2026-09-02 13:37:25 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3>״γ<D7B4>ʼ<EFBFBD><CABC> / ҳ<><D2B3><EFBFBD>л<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ã<EFBFBD>
|
2026-08-26 07:26:58 +08:00
|
|
|
|
// ============================================================
|
|
|
|
|
|
void DrawFader(Fader_t *f)
|
|
|
|
|
|
{
|
2026-09-02 13:37:25 +08:00
|
|
|
|
uint16_t cx = f->x + f->w / 2;
|
|
|
|
|
|
uint16_t slider_y;
|
|
|
|
|
|
LCD_FillByColor(cx - 20, f->y, cx + 20, f->y + f->h + 30, UI0902_BG_COLOR);
|
|
|
|
|
|
LCD_WR_PIC_FROM_FLASH(cx - 15, f->y, 31, 215, UI0902_MIXER_TRACK_ADDR);
|
|
|
|
|
|
LCD_WR_PIC_FROM_FLASH_Trans(cx - s_fader_label[f->id][1] / 2, f->y + f->h + 8,
|
|
|
|
|
|
(uint16_t)s_fader_label[f->id][1], (uint16_t)s_fader_label[f->id][2],
|
|
|
|
|
|
s_fader_label[f->id][0]);
|
|
|
|
|
|
slider_y = CalcSliderY(f);
|
2026-08-26 07:26:58 +08:00
|
|
|
|
DrawFaderSlider(f, slider_y);
|
|
|
|
|
|
f->prev_slider_y = slider_y;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DrawAllFaders(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
NvmParam_Type * nvm = drv_nvm_param_ptr();
|
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
|
|
DrawFader(&faders[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
if(nvm->param.BandVol != faders[0].val)
|
|
|
|
|
|
{
|
|
|
|
|
|
nvm->param.BandVol = faders[0].val;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(nvm->param.StringVol != faders[1].val)
|
|
|
|
|
|
{
|
|
|
|
|
|
nvm->param.StringVol = faders[1].val;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(nvm->param.MIcVol != faders[2].val)
|
|
|
|
|
|
{
|
|
|
|
|
|
nvm->param.MIcVol = faders[2].val;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(nvm->param.MicRev != faders[3].val)
|
|
|
|
|
|
{
|
|
|
|
|
|
nvm->param.MicRev = faders[3].val;
|
|
|
|
|
|
}
|
|
|
|
|
|
drv_nvm_save_to_flash();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ============================================================
|
2026-09-02 13:37:25 +08:00
|
|
|
|
// <20><><EFBFBD>ƻ<EFBFBD><C6BB>飨<EFBFBD><E9A3A8>ɫ<EFBFBD><C9AB>ťͼƬ<CDBC><C6AC>+ <20><>ֵ + <20><><EFBFBD><EFBFBD><EFBFBD>»<EFBFBD><C2BB><EFBFBD>
|
2026-08-26 07:26:58 +08:00
|
|
|
|
// ============================================================
|
|
|
|
|
|
static void DrawFaderSlider(Fader_t *f, uint16_t slider_y)
|
|
|
|
|
|
{
|
2026-09-02 13:37:25 +08:00
|
|
|
|
uint16_t cx = f->x + f->w / 2;
|
|
|
|
|
|
uint16_t ly = f->y + f->h + 8;
|
2026-08-26 07:26:58 +08:00
|
|
|
|
char buf[8];
|
2026-09-02 13:37:25 +08:00
|
|
|
|
LCD_WR_PIC_FROM_FLASH_Trans(cx - 15, slider_y, 30, 24, UI0902_MIXER_KNOB_ADDR);
|
2026-08-26 07:26:58 +08:00
|
|
|
|
sprintf(buf, "%d", f->val);
|
2026-09-02 13:37:25 +08:00
|
|
|
|
LCD_ShowString_AutoAlign(cx - 15, cx + 15, slider_y + 5, (uint8_t*)buf,
|
|
|
|
|
|
LCD_ALIGN_CENTER, 0x1905, WHITE, 0, 11);
|
|
|
|
|
|
LCD_FillByColor(cx - 15, ly + 17, cx + 15, ly + 19, UI0902_BG_COLOR);
|
|
|
|
|
|
if (s_mixer_focus == (int8_t)f->id)
|
|
|
|
|
|
LCD_FillByColor(cx - 15, ly + 17, cx + 15, ly + 19, COLOR_PRIMARY);
|
2026-08-26 07:26:58 +08:00
|
|
|
|
}
|
2026-09-02 13:37:25 +08:00
|
|
|
|
|
2026-08-26 07:26:58 +08:00
|
|
|
|
// ============================================================
|
2026-09-02 13:37:25 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD>λ<EFBFBD>ñ仯<C3B1><E4BBAF><EFBFBD>ػ<EFBFBD><D8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٻ<EFBFBD><D9BB><EFBFBD><EFBFBD>飨<EFBFBD><E9A3A8><EFBFBD><EFBFBD>Ϊ<EFBFBD>ⲿ Flash ͼƬ<CDBC><C6AC>
|
2026-08-26 07:26:58 +08:00
|
|
|
|
// ============================================================
|
|
|
|
|
|
static void UpdateFaderSlider(Fader_t *f)
|
|
|
|
|
|
{
|
2026-09-02 13:37:25 +08:00
|
|
|
|
uint16_t cx = f->x + f->w / 2;
|
2026-08-26 07:26:58 +08:00
|
|
|
|
uint16_t new_y = CalcSliderY(f);
|
|
|
|
|
|
if (f->prev_slider_y == new_y) return;
|
2026-09-02 13:37:25 +08:00
|
|
|
|
LCD_WR_PIC_FROM_FLASH(cx - 15, f->y, 31, 215, UI0902_MIXER_TRACK_ADDR);
|
2026-08-26 07:26:58 +08:00
|
|
|
|
DrawFaderSlider(f, new_y);
|
|
|
|
|
|
f->prev_slider_y = new_y;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateFaderByTouch(int idx, uint16_t y)
|
|
|
|
|
|
{
|
|
|
|
|
|
uint8_t val_127;
|
|
|
|
|
|
uint8_t STR_val;
|
|
|
|
|
|
if (idx < 0 || idx > 3) return;
|
|
|
|
|
|
Fader_t *f = &faders[idx];
|
2026-08-31 06:10:13 +08:00
|
|
|
|
if (s_mixer_focus != (int8_t)idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
int8_t prev = s_mixer_focus;
|
|
|
|
|
|
s_mixer_focus = (int8_t)idx;
|
|
|
|
|
|
if (prev >= 0 && prev <= 3)
|
|
|
|
|
|
DrawFaderSlider(&faders[prev], faders[prev].prev_slider_y);
|
|
|
|
|
|
}
|
2026-08-26 07:26:58 +08:00
|
|
|
|
uint16_t y_min = f->y;
|
|
|
|
|
|
uint16_t y_max = f->y + f->h;
|
2026-09-02 13:37:25 +08:00
|
|
|
|
if (y < y_min + 8) {
|
2026-08-26 07:26:58 +08:00
|
|
|
|
f->val = 10;
|
|
|
|
|
|
}
|
2026-09-02 13:37:25 +08:00
|
|
|
|
else if (y > y_max - 8) {
|
2026-08-26 07:26:58 +08:00
|
|
|
|
f->val = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
int32_t val_raw = 10 - ((int32_t)(y - y_min) * 10) / (y_max - y_min);
|
|
|
|
|
|
if(val_raw < 0) val_raw = 0;
|
|
|
|
|
|
if(val_raw > 10) val_raw = 10;
|
|
|
|
|
|
f->val = val_raw;
|
|
|
|
|
|
}
|
|
|
|
|
|
UpdateFaderSlider(f);
|
2026-08-31 06:10:13 +08:00
|
|
|
|
DrawFaderSlider(f, f->prev_slider_y);
|
2026-08-26 07:26:58 +08:00
|
|
|
|
switch(idx) {
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
val_127 = (f->val * 127) / 10;
|
|
|
|
|
|
SendVolumeChangeMidiEvent(1,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(2,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(3,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(4,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(5,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(6,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(7,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(8,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(9,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(10,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(11,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(12,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(13,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(14,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(15,val_127);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
STR_val = (f->val * 127) / 10;
|
|
|
|
|
|
SendVolumeChangeMidiEvent(0,STR_val);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
AW816_Set_Volume(MIC_VOL_MAP[f->val]);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
AW816_Set_Reverb(f->val * 10);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ============================================================
|
2026-09-02 13:37:25 +08:00
|
|
|
|
// <20><><EFBFBD>㻬<EFBFBD><E3BBAC>Y<EFBFBD><59><EFBFBD>꣨<EFBFBD><EAA3A8><EFBFBD><EFBFBD>valֵ 0~10<31><30>
|
2026-08-26 07:26:58 +08:00
|
|
|
|
// ============================================================
|
|
|
|
|
|
static uint16_t CalcSliderY(Fader_t *f)
|
|
|
|
|
|
{
|
2026-09-02 13:37:25 +08:00
|
|
|
|
uint16_t slider_h = 24;
|
2026-08-26 07:26:58 +08:00
|
|
|
|
uint16_t fill_h = (f->val * f->h) / 10;
|
|
|
|
|
|
if (fill_h > f->h) fill_h = f->h;
|
|
|
|
|
|
uint16_t slider_y = f->y + f->h - fill_h - (slider_h / 2);
|
|
|
|
|
|
if (slider_y < f->y) slider_y = f->y;
|
|
|
|
|
|
if (slider_y > f->y + f->h - slider_h) slider_y = f->y + f->h - slider_h;
|
|
|
|
|
|
return slider_y;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int CheckTouchFader(uint16_t x, uint16_t y)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
|
|
Fader_t *f = &faders[i];
|
|
|
|
|
|
if (x >= f->x - 10 && x <= f->x + f->w + 10 &&
|
|
|
|
|
|
y >= f->y && y <= f->y + f->h) {
|
|
|
|
|
|
return i;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-09-02 13:37:25 +08:00
|
|
|
|
// ==================== <20><>ʼ<EFBFBD><CABC> ====================
|
2026-08-26 07:26:58 +08:00
|
|
|
|
void UI_Mixer_Init(void)
|
|
|
|
|
|
{
|
2026-08-31 06:10:13 +08:00
|
|
|
|
s_mixer_focus = -1;
|
|
|
|
|
|
UI_ClearFocus();
|
2026-09-02 13:37:25 +08:00
|
|
|
|
LCD_FillByColor(0, 0, 240, 320, UI0902_BG_COLOR);
|
|
|
|
|
|
LCD_ShowChinese_AutoAlign(0, 240, 8, (uint8_t*)"\xB5\xF7\xD2\xF4\xCC\xA8",
|
|
|
|
|
|
LCD_ALIGN_CENTER, WHITE, UI0902_BG_COLOR, 0, 16);
|
2026-08-26 07:26:58 +08:00
|
|
|
|
DrawAllFaders();
|
2026-09-02 13:37:25 +08:00
|
|
|
|
Draw_Bottom_Bar(UI0902_NAV_MIXER, 0);
|
|
|
|
|
|
pCurrentTouch_Area = Touch_Mixer_Areas;
|
2026-08-26 07:26:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-09-02 13:37:25 +08:00
|
|
|
|
// ==================== <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ====================
|
2026-08-26 07:26:58 +08:00
|
|
|
|
void UI_Mixer_Process(DisplayTaskMessage_Type msg)
|
|
|
|
|
|
{
|
|
|
|
|
|
uint16_t tx,ty;
|
|
|
|
|
|
int fader_idx;
|
|
|
|
|
|
switch(msg.MessageType)
|
|
|
|
|
|
{
|
|
|
|
|
|
case MSG_ID_TOUCH:
|
|
|
|
|
|
tx = msg.HiByte;
|
|
|
|
|
|
ty = msg.LoByte;
|
|
|
|
|
|
|
2026-09-02 13:37:25 +08:00
|
|
|
|
// 1. <20>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2026-08-26 07:26:58 +08:00
|
|
|
|
fader_idx = CheckTouchFader(tx, ty);
|
|
|
|
|
|
if (fader_idx >= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
UpdateFaderByTouch(fader_idx, ty);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-09-02 13:37:25 +08:00
|
|
|
|
// 2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2026-08-26 07:26:58 +08:00
|
|
|
|
for(uint8_t i=0; i<TOUCH_BTN_NUM; i++)
|
|
|
|
|
|
{
|
2026-09-02 13:37:25 +08:00
|
|
|
|
if( tx >= Touch_Mixer_Areas[i].x_min && tx <= Touch_Mixer_Areas[i].x_max &&
|
|
|
|
|
|
ty >= Touch_Mixer_Areas[i].y_min && ty <= Touch_Mixer_Areas[i].y_max )
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (Touch_Mixer_Areas[i].Value)
|
2026-08-26 07:26:58 +08:00
|
|
|
|
{
|
2026-09-02 13:37:25 +08:00
|
|
|
|
case UI0902_NAV_SETTING: MenuPage_Setting_Proc(); break;
|
|
|
|
|
|
case UI0902_NAV_MIXER: break; /* <20><>ҳ */
|
|
|
|
|
|
case UI0902_NAV_MODE: UI_ReturnToModeSelect(); break;
|
|
|
|
|
|
default: break;
|
2026-08-26 07:26:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
ResetAutoPowerCount();
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case MSG_ID_EC_VOL:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|