Exemple #1
0
func makeOutput(client C.MIDIClientRef, name string, midiChannel int, destination C.MIDIEndpointRef) (ret Output) {
	var outPort C.MIDIPortRef
	C.MIDIOutputPortCreate(client, strToCfstr(name), &outPort)
	ret = Output{outPort, midiChannel, destination, make(chan NoteEvent, 100)}
	go outputHandler(ret)
	return
}
Exemple #2
0
func NewOutputPort(client Client, name string) (outputPort OutputPort, err error) {
	var port C.MIDIPortRef

	stringToCFString(name, func(cfName C.CFStringRef) {
		osStatus := C.MIDIOutputPortCreate(client.client, cfName, &port)

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

	return
}