Documentation ¶
Index ¶
- func Flaot32To16BitPCM(raw []float32) []int16
- func GetUserMedia(constrains StreamConstrains, success func(*Stream), fail func(*js.Error))
- type AudioBuffer
- func (buf *AudioBuffer) ChannelData(idx int) []float32
- func (buf *AudioBuffer) Duration() float64
- func (buf *AudioBuffer) JSValue() js.Value
- func (buf *AudioBuffer) Length() int
- func (buf *AudioBuffer) NumberOfChannels() int
- func (buf *AudioBuffer) SampleRate() float64
- func (buf *AudioBuffer) String() string
- type AudioContext
- func (ctx *AudioContext) Close() *AudioContext
- func (ctx *AudioContext) CreateMediaStreamSource(stream *Stream) *AudioNode
- func (ctx *AudioContext) CreateScriptProcessor(size BufSize, in, out int) *AudioNode
- func (ctx *AudioContext) Destination() *AudioNode
- func (ctx *AudioContext) JSValue() js.Value
- func (ctx *AudioContext) OnClose(cb func()) *AudioContext
- func (ctx *AudioContext) OnResume(cb func()) *AudioContext
- func (ctx *AudioContext) OnSuspend(cb func()) *AudioContext
- func (ctx *AudioContext) Release()
- func (ctx *AudioContext) Resume() *AudioContext
- func (ctx *AudioContext) SampleRate() float64
- func (ctx *AudioContext) State() AudioState
- func (ctx *AudioContext) Suspend() *AudioContext
- type AudioNode
- type AudioState
- type BufSize
- type Stream
- type StreamConstrains
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Flaot32To16BitPCM ¶
Flaot32To16BitPCM converts float32 data to 16Bit PCM.
func GetUserMedia ¶
func GetUserMedia(constrains StreamConstrains, success func(*Stream), fail func(*js.Error))
GetUserMedia ...
Types ¶
type AudioBuffer ¶
type AudioBuffer struct {
// contains filtered or unexported fields
}
AudioBuffer https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer
func AudioBufferOf ¶
func AudioBufferOf(x js.Value) *AudioBuffer
AudioBufferOf returns audio buffer.
func (*AudioBuffer) ChannelData ¶
func (buf *AudioBuffer) ChannelData(idx int) []float32
ChannelData https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/getChannelData
func (*AudioBuffer) Duration ¶
func (buf *AudioBuffer) Duration() float64
Duration https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/duration
func (*AudioBuffer) Length ¶
func (buf *AudioBuffer) Length() int
Length https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/length
func (*AudioBuffer) NumberOfChannels ¶
func (buf *AudioBuffer) NumberOfChannels() int
NumberOfChannels https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/numberOfChannels
func (*AudioBuffer) SampleRate ¶
func (buf *AudioBuffer) SampleRate() float64
SampleRate https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/sampleRate
func (*AudioBuffer) String ¶
func (buf *AudioBuffer) String() string
type AudioContext ¶
type AudioContext struct {
// contains filtered or unexported fields
}
AudioContext https://developer.mozilla.org/en-US/docs/Web/API/AudioContext
func NewAudioContext ¶
func NewAudioContext(sampleRate float64) *AudioContext
NewAudioContext return a audio context with specific sample rate.
func (*AudioContext) Close ¶
func (ctx *AudioContext) Close() *AudioContext
Close https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/close
func (*AudioContext) CreateMediaStreamSource ¶
func (ctx *AudioContext) CreateMediaStreamSource(stream *Stream) *AudioNode
CreateMediaStreamSource https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createMediaStreamSource
func (*AudioContext) CreateScriptProcessor ¶
func (ctx *AudioContext) CreateScriptProcessor(size BufSize, in, out int) *AudioNode
CreateScriptProcessor https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/createScriptProcessor
func (*AudioContext) Destination ¶
func (ctx *AudioContext) Destination() *AudioNode
Destination https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/destination
func (*AudioContext) OnClose ¶
func (ctx *AudioContext) OnClose(cb func()) *AudioContext
OnClose invoked when context is closed.
func (*AudioContext) OnResume ¶
func (ctx *AudioContext) OnResume(cb func()) *AudioContext
OnResume invoked when context is resumed.
func (*AudioContext) OnSuspend ¶
func (ctx *AudioContext) OnSuspend(cb func()) *AudioContext
OnSuspend invoked when context is suspended.
func (*AudioContext) Release ¶
func (ctx *AudioContext) Release()
Release frees up callback functions.
func (*AudioContext) Resume ¶
func (ctx *AudioContext) Resume() *AudioContext
Resume https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/resume
func (*AudioContext) SampleRate ¶
func (ctx *AudioContext) SampleRate() float64
SampleRate https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/sampleRate
func (*AudioContext) State ¶
func (ctx *AudioContext) State() AudioState
State https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/state
func (*AudioContext) Suspend ¶
func (ctx *AudioContext) Suspend() *AudioContext
Suspend https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/suspend
type AudioNode ¶
type AudioNode struct {
// contains filtered or unexported fields
}
AudioNode https://developer.mozilla.org/en-US/docs/Web/API/AudioNode
func (*AudioNode) Connect ¶
Connect https://developer.mozilla.org/en-US/docs/Web/API/AudioNode/connect
func (*AudioNode) Context ¶
func (n *AudioNode) Context() *AudioContext
Context https://developer.mozilla.org/en-US/docs/Web/API/AudioNode/context
func (*AudioNode) Disconnect ¶
Disconnect https://developer.mozilla.org/en-US/docs/Web/API/AudioNode/disconnect
func (*AudioNode) DisconnectAll ¶
func (n *AudioNode) DisconnectAll()
DisconnectAll disconnects all destination nodes.
type AudioState ¶
type AudioState string
AudioState state for AudioConext.
const ( Suspended AudioState = "suspended" Running AudioState = "running" Closed AudioState = "closed" )
AudioContext State https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/state
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream https://developer.mozilla.org/en-US/docs/Web/API/MediaStream