public void SetVolume(float volumePercent, AudioChannel channel) { switch (channel) { case AudioChannel.Master: masterVolumePercent = volumePercent; break; case AudioChannel.Sfx: sfxVolumePercent = volumePercent; break; case AudioChannel.Music: musicVolumePercent = volumePercent; break; default: break; } musicSources[0].volume = musicVolumePercent * masterVolumePercent; musicSources[1].volume = musicVolumePercent * masterVolumePercent; PlayerPrefs.SetFloat("master vol", masterVolumePercent); PlayerPrefs.SetFloat("sfx vol", sfxVolumePercent); PlayerPrefs.SetFloat("music vol", musicVolumePercent); PlayerPrefs.Save(); }
public override void TryFire() { if(magazineEmpty) { if(emptyClipAudioChannel != null && emptyClipAudioChannel.AudioAsset == emptyClip && emptyClipAudioChannel.IsPlaying) { return; } emptyClipAudioChannel = audioManager.PlayAt(emptyClip, ((Firearm)Weapon).Position); SetSpatialBlend(emptyClipAudioChannel); } }
public static void StopLoop(AudioClip clip, AudioChannel channel) { AudioSource[] a = GetChannel(channel); for (int i = 0; i < a.Length; i++) { if (!a[i].isPlaying) continue; if (a[i].loop && a[i].clip == clip) { a[i].Stop(); a[i].loop = false; } } }
private static AudioSource[] GetChannel(AudioChannel channel) { switch(channel) { case AudioChannel.Enemy: return enemy; case AudioChannel.Player: return player; case AudioChannel.UI: return ui; default: case AudioChannel.World: return world; } }
protected void Update() { if(player == null || health == null) { player = EntityUtils.GetEntityWithTag("Player"); if(player == null) { return; } health = player.GetHealth(); } if(health.CurrentHealth <= (health.StartingHealth / 4)) { if(audioChannel == null || !audioChannel.IsPlaying) { audioChannel = audioManager.Play(audio); } } }
public void SetVolume(float volumePercent, AudioChannel channel) //볼륨을 설정하는 매소드 { switch (channel) //스위치 구문 채널에따라 볼륨 퍼센트 설정 { case AudioChannel.Master: masterVolumePercent = volumePercent; break; case AudioChannel.Sfx: sfxVolumePercent = volumePercent; break; case AudioChannel.Music: musicVolumePercent = volumePercent; break; } musicSources.volume = musicVolumePercent * masterVolumePercent; PlayerPrefs.SetFloat("master vol", masterVolumePercent); // 마스터 볼륨 퍼센트로 결정 PlayerPrefs.SetFloat("sfx vol", sfxVolumePercent); PlayerPrefs.SetFloat("music vol", musicVolumePercent); PlayerPrefs.Save(); // 볼륨값을 저장 }
public bool PlayWithKnownEmit(AudioChannel channel, CollisionAudioHitMonitor monitor, Vector3 pos, float emit, float pitch) { if (Listener.instance == null) { return(false); } float magnitude = (pos - Listener.instance.transform.position).magnitude; float num = (!(magnitude < 2f)) ? (2f / magnitude) : 1f; float num2 = AudioUtils.DBToValue(compTresholdDB) / num; float num3 = 1f; if (emit > num2) { float num4 = AudioUtils.ValueToDB(emit); float num5 = AudioUtils.ValueToDB(num2); float decibel = (num5 - num4) * (1f - 1f / compRatio); num3 = AudioUtils.DBToValue(decibel); } float num6 = emit * num3; float rms = num6 * AudioUtils.DBToValue(levelDB); return(sampleLib.PlayRMS(channel, pos, rms, pitch)); }
//sets the volumes public void SetVolume(float volumePercent, AudioChannel channel) { switch (channel) { case AudioChannel.Master: masterVolumePercent = volumePercent; break; case AudioChannel.SoundEffect: soundEffectsVolumePercent = volumePercent; break; case AudioChannel.Music: musicVolumePercent = volumePercent; break; } musicSources.volume = musicVolumePercent * masterVolumePercent; // saves the players volume levels PlayerPrefs.SetFloat("Master Vol", masterVolumePercent); PlayerPrefs.SetFloat("SoundEffects Vol", soundEffectsVolumePercent); PlayerPrefs.SetFloat("Music Vol", musicVolumePercent); PlayerPrefs.Save(); }
public void SetVolume(float volumePercent, AudioChannel channel) { switch (channel) { case AudioChannel.Master: masterVolumePercent = volumePercent; break; case AudioChannel.Sfx: sfxVolumePercent = volumePercent; break; case AudioChannel.Music: musicVolumePercent = volumePercent; break; } PlayerPrefs.SetFloat("MasterVolume", masterVolumePercent); PlayerPrefs.SetFloat("SfxVolume", sfxVolumePercent); PlayerPrefs.SetFloat("MusicVolume", musicVolumePercent); PlayerPrefs.Save(); Debug.Log("New volume value for:" + channel + " at:" + volumePercent + " .Channel values: Master:" + masterVolumePercent + " SFX:" + sfxVolumePercent + " Music:" + musicVolumePercent); }
/// <summary> /// Initializes a new instance of the <see cref="AudioPlaybackManager"/> class. /// </summary> /// <param name="gameEngine">The game engine.</param> /// <param name="soundResMan">The sound resource manager.</param> public AudioPlaybackManager(IGameEngine gameEngine, SoundResourceManager soundResMan) { if (gameEngine == null) { throw new ArgumentNullException(nameof(gameEngine)); } if (soundResMan == null) { throw new ArgumentNullException(nameof(soundResMan)); } _gameEngine = gameEngine; _soundResMan = soundResMan; _channels = new AudioChannel[NumChannels]; for (var i = 0; i < NumChannels; i++) { _channels[i] = new AudioChannel(); } _gameEngine.GetService <Engine.Services.IAudioService>().SoundEffectPlayback += OnGameSoundPlayback; }
// Update is called once per frame void Update() { //Play Loop song example if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Keypad1)) { bgm1 = AudioManager.Instance.PlayNewAudioChannel(AudioType.BGM, BGMClip1, loop: true); } //Fade Out then Fade In example if (bgm1 && (Input.GetKeyDown(KeyCode.Alpha2) || Input.GetKeyDown(KeyCode.Keypad2))) { bgm1.FadeOutSound(callbacks : delegate(AudioChannel s) { AudioChannel bgm2 = AudioManager.Instance.NewAudioChannel(AudioType.BGM, BGMClip2, loop: true); bgm2.FadeInSound(); }); } //Fade Out and Fade In Example (CrossFade) if (bgm1 && (Input.GetKeyDown(KeyCode.Alpha3) || Input.GetKeyDown(KeyCode.Keypad3))) { bgm1.FadeOutSound(); AudioChannel bgm2 = AudioManager.Instance.NewAudioChannel(AudioType.BGM, BGMClip2, loop: true); bgm2.FadeInSound(); } //Play SFX example if (Input.GetKeyDown(KeyCode.Alpha4) || Input.GetKeyDown(KeyCode.Keypad4)) { AudioManager.Instance.PlayNewAudioChannel(AudioType.SFX, SFXClip1); } //Play Interrupting sound example if (Input.GetKeyDown(KeyCode.Alpha5) || Input.GetKeyDown(KeyCode.Keypad5)) { AudioManager.Instance.PlayNewAudioChannel(AudioType.SFX, InteruptClip1, interrupts: true); } }
public void Awake() { GameObject channelsParent = new GameObject(); channelsParent.name = "Channels"; channelsParent.transform.parent = transform; channelsParent.transform.position = Vector3.zero; for (int i = 0; i < numberOfChannels; i++) { GameObject newChannel = GameObject.Instantiate(channelTemplate) as GameObject; newChannel.transform.parent = channelsParent.transform; newChannel.transform.position = Vector3.zero; newChannel.name = "AudioChannel " + (i + 1); AudioChannel chan = new AudioChannel(); chan.source = newChannel.GetComponent <AudioSource>(); chan.paused = false; freeChannels.Add(chan); newChannel.SetActive(false); } }
public void SetVolume(float volumePercent, AudioChannel channel) { switch (channel) { case AudioChannel.MASTER: masterVolumePercent = volumePercent; break; case AudioChannel.MUSIC: musicVolumePercent = volumePercent; break; case AudioChannel.SFX: sfxVolumePercent = volumePercent; break; default: break; } PlayerPrefs.SetFloat("Master Volume", masterVolumePercent); PlayerPrefs.SetFloat("Music Volume", musicVolumePercent); PlayerPrefs.SetFloat("SFX Volume", sfxVolumePercent); }
public bool Play(CollisionAudioSensor sensor, AudioChannel channel, CollisionAudioHitMonitor monitor, Vector3 pos, float impulse, float velocity, float volume, float pitch) { float num = impulse / CollisionAudioEngine.instance.unitImpulse; float num2 = velocity / CollisionAudioEngine.instance.unitVelocity; if (num > 1f) { num = (num - 1f) / impulseComp + 1f; } if (num2 > 1f) { num2 = (num2 - 1f) / velocityComp + 1f; } float t = Mathf.InverseLerp(pitch0velocity, pitch1velocity, velocity); pitch *= Mathf.Lerp(pitch0, pitch1, t); float num3 = num * num2 * volume; if (NetGame.isServer || ReplayRecorder.isRecording) { sensor.BroadcastCollisionAudio(this, channel, pos, num3, pitch); } return(PlayWithKnownEmit(channel, monitor, pos, num3, pitch)); }
public void Generate(List<string> p_aryNames, List<string> p_aryLines, string p_strPath, int p_nRate, AudioBitsPerSample p_samples, AudioChannel p_channels) { SpeechAudioFormatInfo t_audioFormatInfo = new SpeechAudioFormatInfo(p_nRate, p_samples, p_channels); SpeechSynthesizer t_synth = new SpeechSynthesizer(); progressBar1.Maximum = p_aryLines.Count; progressBar1.Step = 1; label1.Text = progressBar1.Step + "/" + p_aryNames.Count; for (int t_i = 0; t_i < p_aryNames.Count; ++t_i) { t_synth.SetOutputToWaveFile(p_strPath + "\\" + p_aryNames[t_i] + ".wav"); t_synth.Speak(p_aryLines[t_i]); label1.Text = (t_i + 1) + "/" + p_aryLines.Count; progressBar1.PerformStep(); progressBar1.Refresh(); } t_synth.Dispose(); Close(); }
/// <summary> /// Sets the volume for channel. /// </summary> /// <param name="channel">Channel.</param> /// <param name="volumePercent">Volume percent.</param> public void SetVolume(AudioChannel channel, float volumePercent) { var newVol = Mathf.Clamp(volumePercent, 0, 1f); switch (channel) { case AudioChannel.Master: _masterVolume = newVol; break; case AudioChannel.SFX: _effectsVolume = newVol; break; case AudioChannel.Music: _musicVolume = newVol; break; } if (VolumeChanged != null) { VolumeChanged(); } }
public void SetVolume(float newVolumePercent, AudioChannel channel) { switch (channel) { case AudioChannel.Master: masterVolumePercent = newVolumePercent; break; case AudioChannel.Music: musicVolumePercent = newVolumePercent; break; case AudioChannel.SFX: sfxVolumePercent = newVolumePercent; break; } musicSources[0].volume = musicVolumePercent * masterVolumePercent; musicSources[1].volume = musicVolumePercent * masterVolumePercent; PlayerPrefs.SetFloat("Master Volume", masterVolumePercent); PlayerPrefs.SetFloat("Music Volume", musicVolumePercent); PlayerPrefs.SetFloat("SFX Volume", sfxVolumePercent); PlayerPrefs.Save(); }
public void SetVolume(float volumePercent, AudioChannel channel) { switch (channel) { case AudioChannel.Master: masterVolumePercent = volumePercent; PlayerPrefs.SetFloat("master volume", volumePercent); break; case AudioChannel.Sfx: sfxVolumePercent = volumePercent; PlayerPrefs.SetFloat("sfx volume", volumePercent); break; case AudioChannel.Music: musicVolumePercent = volumePercent; PlayerPrefs.SetFloat("music volume", volumePercent); break; } PlayerPrefs.Save(); musicSources[activeMusicSourceIndex].volume = musicVolumePercent * masterVolumePercent; }
/// <summary> /// Fades the audiochannel in to volume of specified audioasset. /// </summary> /// <returns>The in coroutine.</returns> /// <param name="channelToFadeOut">Channel to fade out.</param> /// <param name="assetForVolume">Asset for volume.</param> /// <param name="callback">Callback.</param> private IEnumerator FadeInCoroutine(AudioChannel channelToFadeOut, AudioAsset assetForVolume, System.Action <AudioAsset> callback = null, AudioAsset callbackParam = null) { bool isFading = true; while (isFading) { if (channelToFadeOut.Volume < assetForVolume.Volume / 100) { channelToFadeOut.Volume += FADESTRENGHT; } else { isFading = false; } yield return(new WaitForEndOfFrame()); } if (callback != null) { callback(callbackParam); } yield break; }
public void SetVolume(float volumePercent, AudioChannel channel) { //Debug.LogFormat("Set Volume {0} : {1}", channel, volumePercent); switch (channel) { case AudioChannel.Master: masterVolumePercent = volumePercent; break; case AudioChannel.Sfx: sfxVolumePercent = volumePercent; break; case AudioChannel.Music: musicVolumePercent = volumePercent; break; } musicSources[0].volume = musicVolumePercent * masterVolumePercent; musicSources[1].volume = musicVolumePercent * masterVolumePercent; PlayerPrefs.SetFloat("master Volume", masterVolumePercent); PlayerPrefs.SetFloat("music Volume", musicVolumePercent); PlayerPrefs.SetFloat("Sfx Volume", sfxVolumePercent); }
public static void SetVolume(AudioChannel channel, float volume) { switch (channel) { case AudioChannel.Ambiental: volumeAmbient = volume; foreach (var source in ambientList) { source.volume = volumeAmbient; } break; case AudioChannel.Music: volumeMusic = volume; if (backgroundMusic) { backgroundMusic.volume = volumeMusic; } break; case AudioChannel.SFX: volumeSFX = volume; break; case AudioChannel.Voice: volumeVoice = volume; foreach (var source in voiceList) { source.volume = volumeVoice; } break; default: break; } }
public static float GetVolume(AudioChannel channel) { if (!initialized) { Init(); } switch (channel) { case AudioChannel.Ambiental: return(volumeAmbient); case AudioChannel.Music: return(volumeMusic); case AudioChannel.SFX: return(volumeSFX); case AudioChannel.Voice: return(volumeVoice); } return(0); }
public void SetVolume(float volumePercent, AudioChannel channel) //function to set volume { switch (channel) { case AudioChannel.Master: //for master channel masterVolumePercent = volumePercent; break; case AudioChannel.Sfx: //for sound effect channel sfxVolumePercent = volumePercent; break; case AudioChannel.Music: //for BGM channel musicVolumePercent = volumePercent; break; } musicSources[0].volume = musicVolumePercent * masterVolumePercent; //make change of the volume if the volume is changed musicSources[1].volume = musicVolumePercent * masterVolumePercent; //make change of the volume if the volume is changed PlayerPrefs.SetFloat("master vol", masterVolumePercent); //determine the setting for master volume; PlayerPrefs.SetFloat("sfx vol", sfxVolumePercent); //determine the setting for sfx volume; PlayerPrefs.SetFloat("music vol", musicVolumePercent); //determine the setting for bgm volume; PlayerPrefs.Save(); //save the setting }
public void SetVolume(float volumePercent, AudioChannel channel) { switch (channel) { case AudioChannel.Master: masterVolumePercent = volumePercent; break; case AudioChannel.Sfx: sfxVolumePercent = volumePercent; break; case AudioChannel.Music: musicVolumePercent = volumePercent; break; } musicSources[0].volume = musicVolumePercent * masterVolumePercent; musicSources[1].volume = musicVolumePercent * masterVolumePercent; PlayerPrefs.SetFloat("master vol", masterVolumePercent); PlayerPrefs.SetFloat("sfx vol", sfxVolumePercent); PlayerPrefs.SetFloat("music vol", musicVolumePercent); }
public void PauseChannel(AudioChannel channel) { _channelCategory[(int)channel].Pause(); }
/// <summary> /// Fades the music channel to no volume over a period of time. /// </summary> /// <param name="duration"></param> public void FadeChannelOut(AudioChannel channel, float duration) { FadeChannelByAmount(channel, duration, 0f); }
private void OnMagazineEmptyEvent(MagazineEmptyEvent evt) { magazineEmpty = true; emptyClipAudioChannel = audioManager.PlayAt(emptyClip, ((Firearm)Weapon).Position); SetSpatialBlend(emptyClipAudioChannel); }
public AudioSource Play(AudioClip clip, Vector3 point, float volume = 1.0f, float pitch = 1.0f, AudioChannel channel = AudioChannel.Master) { if (!IsEnabled && channel != AudioChannel.Music) { return(null); } AudioSource source = CreatePlaySource(clip, point, volume, pitch, channel); Destroy(source.gameObject, clip.length + 1.0f); return(source); }
/// <summary> /// 指定したチャンネル、パスを指定して再生中のAudioInfoを返却する /// </summary> private static AudioInfo GetPlayingAudioInfoWithPath(AudioChannel ch, string path) { var infoList = PlayingChannelMap[ch]; return(infoList.Find(x => x.ResourcePath == path)); }
public PooledAudioSource PoolSource(AudioChannel channel) { return(_component.PoolSource(channel)); }
public static void wavDevDbgPoc(int samplesPerSecond, AudioBitsPerSample bitsPerSample, AudioChannel channel, string file) { file = $"{file}.{bitsPerSample}.{channel}.{samplesPerSecond}.mp3"; using (var synth = new SpeechSynthesizer()) { synth.SetOutputToWaveFile(file, new SpeechAudioFormatInfo(32000, AudioBitsPerSample.Sixteen, AudioChannel.Mono)); var m_SoundPlayer = new System.Media.SoundPlayer(file); var builder = new PromptBuilder(); builder.AppendText($"{bitsPerSample}.{channel}.{samplesPerSecond}"); synth.Speak(builder); m_SoundPlayer.Play(); } }
private async void Tick(object sender, object e) { try { if (startCounter == 10) { startCounter--; startTimer.Stop(); if (beat == 0) { reboot = await ReadStatus(); if (reboot) await WriteStatus(false); await client.LoadQueueAsync(); } AudioDeviceStatus(); startTimer.Start(); text2.Text = startCounter.ToString(); } else if (startCounter == 0) { if (reboot) { startTimer.Stop(); await client.SaveQueueAsync(); reboot = false; LibRPi.HelperClass hc = new LibRPi.HelperClass(); hc.Restart(); } else { text1.Text = "STARTED"; errorText.Text = ""; startTimer.Stop(); audioEngine = new WASAPIEngine(); var channels = new AudioChannel[2] { new AudioChannel(0, 0, ""), new AudioChannel(0, 1, "") }; var devParam = new AudioDevices(channels, 1); var param = new AudioParameters(50000, 200, 50, 250, -50, true, true, "sample.txt", 1000, 212); await audioEngine.InitializeAsync(ThreadDelegate, devParam, param); } } else { text2.Text = startCounter.ToString(); startCounter--; } } catch (Exception ex) { Error("Tick: " + ex.ToString() + " " + ex.Message + " " + ex.HResult); } }
private VideoMediaInfo GetVideoMetadata(int width, int height, string container, string videoCodec, int videoBps, string videoKeyFrame, double videoFps, string audioCodec, int audioBps, long fileSize, int duration, AudioChannel audioChannel, string audioProfile, string videoFormatProfile = null) { var metadata = new VideoMediaInfo { AudioBitRate = audioBps, AudioFormat = audioCodec, AudioChannels = (int) audioChannel, AudioFormatProfile = audioProfile, GeneralFormat = container, VideoDuration = duration, GeneralFileSize = fileSize, VideoHeight = height, VideoBitRate = videoBps, VideoFormat = videoCodec, VideoFrameRate = videoFps, VideoFormatSettingsGOP = videoKeyFrame, VideoFormatProfile = videoFormatProfile, VideoWidth = width }; return metadata; }
private IEnumerator PlayNaughtyGoatAudioDelayed() { yield return new WaitForSeconds(0.15f); naughtyGoatAudioChannel = audioManager.Play(naughtyGoatAudio); naughtyGoatAudioChannel.Volume = 0.5f; }
public static void LoopSound(AudioClip clip, AudioChannel channel) { PlaySound(clip, channel, true); }
private static AudioSource GetSourcePlaying(AudioClip clip, AudioChannel channel) { AudioSource[] c = GetChannel(channel); for (int i = 0; i < c.Length; i++) { if (!c[i].isPlaying) continue; if (c[i].clip == clip) return c[i]; } return null; }
public static void FadeTo(AudioChannel channel, float time, float volume, Ease ease = Ease.Linear) { DOTween.To(() => channel.AudioSource.volume, a => channel.AudioSource.volume = a, volume, time).SetEase(ease); }
private void SetupAllMediaInfoParams(int width, int height, string container, string videoCodec, int videoBps, int videoKeyFrame, double videoFps, string audioCodec, int audioBps, long fileSize, int duration, AudioChannel audioChannel,string audioProfile, string videoFormatProfile = null) { _mockMediaInfo.Setup(SetupMediaInfoParam(MediaInfoParams.VideoWidth)).Returns(width.ToString); _mockMediaInfo.Setup(SetupMediaInfoParam(MediaInfoParams.VideHeight)).Returns(height.ToString); _mockMediaInfo.Setup(SetupMediaInfoParam(MediaInfoParams.Container)).Returns(container); _mockMediaInfo.Setup(SetupMediaInfoParam(MediaInfoParams.VideoCodec)).Returns(videoCodec); _mockMediaInfo.Setup(SetupMediaInfoParam(MediaInfoParams.VideoBps)).Returns(videoBps.ToString); _mockMediaInfo.Setup(SetupMediaInfoParam(MediaInfoParams.VideoKeyFrame)).Returns(videoKeyFrame.ToString); _mockMediaInfo.Setup(SetupMediaInfoParam(MediaInfoParams.VideoFps)).Returns(videoFps.ToString); _mockMediaInfo.Setup(SetupMediaInfoParam(MediaInfoParams.VideoFormatProfile)).Returns(videoFormatProfile); _mockMediaInfo.Setup(SetupMediaInfoParam(MediaInfoParams.FileSize)).Returns(fileSize.ToString); _mockMediaInfo.Setup(SetupMediaInfoParam(MediaInfoParams.Duration)).Returns(duration.ToString); _mockMediaInfo.Setup(SetupMediaInfoParam(MediaInfoParams.AudioCodec)).Returns(audioCodec); _mockMediaInfo.Setup(SetupMediaInfoParam(MediaInfoParams.AudioBps)).Returns(audioBps.ToString); _mockMediaInfo.Setup(SetupMediaInfoParam(MediaInfoParams.AudioChannel)).Returns(((int)audioChannel).ToString); _mockMediaInfo.Setup(SetupMediaInfoParam(MediaInfoParams.AudioProfile)).Returns(audioProfile.ToString); }
public static void FadeIn(AudioChannel channel, float time, Ease ease = Ease.Linear) { FadeTo(channel, time, 1, ease); }
private static AudioInfo GetPlayingAudioInfo(AudioChannel ch, int playingId) { var infoList = PlayingChannelMap[ch]; return(infoList.Find(x => x.PlayingId == playingId)); }
public AudioSource PlayLoop(AudioClip clip, float volume = 1.0f, float pitch = 1.0f, AudioChannel channel = AudioChannel.Master) { AudioSource source = CreatePlaySource(clip, Vector3.zero, volume, pitch, channel); source.loop = true; return(source); }
private static List <AudioInfo> GetPlayingAudioInfoList(AudioChannel ch) { return(PlayingChannelMap[ch]); }
AudioSource CreatePlaySource(AudioClip clip, Vector3 point, float volume, float pitch, AudioChannel channel) { GameObject go = new GameObject("Audio: " + clip.name); go.transform.position = point; AudioSource source = AddAudioSource(go, clip, volume, pitch, channel); source.Play(); return(source); }
public AudioSource PlayLoop(AudioClip clip, Transform emitter, float volume = 1.0f, float pitch = 1.0f, AudioChannel channel = AudioChannel.Master) { AudioSource source = CreatePlaySource(clip, emitter, volume, pitch, channel); source.loop = true; return(source); }
public static void PlaySound(AudioClip clip, AudioChannel channel) { PlaySound(clip, channel, false); }
AudioSource CreatePlaySource(AudioClip clip, Transform emitter, float volume, float pitch, AudioChannel channel) { GameObject go = new GameObject("Audio: " + clip.name); go.transform.position = emitter.position; go.transform.parent = emitter; AudioSource source = AddAudioSource(go, clip, volume, pitch, channel); source.Play(); return(source); }
private void InitializeConversation() { //saves the AVModality, AudioChannel and VideoChannel, just for the sake of readability avModality = (AVModality)conversation.Modalities[ModalityTypes.AudioVideo]; audioChannel = avModality.AudioChannel; videoChannel = avModality.VideoChannel; // TODO: fix the UI //show the current conversation and modality states in the UI this.SetConversationStatus(conversation.State.ToString()); this.SetModalityStatus(avModality.State.ToString()); this.SetAudioStatus("Disconnected"); this.SetVideoStatus("Disconnected"); //registers for conversation state updates conversation.StateChanged += this.ConversationStateChanged; //subscribes to modality action availability events (all audio button except DTMF) avModality.ActionAvailabilityChanged += this.AvModalityActionAvailabilityChanged; //subscribes to the modality state changes so that the status bar gets updated with the new state avModality.ModalityStateChanged += this.AvModalityModalityStateChanged; //subscribes to the video channel state changes so that the status bar gets updated with the new state audioChannel.StateChanged += this.AudioChannelStateChanged; //subscribes to the video channel state changes so that the video feed can be presented videoChannel.StateChanged += this.VideoChannelStateChanged; }
AudioSource AddAudioSource(GameObject go, AudioClip clip, float volume, float pitch, AudioChannel channel) { AudioSource source = go.AddComponent <AudioSource>(); source.clip = clip; source.volume = volume; source.pitch = pitch; source.outputAudioMixerGroup = GetAudioMixer(channel); return(source); }
public void MuteChannel(AudioChannel channel) { _channelMuted[(int)channel] = true; _channelCategory[(int)channel].SetVolume(0f); }
public void FadeChannelByAmount(AudioChannel channel, float duration, float amount) { _channelGoalVolume[(int)channel] = MathHelper.Clamp(amount, 0f, 1f); _channelFadeDuration[(int)channel] = duration; _channelFading[(int)channel] = true; }
public void SetChannelVolume(AudioChannel channel, float amount) { _channelVolume[(int)channel] = amount; _channelCategory[(int)channel].SetVolume(amount); }
public void ResumeChannel(AudioChannel channel) { _channelCategory[(int)channel].Resume(); }
private static void PlaySound(AudioClip clip, AudioChannel channel, bool loop) { AudioSource a = GetFreeSource(GetChannel(channel)); a.loop = loop; a.clip = clip; a.Play(); }
public void UnMuteChannel(AudioChannel channel) { _channelMuted[(int)channel] = false; _channelCategory[(int)channel].SetVolume(_channelVolume[(int)channel]); }
public float GetDefaultVolume(AudioChannel audioChannel) { return(_audioChannelConfigs .First(config => config.AudioChannel == audioChannel) .DefaultVolume); }
private VideoMetadata GetVideoMetadata(int width, int height, string container, string videoCodec, int videoBps, int videoKeyFrame, double videoFps, string audioCodec, int audioBps, long fileSize, int duration, AudioChannel audioChannel,string audioProfile, string videoFormatProfile = null) { var metadata = new VideoMetadata() { AudioBps = audioBps, AudioCodec = audioCodec, AudioChannel=audioChannel, AudioProfile=audioProfile, Container = container, Duration = duration, FileSize = fileSize, Height = height, VideoBps = videoBps, VideoCodec = videoCodec, VideoFps = videoFps, VideoKeyFrame = videoKeyFrame, VideoProfile = videoFormatProfile, Width = width }; return metadata; }
private void SetSpatialBlend(AudioChannel audioChannel) { switch(mode) { case Mode.TwoD: audioChannel.SpatialBlend = 0; break; case Mode.ThreeD: audioChannel.SpatialBlend = 1; break; } }