public static async Task <AudioOutputManager> CreateAsync(AudioGraph audioGraph) { var outputAudioManager = new AudioOutputManager(audioGraph); await outputAudioManager.InitializeAudioOutput(); return(outputAudioManager); }
public async Task Initialize() { using (var release = await InitializeLock.LockAsync()) { var pcmEncoding = AudioEncodingProperties.CreatePcm(48000, 1, 16); var result = await AudioGraph.CreateAsync( new AudioGraphSettings(AudioRenderCategory.GameChat) { DesiredRenderDeviceAudioProcessing = AudioProcessing.Raw, AudioRenderCategory = AudioRenderCategory.GameChat, EncodingProperties = pcmEncoding } ); if (result.Status != AudioGraphCreationStatus.Success) { throw new Exception(); } AudioGraph = result.Graph; // マイク入力を初期化 Input = await AudioInputManager.CreateAsync(AudioGraph); Input.MinGain = _MicVolume; Input.InputDeviceStateChanged += Input_InputDeviceStateChanged; this.InputDeviceState = Input.InputDeviceState; // スピーカー出力を初期化 Output = await AudioOutputManager.CreateAsync(AudioGraph); Output.SpeakerGain = _SpeakerVolume; } }