Exemple #1
0
static void PE_ChangePitchToEnd(struct PEventQueue *peq,int doit){
	STime btime=PC_TimeToRelBlockStart(pc->end_time);

	if(btime>=peq->time2){
		ReturnPEQelement(peq);
		return;
	}

        const struct Notes *note = peq->note;

        float prev_pitch = peq->pitch!=NULL ? peq->pitch->note : note->note;
        int logtype      = peq->pitch!=NULL ? peq->pitch->logtype : note->pitch_first_logtype;
        
        float next_pitch = note->pitch_end;
        if(next_pitch<=1) // not supposed to happen though.
          next_pitch = 1;

        float x;

	STime ntime=PEQ_CalcNextPitchEvent(
                                           peq,
                                           peq->time1,
                                           btime,
                                           peq->time2,
                                           prev_pitch,
                                           &x,
                                           next_pitch,
                                           logtype
                                           );

	if(ntime>peq->time2){
		ReturnPEQelement(peq);
		return;
	}

//	Pdebug("Player vel->end, Pitch: %d, ntime: %d, btime: %d, time1: %d, time2: %d\n",x,ntime,btime,peq->time1,peq->time2);
	if(doit){
		SendPitchChange(x,peq);
	}

	PC_InsertElement(peq,0,ntime);

	return;

}
Exemple #2
0
static void PE_ChangePitchToEnd(struct PEventQueue *peq,int doit){
	float x;

	STime btime=PC_TimeToRelBlockStart(pc->end_time);

	if(btime>=peq->time2){
		ReturnPEQelement(peq);
		return;
	}

        float next_pitch = FindNextPitch(peq);
        if(next_pitch<=0.0f){
          ReturnPEQelement(peq);
          return;
	}

	STime ntime=PEQ_CalcNextPitchEvent(
                                     peq,
                                     peq->time1,
                                     btime,
                                     peq->time2,
                                     peq->pitch->note,
                                     &x,
                                     next_pitch
	);

	if(ntime>peq->time2){
		ReturnPEQelement(peq);
		return;
	}

//	Pdebug("Player vel->end, Pitch: %d, ntime: %d, btime: %d, time1: %d, time2: %d\n",x,ntime,btime,peq->time1,peq->time2);
	if(doit){
		SendPitchChange(x,peq);
	}

	PC_InsertElement(peq,0,ntime);

	return;

}
Exemple #3
0
static void PE_ChangePitch(struct PEventQueue *peq,int doit){
	float x;
	STime ntime,btime;
	struct Pitches *next;

	btime=PC_TimeToRelBlockStart(pc->end_time);

	if(btime>=peq->time2){
		next=NextPitch(peq->nextpitch);
		peq->time1=peq->time2;
		peq->pitch=peq->nextpitch;

		if(next==NULL){
			peq->time2=Place2STime(peq->block,&peq->note->end);
			peq->TreatMe=PE_ChangePitchToEnd;
			PE_ChangePitchToEnd(peq,doit);
		}else{
			peq->nextpitch=next;
			peq->time2=Place2STime(peq->block,&next->l.p);
			PE_ChangePitch(peq,doit);
		}
		return;
	}

        float pitch1,pitch2;
        if(peq->pitch==peq->nextpitch){
          pitch1=peq->note->note;
          pitch2=peq->pitch->note;
        }else{
          pitch1=peq->pitch->note;
          pitch2=peq->nextpitch->note;
        }

	ntime=PEQ_CalcNextPitchEvent(
                peq,
		peq->time1,
		btime,
		peq->time2,
                pitch1,
		&x,
                pitch2
	);

	if(btime==ntime){
		Pdebug("Samme, stopper, x: %d\n",x);
		return;
	}

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

//	Pdebug("Player vel->vel, Pitch: %d, ntime: %d, btime: %d, time1: %d, time2: %d\n",x,ntime,btime,peq->time1,peq->time2);
	if(doit){
		SendPitchChange(x,peq);
	}

	PC_InsertElement(peq,0,ntime);

	return;

}