Skip to content

Commit

Permalink
made public IsReady device api
Browse files Browse the repository at this point in the history
  • Loading branch information
Binozo committed Dec 26, 2023
1 parent f412c24 commit c8a1966
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/tinyalsa/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ func (d *AlsaDevice) GetInfo() DeviceInfo {
}
}

// IsReady returns if the device is ready
func (d *AlsaDevice) IsReady(format int) (bool, error) {
pcmDevice, err := tinyapi.PcmOpen(d.Card, d.Device, format, d.DeviceConfig)
if err != nil {
return false, err
}
defer pcmDevice.Close()
return pcmDevice.IsReady(), nil
}

// WaitUntilReady waits until the device is ready or the timeout expired
// If successful, nil will be returned. Otherwise, an error
func (d *AlsaDevice) WaitUntilReady(format int, timeout time.Duration) error {
Expand Down

0 comments on commit c8a1966

Please sign in to comment.