void AudioDestinationNode::InputMuted(bool aMuted) { MOZ_ASSERT(Context() && !Context()->IsOffline()); if (!mAudioChannelAgent) { if (aMuted) { return; } CreateAudioChannelAgent(); } if (aMuted) { mAudioChannelAgent->NotifyStoppedPlaying(); return; } AudioPlaybackConfig config; nsresult rv = mAudioChannelAgent->NotifyStartedPlaying(&config, AudioChannelService::AudibleState::eAudible); if (NS_WARN_IF(NS_FAILED(rv))) { return; } WindowVolumeChanged(config.mVolume, config.mMuted); WindowSuspendChanged(config.mSuspend); }
void AudioDestinationNode::InputMuted(bool aMuted) { MOZ_ASSERT(Context() && !Context()->IsOffline()); if (!mAudioChannelAgent) { if (aMuted) { return; } CreateAudioChannelAgent(); } if (aMuted) { mAudioChannelAgent->NotifyStoppedPlaying(); return; } float volume = 0.0; bool muted = true; nsresult rv = mAudioChannelAgent->NotifyStartedPlaying(&volume, &muted); if (NS_WARN_IF(NS_FAILED(rv))) { return; } WindowVolumeChanged(volume, muted); }
void nsSpeechTask::CreateAudioChannelAgent() { if (!mUtterance) { return; } if (mAudioChannelAgent) { mAudioChannelAgent->NotifyStoppedPlaying(); } mAudioChannelAgent = new AudioChannelAgent(); mAudioChannelAgent->InitWithWeakCallback(mUtterance->GetOwner(), static_cast<int32_t>(AudioChannelService::GetDefaultAudioChannel()), this); AudioPlaybackConfig config; nsresult rv = mAudioChannelAgent->NotifyStartedPlaying(&config, AudioChannelService::AudibleState::eAudible); if (NS_WARN_IF(NS_FAILED(rv))) { return; } WindowVolumeChanged(config.mVolume, config.mMuted); WindowSuspendChanged(config.mSuspend); }
void nsSpeechTask::CreateAudioChannelAgent() { if (!mUtterance) { return; } if (mAudioChannelAgent) { mAudioChannelAgent->NotifyStoppedPlaying(nsIAudioChannelAgent::AUDIO_AGENT_NOTIFY); } mAudioChannelAgent = new AudioChannelAgent(); mAudioChannelAgent->InitWithWeakCallback(mUtterance->GetOwner(), static_cast<int32_t>(AudioChannelService::GetDefaultAudioChannel()), this); float volume = 0.0f; bool muted = true; mAudioChannelAgent->NotifyStartedPlaying(nsIAudioChannelAgent::AUDIO_AGENT_NOTIFY, &volume, &muted); WindowVolumeChanged(volume, muted); }