|
|
@ -17,6 +17,42 @@ func main() {
|
|
|
|
defer ctx.Free()
|
|
|
|
defer ctx.Free()
|
|
|
|
defer ctx.Uninit()
|
|
|
|
defer ctx.Uninit()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Playback devices.
|
|
|
|
|
|
|
|
infos, err := ctx.Devices(malgo.Playback)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
panic(err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fmt.Println("Playback Devices")
|
|
|
|
|
|
|
|
for i, info := range infos {
|
|
|
|
|
|
|
|
e := "ok"
|
|
|
|
|
|
|
|
full, err := ctx.DeviceInfo(malgo.Playback, info.ID, malgo.Shared)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
e = err.Error()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Printf(" %d: %v, %s, [%s], formats: %+v\n",
|
|
|
|
|
|
|
|
i, info.ID, info.Name(), e, full.Formats)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fmt.Println()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Capture devices.
|
|
|
|
|
|
|
|
infos, err = ctx.Devices(malgo.Capture)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
panic(err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fmt.Println("Capture Devices")
|
|
|
|
|
|
|
|
for i, info := range infos {
|
|
|
|
|
|
|
|
e := "ok"
|
|
|
|
|
|
|
|
full, err := ctx.DeviceInfo(malgo.Capture, info.ID, malgo.Shared)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
e = err.Error()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Printf(" %d: %v, %s, [%s], formats: %+v\n",
|
|
|
|
|
|
|
|
i, info.ID, info.Name(), e, full.Formats)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inDeviceConfig := malgo.DefaultDeviceConfig(malgo.Capture)
|
|
|
|
inDeviceConfig := malgo.DefaultDeviceConfig(malgo.Capture)
|
|
|
|
inDeviceConfig.Capture.Format = malgo.FormatF32
|
|
|
|
inDeviceConfig.Capture.Format = malgo.FormatF32
|
|
|
|
inDeviceConfig.Capture.Channels = 1
|
|
|
|
inDeviceConfig.Capture.Channels = 1
|
|
|
|