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);
}
Esempio n. 2
0
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);
}
Esempio n. 3
0
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);
}
Esempio n. 4
0
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);
}