diff --git a/Dockerfile b/Dockerfile index 598a8ee8..5de162aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,5 +8,8 @@ RUN apt-get update RUN apt-get install portaudio19-dev -y RUN apt-get install libvpx-dev -y RUN go get github.com/pions/webrtc -RUN go get github.com/gordonklaus/portaudio +#RUN go get github.com/gordonklaus/portaudio RUN go get github.com/gorilla/mux +RUN go install github.com/giongto35/game-online + +EXPOSE 8000 diff --git a/ui/audio.go b/ui/audio.go deleted file mode 100644 index 6508b2cb..00000000 --- a/ui/audio.go +++ /dev/null @@ -1,54 +0,0 @@ -package ui - -import "github.com/gordonklaus/portaudio" - -type Audio struct { - stream *portaudio.Stream - sampleRate float64 - outputChannels int - channel chan float32 -} - -func NewAudio() *Audio { - a := Audio{} - a.channel = make(chan float32, 44100) - return &a -} - -func (a *Audio) Start() error { - host, err := portaudio.DefaultHostApi() - if err != nil { - return err - } - parameters := portaudio.HighLatencyParameters(nil, host.DefaultOutputDevice) - stream, err := portaudio.OpenStream(parameters, a.Callback) - if err != nil { - return err - } - if err := stream.Start(); err != nil { - return err - } - a.stream = stream - a.sampleRate = parameters.SampleRate - a.outputChannels = parameters.Output.Channels - return nil -} - -func (a *Audio) Stop() error { - return a.stream.Close() -} - -func (a *Audio) Callback(out []float32) { - var output float32 - for i := range out { - if i%a.outputChannels == 0 { - select { - case sample := <-a.channel: - output = sample - default: - output = 0 - } - } - out[i] = output - } -}