#define UP 0x33B810EF
#define DOWN 0x33B8E01F
#define MENU 0x33B820DF
#define MUTE 0x33B8946B
#define IN 0x33B8C03F
#define POWER 0x33B800FF
#define BRIG_L 50
#define BRIG_H 250
#include <PT2329.h> // http://rcl-radio.ru/wp-content/uploads/2021/09/PT2329.zip
#include <Wire.h> // Входит в состав Arduino IDE
#include <Encoder.h> // http://rcl-radio.ru/wp-content/uploads/2019/05/Encoder.zip
#include <MsTimer2.h> // http://rcl-radio.ru/wp-content/uploads/2018/11/MsTimer2.zip
#include <EEPROM.h> // Входит в состав Arduino IDE
#include <LiquidCrystal_I2C.h> // http://forum.rcl-radio.ru/misc.php?action=pan_download&item=45&download=1
#include <boarddefs.h> // Входит в состав библиотеки IRremote
#include <IRremote.h> // http://rcl-radio.ru/wp-content/uploads/2019/06/IRremote.zip
#include <DS3231.h> // https://github.com/jarzebski/Arduino-DS3231/archive/master.zip
LiquidCrystal_I2C lcd(0x27,16,2); // Устанавливаем дисплей
Encoder myEnc(9, 8);//CLK, DT подключение энкодера
decode_results ir;
IRrecv irrecv(12); // указываем вывод модуля IR приемника
DS3231 clock;
RTCDateTime DateTime;
PT2329 pt;
byte v1[8] = {0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07};
byte v2[8] = {0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00};
byte v3[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x1F};
byte v4[8] = {0x1F,0x1F,0x00,0x00,0x00,0x00,0x1F,0x1F};
byte v5[8] = {0x1C,0x1C,0x00,0x00,0x00,0x00,0x1C,0x1C};
byte v6[8] = {0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C};
byte v7[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07};
byte v8[8] = {0x1F,0x1F,0x00,0x00,0x00,0x00,0x00,0x00};
byte i,d1,d2,d3,d4,d5,d6,e1,e2,e3,w,w1,gr1,gr2,power=0;
unsigned long time,oldPosition = -999,newPosition,times_in;
int a[6],menu,fun_d,vol,vol_old,in,bass,treb,mute,fun,ball,chl,chr,alarm_h,alarm_m,alarm,cl_l,start_power;
int hour,secon,minut,x,z,z0,z1,www;
byte sur_fun,mode_fun,in_x;
int gain0, gain1,gain2,gain3,gain4,gain5;
void setup() {
Wire.begin();Serial.begin(9600);irrecv.enableIRIn();
MsTimer2::set(3, to_Timer);MsTimer2::start();
lcd.init();lcd.backlight();clock.begin();
lcd.createChar(1, v1);lcd.createChar(2, v2);lcd.createChar(3, v3);lcd.createChar(4, v4);
lcd.createChar(5, v5);lcd.createChar(6, v6);lcd.createChar(7, v7);lcd.createChar(8, v8);
// clock.setDateTime(__DATE__, __TIME__); // Устанавливаем время на часах, основываясь на времени компиляции скетча
pinMode(6,OUTPUT); // PWM output
analogWrite(6,BRIG_H);
lcd.setCursor(5,0);lcd.print("PT2329");delay(1000);lcd.clear();// ЗАСТАВКА
pinMode(10,INPUT); // КНОПКА ЭНКОДЕРA
pinMode(2,INPUT_PULLUP); // INPUT
pinMode(3,INPUT_PULLUP); // MUTE
pinMode(4,INPUT_PULLUP); // POWER
pinMode(5,INPUT_PULLUP); // ALARM
pinMode(13,OUTPUT); // OUTPUT STANDBY
vol = EEPROM.read(0);bass = EEPROM.read(1)-15;treb = EEPROM.read(2)-15;fun = EEPROM.read(3);in = EEPROM.read(4);
gain1 = EEPROM.read(5);gain2 = EEPROM.read(6);gain3 = EEPROM.read(7);gain4 = EEPROM.read(8);gain5 = EEPROM.read(9);
ball = EEPROM.read(10)-4;alarm = EEPROM.read(11);alarm_h = EEPROM.read(12);alarm_m = EEPROM.read(13);
switch(in){
case 0: gain0 = gain1;break;
case 1: gain0 = gain2;break;
case 2: gain0 = gain3;break;
case 3: gain0 = gain4;break;
case 4: gain0 = gain5;break;}
audio();
}
void loop() {
////////// IR ////////////////////////////////////////////////////////////////////
if ( irrecv.decode( &ir )) {Serial.print("0x");Serial.println( ir.value,HEX);irrecv.resume();delay(50);}// IR приемник - чтение, в мониторе порта отображаются коды кнопок
if(ir.value==0){gr1=0;gr2=0;}// запрет нажатий не активных кнопок пульта
///////// BUTTON ///////////////////////////////////////////////////////////////////
if(power==0){
if(digitalRead(10)==LOW||ir.value==MENU){menu++;cl();myEnc.write(0);time=millis();in_x=0;w=1;w1=1;if(menu>4){menu=0;}}// MENU
if(digitalRead(2)==LOW||ir.value==IN){in++;cl();time=millis();times_in=millis();in_x=1;w=1;www=1;menu=100;if(in>4){in=0;}}// IN
if((digitalRead(3)==LOW||ir.value==MUTE)&&mute==0){mute=1;cl();vol_old=vol;vol=127+4;menu=100;myEnc.write(0);audio();lcd.setCursor(6,0);lcd.print("MUTE");}
if((digitalRead(3)==LOW||ir.value==MUTE)&&mute==1){mute=0;cl();vol=vol_old;menu=0;w=1;myEnc.write(0);time=millis();audio();cl();}
}else{menu=100;}
// standby output
if(power==0){digitalWrite(13,HIGH);}else{digitalWrite(13,LOW);}
/// power ///
if((digitalRead(4)==LOW||ir.value==POWER)&&power==0){power=1;menu=100;analogWrite(6,BRIG_L);cl();myEnc.write(0);vol_old=vol;vol=127+4;
lcd.setCursor(4,0);lcd.print("POWER OFF");audio();delay(2000);cl();}
if((digitalRead(4)==LOW||ir.value==POWER||start_power==1)&&power==1&&digitalRead(10)==HIGH&&digitalRead(5)==HIGH){
start_power=0;power=0;menu=0;analogWrite(6,BRIG_H);cl();myEnc.write(0);vol=vol_old;w=1;
lcd.setCursor(4,0);lcd.print("POWER ON");audio();delay(2000);cl();}
//////// VOLUME ////////////////////////////////////////////////////////////////
if(menu==0){
if(ir.value==UP){vol--;gr1=1;gr2=0;cl1();time=millis();w=1;w1=1;vol_fun();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){vol--;gr2=0;cl1();time=millis();w=1;w1=1;vol_fun();audio();}// кнопка >>>>>>
if(ir.value==DOWN){vol++;gr1=0;gr2=1;cl1();time=millis();w=1;w1=1;vol_fun();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){vol++;gr1=0;cl1();time=millis();w=1;w1=1;vol_fun();audio();}// кнопка <<<<<<
if (newPosition != oldPosition){oldPosition = newPosition;
vol=vol+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w1=1;vol_fun();audio();}
lcd.setCursor(0,0);lcd.print(F("VOLUME "));
lcd.setCursor(0,1);lcd.print(F("IN_"));lcd.print(in+1);
switch(fun){
case 0: lcd.setCursor(5,1);lcd.print(F("PB "));break;
case 1: lcd.setCursor(5,1);lcd.print(F("TN "));break;
case 2: lcd.setCursor(5,1);lcd.print(F("TSL"));break;
case 3: lcd.setCursor(5,1);lcd.print(F("TSH"));break;
}
fun_d = 87-vol;if(w==1){w=0;a[0]=(fun_d)/10;a[1]=(fun_d)%10;cif();}}
//////// BASS ////////////////////////////////////////////////////////////////
if(menu==1){
if(ir.value==UP){bass++;gr1=1;gr2=0;cl1();time=millis();w=1;w1=1;bass_fun();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){bass++;gr2=0;cl1();time=millis();w=1;w1=1;bass_fun();audio();}// кнопка >>>>>>
if(ir.value==DOWN){bass--;gr1=0;gr2=1;cl1();time=millis();w=1;w1=1;bass_fun();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){bass--;gr1=0;cl1();time=millis();w=1;w1=1;bass_fun();audio();}// кнопка <<<<<<
if (newPosition != oldPosition){oldPosition = newPosition;
bass=bass-newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w1=1;bass_fun();audio();}
lcd.setCursor(0,0);lcd.print(F("BASS "));fun_d = bass;
if(fun_d<0){lcd.setCursor(7,0);fun_d=abs(fun_d);lcd.write((uint8_t)3);}else{lcd.setCursor(7,0);lcd.print(" ");}
if(w==1){w=0;a[0]=(fun_d)/10;a[1]=(fun_d)%10;cif();}}
//////// TREBLE ////////////////////////////////////////////////////////////////
if(menu==2){
if(ir.value==UP){treb++;gr1=1;gr2=0;cl1();time=millis();w=1;w1=1;treb_fun();audio();}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){treb++;gr2=0;cl1();time=millis();w=1;w1=1;treb_fun();audio();}// кнопка >>>>>>
if(ir.value==DOWN){treb--;gr1=0;gr2=1;cl1();time=millis();w=1;w1=1;treb_fun();audio();}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){treb--;gr1=0;cl1();time=millis();w=1;w1=1;treb_fun();audio();}// кнопка <<<<<<
if (newPosition != oldPosition){oldPosition = newPosition;
treb=treb-newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w1=1;treb_fun();audio();}
lcd.setCursor(0,0);lcd.print(F("TREBLE "));fun_d = treb;
if(fun_d<0){lcd.setCursor(7,0);fun_d=abs(fun_d);lcd.write((uint8_t)3);}else{lcd.setCursor(7,0);lcd.print(" ");}
if(w==1){w=0;a[0]=(fun_d)/10;a[1]=(fun_d)%10;cif();}}
//////// BALANCE ///////////////////////////////////////////////////////////////
if(menu==3){
if(ir.value==UP){ball++;gr1=1;gr2=0;cl1();time=millis();w=1;w1=1;ball_fun();audio();}// кнопка >
if(ir.value==DOWN){ball--;gr1=0;gr2=1;cl1();time=millis();w=1;w1=1;ball_fun();audio();}// кнопка <
if (newPosition != oldPosition){oldPosition = newPosition;
ball=ball-newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w1=1;ball_fun();audio();}
lcd.setCursor(4,0);lcd.print(F(" <> "));lcd.setCursor(4,1);lcd.print(F("CHL CHR"));
chl=(4+ball)-4;chr=(4-ball)-4;
if(chl<0){lcd.setCursor(12,0);chl=abs(chl);lcd.write((uint8_t)3);}else{lcd.setCursor(12,0);lcd.print(" ");}
if(chr<0){lcd.setCursor(0,0);chr=abs(chr);lcd.write((uint8_t)3);}else{lcd.setCursor(0,0);lcd.print(" ");}
if(w==1){w=0;a[0]=chl;a[1]=chr;
for(i=0;i<2;i++){
switch(i){
case 0: e1=1,e2=2,e3=3;break;
case 1: e1=13,e2=14,e3=15;break;
}
switch(a[i]){
case 0: d1=1,d2=8,d3=6,d4=1,d5=3,d6=6;break;
case 1: d1=32,d2=2,d3=6,d4=32,d5=32,d6=6;break;
case 2: d1=2,d2=8,d3=6,d4=1,d5=4,d6=5;break;
case 3: d1=2,d2=4,d3=6,d4=7,d5=3,d6=6;break;
case 4: d1=1,d2=3,d3=6,d4=32,d5=32,d6=6;break;
case 5: d1=1,d2=4,d3=5,d4=7,d5=3,d6=6;break;
case 6: d1=1,d2=4,d3=5,d4=1,d5=3,d6=6;break;
case 7: d1=1,d2=8,d3=6,d4=32,d5=32,d6=6;break;
case 8: d1=1,d2=4,d3=6,d4=1,d5=3,d6=6;break;
case 9: d1=1,d2=4,d3=6,d4=7,d5=3,d6=6;break;
}
lcd.setCursor(e1,0);lcd.write((uint8_t)d1);lcd.setCursor(e2,0);lcd.write((uint8_t)d2);lcd.setCursor(e3,0);lcd.write((uint8_t)d3);
lcd.setCursor(e1,1);lcd.write((uint8_t)d4);lcd.setCursor(e2,1);lcd.write((uint8_t)d5);lcd.setCursor(e3,1);lcd.write((uint8_t)d6);
}}}
/////// TONE CONTROL ///////////////////////////////////////////////////////////
if(menu==4){
if(ir.value==UP){fun++;gr1=1;gr2=0;cl1();time=millis();www=1;w=1;w1=1;fun_fun();audio();}// кнопка >
if(ir.value==DOWN){fun--;gr1=0;gr2=1;cl1();time=millis();www=1;w=1;w1=1;fun_fun();audio();}// кнопка <
if (newPosition != oldPosition){oldPosition = newPosition;
fun=fun-newPosition;myEnc.write(0);newPosition=0;time=millis();www=1;w=1;w1=1;fun_fun();}
lcd.setCursor(2,0);lcd.print(F("TONE CONTROL"));
switch(fun){
case 0: sur_fun=0;mode_fun=0;lcd.setCursor(0,1);lcd.print(" BYPASS ");break;// Bypass
case 1: sur_fun=0;mode_fun=1;lcd.setCursor(0,1);lcd.print(" TONE ");break;// Tone
case 2: sur_fun=0;mode_fun=2;lcd.setCursor(0,1);lcd.print(" TONE&SURR_LOW ");break;// Tone&Sur/low
case 3: sur_fun=1;mode_fun=2;lcd.setCursor(0,1);lcd.print(" TONE&SURR_HIGH ");break;// Tone&Sur/High
}if(www==1){audio();www=0;}}
////////////////////////// GAIN IN /////////////////////////////////////////////////////////////////////////////////////
if(in_x==1){ menu=100;
if(digitalRead(10)==LOW){menu=0;cl();myEnc.write(0);time=millis();in_x=0;w=1;w1=1;}// MENU
switch(in){
case 0: gain0 = gain1;break;
case 1: gain0 = gain2;break;
case 2: gain0 = gain3;break;
case 3: gain0 = gain4;break;
case 4: gain0 = gain5;break;}
if(ir.value==UP){gain0++;gr1=1;gr2=0;cl1();times_in=millis();w=1;gain_func();www=1;}// кнопка >
if(ir.value==0xFFFFFFFF and gr1==1){gain0++;gr2=0;cl1();times_in=millis();w=1;gain_func();www=1;}// кнопка >>>>>>
if(ir.value==DOWN){gain0--;gr1=0;gr2=1;cl1();times_in=millis();w=1;gain_func();www=1;}// кнопка <
if(ir.value==0xFFFFFFFF and gr2==1){gain0--;gr1=0;cl1();times_in=millis();w=1;gain_func();www=1;}// кнопка <<<<<<
if (newPosition != oldPosition) {oldPosition = newPosition;
gain0=gain0-newPosition;myEnc.write(0);newPosition=0;times_in=millis();www=1;w=1;gain_func();}
switch(in){
case 0: gain1 = gain0;break;
case 1: gain2 = gain0;break;
case 2: gain3 = gain0;break;
case 3: gain4 = gain0;break;
case 4: gain5 = gain0;break;}
if(www==1){audio();www=0;}
lcd.setCursor(0,0);lcd.print(F("INPUT "));lcd.print(in+1);fun_d = gain0;
lcd.setCursor(0,1);lcd.print(F("GAIN "));
if(fun_d<0){lcd.setCursor(7,0);fun_d=abs(fun_d);lcd.write((uint8_t)3);}else{lcd.setCursor(7,0);lcd.print(" ");}
if(w==1){w=0;a[0]=(fun_d)/10;a[1]=(fun_d)%10;cif();}
if(millis()-times_in>3000){in_x=0;cl();menu=0;w=1;w1=1;time=millis();}}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////// ЧАСЫ ///////////////////////////////////////////////////////////////////
DateTime = clock.getDateTime();hour = DateTime.hour;minut = DateTime.minute;secon = DateTime.second;
if(power==1&&digitalRead(5)==HIGH){
if(cl_l==1){cl();cl_l=0;}
a[0]=DateTime.hour/10;
a[1]=DateTime.hour%10;
a[2]=DateTime.minute/10;
a[3]=DateTime.minute%10;
a[4]=DateTime.second/10;
a[5]=DateTime.second%10;
for(x=0;x<4;x++){
switch(x){
case 0: e1=0,e2=1,e3=2;break;
case 1: e1=3,e2=4,e3=5;break;
case 2: e1=7,e2=8,e3=9;break;
case 3: e1=10,e2=11,e3=12;break;
}digit();}
lcd.setCursor(6,0);lcd.print(".");lcd.setCursor(6,1);lcd.print(".");
lcd.setCursor(14,1);lcd.print(a[4]);lcd.setCursor(15,1);lcd.print(a[5]);
if(alarm==1){lcd.setCursor(14,0);lcd.print("**");}else{lcd.setCursor(14,0);lcd.print(" ");}
//// set time ////
if(digitalRead(10)==LOW&&digitalRead(2)==LOW){hour++;if(hour>23){hour=0;} clock.setDateTime(2021, 8, 28, hour, minut, secon);delay(100);}// input button HH++
if(digitalRead(10)==LOW&&digitalRead(3)==LOW){minut++;if(minut>59){minut=0;} clock.setDateTime(2021, 8, 28, hour, minut, secon);delay(100); }// mute MM++
if(digitalRead(10)==LOW&&digitalRead(4)==LOW){secon=0; clock.setDateTime(2021, 8, 28, hour, minut, secon);delay(100); }// power SS=0
}
/////////////////// Будильник ///////////////////////////////////////////////////////////////////
if(power==1&&digitalRead(5)==LOW){cl_l=1;
a[0]=alarm_h/10;
a[1]=alarm_h%10;
a[2]=alarm_m/10;
a[3]=alarm_m%10;
for(x=0;x<4;x++){
switch(x){
case 0: e1=0,e2=1,e3=2;break;
case 1: e1=3,e2=4,e3=5;break;
case 2: e1=7,e2=8,e3=9;break;
case 3: e1=10,e2=11,e3=12;break;
}digit();}
lcd.setCursor(6,0);lcd.print(".");lcd.setCursor(6,1);lcd.print(".");
lcd.setCursor(13,0);lcd.print("ALR");
if(alarm==1){lcd.setCursor(13,1);lcd.print("ON ");}else{lcd.setCursor(13,1);lcd.print("OFF");}
//// set time ////
if(digitalRead(2)==LOW){alarm_h++;if(alarm_h>23){alarm_h=0;}delay(100);}// input button HH++
if(digitalRead(3)==LOW){alarm_m++;if(alarm_m>59){alarm_m=0;}delay(100); }// mute MM++
if(digitalRead(4)==LOW&&alarm==0){alarm=1;delay(300);}
if(digitalRead(4)==LOW&&alarm==1){alarm=0;delay(300);}
}
if(alarm==1&&hour==alarm_h&&minut==alarm_m&&secon==0){start_power=1;}
/////// EEPROM //////////////////////////////////////////////////
if(millis()-time>10000 && w1==1&&mute==0&&power==0){
EEPROM.update(0,vol);EEPROM.update(1,bass+15);EEPROM.update(2,treb+15);EEPROM.update(3,fun);EEPROM.update(4,in);
EEPROM.update(5,gain1);EEPROM.update(6,gain2);EEPROM.update(7,gain3);EEPROM.update(8,gain4);EEPROM.update(9,gain5);
EEPROM.update(10,ball+4);EEPROM.update(11,alarm);EEPROM.update(12,alarm_h);EEPROM.update(13,alarm_m);
if(menu!=0){lcd.clear();}menu=0;w=1;w1=0;}
}// end loop
void ball_fun(){if(ball>4){ball=4;}if(ball<-4){ball=-4;}}
void fun_fun(){if(fun>3){fun=0;}if(fun<0){fun=3;}}
void gain_func(){if(gain0<0){gain0=0;}if(gain0>12){gain0=12;}}
void cl(){ir.value=0;delay(300);lcd.clear();}
void cl1(){ir.value=0;delay(300);}
void vol_fun(){if(vol>87){vol=87;}if(vol<8){vol=8;}}
void bass_fun(){if(bass<-15){bass=-15;}if(bass>15){bass=15;}}
void treb_fun(){if(treb<-15){treb=-15;}if(treb>15){treb=15;}}
void to_Timer(){newPosition = myEnc.read()/4;}
void digit(){switch(a[x]){
case 0: d1=1,d2=8,d3=6,d4=1,d5=3,d6=6;break;case 1: d1=32,d2=2,d3=6,d4=32,d5=32,d6=6;break;
case 2: d1=2,d2=8,d3=6,d4=1,d5=4,d6=5;break;case 3: d1=2,d2=4,d3=6,d4=7,d5=3,d6=6;break;
case 4: d1=1,d2=3,d3=6,d4=32,d5=32,d6=6;break;case 5: d1=1,d2=4,d3=5,d4=7,d5=3,d6=6;break;
case 6: d1=1,d2=4,d3=5,d4=1,d5=3,d6=6;break;case 7: d1=1,d2=8,d3=6,d4=32,d5=32,d6=6;break;
case 8: d1=1,d2=4,d3=6,d4=1,d5=3,d6=6;break;case 9: d1=1,d2=4,d3=6,d4=7,d5=3,d6=6;break;}
lcd.setCursor(e1,0);lcd.write((uint8_t)d1);lcd.setCursor(e2,0);lcd.write((uint8_t)d2);lcd.setCursor(e3,0);lcd.write((uint8_t)d3);
lcd.setCursor(e1,1);lcd.write((uint8_t)d4);lcd.setCursor(e2,1);lcd.write((uint8_t)d5);lcd.setCursor(e3,1);lcd.write((uint8_t)d6);}
void cif(){
for(i=0;i<2;i++){
switch(i){
case 0: e1=9,e2=10,e3=11;break;
case 1: e1=12,e2=13,e3=14;break;
}
switch(a[i]){
case 0: d1=1,d2=8,d3=6,d4=1,d5=3,d6=6;break;
case 1: d1=32,d2=2,d3=6,d4=32,d5=32,d6=6;break;
case 2: d1=2,d2=8,d3=6,d4=1,d5=4,d6=5;break;
case 3: d1=2,d2=4,d3=6,d4=7,d5=3,d6=6;break;
case 4: d1=1,d2=3,d3=6,d4=32,d5=32,d6=6;break;
case 5: d1=1,d2=4,d3=5,d4=7,d5=3,d6=6;break;
case 6: d1=1,d2=4,d3=5,d4=1,d5=3,d6=6;break;
case 7: d1=1,d2=8,d3=6,d4=32,d5=32,d6=6;break;
case 8: d1=1,d2=4,d3=6,d4=1,d5=3,d6=6;break;
case 9: d1=1,d2=4,d3=6,d4=7,d5=3,d6=6;break;
}
lcd.setCursor(e1,0);lcd.write((uint8_t)d1);lcd.setCursor(e2,0);lcd.write((uint8_t)d2);lcd.setCursor(e3,0);lcd.write((uint8_t)d3);
lcd.setCursor(e1,1);lcd.write((uint8_t)d4);lcd.setCursor(e2,1);lcd.write((uint8_t)d5);lcd.setCursor(e3,1);lcd.write((uint8_t)d6);
}}
void audio(){
pt.LCH_Volume(vol-4+ball);
// l_volume >>> byte 87...0 === -87...0 dB step 1 dB || int 127 === mute
pt.RCH_Volume(vol-4-ball);
// r_volume >>> byte 87...0 === -87...0 dB step 1 dB || int 127 === mute
pt.setBass(bass);
// set_bass >>> char -15...+15 === -15...+15 dB step 1 dB
pt.setTreb(treb);
// set_treb >>> char -15...+15 === -15...+15 dB step 1 dB
pt.setIn_gain(gain0);
// in_gain >>> byte 0...12 === 0...12 dB step 1 dB
pt.setIn_sel(in+1, 1, 0, sur_fun, mode_fun);
// in_sel >>> byte 1..6 === in1...in6, int 0 === mute
// rec >>> byte 0...1 === If A=0 means IN6 output OFF, than A=1 means IN6 output ON
// rec_gain >>> byte 0 === -2 dB, 1 === 0 dB
// surr >>> byte 0 === Surround Low, 1 === Surround High
// mode >>> byte 0 === Bypass, 1 === Tone, 2 === Tone & Sur
}