2022-11-18 21:18:12 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
2023-11-02 20:30:29 +00:00
|
|
|
"dndmusicbot/snapcast"
|
|
|
|
|
2023-10-26 20:49:39 +00:00
|
|
|
"github.com/gopxl/beep"
|
|
|
|
"github.com/gopxl/beep/effects"
|
2022-11-18 21:18:12 +00:00
|
|
|
|
|
|
|
discordspeaker "dndmusicbot/speaker"
|
|
|
|
)
|
|
|
|
|
2022-12-03 18:22:05 +00:00
|
|
|
var pl_volume *effects.Volume
|
|
|
|
var amb_volume *effects.Volume
|
|
|
|
|
2022-11-18 21:18:12 +00:00
|
|
|
func init() {
|
2023-10-26 20:49:39 +00:00
|
|
|
log.Println("beep.go loading..")
|
2023-11-02 20:30:29 +00:00
|
|
|
amb := beep.Mixer{}
|
2022-12-03 18:22:05 +00:00
|
|
|
|
|
|
|
amb_volume = &effects.Volume{
|
2023-11-02 20:30:29 +00:00
|
|
|
Streamer: &amb,
|
2022-12-03 18:22:05 +00:00
|
|
|
Base: 2,
|
2023-11-02 20:30:29 +00:00
|
|
|
Volume: -2,
|
2022-12-03 18:22:05 +00:00
|
|
|
Silent: false,
|
|
|
|
}
|
2023-11-02 20:30:29 +00:00
|
|
|
|
2022-12-03 18:22:05 +00:00
|
|
|
discordspeaker.Play(amb_volume)
|
2022-11-18 21:18:12 +00:00
|
|
|
|
2023-11-02 20:30:29 +00:00
|
|
|
amb_stream, err := snapcast.New("127.0.0.1", config.GetInt("mpd.ambiance"))
|
2022-11-23 07:37:59 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
2023-11-02 20:30:29 +00:00
|
|
|
amb.Add(amb_stream)
|
|
|
|
|
|
|
|
pl := beep.Mixer{}
|
2022-11-23 07:37:59 +00:00
|
|
|
|
2022-12-03 18:22:05 +00:00
|
|
|
pl_volume = &effects.Volume{
|
2023-11-02 20:30:29 +00:00
|
|
|
Streamer: &pl,
|
2022-11-23 22:29:45 +00:00
|
|
|
Base: 2,
|
|
|
|
Volume: -2,
|
|
|
|
Silent: false,
|
|
|
|
}
|
|
|
|
|
2022-12-03 18:22:05 +00:00
|
|
|
discordspeaker.Play(pl_volume)
|
2022-11-23 07:37:59 +00:00
|
|
|
|
2023-11-02 20:30:29 +00:00
|
|
|
pl_stream, err := snapcast.New("127.0.0.1", config.GetInt("mpd.playlist"))
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
pl.Add(pl_stream)
|
|
|
|
|
2023-10-26 20:49:39 +00:00
|
|
|
log.Println("beep.go done.")
|
2022-11-18 21:18:12 +00:00
|
|
|
}
|