Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AvailableInstruments ¶
func AvailableInstruments() map[InstrumentType]string
Types ¶
type ConnectedPlayer ¶
type ConnectedPlayer struct { *Player // contains filtered or unexported fields }
func NewConnectedPlayer ¶
func NewConnectedPlayer(ws *websocket.Conn, player *Player, room *Room) *ConnectedPlayer
func (*ConnectedPlayer) SendMessage ¶
func (cp *ConnectedPlayer) SendMessage(msg string)
type Instrument ¶
type Instrument interface { // Returns audio file name Play(command string) (string, error) Name() string Type() InstrumentType }
func CreateInstrument ¶
func CreateInstrument(t InstrumentType) Instrument
Factory for create instrument
type InstrumentType ¶
type InstrumentType string
const ( UKULELE InstrumentType = "1" DRUMS InstrumentType = "2" DEFAULT_INSTRUMENT = UKULELE )
type Player ¶
type Player struct {
// contains filtered or unexported fields
}
func NewPlayer ¶
func NewPlayer(name string, instrument Instrument) *Player
func (*Player) PlayedAudio ¶
type Room ¶
type Room struct { // New action added. AddAction chan *ConnectedPlayer // Register requests from the connections. Join chan *ConnectedPlayer // Unregister requests from connections. Leave chan *ConnectedPlayer // contains filtered or unexported fields }
func (*Room) GetFreeInstruments ¶
func (r *Room) GetFreeInstruments() map[InstrumentType]string
func (*Room) OnActionAdded ¶
func (r *Room) OnActionAdded(p *ConnectedPlayer)
func (*Room) OnPlayerJoined ¶
func (r *Room) OnPlayerJoined(newPlayer *ConnectedPlayer)
func (*Room) OnPlayerLeave ¶
func (r *Room) OnPlayerLeave(newPlayer *ConnectedPlayer)
Click to show internal directories.
Click to hide internal directories.