• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IsPlaying函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IsPlaying函数的典型用法代码示例。如果您正苦于以下问题:C++ IsPlaying函数的具体用法?C++ IsPlaying怎么用?C++ IsPlaying使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了IsPlaying函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: lock

bool Base::Start()
//----------------
{
	if(!IsOpen()) return false; 
	if(!IsPlaying())
	{
		{
			Util::lock_guard<Util::mutex> lock(m_StreamPositionMutex);
			m_CurrentUpdateInterval = 0.0;
			m_StreamPositionRenderFrames = 0;
			m_StreamPositionOutputFrames = 0;
		}
		m_Clock.SetResolution(1);
		m_RequestFlags.fetch_and(~RequestFlagRestart);
		if(!InternalStart())
		{
			m_Clock.SetResolution(0);
			return false;
		}
		m_IsPlaying = true;
	}
	return true;
}
开发者ID:luaman,项目名称:modplug,代码行数:23,代码来源:SoundDevice.cpp


示例2: UpdateTimer

void COggStream::Update() {
    if (!stopped) {
        UpdateTimer();

        if (!paused) {
            if (UpdateBuffers()) {
                if (!IsPlaying()) {
                    // source state changed
                    if (!StartPlaying()) {
                        // stream stopped
                        ReleaseBuffers();
                    } else {
                        // stream interrupted
                        ReleaseBuffers();
                    }
                }
            } else {
                // EOS, nothing left to do
                ReleaseBuffers();
            }
        }
    }
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:23,代码来源:OggStream.cpp


示例3: SetAnimation

void wxAnimationCtrl::SetAnimation(const wxAnimation &anim)
{
    if (IsPlaying())
        Stop();

    ResetAnim();
    ResetIter();

    // copy underlying GdkPixbuf object
    m_anim = anim.GetPixbuf();

    // m_anim may be null in case wxNullAnimation has been passed
    if (m_anim)
    {
        // add a reference to the GdkPixbufAnimation
        g_object_ref(m_anim);

        if (!this->HasFlag(wxAC_NO_AUTORESIZE))
            FitToAnimation();
    }

    DisplayStaticImage();
}
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:23,代码来源:animate.cpp


示例4: MixNull

void SoundSource::Update(float timeStep)
{
    if (!audio_ || !IsEnabledEffective())
        return;

    // If there is no actual audio output, perform fake mixing into a nonexistent buffer to check stopping/looping
    if (!audio_->IsInitialized())
        MixNull(timeStep);

    // check for autoPlay
    if (autoPlay_ && sound_.NotNull() && !hasAutoPlayed_ && !context_->GetEditorContext())
    {
        hasAutoPlayed_ = true;
        Play(sound_);
    }

    // Free the stream if playback has stopped
    if (soundStream_ && !position_)
        StopLockless();

    // Check for autoremove
    if (autoRemove_)
    {
        if (!IsPlaying())
        {
            autoRemoveTimer_ += timeStep;
            if (autoRemoveTimer_ > AUTOREMOVE_DELAY)
            {
                Remove();
                // Note: this object is now deleted, so only returning immediately is safe
                return;
            }
        }
        else
            autoRemoveTimer_ = 0.0f;
    }
}
开发者ID:AliAkbarMontazeri,项目名称:AtomicGameEngine,代码行数:37,代码来源:SoundSource.cpp


示例5: InternalStopForce

void Base::Stop(bool force)
//-------------------------
{
	if(!IsOpen()) return;
	if(IsPlaying())
	{
		if(force)
		{
			InternalStopForce();
		} else
		{
			InternalStop();
		}
		m_RequestFlags.fetch_and(~RequestFlagRestart);
		m_Clock.SetResolution(0);
		m_IsPlaying = false;
		{
			Util::lock_guard<Util::mutex> lock(m_StreamPositionMutex);
			m_CurrentUpdateInterval = 0.0;
			m_StreamPositionRenderFrames = 0;
			m_StreamPositionOutputFrames = 0;
		}
	}
}
开发者ID:luaman,项目名称:modplug,代码行数:24,代码来源:SoundDevice.cpp


示例6: Play

bool psEntity::Play(SoundControl* &ctrl, csVector3 entityPosition)
{
    EntityState* entityState;

    // checking if a sound is still playing
    if(IsPlaying())
    {
        return false;
    }

    // checking if the state is defined
    entityState = states.Get(state, 0);
    if(entityState == 0)
    {
        return false;
    }

    // picking up randomly among resources
    if(!entityState->resources.IsEmpty())
    {
        int resourceNumber = SoundManager::randomGen.Get() * entityState->resources.GetSize();

        Debug4(LOG_SOUND, 0, "psEntity::Play() %s PLAYS %s meshid: %u",entityName.GetData(),entityState->resources[resourceNumber],GetMeshID());

        if(SoundSystemManager::GetSingleton().Play3DSound(entityState->resources[resourceNumber], DONT_LOOP, 0, 0,
                entityState->volume, ctrl, entityPosition, 0, minRange, maxRange,
                VOLUME_ZERO, CS_SND3D_ABSOLUTE, handle))
        {
            when = entityState->delay;
            handle->SetCallback(this, &StopCallback);
            return true;
        }
    }

    return false;
}
开发者ID:Chettie,项目名称:Eulora-client,代码行数:36,代码来源:psentity.cpp


示例7: OnAnimStopped

void nuiAnimationSequence::OnAnimStopped(const nuiEvent& rEvent)
{
  if (IsPlaying())
  {
    //NGL_LOG(_T("nuiAnimationSequence), NGL_LOG_DEBUG, _T("::OnAnimStopped\n"));
    nuiAnimation* pAnim = (nuiAnimation*)rEvent.mpUser;
    // Find the next anim in the sequence:
    std::list<nuiAnimation*>::iterator it = mpAnimations.begin();
    std::list<nuiAnimation*>::iterator end = mpAnimations.end();

    while (it != end)
    {
      if (pAnim == *it)
      {
        ++it;
        break;
      }

      ++it;
    }

    if (it != end)
    {
      // Launch the next anim in the sequence:
      pAnim = *it;
      pAnim->Play();
      //NGL_LOG(_T("nuiAnimationSequence), NGL_LOG_DEBUG, _T("OnAnimStopped Launch next anim\n"));
    }
    else
    {
      // stop the sequence if this was the last in the chain:
      //NGL_LOG(_T("nuiAnimationSequence), NGL_LOG_DEBUG, _T("OnAnimStopped STOP\n"));
      mpAnimations.front()->Play();
    }
  }
}
开发者ID:jpastuszek,项目名称:nui3,代码行数:36,代码来源:nuiAnimation.cpp


示例8: Fadeout

void CAudioManager::Fadeout(int id, int targetVolume, float time){
  if(m_bValidAudio == false)
    return;

  int currentVolume = 0;
  double timeStep = 0;
  double volumeStep = 0;

  for(int i = 0; i < m_AudioClip.size(); i++){
    if(m_AudioClip[i].AudioID == id && IsPlaying(id) == true){
      m_AudioClip[i].bFadeout = true;
      
      m_AudioClip[i].targetVolume = targetVolume;
      currentVolume = GetVolume(i);
      if(targetVolume < currentVolume && time > 0){
        timeStep = time/ 0.1;
        volumeStep = (double)(currentVolume - targetVolume) / timeStep;
        m_AudioClip[i].fadeStep = volumeStep;
        m_AudioClip[i].bFadein = true;
      }

    }
  }//for
}
开发者ID:ChuckBolin,项目名称:CookieStealingOgre,代码行数:24,代码来源:CAudioManager.cpp


示例9: wxDynamicCast

void MapSidebar::UpdateSimButtons()
{
	wxButton* button;

	button = wxDynamicCast(FindWindow(ID_SimPlay), wxButton);
	wxCHECK(button, );
	button->Enable(m_SimState != SimPlaying);

	button = wxDynamicCast(FindWindow(ID_SimFast), wxButton);
	wxCHECK(button, );
	button->Enable(m_SimState != SimPlayingFast);

	button = wxDynamicCast(FindWindow(ID_SimSlow), wxButton);
	wxCHECK(button, );
	button->Enable(m_SimState != SimPlayingSlow);

	button = wxDynamicCast(FindWindow(ID_SimPause), wxButton);
	wxCHECK(button, );
	button->Enable(IsPlaying(m_SimState));

	button = wxDynamicCast(FindWindow(ID_SimReset), wxButton);
	wxCHECK(button, );
	button->Enable(m_SimState != SimInactive);
}
开发者ID:krichter722,项目名称:0ad,代码行数:24,代码来源:Map.cpp


示例10: Play

	/// starts or continue playing, true if successfull
	virtual const bool Play(){
		if(IsPlaying())return true;
		if(IsPaused()){
			// unpause sound
			if(mpChannel){
				result = FMOD_Channel_SetPaused(mpChannel,false);
				ERRCHECK(result);
			}
		} else {
			// start playing
			mpChannel = 0;
			// alloc channel
			if(mpSound && mSoundSystem && mSoundSystem->mpSystem){
				result = FMOD_System_PlaySound(mSoundSystem->mpSystem, FMOD_CHANNEL_FREE, mpSound, true, &mpChannel);
				ERRCHECK(result);
			}
			
			// channel free and working?
			if(mpChannel){
				
				if(mb3D){
					// set 3d position and velocity data
					result = FMOD_Channel_Set3DAttributes(mpChannel, &mlPos, &mlVel);
					ERRCHECK(result);
					// set currently set minmax distances
					SetMinMaxDistance(mfMinDistance,mfMaxDistance);
				} 
				
				result = FMOD_Channel_SetPaused(mpChannel,false);
				ERRCHECK(result);
				
				return true;
			} else return false;
		}
		return false;
	}
开发者ID:ghoulsblade,项目名称:lugreexample,代码行数:37,代码来源:lugre_sound_fmod.cpp


示例11: return

int SoundEvent::play(SoundLib soundlib,
					 VESSEL   *Vessel,
					  char    *names ,
					  double  *offset,
					  int     *newbuffer,
					  double  simcomputert,
					  double  MissionTime,
					  int     mode,
					  double  timeremaining,
					  double  timeafterpdi,
					  double  timetoapproach,
					  int     flags,
					  int     volume)


{
	int kk;
	char buffers[255];
	double altitude;
	double vlon,vlat,vrad;


    double timetopdi;
	double timesincepdi;
	double deltaoffset =0.;

    if (!isValid())
		return(false);

	// is Sound still playing ?
	// if yes let it play

//   TRACESETUP("SOUNDEVENT PLAY");

	if(lastplayed >= 0)
	{
        if(soundevents[lastplayed].offset == -1)
		{
	        if (IsPlaying())
			{ 
            //		TRACE("EN TRAIN DE JOUER");
                return(false);
			}
		}
		else if (IsPlaying())
		{
			if (soundevents[lastplayed+1].offset > soundevents[lastplayed].offset)
			{
			    if(Finish((double) soundevents[lastplayed+1].offset - 0.1))
				{
				}
				else
				    return(false);
			}
		}
	}


//  no more sounds to be played just return

	if(soundevents[lastplayed+1].met == 0)
		return(false);


//	sprintf(buffers,"ENTREE PLAY MODE %d timeremaining %f timeafterpdi %f altitude %f",
//		mode,timeremaining,timeafterpdi,altitude);
//	TRACE(buffers);

	timetopdi = timeremaining  -(MissionTime - simcomputert);
	timesincepdi = timeafterpdi +(MissionTime - simcomputert);
	timetoapproach = timetoapproach -(MissionTime -simcomputert);
    if (mode == 0)
	{ 
/*		sprintf(buffers,"AVANT PDI IGNIT %f %f %f ",
					   timetopdi, MissionTime, simcomputert);
		sprintf(oapiDebugString(),"%s",buffers);
*/
	}	

	if (mode >= 1 && mode < 3)
	{ 
		OBJHANDLE hbody=Vessel->GetGravityRef();
		double bradius=oapiGetSize(hbody);
		Vessel->GetEquPos(vlon, vlat, vrad);
		double cgelev=Vessel->GetCOG_elev();
		altitude=vrad-bradius-cgelev;

							
/*		sprintf(buffers,"AFTER PDI : TIMEAFTER %f ALTITUDE %f",
			        timesincepdi,altitude);
		sprintf(oapiDebugString(),"%s",buffers);
*/
	}	

    kk = lastplayed+1;
	sprintf(buffers,"%f",soundevents[kk].altitude);
//	TRACE (buffers);
//	sprintf(buffers,"%f",altitude);
//	TRACE (buffers);

//.........这里部分代码省略.........
开发者ID:dseagrav,项目名称:NASSP,代码行数:101,代码来源:soundevents.cpp


示例12: GetPosition

// -------------------------------------------------------------------------- //
// Sound property functions                                               
// -------------------------------------------------------------------------- //
void VFmodSoundObject::Play(float fStartTime, bool bAlsoInEditor)
{
  if (m_spResource == NULL || IsPlaying())
    return;

  if (!bAlsoInEditor && !Vision::Editor.IsAnimatingOrPlaying())
    return; 
  
  m_fStartTime = fStartTime;  
  
  VFmodManager &manager = VFmodManager::GlobalManager();
  if (manager.IsInitialized())
  {
    const hkvVec3 &vPos = GetPosition();

    // stop old playing
    if (m_pChannel)
      m_pChannel->stop();

    VFmodSoundResource* pResource = (VFmodSoundResource*)GetResource();
    if (pResource->m_pSound == NULL) // sound resource not loaded successfully
      return;

    FMOD_WARNINGCHECK(manager.m_pSystem->playSound(FMOD_CHANNEL_FREE, pResource->m_pSound, true, &m_pChannel));
    if (!m_pChannel)
      return;

    FMOD_WARNINGCHECK(m_pChannel->getFrequency(&m_fInitialFreq));

    // if this a music sound object assign it to the music channel group
    if (IsMusic())
      m_pChannel->setChannelGroup(manager.m_pMusicGroup);

    // set everything  
    m_pChannel->setUserData(this); // ...so that we can get from channel to VSoundObject
    m_pChannel->setCallback(ChannelCallback);
    m_pChannel->setMode(IsLooped() ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF);
    m_pChannel->setPriority(GetPriority());
    m_pChannel->set3DMinMaxDistance(Get3DFadeMinDistance(), Get3DFadeMaxDistance());
    m_pChannel->set3DAttributes((FMOD_VECTOR *)&vPos, NULL); // no speed (yet)
    m_pChannel->setVolume(GetVolume());
    m_pChannel->setPan(GetPan());

    SetPitch(GetPitch());
    SetConeAngles(GetConeAngleInside(), GetConeAngleOutside());

    // Initially the sound is left paused, then within the first RunTick it is unpaused. This is required since 
    // the 3D listener attributes has to be set prior to playing a sound. Otherwise Fmod would perform 
    // occlusion-raycasts without having initialized listener-attributes, which potentially results in a
    // wrong occlusion-behavior.
    m_bUnpause = true;

    m_bIsPlaying = true;
    m_bPlayedOnce = true;

    unsigned int ims = (int)(fStartTime*1000.f); // milliseconds
    m_pChannel->setPosition(ims,FMOD_TIMEUNIT_MS);
    m_pChannel->setMute(IsMuted());
  }

  Helper_SetFlag(VFMOD_FLAG_PAUSED, !IsPlaying());
}
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:65,代码来源:VFmodSoundObject.cpp


示例13: QueueNextFile

bool PAPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options)
{
  if (m_currentlyCrossFading) CloseFileInternal(false); //user seems to be in a hurry

  m_crossFading = g_guiSettings.GetInt("musicplayer.crossfade");
  //WASAPI doesn't support multiple streams, no crossfading for cdda, cd-reading goes mad and no crossfading for last.fm doesn't like two connections
  if (file.IsCDDA() || file.IsLastFM() || g_guiSettings.GetString("audiooutput.audiodevice").find("wasapi:") != CStdString::npos) m_crossFading = 0;
  if (m_crossFading && IsPlaying())
  {
    //do a short crossfade on trackskip
    //set to max 2 seconds for these prev/next transitions
    if (m_crossFading > 2) m_crossFading = 2;
    //queue for crossfading
    bool result = QueueNextFile(file, false);
    if (result)
    {
      //crossfading value may be update by QueueNextFile when nr of channels changed
      if (!m_crossFading) // swap to next track
        m_decoder[m_currentDecoder].SetStatus(STATUS_ENDED);
      else //force to fade to next track immediately
        m_forceFadeToNext = true;
    }
    return result;
  }

  // normal opening of file, nothing playing or crossfading not enabled
  // however no need to return to gui audio device
  CloseFileInternal(false);

  // always open the file using the current decoder
  m_currentDecoder = 0;

  if (!m_decoder[m_currentDecoder].Create(file, (__int64)(options.starttime * 1000), m_crossFading))
    return false;

  m_iSpeed = 1;
  m_bPaused = false;
  m_bStopPlaying = false;
  m_bytesSentOut = 0;

  CLog::Log(LOGINFO, "PAPlayer: Playing %s", file.m_strPath.c_str());

  m_timeOffset = (__int64)(options.starttime * 1000);

  unsigned int channel, sampleRate, bitsPerSample;
  m_decoder[m_currentDecoder].GetDataFormat(&channel, &sampleRate, &bitsPerSample);

  if (!CreateStream(m_currentStream, channel, sampleRate, bitsPerSample))
  {
    m_decoder[m_currentDecoder].Destroy();
    CLog::Log(LOGERROR, "PAPlayer::Unable to create audio stream");
  }

  *m_currentFile = file;

  if (ThreadHandle() == NULL)
    Create();

  m_startEvent.Set();

  m_bIsPlaying = true;
  m_cachingNextFile = false;
  m_currentlyCrossFading = false;
  m_forceFadeToNext = false;
  m_bQueueFailed = false;

  m_decoder[m_currentDecoder].Start();  // start playback

  return true;
}
开发者ID:mbolhuis,项目名称:xbmc,代码行数:70,代码来源:PAPlayer.cpp


示例14: return

bool CApplicationPlayer::IsPausedPlayback() const
{
  return (IsPlaying() && IsPaused());
}
开发者ID:B0k0,项目名称:xbmc,代码行数:4,代码来源:ApplicationPlayer.cpp


示例15: ProcessCommandLine

//========================================================================================
//	/exit		exit T-Clock 2010
//	/prop		show T-Clock 2010 properties
//	/SyncOpt	SNTP options
//	/Sync		synchronize the system clock with an NTP server
//	/start		start the Stopwatch (open as needed)
//	/stop		stop (pause really) the Stopwatch
//	/reset		reset Stopwatch to 0 (stop as needed)
//	/lap		record a (the current) lap time
//================================================================================================
//---------------------------------------------//---------------+++--> T-Clock Command Line Option:
void ProcessCommandLine(HWND hwndMain,const char* cmdline)   //-----------------------------+++-->
{
	int justElevated = 0;
	const char* p = cmdline;
	if(g_hwndTClockMain != hwndMain){
		g_hwndTClockMain = CreateWindow("STATIC",NULL,0,0,0,0,0,HWND_MESSAGE_nowarn,0,0,0);
		SubclassWindow(g_hwndTClockMain, MsgOnlyProc);
	}
	
	while(*p != '\0') {
		if(*p == '/') {
			++p;
			if(strncasecmp(p, "prop", 4) == 0) {
				SendMessage(hwndMain, WM_COMMAND, IDM_SHOWPROP, 0);
				p += 4;
			} else if(strncasecmp(p, "exit", 4) == 0) {
				SendMessage(hwndMain, MAINM_EXIT, 0, 0);
				p += 4;
			} else if(strncasecmp(p, "start", 5) == 0) {
				SendMessage(hwndMain, WM_COMMAND, IDM_STOPWATCH_START, 0);
				p += 5;
			} else if(strncasecmp(p, "stop", 4) == 0) {
				SendMessage(hwndMain, WM_COMMAND, IDM_STOPWATCH_STOP, 0);
				p += 4;
			} else if(strncasecmp(p, "reset", 5) == 0) {
				SendMessage(hwndMain, WM_COMMAND, IDM_STOPWATCH_RESET, 0);
				p += 5;
			} else if(strncasecmp(p, "pause", 5) == 0) {
				SendMessage(hwndMain, WM_COMMAND, IDM_STOPWATCH_PAUSE, 0);
				p += 5;
			} else if(strncasecmp(p, "resume", 6) == 0) {
				SendMessage(hwndMain, WM_COMMAND, IDM_STOPWATCH_RESUME, 0);
				p += 6;
			} else if(strncasecmp(p, "lap", 3) == 0) {
				SendMessage(hwndMain, WM_COMMAND, IDM_STOPWATCH_LAP, 0);
				p += 3;
			} else if(strncasecmp(p, "SyncOpt", 7) == 0) {
				if(HaveSetTimePermissions()){
					if(!SendMessage(hwndMain, WM_COMMAND, MAKEWPARAM(IDM_SNTP,1), 0)){
						NetTimeConfigDialog(justElevated);
					}
				}else{
					SendMessage(hwndMain, WM_COMMAND, IDM_SNTP, 0);
				}
				p += 7;
			} else if(strncasecmp(p, "Sync", 4) == 0) {
				p += 4;
				SendMessage(hwndMain, WM_COMMAND, MAKEWPARAM(IDM_SNTP_SYNC,justElevated), 0);
				if(g_hwndTClockMain == hwndMain)
					SendMessage(hwndMain, MAINM_EXIT, 0, 0);
			} else if(strncmp(p, "Wc", 2) == 0) { // Win10 calendar "restore"
				if(p[2] == '1') // restore to previous
					api.SetSystemInt(HKEY_LOCAL_MACHINE, kSectionImmersiveShell, kKeyWin32Tray, 1);
				else // use the slow (new) one
					api.DelSystemValue(HKEY_LOCAL_MACHINE, kSectionImmersiveShell, kKeyWin32Tray);
				p += 2;
			} else if(strncmp(p, "UAC", 3) == 0) {
				justElevated = 1;
				p += 3;
			}
			continue;
		}
		++p;
	}
	
	if(g_hwndTClockMain != hwndMain){
		const DWORD kTimeout = 10000;
		const DWORD kStartTicks = GetTickCount();
		DWORD timeout;
		MSG msg;
		msg.message = 0;
		for(;;){
			int have_ui = IsWindow(g_hwndSheet) || IsWindow(g_hDlgTimer) || IsWindow(g_hDlgTimerWatch) || IsWindow(g_hDlgSNTP) || IsWindow(g_hDlgStopWatch);
			if(have_ui)
				timeout = INFINITE;
			else if(IsPlaying())
				timeout = 200;
			else
				break;
			MsgWaitForMultipleObjectsEx(0, NULL, timeout, QS_ALLEVENTS, MWMO_INPUTAVAILABLE);
			while(PeekMessage(&msg,NULL,0,0,PM_REMOVE)){
				if(msg.message == WM_QUIT)
					break;
				if(!(g_hwndSheet && IsWindow(g_hwndSheet) && PropSheet_IsDialogMessage(g_hwndSheet,&msg))
				&& !(g_hDlgTimer && IsWindow(g_hDlgTimer) && IsDialogMessage(g_hDlgTimer,&msg))
				&& !(g_hDlgTimerWatch && IsWindow(g_hDlgTimerWatch) && IsDialogMessage(g_hDlgTimerWatch,&msg))
				&& !(g_hDlgSNTP && IsWindow(g_hDlgSNTP) && IsDialogMessage(g_hDlgSNTP,&msg))
				&& !(g_hDlgStopWatch && IsWindow(g_hDlgStopWatch) && IsDialogStopWatchMessage(g_hDlgStopWatch,&msg))){
					TranslateMessage(&msg);
//.........这里部分代码省略.........
开发者ID:dubepaul,项目名称:T-Clock,代码行数:101,代码来源:main.c


示例16: GetPlaybackPosition

int AudioController::GetPlaybackPosition()
{
	if (!IsPlaying()) return 0;

	return MillisecondsFromSamples(player->GetCurrentPosition());
}
开发者ID:sthenc,项目名称:Aegisub,代码行数:6,代码来源:audio_controller.cpp


示例17: return

bool CApplicationPlayer::IsPausedPlayback()
{
  return (IsPlaying() && (GetPlaySpeed() == 0));
}
开发者ID:angp,项目名称:xbmc,代码行数:4,代码来源:ApplicationPlayer.cpp


示例18: SetTimer

HRESULT FMediaContainer::PlayMT(ulong videoID, BOOL bPaused /* = FALSE */)
{
	if (m_pStatusBar)
		m_pStatusBar->SetStatusText(0, "Loading video plug-in...", VIEW_PLAYER);
	m_bFullScreenAd = FALSE; 

	m_MSLast = 0; 
	m_MSPlayed = 0; 

	HRESULT hr = m_pMediaPlayer.PlayMT(videoID, bPaused); 
	BOOL bFullscreenAd = FALSE; 
	
	for (size_t k =0 ; k < MAX_AD_WINDOWS; k++)
	{
		if (m_pAdWindows[k])
		{
			m_pAdWindows[k]->ShowWindow(SW_HIDE); 
			m_pAdWindows[k]->Clear(); 
		}
	}

	m_CurVideoID = videoID; //No sync, let it burn!

	m_AdManager->Clear();
	if (SUCCEEDED(hr) || hr == E_PENDING)
	{
		m_AdRequests.Push(videoID); 
		m_bPlaying = !bPaused; 
		FDownload &pDown = m_pMediaPlayer.m_pVideo; 

		FIniConfig aConf = g_Objects._DownloadManager.GetDownloadConf(videoID); 
		
		if (m_AdManager->LoadAds(aConf, TRUE))
		{
			IAdWindowInit InitData; 
			InitData.m_hWndParent = m_hWnd; 
			InitData.m_pAdManager = m_AdManager.m_p; 
			InitData.m_pNotify = this;

			IAdPosition pPos; 
			pPos.m_PlaybackPosMS = pDown.m_Detail.m_PlaybackPosMS / DURATION_MULT;
			pPos.m_TotalDurationMS = pDown.m_Detail.m_TotalDurationMS; 
			pPos.m_dwFlags = FLAG_PLAYBACK_START; 

			for (size_t k = 0; k < MAX_AD_WINDOWS; k++)
			{
				InitData.m_AdType = (AdTypes)(k + 1);
				InitData.m_dwWinID = (DWORD)k; 

				if (m_pAdWindows[k] == NULL)
					m_pAdWindows[k].Attach(new FAdWindow);

				if (m_pAdWindows[k]->Init(InitData))
				{
					BOOL bHasAd = m_pAdWindows[k]->UpdatePosition(pPos); 
					if (k == 0 && bHasAd)
						bFullscreenAd = TRUE; 
				}
			}	
			SetTimer(1, 500); 
		}
	}
	
	m_pMediaPlayer.ShowWindow(SW_SHOW); 
	if (bFullscreenAd)
	{
		Pause(); 
	}

	if (g_MainFrame->IsFullScreen())
		m_ControlBar.ShowWindow(SW_HIDE);

	UpdateLayout(); 

	if (FAILED(hr))
	{
		if (hr != E_PENDING)
		{
			if (m_pStatusBar)
				m_pStatusBar->SetStatusText(0, "Cannot play video.", VIEW_PLAYER);
		}
	}
	else
	{
		if (m_pStatusBar)
		{
			if (IsPlaying())
				m_pStatusBar->SetStatusText(0, "Playing", VIEW_PLAYER); 
			else
				m_pStatusBar->SetStatusText(0, "Paused", VIEW_PLAYER); 
		}
	}
	return hr; 
}
开发者ID:codeboost,项目名称:libertv,代码行数:94,代码来源:FMediaContainer.cpp


示例19: PlayL

void MsgAudioPreview::PlayL()
    {
    if( IsPlaying() )
        {
        Stop();
        return;
        }
    //sequence for playing a beep once sound
    _LIT8( KFileListBeepSequence, "\x00\x11\x06\x0A\x08\x73\x0A\x40\x28\x0A\xF7\
    \x05\xFC\x40\x64\x0A\x08\x40\x32\x0A\xF7\x06\x0B" ); 

    // rng mime type
    _LIT( KFileListRngMimeType, "application/vnd.nokia.ringing-tone" );
    
    Cancel(); // stop previous play
    
    if ( !iFullName || iFullName->Des().Length() == 0 )
        {
        User::Leave( KErrNotFound );
        }

    TRAP_IGNORE( ReadActiveProfileL() );

    TPtrC fileName( iFullName->Des() );
    TDataType dataType;
    TInt err = GetDataType( fileName, dataType );
    if ( err == KErrNotFound )
        {
        fileName.Set( iDefaultTone );
        if ( fileName.Length() == 0 )
             {
             User::Leave( KErrNotFound );
             }
        }
    else if ( err != KErrNone )
        {
        User::Leave( err );
        }
        
    TBool mimeTypeRng = EFalse;
    
    if ( err == KErrNone )
        {
        if( dataType.Des().CompareF( KFileListRngMimeType ) == 0 )
            {
            mimeTypeRng = ETrue;
            }
        }

    TInt ringingType = RingingType();
    if ( ringingType == ERingingTypeBeepOnce )
        {
        // Active profile ringing tone is set to Beep Once
        // Don't initialize a FileSequence but use DesSequence instead
        iTonePlayer = CMdaAudioToneUtility::NewL( *this );
        iTonePlayer->PrepareToPlayDesSequence( KFileListBeepSequence() );
        iTonePlayerStatus = EPlayerInitializing;
        }
    else
        {
        if( mimeTypeRng )
            {
            //Ringingtone is a RNG-file
            iTonePlayer = CMdaAudioToneUtility::NewL( *this );
            iTonePlayer->PrepareToPlayFileSequence( fileName );
            iTonePlayerStatus = EPlayerInitializing;
            }
        else
            {
            delete iAudioPlayer;
            iAudioPlayer = 0;

            iAudioPlayer = CDrmPlayerUtility::NewFilePlayerL(
                fileName, *this, KAudioPriorityRingingTonePreview,
                ( TMdaPriorityPreference )KAudioPrefRingFilePreview );
    
            iAudioPlayerStatus = EPlayerInitializing;
            }
        }
    DisableBackLight();
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:81,代码来源:msgaudiopreview.cpp


示例20: init_mud


//.........这里部分代码省略.........
	// connect_attempts array, to keep people from spam connecting to slow down the mud
        connect_attempts        = malloc(sizeof(char*));
        connect_attempts[0]     = 0;

	mysql = mysql_init(NULL);       
       if (!mysql)
       {
               mudlog("Error initializing MySQL: %s", mysql_error(mysql));
               abort();
       }

        // connect to MySQL database
       if (!mysql_real_connect(mysql, DB_HOST, DB_LOGIN, DB_PASSWORD, DB_NAME, 0, NULL, 0))
        {
               mudlog("Error opening mysql database: %s", mysql_error(mysql));
                abort();
        }

        if (mysql_select_db(mysql, DB_NAME))
        {
               mudlog("Error opening main database: %s",mysql_error(mysql));
               if (mysql)
                       mysql_close(mysql);
                abort();
        }

	// time of da mud !
	fread_time();

	// load areas/rooms/objects/creatures
	load_db();

	// check if hotreboot and reconnect everything
	if(hotreboot)
	{
		MSOCKET *socket=0;
		char buf[MAX_BUFFER];
		MYSQL_RES *result;
		MYSQL_ROW row;

		mysql_query(mysql, "SELECT * FROM player WHERE online='1'");
		result = mysql_store_result(mysql);

		if (mysql_num_rows(result) < 0)
		{
			mudlog("hotreboot: mysql error is: %s",mysql_error(mysql));
			exit(1);
		}

		while((row = mysql_fetch_row(result)))
		{
			strcpy(buf, row[P_NAME]);

			// check for "host" player.. holds control descriptor
			if(!strcasecmp("host", row[C_NAME]))
			{
				host = atoi(row[P_DESCRIPTOR]);
			}
			else
			{
				socket = init_socket();
				fread_player(socket, buf);

				str_dup(&socket->host,		row[P_HOST]);
				str_dup(&socket->ip,		row[P_IP]);

				socket->desc = atoi(row[P_DESCRIPTOR]);
				socket->connected = CON_PLAYING;

				trans(socket->pc, socket->pc->in_room);

				sendcrit(socket->pc, "Hotreboot completed.");
			}
		}
		mysql_free_result(result);
	}

	// make sure nobody has non-existant connections, in the event of a crash + hotreboot
	// then go through and update people who are online
	// this is also a good time to get host address, as players will be expecting lag
	mysql_query(mysql, "UPDATE player SET online='0', descriptor='0'");

	for(socket = socket_list; socket; socket = socket->next)
	{
		get_hostname(socket);
		sprintf(buf,"UPDATE player SET online='1', host=\"%s\" WHERE id='%li'",
			smash_quotes(socket->host), socket->id);
		mysql_query(mysql, buf);
	}

	// see how many players are in each area, to see if area should be 'alive'
	for(socket = socket_list; socket; socket = socket->next)
	{
		if(IsPlaying(socket->pc))
			socket->pc->in_room->area->players++;
	}

	// check if we need to backup
	backup_update();
}
开发者ID:borlak,项目名称:acmud,代码行数:101,代码来源:main.c



注:本文中的IsPlaying函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IsPortActive函数代码示例发布时间:2022-05-30
下一篇:
C++ IsPet函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap