Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( Bell = "bell" Message = "message" )
Sound IDs.
Variables ¶
This section is empty.
Functions ¶
func Play ¶
func Play(app *app.Application, id string)
Play plays the given sound ID. It first uses Canberra, falling back to ~/.cache/gotktrix/{id}.opus, then the embedded audio (if any), then display.Beep() otherwise.
Play is asynchronous; it returning does not mean the audio has successfully been played to the user.
Example ¶
app := app.New(context.Background(), "com.example.app", "app") app.ConnectActivate(func() { // Plays are automatically debounced. sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) sounds.Play(app, sounds.Message) app.Hold() glib.TimeoutSecondsAdd(1, app.Release) }) app.Run(nil)
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.