56 lines
882 B
Go
56 lines
882 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
|
|
"dndmusicbot/snapcast"
|
|
|
|
"github.com/gopxl/beep"
|
|
"github.com/gopxl/beep/effects"
|
|
|
|
discordspeaker "dndmusicbot/speaker"
|
|
)
|
|
|
|
var pl_volume *effects.Volume
|
|
var amb_volume *effects.Volume
|
|
|
|
func init() {
|
|
log.Println("beep.go loading..")
|
|
amb := beep.Mixer{}
|
|
|
|
amb_volume = &effects.Volume{
|
|
Streamer: &amb,
|
|
Base: 2,
|
|
Volume: -2,
|
|
Silent: false,
|
|
}
|
|
|
|
discordspeaker.Play(amb_volume)
|
|
|
|
amb_stream, err := snapcast.New("127.0.0.1", config.GetInt("mpd.ambiance"))
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
amb.Add(amb_stream)
|
|
|
|
pl := beep.Mixer{}
|
|
|
|
pl_volume = &effects.Volume{
|
|
Streamer: &pl,
|
|
Base: 2,
|
|
Volume: -2,
|
|
Silent: false,
|
|
}
|
|
|
|
discordspeaker.Play(pl_volume)
|
|
|
|
pl_stream, err := snapcast.New("127.0.0.1", config.GetInt("mpd.playlist"))
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
pl.Add(pl_stream)
|
|
|
|
log.Println("beep.go done.")
|
|
}
|