pnyx/cmd/server/main.go

39 lines
644 B
Go

2024-04-03 18:52:04 -06:00
package main
import (
"os"
"os/signal"
"syscall"
"git.metznet.ca/MetzNet/pnyx"
)
func main() {
os_sigs := make(chan os.Signal, 1)
2024-04-18 20:10:01 -06:00
signal.Notify(os_sigs, syscall.SIGINT, syscall.SIGABRT)
2024-04-03 18:52:04 -06:00
2024-04-16 15:06:53 -06:00
channel_0, err := pnyx.NewChannel(map[pnyx.ModeID]pnyx.Mode{
pnyx.MODE_RAW: pnyx.RawMode{},
pnyx.MODE_AUDIO: pnyx.AudioMode{
SampleRate: pnyx.SAMPLE_RATE_48KHZ,
},
})
if err != nil {
panic(err)
}
2024-04-03 18:52:04 -06:00
server, err := pnyx.NewServer(os.Args[1], nil, map[pnyx.ChannelID]*pnyx.Channel{
2024-04-16 15:06:53 -06:00
0: channel_0,
})
2024-04-03 18:52:04 -06:00
if err != nil {
panic(err)
}
<-os_sigs
err = server.Stop()
if err != nil {
panic(err)
}
}