Esempio n. 1
0
void CopyRange_fxs(
                   vector_t *tofxs,
                   vector_t *das_fromfxs,
                   Place *p1,
                   Place *p2
                   )
{
  VECTOR_FOR_EACH(struct FXs *fromfxs, das_fromfxs){

        R_ASSERT_RETURN_IF_FALSE(fromfxs->fx->patch->is_usable);
        
#if 0
        // This thing should perhaps be moved into co_CB_PasteTrack.
        if (!fromfxs->fx->patch->is_usable) {
          fromfxs->fx->patch = PATCH_create_audio(NULL, NULL, fromfxs->fx->patch->name, fromfxs->fx->patch->state);
          R_ASSERT_RETURN_IF_FALSE(fromfxs->fx->patch->patchdata != NULL);
        }
#endif
        
	struct FXs *fxs=talloc(sizeof(struct FXs));

	fxs->fx=tcopy(fromfxs->fx, sizeof(struct FX)); // Why not just reference the existing fx? (fx is modified)

	VECTOR_push_back(tofxs,fxs);

	CopyRange_fxnodelines(&fxs->fxnodelines,fromfxs->fxnodelines,NULL,*p1,*p2);

  }END_VECTOR_FOR_EACH;
Esempio n. 2
0
static void make_patches_usable(struct Tracks *track){
  struct Patch *old_patch = track->patch;
  
  if (old_patch != NULL) {
    
    struct Patch *new_patch = old_patch;
    
    if (!old_patch->is_usable) {
      R_ASSERT(old_patch->instrument == get_audio_instrument()); // Only audio instruments may not be usable.

      printf("PERMANENT_ID for %s: %d\n",old_patch->name,old_patch->permanent_id);
      
      if (old_patch->permanent_id != 0)
        new_patch = AUDIO_get_the_replacement_for_old_permanent_patch(old_patch);
      else {
        new_patch = PATCH_create_audio(NULL, NULL, old_patch->name, old_patch->state, 0, 0);
        connectAudioInstrumentToMainPipe(new_patch->id);
      }
      
      track->patch = new_patch;
    }
    
    R_ASSERT(track->patch->patchdata != NULL);

    VECTOR_FOR_EACH(struct FXs *fxs, &track->fxs){
      struct FX *fx = fxs->fx;
      
      if (fx->patch == old_patch)
        fx->patch = new_patch;
      else if (!fx->patch->is_usable){
        R_ASSERT(old_patch->instrument == get_audio_instrument()); // Only audio instruments may not be usable.
        
        if (fx->patch->permanent_id != 0)
          fx->patch = AUDIO_get_the_replacement_for_old_permanent_patch(fx->patch);
        else
          fx->patch = PATCH_create_audio(NULL, NULL, fx->patch->name, fx->patch->state, 0, 0);
      }
    }END_VECTOR_FOR_EACH;
    
  }
}