Esempio n. 1
0
// set current state of system from global RAM buffer
void scene_read_buf(void) {
  /// pointer to serial blob
  const u8* src = (u8*)&(sceneData->pickle);
  int i;
  // param count reported from dsp
  //  u32 paramsReported;
  //// TEST
  char moduleName[MODULE_NAME_LEN];
  ModuleVersion moduleVersion;
  ////

   app_pause();

  // store current mod name in scene desc
   //  memcpy(modName, sceneData->desc.moduleName, MODULE_NAME_LEN);
   
   // read scene name
  for(i=0; i<SCENE_NAME_LEN; i++) {
    sceneData->desc.sceneName[i] = *src;
    src++;
  }

   // read bees version
  sceneData->desc.beesVersion.min = *src;
  src++;
  sceneData->desc.beesVersion.maj = *src;
  src++;
  src = unpickle_16(src, &(sceneData->desc.beesVersion.rev));

 // read module name
  // target is temp module name buffer, so we can run a comparison 
  for(i=0; i<MODULE_NAME_LEN; i++) {
    moduleName[i] = *src;
    src++;
  }
  print_dbg("\r\n unpickled module name: ");
  print_dbg(moduleName);

   // read module version
  sceneData->desc.moduleVersion.min = *src;
  src++;
  sceneData->desc.moduleVersion.maj = *src;
  src++;
  src = unpickle_16(src, &(sceneData->desc.moduleVersion.rev));

  print_dbg("\r\n unpickled module version: ");
  print_dbg_ulong(sceneData->desc.moduleVersion.maj);
  print_dbg(".");
  print_dbg_ulong(sceneData->desc.moduleVersion.min);
  print_dbg(".");
  print_dbg_ulong(sceneData->desc.moduleVersion.rev);

  print_dbg("\r\n checking against module name from scene data: ");
  print_dbg(sceneData->desc.moduleName);

  if(strcmp(moduleName, sceneData->desc.moduleName) == 0) {
    print_dbg("\r\n requested module name is already loaded; skip DSP reboot.");
    // skip DSP load
    /// FIXME: should check module version too

  } else {
    strcpy(sceneData->desc.moduleName, moduleName);
    render_boot("loading DSP module:");
    render_boot(sceneData->desc.moduleName);

    ///// load the DSP now!  
    render_boot("loading module from sdcard");
    print_dbg("\r\n loading module from card, filename: ");
    print_dbg(sceneData->desc.moduleName);

    files_load_dsp_name(sceneData->desc.moduleName);

    render_boot("waiting for module init");
    print_dbg("\r\n waiting for DSP init...");
    bfin_wait_ready();

#if RELEASEBUILD==1
#else
  
    // query module name / version

    render_boot("querying module");

    print_dbg("\r\n querying module name...");
    bfin_get_module_name(moduleName);
    print_dbg("\r\n querying module version...");
    bfin_get_module_version(&moduleVersion);

    print_dbg("\r\n received module name: ");
    print_dbg((char*)moduleName);

    print_dbg("\r\n received module version: ");
    print_dbg_ulong(moduleVersion.maj);
    print_dbg(".");
    print_dbg_ulong(moduleVersion.min);
    print_dbg(".");
    print_dbg_ulong(moduleVersion.rev);

#ifdef BEEKEEP
#else
    // store in scene data
    render_boot("storing module version");

    sceneData->desc.moduleVersion.maj = moduleVersion.maj;
    sceneData->desc.moduleVersion.min = moduleVersion.min;
    sceneData->desc.moduleVersion.rev = moduleVersion.rev;
    strcpy(sceneData->desc.moduleName, (const char*)moduleName);
#endif

#endif

  } // load-module case
  app_pause();

  /// don't have to do this b/c net_unpickle will deinit anyways
  /*
  print_dbg("\r\n clearing operator list...");
  net_clear_user_ops();
  */

  //// FIXME: use .dsc
  /*
  print_dbg("\r\n reporting DSP parameters...");
  paramsReported = net_report_params();
  */

  /// FIXME:
  /// check the module version and warn if different!
  // there could also be a check here for mismatched parameter list.

  // unpickle network 
  render_boot("reading network");
  print_dbg("\r\n unpickling network for scene recall...");
  src = net_unpickle(src);
    
  // unpickle presets
  render_boot("reading presets");
  print_dbg("\r\n unpickling presets for scene recall...");
  src = presets_unpickle(src);

  render_boot("scene data stored in RAM");
  print_dbg("\r\n copied stored network and presets to RAM ");

  /* for(i=0; i<net->numParams; i++) { */
  /*   print_dbg("\r\n param "); */
  /*   print_dbg_ulong(i); */
  /*   print_dbg(" : "); */
  /*   print_dbg(net->params[i].desc.label); */
  /*   print_dbg(" ; val "); */
  /*   print_dbg_hex((u32)net->params[i].data.value); */
  /* } */

  render_boot("waiting for DSP");
  bfin_wait_ready();
  // update bfin parameters
  //  if(net->numParams != paramsReported) {
  //    print_dbg("\r\n !!!!!! WARNING ! param count from scene does not match reported count from DSP");
  //    render_boot("warning: param count mismatch!");
  //  } else {

#ifdef BEEKEEP
#else
  render_boot("sending param values");
  net_send_params();
#endif

  //  }

  print_dbg("\r\n sent new parameter values");

  delay_ms(5);


  render_boot("enabling audio");  // enable audio processing
  bfin_enable();
  
  app_resume();
}
Esempio n. 2
0
// set current state of system from global RAM buffer
void scene_read_buf(void) {
  s8 modName[MODULE_NAME_LEN];
  const u8* src = (u8*)&(sceneData->pickle);

  /// FIXME: we really should be using this comparison
  
  //  s8 neq = 0;
  //  u32 i;

  app_pause();

  // store current mod name in scene desc
  memcpy(modName, sceneData->desc.moduleName, MODULE_NAME_LEN);

  ///// always load:
    print_dbg("\r\n loading module name: ");
    print_dbg(sceneData->desc.moduleName);
    files_load_dsp_name(sceneData->desc.moduleName);
    //  }

    bfin_wait_ready();

    net_clear_user_ops();

    net_report_params();

  // unpickle network 
  print_dbg("\r\n unpickling network for scene recall...");
  src = net_unpickle(src);

  // unpickle presets
  print_dbg("\r\n unpickling presets for scene recall...");
  src = presets_unpickle(src);
  
  print_dbg("\r\n copied stored network and presets to RAM ");

  /* for(i=0; i<net->numParams; i++) { */
  /*   print_dbg("\r\n param "); */
  /*   print_dbg_ulong(i); */
  /*   print_dbg(" : "); */
  /*   print_dbg(net->params[i].desc.label); */
  /*   print_dbg(" ; val "); */
  /*   print_dbg_hex((u32)net->params[i].data.value); */
  /* } */

  // compare module name  

  //// is strncmp f*****g with us??
  ///  neq = strncmp((const char*)modName, (const char*)sceneData->desc.moduleName, MODULE_NAME_LEN);
  
  //  if(neq) {
    // load bfin module if it doesn't match the current scene desc

  //...
    
    bfin_wait_ready();

  //// well let's try it, actually that would explain some things..
    //  delay_ms(10);

  // update bfin parameters
  net_send_params();
  print_dbg("\r\n sent new params");

  delay_ms(5);

  // enable audio processing
  bfin_enable();
  
  app_resume();
}