/// <inheritdoc/> void IAudioHandler.OnAudioStreamStarted(IWebBrowser chromiumWebBrowser, IBrowser browser, AudioParameters parameters, int channels) { OnAudioStreamStarted(chromiumWebBrowser, browser, parameters, channels); }
public InPlayer PlayConnectedTo(GameObject controllingObject, InAudioNode audioNode, GameObject attachedTo, AudioParameters audioParameters, float fade = 0f, LeanTweenType fadeType = LeanTweenType.notUsed) { if (audioNode.IsRootOrFolder) { Debug.LogWarning("InAudio: Cannot play \""+audioNode.GetName+"\" as it is a folder"); return null; } List<InstanceInfo> currentInstances = audioNode.CurrentInstances; if (!AllowedStealing(audioNode, currentInstances)) { return null; } var runtimePlayer = InAudioInstanceFinder.RuntimePlayerControllerPool.GetObject(); if (runtimePlayer == null) { Debug.LogWarning("InAudio: A pooled objected was not initialized. Try to restart play mode. If the problem persists, please submit a bug report."); } currentInstances.Add(new InstanceInfo(AudioSettings.dspTime, runtimePlayer)); runtimePlayer.transform.parent = attachedTo.transform; runtimePlayer.transform.localPosition = new Vector3(); Play(controllingObject, audioNode, runtimePlayer, fade, fadeType, audioParameters); return runtimePlayer; }
public AudioQueueMediaStreamSource(IAudioQueue queue, AudioParameters parameters, TimeSpan trackDuration) { if (q == null) throw new ArgumentNullException ("queue"); parameters = parameters ?? AudioParameters.Default; this.q = queue; track_duration = trackDuration; }
/// <summary> /// Play an audio node directly /// </summary> /// <param name="gameObject">The game object to attach to and be controlled by</param> /// <param name="audioNode">The node to play</param> /// <param name="parameters">Parameters to set initial values directly</param> /// <returns>A controller for the playing node</returns> public static InPlayer Play(GameObject gameObject, InAudioNode audioNode, AudioParameters parameters = null) { if (instance != null && gameObject != null && audioNode != null) return instance._inAudioEventWorker.PlayConnectedTo(gameObject, audioNode, gameObject, parameters); else InDebug.MissingArguments("Play", gameObject, audioNode); return null; }
public AudioParameters(AudioParameters parameters) { volume = parameters.volume; pitch = parameters.pitch; stereoPan = parameters.stereoPan; spatialBlend = parameters.spatialBlend; audioMixer = parameters.audioMixer; setMixer = parameters.setMixer; }
/// <summary> /// Set audiosource values from parameters. Note that Pitch is first applied on the next audioclip (looping). /// </summary> /// <param name="parameters"></param> public void SetFromAudioParameters(AudioParameters parameters) { audioParameters.CopyFrom(parameters); for (int i = 0; i < audioSources.Count; i++) { audioSources[i].AudioSource.spatialBlend = parameters.SpatialBlend; audioSources[i].AudioSource.panStereo = parameters.StereoPan; SetVolume(audioSources[i], parameters.Volume); if (parameters.SetMixer) { audioSources[i].AudioSource.outputAudioMixerGroup = parameters.AudioMixer; } } }
public InPlayer PlayAtPosition(GameObject controllingObject, InAudioNode audioNode, Vector3 position, AudioParameters audioParameters, float fade = 0f, LeanTweenType fadeType = LeanTweenType.notUsed) { if (audioNode.IsRootOrFolder) { Debug.LogWarning("InAudio: Cannot play \"" + audioNode.GetName + "\" as it is a folder"); return null; } List<InstanceInfo> currentInstances = audioNode.CurrentInstances; if (!AllowedStealing(audioNode, currentInstances)) return null; var runtimePlayer = InAudioInstanceFinder.RuntimePlayerControllerPool.GetObject(); runtimePlayer.transform.position = position; currentInstances.Add(new InstanceInfo(AudioSettings.dspTime, runtimePlayer)); Play(controllingObject, audioNode, runtimePlayer, fade, fadeType, audioParameters); return runtimePlayer; }
public void TriggerParameters(AudioParameters parameter, float value) { for (int i = 0; i < Emitters.Length; i++) { var emitterRef = Emitters[i]; if (emitterRef.Target != null && emitterRef.Target.EventInstance.isValid()) { for (int j = 0; j < Emitters[i].Params.Length; j++) { if (Emitters[i].Params[j].Name == parameter.ToString()) { Emitters[i].Params[j].Value = value; emitterRef.Target.EventInstance.setParameterByID(Emitters[i].Params[(int)parameter].ID, Emitters[i].Params[j].Value); } } } } TriggerParameters(); }
private void PlayFollowing(GameObject controllingObject,InAudioNode audioNode, InPlayer player, float fade, LeanTweenType fadeType, AudioParameters parameters) { var runtimeInfo = PreparePlay(controllingObject, audioNode, player); player._internalPlayFollowing(audioNode, controllingObject, runtimeInfo, fade, fadeType, parameters); }
public InPlayer PlayAtPosition(GameObject controllingObject, InAudioNode audioNode, Vector3 position, AudioParameters audioParameters, float fade = 0f, LeanTweenType fadeType = LeanTweenType.notUsed) { if (audioNode.IsRootOrFolder) { Debug.LogWarning("InAudio: Cannot play \"" + audioNode.GetName + "\" as it is a folder"); return(null); } List <InstanceInfo> currentInstances = audioNode.CurrentInstances; if (!AllowedStealing(audioNode, currentInstances)) { return(null); } var runtimePlayer = InAudioInstanceFinder.RuntimePlayerControllerPool.GetObject(); runtimePlayer.transform.position = position; currentInstances.Add(new InstanceInfo(AudioSettings.dspTime, runtimePlayer)); Play(controllingObject, audioNode, runtimePlayer, fade, fadeType, audioParameters); return(runtimePlayer); }
public IRequest Marshall(CreatePresetRequest createPresetRequest) { IRequest request = new DefaultRequest(createPresetRequest, "AmazonElasticTranscoder"); string target = "EtsCustomerService.CreatePreset"; request.Headers["X-Amz-Target"] = target; request.Headers["Content-Type"] = "application/x-amz-json-1.0"; request.HttpMethod = "POST"; string uriResourcePath = "2012-09-25/presets"; if (uriResourcePath.Contains("?")) { string queryString = uriResourcePath.Substring(uriResourcePath.IndexOf("?") + 1); uriResourcePath = uriResourcePath.Substring(0, uriResourcePath.IndexOf("?")); foreach (string s in queryString.Split('&', ';')) { string[] nameValuePair = s.Split('='); if (nameValuePair.Length == 2 && nameValuePair[1].Length > 0) { request.Parameters.Add(nameValuePair[0], nameValuePair[1]); } else { request.Parameters.Add(nameValuePair[0], null); } } } request.ResourcePath = uriResourcePath; using (StringWriter stringWriter = new StringWriter()) { JsonWriter writer = new JsonWriter(stringWriter); writer.WriteObjectStart(); if (createPresetRequest != null && createPresetRequest.IsSetName()) { writer.WritePropertyName("Name"); writer.Write(createPresetRequest.Name); } if (createPresetRequest != null && createPresetRequest.IsSetDescription()) { writer.WritePropertyName("Description"); writer.Write(createPresetRequest.Description); } if (createPresetRequest != null && createPresetRequest.IsSetContainer()) { writer.WritePropertyName("Container"); writer.Write(createPresetRequest.Container); } if (createPresetRequest != null) { VideoParameters video = createPresetRequest.Video; if (video != null) { writer.WritePropertyName("Video"); writer.WriteObjectStart(); if (video != null && video.IsSetCodec()) { writer.WritePropertyName("Codec"); writer.Write(video.Codec); } if (video != null) { if (video.CodecOptions != null && video.CodecOptions.Count > 0) { writer.WritePropertyName("CodecOptions"); writer.WriteObjectStart(); foreach (string videoCodecOptionsKey in video.CodecOptions.Keys) { string codecOptionsListValue; bool codecOptionsListValueHasValue = video.CodecOptions.TryGetValue(videoCodecOptionsKey, out codecOptionsListValue); writer.WritePropertyName(videoCodecOptionsKey); writer.Write(codecOptionsListValue); } writer.WriteObjectEnd(); } } if (video != null && video.IsSetKeyframesMaxDist()) { writer.WritePropertyName("KeyframesMaxDist"); writer.Write(video.KeyframesMaxDist); } if (video != null && video.IsSetFixedGOP()) { writer.WritePropertyName("FixedGOP"); writer.Write(video.FixedGOP); } if (video != null && video.IsSetBitRate()) { writer.WritePropertyName("BitRate"); writer.Write(video.BitRate); } if (video != null && video.IsSetFrameRate()) { writer.WritePropertyName("FrameRate"); writer.Write(video.FrameRate); } if (video != null && video.IsSetResolution()) { writer.WritePropertyName("Resolution"); writer.Write(video.Resolution); } if (video != null && video.IsSetAspectRatio()) { writer.WritePropertyName("AspectRatio"); writer.Write(video.AspectRatio); } if (video != null && video.IsSetMaxWidth()) { writer.WritePropertyName("MaxWidth"); writer.Write(video.MaxWidth); } if (video != null && video.IsSetMaxHeight()) { writer.WritePropertyName("MaxHeight"); writer.Write(video.MaxHeight); } if (video != null && video.IsSetDisplayAspectRatio()) { writer.WritePropertyName("DisplayAspectRatio"); writer.Write(video.DisplayAspectRatio); } if (video != null && video.IsSetSizingPolicy()) { writer.WritePropertyName("SizingPolicy"); writer.Write(video.SizingPolicy); } if (video != null && video.IsSetPaddingPolicy()) { writer.WritePropertyName("PaddingPolicy"); writer.Write(video.PaddingPolicy); } writer.WriteObjectEnd(); } } if (createPresetRequest != null) { AudioParameters audio = createPresetRequest.Audio; if (audio != null) { writer.WritePropertyName("Audio"); writer.WriteObjectStart(); if (audio != null && audio.IsSetCodec()) { writer.WritePropertyName("Codec"); writer.Write(audio.Codec); } if (audio != null && audio.IsSetSampleRate()) { writer.WritePropertyName("SampleRate"); writer.Write(audio.SampleRate); } if (audio != null && audio.IsSetBitRate()) { writer.WritePropertyName("BitRate"); writer.Write(audio.BitRate); } if (audio != null && audio.IsSetChannels()) { writer.WritePropertyName("Channels"); writer.Write(audio.Channels); } writer.WriteObjectEnd(); } } if (createPresetRequest != null) { Thumbnails thumbnails = createPresetRequest.Thumbnails; if (thumbnails != null) { writer.WritePropertyName("Thumbnails"); writer.WriteObjectStart(); if (thumbnails != null && thumbnails.IsSetFormat()) { writer.WritePropertyName("Format"); writer.Write(thumbnails.Format); } if (thumbnails != null && thumbnails.IsSetInterval()) { writer.WritePropertyName("Interval"); writer.Write(thumbnails.Interval); } if (thumbnails != null && thumbnails.IsSetResolution()) { writer.WritePropertyName("Resolution"); writer.Write(thumbnails.Resolution); } if (thumbnails != null && thumbnails.IsSetAspectRatio()) { writer.WritePropertyName("AspectRatio"); writer.Write(thumbnails.AspectRatio); } if (thumbnails != null && thumbnails.IsSetMaxWidth()) { writer.WritePropertyName("MaxWidth"); writer.Write(thumbnails.MaxWidth); } if (thumbnails != null && thumbnails.IsSetMaxHeight()) { writer.WritePropertyName("MaxHeight"); writer.Write(thumbnails.MaxHeight); } if (thumbnails != null && thumbnails.IsSetSizingPolicy()) { writer.WritePropertyName("SizingPolicy"); writer.Write(thumbnails.SizingPolicy); } if (thumbnails != null && thumbnails.IsSetPaddingPolicy()) { writer.WritePropertyName("PaddingPolicy"); writer.Write(thumbnails.PaddingPolicy); } writer.WriteObjectEnd(); } } writer.WriteObjectEnd(); string snippet = stringWriter.ToString(); request.Content = System.Text.Encoding.UTF8.GetBytes(snippet); } return(request); }
public IRequest Marshall(CreatePresetRequest createPresetRequest) { IRequest request = new DefaultRequest(createPresetRequest, "AmazonElasticTranscoder"); string target = "EtsCustomerService.CreatePreset"; request.Headers["X-Amz-Target"] = target; request.Headers["Content-Type"] = "application/x-amz-json-1.0"; request.HttpMethod = "POST"; string uriResourcePath = "2012-09-25/presets"; request.ResourcePath = uriResourcePath; using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture)) { JsonWriter writer = new JsonWriter(stringWriter); writer.WriteObjectStart(); if (createPresetRequest != null && createPresetRequest.IsSetName()) { writer.WritePropertyName("Name"); writer.Write(createPresetRequest.Name); } if (createPresetRequest != null && createPresetRequest.IsSetDescription()) { writer.WritePropertyName("Description"); writer.Write(createPresetRequest.Description); } if (createPresetRequest != null && createPresetRequest.IsSetContainer()) { writer.WritePropertyName("Container"); writer.Write(createPresetRequest.Container); } if (createPresetRequest != null) { VideoParameters video = createPresetRequest.Video; if (video != null) { writer.WritePropertyName("Video"); writer.WriteObjectStart(); if (video != null && video.IsSetCodec()) { writer.WritePropertyName("Codec"); writer.Write(video.Codec); } if (video != null) { if (video.CodecOptions != null && video.CodecOptions.Count > 0) { writer.WritePropertyName("CodecOptions"); writer.WriteObjectStart(); foreach (string videoCodecOptionsKey in video.CodecOptions.Keys) { string codecOptionsListValue; bool codecOptionsListValueHasValue = video.CodecOptions.TryGetValue(videoCodecOptionsKey, out codecOptionsListValue); writer.WritePropertyName(videoCodecOptionsKey); writer.Write(codecOptionsListValue); } writer.WriteObjectEnd(); } } if (video != null && video.IsSetKeyframesMaxDist()) { writer.WritePropertyName("KeyframesMaxDist"); writer.Write(video.KeyframesMaxDist); } if (video != null && video.IsSetFixedGOP()) { writer.WritePropertyName("FixedGOP"); writer.Write(video.FixedGOP); } if (video != null && video.IsSetBitRate()) { writer.WritePropertyName("BitRate"); writer.Write(video.BitRate); } if (video != null && video.IsSetFrameRate()) { writer.WritePropertyName("FrameRate"); writer.Write(video.FrameRate); } if (video != null && video.IsSetMaxFrameRate()) { writer.WritePropertyName("MaxFrameRate"); writer.Write(video.MaxFrameRate); } if (video != null && video.IsSetResolution()) { writer.WritePropertyName("Resolution"); writer.Write(video.Resolution); } if (video != null && video.IsSetAspectRatio()) { writer.WritePropertyName("AspectRatio"); writer.Write(video.AspectRatio); } if (video != null && video.IsSetMaxWidth()) { writer.WritePropertyName("MaxWidth"); writer.Write(video.MaxWidth); } if (video != null && video.IsSetMaxHeight()) { writer.WritePropertyName("MaxHeight"); writer.Write(video.MaxHeight); } if (video != null && video.IsSetDisplayAspectRatio()) { writer.WritePropertyName("DisplayAspectRatio"); writer.Write(video.DisplayAspectRatio); } if (video != null && video.IsSetSizingPolicy()) { writer.WritePropertyName("SizingPolicy"); writer.Write(video.SizingPolicy); } if (video != null && video.IsSetPaddingPolicy()) { writer.WritePropertyName("PaddingPolicy"); writer.Write(video.PaddingPolicy); } if (video != null && video.Watermarks != null && video.Watermarks.Count > 0) { List <PresetWatermark> watermarksList = video.Watermarks; writer.WritePropertyName("Watermarks"); writer.WriteArrayStart(); foreach (PresetWatermark watermarksListValue in watermarksList) { writer.WriteObjectStart(); if (watermarksListValue != null && watermarksListValue.IsSetId()) { writer.WritePropertyName("Id"); writer.Write(watermarksListValue.Id); } if (watermarksListValue != null && watermarksListValue.IsSetMaxWidth()) { writer.WritePropertyName("MaxWidth"); writer.Write(watermarksListValue.MaxWidth); } if (watermarksListValue != null && watermarksListValue.IsSetMaxHeight()) { writer.WritePropertyName("MaxHeight"); writer.Write(watermarksListValue.MaxHeight); } if (watermarksListValue != null && watermarksListValue.IsSetSizingPolicy()) { writer.WritePropertyName("SizingPolicy"); writer.Write(watermarksListValue.SizingPolicy); } if (watermarksListValue != null && watermarksListValue.IsSetHorizontalAlign()) { writer.WritePropertyName("HorizontalAlign"); writer.Write(watermarksListValue.HorizontalAlign); } if (watermarksListValue != null && watermarksListValue.IsSetHorizontalOffset()) { writer.WritePropertyName("HorizontalOffset"); writer.Write(watermarksListValue.HorizontalOffset); } if (watermarksListValue != null && watermarksListValue.IsSetVerticalAlign()) { writer.WritePropertyName("VerticalAlign"); writer.Write(watermarksListValue.VerticalAlign); } if (watermarksListValue != null && watermarksListValue.IsSetVerticalOffset()) { writer.WritePropertyName("VerticalOffset"); writer.Write(watermarksListValue.VerticalOffset); } if (watermarksListValue != null && watermarksListValue.IsSetOpacity()) { writer.WritePropertyName("Opacity"); writer.Write(watermarksListValue.Opacity); } if (watermarksListValue != null && watermarksListValue.IsSetTarget()) { writer.WritePropertyName("Target"); writer.Write(watermarksListValue.Target); } writer.WriteObjectEnd(); } writer.WriteArrayEnd(); } writer.WriteObjectEnd(); } } if (createPresetRequest != null) { AudioParameters audio = createPresetRequest.Audio; if (audio != null) { writer.WritePropertyName("Audio"); writer.WriteObjectStart(); if (audio != null && audio.IsSetCodec()) { writer.WritePropertyName("Codec"); writer.Write(audio.Codec); } if (audio != null && audio.IsSetSampleRate()) { writer.WritePropertyName("SampleRate"); writer.Write(audio.SampleRate); } if (audio != null && audio.IsSetBitRate()) { writer.WritePropertyName("BitRate"); writer.Write(audio.BitRate); } if (audio != null && audio.IsSetChannels()) { writer.WritePropertyName("Channels"); writer.Write(audio.Channels); } if (audio != null) { AudioCodecOptions codecOptions = audio.CodecOptions; if (codecOptions != null) { writer.WritePropertyName("CodecOptions"); writer.WriteObjectStart(); if (codecOptions != null && codecOptions.IsSetProfile()) { writer.WritePropertyName("Profile"); writer.Write(codecOptions.Profile); } writer.WriteObjectEnd(); } } writer.WriteObjectEnd(); } } if (createPresetRequest != null) { Thumbnails thumbnails = createPresetRequest.Thumbnails; if (thumbnails != null) { writer.WritePropertyName("Thumbnails"); writer.WriteObjectStart(); if (thumbnails != null && thumbnails.IsSetFormat()) { writer.WritePropertyName("Format"); writer.Write(thumbnails.Format); } if (thumbnails != null && thumbnails.IsSetInterval()) { writer.WritePropertyName("Interval"); writer.Write(thumbnails.Interval); } if (thumbnails != null && thumbnails.IsSetResolution()) { writer.WritePropertyName("Resolution"); writer.Write(thumbnails.Resolution); } if (thumbnails != null && thumbnails.IsSetAspectRatio()) { writer.WritePropertyName("AspectRatio"); writer.Write(thumbnails.AspectRatio); } if (thumbnails != null && thumbnails.IsSetMaxWidth()) { writer.WritePropertyName("MaxWidth"); writer.Write(thumbnails.MaxWidth); } if (thumbnails != null && thumbnails.IsSetMaxHeight()) { writer.WritePropertyName("MaxHeight"); writer.Write(thumbnails.MaxHeight); } if (thumbnails != null && thumbnails.IsSetSizingPolicy()) { writer.WritePropertyName("SizingPolicy"); writer.Write(thumbnails.SizingPolicy); } if (thumbnails != null && thumbnails.IsSetPaddingPolicy()) { writer.WritePropertyName("PaddingPolicy"); writer.Write(thumbnails.PaddingPolicy); } writer.WriteObjectEnd(); } } writer.WriteObjectEnd(); string snippet = stringWriter.ToString(); request.Content = System.Text.Encoding.UTF8.GetBytes(snippet); } return(request); }
public void _internalPlayFollowing(InAudioNode node, GameObject controllingObject, RuntimeInfo playingInfo, float fade, LeanTweenType fadeType, AudioParameters parameters) { this.toFollow = controllingObject.transform; internalUpdate(); _internalPlay(node, controllingObject, playingInfo, fade, fadeType, parameters); }
/// <summary> /// Internal InAudio play method. Please use InAudio.Play(...) to play audio /// </summary> public void _internalPlay(InAudioNode node, GameObject controllingObject, RuntimeInfo playingInfo, float fade, LeanTweenType fadeType, AudioParameters parameters) { if (node.IsRootOrFolder) { Debug.LogWarning("InAudio: Cannot play Folder node \"" + node.Name + "\""); return; } if (audioParameters == null) { audioParameters = new AudioParameters(); } if (parameters != null) { audioParameters.CopyFrom(parameters); } else { audioParameters.Reset(); } dspPool = InAudioInstanceFinder.DSPTimePool; breakLoop = false; controlling = controllingObject; ParentBeforeFolder = TreeWalker.FindParentBeforeFolder(node); ParentFolder = ParentBeforeFolder._parent._nodeData as InFolderData; folderVolume = 1.0f; if (ParentFolder != null) { folderVolume = ParentFolder.runtimeVolume; ParentFolder.runtimePlayers.Add(this); } //This is to queue the next playing node, as the first clip will not yield a waitforseconds //firstClip = true; runtimeInfo = playingInfo; PlayingNode = node; DSPTime time = dspPool.GetObject(); time.CurrentEndTime = AudioSettings.dspTime; isActive = true; fadeVolume = 1f; _spread = 0.0f; if (fade > 0) { LTDescr tweever = LeanTween.value(controllingObject, f => { fadeVolume = f; SetFadeVolume(f); }, 0f, 1f, fade); tweever.tweenType = fadeType; fadeVolume = 0; SetFadeVolume(0); } StartCoroutine(StartPlay(node, time)); }
bool IAudioHandler.GetAudioParameters(IWebBrowser chromiumWebBrowser, IBrowser browser, ref AudioParameters parameters) { //Cancel Capture return(false); }
/// <summary> /// Called on a browser audio capture thread when the browser starts streaming audio. /// OnAudioSteamStopped will always be called after OnAudioStreamStarted; both methods may be called multiple /// times for the same browser. /// </summary> /// <param name="chromiumWebBrowser">the ChromiumWebBrowser control</param> /// <param name="browser">the browser object</param> /// <param name="parameters">contains the audio parameters like sample rate and channel layout. /// Changing the param values will have no effect here.</param> /// <param name="channels">is the number of channels</param> protected virtual void OnAudioStreamStarted(IWebBrowser chromiumWebBrowser, IBrowser browser, AudioParameters parameters, int channels) { }
protected override bool GetAudioParameters(IWebBrowser chromiumWebBrowser, IBrowser browser, ref AudioParameters parameters) { //Cancel Capture return(false); }
/// <summary> /// Called on the CEF UI thread to allow configuration of audio stream parameters. /// Audio stream paramaters can optionally be configured by modifying <paramref name="parameters"/> /// </summary> /// <param name="chromiumWebBrowser">the ChromiumWebBrowser control</param> /// <param name="browser">the browser object</param> /// <param name="parameters">audio stream parameters can optionally be configured here, they are /// pre-filled with some sensible defaults.</param> /// <returns>Return true to proceed with audio stream capture, or false to cancel it</returns> protected virtual bool GetAudioParameters(IWebBrowser chromiumWebBrowser, IBrowser browser, ref AudioParameters parameters) { return(false); }
/// <inheritdoc/> bool IAudioHandler.GetAudioParameters(IWebBrowser chromiumWebBrowser, IBrowser browser, ref AudioParameters parameters) { return(GetAudioParameters(chromiumWebBrowser, browser, ref parameters)); }
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); } }
/// <summary> /// Play an audio node directly with a custom fade, following a game object and persists even if the GO is destroyed. /// </summary> /// <param name="gameObject">The game object to be controlled by and follow</param> /// <param name="audioNode">The node to play</param> /// <param name="parameters">Parameters to set initial values directly</param> /// <returns>A controller for the playing node</returns> public static InPlayer PlayFollowing(GameObject gameObject, InAudioNode audioNode, AudioParameters parameters = null) { if (instance == null || audioNode == null || audioNode.IsRootOrFolder || gameObject == null) { InDebug.MissingArguments("PlayFollowing", gameObject, audioNode); return null; } InPlayer player = instance._inAudioEventWorker.PlayFollowing(gameObject, audioNode, parameters); return player; }
/// <summary> /// Play an audio node directly with a fade, following a game object and persists even if the GO is destroyed. /// </summary> /// <param name="gameObject">The game object to be controlled by and follow</param> /// <param name="audioNode">The node to play</param> /// <param name="fadeTime">How long it should take to fade in from 0 to 1 in volume</param> /// <param name="tweeenType">The curve of fading</param> /// <param name="parameters">Parameters to set initial values directly</param> /// <returns>A controller for the playing node</returns> public static InPlayer PlayFollowing(GameObject gameObject, InAudioNode audioNode, float fadeTime, LeanTweenType tweeenType, AudioParameters parameters = null) { if (instance == null || audioNode == null || audioNode.IsRootOrFolder || gameObject == null) { InDebug.MissingArguments("PlayFollowing (tween)", gameObject, audioNode); return null; } InPlayer player = instance._inAudioEventWorker.PlayFollowing(gameObject, audioNode, parameters); player.Volume = 0.0f; LTDescr tweever = LeanTween.value(gameObject, (f, o) => { (o as InPlayer).Volume = f; }, 0.0f, 1f, fadeTime); tweever.onUpdateParam = player; tweever.tweenType = tweeenType; return player; }
/// <summary> /// Play an audio node on InAudio directly so it does not get destroyed in scene transition. /// No fade in as code would not get called during scene transition. Works best with simple sound effects /// </summary> /// <param name="gameObject">The game object to attach to and be controlled by</param> /// <param name="audioNode">The node to play</param> /// <returns>A controller for the playing node</returns> /// <param name="parameters">Parameters to set initial values directly</param> public static InPlayer PlayPersistent(Vector3 position, InAudioNode audioNode, AudioParameters parameters = null) { if (instance == null || audioNode == null || audioNode.IsRootOrFolder) { InDebug.MissingArgumentsForNode("PlayPersistent", audioNode); return null; } InPlayer player = instance._inAudioEventWorker.PlayAtPosition(instance.gameObject, audioNode, position, parameters); return player; }
protected override bool GetAudioParameters(IWebBrowser chromiumWebBrowser, IBrowser browser, ref AudioParameters parameters) { // return true to activate audio stream capture return(true); }
public InPlayer PlayFollowing(GameObject controllingObject, InAudioNode audioNode, AudioParameters audioParameters, float fade = 0f, LeanTweenType fadeType = LeanTweenType.notUsed) { if (audioNode.IsRootOrFolder) { Debug.LogWarning("InAudio: Cannot play \"" + audioNode.GetName + "\" as it is a folder"); return(null); } List <InstanceInfo> currentInstances = audioNode.CurrentInstances; if (!AllowedStealing(audioNode, currentInstances)) { return(null); } var runtimePlayer = InAudioInstanceFinder.RuntimePlayerControllerPool.GetObject(); if (runtimePlayer == null) { Debug.LogWarning("InAudio: A pooled objected was not initialized. Try to restart play mode. If the problem persists, please submit a bug report."); } currentInstances.Add(new InstanceInfo(AudioSettings.dspTime, runtimePlayer)); PlayFollowing(controllingObject, audioNode, runtimePlayer, fade, fadeType, audioParameters); return(runtimePlayer); }
/// <summary> /// Play an audio node directly, at this position in world space /// </summary> /// <param name="gameObject">The game object to attach to and be controlled by</param> /// <param name="audioNode">The node to play</param> /// <param name="position">The world position to play at</param> /// <param name="parameters">Parameters to set initial values directly</param> /// <returns>A controller for the playing node</returns> public static InPlayer PlayAtPosition(GameObject gameObject, InAudioNode audioNode, Vector3 position, AudioParameters parameters = null) { if (instance != null && gameObject != null && audioNode != null) return instance._inAudioEventWorker.PlayAtPosition(gameObject, audioNode, position, parameters); else InDebug.MissingArguments("PlayAtPosition", gameObject, audioNode); return null; }
protected override void OnAudioStreamStarted(IWebBrowser chromiumWebBrowser, IBrowser browser, AudioParameters parameters, int channels) { this.channelLayout = parameters.ChannelLayout; this.sampleRate = parameters.SampleRate; this.channelCount = channels; }
/// <summary> /// Play an audio node in world space with a custom fade, attached to another game object /// </summary> /// <param name="gameObject">The game object to attach to and be controlled by</param> /// <param name="audioNode">The node to play</param> /// <param name="position">The world position to play at</param> /// <param name="fadeTime">How long it should take to fade in from 0 to 1 in volume</param> /// <param name="tweeenType">The curve of fading</param> /// <param name="startVolume">The starting volume</param> /// <param name="endVolume">The end volume</param> /// <param name="parameters">Parameters to set initial values directly</param> /// <returns>A controller for the playing node</returns> public static InPlayer PlayAtPosition(GameObject gameObject, InAudioNode audioNode, Vector3 position, float fadeTime, LeanTweenType tweeenType, float startVolume, float endVolume, AudioParameters parameters = null) { if (instance == null || audioNode == null || audioNode.IsRootOrFolder) { InDebug.MissingArguments("PlayAtPosition (tween specific)", gameObject, audioNode); return null; } InPlayer player = instance._inAudioEventWorker.PlayAtPosition(gameObject, audioNode, position, parameters); player.Volume = startVolume; LTDescr tweever = LeanTween.value(gameObject, (f, o) => { (o as InPlayer).Volume = f; }, startVolume, endVolume, fadeTime); tweever.onUpdateParam = player; tweever.tweenType = tweeenType; return player; }
protected override bool GetAudioParameters(IWebBrowser chromiumWebBrowser, IBrowser browser, ref AudioParameters parameters) => ProceedWithAudioStreamCapture;
protected override void OnAudioStreamStarted(IWebBrowser chromiumWebBrowser, IBrowser browser, AudioParameters parameters, int channels) { Console.WriteLine($"Audio stream started with channel layout {parameters.ChannelLayout}, number of channels {channels}"); _numberOfChannels = channels; }
private void PlayFollowing(GameObject controllingObject, InAudioNode audioNode, InPlayer player, float fade, LeanTweenType fadeType, AudioParameters parameters) { var runtimeInfo = PreparePlay(controllingObject, audioNode, player); player._internalPlayFollowing(audioNode, controllingObject, runtimeInfo, fade, fadeType, parameters); }