From 7e27d6a0fa8f826f56b84e18ae43d9e26bbd7269 Mon Sep 17 00:00:00 2001 From: Paul Joannon Date: Thu, 4 Mar 2021 11:31:03 +0100 Subject: [PATCH] add C# code tabs to pages under tutorials/audio --- tutorials/audio/recording_with_microphone.rst | 62 +++++++++++++++++++ tutorials/audio/sync_with_audio.rst | 43 +++++++++++++ 2 files changed, 105 insertions(+) diff --git a/tutorials/audio/recording_with_microphone.rst b/tutorials/audio/recording_with_microphone.rst index 772bfb89f..34673b624 100644 --- a/tutorials/audio/recording_with_microphone.rst +++ b/tutorials/audio/recording_with_microphone.rst @@ -38,6 +38,20 @@ An ``AudioStreamPlayer`` named ``AudioStreamRecord`` is used for recording. # as an "AudioEffectRecord" resource. effect = AudioServer.get_bus_effect(idx, 0) + .. code-tab:: csharp + + private AudioEffectRecord _effect; + private AudioStreamSample _recording; + + public override void _Ready() + { + // We get the index of the "Record" bus. + int idx = AudioServer.GetBusIndex("Record"); + // And use it to retrieve its first effect, which has been defined + // as an "AudioEffectRecord" resource. + _effect = (AudioEffectRecord)AudioServer.GetBusEffect(idx, 0); + } + The audio recording is handled by the :ref:`class_AudioEffectRecord` resource which has three methods: :ref:`get_recording() `, @@ -62,6 +76,29 @@ and :ref:`set_recording_active() ("PlayButton").Disabled = false; + GetNode