DCDC/Assets/Photon/PhotonVoice/Code/FMOD/FMODRecorderSetup.cs
2026-02-22 14:21:56 +01:00

23 lines
855 B
C#

#if PHOTON_VOICE_FMOD_ENABLE
using UnityEngine;
namespace Photon.Voice.Unity.FMOD
{
[RequireComponent(typeof(Recorder))]
[AddComponentMenu("Photon Voice/FMOD/FMOD Recorder Setup")]
public class FMODRecorderSetup : VoiceComponent
{
protected override void Awake()
{
base.Awake();
var recorder = this.GetComponent<Recorder>();
recorder.SourceType = Recorder.InputSourceType.Factory;
recorder.InputFactory = () =>
{
this.Logger.Log(LogLevel.Info, "Setting recorder's source to FMOD factory with device={0}", recorder.MicrophoneDevice);
return new Voice.FMOD.AudioInReader<short>(FMODUnity.RuntimeManager.CoreSystem, recorder.MicrophoneDevice.IDInt, (int)recorder.SamplingRate, this.Logger);
};
}
}
}
#endif