| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Go bindings for Jack Audio Connection Kit
For a working passthrough example see example/passthrough.go
Import the package:
import "github.com/xthexder/go-jack"Connect to an existing jack server:
client, _ := jack.ClientOpen("Example Client", jack.NoStartServer)
if client == nil {
fmt.Println("Could not connect to jack server.")
return
}
defer client.Close()Add a processing callback:
func process(nframes uint32) int {
// Do processing here
return 0
}
/* ... */
if code := client.SetProcessCallback(process); code != 0 {
fmt.Println("Failed to set process callback.")
return
}Activate the client:
if code := client.Activate(); code != 0 {
fmt.Println("Failed to activate client.")
return
}Add an output port:
port := client.PortRegister("out_1", jack.DEFAULT_AUDIO_TYPE, jack.PortIsOutput, 0)Output a sine wave:
var Port *jack.Port
func process(nframes uint32) int {
samples := Port.GetBuffer(nframes)
nsamples := float64(len(samples))
for i := range samples {
samples[i] = jack.AudioSample(math.Sin(float64(i)*math.Pi*20/nsamples) / 2)
}
return 0
}See Official Jack API for detailed documentation on each of these functions.
| Back | FazBrowse Home | New Git URL |