Class: SMF::Sequence::EncodeXML

Inherits:
XSCallback show all
Defined in:
lib/smf/toy/xml.rb

Instance Method Summary collapse

Methods inherited from XSCallback

#error, #track_end, #unknownchunk, #unknownmeta, #warn

Instance Method Details

#allnotesoff(ch) ⇒ Object



242
# File 'lib/smf/toy/xml.rb', line 242

def allnotesoff(ch) channelmodemessage('AllNotesOff', ch) end

#allsoundoff(ch) ⇒ Object



239
# File 'lib/smf/toy/xml.rb', line 239

def allsoundoff(ch) channelmodemessage('AllSoundOff', ch) end

#channelprefix(ch) ⇒ Object



293
294
295
296
297
# File 'lib/smf/toy/xml.rb', line 293

def channelprefix(ch)
	e = REXML::Element.new('ChannelPrefix', @doctr)
	e.attributes['offset'] = @offset.to_s
	e.attributes['ch'] = ch.to_s
end

#channelpressure(ch, val) ⇒ Object



216
217
218
219
220
221
# File 'lib/smf/toy/xml.rb', line 216

def channelpressure(ch, val)
	e = REXML::Element.new('ChannelPressure', @doctr)
	e.attributes['offset'] = @offset.to_s
	e.attributes['ch'] = ch.to_s
	e.attributes['val'] = val.to_s
end

#controlchange(ch, num, val) ⇒ Object



201
202
203
204
205
206
207
# File 'lib/smf/toy/xml.rb', line 201

def controlchange(ch, num, val)
	e = REXML::Element.new('ControlChange', @doctr)
	e.attributes['offset'] = @offset.to_s
	e.attributes['ch'] = ch.to_s
	e.attributes['num'] = num.to_s
	e.attributes['val'] = val.to_s
end

#copyrightnotice(text) ⇒ Object



278
# File 'lib/smf/toy/xml.rb', line 278

def copyrightnotice(text) text('CopyrightNotice', text) end

#cuepoint(text) ⇒ Object



283
# File 'lib/smf/toy/xml.rb', line 283

def cuepoint(text) text('CuePoint', text) end

#delta(delta) ⇒ Object



175
# File 'lib/smf/toy/xml.rb', line 175

def delta(delta) @offset += delta end

#devicename(text) ⇒ Object



285
# File 'lib/smf/toy/xml.rb', line 285

def devicename(text) text('DeviceName', text) end

#endoftrackObject



305
306
307
308
# File 'lib/smf/toy/xml.rb', line 305

def endoftrack
	e = REXML::Element.new('EndOfTrack', @doctr)
	e.attributes['offset'] = @offset.to_s
end

#exclusivef0(data) ⇒ Object



260
# File 'lib/smf/toy/xml.rb', line 260

def exclusivef0(data) put_binary('ExclusiveF0', data) end

#exclusivef7(data) ⇒ Object



261
# File 'lib/smf/toy/xml.rb', line 261

def exclusivef7(data) put_binary('ExclusiveF7', data) end

#generalpurposetext(text) ⇒ Object



277
# File 'lib/smf/toy/xml.rb', line 277

def generalpurposetext(text) text('GeneralPurposeText', text) end

#header(format, ntrks, division, tc) ⇒ Object



161
162
163
164
165
166
167
168
# File 'lib/smf/toy/xml.rb', line 161

def header(format, ntrks, division, tc)
	@doc = REXML::Document.new
	@doc << REXML::XMLDecl.new
	@docsq = REXML::Element.new('MThd', @doc)
	@docsq.attributes['format'] = format.to_s
	@docsq.attributes['division'] = division.to_s
	@docsq.attributes['tc'] = tc.to_s
end

#instrumentname(text) ⇒ Object



280
# File 'lib/smf/toy/xml.rb', line 280

def instrumentname(text) text('InstrumentName', text) end

#keysignature(sf, mi) ⇒ Object



336
337
338
339
340
341
# File 'lib/smf/toy/xml.rb', line 336

def keysignature(sf, mi)
	e = REXML::Element.new('KeySignature', @doctr)
	e.attributes['offset'] = @offset.to_s
	e.attributes['sf'] = sf.to_s
	e.attributes['mi'] = mi.to_s
end

#localcontrol(ch, val) ⇒ Object



241
# File 'lib/smf/toy/xml.rb', line 241

def localcontrol(ch, val) channelmodemessage('LocalControl', ch, val) end

#lyric(text) ⇒ Object



281
# File 'lib/smf/toy/xml.rb', line 281

def lyric(text) text('Lyric', text) end

#marker(text) ⇒ Object



282
# File 'lib/smf/toy/xml.rb', line 282

def marker(text) text('Marker', text) end

#midiport(num) ⇒ Object



299
300
301
302
303
# File 'lib/smf/toy/xml.rb', line 299

def midiport(num)
	e = REXML::Element.new('MIDIPort', @doctr)
	e.attributes['offset'] = @offset.to_s
	e.attributes['num'] = num.to_s
end

#monomode(ch, val) ⇒ Object



245
# File 'lib/smf/toy/xml.rb', line 245

def monomode(ch, val) channelmodemessage('MonoMode', ch, val) end

#noteoff(ch, note, vel) ⇒ Object



177
178
179
180
181
182
183
# File 'lib/smf/toy/xml.rb', line 177

def noteoff(ch, note, vel)
	e = REXML::Element.new('NoteOff', @doctr)
	e.attributes['offset'] = @offset.to_s
	e.attributes['ch'] = ch.to_s
	e.attributes['note'] = note.to_s
	e.attributes['vel'] = vel.to_s
end

#noteon(ch, note, vel) ⇒ Object



185
186
187
188
189
190
191
# File 'lib/smf/toy/xml.rb', line 185

def noteon(ch, note, vel)
	e = REXML::Element.new('NoteOn', @doctr)
	e.attributes['offset'] = @offset.to_s
	e.attributes['ch'] = ch.to_s
	e.attributes['note'] = note.to_s
	e.attributes['vel'] = vel.to_s
end

#omnioff(ch) ⇒ Object



243
# File 'lib/smf/toy/xml.rb', line 243

def omnioff(ch) channelmodemessage('OmniOff', ch) end

#omnion(ch) ⇒ Object



244
# File 'lib/smf/toy/xml.rb', line 244

def omnion(ch) channelmodemessage('OmniOn', ch) end

#pitchbendchange(ch, val) ⇒ Object



223
224
225
226
227
228
# File 'lib/smf/toy/xml.rb', line 223

def pitchbendchange(ch, val)
	e = REXML::Element.new('PitchBendChange', @doctr)
	e.attributes['offset'] = @offset.to_s
	e.attributes['ch'] = ch.to_s
	e.attributes['val'] = val.to_s
end

#polymode(ch) ⇒ Object



246
# File 'lib/smf/toy/xml.rb', line 246

def polymode(ch) channelmodemessage('PolyMode', ch) end

#polyphonickeypressure(ch, note, val) ⇒ Object



193
194
195
196
197
198
199
# File 'lib/smf/toy/xml.rb', line 193

def polyphonickeypressure(ch, note, val)
	e = REXML::Element.new('PolyphonicKeyPressure', @doctr)
	e.attributes['offset'] = @offset.to_s
	e.attributes['ch'] = ch.to_s
	e.attributes['note'] = note.to_s
	e.attributes['val'] = val.to_s
end

#programchange(ch, num) ⇒ Object



209
210
211
212
213
214
# File 'lib/smf/toy/xml.rb', line 209

def programchange(ch, num)
	e = REXML::Element.new('ProgramChange', @doctr)
	e.attributes['offset'] = @offset.to_s
	e.attributes['ch'] = ch.to_s
	e.attributes['num'] = num.to_s
end

#programname(text) ⇒ Object



284
# File 'lib/smf/toy/xml.rb', line 284

def programname(text) text('ProgramName', text) end

#resetallcontrollers(ch) ⇒ Object



240
# File 'lib/smf/toy/xml.rb', line 240

def resetallcontrollers(ch) channelmodemessage('ResetAllControllers', ch) end

#resultObject



347
# File 'lib/smf/toy/xml.rb', line 347

def result() @doc.to_s(0) end

#sequencenumber(num) ⇒ Object



263
264
265
266
267
# File 'lib/smf/toy/xml.rb', line 263

def sequencenumber(num)
	e = REXML::Element.new('SequenceNumber', @doctr)
	e.attributes['offset'] = @offset.to_s
	e.attributes['num'] = num.to_s
end

#sequencerspecific(data) ⇒ Object



343
# File 'lib/smf/toy/xml.rb', line 343

def sequencerspecific(data) put_binary('SequencerSpecific', data) end

#settempo(tempo) ⇒ Object



310
311
312
313
314
# File 'lib/smf/toy/xml.rb', line 310

def settempo(tempo)
	e = REXML::Element.new('SetTempo', @doctr)
	e.attributes['offset'] = @offset.to_s
	e.attributes['tempo'] = tempo.to_s
end

#smpteoffset(hr, mn, se, fr, ff, tc) ⇒ Object



316
317
318
319
320
321
322
323
324
325
# File 'lib/smf/toy/xml.rb', line 316

def smpteoffset(hr, mn, se, fr, ff, tc)
	e = REXML::Element.new('SMPTEOffset', @doctr)
	e.attributes['offset'] = @offset.to_s
	e.attributes['hr'] = hr.to_s
	e.attributes['mn'] = mn.to_s
	e.attributes['se'] = se.to_s
	e.attributes['fr'] = fr.to_s
	e.attributes['ff'] = ff.to_s
	e.attributes['tc'] = tc.to_s
end

#text0a(text) ⇒ Object



286
# File 'lib/smf/toy/xml.rb', line 286

def text0a(text) text('Text0A', text) end

#text0b(text) ⇒ Object



287
# File 'lib/smf/toy/xml.rb', line 287

def text0b(text) text('Text0B', text) end

#text0c(text) ⇒ Object



288
# File 'lib/smf/toy/xml.rb', line 288

def text0c(text) text('Text0C', text) end

#text0d(text) ⇒ Object



289
# File 'lib/smf/toy/xml.rb', line 289

def text0d(text) text('Text0D', text) end

#text0e(text) ⇒ Object



290
# File 'lib/smf/toy/xml.rb', line 290

def text0e(text) text('Text0E', text) end

#text0f(text) ⇒ Object



291
# File 'lib/smf/toy/xml.rb', line 291

def text0f(text) text('Text0F', text) end

#timesignature(nn, dd, cc, bb) ⇒ Object



327
328
329
330
331
332
333
334
# File 'lib/smf/toy/xml.rb', line 327

def timesignature(nn, dd, cc, bb)
	e = REXML::Element.new('TimeSignature', @doctr)
	e.attributes['offset'] = @offset.to_s
	e.attributes['nn'] = nn.to_s
	e.attributes['dd'] = dd.to_s
	e.attributes['cc'] = cc.to_s
	e.attributes['bb'] = bb.to_s
end

#track_startObject



170
171
172
173
# File 'lib/smf/toy/xml.rb', line 170

def track_start()
	@offset = 0
	@doctr = REXML::Element.new('MTrk', @docsq)
end

#trackname(text) ⇒ Object



279
# File 'lib/smf/toy/xml.rb', line 279

def trackname(text) text('TrackName', text) end