chenlh
2026-01-20 fe4d335b54ede7a47fd4bcf5c228fb427cbcc8c9
src/scene.cpp
@@ -14,6 +14,7 @@
#include "protocol_internal.h"
#include "moduleexport.h"
#include "crc.h"
#include "../drv/memory.h"
s32 Scene::str_delim(const s8* str, u16 logic_channel[])
{
@@ -49,7 +50,16 @@
   }
}
void *Scene::get_param(s32 proc_id)
{
   for (auto& proc : proc_list) {
      if (proc.proc_id == proc_id) {
//         printf("proc:%d,addr:0x%x\n", proc_id, proc.parameters);
         return proc.parameters;
      }
   }
   return nullptr;
}
s32 Scene::convert_to_bin(u8* bin)
{
@@ -67,7 +77,7 @@
   if (!bin) return 0;
   struct Module *m  = (struct Module *)(bin + size);
   printf("proc list size %d\n", proc_list.size());
   dbg_printf("proc list size %d\n", proc_list.size());
   for (i=0; i< proc_list.size(); i++) {
      Module *m  = (struct Module *)(bin + size);
@@ -80,25 +90,9 @@
         continue;
      }
      //ducker & spl.
      //ducker & spl with mix.
      if(p->proc_type == PROC_DUCKER || p->proc_type == PROC_CONTINUNOUS_SPL) {
         //insert a mixer.
         struct Module *mixer  = (struct Module *)(bin + size);
         u16 channelID[64];
         mixer->mDsp = 0;
         mixer->mID = p->proc_id + 320;
         mixer->mType = ModuleType::PROC_MIXER;
         mixer->mTag = 0;
         mixer->mPhyModule = 0;
         mixer->mParamaddr = (s32)get_module_param_ptr(p->parameters,p->fixed);
         size += sizeof(struct Module);
         mixer->mRxNum = str_delim(proc_list[1].inportstr, channelID) ;
         memcpy(bin + size , channelID, mixer->mRxNum*sizeof(u16)); size += mixer->mRxNum*sizeof(u16);
         mixer->mTxNum = 1;
         memcpy(bin + size , &rxBufID[1], mixer->mTxNum*sizeof(u16)); size += mixer->mTxNum*sizeof(u16);
         ninports = str_delim(proc_list[1].inportstr, &rxBufID[1]) + 1;   // rxBufID[0] is the dataIn Frame, rxBufID[1]~rxBufID[inportstr] is the mix channel.
      }
      if(hw_adapter->get_system_is_dual_dsp()){
         dsp_index = p->dsp_index ;
@@ -106,7 +100,6 @@
      else {
         dsp_index = 0;
      }
      m  = (struct Module *)(bin + size);
      for(j = 0 ; j< ninports ;j ++) {
@@ -125,7 +118,7 @@
      m->mType = p->proc_type;
      m->mTag = p->tag;
      m->mPhyModule = p->physic_type;
      m->mParamaddr = (s32)get_module_param_ptr(p->parameters,p->fixed);
      m->mParamaddr = (s32)get_module_param_ptr(m->mType, p->parameters, p->fixed);
      size += sizeof(struct Module);
      m->mRxNum = ninports;
@@ -137,7 +130,8 @@
         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);
            phy_id->mPhyID = hw_adapter->get_physical_channel(1, rxBufID[j]-1);
//            dbg_printf("PhyID:%d\n", phy_id->mPhyID);
         }
         size += ninports*sizeof(PhyPort);
      }
@@ -145,7 +139,7 @@
         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);
            phy_id->mPhyID = hw_adapter->get_physical_channel(0, txBufID[j]-1);
         }
         size += noutports*sizeof(PhyPort);
      }