예제 #1
0
파일: client.go 프로젝트: j14159/gocmc
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}
}
예제 #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
}