Skip to content

Commit c8a1966

Browse files
committed
made public IsReady device api
1 parent f412c24 commit c8a1966

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/tinyalsa/device.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ func (d *AlsaDevice) GetInfo() DeviceInfo {
5454
}
5555
}
5656

57+
// IsReady returns if the device is ready
58+
func (d *AlsaDevice) IsReady(format int) (bool, error) {
59+
pcmDevice, err := tinyapi.PcmOpen(d.Card, d.Device, format, d.DeviceConfig)
60+
if err != nil {
61+
return false, err
62+
}
63+
defer pcmDevice.Close()
64+
return pcmDevice.IsReady(), nil
65+
}
66+
5767
// WaitUntilReady waits until the device is ready or the timeout expired
5868
// If successful, nil will be returned. Otherwise, an error
5969
func (d *AlsaDevice) WaitUntilReady(format int, timeout time.Duration) error {

0 commit comments

Comments
 (0)