fix : Turn on the microphone with the current device id (#395)

* fix : Turn on the microphone with the current device id

* modify comments
This commit is contained in:
代码人生
2022-04-13 13:01:30 +08:00
committed by GitHub
parent 0d09f7f458
commit 08a396571f
+2
View File
@@ -111,6 +111,8 @@ func (m *microphone) AudioRecord(inputProp prop.Media) (audio.Reader, error) {
config.PerformanceProfile = malgo.LowLatency
config.Capture.Channels = uint32(inputProp.ChannelCount)
config.SampleRate = uint32(inputProp.SampleRate)
//FIX: Turn on the microphone with the current device id
config.Capture.DeviceID = m.ID.Pointer()
if inputProp.SampleSize == 4 && inputProp.IsFloat {
config.Capture.Format = malgo.FormatF32
} else if inputProp.SampleSize == 2 && !inputProp.IsFloat {