XnStatus PlayerImpl::SetSource(XnRecordMedium sourceType, const XnChar* strSource) { XnStatus nRetVal = XN_STATUS_OK; // NOTE: we don't want playback speed to affect getting to the first frame, so perform this // without playback speed XnDouble dPlaybackSpeed = GetPlaybackSpeed(); SetPlaybackSpeed(XN_PLAYBACK_SPEED_FASTEST); //Right now the only record medium we support is a file m_sourceType = sourceType; switch (m_sourceType) { case XN_RECORD_MEDIUM_FILE: { nRetVal = xnOSStrCopy(m_strSource, strSource, sizeof(m_strSource)); XN_IS_STATUS_OK(nRetVal); nRetVal = ModulePlayer().SetInputStream(ModuleHandle(), this, &s_fileInputStream); XN_IS_STATUS_OK(nRetVal); break; } default: XN_ASSERT(FALSE); return XN_STATUS_BAD_PARAM; } // now re-set playback speed nRetVal = SetPlaybackSpeed(dPlaybackSpeed); XN_IS_STATUS_OK(nRetVal); return XN_STATUS_OK; }
//////////////////////////////////////////////////////////// // // 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 ); } }
void UGeometryCacheComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) { SCOPE_CYCLE_COUNTER(STAT_GeometryCacheComponent_TickComponent); if (GeometryCache && bRunning) { // Increase total elapsed time since BeginPlay according to PlayDirection and speed ElapsedTime += (DeltaTime * PlayDirection * GetPlaybackSpeed()); if (ElapsedTime < 0.0f && bLooping) { ElapsedTime += Duration; } for (int32 TrackIndex = 0; TrackIndex < NumTracks; ++TrackIndex) { // Determine if and which part of the section we have to update UGeometryCacheTrack* Track = GeometryCache->Tracks[TrackIndex]; FMatrix WorldMatrix; FGeometryCacheMeshData* MeshData = nullptr; const float ClampedStartTimeOffset = FMath::Clamp(StartTimeOffset, -14400.0f, 14400.0f); const bool bUpdateMatrix = Track->UpdateMatrixData(ElapsedTime + ClampedStartTimeOffset, bLooping, TrackMatrixSampleIndices[TrackIndex], WorldMatrix); const bool bUpdateMesh = Track->UpdateMeshData(ElapsedTime + ClampedStartTimeOffset, bLooping, TrackMeshSampleIndices[TrackIndex], MeshData); // Update sections according what is required if (bUpdateMatrix) { UpdateTrackSectionMatrixData(TrackIndex, WorldMatrix); } if (bUpdateMesh) { UpdateTrackSectionMeshData(TrackIndex, MeshData); } } } }
float WrapperDLL::Sound_GetPlaybackSpeed(void* self,int32_t id){ auto self_ = (Sound*)self; auto arg0 = id; auto ret = self_->GetPlaybackSpeed(arg0); return ret; };