dndmusicbot/mixer.go

72 lines
1.1 KiB
Go
Raw Normal View History

2022-12-22 11:43:40 +00:00
package main
import (
"log"
"time"
"github.com/faiface/beep"
"github.com/faiface/beep/effects"
"dndmusicbot/ffmpeg"
discordspeaker "dndmusicbot/speaker"
)
var (
pl_volume *effects.Volume
amb_volume *effects.Volume
amb_mixer beep.Mixer
amb_curr Ambiance
)
func init() {
log.Println("queue.go loading..")
amb_mixer = beep.Mixer{}
amb_volume = &effects.Volume{
Streamer: &amb_mixer,
Base: 2,
Volume: 2,
Silent: false,
}
discordspeaker.Play(amb_volume)
mpdstream, err := NewMPD()
if err != nil {
log.Fatal(err)
}
pl_volume = &effects.Volume{
Streamer: mpdstream,
Base: 2,
Volume: -2,
Silent: false,
}
discordspeaker.Play(pl_volume)
/*
app.queue = new(Queue)
app.queue.list = list.New()
app.queue.Events = app.events
discordspeaker.Play(app.queue)
*/
log.Println("queue.go done.")
}
type Song struct {
Title string
Channel string
VideoID string
Length time.Duration
PCM *ffmpeg.PCM
Playlist Playlist
DLuri string
}
func (s *Song) NewStream() (err error) {
s.PCM, err = ffmpeg.NewPCM(s.DLuri, sampleRate, channels)
return
}