Skip to content

Commit dc17130

Browse files
committed
[BUGFIX] Device index counting compared to python
1 parent af1e817 commit dc17130

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

FyneApp.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ Website = "https://github.com/Sharrnah/whispering"
55
Name = "Whispering Tiger"
66
ID = "tiger.whispering"
77
Version = "1.0.0"
8-
Build = 11
8+
Build = 12

Pages/Profiles.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (c *CurrentPlaybackDevice) InitDevices() {
101101
for index, deviceInfo := range playbackDevices {
102102
if deviceInfo.Name() == c.OutputDeviceName {
103103
selectedPlaybackDeviceIndex = index
104-
fmt.Println("Found input device: ", deviceInfo.Name(), " at index: ", index)
104+
fmt.Println("Found output device: ", deviceInfo.Name(), " at index: ", index)
105105
break
106106
}
107107
}
@@ -247,9 +247,9 @@ func (c *CurrentPlaybackDevice) Init() {
247247

248248
}
249249

250-
func GetAudioDevices(deviceType malgo.DeviceType) ([]CustomWidget.TextValueOption, error) {
250+
func GetAudioDevices(deviceType malgo.DeviceType, deviceIndexStartPoint int) ([]CustomWidget.TextValueOption, error) {
251251

252-
deviceList, _ := Utilities.GetAudioDevices(deviceType)
252+
deviceList, _ := Utilities.GetAudioDevices(deviceType, deviceIndexStartPoint)
253253

254254
if deviceList == nil {
255255
return nil, fmt.Errorf("no devices found")
@@ -277,8 +277,8 @@ func CreateProfileWindow(onClose func()) fyne.CanvasObject {
277277

278278
go playBackDevice.Init()
279279

280-
audioInputDevices, _ := GetAudioDevices(malgo.Capture)
281-
audioOutputDevices, _ := GetAudioDevices(malgo.Playback)
280+
audioInputDevices, _ := GetAudioDevices(malgo.Capture, 0)
281+
audioOutputDevices, _ := GetAudioDevices(malgo.Playback, len(audioInputDevices))
282282

283283
BuildProfileForm := func() fyne.CanvasObject {
284284
profileForm := widget.NewForm()

Utilities/AudioDevices.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type AudioDeviceList struct {
1717
Devices []AudioDevice
1818
}
1919

20-
func GetAudioDevices(deviceType malgo.DeviceType) ([]AudioDevice, error) {
20+
func GetAudioDevices(deviceType malgo.DeviceType, deviceIndexStartPoint int) ([]AudioDevice, error) {
2121
//a.DeviceType = deviceType
2222

2323
// initialize malgo
@@ -50,7 +50,7 @@ func GetAudioDevices(deviceType malgo.DeviceType) ([]AudioDevice, error) {
5050
}
5151
deviceList = append(deviceList, AudioDevice{
5252
Name: deviceInfo.Name(),
53-
Index: index,
53+
Index: index + deviceIndexStartPoint,
5454
ID: deviceInfo.ID.String(),
5555
IsDefault: fullInfo.IsDefault != 0,
5656
})

0 commit comments

Comments
 (0)