Exemple #1
0
// NewClient creates a new Jack client via jack_client_open.
func NewClient(name string, options Options, serverName string) (*Client, Status, error) {
	var status C.jack_status_t
	var clientPtr *Client
	var err error

	if serverName != "" {
		options |= JackServerName
	}

	nameCStr := C.CString(name)
	serverNameCStr := C.CString(serverName)
	defer C.free(unsafe.Pointer(nameCStr))
	defer C.free(unsafe.Pointer(serverNameCStr))

	jackClient := C.gojack_client_open(nameCStr, C.jack_options_t(options), &status, serverNameCStr)
	if jackClient != nil {
		nameCStr := C.jack_get_client_name(jackClient)
		//C.free(nameCStr)
		clientPtr = &Client{jackClient: jackClient, name: C.GoString(nameCStr)}
	} else {
		err = errors.New("jack_client_open returned status " + strconv.Itoa(int(status)))
	}
	return clientPtr, Status(status), err
}
Exemple #2
0
func (client *Client) GetName() string {
	return C.GoString(C.jack_get_client_name(client.handler))
}