midi

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package midi provides Go bindings for Android MIDI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	// contains filtered or unexported fields
}

Device wraps the NDK AMidiDevice handle.

func NewDeviceFromPointer

func NewDeviceFromPointer(ptr unsafe.Pointer) *Device

NewDeviceFromPointer wraps a raw AMidiDevice pointer.

func (*Device) Close

func (h *Device) Close() error

Close releases the underlying NDK handle.

func (*Device) GetType

func (h *Device) GetType() error

GetType calls the underlying NDK function.

func (*Device) NumInputPorts

func (h *Device) NumInputPorts() int64

NumInputPorts returns the value directly.

func (*Device) NumOutputPorts

func (h *Device) NumOutputPorts() int64

NumOutputPorts returns the value directly.

func (*Device) OpenInputPort

func (h *Device) OpenInputPort(portNumber int32) (*InputPort, error)

OpenInputPort creates a new InputPort from this Device.

func (*Device) OpenOutputPort

func (h *Device) OpenOutputPort(portNumber int32) (*OutputPort, error)

OpenOutputPort creates a new OutputPort from this Device.

func (*Device) Pointer

func (h *Device) Pointer() unsafe.Pointer

Pointer returns the underlying pointer as unsafe.Pointer.

type Error

type Error int32

Error represents an NDK error code.

const (
	ErrUnknown    Error = -1
	ErrWouldBlock Error = -2
)

func (Error) Error

func (e Error) Error() string

type InputPort

type InputPort struct {
	// contains filtered or unexported fields
}

InputPort wraps the NDK AMidiInputPort handle.

func NewInputPortFromPointer

func NewInputPortFromPointer(ptr unsafe.Pointer) *InputPort

NewInputPortFromPointer wraps a raw AMidiInputPort pointer.

func (*InputPort) Close

func (h *InputPort) Close() error

Close releases the underlying NDK handle.

func (*InputPort) Pointer

func (h *InputPort) Pointer() unsafe.Pointer

Pointer returns the underlying pointer as unsafe.Pointer.

func (*InputPort) Send

func (h *InputPort) Send(buffer *uint8, numBytes uint64) error

Send calls the underlying NDK function.

func (*InputPort) SendWithTimestamp

func (h *InputPort) SendWithTimestamp(buffer *uint8, numBytes uint64, timestamp int64) int64

SendWithTimestamp returns the value directly.

type MIDI_DEVICE_TYPE

type MIDI_DEVICE_TYPE int32
const (
	AMIDI_DEVICE_TYPE_USB       MIDI_DEVICE_TYPE = 1
	AMIDI_DEVICE_TYPE_VIRTUAL   MIDI_DEVICE_TYPE = 2
	AMIDI_DEVICE_TYPE_BLUETOOTH MIDI_DEVICE_TYPE = 3
)

type MIDI_OPCODE

type MIDI_OPCODE int32
const (
	AMIDI_OPCODE_DATA  MIDI_OPCODE = 1
	AMIDI_OPCODE_FLUSH MIDI_OPCODE = 2
)

type Media_status_t

type Media_status_t = capi.Media_status_t

type MidiDevice_Protocol

type MidiDevice_Protocol int32
const (
	AMIDI_DEVICE_PROTOCOL_UMP_USE_MIDI_CI                      MidiDevice_Protocol = 0
	AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS           MidiDevice_Protocol = 1
	AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS_AND_JRTS  MidiDevice_Protocol = 2
	AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS          MidiDevice_Protocol = 3
	AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS_AND_JRTS MidiDevice_Protocol = 4
	AMIDI_DEVICE_PROTOCOL_UMP_MIDI_2_0                         MidiDevice_Protocol = 17
	AMIDI_DEVICE_PROTOCOL_UMP_MIDI_2_0_AND_JRTS                MidiDevice_Protocol = 18
	AMIDI_DEVICE_PROTOCOL_UNKNOWN                              MidiDevice_Protocol = -1
)

type OutputPort

type OutputPort struct {
	// contains filtered or unexported fields
}

OutputPort wraps the NDK AMidiOutputPort handle.

func NewOutputPortFromPointer

func NewOutputPortFromPointer(ptr unsafe.Pointer) *OutputPort

NewOutputPortFromPointer wraps a raw AMidiOutputPort pointer.

func (*OutputPort) Close

func (h *OutputPort) Close() error

Close releases the underlying NDK handle.

func (*OutputPort) Pointer

func (h *OutputPort) Pointer() unsafe.Pointer

Pointer returns the underlying pointer as unsafe.Pointer.

func (*OutputPort) Receive

func (h *OutputPort) Receive(opcodePtr *int32, buffer *uint8, maxBytes uint64, numBytesReceivedPtr *uint64, outTimestampPtr *int64) int64

Receive returns the value directly.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL