Continue prototyping

This commit is contained in:
2020-04-29 14:33:39 +02:00
parent d6f9ac7138
commit 86d6751754
2 changed files with 88 additions and 2 deletions

37
main.go
View File

@ -2,13 +2,16 @@ package main
import (
"fmt"
"os"
"io"
"time"
"remote-mic/socketops"
"remote-mic/pulsectl"
"remote-mic/audio"
)
func nop() {
func socketExample() {
fmt.Print("Listening for TCP connection on port 8080... ")
conn, err := socketops.AcceptConn(":8080")
if err != nil {
@ -24,7 +27,7 @@ func nop() {
fmt.Println("Exiting.")
}
func main() {
func pulsectlExample() {
pulsectl.LoadPipeSource(pulsectl.PipeSourceConfig{
"remote-mic",
"/dev/shm",
@ -35,3 +38,33 @@ func main() {
time.Sleep(10 * time.Second)
pulsectl.UnloadPipeSource()
}
func micStreamExample() {
cmd := audio.StreamMic(audio.MicStreamConfig{
"avfoundation",
":0",
"s16le",
44100,
2,
})
pipe, _ := cmd.StdoutPipe()
cmd.Start()
for {
io.Copy(os.Stdout, pipe)
}
}
func getDeviceExample() {
device, err := audio.GetMicDevice()
if err != nil {
panic(err)
}
fmt.Println(device)
}
func main() {
getDeviceExample()
}