/*
|
* scene.c
|
*
|
* Created on: 2025年7月18日
|
* Author: 86189
|
*/
|
#include <string.h>
|
#include <stdlib.h>
|
#include <stdio.h>
|
#include <vector>
|
#include "tg_scene.h"
|
#include "../protocol_internal.h"
|
#include "../ModuleExport.h"
|
|
|
|
tgScene::~tgScene()
|
{
|
for (s32 i = 0; i < input_num; i++)
|
delete chin_mid[i];
|
for (s32 i = 0; i < output_num; i++)
|
delete chout_mid[i];
|
delete chin_mid;
|
delete chout_mid;
|
paramPtr.clear();
|
}
|
|
tgScene::tgScene(hw_adapter_t* adapter):Scene(adapter)
|
{
|
s32 i;
|
s8 inport_str[16],outport_str[16];
|
s8 ana_input_num, ana_output_num, loc_input_num, loc_output_num, dante_input_num, dante_output_num ;
|
s8 usb_input_num, usb_output_num;
|
// s16 input_num, output_num ;
|
s32 n, new_idx = 300; //ID of the USB channel starts from 300.
|
|
s16 dual_dsp = adapter->get_system_is_dual_dsp();
|
s16 dsp_index = adapter->get_dsp_index();
|
|
adapter->get_channel_num(&loc_input_num, &loc_output_num, &dante_input_num, &dante_output_num, &usb_input_num, &usb_output_num);
|
ana_input_num = loc_input_num - usb_input_num;
|
ana_output_num = loc_output_num - usb_output_num;
|
|
//物理输入共16+16+2
|
input_num = ana_input_num + dante_input_num + usb_input_num; //2 USB
|
output_num = ana_output_num + dante_output_num + usb_output_num;
|
chin_mid = new s32*[input_num];
|
chout_mid = new s32*[output_num];
|
for (i = 0; i < input_num; i++) {
|
chin_mid[i] = new s32[6];
|
}
|
for (i = 0; i < output_num; i++) {
|
chout_mid[i] = new s32[5];
|
}
|
paramPtr.resize(new_idx + usb_input_num * 5 + usb_output_num * 4, nullptr);
|
|
tgScene_param_default(¶meters);
|
|
sprintf(inport_str, "1-%d", input_num);
|
__MADD(299, PROC_INPUT,inport_str,inport_str,0, 1 ,¶meters.input, 0, ModuleInterfaceType::PHY_INPUT);
|
for (i = 0; i < input_num; i++)
|
chin_mid[i][0] = 299;
|
|
|
sprintf(inport_str, "1-%d", input_num);
|
__MADD(298, PROC_METER,inport_str,"",0,1 ,NULL,0, ModuleInterfaceType::SOFT_MODULE); //tag:0-peak,1-rms
|
|
|
|
//expander
|
for(s32 i =0 ;i < input_num ; i++) {
|
sprintf(inport_str, "%d|", i+1);
|
if(i < input_num - usb_input_num) {
|
__MADD(1+i, PROC_EXPANDER, inport_str, inport_str, 0, 0, ¶meters.in1[i], 0, ModuleInterfaceType::SOFT_MODULE);
|
chin_mid[i][1] = 1+i;
|
}
|
else {
|
__MADD(new_idx, PROC_EXPANDER, inport_str, inport_str, 0, 0, ¶meters.in1[i], 0, ModuleInterfaceType::SOFT_MODULE);
|
chin_mid[i][1] = new_idx++;
|
}
|
}
|
|
//compresser
|
for(s32 i =0 ;i < input_num ; i++) {
|
sprintf(inport_str, "%d|", i+1);
|
if(i < input_num - usb_input_num) {
|
__MADD(33+i, PROC_COMPRESS, inport_str, inport_str, 0, 0, ¶meters.in2[i], 0, ModuleInterfaceType::SOFT_MODULE);
|
chin_mid[i][2] = 33+i;
|
}
|
else {
|
__MADD(new_idx, PROC_COMPRESS, inport_str, inport_str, 0, 0, ¶meters.in2[i], 0, ModuleInterfaceType::SOFT_MODULE);
|
chin_mid[i][2] = new_idx++;
|
}
|
}
|
|
//agc
|
for(s32 i =0 ;i < input_num ; i++) {
|
sprintf(inport_str, "%d|", i+1);
|
if(i < input_num - usb_input_num) {
|
__MADD(65+i, PROC_AGC, inport_str, inport_str, 0, 0, ¶meters.in3[i], 0, ModuleInterfaceType::SOFT_MODULE);
|
chin_mid[i][3] = 65+i;
|
}
|
else {
|
__MADD(new_idx, PROC_AGC, inport_str, inport_str, 0, 0, ¶meters.in3[i], 0, ModuleInterfaceType::SOFT_MODULE);
|
chin_mid[i][3] = new_idx++;
|
}
|
}
|
|
//eq
|
for(s32 i =0 ;i < input_num ; i++) {
|
sprintf(inport_str, "%d|", i+1);
|
if(i < input_num - usb_input_num) {
|
__MADD(97+i, PROC_EQ, inport_str, inport_str, 0, 0, ¶meters.in4[i], 8, ModuleInterfaceType::SOFT_MODULE);
|
chin_mid[i][4] = 97+i;
|
}
|
else {
|
__MADD(new_idx, PROC_EQ, inport_str, inport_str, 0, 0, ¶meters.in4[i], 8, ModuleInterfaceType::SOFT_MODULE);
|
chin_mid[i][4] = new_idx++;
|
}
|
}
|
|
//nhs
|
for(s32 i =0 ;i < input_num ; i++) {
|
sprintf(inport_str, "%d|", i+1);
|
if(i < input_num - usb_input_num) {
|
__MADD(129+i, PROC_FEEDBACK, inport_str, inport_str, 0, 0, ¶meters.in5[i], 8, ModuleInterfaceType::SOFT_MODULE);
|
chin_mid[i][5] = 129+i;
|
}
|
else {
|
__MADD(new_idx, PROC_FEEDBACK, inport_str, inport_str, 0, 0, ¶meters.in5[i], 8, ModuleInterfaceType::SOFT_MODULE);
|
chin_mid[i][5] = new_idx++;
|
}
|
}
|
|
//am
|
sprintf(inport_str, "1-%d", input_num);
|
sprintf(outport_str, "1-%d", input_num+1);
|
__MADD(161,PROC_AUTOMIXER,inport_str, outport_str, 0, 0, ¶meters.automixer, 0, ModuleInterfaceType::SOFT_MODULE); //¿ÉÌæ»»
|
|
//aec selector
|
sprintf(inport_str, "1-%d", input_num+ 1);
|
sprintf(outport_str, "%d|%d|", input_num+ 2, input_num+ 3);
|
__MADD(162,PROC_SELECTOR, inport_str,outport_str, 0, 1, ¶meters.aec_selector, 0, ModuleInterfaceType::SOFT_MODULE); //add usb
|
|
//aec
|
sprintf(inport_str, "%d|%d", input_num+ 2, input_num+ 3);
|
sprintf(outport_str, "%d|", input_num+ 2);
|
__MADD(163,PROC_AEC,inport_str, outport_str ,0, 1, ¶meters.aec, 256, ModuleInterfaceType::SOFT_MODULE);
|
|
//ans selector
|
sprintf(inport_str, "1-%d", input_num+ 2);
|
sprintf(outport_str, "%d|", input_num+ 3);
|
__MADD(164,PROC_SELECTOR,inport_str,outport_str, 1, 1 ,¶meters.ans_selector, 0, ModuleInterfaceType::SOFT_MODULE);
|
|
//ans
|
sprintf(inport_str, "%d|", input_num+ 3);
|
sprintf(outport_str, "%d|", input_num+ 3);
|
__MADD(165,PROC_ANS,inport_str,outport_str, 1, 0 ,¶meters.afc_ns,0, ModuleInterfaceType::SOFT_MODULE);
|
|
//mixer
|
sprintf(inport_str, "1-%d", input_num+ 3);
|
sprintf(outport_str, "%d-%d",input_num+4, input_num+output_num+4);
|
__MADD(166,PROC_MIXER,inport_str,outport_str,1, 1 ,¶meters.mixer, 0, ModuleInterfaceType::SOFT_MODULE);
|
|
//dummy
|
for(s32 i =0 ;i < output_num ; i++) {
|
sprintf(inport_str, "%d|", i+input_num+4);
|
sprintf(outport_str, "%d|", i+1);
|
__MADD(500+i, DUMMY_OUTPUT, inport_str, outport_str, 1, 0, ¶meters.aec, 2, ModuleInterfaceType::SOFT_MODULE); //预防删除了第一个输出模块时硬件无声音输出
|
}
|
|
//crossover
|
for(s32 i =0 ;i < output_num ; i++) {
|
sprintf(outport_str, "%d|", i+1);
|
if(i < output_num - usb_output_num) {
|
__MADD(167+i, PROC_CROSSOVER, outport_str, outport_str, 1, 0, ¶meters.out1[i],2, ModuleInterfaceType::SOFT_MODULE);
|
chout_mid[i][1] = 167+i;
|
}
|
else {
|
__MADD(new_idx, PROC_CROSSOVER, outport_str, outport_str, 1, 0, ¶meters.out1[i],2, ModuleInterfaceType::SOFT_MODULE);
|
chout_mid[i][1] = new_idx++;
|
}
|
}
|
// printf("ou_adr ou1[2]:0x%x, ou1[3]:0x%x\n", ¶meters.out1[2], ¶meters.out1[3]);
|
|
//eq
|
for(s32 i =0 ;i < output_num ; i++) {
|
sprintf(outport_str, "%d|", i+1);
|
if(i < output_num - usb_output_num) {
|
__MADD(199+i, PROC_EQ, outport_str, outport_str,1, 0, ¶meters.out2[i], 8, ModuleInterfaceType::SOFT_MODULE);
|
chout_mid[i][2] = 199+i;
|
}
|
else {
|
__MADD(new_idx, PROC_EQ, outport_str, outport_str,1, 0, ¶meters.out2[i], 8, ModuleInterfaceType::SOFT_MODULE);
|
chout_mid[i][2] = new_idx++;
|
}
|
}
|
|
//delay
|
for(s32 i =0 ;i < output_num ; i++) {
|
sprintf(outport_str, "%d|", i+1);
|
if(i < output_num - usb_output_num) {
|
__MADD(231+i,PROC_DELAY, outport_str, outport_str,1, 0, ¶meters.out3[i], 1200, ModuleInterfaceType::SOFT_MODULE);
|
chout_mid[i][3] = 231+i;
|
}
|
else {
|
__MADD(new_idx,PROC_DELAY, outport_str, outport_str,1, 0, ¶meters.out3[i], 1200, ModuleInterfaceType::SOFT_MODULE);
|
chout_mid[i][3] = new_idx++;
|
}
|
}
|
|
//limit
|
for(s32 i =0 ;i < output_num ; i++) {
|
sprintf(outport_str, "%d|", i+1);
|
if(i < output_num - usb_output_num) {
|
__MADD(263+i, PROC_LIMIT, outport_str, outport_str,1, 0, ¶meters.out4[i],0, ModuleInterfaceType::SOFT_MODULE);
|
chout_mid[i][4] = 263+i;
|
}
|
else {
|
__MADD(new_idx, PROC_LIMIT, outport_str, outport_str,1, 0, ¶meters.out4[i],0, ModuleInterfaceType::SOFT_MODULE);
|
chout_mid[i][4] = new_idx++;
|
}
|
}
|
|
//output
|
sprintf(outport_str, "1-%d", output_num);
|
__MADD(295,PROC_OUTPUT,outport_str,outport_str,1, 1, ¶meters.output,0, ModuleInterfaceType::SOFT_MODULE);
|
for (i = 0; i < output_num; i++)
|
chout_mid[i][0] = 295;
|
|
//sysctrl
|
__MADD(296,PROC_SYSCTL,outport_str,outport_str,1, 1, ¶meters.sysctl,0, ModuleInterfaceType::SOFT_MODULE);
|
//meter
|
__MADD(297,PROC_METER,outport_str,outport_str,1, 1, ¶meters.output, 0, ModuleInterfaceType::PHY_OUTPUT);
|
|
};
|
|
|
void tgScene::module_def(s32 proc_type, void* param_ptr)
|
{
|
int j;
|
int allbypass = 1;
|
ptag_module pmodu = (ptag_module)param_ptr;
|
switch(proc_type) {
|
|
case PROC_INPUT:
|
ptag_input pInput = (ptag_input)param_ptr;
|
pInput->input_num = MAX_INPUT_NUM;
|
for(j=0; j<pInput->input_num; j++){
|
pInput->input[j].freq = 1000;
|
pInput->input[j].level = -4800;
|
pInput->input[j].phant = 0;
|
pInput->input[j].sensitivity = 0;
|
pInput->input[j].channelID = j;
|
pInput->input[j].gain =0;
|
pInput->input[j].mute = 0;
|
pInput->input[j].type=0;
|
pInput->input[j].phase =0;
|
pInput->input[j].mingain = -8000;
|
pInput->input[j].maxgain = 1200;
|
}
|
break;
|
|
case PROC_METER:
|
pmodu->proc_type = PROC_METER;
|
ptag_Meter pMeter = (ptag_Meter)pmodu->proc_ins;
|
pMeter->input_num = 8;
|
break;
|
|
case PROC_SHELF:
|
pmodu->proc_type = PROC_SHELF;
|
ptag_shelf pshelf = (ptag_shelf)pmodu->proc_ins;
|
pshelf->highshelf.bypass = allbypass;
|
pshelf->highshelf.freq = 500;
|
pshelf->highshelf.gain = -4500;
|
pshelf->highshelf.q = 71;
|
pshelf->lowshelf.bypass = 1;
|
pshelf->lowshelf.freq = 500;
|
pshelf->lowshelf.gain =-4500;
|
pshelf->lowshelf.q = 71;
|
break;
|
|
case PROC_GEQ:
|
int j;
|
pmodu->proc_type = PROC_GEQ;
|
ptag_geq pGEQ = (ptag_geq)pmodu->proc_ins;
|
pGEQ->bypass = allbypass;
|
pGEQ->q_index = 2;
|
pGEQ->nsections = 31;
|
for(j=0;j<31;j++){
|
pGEQ->eq_attr[j].gain = 0;
|
}
|
break;
|
case PROC_EQ:
|
pmodu->proc_type = PROC_EQ;
|
ptag_eq pEQ = (ptag_eq)pmodu->proc_ins;
|
u16 freq[]={40,80,200,500,1000,2000,4000,8000,10000,12500,16000,20000};
|
pEQ->bypass = allbypass;
|
pEQ->nsection = MAX_EQ_SECTION;
|
for(j=0;j<pEQ->nsection;j++){
|
pEQ->eq_attr[j].bypass = allbypass;
|
pEQ->eq_attr[j].freq = freq[j];
|
pEQ->eq_attr[j].gain = 0;
|
pEQ->eq_attr[j].q = 250;
|
//pEQ->eq_attr[j].type =
|
}
|
break;
|
|
case PROC_EXPANDER:
|
pmodu->proc_type = PROC_EXPANDER;
|
ptag_expander pExpander = (ptag_expander)pmodu->proc_ins;
|
pExpander->bypass = allbypass;
|
pExpander->threshold = -6000;
|
pExpander->ratio = 100;
|
pExpander->attack = 1;
|
pExpander->release = 1;
|
break;
|
|
case PROC_COMPRESS:
|
pmodu->proc_type = PROC_COMPRESS;
|
ptag_compress pcompress = (ptag_compress)pmodu->proc_ins;
|
pcompress->bypass = allbypass;
|
pcompress->threshold = -4800;
|
pcompress->ratio = 100;
|
pcompress->attack = 1;
|
pcompress->release = 1;
|
pcompress->gain = 0;
|
pcompress->soft = 0;
|
break;
|
|
case PROC_LIMIT:
|
pmodu->proc_type = PROC_LIMIT;
|
ptag_compress limiter = (ptag_compress)pmodu->proc_ins;
|
limiter->bypass = allbypass;
|
limiter->threshold = 0;
|
limiter->ratio = 10000;
|
limiter->attack = 1;
|
limiter->release = 1;
|
limiter->gain = 0;
|
limiter->soft = 0;
|
break;
|
|
case PROC_MIXER:
|
int m;
|
ptag_mixer pMixer = (ptag_mixer)param_ptr;
|
pMixer->input_num = MAX_MIXER_INPUT;
|
pMixer->output_num = MAX_MIXER_OUTPUT;
|
memset(pMixer->input_mask,0,sizeof(pMixer->input_mask));
|
for (m=0;m<pMixer->output_num ;m ++){
|
for(j=0;j<pMixer->input_num;j++){
|
pMixer->input_gain[m][j]=0;
|
pMixer->delay[m][j] =0;
|
}
|
pMixer->input_mask[m][m/16]=1<<(m&15);
|
}
|
break;
|
|
case PROC_DELAY:
|
pmodu->proc_type = PROC_DELAY;
|
ptag_delay pDelay = (ptag_delay)pmodu->proc_ins;
|
pDelay->bypass = allbypass;
|
pDelay->ms = 1;
|
break;
|
|
case PROC_CROSSOVER:
|
pmodu->proc_type = PROC_CROSSOVER;
|
ptag_crossover pCross = (ptag_crossover)pmodu->proc_ins;
|
pCross->highpass.bypass = allbypass;
|
pCross->highpass.freq = 500;//454;
|
pCross->highpass.taps = 18;//48;
|
pCross->highpass.type = 0;
|
pCross->highpass.gain =0 ;
|
pCross->lowpass.bypass = allbypass;
|
pCross->lowpass.freq = 500;
|
pCross->lowpass.taps = 18;
|
pCross->lowpass.type = 0;
|
pCross->lowpass.gain =0;
|
break;
|
|
case PROC_OUTPUT:
|
ptag_output pOutput= (ptag_output)param_ptr;
|
pOutput->output_num = MAX_OUTPUT_NUM;
|
for(j=0;j<pOutput->output_num;j++){
|
pOutput->output[j].gain = 0;
|
pOutput->output[j].mute = 0;
|
pOutput->output[j].channelID = j;
|
pOutput->output[j].phase = 0;
|
pOutput->output[j].mingain = -8000;
|
pOutput->output[j].maxgain = 1200;
|
}
|
break;
|
|
case PROC_GAIN:
|
ptag_gain pgain = (ptag_gain)param_ptr;
|
pgain->gain = 0;
|
pgain->mute = 0;
|
break;
|
|
case PROC_AUTOMIXER:
|
ptag_gainsharing_mixer pautomixer = (ptag_gainsharing_mixer)param_ptr;
|
pautomixer->bypass = allbypass;
|
pautomixer->master_mute =0;
|
pautomixer->master_gain =0;
|
pautomixer->response = 5;
|
pautomixer->slope = 200;
|
for(j=0;j<AUTOMIXER_CHANNEL_NUM;j++){
|
pautomixer->channels[j].automatic = 0;
|
pautomixer->channels[j].mute = 0;
|
pautomixer->channels[j].gain = 0;
|
pautomixer->channels[j].priority = 5;
|
}
|
break;
|
|
case PROC_FEEDBACK:
|
pmodu->proc_type = PROC_FEEDBACK;
|
ptag_feedback pfb = (ptag_feedback)pmodu->proc_ins;
|
pfb->bypass = allbypass;
|
pfb->panic_threshold = 0;
|
pfb->flt_depth = 1800;
|
break;
|
|
case PROC_SYSCTL:
|
ptag_sysctl psysctl = (ptag_sysctl)param_ptr;
|
psysctl->gain = 0;
|
psysctl->mute = 0;
|
break;
|
|
case PROC_AEC:
|
ptag_aec paec = (ptag_aec)param_ptr;
|
paec->bypass = allbypass;
|
paec->mode = 0;
|
break;
|
|
case PROC_ANS:
|
pmodu->proc_type = PROC_ANS;
|
ptag_ans pans = (ptag_ans)pmodu->proc_ins;
|
pans->bypass = allbypass;
|
pans->mode = 0;
|
break;
|
|
case PROC_SELECTOR:
|
ptag_selector pselector = (ptag_selector)param_ptr;
|
pselector->input_num = MAX_MIXER_INPUT;
|
pselector->output_num = MAX_MIXER_OUTPUT;
|
memset(pselector->input_mask,0,sizeof(pselector->input_mask));
|
break;
|
|
case PROC_AGC:
|
ptag_agc pAGC = (ptag_agc)param_ptr;
|
pAGC->bypass = allbypass;
|
pAGC->attacktime = 1;
|
pAGC->releasetime = 500;
|
pAGC->ratio = 100;
|
pAGC->tar_threshold = 0;
|
pAGC->threshold =-4800;
|
break;
|
|
case PROC_GATING_AUTOMIXER:
|
ptag_gating_mixer pgautomixer = (ptag_gating_mixer)param_ptr;
|
pgautomixer->bypass = allbypass;
|
pgautomixer->master_mute =0;
|
pgautomixer->master_gain =0;
|
pgautomixer->holdtime = 500;
|
pgautomixer->offgain = -4000;
|
pgautomixer->sensitivity = 600;
|
pgautomixer->nom_atten = 300;
|
pgautomixer->nom_num = 4;
|
for(j=0;j<AUTOMIXER_CHANNEL_NUM;j++){
|
pgautomixer->channels[j].automatic = 0;
|
pgautomixer->channels[j].mute = 0;
|
pgautomixer->channels[j].gain = 0;
|
pgautomixer->channels[j].priority = 5;
|
}
|
break;
|
|
case PROC_CONTINUNOUS_SPL:
|
ptag_spl pspl = (ptag_spl)param_ptr;
|
pspl->maxgain = 2000;
|
pspl->mingain = -2000;
|
pspl->sense_ratio = 75;
|
pspl->speed = 5;
|
pspl->trim =0;
|
pspl->bypass = allbypass;
|
memset((void*)pspl->mask,0,sizeof(pspl->mask));
|
break;
|
|
case PROC_GATING:
|
ptag_gate pgate = (ptag_gate)param_ptr;
|
pgate->bypass = allbypass;
|
pgate->threshold = -3000;
|
pgate->depth = -6000;
|
pgate->attacktime = 2;
|
pgate->holdtime = 5;
|
pgate->releasetime = 1000;
|
break;
|
|
case PROC_DUCKER:
|
pmodu->proc_type = PROC_DUCKER;
|
ptag_ducker pducker = (ptag_ducker)pmodu->proc_ins;
|
pducker->bypass = allbypass;
|
pducker->threshold = -4500;
|
pducker->depth = -2000;
|
pducker->attacktime = 20;
|
pducker->holdtime = 1000;
|
pducker->releasetime = 1000;
|
memset((void*)pducker->mask,0,sizeof(pducker->mask));
|
break;
|
|
case PROC_REVERB:
|
break;
|
|
case PROC_ECHO:
|
break;
|
|
case PROC_FIR:
|
pmodu->proc_type = PROC_FIR;
|
ptag_fir pfir = (ptag_fir)pmodu->proc_ins;
|
pfir->bypass = allbypass;
|
pfir->taps = 1024;
|
memset((void*)pfir->coeffs, 0, sizeof(pfir->coeffs));
|
pfir->coeffs[0] = 1;
|
break;
|
|
default:
|
break;
|
|
}
|
}
|
|
|
void tgScene::tgScene_param_default(ptag_parameters p)
|
{
|
int i,j,module_cnt=0;
|
|
module_def(PROC_INPUT, &p->input);
|
|
for (i=0; i<MAX_INPUT_NUM; i++) {
|
module_def(PROC_EXPANDER, &p->in1[i]);
|
module_def(PROC_COMPRESS, &p->in2[i]);
|
module_def(PROC_AGC, &p->in3[i]);
|
module_def(PROC_EQ, &p->in4[i]);
|
module_def(PROC_FEEDBACK, &p->in5[i]);
|
}
|
|
module_def(PROC_AUTOMIXER, &p->automixer);
|
module_def(PROC_SELECTOR, &p->aec_selector);
|
module_def(PROC_AEC, &p->aec);
|
module_def(PROC_SELECTOR, &p->ans_selector);
|
module_def(PROC_ANS, &p->ans_selector);
|
module_def(PROC_MIXER, &p->mixer);
|
|
for (i=0; i<MAX_OUTPUT_NUM; i++) {
|
module_def(PROC_CROSSOVER, &p->out1[i]);
|
module_def(PROC_EQ, &p->out2[i]);
|
module_def(PROC_DELAY, &p->out3[i]);
|
module_def(PROC_LIMIT, &p->out4[i]);
|
}
|
|
module_def(PROC_OUTPUT, &p->output);
|
module_def(PROC_SYSCTL, &p->sysctl);
|
}
|
|
|
s32 tgScene::set_parameters_content(uvoid* param, s32 size)
|
{
|
tag_parameters* pp = (tag_parameters*)param;
|
int L[24] = {0};
|
if(pp->magic != 0xbcba || size != sizeof(tag_parameters)) {
|
printf("preset param error!\n");
|
/*printf("tag_head:%d,%d,%d,%d,%d\n", L[0]=sizeof(parameters.magic), L[1]=sizeof(parameters.nmds)+L[0], L[2]=sizeof(parameters.pad1)+L[1], L[3]=sizeof(parameters.pad2)+L[2], L[4]=sizeof(parameters.crc)+L[3]);
|
printf("tag_input:%d, %d\n", sizeof(tag_input), L[5]=sizeof(tag_input)+L[4]);
|
printf("tag_module_in:%d, %d\n", sizeof(tag_module), L[6]=sizeof(tag_module) * MAX_INPUT_NUM * 5 + L[5]);
|
|
printf("tag_automixer:%d, %d\n", sizeof(tag_automixer), L[7]=sizeof(tag_automixer)+L[6]);
|
printf("tag_select1:%d, %d\n", sizeof(tag_selector), L[8]=sizeof(tag_selector)+L[7]);
|
printf("tag_aec:%d, %d\n", sizeof(tag_aec), L[9]=sizeof(tag_aec)+L[8]);
|
printf("tag_selector:%d, %d\n", sizeof(tag_selector), L[10]=sizeof(tag_selector) + L[9]);
|
printf("tag_3a:%d, %d, %d\n", sizeof(tag_3a), L[11]=sizeof(tag_3a)+L[10]);
|
printf("tag_mixer:%d, %d\n", sizeof(tag_mixer), L[12]=sizeof(tag_mixer)+L[11]);
|
|
printf("tag_module_o1:%d, %d\n", sizeof(tag_module), L[13]=sizeof(tag_module) * MAX_INPUT_NUM + L[12]);
|
printf("tag_module_fir:%d\n", sizeof(tag_module_fir), L[14]=sizeof(tag_module_fir) * MAX_OUTPUT_NUM + L[13]);
|
printf("tag_module_out:%d\n", sizeof(tag_module), L[15]=sizeof(tag_module) * MAX_OUTPUT_NUM * 2 + L[14]);
|
printf("tag_output:%d, %d\n", sizeof(tag_output), L[16]=sizeof(tag_output)+L[15]);
|
printf("tag_sysctl:%d, %d\n", sizeof(tag_sysctl), L[17]=sizeof(tag_sysctl)+L[16]);
|
printf("tag_group:%d, %d\n", sizeof(tag_group), L[18]=sizeof(tag_group)+L[17]);*/
|
|
dbg_printf("Len parameters:%d, Len recv:%d\n", L[19]=sizeof(tag_parameters), size);
|
return -1;
|
}
|
memcpy(¶meters, param, sizeof(tag_parameters));
|
|
return 0;
|
}
|
|
s32 tgScene::update_dynmodule_tag(s32 proc_type, struct proc_field* proc)
|
{
|
switch(proc_type) {
|
case ModuleType::PROC_GEQ:{
|
ptag_module pmodule = (ptag_module)proc->parameters;
|
ptag_geq geq = (ptag_geq)pmodule->proc_ins;
|
|
proc->tag = geq->nsections;
|
}
|
break;
|
case ModuleType::PROC_EQ:{
|
ptag_module pmodule = (ptag_module)proc->parameters;
|
ptag_eq eq = (ptag_eq)pmodule->proc_ins;
|
|
proc->tag = eq->nsection;
|
}
|
break;
|
case ModuleType::PROC_GATING:
|
case ModuleType::PROC_EXPANDER:
|
proc->tag =0;
|
break;
|
case ModuleType::PROC_COMPRESS:
|
case ModuleType::PROC_LIMIT:
|
proc->tag =0;
|
break;
|
case ModuleType::PROC_DELAY:
|
proc->tag =1200;
|
break;
|
case ModuleType::PROC_CROSSOVER:
|
proc->tag =1;
|
break;
|
case ModuleType::PROC_FEEDBACK:{
|
ptag_module pmodule = (ptag_module)proc->parameters;
|
ptag_feedback nhs = (ptag_feedback)pmodule->proc_ins;
|
|
proc->tag = nhs->fbc_num;
|
}
|
break;
|
case ModuleType::PROC_AGC:
|
proc->tag =0;
|
break;
|
case ModuleType::PROC_CONTINUNOUS_SPL:
|
proc->tag =0;
|
break;
|
case ModuleType::PROC_DUCKER:
|
proc->tag =0;
|
break;
|
case ModuleType::PROC_FIR:
|
proc->tag = 1024;
|
break;
|
default:
|
proc->tag =0 ;
|
break;
|
}
|
proc->proc_type = proc_type;
|
return 0;
|
}
|
|
s32 tgScene::update_module()
|
{
|
s8 ana_input_num, ana_output_num,dante_input_num,dante_output_num, usb_input_num, usb_output_num ;
|
s16 input_num, output_num ;
|
s16 dual_dsp = hw_adapter->get_system_is_dual_dsp();
|
s16 dsp_index = hw_adapter->get_dsp_index();
|
|
hw_adapter->get_channel_num(&ana_input_num, &ana_output_num, &dante_input_num, &dante_output_num, &usb_input_num, &usb_output_num);
|
input_num = ana_input_num + dante_input_num;
|
output_num = ana_output_num + dante_output_num;
|
|
for(auto& iter: proc_list){
|
//update dynamic module info.
|
if(iter.fixed == 0) {
|
ptag_module pmodule = (ptag_module)iter.parameters;
|
if(pmodule->proc_type >= ModuleType::PROC_COUNT || pmodule->proc_type < ModuleType::PROC_NONE) {
|
pmodule->proc_type = ModuleType::PROC_NONE;
|
}
|
|
update_dynmodule_tag(pmodule->proc_type, &iter);
|
}
|
}
|
|
return 0;
|
}
|
|
uvoid* tgScene::get_module_param_ptr(s32 mType, uvoid *param, s32 fixed)
|
{
|
uvoid *ptr = param;
|
|
if(fixed == 0){
|
if (PROC_FIR == mType) {
|
ptag_module_fir pmod = (ptag_module_fir)param;
|
ptr = (void*)pmod->proc_ins;
|
}
|
else {
|
ptag_module pmod = (ptag_module)param;
|
ptr = (void*)pmod->proc_ins;
|
}
|
}
|
return ptr;
|
}
|
|
|
//u32 tgScene::get_module_id(u32 mid, s32 mtype , u32 pid)
|
//{
|
// if(mtype == PROC_INPUT && (pid == INPUT_TYPE || pid == INPUT_FREQ || pid == INPUT_LEVEL)){
|
// mid = 300;
|
// }
|
// else if(mtype == PROC_DUCKER && pid == DUCKER_MIX){
|
// mid = mid + 320;
|
// }
|
//
|
// return mid;
|
//}
|