Beispiel #1
0
//////////////////////////////////////////////////////////////////////
// Descripcion:
// - Detiene el sonido que se este reproduciendo.
// Parametros:
// - bInitPlayPos: Indica si hay que parar y poner al comienzo el 
//   cursor de reproduccion. Por defecto vale true, con lo que se
//   llevara al comienzo el cursor si no se recibe otro parametro.
// Devuelve:
// - true: Si se detiene el sonido o el sonido.
// - false: Existe algun tipo de problema.
// Notas:
// - Aunque el buffer se encuentre sin ser reproducido, al llamar a 
//   stop se devolvera true si todo sale bien.
////////////////////////////////////////////////////////////////////// 
bool DXDSWAVSound::Stop(const bool bInitPlayPos)
{
  // SOLO si hay buffer secundario
  DXASSERT(m_lpDSBuffer != NULL);
  
  // Para la reproduccion
  m_CodeResult = m_lpDSBuffer->Stop();
  if (FAILED(m_CodeResult)) {
    // Hay problemas
    DXDSError::DXDSErrorToString(m_CodeResult, m_sLastCode);
    return false;
  }

  // ¿Hay que resituar el cursor?
  if (bInitPlayPos) {
    // Si; ademas de parar hay que situar el cursor en la pos. inicial
    if (!SetPlayPosition()) {
      // No se pudo situar el cursor; se establece codigo de error interno
      m_CodeResult = S_OK;
      m_sLastCode = DXDSBUFFERS_SETPLAYPOSERROR_MSG;
      return false;
    }
  }   

  // Todo correcto
  return true;
}
Beispiel #2
0
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ Tick
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// test if song is over, if it is reset the playing flag
void CMADDriver::Tick()
{
	if (!IsLooping())
	{
		long	fullTime,currTime;

		::MADGetMusicStatus(mDriver,&fullTime,&currTime);

		if (mMadPlaying)
		{
			if ((currTime>=fullTime) || (mLastRecordedPosition && (!mDriver->PL)))
			{
				StopMusic();
				SetPlayPosition(0);
			}
			else
				mLastRecordedPosition=mDriver->PL;
		}
	}
}
Beispiel #3
0
void SoundSource::SetPositionAttr(int value)
{
    if (sound_)
        SetPlayPosition(sound_->GetStart() + value);
}
	void AnimationController::DoUpdate(float deltaTime)
	{
		// FIXME: don't assume looping
		SetPlayPosition(time + deltaTime * timeScale);
	}