From 1497d52928a6171058e15638f83bf95de10dc201 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 18 Apr 2017 00:59:10 +0900 Subject: [PATCH] audio: Add comments about errors (#331) --- audio/audio.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/audio/audio.go b/audio/audio.go index 223424bb2..90362dd2c 100644 --- a/audio/audio.go +++ b/audio/audio.go @@ -230,7 +230,7 @@ func NewContext(sampleRate int) (*Context, error) { // you will find audio stops when the game stops e.g. when the window is deactivated. // In async mode, the audio never stops even when the game stops. // -// Update returns error when IO error occurs. +// Update returns error when IO error occurs in the underlying IO object. func (c *Context) Update() error { // Initialize c.driver lazily to enable calling NewContext in an 'init' function. // Accessing driver functions requires the environment to be already initialized, @@ -323,6 +323,9 @@ type Player struct { // // Note that the given src can't be shared with other Players. // +// NewPlayer tries to rewind src by calling Seek to get the current position. +// NewPlayer returns error when the Seek returns error. +// // This function is concurrent-safe. func NewPlayer(context *Context, src ReadSeekCloser) (*Player, error) { if context.players.hasSource(src) { @@ -352,6 +355,8 @@ func NewPlayer(context *Context, src ReadSeekCloser) (*Player, error) { // // The format of src should be same as noted at NewPlayer. // +// NewPlayerFromBytes returns error in the same situation of NewPlayer. +// // This function is concurrent-safe. func NewPlayerFromBytes(context *Context, src []byte) (*Player, error) { b := BytesReadSeekCloser(src)