mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
audio: Add comments
This commit is contained in:
parent
d9f6699b7f
commit
fe2380f1ab
@ -194,7 +194,13 @@ var (
|
|||||||
theContextLock sync.Mutex
|
theContextLock sync.Mutex
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewContext creates a new audio context with the given sample rate (e.g. 44100).
|
// NewContext creates a new audio context with the given sample rate.
|
||||||
|
//
|
||||||
|
// The sample rate is also used for decoding MP3 or other formats as the target sample rate.
|
||||||
|
//
|
||||||
|
// sampleRate should be 44100 or 48000.
|
||||||
|
// Other values might not work.
|
||||||
|
// For example, 22050 causes error on Safari when decoding MP3.
|
||||||
//
|
//
|
||||||
// Error returned by NewContext is always nil as of 1.5.0-alpha.
|
// Error returned by NewContext is always nil as of 1.5.0-alpha.
|
||||||
//
|
//
|
||||||
|
@ -108,6 +108,7 @@ func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) {
|
|||||||
if klass == js.Undefined {
|
if klass == js.Undefined {
|
||||||
return nil, errors.New("audio/mp3: OfflineAudioContext is not available")
|
return nil, errors.New("audio/mp3: OfflineAudioContext is not available")
|
||||||
}
|
}
|
||||||
|
// This might causes 'Syntax' error when the sample rate is not so usual like 22050 on Safari.
|
||||||
// TODO: 1 is a correct second argument?
|
// TODO: 1 is a correct second argument?
|
||||||
oc := klass.New(2, 1, context.SampleRate())
|
oc := klass.New(2, 1, context.SampleRate())
|
||||||
oc.Call("decodeAudioData", js.NewArrayBuffer(b), func(buf *js.Object) {
|
oc.Call("decodeAudioData", js.NewArrayBuffer(b), func(buf *js.Object) {
|
||||||
|
Loading…
Reference in New Issue
Block a user