Exemple #1
0
// Returns a pointer to AN ARRAY of vectors (one vector for each realline), not a pointer to a vector (as one would think).
const FXText_trss FXTEXTS_get(const struct WBlocks *wblock, const struct WTracks *wtrack, const struct FXs *fxs){
  FXText_trss fxtexts;

  struct FXNodeLines *fxnodeline = fxs->fxnodelines;
  while(fxnodeline!=NULL){
    add_fxtext(wblock, fxtexts, fxs->fx, fxnodeline);
    fxnodeline = NextFXNodeLine(fxnodeline);
  }

  return fxtexts;
}
Exemple #2
0
void UpdateFXNodeLines(
	struct Tracker_Windows *window,
	struct WBlocks *wblock,
	struct WTracks *wtrack
){
	struct FXs *fx=wtrack->track->fxs;

	struct FXNodeLines *prev;
	struct FXNodeLines *fxnode;

	struct FXextrainfo fxextrainfo={0};

        wtrack->wfxnodes=talloc(sizeof(WFXNodes *) * wblock->num_reallines);

	while(fx!=NULL){
		fxextrainfo.FXs=fx;
		prev=fx->fxnodelines;
		fxnode=NextFXNodeLine(prev);
		fxextrainfo.color=fx->fx->color;

		while(fxnode!=NULL){
			fxextrainfo.FXNodeLine=prev;
			MakeNodeLines(
				window,
				wblock,
                                wtrack,
				&prev->l.p,
				&fxnode->l.p,
				(float)prev->val,(float)fxnode->val,
				(float) fx->fx->min,(float) fx->fx->max,
				&fxextrainfo,
				&MakeWFXNodesCallBack
			);
			prev=fxnode;
			fxnode=NextFXNodeLine(fxnode);
		}
		fx=NextFX(fx);
	}

}
static void CopyRange_fxnodelines(
                                  struct FXNodeLines **tofxnodeline,
                                  struct FXNodeLines *fromfxnodeline,
                                  struct FXNodeLines *last,
                                  Place p1,
                                  Place p2
){
	if(fromfxnodeline==NULL) return;

	if(p_Less_Than(fromfxnodeline->l.p, p1)){
          CopyRange_fxnodelines(tofxnodeline,
                                NextFXNodeLine(fromfxnodeline),
                                fromfxnodeline,
                                p1,
                                p2);
          return;
	}

        if (last!=NULL)
          if (p_Less_Than(last->l.p, p1))
            add_scaled_fxnodeline(tofxnodeline, last, fromfxnodeline, p1, p1);

        if(p_Greater_Or_Equal(fromfxnodeline->l.p, p2)) {
          if (last!=NULL)
            add_scaled_fxnodeline(tofxnodeline, last, fromfxnodeline, p2, p1);
          return;
        }

        add_fxnodeline(tofxnodeline, fromfxnodeline, p1);

	CopyRange_fxnodelines(tofxnodeline,
                              NextFXNodeLine(fromfxnodeline),
                              fromfxnodeline,
                              p1,
                              p2);
}
Exemple #4
0
void PE_HandleFirstFX(struct PEventQueue *peq,int doit){
	int x;
	STime ntime,btime;
	struct FXNodeLines *next;

//	Pdebug("fx, start: %d\n",peq->fxnodeline->val);
	if(doit){
          fxhandle(peq->fxnodeline->val,peq,0,FX_start);
	}

	btime=PC_TimeToRelBlockStart(pc->end_time);

	peq->TreatMe=PE_HandleFX;

	if(btime>=peq->time2){
		next=NextFXNodeLine(peq->nextfxnodeline);

		if(next==NULL){
//			Pdebug("fx, slutt: %d\n",peq->nextfxnodeline->val);
			if(doit){
                          fxhandle(peq->nextfxnodeline->val,peq,0,FX_end);
			}
			ReturnPEQelement(peq);
		}else{
			peq->fxnodeline=peq->nextfxnodeline;
			peq->nextfxnodeline=next;
			peq->time1=peq->time2;
			peq->time2=Place2STime(peq->block,&next->l.p);
			PE_HandleFX(peq,doit);
		}
		return;
	}

	ntime=PEQ_CalcNextEvent(
		peq->time1,
		btime,
		peq->time2,
		peq->fxnodeline->val,
		&x,
		peq->nextfxnodeline->val
	);

	if(ntime>peq->time2) ntime=peq->time2;

	PC_InsertElement(peq,0,ntime);

	return;
}
Exemple #5
0
static void InitPEQfxs(
	const struct Blocks *block,
	const struct Tracks *track,
	struct FXs *fxs
){
	struct PEventQueue *peq=GetPEQelement();
	peq->TreatMe=PE_HandleFirstFX;
	peq->block=block;
	peq->track=track;
	peq->fxs=fxs;
	peq->fxnodeline=fxs->fxnodelines;
	peq->nextfxnodeline=NextFXNodeLine(peq->fxnodeline);

	peq->time1=Place2STime(block,&peq->fxnodeline->l.p);
	peq->time2=Place2STime(block,&peq->nextfxnodeline->l.p);

	PC_InsertElement(peq,0,peq->time1);
}
Exemple #6
0
void FX_min_max_have_changed_for_patch(struct Patch *patch, NInt fxnum, float old_min, float old_max, float new_min, float new_max){
  struct Blocks *block = root->song->blocks;

  while(block!=NULL){
    struct Tracks *track = block->tracks;

    while(track!=NULL){

      if (track->patch == patch) {
        struct FXs *fxs=track->fxs;
        while(fxs!=NULL){
          if (fxs->l.num == fxnum) {
            struct FX *fx = fxs->fx;
            int fx_min = fx->min;
            int fx_max = fx->max;

            struct FXNodeLines *fxnode = fxs->fxnodelines;

            Undo_FXs(root->song->tracker_windows, block, track, 0);

            while(fxnode != NULL) {
              double real_val = scale_double(fxnode->val, fx_min,  fx_max,  old_min, old_max);
              fxnode->val     = scale_double(real_val,    new_min, new_max, fx_min,  fx_max);
              fxnode = NextFXNodeLine(fxnode);
            }

            block->is_dirty=true;
          }

          fxs = NextFX(fxs);
        }
      }
      track = NextTrack(track);
    }
    block = NextBlock(block);
  }
}
Exemple #7
0
void MakeWFXNodesCallBack(
	struct Tracker_Windows *window,
	struct WBlocks *wblock,
        struct WTracks *wtrack,
	void *extrainfo,
	int firstlast,
	int realline,
	float u_y1,float u_y2,
	float u_x1,float u_x2
){
	struct FXextrainfo *fxextrainfo=(struct FXextrainfo *)extrainfo;
	struct FXNodeLines *fxnodeline1,*fxnodeline2;

	/* To avoid displaying a long vertical line. */
	if(firstlast==NODELINE_NOTFIRSTORLAST){

		fxnodeline1=(struct FXNodeLines *)fxextrainfo->FXNodeLine;

		fxnodeline2=NextFXNodeLine(fxnodeline1);

		if(fxnodeline1->val==fxnodeline2->val) return;
	}


	WFXNodes *wfxnode2 = talloc(sizeof(WFXNodes));

	wfxnode2->type=TRE_FXLINE;
	wfxnode2->subtype=fxextrainfo->color;
	wfxnode2->y1=u_y1;
	wfxnode2->y2=u_y2;
	wfxnode2->x1=u_x1;
	wfxnode2->x2=u_x2;
	wfxnode2->pointer=fxextrainfo->FXs;

//	wfxnode2->next=wtrack->wfxnodes[realline];
//	wtrack->wfxnodes[realline]=wfxnode2;

	if(firstlast==NODELINE_FIRST || firstlast==NODELINE_FIRSTANDLAST){
		WFXNodes *wfxnode = talloc(sizeof(WFXNodes));

		wfxnode->type=TRE_FXNODE;
		wfxnode->subtype=fxextrainfo->color;

		//		MakeBlackBox(window,u_x1,u_y1,wtrack->fxwidth,wfxnode);
		wfxnode->x1=u_x1;
		wfxnode->y1=u_y1;

		wfxnode->pointer=fxextrainfo->FXNodeLine;

		wfxnode->next=wtrack->wfxnodes[realline];
		wtrack->wfxnodes[realline]=wfxnode;
	}

	if(
		NextFXNodeLine(
			NextFXNodeLine((struct FXNodeLines *)fxextrainfo->FXNodeLine)
		)==NULL
	){

		if(firstlast==NODELINE_LAST || firstlast==NODELINE_FIRSTANDLAST){
			WFXNodes *wfxnode = talloc(sizeof(WFXNodes));

			wfxnode->type=TRE_FXNODE;
			wfxnode->subtype=fxextrainfo->color;

			//			MakeBlackBox(window,u_x2,u_y2,wtrack->fxwidth,wfxnode);
			wfxnode->x1=u_x2;
			wfxnode->y1=u_y2;

			wfxnode->pointer=(((struct ListHeader3 *)(fxextrainfo->FXNodeLine))->next);
	
			wfxnode->next=wtrack->wfxnodes[realline];
			wtrack->wfxnodes[realline]=wfxnode;
		}
	}
	wfxnode2->next=wtrack->wfxnodes[realline];
	wtrack->wfxnodes[realline]=wfxnode2;
}