Example #1
0
func MakeClient(name string) Client {
	cfName := strToCfstr(name)
	var client C.MIDIClientRef
	err := C.MIDIClientCreate(cfName, nil, nil, &client)
	//TODO:  actual error handling (DERP)
	if err != C.noErr {
		fmt.Println("Error creating client:  ", int(err))
	}

	return Client{client}
}
Example #2
0
func NewClient(name string) (client Client, err error) {
	var clientRef C.MIDIClientRef

	stringToCFString(name, func(cfName C.CFStringRef) {
		osStatus := C.MIDIClientCreate(cfName, nil, nil, &clientRef)

		if osStatus != C.noErr {
			err = errors.New(fmt.Sprintf("%d: failed to create a client", int(osStatus)))
		} else {
			client = Client{clientRef}
		}
	})

	return
}