void VideoProducer::HandleEvent(const media_timed_event *event, bigtime_t lateness, bool realTimeEvent) { TOUCH(lateness); TOUCH(realTimeEvent); switch(event->type) { case BTimedEventQueue::B_START: HandleStart(event->event_time); break; case BTimedEventQueue::B_STOP: HandleStop(); break; case BTimedEventQueue::B_WARP: HandleTimeWarp(event->bigdata); break; case BTimedEventQueue::B_SEEK: HandleSeek(event->bigdata); break; case BTimedEventQueue::B_HANDLE_BUFFER: case BTimedEventQueue::B_DATA_STATUS: case BTimedEventQueue::B_PARAMETER: default: PRINTF(-1, ("HandleEvent: Unhandled event -- %lx\n", event->type)); break; } }
void LegacyAudioConsumer::HandleEvent( const media_timed_event *event, bigtime_t lateness, bool realTimeEvent ) { switch(event->type) { case BTimedEventQueue::B_START: HandleStart( event->event_time ); break; case BTimedEventQueue::B_STOP: HandleStop(); break; case BTimedEventQueue::B_WARP: HandleTimeWarp( event->bigdata ); break; case BTimedEventQueue::B_SEEK: HandleSeek( event->bigdata ); break; case BTimedEventQueue::B_HANDLE_BUFFER: HandleBuffer( static_cast<BBuffer *>( event->pointer ) ); break; case BTimedEventQueue::B_DATA_STATUS: case BTimedEventQueue::B_PARAMETER: default: break; //HandleEvent: Unhandled event } }
// -------------------------------------------------------- // // implementation for BMediaEventLooper // -------------------------------------------------------- // void AbstractFileInterfaceNode::HandleEvent( const media_timed_event *event, bigtime_t lateness, bool realTimeEvent) { CALLED(); switch (event->type) { case BTimedEventQueue::B_START: HandleStart(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_SEEK: HandleSeek(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_WARP: HandleWarp(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_STOP: HandleStop(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_HANDLE_BUFFER: if (RunState() == BMediaEventLooper::B_STARTED) { HandleBuffer(event,lateness,realTimeEvent); } break; case BTimedEventQueue::B_DATA_STATUS: HandleDataStatus(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_PARAMETER: HandleParameter(event,lateness,realTimeEvent); break; default: PRINT(" unknown event type: %ld\n",event->type); break; } }
void FireWireDVNode::HandleEvent(const media_timed_event* event, bigtime_t lateness, bool realTimeEvent) { switch(event->type) { case M_REFRESH_PARAMETER_WEB: RefreshParameterWeb(); break; case BTimedEventQueue::B_START: HandleStart(event->event_time); break; case BTimedEventQueue::B_STOP: HandleStop(); break; case BTimedEventQueue::B_WARP: HandleTimeWarp(event->bigdata); break; case BTimedEventQueue::B_SEEK: HandleSeek(event->bigdata); break; case BTimedEventQueue::B_HANDLE_BUFFER: case BTimedEventQueue::B_DATA_STATUS: case BTimedEventQueue::B_PARAMETER: default: TRACE("FireWireDVNode::HandleEvent: Unhandled event -- %lx\n", event->type); break; } }
void DisplayTimer::HandleAdd(LTFLOAT fTime) { // Start the timer if it isn't going (and the timer is positive)... if (m_Timer.GetCountdownTime() <= 0.0f) { if (fTime > 0.0f) { HandleStart(fTime); } return; } // Add/subtract the time from the timer... m_Timer.Add(fTime); // Send message to clients telling them to update DisplayTimer... UpdateClients(); }
EXPORT_C CApaDataRecognizerType* CreateRecognizer() { CApaDataRecognizerType* recog = new CTrkDummyRecognizer(); // no (ELeave) as return NULL is OK HandleStart(); return recog; }
CApaDataRecognizerType* CTrkDummyRecognizer::NewL() { RDebug::Print(_L("TrkLauncher::CTrkDummyRecognizer::NewL()")); CApaDataRecognizerType *recog = new CTrkDummyRecognizer(); // no (ELeave) as return NULL is OK RDebug::Print(_L("TrkLauncher - Before HandleSart()")); HandleStart(); return recog; }
void SoundPlayNode::HandleEvent(const media_timed_event* event, bigtime_t lateness, bool realTimeEvent) { CALLED(); switch (event->type) { case BTimedEventQueue::B_START: HandleStart(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_SEEK: HandleSeek(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_WARP: HandleWarp(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_STOP: HandleStop(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_HANDLE_BUFFER: // we don't get any buffers break; case SEND_NEW_BUFFER_EVENT: if (RunState() == BMediaEventLooper::B_STARTED) SendNewBuffer(event, lateness, realTimeEvent); break; case BTimedEventQueue::B_DATA_STATUS: HandleDataStatus(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_PARAMETER: HandleParameter(event,lateness,realTimeEvent); break; default: fprintf(stderr," unknown event type: %li\n", event->type); break; } }
void BattlePhase::Start (const PhaseArgs& args) { HandleStart (args); }
void USoundWave::Parse( FAudioDevice* AudioDevice, const UPTRINT NodeWaveInstanceHash, FActiveSound& ActiveSound, const FSoundParseParameters& ParseParams, TArray<FWaveInstance*>& WaveInstances ) { FWaveInstance* WaveInstance = ActiveSound.FindWaveInstance(NodeWaveInstanceHash); // Create a new WaveInstance if this SoundWave doesn't already have one associated with it. if( WaveInstance == NULL ) { if( !ActiveSound.bRadioFilterSelected ) { ActiveSound.ApplyRadioFilter( AudioDevice, ParseParams ); } WaveInstance = HandleStart( ActiveSound, NodeWaveInstanceHash); } // Looping sounds are never actually finished if (bLooping || ParseParams.bLooping) { WaveInstance->bIsFinished = false; #if !NO_LOGGING if (!ActiveSound.bWarnedAboutOrphanedLooping && !ActiveSound.AudioComponent.IsValid()) { UE_LOG(LogAudio, Warning, TEXT("Detected orphaned looping sound '%s'."), *ActiveSound.Sound->GetName()); ActiveSound.bWarnedAboutOrphanedLooping = true; } #endif } // Check for finished paths. if( !WaveInstance->bIsFinished ) { // Propagate properties and add WaveInstance to outgoing array of FWaveInstances. WaveInstance->Volume = ParseParams.Volume * Volume; WaveInstance->VolumeMultiplier = ParseParams.VolumeMultiplier; WaveInstance->Pitch = ParseParams.Pitch * Pitch; WaveInstance->HighFrequencyGain = ParseParams.HighFrequencyGain; WaveInstance->bApplyRadioFilter = ActiveSound.bApplyRadioFilter; WaveInstance->StartTime = ParseParams.StartTime; WaveInstance->UserIndex = ActiveSound.UserIndex; WaveInstance->OmniRadius = ParseParams.OmniRadius; bool bAlwaysPlay = false; // Properties from the sound class WaveInstance->SoundClass = ParseParams.SoundClass; if (ParseParams.SoundClass) { FSoundClassProperties* SoundClassProperties = AudioDevice->GetSoundClassCurrentProperties(ParseParams.SoundClass); // Use values from "parsed/ propagated" sound class properties WaveInstance->VolumeMultiplier *= SoundClassProperties->Volume; WaveInstance->Pitch *= SoundClassProperties->Pitch; //TODO: Add in HighFrequencyGainMultiplier property to sound classes WaveInstance->VoiceCenterChannelVolume = SoundClassProperties->VoiceCenterChannelVolume; WaveInstance->RadioFilterVolume = SoundClassProperties->RadioFilterVolume * ParseParams.VolumeMultiplier; WaveInstance->RadioFilterVolumeThreshold = SoundClassProperties->RadioFilterVolumeThreshold * ParseParams.VolumeMultiplier; WaveInstance->StereoBleed = SoundClassProperties->StereoBleed; WaveInstance->LFEBleed = SoundClassProperties->LFEBleed; WaveInstance->bIsUISound = ActiveSound.bIsUISound || SoundClassProperties->bIsUISound; WaveInstance->bIsMusic = ActiveSound.bIsMusic || SoundClassProperties->bIsMusic; WaveInstance->bCenterChannelOnly = ActiveSound.bCenterChannelOnly || SoundClassProperties->bCenterChannelOnly; WaveInstance->bEQFilterApplied = ActiveSound.bEQFilterApplied || SoundClassProperties->bApplyEffects; WaveInstance->bReverb = ActiveSound.bReverb || SoundClassProperties->bReverb; WaveInstance->OutputTarget = SoundClassProperties->OutputTarget; bAlwaysPlay = ActiveSound.bAlwaysPlay || SoundClassProperties->bAlwaysPlay; } else { WaveInstance->VoiceCenterChannelVolume = 0.f; WaveInstance->RadioFilterVolume = 0.f; WaveInstance->RadioFilterVolumeThreshold = 0.f; WaveInstance->StereoBleed = 0.f; WaveInstance->LFEBleed = 0.f; WaveInstance->bEQFilterApplied = ActiveSound.bEQFilterApplied; WaveInstance->bIsUISound = ActiveSound.bIsUISound; WaveInstance->bIsMusic = ActiveSound.bIsMusic; WaveInstance->bReverb = ActiveSound.bReverb; WaveInstance->bCenterChannelOnly = ActiveSound.bCenterChannelOnly; bAlwaysPlay = ActiveSound.bAlwaysPlay; } WaveInstance->PlayPriority = WaveInstance->Volume + ( bAlwaysPlay ? 1.0f : 0.0f ) + WaveInstance->RadioFilterVolume; WaveInstance->Location = ParseParams.Transform.GetTranslation(); WaveInstance->bIsStarted = true; WaveInstance->bAlreadyNotifiedHook = false; WaveInstance->bUseSpatialization = ParseParams.bUseSpatialization; WaveInstance->WaveData = this; WaveInstance->NotifyBufferFinishedHooks = ParseParams.NotifyBufferFinishedHooks; WaveInstance->LoopingMode = ((bLooping || ParseParams.bLooping) ? LOOP_Forever : LOOP_Never); // Don't add wave instances that are not going to be played at this point. if( WaveInstance->PlayPriority > KINDA_SMALL_NUMBER ) { WaveInstances.Add( WaveInstance ); } // We're still alive. ActiveSound.bFinished = false; // Sanity check if( NumChannels > 2 && WaveInstance->bUseSpatialization && !WaveInstance->bReportedSpatializationWarning) { FString SoundWarningInfo = FString::Printf(TEXT("Spatialisation on stereo and multichannel sounds is not supported. SoundWave: %s"), *GetName()); if (ActiveSound.Sound != this) { SoundWarningInfo += FString::Printf(TEXT(" SoundCue: %s"), *ActiveSound.Sound->GetName()); } if (ActiveSound.AudioComponent.IsValid()) { // TODO - Audio Threading. This log would have to be a task back to game thread AActor* SoundOwner = ActiveSound.AudioComponent->GetOwner(); UE_LOG(LogAudio, Warning, TEXT( "%s Actor: %s AudioComponent: %s" ), *SoundWarningInfo, (SoundOwner ? *SoundOwner->GetName() : TEXT("None")), *ActiveSound.AudioComponent->GetName() ); } else { UE_LOG(LogAudio, Warning, TEXT("%s"), *SoundWarningInfo ); } WaveInstance->bReportedSpatializationWarning = true; } } }
void USoundWave::Parse( FAudioDevice* AudioDevice, const UPTRINT NodeWaveInstanceHash, FActiveSound& ActiveSound, const FSoundParseParameters& ParseParams, TArray<FWaveInstance*>& WaveInstances ) { FWaveInstance* WaveInstance = ActiveSound.FindWaveInstance(NodeWaveInstanceHash); // Create a new WaveInstance if this SoundWave doesn't already have one associated with it. if( WaveInstance == NULL ) { if( !ActiveSound.bRadioFilterSelected ) { ActiveSound.ApplyRadioFilter(ParseParams); } WaveInstance = HandleStart( ActiveSound, NodeWaveInstanceHash); } // Looping sounds are never actually finished if (bLooping || ParseParams.bLooping) { WaveInstance->bIsFinished = false; #if !(NO_LOGGING || UE_BUILD_SHIPPING || UE_BUILD_TEST) if (!ActiveSound.bWarnedAboutOrphanedLooping && ActiveSound.GetAudioComponentID() == 0) { UE_LOG(LogAudio, Warning, TEXT("Detected orphaned looping sound '%s'."), *ActiveSound.GetSound()->GetName()); ActiveSound.bWarnedAboutOrphanedLooping = true; } #endif } // Check for finished paths. if( !WaveInstance->bIsFinished ) { // Propagate properties and add WaveInstance to outgoing array of FWaveInstances. WaveInstance->Volume = ParseParams.Volume * Volume; WaveInstance->VolumeMultiplier = ParseParams.VolumeMultiplier; WaveInstance->VolumeApp = ParseParams.VolumeApp; WaveInstance->Pitch = ParseParams.Pitch * Pitch; WaveInstance->bEnableLowPassFilter = ParseParams.bEnableLowPassFilter; WaveInstance->bIsOccluded = ParseParams.bIsOccluded; WaveInstance->LowPassFilterFrequency = ParseParams.LowPassFilterFrequency; WaveInstance->OcclusionFilterFrequency = ParseParams.OcclusionFilterFrequency; WaveInstance->AttenuationFilterFrequency = ParseParams.AttenuationFilterFrequency; WaveInstance->AmbientZoneFilterFrequency = ParseParams.AmbientZoneFilterFrequency; WaveInstance->bApplyRadioFilter = ActiveSound.bApplyRadioFilter; WaveInstance->StartTime = ParseParams.StartTime; WaveInstance->UserIndex = ActiveSound.UserIndex; WaveInstance->OmniRadius = ParseParams.OmniRadius; WaveInstance->StereoSpread = ParseParams.StereoSpread; WaveInstance->AttenuationDistance = ParseParams.AttenuationDistance; WaveInstance->AbsoluteAzimuth = ParseParams.AbsoluteAzimuth; bool bAlwaysPlay = false; // Properties from the sound class WaveInstance->SoundClass = ParseParams.SoundClass; if (ParseParams.SoundClass) { FSoundClassProperties* SoundClassProperties = AudioDevice->GetSoundClassCurrentProperties(ParseParams.SoundClass); // Use values from "parsed/ propagated" sound class properties WaveInstance->VolumeMultiplier *= SoundClassProperties->Volume; WaveInstance->Pitch *= SoundClassProperties->Pitch; //TODO: Add in HighFrequencyGainMultiplier property to sound classes WaveInstance->VoiceCenterChannelVolume = SoundClassProperties->VoiceCenterChannelVolume; WaveInstance->RadioFilterVolume = SoundClassProperties->RadioFilterVolume * ParseParams.VolumeMultiplier; WaveInstance->RadioFilterVolumeThreshold = SoundClassProperties->RadioFilterVolumeThreshold * ParseParams.VolumeMultiplier; WaveInstance->StereoBleed = SoundClassProperties->StereoBleed; WaveInstance->LFEBleed = SoundClassProperties->LFEBleed; WaveInstance->bIsUISound = ActiveSound.bIsUISound || SoundClassProperties->bIsUISound; WaveInstance->bIsMusic = ActiveSound.bIsMusic || SoundClassProperties->bIsMusic; WaveInstance->bCenterChannelOnly = ActiveSound.bCenterChannelOnly || SoundClassProperties->bCenterChannelOnly; WaveInstance->bEQFilterApplied = ActiveSound.bEQFilterApplied || SoundClassProperties->bApplyEffects; WaveInstance->bReverb = ActiveSound.bReverb || SoundClassProperties->bReverb; WaveInstance->OutputTarget = SoundClassProperties->OutputTarget; if (SoundClassProperties->bApplyAmbientVolumes) { WaveInstance->VolumeMultiplier *= ParseParams.InteriorVolumeMultiplier; WaveInstance->RadioFilterVolume *= ParseParams.InteriorVolumeMultiplier; WaveInstance->RadioFilterVolumeThreshold *= ParseParams.InteriorVolumeMultiplier; } bAlwaysPlay = ActiveSound.bAlwaysPlay || SoundClassProperties->bAlwaysPlay; } else { WaveInstance->VoiceCenterChannelVolume = 0.f; WaveInstance->RadioFilterVolume = 0.f; WaveInstance->RadioFilterVolumeThreshold = 0.f; WaveInstance->StereoBleed = 0.f; WaveInstance->LFEBleed = 0.f; WaveInstance->bEQFilterApplied = ActiveSound.bEQFilterApplied; WaveInstance->bIsUISound = ActiveSound.bIsUISound; WaveInstance->bIsMusic = ActiveSound.bIsMusic; WaveInstance->bReverb = ActiveSound.bReverb; WaveInstance->bCenterChannelOnly = ActiveSound.bCenterChannelOnly; bAlwaysPlay = ActiveSound.bAlwaysPlay; } // If set to bAlwaysPlay, increase the current sound's priority scale by 10x. This will still result in a possible 0-priority output if the sound has 0 actual volume if (bAlwaysPlay) { WaveInstance->Priority = MAX_FLT; } else { WaveInstance->Priority = ParseParams.Priority; } WaveInstance->Location = ParseParams.Transform.GetTranslation(); WaveInstance->bIsStarted = true; WaveInstance->bAlreadyNotifiedHook = false; WaveInstance->bUseSpatialization = ParseParams.bUseSpatialization; WaveInstance->SpatializationAlgorithm = ParseParams.SpatializationAlgorithm; WaveInstance->WaveData = this; WaveInstance->NotifyBufferFinishedHooks = ParseParams.NotifyBufferFinishedHooks; WaveInstance->LoopingMode = ((bLooping || ParseParams.bLooping) ? LOOP_Forever : LOOP_Never); WaveInstance->bIsPaused = ParseParams.bIsPaused; if (AudioDevice->IsHRTFEnabledForAll() && ParseParams.SpatializationAlgorithm == SPATIALIZATION_Default) { WaveInstance->SpatializationAlgorithm = SPATIALIZATION_HRTF; } else { WaveInstance->SpatializationAlgorithm = ParseParams.SpatializationAlgorithm; } // Only append to the wave instances list if we're virtual (always append) or we're audible (non-zero volume) if (WaveInstance->GetVolume() > KINDA_SMALL_NUMBER || (bVirtualizeWhenSilent && AudioDevice->VirtualSoundsEnabled())) { WaveInstances.Add(WaveInstance); } // We're still alive. ActiveSound.bFinished = false; // Sanity check if( NumChannels > 2 && WaveInstance->bUseSpatialization && !WaveInstance->bReportedSpatializationWarning) { static TSet<USoundWave*> ReportedSounds; if (!ReportedSounds.Contains(this)) { FString SoundWarningInfo = FString::Printf(TEXT("Spatialisation on stereo and multichannel sounds is not supported. SoundWave: %s"), *GetName()); if (ActiveSound.GetSound() != this) { SoundWarningInfo += FString::Printf(TEXT(" SoundCue: %s"), *ActiveSound.GetSound()->GetName()); } #if !NO_LOGGING const uint64 AudioComponentID = ActiveSound.GetAudioComponentID(); if (AudioComponentID > 0) { FAudioThread::RunCommandOnGameThread([AudioComponentID, SoundWarningInfo]() { if (UAudioComponent* AudioComponent = UAudioComponent::GetAudioComponentFromID(AudioComponentID)) { AActor* SoundOwner = AudioComponent->GetOwner(); UE_LOG(LogAudio, Warning, TEXT( "%s Actor: %s AudioComponent: %s" ), *SoundWarningInfo, (SoundOwner ? *SoundOwner->GetName() : TEXT("None")), *AudioComponent->GetName() ); } else { UE_LOG(LogAudio, Warning, TEXT("%s"), *SoundWarningInfo ); } }); } else { UE_LOG(LogAudio, Warning, TEXT("%s"), *SoundWarningInfo ); } #endif ReportedSounds.Add(this); } WaveInstance->bReportedSpatializationWarning = true; } } }
void DisplayTimer::Start( float fTime ) { HandleStart( fTime ); }
bool DisplayTimer::OnTrigger(HOBJECT hSender, const CParsedMsg &cMsg) { static CParsedMsg::CToken s_cTok_Start("START"); static CParsedMsg::CToken s_cTok_On("ON"); static CParsedMsg::CToken s_cTok_Add("ADD"); static CParsedMsg::CToken s_cTok_End("END"); static CParsedMsg::CToken s_cTok_Off("OFF"); static CParsedMsg::CToken s_cTok_Kill("KILL"); static CParsedMsg::CToken s_cTok_Pause("PAUSE"); static CParsedMsg::CToken s_cTok_Resume("RESUME"); static CParsedMsg::CToken s_cTok_Team("TEAM"); if ((cMsg.GetArg(0) == s_cTok_Start) || (cMsg.GetArg(0) == s_cTok_On)) { if (cMsg.GetArgCount() > 1) { HandleStart((LTFLOAT)atof(cMsg.GetArg(1))); } } else if (cMsg.GetArg(0) == s_cTok_Add) { if (cMsg.GetArgCount() > 1) { HandleAdd((LTFLOAT)atof(cMsg.GetArg(1))); } } else if ((cMsg.GetArg(0) == s_cTok_End) || (cMsg.GetArg(0) == s_cTok_Off)) { HandleEnd(); } else if (cMsg.GetArg(0) == s_cTok_Kill) { HandleAbort(); } else if (cMsg.GetArg(0) == s_cTok_Pause) { HandlePause(); } else if (cMsg.GetArg(0) == s_cTok_Resume) { HandleResume(); } else if (cMsg.GetArg(0) == s_cTok_Team) { if( cMsg.GetArgCount( ) > 1 ) { uint32 nTeamId = atoi( cMsg.GetArg( 1 )); if( nTeamId < MAX_TEAMS ) { m_nTeamId = nTeamId; } else { m_nTeamId = INVALID_TEAM; } UpdateClients( ); } } else return GameBase::OnTrigger(hSender, cMsg); return true; }