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 }
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 }
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 }
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 }
func numberOfSources() int { return int(C.ItemCount(C.MIDIGetNumberOfSources())) }
func numberOfDestinations() int { return int(C.ItemCount(C.MIDIGetNumberOfDestinations())) }