mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
audio: Add comments (#199)
This commit is contained in:
parent
b0178e8425
commit
5ae624b891
@ -39,12 +39,14 @@ func (s *Stream) Close() error {
|
||||
return s.decoded.Close()
|
||||
}
|
||||
|
||||
// TODO: Should be int?
|
||||
// Size returns the size of decoded stream in bytes.
|
||||
func (s *Stream) Size() int64 {
|
||||
return s.decoded.Size()
|
||||
}
|
||||
|
||||
// TODO: src should be ReadCloser?
|
||||
// Decode decodes Ogg/Vorbis data to playable stream.
|
||||
//
|
||||
// The sample rate must be same as that of audio context.
|
||||
func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) {
|
||||
decoded, channelNum, sampleRate, err := decode(src)
|
||||
if err != nil {
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
// +build !js
|
||||
|
||||
// Package vorbis provides Ogg/Vorbis decoder.
|
||||
package vorbis
|
||||
|
||||
import (
|
||||
|
@ -12,6 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package vorbis provides WAV (RIFF) decoder.
|
||||
package wav
|
||||
|
||||
import (
|
||||
@ -43,10 +44,15 @@ func (s *Stream) Close() error {
|
||||
return s.src.Close()
|
||||
}
|
||||
|
||||
// Size returns the size of decoded stream in bytes.
|
||||
func (s *Stream) Size() int64 {
|
||||
return s.dataSize
|
||||
}
|
||||
|
||||
// Decode decodes WAV (RIFF) data to playable stream.
|
||||
//
|
||||
// The format must be 2 channels, 16bit little endian PCM.
|
||||
// The sample rate must be same as that of audio context.
|
||||
func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) {
|
||||
buf := make([]byte, 12)
|
||||
n, err := io.ReadFull(src, buf)
|
||||
|
Loading…
Reference in New Issue
Block a user