Continue prototyping
This commit is contained in:
37
main.go
37
main.go
@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user