Module: Webmidi::Message
- Defined in:
- lib/webmidi/message.rb,
lib/webmidi/message/ump.rb,
lib/webmidi/message/base.rb,
lib/webmidi/message/parser.rb,
lib/webmidi/message/system.rb,
lib/webmidi/message/channel.rb
Defined Under Namespace
Modules: Channel, Parser, System, UMP
Classes: Base
Constant Summary
collapse
- DEFAULT_ARGUMENT =
Object.new.freeze
Class Method Summary
collapse
-
.active_sensing(timestamp: nil) ⇒ Object
-
.channel_pressure(pressure, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
-
.clock(timestamp: nil) ⇒ Object
-
.continue(timestamp: nil) ⇒ Object
-
.control_change(cc, value, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
-
.downgrade(midi2_message) ⇒ Object
-
.from_bytes(*bytes, normalize_note_on_zero: true) ⇒ Object
-
.note_off(note, velocity: 0, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
-
.note_on(note, velocity: DEFAULT_ARGUMENT, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
-
.parse_many(bytes, normalize_note_on_zero: true) ⇒ Object
-
.pitch_bend(value = Channel::PitchBend::CENTER, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
-
.pitch_bend_signed(value, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
-
.polyphonic_pressure(note, pressure, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
-
.program_change(program, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
-
.song_position(position, timestamp: nil) ⇒ Object
-
.song_select(song, timestamp: nil) ⇒ Object
-
.start(timestamp: nil) ⇒ Object
-
.stop(timestamp: nil) ⇒ Object
-
.sysex(*data, timestamp: nil) ⇒ Object
-
.system_reset(timestamp: nil) ⇒ Object
-
.time_code(type, value, timestamp: nil) ⇒ Object
-
.tune_request(timestamp: nil) ⇒ Object
-
.upgrade(midi1_message, group: DEFAULT_ARGUMENT) ⇒ Object
Class Method Details
.active_sensing(timestamp: nil) ⇒ Object
103
104
105
|
# File 'lib/webmidi/message.rb', line 103
def self.active_sensing(timestamp: nil)
System::ActiveSensing.new(timestamp: timestamp)
end
|
.channel_pressure(pressure, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
.clock(timestamp: nil) ⇒ Object
87
88
89
|
# File 'lib/webmidi/message.rb', line 87
def self.clock(timestamp: nil)
System::Clock.new(timestamp: timestamp)
end
|
.continue(timestamp: nil) ⇒ Object
95
96
97
|
# File 'lib/webmidi/message.rb', line 95
def self.continue(timestamp: nil)
System::Continue.new(timestamp: timestamp)
end
|
.control_change(cc, value, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
.downgrade(midi2_message) ⇒ Object
140
141
142
|
# File 'lib/webmidi/message.rb', line 140
def self.downgrade(midi2_message)
UMP.downgrade(midi2_message)
end
|
.from_bytes(*bytes, normalize_note_on_zero: true) ⇒ Object
127
128
129
130
|
# File 'lib/webmidi/message.rb', line 127
def self.from_bytes(*bytes, normalize_note_on_zero: true)
bytes = bytes.flatten
Parser.parse_single(bytes, normalize_note_on_zero: normalize_note_on_zero)
end
|
.note_off(note, velocity: 0, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'lib/webmidi/message.rb', line 24
def self.note_off(note, velocity: 0, channel: DEFAULT_ARGUMENT, timestamp: nil)
Channel::NoteOff.new(
note: coerce_note(note),
velocity: velocity,
channel: default_value(channel, Webmidi.configuration.default_channel),
timestamp: timestamp
)
end
|
.note_on(note, velocity: DEFAULT_ARGUMENT, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
.parse_many(bytes, normalize_note_on_zero: true) ⇒ Object
132
133
134
|
# File 'lib/webmidi/message.rb', line 132
def self.parse_many(bytes, normalize_note_on_zero: true)
Parser.parse_many(bytes, normalize_note_on_zero: normalize_note_on_zero)
end
|
.pitch_bend(value = Channel::PitchBend::CENTER, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
.pitch_bend_signed(value, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
.polyphonic_pressure(note, pressure, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
58
59
60
61
62
63
64
65
|
# File 'lib/webmidi/message.rb', line 58
def self.polyphonic_pressure(note, pressure, channel: DEFAULT_ARGUMENT, timestamp: nil)
Channel::PolyphonicPressure.new(
note: coerce_note(note),
pressure: pressure,
channel: default_value(channel, Webmidi.configuration.default_channel),
timestamp: timestamp
)
end
|
.program_change(program, channel: DEFAULT_ARGUMENT, timestamp: nil) ⇒ Object
.song_position(position, timestamp: nil) ⇒ Object
115
116
117
|
# File 'lib/webmidi/message.rb', line 115
def self.song_position(position, timestamp: nil)
System::SongPosition.new(position: position, timestamp: timestamp)
end
|
.song_select(song, timestamp: nil) ⇒ Object
119
120
121
|
# File 'lib/webmidi/message.rb', line 119
def self.song_select(song, timestamp: nil)
System::SongSelect.new(song: song, timestamp: timestamp)
end
|
.start(timestamp: nil) ⇒ Object
91
92
93
|
# File 'lib/webmidi/message.rb', line 91
def self.start(timestamp: nil)
System::Start.new(timestamp: timestamp)
end
|
.stop(timestamp: nil) ⇒ Object
99
100
101
|
# File 'lib/webmidi/message.rb', line 99
def self.stop(timestamp: nil)
System::Stop.new(timestamp: timestamp)
end
|
.sysex(*data, timestamp: nil) ⇒ Object
83
84
85
|
# File 'lib/webmidi/message.rb', line 83
def self.sysex(*data, timestamp: nil)
System::SysEx.new(data: data, timestamp: timestamp)
end
|
.system_reset(timestamp: nil) ⇒ Object
107
108
109
|
# File 'lib/webmidi/message.rb', line 107
def self.system_reset(timestamp: nil)
System::SystemReset.new(timestamp: timestamp)
end
|
.time_code(type, value, timestamp: nil) ⇒ Object
111
112
113
|
# File 'lib/webmidi/message.rb', line 111
def self.time_code(type, value, timestamp: nil)
System::TimeCode.new(type: type, value: value, timestamp: timestamp)
end
|
.tune_request(timestamp: nil) ⇒ Object
123
124
125
|
# File 'lib/webmidi/message.rb', line 123
def self.tune_request(timestamp: nil)
System::TuneRequest.new(timestamp: timestamp)
end
|
.upgrade(midi1_message, group: DEFAULT_ARGUMENT) ⇒ Object