示例#1
0
void InitPEQclock(void){
	struct PEventQueue *peq=GetPEQelement();

	peq->l.time=LATENCY;

	peq->TreatMe=PC_NewSecond;

	ListAddElementP(&pc->peq,&peq->l);
}
示例#2
0
void InitPEQ_Signature(struct Blocks *block,Place *place){
  InitPEQ_Signature_new_block(block);
    
  struct PEventQueue *peq = GetPEQelement();
  
  peq->TreatMe=PlayerNextSignature;
  peq->block=block;

  InsertNextSignature_PEQ(peq);
}
示例#3
0
void InitPEQendnote(
	const struct Blocks *block,
	const struct Tracks *track,
	const struct Notes *note,
	int playlistaddpos
){
	NInt tracknum=track->l.num;
	struct PEventQueue *peq=GetPEQelement();
	int orgplaylistaddpos=playlistaddpos;

	peq->TreatMe=PE_StopNote;
	peq->block=block;
	peq->track=track;
	peq->note=note;

	if(
		note->noend==1 &&
		note->end.line==block->num_lines-1 &&
		note->end.counter==MAX_UINT32-1 &&
		note->end.dividor==MAX_UINT32
	){
		if(PC_isPlayingBlock()) playlistaddpos=0;

		for(;;){
			playlistaddpos++;
			const struct Blocks *block=PC_GetPlayBlock(playlistaddpos);
			if(block==NULL){
				ReturnPEQelement(peq);
				return;
			}
			track=ListFindElement1_r0(&block->tracks->l,tracknum);
			if(track!=NULL){
				if(track->notes!=NULL){
					if(track->stops!=NULL){
						PC_InsertElement2(peq,playlistaddpos,PlaceMin(&track->stops->l.p,&track->notes->l.p));
						break;
					}else{
						PC_InsertElement2(peq,playlistaddpos,&track->notes->l.p);
						break;
					}
				}else{
					if(track->stops!=NULL){
						PC_InsertElement2(peq,playlistaddpos,&track->stops->l.p);
						break;
					}
				}
			}
		}
	}else{
		PC_InsertElement2(peq,playlistaddpos,&note->end);
	}

//A small hack here.
	peq->playpos=orgplaylistaddpos;
}
示例#4
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
                                           )
                         );
}
示例#5
0
void InitPEQline(struct Blocks *block,Place *place){
	int addplaypos=0;
	struct PEventQueue *peq=NULL;

        int line = place->line;
        if (place->counter>0)
          line++;

        if(line>=block->num_lines){
          line=0;
          addplaypos=1;
        }

        if(line==0) {
          peq=GetPEQelement();
          peq->TreatMe=PlayerFirstLine;
          peq->block=block;
          peq->line=0;
          PC_InsertElement_a_latencycompencated(
                                                peq,
                                                addplaypos,
                                                block->times[line].time
                                                );
          line = 1;
        }
        
        peq=GetPEQelement();
        peq->TreatMe=PlayerNewLine;
        peq->block=block;
        peq->line=line;
        
        PC_InsertElement_latencycompencated(
                                            peq,
                                            addplaypos,
                                            block->times[line].time
                                            );
        //printf("time: %d, addplaypos: %d, realline: %d, wblocknum: %d\n",(int)peq->l.time,(int)addplaypos,realline,wblock->l.num);
        //fflush(stdout);
}
示例#6
0
文件: PEQfxs.c 项目: renno23/radium
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);
}
示例#7
0
void InitPEQnote(
	const struct Blocks *block,
	const struct Tracks *track,
	const struct Notes *note,
	int playlistaddpos
){
	struct PEventQueue *peq=GetPEQelement();
	peq->TreatMe=PE_StartNote;
	peq->block=block;
	peq->track=track;
	peq->note=note;

	PC_InsertElement2_a(peq,playlistaddpos,&note->l.p);

        InitPEQendnote(block,track,note,playlistaddpos);
        
        InitPEQvelocities(block,track,note,playlistaddpos);

        InitPEQpitches(block,track,note,playlistaddpos);
}
示例#8
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
                                           )
                         );
}
示例#9
0
void PlayerNewLine(struct PEventQueue *peq,int doit){
	int addplaypos=0;
	int line=peq->line;
        //int time = peq->l.time;

#ifdef WITH_PD
        int org_line = peq->line;
        bool inserted_pd_line = false;
        int64_t org_time = peq->l.time;
#endif

	line++;

	if(pc->playtype==PLAYRANGE){
          RError("When did this happen?"); // PLAYRANGE has never been implemented
	}else{
		if(line>=peq->block->num_lines){
		        const struct Blocks *nextblock=PC_GetPlayBlock(1);
			if(nextblock==NULL){
				ReturnPEQelement(peq);
				return;
			}else{

                          struct PEventQueue *peq2=GetPEQelement();
                          peq2->TreatMe=PlayerFirstLine;
                          peq2->block=nextblock;
                          PC_InsertElement_a_latencycompencated(
                                                                peq2,
                                                                1,
                                                                nextblock->times[0].time
                                                                );
#ifdef WITH_PD
                          //printf("org_time: %f. next_time: %f\n",org_time/48000.0,peq2->l.time/48000.0);
                          RT_PD_set_line(org_time, peq2->l.time, org_line);
                          inserted_pd_line=true;
#endif

                          line=1;
                          peq->block=nextblock;
                          addplaypos=1;
			}
		}
	}

	peq->line=line;

        PC_InsertElement_latencycompencated(
                                            peq,
                                            addplaypos,
                                            peq->block->times[line].time
                                            );

#ifdef WITH_PD
        if(inserted_pd_line==false)
          RT_PD_set_line(org_time, peq->l.time, org_line);
#endif

	//printf("NewLine: %d (n: %d), time: %d, nextrealline: %d, nexttime: %d, addplaypos: %d, pc->seqtime: %d\n",org_line, (int)line,(int)time,(int)peq->realline,(int)peq->l.time,(int)addplaypos,(int)pc->seqtime);
        //fflush(stdout);

	return;
}