Recurse if inited but no deviceOpen
This commit is contained in:
@@ -113,8 +113,11 @@ func Play(path string, loopForever bool, cfg *db.AppConfig) error {
|
|||||||
defer mu.Unlock()
|
defer mu.Unlock()
|
||||||
|
|
||||||
// Check if mixer has been initialized and that a device is open
|
// Check if mixer has been initialized and that a device is open
|
||||||
// JUMP: This is where the issue is...
|
|
||||||
if !inited || !deviceOpen {
|
if !inited || !deviceOpen {
|
||||||
|
if !deviceOpen {
|
||||||
|
SwitchDevice("") // Re-switch to the default device
|
||||||
|
Play(path, loopForever, cfg) // Re-run the function
|
||||||
|
}
|
||||||
logger.Error("audio mixer not initialized")
|
logger.Error("audio mixer not initialized")
|
||||||
return errors.New("audio mixer not initialized")
|
return errors.New("audio mixer not initialized")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user