示例#1
0
int SoundSource::GetPositionAttr() const
{
    if (sound_ && position_)
        return (int)(GetPlayPosition() - sound_->GetStart());
    else
        return 0;
}
示例#2
0
void MarkerActionTimer()
{
	static double dLastPos = 0.0;
	static double dUsualPosDelta = 0.050;
	if (g_bMAEnabled && GetPlayState() & 1)
	{
		double dPlayPos = GetPlayPosition();
		double dDelta = dPlayPos - dLastPos;
		// Ignore markers when the play state seems to have jumped forward or backwards
		if (dDelta > 0.0 && dDelta < dUsualPosDelta * 5.0)
		{
			// Quick and dirty IIR
			dUsualPosDelta = dUsualPosDelta * 0.99 + dDelta * 0.01;
			int x = 0;
			const char* cName;
			double dMarkerPos;
			// Look for markers with '!' as the first char with the right time
			while ((x = EnumProjectMarkers(x, NULL, &dMarkerPos, NULL, &cName, NULL)))
				if (dMarkerPos >= dLastPos && dMarkerPos < dPlayPos)
					RunActionMarker(cName);
		}
		dLastPos = dPlayPos;
	}
	else
		dLastPos = GetCursorPosition();
}
示例#3
0
////////////////////////////////////////////////////////////
//
// CClientSound::BeginSimulationOfPlayPosition
//
//
//
////////////////////////////////////////////////////////////
void CClientSound::BeginSimulationOfPlayPosition ( void )
{
    // Only 3d sounds will be distance streamed in and out. Also streams can't be seeked.
    // So only non-streamed 3D sounds need the play position simulated.
    if ( m_b3D && !m_bStream )
    {
        m_SimulatedPlayPosition.SetLooped ( m_bLoop );
        m_SimulatedPlayPosition.SetLength ( m_dLength );
        m_SimulatedPlayPosition.SetPaused ( m_bPaused );
        m_SimulatedPlayPosition.SetPlaybackSpeed( GetPlaybackSpeed () );
        m_SimulatedPlayPosition.SetPlayPositionNow ( GetPlayPosition () );
        m_SimulatedPlayPosition.SetValid ( true );
    }
}