Esempio n. 1
0
static void PlayBlock(
	struct Blocks *block,
	Place *place,
        bool do_loop
){

        // GC isn't used in the player thread, but the player thread sometimes holds pointers to gc-allocated memory.
        //while(GC_is_disabled()==false){
          //printf("Calling gc_disable: %d\n",GC_dont_gc);
        while(GC_dont_gc<=0){
          GC_disable();
        }

	pc->initplaying=true;

		pc->playpos=0;
                pc->play_id++;
                
                if(do_loop==true)
                  pc->playtype=PLAYBLOCK;
                else
                  pc->playtype=PLAYBLOCK_NONLOOP;

		pc->block=block;

		root->curr_block=pc->block->l.num;
		printf("Play block. root->curr_block: %d. Block: %p\n",root->curr_block,pc->block);
                //abort();
                fflush(stdout);

#if !USE_OPENGL
		pc->isplaying=true;
		(*Ptask2MtaskCallBack)();
#endif
		pc->isplaying=false;

                PATCH_reset_time();
		InitPEQclock();
                InitPEQ_LPB(pc->block,place);
                InitPEQ_Signature(pc->block,place);
                InitPEQ_Beat(pc->block,place);
		InitPEQrealline(block,place);
		InitPEQline(block,place);
		InitPEQblock(block,place);
		InitAllPEQnotes(block,place);

		StartPlayer();							// An OS spesific function.
		pc->isplaying=true;


	pc->initplaying=false;
}
Esempio n. 2
0
static void PlaySong(
	Place *place,
	int playpos
){
	debug("haaasfdfsafsa, root->song->length: %d\n\n\n",root->song->length);
	pc->initplaying=true;

		struct Blocks *block=BL_GetBlockFromPos(playpos);

		printf("Play song. blocknum:%d. Block: %p\n",block->l.num, block);

		pc->playpos=playpos;
                pc->play_id++;
                
		root->curr_playlist=playpos;

		pc->playtype=PLAYSONG;

		pc->block=block;

		root->curr_block=block->l.num;
#if !USE_OPENGL
		pc->isplaying=true;
		(*Ptask2MtaskCallBack)();
#endif
		pc->isplaying=false;

                PATCH_reset_time();
		InitPEQclock();
                InitPEQ_LPB(pc->block,place);
                InitPEQ_Signature(pc->block,place);
                InitPEQ_Beat(pc->block,place);
		InitPEQrealline(block,place);
		InitPEQline(block,place);
		InitPEQblock(block,place);
		InitAllPEQnotes(block,place);

		StartPlayer();							// An OS spesific function.
		pc->isplaying=true;


	pc->initplaying=false;

        // GC isn't used in the player thread, but the player thread sometimes holds pointers to gc-allocated memory.
        while(GC_is_disabled()==false)
          GC_disable();
}
Esempio n. 3
0
static void PlayStopReally(bool doit){ 
	pc->isplaying=false;
	pc->initplaying=false;
        pc->playertask_has_been_called = false;
        pc->is_playing_range = false;
        
        printf("PlayStopReally called: %s\n",doit==true?"true":"false");

        if (PLAYER_current_thread_has_lock()){
          RError("Potential deadlock detected: Calling PlayStopReally while holding player lock.");
          return;
        }

        if (PLAYER_is_running())
          while(pc->peq!=NULL) OS_WaitForAShortTime(20);

	StopAllInstruments();

#if !USE_OPENGL
	if(doit) (*Ptask2MtaskCallBack)();
#endif

	pc->end_time=0;
        pc->end_time_f=0;

        pc->play_id++;

        struct Tracker_Windows *window = root->song->tracker_windows;
        struct WBlocks *wblock = window->wblock;

        ScrollEditorToRealLine(window,wblock,wblock->curr_realline);

#if !USE_OPENGL
        DrawWBlockSpesific(window,wblock,wblock->curr_realline,wblock->curr_realline); // clear cursor shade.
        UpdateAllWTracks(window,wblock,wblock->curr_realline,wblock->curr_realline); // same here.
#endif
        printf("[hb gakkgakk: %d\n",GC_dont_gc);
        PATCH_reset_time();

        //while(GC_is_disabled())
        while(GC_dont_gc>0)
          GC_enable();

        MIDI_insert_recorded_midi_events();
}