Add change program event.
This commit is contained in:
parent
3947d6fa2a
commit
25830345ef
1 changed files with 14 additions and 0 deletions
|
@ -13,6 +13,14 @@ defmodule MIDITools.Event do
|
|||
end
|
||||
end
|
||||
|
||||
defmodule ChangeProgram do
|
||||
defstruct channel: 0, time: 0, program: 0
|
||||
|
||||
def new(channel, time, program) do
|
||||
%__MODULE__{channel: channel, time: time, program: program}
|
||||
end
|
||||
end
|
||||
|
||||
def convert(%Note{
|
||||
channel: channel,
|
||||
tone: tone,
|
||||
|
@ -24,4 +32,10 @@ defmodule MIDITools.Event do
|
|||
note_off = MIDISynth.Command.note_off(channel, tone)
|
||||
[{start_time, note_on}, {end_time, note_off}]
|
||||
end
|
||||
|
||||
def convert(%ChangeProgram{channel: channel, time: time, program: program}) do
|
||||
change_program = MIDISynth.Command.change_program(channel, program)
|
||||
|
||||
[{time, change_program}]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue