tracks

package
v0.0.0-...-a4649ec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterEvent

func RegisterEvent[T any](name string)

Types

type Event

type Event struct {
	EventMeta
	Data any
	// contains filtered or unexported fields
}

func (Event) Span

func (e Event) Span() Span

func (Event) Track

func (e Event) Track() *Track

func (*Event) UnmarshalCBOR

func (e *Event) UnmarshalCBOR(data []byte) error

type EventEmitter

type EventEmitter struct {
	// contains filtered or unexported fields
}

func (*EventEmitter) Emit

func (ee *EventEmitter) Emit(e Event)

func (*EventEmitter) Listen

func (ee *EventEmitter) Listen(n Handler)

func (*EventEmitter) Unlisten

func (ee *EventEmitter) Unlisten(n Handler)

type EventMeta

type EventMeta struct {
	Start, End Timestamp
	Type       string
	ID         ID
}

type Handler

type Handler interface {
	HandleEvent(Event)
}

type HandlerFunc

type HandlerFunc func(e Event)

func (HandlerFunc) HandleEvent

func (f HandlerFunc) HandleEvent(e Event)

type ID

type ID string

type Session

type Session struct {
	EventEmitter
	ID    ID
	Start time.Time
	// contains filtered or unexported fields
}

func NewSession

func NewSession() *Session

func (*Session) MarshalCBOR

func (s *Session) MarshalCBOR() ([]byte, error)

func (*Session) NewTrack

func (s *Session) NewTrack(format beep.Format) *Track

func (*Session) NewTrackAt

func (s *Session) NewTrackAt(start Timestamp, format beep.Format) *Track

func (*Session) Tracks

func (s *Session) Tracks() []*Track

func (*Session) UnmarshalCBOR

func (s *Session) UnmarshalCBOR(data []byte) error

type Span

type Span interface {
	Track() *Track
	Span(from, to Timestamp) Span
	Start() Timestamp
	End() Timestamp
	Length() time.Duration
	Audio() beep.Streamer
	EventTypes() []string
	Events(typ string) []Event
	RecordEvent(typ string, data any) Event
}

type Timestamp

type Timestamp time.Duration // relative to stream start

type Track

type Track struct {
	ID      ID
	Session *Session
	// contains filtered or unexported fields
}

func (*Track) AddAudio

func (t *Track) AddAudio(streamer beep.Streamer)

func (*Track) Audio

func (t *Track) Audio() beep.Streamer

func (*Track) AudioFormat

func (t *Track) AudioFormat() beep.Format

func (*Track) End

func (t *Track) End() Timestamp

func (*Track) EventTypes

func (t *Track) EventTypes() []string

func (*Track) Events

func (t *Track) Events(typ string) []Event

func (*Track) Length

func (t *Track) Length() time.Duration

func (*Track) RecordEvent

func (t *Track) RecordEvent(typ string, data any) Event

func (*Track) Span

func (t *Track) Span(from Timestamp, to Timestamp) Span

func (*Track) Start

func (t *Track) Start() Timestamp

Start implements Span.

func (*Track) Track

func (t *Track) Track() *Track

func (*Track) UpdateEvent

func (t *Track) UpdateEvent(evt Event) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL