pnyx/cmd/server/main.go

44 lines
703 B
Go

package main
import (
"os"
"os/signal"
"syscall"
"git.metznet.ca/MetzNet/pnyx"
)
func main() {
os_sigs := make(chan os.Signal, 1)
signal.Notify(os_sigs, syscall.SIGINT, syscall.SIGABRT)
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)
}
server, err := pnyx.NewServer(nil, map[pnyx.ChannelID]*pnyx.Channel{
0: channel_0,
})
if err != nil {
panic(err)
}
err = server.Start(os.Args[1])
if err != nil {
panic(err)
}
<-os_sigs
err = server.Stop()
if err != nil {
panic(err)
}
}