コード例 #1
0
ファイル: PEQ_Signature.c プロジェクト: jakobvonrotz/radium
static void InsertNextSignature_PEQ(struct PEventQueue *peq){
  if (g_signature==NULL) {

    peq->TreatMe=PlayerNextSignature_Block;
    peq->block = PC_GetPlayBlock(1);
    
    if (peq->block == NULL)
      ReturnPEQelement(peq);
    
    else {
      
      PC_InsertElement_a( // need to use the "_a" version so that the block has a chance to update first. (there should be an "_aa" version for the block. Now fx/etc. can be called before signature block change)
                         peq,
                         1,
                         0
                          );
    }
    
  } else {

    peq->TreatMe=PlayerNextSignature;
    
    PC_InsertElement2(
                     peq,
                     0,
                     &g_signature->l.p
                     );

  }
}
コード例 #2
0
ファイル: PEQnotes.c プロジェクト: dieface/radium-1
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;
}
コード例 #3
0
ファイル: PEQnotes.c プロジェクト: dieface/radium-1
void InitAllPEQnotes(
	const struct Blocks *block,
	const Place *p
){
	Place *firstplace=PlaceGetFirstPos();
	int playlistaddpos=0;
        
	PEQ_UsedTracks *UsedTracks=NULL; // Used to keep track of which tracks have been initialized.


	InitPEQnotesBlock(&UsedTracks,block,p,0);


        for(;;){
          playlistaddpos++;
          const struct Blocks *playlistblock=PC_GetPlayBlock(playlistaddpos);
          if(playlistblock==NULL)
            break;
          InitPEQnotesBlock(&UsedTracks,playlistblock,firstplace,playlistaddpos);
          
          if( ! PC_isPlayingSong() )
            break; // If not, we would loop forever here when starting to play a block.
        }
}
コード例 #4
0
ファイル: PEQline.c プロジェクト: dieface/radium-1
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;
}