Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientMIDI ¶
type ClientMIDI interface { Stop() error // Stops the MIDI client and releases resources. ListDevices() ([]DeviceInfo, error) // Lists all available MIDI devices. SelectDevice(deviceID int) error // Selects a MIDI device by its ID for communication. StartCapture(eventChannel chan MIDI) // Starts capturing MIDI events and sends them to the specified channel. }
ClientMIDI defines an interface for MIDI client operations.
type ClientOptions ¶
type ClientOptions struct { Logger Logger // Logger for logging events and errors. LogLevel LogLevel // Level of logging to use. LogFilePath string // File path for logging if file logging is enabled. MIDIEventFilter *MIDIEventFilter // Optional filter for MIDI events to capture. CoreMIDIConfig *CoreMIDIConfig // Configuration specific to CoreMIDI. }
ClientOptions defines the configuration options for the MIDI client.
type CoreMIDIConfig ¶
type CoreMIDIConfig struct {
ClientName string // Name of the MIDI client.
}
CoreMIDIConfig holds configuration for CoreMIDI.
type DeviceInfo ¶
type DeviceInfo struct { Name string // Device name. Manufacturer string // Device manufacturer. EntityName string // Name of the entity to which the device belongs. }
DeviceInfo contains information about a MIDI device.
type Field ¶
type Field interface { Bool(key string, val bool) Field Int(key string, val int) Field Float64(key string, val float64) Field String(key string, val string) Field Time(key string, val time.Time) Field Int64(key string, val int64) Field Error(key string, val error) Field Uint64(key string, val uint64) Field Uint8(key string, val uint8) Field }
Field representa um campo de log com vários tipos de dados.
type LogDestination ¶
type LogDestination string
LogDestination specifies where the log messages should be directed.
const ( // ConsoleLog directs log messages to the console output. ConsoleLog LogDestination = "console" // FileLog directs log messages to a file. FileLog LogDestination = "file" )
type LogLevel ¶
type LogLevel int
LogLevel represents the severity level for logging.
const ( // InfoLevel indicates informational messages that highlight the progress of the application. InfoLevel LogLevel = iota // DebugLevel indicates debug messages that are useful for developers to troubleshoot issues. DebugLevel // ErrorLevel indicates error messages that represent serious issues that need attention. ErrorLevel // WarnLevel indicates potentially harmful situations that should be monitored. WarnLevel // FatalLevel indicates very severe error events that will presumably lead the application to abort. FatalLevel )
type Logger ¶
type Logger interface { Info(msg string, fields ...Field) Error(msg string, fields ...Field) Debug(msg string, fields ...Field) Warn(msg string, fields ...Field) Fatal(msg string, fields ...Field) Field() Field SetLevel(level LogLevel) SetDestination(dest LogDestination, filePath ...string) }
Logger fornece métodos para registrar mensagens em diferentes níveis.
type MIDI ¶
type MIDI struct { Timestamp uint64 // Timestamp indicates the time the event occurred. Command byte // Command specifies the type of MIDI event (e.g., Note On, Note Off). Note byte // Note represents the MIDI note number (0-127). Velocity byte // Velocity indicates the strength of the note being played (0-127). }
MIDI represents a MIDI event with a timestamp, command, note, and velocity.
type MIDICommand ¶
type MIDICommand byte
MIDICommand represents the types of MIDI commands for event filtering.
const ( // NoteOn is the MIDI command for a Note On event (0x90). NoteOn MIDICommand = 0x90 // NoteOff is the MIDI command for a Note Off event (0x80). NoteOff MIDICommand = 0x80 )
type MIDIEventFilter ¶
type MIDIEventFilter struct {
Commands []MIDICommand // List of MIDI commands to filter.
}
MIDIEventFilter allows users to specify which MIDI commands to capture.
type Option ¶
type Option func(*ClientOptions)
Option is a function that modifies ClientOptions.
func WithCoreMIDIConfig ¶
func WithCoreMIDIConfig(config CoreMIDIConfig) Option
WithCoreMIDIConfig sets the CoreMIDI configuration for the MIDI client.
func WithLogLevel ¶
WithLogLevel sets the logging level for the MIDI client.
func WithMIDIEventFilter ¶
func WithMIDIEventFilter(filter MIDIEventFilter) Option
WithMIDIEventFilter sets the MIDI event filter for the MIDI client.