Ejemplo n.º 1
0
void InitPEQpitches(
	const struct Blocks *block,
	const struct Tracks *track,
	struct Notes *note,
	int playlistaddpos
){

        if(track->patch==NULL)
          return;

	struct Pitches *pitch=note->pitches;

	if(pitch==NULL && note->pitch_end==0.0)
          return;


	struct PEventQueue *peq=GetPEQelement();
	peq->block=block;
	peq->track=track;
	peq->note=note;
        peq->pitch=pitch;
	peq->time1=Place2STime(block,&note->l.p);

        if (pitch==NULL) {

          peq->nextpitch = NULL;
          peq->time2=Place2STime(block,&note->end);
          peq->TreatMe=PE_ChangePitchToEnd;
          
        } else {

          pitch->doit = pitch->chance==0x100 || pitch->chance > rnd(0x100);

          peq->nextpitch = pitch;
          peq->time2=Place2STime(block,&pitch->l.p);
          peq->TreatMe=PE_ChangePitch;
          
        }
        
        int x;
	PC_InsertElement(
                         peq,playlistaddpos,
                         PEQ_CalcNextEvent(
                                           peq->time1,
                                           peq->time1,
                                           peq->time2,
                                           1,
                                           &x,
                                           20000000,
                                           note->pitch_first_logtype
                                           )
                         );
}
Ejemplo n.º 2
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;
}
Ejemplo n.º 3
0
// If patch max pitch is much lower than radium max pitch (MAX_PITCH), we avoid sending out two or more messages in a row with the same pitch value.
static STime PEQ_CalcNextPitchEvent(
                                struct PEventQueue *peq,
                                STime time1,
                                STime time,
                                STime time2,
                                float x1,
                                float *x,
                                float x2
                                )
{
  int int_x;
  STime ntime=PEQ_CalcNextEvent(
                                time1,time,time2,
                                scale(x1, 0,128,0,INT_MAX/2),
                                &int_x,
                                scale(x2, 0,128,0,INT_MAX/2)
                                );
  *x = scale(int_x, 0,INT_MAX/2, 0.0,128.0); // convert back.
  return ntime;
}
Ejemplo n.º 4
0
void InitPEQpitches(
	const struct Blocks *block,
	const struct Tracks *track,
	const struct Notes *note,
	int playlistaddpos
){
	struct PEventQueue *peq;

	struct Pitches *pitch=note->pitches;

        if(track->patch==NULL)
          return;

	if(pitch==NULL)
          return;


	peq=GetPEQelement();
	peq->block=block;
	peq->track=track;
	peq->note=note;
        peq->pitch=pitch;
	peq->time1=Place2STime(block,&note->l.p);

        peq->nextpitch = pitch;
        peq->time2=Place2STime(block,&pitch->l.p);
        peq->TreatMe=PE_ChangePitch;

        int x;
	PC_InsertElement(
                         peq,playlistaddpos,
                         PEQ_CalcNextEvent(
                                           peq->time1,
                                           peq->time1,
                                           peq->time2,
                                           1,
                                           &x,
                                           20000000
                                           )
                         );
}