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 AllDestinations() (destinations []Destination, err error) {
	numberOfDestinations := numberOfDestinations()
	destinations = make([]Destination, numberOfDestinations)

	for i := range destinations {
		destination := C.MIDIGetDestination(C.ItemCount(i))

		if destination == (C.MIDIEndpointRef)(0) {
			err = errors.New("failed to get destination")

			return
		}

		destinations[i] = Destination{
			destination,
			&Object{C.MIDIObjectRef(destination)}}
	}

	return
}