Exemplo n.º 1
0
func (entity Entity) Destinations() (destinations []Destination, err error) {
	numberOfDestinations := int(C.ItemCount(C.MIDIEntityGetNumberOfDestinations(entity.entity)))
	destinations = make([]Destination, numberOfDestinations)

	for i := range destinations {
		destination := C.MIDIEntityGetDestination(entity.entity, 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
}
Exemplo n.º 2
0
func (entity Entity) Sources() (sources []Source, err error) {
	numberOfSources := int(C.ItemCount(C.MIDIEntityGetNumberOfSources(entity.entity)))
	sources = make([]Source, numberOfSources)

	for i := range sources {
		source := C.MIDIEntityGetSource(entity.entity, C.ItemCount(i))

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

			return
		}

		sources[i] = Source{source, &Object{C.MIDIObjectRef(source)}}
	}

	return
}
Exemplo n.º 3
0
func (device Device) Entities() (entities []Entity, err error) {
	numberOfEntitiles := int(C.ItemCount(C.MIDIDeviceGetNumberOfEntities(device.device)))
	entities = make([]Entity, numberOfEntitiles)

	for i := range entities {
		entity := C.MIDIDeviceGetEntity(device.device, C.ItemCount(i))

		if entity == (C.MIDIEntityRef)(0) {
			err = errors.New("failed to get entity")

			return
		}

		entities[i] = Entity{entity, &Object{C.MIDIObjectRef(entity)}}
	}

	return
}
Exemplo n.º 4
0
func AllDevices() (devices []Device, err error) {
	numberOfDevices := numberOfDevices()
	devices = make([]Device, numberOfDevices)

	for i := range devices {
		device := C.MIDIGetDevice(C.ItemCount(i))

		if device == (C.MIDIDeviceRef)(0) {
			err = errors.New("failed to get device")

			return
		}

		devices[i] = Device{
			device,
			&Object{C.MIDIObjectRef(device)}}
	}

	return
}
Exemplo n.º 5
0
func numberOfSources() int {
	return int(C.ItemCount(C.MIDIGetNumberOfSources()))
}
Exemplo n.º 6
0
func numberOfDestinations() int {
	return int(C.ItemCount(C.MIDIGetNumberOfDestinations()))
}