class SMF::Sequence::EncodeText

Public Instance Methods

allnotesoff(ch) click to toggle source
# File lib/smf/toy/text.rb, line 259
def allnotesoff(ch)
  @s << format("%d AllNotesOff %d\n", @offset, ch)
end
allsoundoff(ch) click to toggle source
# File lib/smf/toy/text.rb, line 247
def allsoundoff(ch)
  @s << format("%d AllSoundOff %d\n", @offset, ch)
end
channelprefix(ch) click to toggle source
# File lib/smf/toy/text.rb, line 318
def channelprefix(ch)
  @s << format("%d ChannelPrefix %d\n", @offset, ch)
end
channelpressure(ch, val) click to toggle source
# File lib/smf/toy/text.rb, line 239
def channelpressure(ch, val)
  @s << format("%d ChannelPressure %d %d\n", @offset, ch, val)
end
controlchange(ch, num, val) click to toggle source
# File lib/smf/toy/text.rb, line 231
def controlchange(ch, num, val)
  @s << format("%d ControlChange %d %d %d\n", @offset, ch, num, val)
end
copyrightnotice(text) click to toggle source
# File lib/smf/toy/text.rb, line 303
def copyrightnotice(text) text('CopyrightNotice', text) end
cuepoint(text) click to toggle source
# File lib/smf/toy/text.rb, line 308
def cuepoint(text) text('CuePoint', text) end
delta(delta) click to toggle source
# File lib/smf/toy/text.rb, line 216
def delta(delta) @offset += delta end
devicename(text) click to toggle source
# File lib/smf/toy/text.rb, line 310
def devicename(text) text('DeviceName', text) end
endoftrack() click to toggle source
# File lib/smf/toy/text.rb, line 326
def endoftrack
  @s << format("%d EndOfTrack\n", @offset)
end
exclusivef0(data) click to toggle source
# File lib/smf/toy/text.rb, line 289
def exclusivef0(data) put_binary('ExclusiveF0', data) end
exclusivef7(data) click to toggle source
# File lib/smf/toy/text.rb, line 290
def exclusivef7(data) put_binary('ExclusiveF7', data) end
generalpurposetext(text) click to toggle source
# File lib/smf/toy/text.rb, line 302
def generalpurposetext(text) text('GeneralPurposeText', text) end
header(format, ntrks, division, tc) click to toggle source
# File lib/smf/toy/text.rb, line 205
def header(format, ntrks, division, tc)
  if tc
    @s = format("MThd %d %d %d %d\n", format, ntrks, division, tc)
  else
    @s = format("MThd %d %d %d\n", format, ntrks, division)
  end
end
instrumentname(text) click to toggle source
# File lib/smf/toy/text.rb, line 305
def instrumentname(text) text('InstrumentName', text) end
keysignature(sf, mi) click to toggle source
# File lib/smf/toy/text.rb, line 343
def keysignature(sf, mi)
  @s << format("%d KeySignature %d %d\n", @offset, sf, mi)
end
localcontrol(ch, val) click to toggle source
# File lib/smf/toy/text.rb, line 255
def localcontrol(ch, val)
  @s << format("%d LocalControl %d %d\n", @offset, ch, val)
end
lyric(text) click to toggle source
# File lib/smf/toy/text.rb, line 306
def lyric(text) text('Lyric', text) end
marker(text) click to toggle source
# File lib/smf/toy/text.rb, line 307
def marker(text) text('Marker', text) end
midiport(num) click to toggle source
# File lib/smf/toy/text.rb, line 322
def midiport(num)
  @s << format("%d MIDIPort %d\n", @offset, num)
end
monomode(ch, val) click to toggle source
# File lib/smf/toy/text.rb, line 271
def monomode(ch, val)
  @s << format("%d MonoMode %d %d\n", @offset, ch, val)
end
noteoff(ch, note, vel) click to toggle source
# File lib/smf/toy/text.rb, line 218
def noteoff(ch, note, vel)
  @s << format("%d NoteOff %d %d %d\n", @offset, ch, note, vel)
end
noteon(ch, note, vel) click to toggle source
# File lib/smf/toy/text.rb, line 222
def noteon(ch, note, vel)
  @s << format("%d NoteOn %d %d %d\n", @offset, ch, note, vel)
end
omnioff(ch) click to toggle source
# File lib/smf/toy/text.rb, line 263
def omnioff(ch)
  @s << format("%d OmniOff %d\n", @offset, ch)
end
omnion(ch) click to toggle source
# File lib/smf/toy/text.rb, line 267
def omnion(ch)
  @s << format("%d OmniOn %d\n", @offset, ch)
end
pitchbendchange(ch, val) click to toggle source
# File lib/smf/toy/text.rb, line 243
def pitchbendchange(ch, val)
  @s << format("%d PitchBendChange %d %d\n", @offset, ch, val)
end
polymode(ch) click to toggle source
# File lib/smf/toy/text.rb, line 275
def polymode(ch)
  @s << format("%d PolyMode %d\n", @offset, ch)
end
polyphonickeypressure(ch, note, val) click to toggle source
# File lib/smf/toy/text.rb, line 226
def polyphonickeypressure(ch, note, val)
  @s << format("%d PolyphonicKeyPressure %d %d %d\n",
               @offset, ch, note, val)
end
programchange(ch, num) click to toggle source
# File lib/smf/toy/text.rb, line 235
def programchange(ch, num)
  @s << format("%d ProgramChange %d %d\n", @offset, ch, num)
end
programname(text) click to toggle source
# File lib/smf/toy/text.rb, line 309
def programname(text) text('ProgramName', text) end
resetallcontrollers(ch) click to toggle source
# File lib/smf/toy/text.rb, line 251
def resetallcontrollers(ch)
  @s << format("%d ResetAllControllers %d\n", @offset, ch)
end
result() click to toggle source
# File lib/smf/toy/text.rb, line 349
def result() @s end
sequencenumber(num) click to toggle source
# File lib/smf/toy/text.rb, line 292
def sequencenumber(num)
  @s << format("%d SequenceNumber %d\n", @offset, num)
end
sequencerspecific(data) click to toggle source
# File lib/smf/toy/text.rb, line 347
def sequencerspecific(data) put_binary('SequencerSpecific', data) end
settempo(tempo) click to toggle source
# File lib/smf/toy/text.rb, line 330
def settempo(tempo)
  @s << format("%d SetTempo %d\n", @offset, tempo)
end
smpteoffset(hr, mn, se, fr, ff, tc) click to toggle source
# File lib/smf/toy/text.rb, line 334
def smpteoffset(hr, mn, se, fr, ff, tc)
  @s << format("%d SMPTEOffset %d %d %d %d %d %d\n",
               @offset, hr, mn, se, fr, ff, tc)
end
text0a(text) click to toggle source
# File lib/smf/toy/text.rb, line 311
def text0a(text) text('Text0A', text) end
text0b(text) click to toggle source
# File lib/smf/toy/text.rb, line 312
def text0b(text) text('Text0B', text) end
text0c(text) click to toggle source
# File lib/smf/toy/text.rb, line 313
def text0c(text) text('Text0C', text) end
text0d(text) click to toggle source
# File lib/smf/toy/text.rb, line 314
def text0d(text) text('Text0D', text) end
text0e(text) click to toggle source
# File lib/smf/toy/text.rb, line 315
def text0e(text) text('Text0E', text) end
text0f(text) click to toggle source
# File lib/smf/toy/text.rb, line 316
def text0f(text) text('Text0F', text) end
timesignature(nn, dd, cc, bb) click to toggle source
# File lib/smf/toy/text.rb, line 339
def timesignature(nn, dd, cc, bb)
  @s << format("%d TimeSignature %d %d %d %d\n", @offset, nn, dd, cc, bb)
end
track_end() click to toggle source
# File lib/smf/toy/text.rb, line 214
def track_end()   @offset = 0; @s << "MTrkEnd\n" end
track_start() click to toggle source
# File lib/smf/toy/text.rb, line 213
def track_start() @offset = 0; @s << "MTrk\n" end
trackname(text) click to toggle source
# File lib/smf/toy/text.rb, line 304
def trackname(text) text('TrackName', text) end

Private Instance Methods

put_binary(name, data) click to toggle source
# File lib/smf/toy/text.rb, line 279
def put_binary(name, data)
  @s << format('%d %s "', @offset, name)
  data.each_byte do |c|
    @s << format('\\%03o', c)
  end
  @s << "\"\n" # "
end
text(name, text) click to toggle source
# File lib/smf/toy/text.rb, line 296
def text(name, text)
  @s << format("%d %s %s\n", @offset, name, text.dump)
end