Ejemplo n.º 1
0
func GetDestinations() (ret map[string]Destination) {
	destCount := C.MIDIGetNumberOfDestinations()
	fmt.Println("Found destination count:  ", destCount)

	ret = make(map[string]Destination)
	var x C.ItemCount = 0
	for ; x < destCount; x++ {
		dest := C.MIDIGetDestination(x)
		var destName C.CFStringRef
		C.MIDIObjectGetStringProperty((C.MIDIObjectRef)(dest), C.kMIDIPropertyName, &destName)
		cleanName := strings.Trim(cstrToStr(destName), "\u0000")
		ret[cleanName] = Destination{cleanName, CoreMidiEndpoint(dest)}
	}

	return
}
Ejemplo n.º 2
0
func (object Object) getStringProperty(key C.CFStringRef) (propValue string) {
	var result C.CFStringRef

	osStatus := C.MIDIObjectGetStringProperty(object.object, key, &result)

	if osStatus != C.noErr {
		return
	}

	defer C.CFRelease((C.CFTypeRef)(result))

	value := C.CFStringGetCStringPtr(result, C.kCFStringEncodingMacRoman)
	propValue = C.GoString(value)

	return
}