Example #1
0
BOOL CTVTChan_1::Play(string ip,int nPort,HWND hwnd)
{

    m_hWnd = hwnd;

	m_hUserHandle = NET_SDK_Login((char *)ip.c_str(), nPort, "admin", "123456", &m_SystemParam);

    if(m_hUserHandle == -1)
    {
        return false;
    }
    NET_SDK_CLIENTINFO clientInfo = {0};
    clientInfo.hPlayWnd =0;
    clientInfo.lChannel = 0;
    clientInfo.streamType =NET_SDK_MAIN_STREAM;// NET_SDK_SUB_STREAM;  
	StartPlayer();
    m_lLiveHandle = NET_SDK_LivePlay(m_hUserHandle, &clientInfo, &CTVTChan_1::LiveCallBack, this);
    if(m_lLiveHandle == -1)
    {
        int nRet = NET_SDK_GetLastError();        
        return FALSE;
    } 
    NET_SDK_MakeKeyFrame(m_hUserHandle, m_lLiveHandle);
    return TRUE;
}
Example #2
0
int main(int argc, char **argv)
{
    StreamPlayer *player;
    int i;

    /* Print out usage if no file was specified */
    if(argc < 2)
    {
        fprintf(stderr, "Usage: %s <filenames...>\n", argv[0]);
        return 1;
    }

    if(InitAL() != 0)
        return 1;

    if(alIsExtensionPresent("AL_SOFT_buffer_samples"))
    {
        printf("AL_SOFT_buffer_samples supported!\n");
        alBufferSamplesSOFT = alGetProcAddress("alBufferSamplesSOFT");
        alIsBufferFormatSupportedSOFT = alGetProcAddress("alIsBufferFormatSupportedSOFT");
    }
    else
        printf("AL_SOFT_buffer_samples not supported\n");

    player = NewPlayer();

    /* Play each file listed on the command line */
    for(i = 1;i < argc;i++)
    {
        if(!OpenPlayerFile(player, argv[i]))
            continue;

        printf("Playing %s (%s, %s, %dhz)\n", argv[i],
               TypeName(player->type), ChannelsName(player->channels),
               player->rate);
        fflush(stdout);

        if(!StartPlayer(player))
        {
            ClosePlayerFile(player);
            continue;
        }

        while(UpdatePlayer(player))
            Sleep(10);

        /* All done with this file. Close it and go to the next */
        ClosePlayerFile(player);
    }
    printf("Done.\n");

    /* All files done. Delete the player, and close OpenAL */
    DeletePlayer(player);
    player = NULL;

    CloseAL();

    return 0;
}
Example #3
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;
}
Example #4
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();
}
Example #5
0
 /*--------------------------------------------------------------------------*/
 JNIEXPORT void JNICALL Java_grame_midishare_player_MidiPlayer_Start
  (JNIEnv * inEnv, jclass cl, jint ref){

 	StartPlayer(ref);
 }