Ejemplo n.º 1
0
bool CSoundMgr::GetMusicPlayState (SMusicPlayState *retState)

//	GetMusicPlayState
//
//	Returns the current play state. Returns FALSE if not playing

	{
	if (m_hMusic == NULL)
		{
		retState->bPlaying = false;
		retState->iLength = 0;
		retState->iPos = 0;
		retState->sFilename = NULL_STR;
		return false;
		}

	int iMode = MCIWndGetMode(m_hMusic, NULL, 0);
	retState->bPlaying = (iMode == MCI_MODE_PLAY);
	retState->bPaused = (iMode == MCI_MODE_PAUSE);
	retState->iLength = MCIWndGetLength(m_hMusic);
	retState->iPos = MCIWndGetPosition(m_hMusic);
	
	char *pDest = retState->sFilename.GetWritePointer(MAX_PATH);
	MCIWndGetFileName(m_hMusic, pDest, retState->sFilename.GetLength());
	retState->sFilename.Truncate(lstrlen(pDest));

	return retState->bPlaying;
	}
Ejemplo n.º 2
0
/**
 * Timer callback used to check about end of media (except JTS type)
 */
static void CALLBACK audio_timer_callback(UINT uID, UINT uMsg, 
                                          DWORD dwUser, 
                                          DWORD dw1, 
                                          DWORD dw2) {
    audio_handle* pHandle = (audio_handle*)dwUser;

    if (pHandle->hWnd) {
        if (-1 == pHandle->duration) {
            pHandle->duration = MCIWndGetLength(pHandle->hWnd);
            JAVA_DEBUG_PRINT1("[jc_media] audio_timer_callback %d\n", 
                pHandle->duration);
        }

        pHandle->offset = MCIWndGetPosition(pHandle->hWnd);
        pHandle->curTime = pHandle->offset;
        
        /* Is end of media reached? */
        if (pHandle->offset >= pHandle->duration) {
            /* Post EOM event to Java and kill player timer */
            pHandle->timerId = 0;
            pHandle->offset = 0;
            timeKillEvent(uID);
            JAVA_DEBUG_PRINT1("[jc_media] javanotify_on_media_notification %d\n", 
                pHandle->playerId);

            javanotify_on_media_notification(JAVACALL_EVENT_MEDIA_END_OF_MEDIA, 
                pHandle->playerId, (void*)pHandle->duration);
        }
    }

}
Ejemplo n.º 3
0
static long audio_get_time(javacall_handle handle){

    audio_handle* pHandle = (audio_handle*)handle;

    if (pHandle->timerId && pHandle->hWnd) {
        pHandle->curTime = MCIWndGetPosition(pHandle->hWnd);
    }

    return pHandle->curTime;
}
Ejemplo n.º 4
0
void MCIOBJ::work(void) 
{
//		  InvalidateRect(displayWnd,NULL,FALSE);	

	if (GLOBAL.fly) return;
	if (!m_video) return;

	if (MCIWndGetPosition(m_video)==MCIWndGetLength(m_video)) playing=FALSE;

	if ((play!=INVALID_VALUE) && (m_video) && (!playing))
	{ 
		if ((!play_once)||(resetted)) { MCIWndPlay(m_video); playing = TRUE; }
		resetted=FALSE;
	}

	if (play==INVALID_VALUE)
	{
		resetted=TRUE;
		if ((m_video) && (playing))
		{	MCIWndStop(m_video); playing=FALSE; }
	}


	acttime=TIMING.acttime-prevtime;
    if (((float)acttime/(float)TIMING.pcfreq*1000)>(float)upd_speed)
	{  
		prevtime=TIMING.acttime;
		if (actspeed!=speed) { actspeed=speed; MCIWndSetSpeed(m_video, speed); }	
		if (actvolume!=volume) { actvolume=volume;	MCIWndSetVolume(m_video, volume); }
		if (step) { MCIWndStep(m_video,step); step=0;} 
		if (pos_change) {MCIWndSeek(m_video,pos_center+pos_change); pos_change=0;}

		if (MCIWndGetPosition(m_video)==MCIWndGetLength(m_video))
		{
			//MCIWndPlay(m_video);
			MCIWndSeek(m_video,1);
		}
	}
}
Ejemplo n.º 5
0
static javacall_result audio_stop(javacall_handle handle){

    audio_handle* pHandle = (audio_handle*)handle;
    audio_prepare_MCIWnd(pHandle);

    if (pHandle->hWnd) {
        /* Get stopped position for later use */
        pHandle->offset = MCIWndGetPosition(pHandle->hWnd);
        if (pHandle->offset >= MCIWndGetLength(pHandle->hWnd)) {
            pHandle->offset = 0;
        }
        /* Kill player timer */
        if (pHandle->timerId) {
            timeKillEvent(pHandle->timerId);
            pHandle->timerId = 0;
        }
        MCIWndStop(pHandle->hWnd);
    }
    
    return JAVACALL_OK;
}