dgvoice

package module
v0.0.0-...-5cfd0e2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2018 License: BSD-3-Clause Imports: 9 Imported by: 0

README

dgVoice

GoDoc Go report Build Status Discord Gophers

dgVoice is a Go package that provides an example of adding opus audio and play file support for DiscordGo.

  • You must use the current develop branch of Discordgo
  • You must have ffmpeg in your path and Opus libs already installed.

This code should be considered just a proof of concept, or an example, of accomplishing this task and not a defacto standard.

Please send feedback on any performance improvements that can be made for sound quality, stability, or efficiency.

For help with this package or general Go discussion, please join the Discord Gophers chat server.

Getting Started

Installing

This assumes you already have a working Go environment, if not please see this page first.

go get github.com/bwmarrin/dgvoice

Usage Example

See example folder

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 (
	Volume = 75

	Run *exec.Cmd

	IsSpeaking = false
	ListReady  = true
	Paused     = false
)

Functions

func IsThisThingOn

func IsThisThingOn() bool

func KillPlayer

func KillPlayer()

KillPlayer forces the player to stop by killing the ffmpeg cmd process this method may be removed later in favor of using chans or bools to request a stop.

func PlayAudioFile

func PlayAudioFile(v *discordgo.VoiceConnection, filename string, s *discordgo.Session) (err error)

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

type StreamingSession

type StreamingSession struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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