Documentation ¶
Overview ¶
Package dgvoice provides opus encoding and audio file playback for the Discordgo package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var OnError = func(str string, err error) { prefix := "dgVoice: " + str if err != nil { os.Stderr.WriteString(prefix + ": " + err.Error()) } else { os.Stderr.WriteString(prefix) } }
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, endtime chan<- float64, skipahead float64, isMono 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. Must say if this is mono or stereo. Ignore all other channels because discord maxxes out at stereo end time is the point in the audio that it was stopped. this is to allow for resuming later on
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.
Types ¶
This section is empty.