Documentation ¶
Overview ¶
Package portmidi provides PortMidi bindings.
Index ¶
- Variables
- func CountDevices() int
- func Initialize() error
- func Terminate() error
- type Channel
- type DeviceID
- type DeviceInfo
- type Event
- type Stream
- func (s *Stream) Abort() error
- func (s *Stream) Close() error
- func (s *Stream) Listen() <-chan Event
- func (s *Stream) Poll() (bool, error)
- func (s *Stream) Read(max int) (events []Event, err error)
- func (s *Stream) ReadSysExBytes(max int) ([]byte, error)
- func (s *Stream) SetChannelMask(mask int) error
- func (s *Stream) Write(events []Event) error
- func (s *Stream) WriteShort(status int64, data1 int64, data2 int64) error
- func (s *Stream) WriteShorts(status int64, data1s []int64, data2s []int64) error
- func (s *Stream) WriteSysEx(when Timestamp, msg string) error
- func (s *Stream) WriteSysExBytes(when Timestamp, msg []byte) error
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
var ( ErrMaxBuffer = errors.New("portmidi: max event buffer size is 1024") ErrMinBuffer = errors.New("portmidi: min event buffer size is 1") )
Functions ¶
func Initialize ¶
func Initialize() error
Initialize initializes the portmidi. Needs to be called before making any other call from the portmidi package. Once portmidi package is no longer required, Terminate should be called to free the underlying resources.
Types ¶
type DeviceID ¶
type DeviceID int
DeviceID is a MIDI device ID.
func DefaultInputDeviceID ¶
func DefaultInputDeviceID() DeviceID
DefaultInputDeviceID returns the default input device's ID.
func DefaultOutputDeviceID ¶
func DefaultOutputDeviceID() DeviceID
DefaultOutputDeviceID returns the default output device's ID.
type DeviceInfo ¶
type DeviceInfo struct { Interface string Name string IsInputAvailable bool IsOutputAvailable bool IsOpened bool }
DeviceInfo provides info about a MIDI device.
func Info ¶
func Info(deviceID DeviceID) *DeviceInfo
Info returns the device info for the device indentified with deviceID. If deviceID is out of range, Info returns nil.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream represents a portmidi stream.
func NewInputStream ¶
NewInputStream initializes a new input stream.
func NewOutputStream ¶
NewOutputStream initializes a new output stream.
func (*Stream) Read ¶
Reads from the input stream, the max number events to be read are determined by max.
func (*Stream) ReadSysExBytes ¶
ReadSysExBytes reads 4*max sysex bytes from the input stream.
func (*Stream) SetChannelMask ¶
SetChannelMask filters incoming stream based on channel. In order to filter from more than a single channel, or multiple channels. s.SetChannelMask(Channel(1) | Channel(10)) will both filter input from channel 1 and 10.
func (*Stream) WriteShort ¶
WriteShort writes a MIDI event of three bytes immediately to the output stream.
func (*Stream) WriteShorts ¶
WriteShorts writes a bunch of MIDI events of three bytes immediately to the output stream.
func (*Stream) WriteSysEx ¶
WriteSysEx writes a system exclusive MIDI message given as a string of hexadecimal characters to the output stream. The string must only consist of hex digits (0-9A-F) and optional spaces. This function is case-insenstive.