当前位置: 首页>>代码示例>>C++>>正文


C++ IsPlaying函数代码示例

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


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


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