examples/piano: Add comments

This commit is contained in:
Hajime Hoshi 2016-04-22 02:07:43 +09:00
parent bd1e81ec4a
commit 401e031349

View File

@ -90,6 +90,9 @@ func (s *stream) Close() error {
} }
func addNote(freq float64, vol float64) error { func addNote(freq float64, vol float64) error {
// TODO: Call Close method of *audio.Player.
// However, this works without Close because Close is automatically called when GC
// collects a *audio.Player object.
f := int(freq) f := int(freq)
if n, ok := noteCache[f]; ok { if n, ok := noteCache[f]; ok {
p, err := audio.NewPlayer(audioContext, &stream{bytes.NewReader(n)}) p, err := audio.NewPlayer(audioContext, &stream{bytes.NewReader(n)})