From 96cfbbcc47a845cad3f3248c284703eca519650f Mon Sep 17 00:00:00 2001
From: graydon <weidong.gao@cretone.cn>
Date: 星期四, 24 七月 2025 17:36:56 +0800
Subject: [PATCH] 修正
---
src/tob.h | 6
src/tob.cpp | 128 +------------------------
src/tg/tg_scene.cpp | 47 ++++----
system/startup_ldf/app_startup.s | 2
system/startup_ldf/app_IVT.s | 2
src/tg/tg_adapter.cpp | 18 ++-
system/startup_ldf/app.ldf | 2
src/scene.h | 2
src/scene.cpp | 32 ++++--
system/startup_ldf/app_heaptab.c | 2
10 files changed, 74 insertions(+), 167 deletions(-)
diff --git a/src/scene.cpp b/src/scene.cpp
index e0cf1b2..4a248b6 100644
--- a/src/scene.cpp
+++ b/src/scene.cpp
@@ -108,7 +108,7 @@
}
}
- m->mDsp = 0;
+ m->mDsp = p->dsp_index;
m->mID = p->proc_id;
m->mType = p->proc_type;
m->mTag = p->tag;
@@ -120,23 +120,35 @@
memcpy(bin + size , rxBufID, m->mRxNum*sizeof(u16)); size += m->mRxNum*sizeof(u16);
m->mTxNum = noutports;
memcpy(bin + size , txBufID, m->mTxNum*sizeof(u16)); size += m->mTxNum*sizeof(u16);
+
+ if(p->physic_type == ModuleInterfaceType::PHY_INPUT) {
+ PhyPort* phy_id = (PhyPort*)(bin + size);
+ for(j = 0 ; j< ninports ;j ++, phy_id++) {
+ phy_id->mIntType = 0;
+ phy_id->mPhyID = hw_adapter->get_physical_channel(1, j);
+ }
+ size += ninports*sizeof(PhyPort);
+ }
+ else if(p->physic_type == ModuleInterfaceType::PHY_OUTPUT){
+ PhyPort* phy_id = (PhyPort*)(bin + size);
+ for(j = 0 ; j< noutports ;j ++, phy_id++) {
+ phy_id->mIntType = 0;
+ phy_id->mPhyID = hw_adapter->get_physical_channel(0, j);
+ }
+ size += noutports*sizeof(PhyPort);
+ }
}
- ninports = dsp_input_num[0]>dsp_output_num[0]?dsp_input_num[0]:dsp_output_num[0];
- noutports = dsp_input_num[1]>dsp_output_num[1]?dsp_input_num[1]:dsp_output_num[1];
-
- if(0) {
- flowchart->dsp_buffer_num[0] = ninports;
- flowchart->dsp_buffer_num[1] = noutports;
- }
- else {
- flowchart->dsp_buffer_num[0] = ninports>noutports?ninports:noutports;
+ //dual_dsp for 2 DSP,else 1 DSP.
+ for (i =0 ;i < hw_adapter->get_system_is_dual_dsp() + 1 ;i ++) {
+ flowchart->dsp_buffer_num[i] = std::max(dsp_input_num[i], dsp_output_num[i]);
}
flowchart->module_num = proc_list.size();
flowchart->crcLsb = 0;
flowchart->crcMsb = 0;
flowchart->compress = 0;
+ flowchart->version = 1;
crc = CRC::crc32((const u8*)bin, size);
diff --git a/src/scene.h b/src/scene.h
index 0835324..aa76874 100644
--- a/src/scene.h
+++ b/src/scene.h
@@ -23,7 +23,7 @@
s8 inportstr[8]; //模块输入逻辑端口 ID
s8 outportstr[8]; //模块输出逻辑端口 ID
- s8 dsp_index; //模块所属DSP,<0无效
+ s8 dsp_index; //模块所属DSP, < 0无效
u8 fixed; //模块是否可更换,0-可更换,1-不可更换
u8 pad =0;
u8 physic_type ;//1:input,2-output.
diff --git a/src/tg/tg_adapter.cpp b/src/tg/tg_adapter.cpp
index f0c9db4..8a30391 100644
--- a/src/tg/tg_adapter.cpp
+++ b/src/tg/tg_adapter.cpp
@@ -9,22 +9,30 @@
s32 input_num = ana_input_num + dante_input_num ;
if(logic_channel < ana_input_num) {
//analog
- return logic_channel;
+ return logic_channel + 1;
}
else if(logic_channel < input_num) {
//dante
- return 16+ (logic_channel-ana_input_num);
+ return 17+ (logic_channel-ana_input_num);
}
else {
//usb
- return 48 + (logic_channel-input_num);
+ return 49 + (logic_channel-input_num);
}
}
else {
+ s32 output_num = ana_output_num + dante_output_num ;
//output
+ if(logic_channel < ana_output_num) {
+ return logic_channel +1;
+ }
+ else if(logic_channel < output_num) {
+ return 17+ (logic_channel-ana_output_num);
+ }
+ else {
+ return 49 + (logic_channel-output_num);
+ }
}
-
- return 0;
}
//物理buffer定义顺序是16通道模拟+2通道USB+32通道Dante.
diff --git a/src/tg/tg_scene.cpp b/src/tg/tg_scene.cpp
index e233423..2804842 100644
--- a/src/tg/tg_scene.cpp
+++ b/src/tg/tg_scene.cpp
@@ -25,7 +25,8 @@
input_num = ana_input_num + dante_input_num;
output_num = dante_input_num + dante_output_num;
- sprintf(inport_str, "0-%d", input_num-1);
+ //port from 1 start.
+ sprintf(inport_str, "1-%d", input_num);
__MADD(299,PROC_INPUT,inport_str,inport_str,0, 1 ,¶meters.input, 0, ModuleInterfaceType::PHY_INPUT);
__MADD(298,PROC_METER,inport_str,"",0,1 ,NULL,0, ModuleInterfaceType::SOFT_MODULE); //tag:0-peak,1-rms
@@ -41,90 +42,90 @@
//expander
for(s32 i =0 ;i < input_num ; i++) {
- sprintf(inport_str, "%d|", i);
+ sprintf(inport_str, "%d|", i+1);
__MADD(1+i,PROC_EXPANDER, inport_str, inport_str, 0, 0, ¶meters.in1[i], 0, ModuleInterfaceType::SOFT_MODULE);
}
//compresser
for(s32 i =0 ;i < input_num ; i++) {
- sprintf(inport_str, "%d|", i);
+ sprintf(inport_str, "%d|", i+1);
__MADD(33+i,PROC_COMPRESS, inport_str, inport_str, 0, 0, ¶meters.in2[i], 0, ModuleInterfaceType::SOFT_MODULE);
}
//agc
for(s32 i =0 ;i < input_num ; i++) {
- sprintf(inport_str, "%d|", i);
+ sprintf(inport_str, "%d|", i+1);
__MADD(65+i,PROC_AGC, inport_str, inport_str, 0, 0, ¶meters.in3[i], 0, ModuleInterfaceType::SOFT_MODULE);
}
//eq
for(s32 i =0 ;i < input_num ; i++) {
- sprintf(inport_str, "%d|", i);
+ sprintf(inport_str, "%d|", i+1);
__MADD(97+i,PROC_EQ, inport_str, inport_str, 0, 0, ¶meters.in4[i], 8, ModuleInterfaceType::SOFT_MODULE);
}
//nhs
for(s32 i =0 ;i < input_num ; i++) {
- sprintf(inport_str, "%d|", i);
+ sprintf(inport_str, "%d|", i+1);
__MADD(129+i,PROC_FEEDBACK, inport_str, inport_str, 0, 0, ¶meters.in5[i], 8, ModuleInterfaceType::SOFT_MODULE);
}
//am
- sprintf(inport_str, "0-%d", input_num-1);
- sprintf(outport_str, "0-%d", input_num);
+ 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, "0-%d", input_num+ 1);//+1 add usb
- sprintf(outport_str, "%d|%d|", input_num+ 2, input_num+ 3);
+ sprintf(inport_str, "1-%d", input_num+ 2);//+1 add usb
+ sprintf(outport_str, "%d|%d|", input_num+ 3, input_num+ 4);
__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);
+ sprintf(inport_str, "%d|%d", input_num+ 3, input_num+ 4);
+ sprintf(outport_str, "%d|", input_num+ 3);
__MADD(163,PROC_AEC,inport_str, outport_str ,0, 1, ¶meters.aec, 256, ModuleInterfaceType::SOFT_MODULE);
//ans selector
- sprintf(inport_str, "0-%d", input_num+ 2);
- sprintf(outport_str, "%d|", input_num+ 3);
+ sprintf(inport_str, "0-%d", input_num+ 3);
+ sprintf(outport_str, "%d|", input_num+ 4);
__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);
+ sprintf(inport_str, "%d|", input_num+ 4);
+ sprintf(outport_str, "%d|", input_num+ 4);
__MADD(165,PROC_ANS,inport_str,outport_str, 1, 0 ,¶meters.afc_ns,0, ModuleInterfaceType::SOFT_MODULE);
//mixer
- sprintf(inport_str, "0-%d", input_num+ 3);
- sprintf(outport_str, "0-%d", output_num);
+ sprintf(inport_str, "1-%d", input_num+ 4);
+ sprintf(outport_str, "1-%d", output_num+1);
__MADD(166,PROC_MIXER,"0-35","0-32",1, 1 ,¶meters.mixer, 0, ModuleInterfaceType::SOFT_MODULE);
//crossover
for(s32 i =0 ;i < output_num ; i++) {
- sprintf(outport_str, "%d|", i);
+ sprintf(outport_str, "%d|", i+1);
__MADD(167,PROC_CROSSOVER,outport_str, outport_str,1, 0, ¶meters.out1[i],2, ModuleInterfaceType::SOFT_MODULE);
}
//eq
for(s32 i =0 ;i < output_num ; i++) {
- sprintf(outport_str, "%d|", i);
+ sprintf(outport_str, "%d|", i+1);
__MADD(199,PROC_EQ,outport_str, outport_str,1, 0, ¶meters.out2[i], 8, ModuleInterfaceType::SOFT_MODULE);
}
//delay
for(s32 i =0 ;i < output_num ; i++) {
- sprintf(outport_str, "%d|", i);
+ sprintf(outport_str, "%d|", i+1);
__MADD(231,PROC_DELAY,outport_str, outport_str,1, 0, ¶meters.out3[i], 1200, ModuleInterfaceType::SOFT_MODULE);
}
//limit
for(s32 i =0 ;i < output_num ; i++) {
- sprintf(outport_str, "%d|", i);
+ sprintf(outport_str, "%d|", i+1);
__MADD(263,PROC_LIMIT,outport_str, outport_str,1, 0, ¶meters.out4[i],0, ModuleInterfaceType::SOFT_MODULE);
}
//output
- sprintf(outport_str, "0-%d", output_num-1);
+ sprintf(outport_str, "0-%d", output_num);
__MADD(295,PROC_OUTPUT,outport_str,outport_str,1, 1, ¶meters.output,0, ModuleInterfaceType::SOFT_MODULE);
//sysctrl
__MADD(296,PROC_SYSCTL,outport_str,outport_str,1, 1, ¶meters.sysctl,0, ModuleInterfaceType::PHY_OUTPUT);
diff --git a/src/tob.cpp b/src/tob.cpp
index 22f4e44..7de4099 100644
--- a/src/tob.cpp
+++ b/src/tob.cpp
@@ -39,7 +39,6 @@
frames = NULL;
processed = ufalse;
mModuleNum =0;
- mLevelPacketNum =0;
mModuleIndex.resize(0);
}
@@ -382,130 +381,19 @@
return ErrStatus::SUCCESS;
}
-u32 ToB::GetLevels(Message* handle , MSG* pmsg)
+u32 ToB::GetLevels(s16* buffer)
{
- u32 n =0,len =0;
- s8 buffer[MSG_DATA_LEN];
- u32 packetNo =0;
+ u32 n =0,size =0;
if( !processed ) {
return 0;
}
-//
-// for (std::vector<IModule*>::iterator iter = mList.begin();
-// iter != mList.end() ; iter++) {
-// IModule* m = *iter;
-//
-// u32 ID = m->GetModuleID();
-//
-// struct Level* p = (struct Level*)buffer;
-//
-// n = sizeof(struct Level);
-// p->mID = ID;
-//
-// /*graydon-230905: 多通道模块会出现电平数量超出1024,比如32通道32点反馈抑制,
-// * ps: 讨论决定多通道模块在界面做数量限制且过多多通道不符合应用需求.
-// */
-// p->num = m->GetLevel((s16*)(buffer + n));
-// if(p->num == 0) continue;
-//
-// n += p->num*sizeof(s16);
-//
-// //过去的电平数量+当前的电平数量是否大于MSG_DATA_LEN
-// if(len + n > MSG_DATA_LEN) {
-// pmsg->pktNo = packetNo++;
-// pmsg->totalPkts = mLevelPacketNum;
-// pmsg->Enc(MsgType::MSG_LEVEL_GET_RES, 0, len);
-// handle->Send(pmsg);//入队列
-// len = 0;
-// }
-// memcpy(pmsg->data+len, p , n);
-// len += n;
-// }
-//
-// if(len > 0) {
-// pmsg->pktNo = packetNo++;
-// pmsg->totalPkts = mLevelPacketNum;
-// pmsg->Enc(MsgType::MSG_LEVEL_GET_RES, 0, len);
-// handle->Send(pmsg);
-// }
-//
-// if(packetNo > 0){
-// mLevelPacketNum = packetNo;
-// }
-// return n;
- return 0;
-}
-
-
-//cpu = time*SAMPLE_RATE/SAMPLE_NUM
-//cpu *1000 -> s32
-//cpu * 100 -> percent.
-u32 ToB::GetModuleCPU(Message* handle , MSG* pmsg)
-{
-// u32 n =0;
-// const ufloat period_s = SAMPLE_NUM*1.f/SAMPLE_RATE;
-// const u32 percent = 100000;
-// ufloat module_cpu ;
-// u32* data = (u32*)pmsg->data;
-//
-// if( !processed ) {
-// return 0;
-// }
-//
-// for (std::vector<IModule*>::iterator iter = mList.begin();
-// iter != mList.end() ; iter++) {
-// IModule* m = *iter;
-// ufloat time = m->GetRuntime();
-// ModuleType type = (ModuleType)m->GetModuleType();
-// u32 tag = m->GetModuleTag();
-// u16 rxNum = m->GetModuleInputNum();
-// u16 txNum = m->GetModuleOutputNum();
-// u32 ID = m->GetModuleID();
-//
-//
-// switch(type) {
-// case ModuleType::Mixer:
-// case ModuleType::SupperMatrix:
-// time = time / rxNum ;
-// module_cpu = time / period_s ;
-// break;
-// case ModuleType::GEQ:
-// case ModuleType::EQ:
-// case ModuleType::NHS:
-// time = time / (tag * rxNum) ;
-// module_cpu = time / period_s ;
-// break;
-// case ModuleType::SignalGenerator:
-// case ModuleType::Ducker:
-// case ModuleType::ContinuitySPL:
-// time = time / txNum ;
-// module_cpu = time / period_s ;
-// break;
-// case ModuleType::AEC:
-// module_cpu = time / 0.01f ;//aec 10ms处理一次.
-// break;
-// default:
-// time = time / rxNum ;
-// module_cpu = time / period_s ;
-// break;
-// }
-// data[n++] = ID;
-// data[n++] = (u32)(module_cpu* percent);
-//
-// if(n*sizeof(u32) >= MSG_DATA_LEN) {
-// pmsg->Enc(MsgType::MSG_MODULE_CPU_RES, 0, MSG_DATA_LEN);
-// handle->Send(pmsg);
-// n = 0;
-// }
-// }
-//
-// if(n > 0) {
-// pmsg->Enc(MsgType::MSG_MODULE_CPU_RES, 0, n*sizeof(u32));
-// handle->Send(pmsg);
-// }
-
- return 0;
+ for (std::vector<IModule*>::iterator iter = mList.begin();
+ iter != mList.end() ; iter++) {
+ size = (*iter)->GetLevel(buffer + n );
+ n += size;
+ }
+ return n;
}
diff --git a/src/tob.h b/src/tob.h
index c1ae2d7..969313e 100644
--- a/src/tob.h
+++ b/src/tob.h
@@ -27,7 +27,6 @@
ubool dual_dsp;
ubool processed;
u16 mModuleNum;
- u16 mLevelPacketNum ;
IModule* CreateBaseModule( u32 moduleType, u16 tag, u16 rxNum, u16 txNum);
ErrStatus CreateModule(const u8* bin, u32 nbytes);
ErrStatus CreateModuleV1(const u8* bin, u32 nbytes);
@@ -42,10 +41,9 @@
ErrStatus toCtrl(u32 mID, u32 pID, const s16* val, u32 num);
ErrStatus toCtrl(const u8* bin , u32 nbytes);
ErrStatus toAnalysis(const u8* bin, u32 nbytes);
- u32 GetLevels(Message* handle , MSG* msg);
- u32 GetModuleCPU(Message* handle , MSG* pmsg);
+ u32 GetLevels(s16* buffer);
u16 GetModuleNum() {return mModuleNum;}
- u16 GetLevelPacketNum() {return mLevelPacketNum;}
+
u32 GetDSPIndex(){return dsp_index ;}
u32 GetModuleType(u32 mID);
};
diff --git a/system/startup_ldf/app.ldf b/system/startup_ldf/app.ldf
index ad87259..803854a 100644
--- a/system/startup_ldf/app.ldf
+++ b/system/startup_ldf/app.ldf
@@ -1,5 +1,5 @@
/*
-** ADSP-21569 linker description file generated on Jul 17, 2025 at 13:46:52.
+** ADSP-21569 linker description file generated on Jul 24, 2025 at 14:17:30.
*/
/*
** Copyright (C) 2000-2022 Analog Devices Inc., All Rights Reserved.
diff --git a/system/startup_ldf/app_IVT.s b/system/startup_ldf/app_IVT.s
index 0752e5d..d371cf9 100644
--- a/system/startup_ldf/app_IVT.s
+++ b/system/startup_ldf/app_IVT.s
@@ -1,5 +1,5 @@
/*
-** ADSP-21569 app_IVT.s generated on Jul 17, 2025 at 13:46:52
+** ADSP-21569 app_IVT.s generated on Jul 24, 2025 at 14:17:29
*/
/*
** Copyright (C) 2000-2022 Analog Devices Inc., All Rights Reserved.
diff --git a/system/startup_ldf/app_heaptab.c b/system/startup_ldf/app_heaptab.c
index 45be006..b4673ae 100644
--- a/system/startup_ldf/app_heaptab.c
+++ b/system/startup_ldf/app_heaptab.c
@@ -1,5 +1,5 @@
/*
-** ADSP-21569 user heap source file generated on Jul 17, 2025 at 13:46:52.
+** ADSP-21569 user heap source file generated on Jul 24, 2025 at 14:17:30.
*/
/*
** Copyright (C) 2000-2022 Analog Devices Inc., All Rights Reserved.
diff --git a/system/startup_ldf/app_startup.s b/system/startup_ldf/app_startup.s
index deb1ceb..5fc99aa 100644
--- a/system/startup_ldf/app_startup.s
+++ b/system/startup_ldf/app_startup.s
@@ -1,5 +1,5 @@
/*
-** ADSP-21569 startup code generated on Jul 17, 2025 at 13:46:52.
+** ADSP-21569 startup code generated on Jul 24, 2025 at 14:17:29.
*/
/*
** Copyright (C) 2000-2022 Analog Devices Inc., All Rights Reserved.
--
Gitblit v1.9.3