MCPcopy
hub / github.com/EngoEngine/engo / Seek

Method Seek

common/audio_player.go:253–262  ·  view source on GitHub ↗

Seek seeks the position with the given offset. Seek returns error when seeking the source stream returns error.

(offset time.Duration)

Source from the content-addressed store, hash-verified

251//
252// Seek returns error when seeking the source stream returns error.
253func (p *Player) Seek(offset time.Duration) error {
254 o := int64(offset) * bytesPerSample * channelNum * int64(p.sampleRate) / int64(time.Second)
255 o &= mask
256 select {
257 case p.seekCh <- seekArgs{o, io.SeekStart}:
258 return <-p.seekedCh
259 case <-p.readLoopEndedCh:
260 return fmt.Errorf("audio: the player is already closed")
261 }
262}
263
264// Pause pauses the playing.
265func (p *Player) Pause() {

Callers 5

RewindMethod · 0.95
newPlayerFunction · 0.45
readLoopMethod · 0.45
TestAudioPlayerPlayFunction · 0.45
TestAudioPlayerSeekFunction · 0.45

Calls

no outgoing calls

Tested by 2

TestAudioPlayerPlayFunction · 0.36
TestAudioPlayerSeekFunction · 0.36