Documentation ¶
Overview ¶
Package dgvoice provides opus encoding and audio file playback for the Discordgo package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var OnError = func(str string, err error) { prefix := "dgVoice: " + str if err != nil { os.Stderr.WriteString(prefix + ": " + err.Error() + "\n") } else { os.Stderr.WriteString(prefix + "\n") } }
OnError gets called by dgvoice when an error is encountered. By default logs to STDERR
Functions ¶
func PlayAudioFile ¶
func PlayAudioFile(v *discordgo.VoiceConnection, filename string, stop <-chan bool)
PlayAudioFile will play the given filename to the already connected Discord voice server/channel. voice websocket and udp socket must already be setup before this will work.
func ReceivePCM ¶
func ReceivePCM(v *discordgo.VoiceConnection, c chan *discordgo.Packet)
ReceivePCM will receive on the the Discordgo OpusRecv channel and decode the opus audio into PCM then send it on the provided channel.
func SendPCM ¶
func SendPCM(v *discordgo.VoiceConnection, pcm <-chan []int16)
SendPCM will receive on the provied channel encode received PCM data into Opus then send that to Discordgo
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.