// Activate starts event processing loops and calls jack_activate. func (this *Client) Activate() error { if err := this.startGenericCallbackSync(); err != nil { return err } else if err := this.startProcessCallbackSync(); err != nil { return err } else if result := C.jack_activate(this.jackClient); result != 0 { return errors.New("jack_activate returned " + strconv.Itoa(int(result)) + " for client '" + this.GetName() + "'") } else { return nil } }
// New: Create a new jack client with the given name and the given number // of input and output ports. func New(name string, numInputs, numOutputs int) (*JackClient, error) { jc := new(JackClient) jc.name = name // Create jack client. jc.client = C.wrap_jack_client_open(C.CString(name)) if jc.client == nil { return nil, errors.New("Failed to initialize jack client.") } // Create ports. for i := 0; i < numInputs; i++ { port := C.jack_port_register( jc.client, C.CString(fmt.Sprintf("in_%d", i)), C.CString(C.JACK_DEFAULT_AUDIO_TYPE), C.JackPortIsInput, 0) jc.jackIn = append(jc.jackIn, port) } for i := 0; i < numOutputs; i++ { port := C.jack_port_register( jc.client, C.CString(fmt.Sprintf("out_%d", i)), C.CString(C.JACK_DEFAULT_AUDIO_TYPE), C.JackPortIsOutput, 0) jc.jackOut = append(jc.jackOut, port) } // Create buffers. jc.bufIn = make([][]float32, numInputs) jc.bufOut = make([][]float32, numOutputs) // Register jack callback. C.register_callback(jc.client, unsafe.Pointer(jc)) C.jack_activate(jc.client) // Done. return jc, nil }
func (client *Client) Activate() int { return int(C.jack_activate(client.handler)) }