Ejemplo n.º 1
0
pascal void PrebufTimerProc(EventLoopTimerRef inTimer, void *inUserData)
{ // monitor prebuffering progress
	DWORD progress=BASS_StreamGetFilePosition(chan,BASS_FILEPOS_BUFFER)
		*100/BASS_StreamGetFilePosition(chan,BASS_FILEPOS_END); // percentage of buffer filled
	if (progress>75 || !BASS_StreamGetFilePosition(chan,BASS_FILEPOS_CONNECTED)) { // over 75% full (or end of download)
		RemoveEventLoopTimer(prebuftimer); // finished prebuffering, stop monitoring
		{ // get the broadcast name and URL
			const char *icy=BASS_ChannelGetTags(chan,BASS_TAG_ICY);
			if (!icy) icy=BASS_ChannelGetTags(chan,BASS_TAG_HTTP); // no ICY tags, try HTTP
			if (icy) {
				for (;*icy;icy+=strlen(icy)+1) {
					if (!strncasecmp(icy,"icy-name:",9))
						SetStaticText(31,icy+9);
					if (!strncasecmp(icy,"icy-url:",8))
						SetStaticText(32,icy+8);
				}
			} else
				SetStaticText(31,"");
		}
		// get the stream title and set sync for subsequent titles
		DoMeta();
		BASS_ChannelSetSync(chan,BASS_SYNC_META,0,&MetaSync,0); // Shoutcast
		BASS_ChannelSetSync(chan,BASS_SYNC_OGG_CHANGE,0,&MetaSync,0); // Icecast/OGG
		// set sync for end of stream
		BASS_ChannelSetSync(chan,BASS_SYNC_END,0,&EndSync,0);
		// play it!
		BASS_ChannelPlay(chan,FALSE);
	} else {
		char text[20];
		sprintf(text,"buffering... %d%%",progress);
		SetStaticText(31,text);
	}
}
Ejemplo n.º 2
0
void BassPlayer::playPreproccessing() {
    emit statusChanged(media_title, LoadedMedia);

    BASS_CHANNELINFO info;
    if (BASS_ChannelGetInfo(chan, &info))
        channelsCount(info.chans);
    else
        channelsCount(2);

    if (eq_in_use) registerEQ();

    #ifdef BASS_USE_TEMPO
        applyTempoToChannel();
        newTempoProcessing(tempo());
    #endif

    setSampleRateQuality();
    newVolumeProcessing(volume());
    newPanProcessing(pan());

    if (BASS_ChannelPlay(chan, true)) { // stalled with big sized video files
        playPostprocessing(is_paused);

        syncHandle = BASS_ChannelSetSync((HSYNC)chan, BASS_SYNC_END, 0, &endTrackSync, this);
        syncDownloadHandle = BASS_ChannelSetSync(chan, BASS_SYNC_DOWNLOAD, 0, &endTrackDownloading, this);

//        BASS_SYNC_STALL
//        mixtime only	Sync when playback of the channel is stalled/resumed.
//        param : not used. data : 0 = stalled, 1 = resumed.
    } else {
        proceedErrorState();
        qCritical() << "IS NOT PLAYED";
    }
}
Ejemplo n.º 3
0
gboolean PrebufTimerProc(gpointer data)
{ // monitor prebuffering progress
	DWORD progress=BASS_StreamGetFilePosition(chan,BASS_FILEPOS_BUFFER)
		*100/BASS_StreamGetFilePosition(chan,BASS_FILEPOS_END); // percentage of buffer filled
	if (progress>75 || !BASS_StreamGetFilePosition(chan,BASS_FILEPOS_CONNECTED)) { // over 75% full (or end of download)
		{ // get the broadcast name and URL
			const char *icy=BASS_ChannelGetTags(chan,BASS_TAG_ICY);
			if (!icy) icy=BASS_ChannelGetTags(chan,BASS_TAG_HTTP); // no ICY tags, try HTTP
			if (icy) {
				for (;*icy;icy+=strlen(icy)+1) {
					if (!strncasecmp(icy,"icy-name:",9))
						gtk_label_set_text_8859(GTK_LABEL(GetWidget("status2")),icy+9);
					if (!strncasecmp(icy,"icy-url:",8))
						gtk_label_set_text_8859(GTK_LABEL(GetWidget("status3")),icy+8);
				}
			} else
				gtk_label_set_text(GTK_LABEL(GetWidget("status2")),"");
		}
		// get the stream title and set sync for subsequent titles
		DoMeta();
		BASS_ChannelSetSync(chan,BASS_SYNC_META,0,&MetaSync,0); // Shoutcast
		BASS_ChannelSetSync(chan,BASS_SYNC_OGG_CHANGE,0,&MetaSync,0); // Icecast/OGG
		// set sync for end of stream
		BASS_ChannelSetSync(chan,BASS_SYNC_END,0,&EndSync,0);
		// play it!
		BASS_ChannelPlay(chan,FALSE);
		return FALSE; // stop monitoring
	} else {
		char text[20];
		sprintf(text,"buffering... %d%%",progress);
		gtk_label_set_text(GTK_LABEL(GetWidget("status2")),text);
		return TRUE; // continue monitoring
	}
}
Ejemplo n.º 4
0
void CClientSound::ThreadCallback ( HSTREAM pSound )
{
    if ( pSound )
    {
        m_pSound = pSound;
        if ( m_b3D )
        {
            BASS_3DVECTOR pos ( m_vecPosition.fX, m_vecPosition.fY, m_vecPosition.fZ );
            BASS_ChannelSet3DPosition ( pSound, &pos, NULL, NULL );
            BASS_ChannelSet3DAttributes ( pSound, BASS_3DMODE_NORMAL, 1.0f, 0.5f, 360, 360, 1.0f );
        }
        // Set a Callback function for download finished
        BASS_ChannelSetSync ( pSound, BASS_SYNC_DOWNLOAD, 0, &DownloadSync, this );
        BASS_ChannelGetAttribute ( pSound, BASS_ATTRIB_FREQ, &m_fDefaultFrequency );
        BASS_ChannelPlay ( pSound, false );
    }
    else
        g_pCore->GetConsole()->Printf ( "BASS ERROR %d in PlayStream  b3D = %s  path = %s", BASS_ErrorGetCode(), m_b3D ? "true" : "false", m_strPath.c_str() );
    
    // Call onClientSoundStream LUA event
    CLuaArguments Arguments;
    Arguments.PushBoolean ( pSound ? true : false );
    Arguments.PushNumber ( GetLength () );
    this->CallEvent ( "onClientSoundStream", Arguments, true );
}
Ejemplo n.º 5
0
void KNMusicBackendBassThread::establishSyncHandle()
{
    HSYNC handle=BASS_ChannelSetSync(m_channel,
                                     BASS_SYNC_END,
                                     0,
                                     onActionEnd,
                                     this);
    m_syncHandles.append(handle);
}
Ejemplo n.º 6
0
// returns true when buffering is done
bool net_radio_updateBuffering() {
    QWORD progress=BASS_StreamGetFilePosition(chan,BASS_FILEPOS_BUFFER)
                   *100/BASS_StreamGetFilePosition(chan,BASS_FILEPOS_END); // percentage of buffer filled
    if (progress>75 || !BASS_StreamGetFilePosition(chan,BASS_FILEPOS_CONNECTED)) { // over 75% full (or end of download)
        KillTimer(win,0); // finished prebuffering, stop monitoring
        {   // get the broadcast name and URL
            const char *icy=BASS_ChannelGetTags(chan,BASS_TAG_ICY);
            if (!icy) icy=BASS_ChannelGetTags(chan,BASS_TAG_HTTP); // no ICY tags, try HTTP
            if (icy) {
                for (; *icy; icy+=strlen(icy)+1) {
                    if (!_strnicmp(icy,"icy-name:",9)) {
                        //MESS(31,WM_SETTEXT,0,icy+9);
                        // TODO pass this text to user
                    }
                    if (!_strnicmp(icy,"icy-url:",8)) {
                        //MESS(32,WM_SETTEXT,0,icy+8);
                        // TODO pass this text to user
                    }
                }
            } else {
                //MESS(31,WM_SETTEXT,0,"");
                // TODO pass this text to user
            }
        }
        // get the stream title and set sync for subsequent titles
        doMeta();
        BASS_ChannelSetSync(chan,BASS_SYNC_META,0,&metaSync,0); // Shoutcast
        BASS_ChannelSetSync(chan,BASS_SYNC_OGG_CHANGE,0,&metaSync,0); // Icecast/OGG
        // set sync for end of stream
        BASS_ChannelSetSync(chan,BASS_SYNC_END,0,&endSync,0);
        // play it!
        BASS_ChannelPlay(chan,FALSE);
        // done buffering, so return true
        return true;
    } else {
        char text[20];
        sprintf_s(text,"buffering... %d%%",progress);
        // TODO tell the user 'text' how much has buffered

        // not finished buffering, so return false
        return false;
    }
}
Ejemplo n.º 7
0
// select a file to play, and start scanning it
BOOL PlayFile()
{
	char file[MAX_PATH]="";
	OPENFILENAME ofn={0};
	ofn.lStructSize=sizeof(ofn);
	ofn.hwndOwner=win;
	ofn.nMaxFile=MAX_PATH;
	ofn.lpstrFile=file;
	ofn.Flags=OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_EXPLORER;
	ofn.lpstrTitle="Select a file to play";
	ofn.lpstrFilter="Playable files\0*.mp3;*.mp2;*.mp1;*.ogg;*.wav;*.aif;*.mo3;*.it;*.xm;*.s3m;*.mtm;*.mod;*.umx\0All files\0*.*\0\0";
	if (!GetOpenFileName(&ofn)) return FALSE;

	if (!(chan=BASS_StreamCreateFile(FALSE,file,0,0,0))
		&& !(chan=BASS_MusicLoad(FALSE,file,0,0,BASS_MUSIC_RAMPS|BASS_MUSIC_POSRESET|BASS_MUSIC_PRESCAN,1))) {
		Error("Can't play file");
		return FALSE; // Can't load the file
	}
	{
		BYTE data[2000]={0};
		BITMAPINFOHEADER *bh=(BITMAPINFOHEADER*)data;
		RGBQUAD *pal=(RGBQUAD*)(data+sizeof(*bh));
		int a;
		bh->biSize=sizeof(*bh);
		bh->biWidth=WIDTH;
		bh->biHeight=-HEIGHT;
		bh->biPlanes=1;
		bh->biBitCount=8;
		bh->biClrUsed=bh->biClrImportant=HEIGHT/2+1;
		// setup palette
		for (a=1;a<=HEIGHT/2;a++) {
			pal[a].rgbRed=(255*a)/(HEIGHT/2);
			pal[a].rgbGreen=255-pal[a].rgbRed;
		}
		// create the bitmap
		wavebmp=CreateDIBSection(0,(BITMAPINFO*)bh,DIB_RGB_COLORS,(void**)&wavebuf,NULL,0);
		wavedc=CreateCompatibleDC(0);
		SelectObject(wavedc,wavebmp);
	}
	bpp=BASS_ChannelGetLength(chan,BASS_POS_BYTE)/WIDTH; // bytes per pixel
	{
		DWORD bpp1=BASS_ChannelSeconds2Bytes(chan,0.001); // minimum 1ms per pixel
		if (bpp<bpp1) bpp=bpp1;
	}
	BASS_ChannelSetSync(chan,BASS_SYNC_END|BASS_SYNC_MIXTIME,0,LoopSyncProc,0); // set sync to loop at end
	BASS_ChannelPlay(chan,FALSE); // start playing
	{ // create another channel to scan
		DWORD chan2=BASS_StreamCreateFile(FALSE,file,0,0,BASS_STREAM_DECODE);
		if (!chan2) chan2=BASS_MusicLoad(FALSE,file,0,0,BASS_MUSIC_DECODE,1);
		scanthread=_beginthread(ScanPeaks,0,(void*)chan2); // start scanning in a new thread
	}
	return TRUE;
}
Ejemplo n.º 8
0
BOOL CBassMusicEngine::Play(HSTREAM hStream,bool bRestart/* = false*/)
{
	Stop(m_hStream);

	m_hStream = hStream;

	//开始播放
	BOOL bResult = BASS_ChannelPlay(hStream, bRestart);

	//if ( m_pMusicState != NULL ) m_pMusicState->OnPlaying();

	BASS_ChannelSetSync(hStream, BASS_SYNC_END, (QWORD)MAKELONG(10,0), &CBassMusicEngine::MySyncProc, 0);

	return bResult;
}
HRESULT CBSoundBuffer::SetLoopStart(DWORD Pos)
{
	m_LoopStart = Pos;

	if (m_Stream)
	{
		if (m_Sync)
		{
			BASS_ChannelRemoveSync(m_Stream, m_Sync);
			m_Sync = NULL;
		}
		if (m_LoopStart > 0)
		{
			QWORD len = BASS_ChannelGetLength(m_Stream, BASS_POS_BYTE);
			m_Sync = BASS_ChannelSetSync(m_Stream, BASS_SYNC_POS | BASS_SYNC_MIXTIME, len, CBSoundBuffer::LoopSyncProc, (void*)this);
		}
	}

	return S_OK;
}
Ejemplo n.º 10
0
void CBassAudio::SetFinishedCallbacks ( void )
{
    m_hSyncEnd = BASS_ChannelSetSync ( m_pSound, BASS_SYNC_END, 0, &EndSync, m_uiCallbackId );
    m_hSyncFree = BASS_ChannelSetSync ( m_pSound, BASS_SYNC_FREE, 0, &FreeSync, m_uiCallbackId );
}
Ejemplo n.º 11
0
//
// Called from the main thread during DoPulse
//
void CBassAudio::CompleteStreamConnect ( HSTREAM pSound )
{
    if ( pSound )
    {
        m_pSound = pSound;

        BASS_ChannelGetAttribute ( pSound, BASS_ATTRIB_FREQ, &m_fDefaultFrequency );
        BASS_ChannelSetAttribute ( pSound, BASS_ATTRIB_FREQ, m_fPlaybackSpeed * m_fDefaultFrequency );
        if ( !m_b3D )
            BASS_ChannelSetAttribute( pSound, BASS_ATTRIB_VOL, m_fVolume );
        ApplyFxEffects ();
        // Set a Callback function for download finished or connection closed prematurely
        m_hSyncDownload = BASS_ChannelSetSync ( pSound, BASS_SYNC_DOWNLOAD, 0, &DownloadSync, m_uiCallbackId );
        SetFinishedCallbacks ();

        if ( BASS_FX_BPM_CallbackSet ( pSound, (BPMPROC*)&BPMCallback, 1, 0, 0, m_uiCallbackId ) == false )
        {
            g_pCore->GetConsole()->Print ( "BASS ERROR in BASS_FX_BPM_CallbackSet" );
        }
        if ( BASS_FX_BPM_BeatCallbackSet ( pSound, (BPMBEATPROC*)&BeatCallback, m_uiCallbackId ) == false )
        {
            g_pCore->GetConsole()->Print ( "BASS ERROR in BASS_FX_BPM_BeatCallbackSet" );
        }
        // get the broadcast name
        const char* szIcy;
        szIcy = BASS_ChannelGetTags ( pSound, BASS_TAG_ICY );
        if ( 
            ( szIcy = BASS_ChannelGetTags ( pSound, BASS_TAG_ICY ) )
         || ( szIcy = BASS_ChannelGetTags ( pSound, BASS_TAG_WMA ) )
         || ( szIcy = BASS_ChannelGetTags ( pSound, BASS_TAG_HTTP ) )
            )
        {
            if ( szIcy ) 
            {
                for ( ; *szIcy; szIcy += strlen ( szIcy ) + 1 )
                {
                    if ( !strnicmp ( szIcy, "icy-name:", 9 ) ) // ICY / HTTP
                    {
                        m_strStreamName = szIcy + 9;
                        break;
                    }
                    else if ( !strnicmp ( szIcy, "title=", 6 ) ) // WMA
                    {
                        m_strStreamName = szIcy + 6;
                        break;
                    }
                    //g_pCore->GetConsole()->Printf ( "BASS STREAM INFO  %s", szIcy );
                }
            }
        }
        // set sync for stream titles
        m_hSyncMeta = BASS_ChannelSetSync( pSound, BASS_SYNC_META, 0, &MetaSync, m_uiCallbackId ); // Shoutcast
        //g_pCore->GetConsole()->Printf ( "BASS ERROR %d in BASS_SYNC_META", BASS_ErrorGetCode() );
        //BASS_ChannelSetSync(pSound,BASS_SYNC_OGG_CHANGE,0,&MetaSync,this); // Icecast/OGG
        //g_pCore->GetConsole()->Printf ( "BASS ERROR %d in BASS_SYNC_OGG_CHANGE", BASS_ErrorGetCode() );
        //BASS_ChannelSetSync(pSound,BASS_SYNC_WMA_META,0,&MetaSync,this); // script/mid-stream tags
        //g_pCore->GetConsole()->Printf ( "BASS ERROR %d in BASS_SYNC_WMA_META", BASS_ErrorGetCode() );
        //BASS_ChannelSetSync(pSound,BASS_SYNC_WMA_CHANGE,0,&WMAChangeSync,this); // server-side playlist changes
        //g_pCore->GetConsole()->Printf ( "BASS ERROR %d in BASS_SYNC_WMA_CHANGE", BASS_ErrorGetCode() );
    }
    else
        g_pCore->GetConsole()->Printf ( "BASS ERROR %d in PlayStream  b3D = %s  path = %s", BASS_ErrorGetCode(), m_b3D ? "true" : "false", m_strPath.c_str() );

    OutputDebugLine ( "[Bass]        stream connect complete" );

    AddQueuedEvent ( SOUND_EVENT_STREAM_RESULT, m_strStreamName, GetLength (), pSound ? true : false );
}
Ejemplo n.º 12
0
void CFusicCartsDlg::OnBnClickedBtnLogout()
{
	//ensure we want to logout:
	int res = MessageBox("Are you sure you want to log out?\nNOTE: All user carts will be "
		"halted when you logout.",
		"Fusic", MB_YESNO | MB_ICONQUESTION);

	if(res == IDNO)
	{
		//don't logout:
		return;
	}


	//stop all user carts:
	//(stop all nav buttons):
	for(std::vector<SNavigationStreams>::iterator i = m_vecNavStreamsBottom.begin();
		i != m_vecNavStreamsBottom.end(); i++)
	{
		//fade out the cart (500 ms):
		BASS_ChannelSlideAttribute(i->stream, BASS_ATTRIB_VOL, 0, 500);
		//also remove from the map:
		for(T_mapCallback::iterator j = g_mapCartCallbacks.end(); j != g_mapCartCallbacks.end();
			j++)
		{
			if(j->first == i->syncHandle)
			{
				g_mapCartCallbacks.erase(j);
				break;
			}
		}

		//remove old end sync:
		BASS_ChannelRemoveSync(i->stream, i->syncHandle);

		//create a new sync at the end of the slide:
		//NOTE: We should be safe to call this callback function, it is a part of a class
		//that will be destroyed when the window is, however, it is a static function and 
		//therefore
		//does not need a class to be created in order to use the function:
		BASS_ChannelSetSync(i->stream, BASS_SYNC_SLIDE, 0, &CCallbackButton::fnSlideCallback,
			NULL);
	}

	//(stop page buttons):
	for(mapCart::iterator i = m_mapBtnCartBottom.begin(); i != m_mapBtnCartBottom.end();
		i++)
	{
		i->second->fnStop(true);
	}

	//add all the currently playing fuse carts:
	//(current wall):
	for(mapCart::iterator i = m_mapBtnCartTop.begin(); i != m_mapBtnCartTop.end(); i++)
	{
		if(i->second->fnGetCurrentStream() != 0)
		{
			CString strTitle;
			SCartsList lst;
			HSYNC callbackSync;

			//remove the callback from the global map:
			for(T_mapCallback::iterator j = g_mapCartCallbacks.begin(); j != g_mapCartCallbacks.end();
				j++)
			{
				if(j->first == i->second->fnGetCurrentSync())
				{
					g_mapCartCallbacks.erase(j);
					break;
				}
			}

			//reset the callback:
			BASS_ChannelRemoveSync(i->second->fnGetCurrentStream(), 
				i->second->fnGetCurrentSync());
			callbackSync = BASS_ChannelSetSync(i->second->fnGetCurrentStream(), 
				BASS_SYNC_END, 0, CFusicLoginDlg::fnLoginDialogCartCallback, m_pLoginDlg);
			//create a new cart list element:

			i->second->GetWindowTextA(strTitle);
			lst.hstCartsStream = i->second->fnGetCurrentStream();
			lst.hsyCartsSync = 0;
			lst.strTitle = strTitle;
			lst.hsyCartsSync = callbackSync;
			lst.intPageNumber = m_intCurrnetDialogPageTop;
			lst.strCartPosistion = i->first;
			m_pLoginDlg->fnAddCartToList(lst);
		}//if
	}//for

	//(nav walls):
	for(std::vector<SNavigationStreams>::iterator ii = m_vecNavStreamsTop.begin();
		ii != m_vecNavStreamsTop.end(); ii++)
	{
		CString strTitle;
		SCartsList lst;
		HSYNC callbackSync;
		lst.hstCartsStream = ii->stream;

		lst.intPageNumber = ii->intPageNumber;
		lst.strCartPosistion = ii->btnIterator->first;

		//remove the callback from the global map:
		for(T_mapCallback::iterator j = g_mapCartCallbacks.begin(); j != g_mapCartCallbacks.end();
			j++)
		{
			if(j->first == ii->syncHandle)
			{
				g_mapCartCallbacks.erase(j);
				break;
			}
		}

		//change the callbacks:
		BASS_ChannelRemoveSync(ii->stream, 
			ii->syncHandle);
		callbackSync = BASS_ChannelSetSync(ii->stream, 
			BASS_SYNC_END, 0, CFusicLoginDlg::fnLoginDialogCartCallback, m_pLoginDlg);
		lst.hsyCartsSync = callbackSync;

		//to get the title we will need to do an SQL query :-(
		CString strQuery;
		CString strPageNumber;
		strPageNumber.Format("%d", ii->intPageNumber);
		strQuery = "SELECT Cart_Title FROM tbl_carts WHERE Show_ID = 0 AND Cart_ID = ";
		strQuery += strPageNumber;
		strQuery += ii->btnIterator->first;

		//do the query:
		mysqlpp::StoreQueryResult res = fnGetResultSetForQuery(strQuery);
		lst.strTitle = res[0]["Cart_Title"];
		m_pLoginDlg->fnAddCartToList(lst);
	}

	//kill the main dialog:
	m_pMainDlg->doOk();

	//logout of the fusic carts screen:
	OnOK();
}
Ejemplo n.º 13
0
BOOL CFusicCartsDlg::OnInitDialog()
{
	mysqlpp::StoreQueryResult resFuse;
	mysqlpp::StoreQueryResult resUser;
	CDialog::OnInitDialog();

	//set the stop all button dialog pointer:
	m_ctlBtnStopall.fnSetCartsDialogPointer((void*)this);

	//set up button maps:
	fnSetupButtonMaps();

	//set up all nav buttons:
	for(mapNav::iterator i = m_mapBtnNavBottom.begin(); i != m_mapBtnNavBottom.end();
		i++)
	{
		i->second->fnSetupNavButtonForPage(i->first, USERCARTS, (void*)this);
	}

	for(mapNav::iterator i = m_mapBtnNavTop.begin(); i != m_mapBtnNavTop.end();
		i++)
	{
		i->second->fnSetupNavButtonForPage(i->first, FUSECARTS, (void*)this);
	}

	//setup all carts buttons:
	for(mapCart::iterator i = m_mapBtnCartBottom.begin(); i != m_mapBtnCartBottom.end();
		i++)
	{
		i->second->fnSetDefaultButton();
	}

	for(mapCart::iterator i = m_mapBtnCartTop.begin(); i != m_mapBtnCartTop.end();
		i++)
	{
		i->second->fnSetDefaultButton();
	}



	//setup stopall button:
	m_ctlBtnStopall.fnSetBackColour(255,0,0, true);
	m_ctlBtnStopall.fnSetFontColour(255,255,0);
	m_ctlBtnStopall.fnSetEdgeColour(255,255,0);
	m_ctlBtnStopall.fnSetClickColourChange(true);

	//setup logout button:
	m_ctlBtnLogout.fnSetBackColour(255,0,0,true);
	m_ctlBtnLogout.fnSetFontColour(255,255,0);
	m_ctlBtnLogout.fnSetEdgeColour(255,255,0);
	m_ctlBtnLogout.fnSetClickColourChange(true);

	//setup reconnect button:
	m_ctlBtnReconnect.fnSetBackColour(255,0,0,true);
	m_ctlBtnReconnect.fnSetFontColour(255,255,0);
	m_ctlBtnReconnect.fnSetEdgeColour(255,255,0);
	m_ctlBtnReconnect.fnSetClickColourChange(true);

	//setup refresh button:
	m_ctlBtnRefresh.fnSetBackColour(255,0,0,true);
	m_ctlBtnRefresh.fnSetFontColour(255,255,0);
	m_ctlBtnRefresh.fnSetEdgeColour(255,255,0);
	m_ctlBtnRefresh.fnSetClickColourChange(true);


	//create the connection to mysql:
	if(!connect())
	{
		//we didnt connect:
		CString strError;
		strError = "Error: could not connecto the mysql database: ";
		strError += m_PMYSQLConn->error();
		strError += ".";
		MessageBox(strError, "Carts Pane", MB_OK | MB_ICONERROR);
	}

	//need to get all fuse carts:
	resFuse = fnGetResultSetForQuery("SELECT * FROM tbl_carts where Show_ID = 0 and Cart_ID like '1%'");

	//setup fuse carts:
	fnSetupButtonForPageData(resFuse, FUSECARTS);

	//do the query for user carts:
	CString strQuery;
	CString strShowID;
	strShowID.Format("%d", g_intShowID);
	strQuery = "SELECT * FROM tbl_carts where Show_ID = ";
	strQuery += strShowID;
	strQuery += " and Cart_ID like '1%'";

	//do the query:
	resUser = fnGetResultSetForQuery(strQuery);

	//setup the user buttons:
	fnSetupButtonForPageData(resUser, USERCARTS);

	//we need now to get carts that where left playing on logout:
	for(std::vector<SCartsList>::iterator i = m_pLoginDlg->m_vecCartsList.begin();
		i != m_pLoginDlg->m_vecCartsList.end(); i++)
	{
		//we want to set all current first buttons up (as these will be displaied first):
		//get the button we firstly need to change:
		CCartsButton* curBtn = NULL;
		if(i->intPageNumber == 1)
		{
			curBtn = m_mapBtnCartTop[i->strCartPosistion];
			if(curBtn == NULL)
				break;

			for(T_mapCallback::iterator j = g_mapCartCallbacks.begin(); j != g_mapCartCallbacks.end();
				j++)
			{
				if(j->first == i->hsyCartsSync)
				{
					g_mapCartCallbacks.erase(j);
					break;
				}
			}


			//set all settings back;
			curBtn->fnPageMoveOn(i->hstCartsStream, i->hsyCartsSync);

			//also reset the callback:
			BASS_ChannelRemoveSync(i->hstCartsStream, i->hsyCartsSync);

			//set the new callback for the button:
			HSYNC callback = BASS_ChannelSetSync(i->hstCartsStream, BASS_SYNC_END, 0, 
				&CCallbackButton::fnEndCallback, 0);

			//add to the callback map:
			g_mapCartCallbacks[callback] = (CCallbackButton*)curBtn;
		}
		else
		{
			//the other buttons arn't on the first page.
			//so we need to put them back into the Navigation stream vector:
			//fist find the nav button that this cart will corrispond to:
			CNavigationButton* navBtn = m_mapBtnNavTop[i->intPageNumber];

			//remove the callback before we change it from the map:
			for(T_mapCallback::iterator j = g_mapCartCallbacks.begin();
				j != g_mapCartCallbacks.end(); j++)
			{
				if(j->first == i->hsyCartsSync)
				{
					g_mapCartCallbacks.erase(j);
					break;
				}
			}

			BASS_ChannelRemoveSync(i->hstCartsStream, i->hsyCartsSync);
			HSYNC synx = BASS_ChannelSetSync(i->hstCartsStream, BASS_SYNC_END,0,
				&CCallbackButton::fnEndCallback, 0);

			SNavigationStreams sNav;
			sNav.intPageNumber = i->intPageNumber;
			sNav.stream = i->hstCartsStream;
			sNav.syncHandle = i->hsyCartsSync;
			sNav.syncHandle = synx;
			//sNav.

			//now the tricky part, we need to create a std::mapCart::iterator for the
			//button that we can store in the struct; the only way I can see of doing this
			//is to iterate over the buttons untill we find one with the appropriate ID:
			for(mapCart::iterator ii = m_mapBtnCartTop.begin(); ii != m_mapBtnCartTop.end();
				ii++)
			{
				if(ii->first == i->strCartPosistion)
				{
					sNav.btnIterator = ii;
					break;
				}
			}

			//reset the callback:
			g_mapCartCallbacks[i->hsyCartsSync] = navBtn;

			//incrase the reference count on the nav button (to start it flashing):
			navBtn->fnIncreasePlayCount();

			//also add to the nav stream map:
			m_vecNavStreamsTop.push_back(sNav);
		}

	}

	//allow the window to be changed.
	AllowSetForegroundWindow(ASFW_ANY);

	//clear out the vector on the login dialog for the next logout population:
	m_pLoginDlg->m_vecCartsList.clear();

	//begin the fader start timer:
	SetTimer(WM_USER + 10, 10, NULL);

	return TRUE;  // return TRUE unless you set the focus to a control
}
Ejemplo n.º 14
0
void SetLoopEnd(QWORD pos)
{
	loop[1]=pos;
	BASS_ChannelRemoveSync(chan,lsync); // remove old sync
	lsync=BASS_ChannelSetSync(chan,BASS_SYNC_POS|BASS_SYNC_MIXTIME,loop[1],LoopSyncProc,0); // set new sync
}
Ejemplo n.º 15
0
void bmx_bass_setsync(DWORD handle, DWORD stype, QWORD param, MaxSyncData * syncData, DWORD * channel, DWORD * data, int * set) {
	syncData->channel = channel;
	syncData->data = data;
	syncData->set = set;
	syncData->handle = BASS_ChannelSetSync(handle, stype, param, bmx_sync_callback, syncData);
}