-
Notifications
You must be signed in to change notification settings - Fork 0
/
rmc505.old.rb
executable file
·1435 lines (1383 loc) · 38.7 KB
/
rmc505.old.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#! /usr/bin/env ruby
$: << File.join(File.dirname(__FILE__), 'asound')
require 'asound'
require 'Korundum'
######################################################################
class ByteParameter < Qt::Object
slots 'change(int)'
attr_accessor :parent
attr_accessor :offset
def initialize(name, range, choices = nil)
super()
@name = name
@range = range
@value = range.first
@choices = choices
end
def load
send_sysex(data_request(@offset, 1))
end
def write(value)
unless @range.member?(value)
dump
raise 'Parameter (%d) out of range' % value
end
@value = value
dump
if @slider
@slider.value = @value
end
end
def change(value)
if value != @value
write(value)
send_sysex(data_set(@offset, @value.chr))
auto_trigger
end
if @combo
@combo.set_current_item(@value)
end
end
def read
return @value
end
def dump(indent = 0)
print " " * indent
print "%8x | %2x | %s (%s)\n" % [@offset, @value, @name, @range]
end
def build_widgets(parent)
@label = Qt::Label.new(@name, parent)
box = Qt::HBox.new(parent)
@slider = Qt::Slider.new(@range.first, @range.last, 1, @value, Qt::Slider::Horizontal, box)
@slider.tick_interval = 1
@slider.tickmarks = Qt::Slider::Below
@slider.value = @value
connect(@slider, SIGNAL('valueChanged(int)'), self, SLOT('change(int)'))
if @choices
@combo = Qt::ComboBox.new(box)
@combo.insert_string_list(@choices)
@combo.set_current_item(@value)
connect(@combo, SIGNAL('activated(int)'), @slider, SLOT('setValue(int)'))
end
end
def auto_trigger
ref = @parent
loop do
break if ref.respond_to?(:trigger_channel) and ref.trigger_channel
if ref.respond_to?(:parent)
ref = ref.parent
else
return
end
end
$note_trigger.auto_trigger(ref.trigger_channel, ref.trigger_note)
end
end
# Subclassing a subclass of Qt::Object causes strange problems
module ParameterRangeMod
attr_accessor :parent
attr_reader :offset
def add(parameter)
parameter.offset = @offset + @parameters.length
@parameters.push(parameter)
parameter.parent = self
end
def length
return @parameters.length
end
def load
send_sysex(data_request(@offset, @parameters.length))
end
def write(offset, value)
@parameters[offset - @offset].write(value)
end
def read(offset)
@parameters[offset].read
end
def dump(indent = 0)
@parameters.each do |p|
p.dump(indent+1)
end
end
def build_widgets(parent)
@parameters.each do |p|
p.build_widgets(parent)
end
end
end
class ParameterRange
include ParameterRangeMod
def initialize(offset)
@offset = offset
@parameters = []
end
end
class ReservedParameterRange
include ParameterRangeMod
attr_accessor :length
def initialize(offset)
@offset = offset
@length = 1
end
def write(offset, value)
end
def build_widgets(parent)
end
end
WAVENAMES = ["TB Dst Saw",
"TB Dst Sqr 1",
"TB Dst Sqr 2",
"TB Reso Sqr 1",
"TB Reso Sqr 2",
"TB Saw",
"TB Solid Saw 1",
"TB Solid Saw 2",
"TB Square 1",
"TB Square 2",
"TB Sqr Decay",
"TB Natural",
"JP8000 Saw 1",
"JP8000 Saw 2",
"MG Saw",
"Synth Saw 1",
"JP-8 Saw",
"P5 Saw",
"Synth Saw 2",
"OB Saw",
"D-50 Saw",
"JP-6 Square",
"MG Square",
"P5 Square",
"JP-8 Pulse",
"JP-6 Pulse",
"MG Pulse",
"260 Pulse",
"JU-2 Sub OSC",
"Frog wave",
"Digiwave",
"FM Pulse",
"JP8000 PWM",
"JP8000 FBK",
"260 Sub OSC",
"Dist Synth",
"Dist Square",
"MG Triangle",
"Jungle Bass",
"260 Sine Bs",
"MC-202 Bass",
"SH-101 Bass",
"Octa Bass",
"Funky Bass",
"Poly Bass",
"MG Bass",
"FM Super Bass",
"Solid Bass",
"Organ Bass",
"Dirty Bass",
"Upright Bass",
"Ac Bass",
"Voco Bass",
"Fingered Bass",
"Pick Bass",
"Fretless Bass",
"Slap Bass",
"Juno Rave",
"Blaster",
"Fat JP-6",
"OB Strings",
"Orch Strings",
"Pizzy Techno",
"Choir",
"Syn Vox 1",
"Syn Vox 2",
"Syn Vox 3",
"Ac Piano",
"D-50 EP",
"E Piano",
"Clavi",
"Full Stop",
"FM Club Org",
"E Organ 1",
"E Organ 2",
"Church Org",
"Power B fst",
"Power B slw",
"Org Chord",
"Tabular",
"Glockenspiel",
"Vibraphone",
"FantabellSub",
"DIGI Bell",
"Steel Drum",
"Marimba",
"Balaphone",
"Kalimba",
"Steel Gtr",
"Clean TC",
"Dst Solo Gtr",
"Dist Tek Gtr",
"Gtr FX",
"Harmo Gtr",
"Wah Gtr 1",
"Wah Gtr 2",
"Wah Gtr 2a",
"Wah Gtr 2b",
"Wah Gtr 2c",
"Wah Gtr 2d",
"Sitar",
"Brass",
"Trumpet",
"Mute Trumpet",
"Soprano Sax",
"Solo Sax",
"Baritone Sax",
"Brass Fall",
"Flute",
"Pan Flute",
"Shakunichi",
"Bagpipe",
"Breath",
"FeedbackWave",
"Atmosphere",
"Reso Noise",
"MG White Nz",
"P5 Noise",
"MG Pink Nz",
"Bomb Noise",
"Sea",
"Brush Noise",
"Space Noise",
"Scream",
"Jet Plane",
"Toy Gun 1",
"Crash",
"Toy Gun 2",
"Toy Gun 3",
"Emergency",
"Buzzer",
"Insect",
"Tonality",
"Ring OSC",
"Reso FX",
"Scratch Menu",
"Vinyl Noise",
"Scratch BD f",
"Scratch BD r",
"Scratch SD f",
"Scratch SD r",
"Scratch Alt",
"Tape Rewind",
"Vinyl Stop",
"Hit Menu",
"MG Blip",
"Beam HiQ",
"MG Attack",
"Air Blip",
"Org Click",
"Syn Hit",
"Techno Scene",
"Techno Chord",
"Dist Hit",
"Thin Beef",
"Tekno Hit",
"Back Hit",
"TAO Hit",
"Phily Hit",
"INDUST MENU",
"Analog Bird",
"Retro UFO",
"PC-2 Machine",
"Hoo",
"Metal Sweep",
"Afro Feet",
"Bomb",
"Bounce",
"Electric Dunk",
"Iron Door",
"Dist Swish",
"Drill Hit",
"Thrill",
"PCM Press",
"Air Gun",
"Voice Menu",
"One!",
"Two!",
"Three!",
"Kick it!",
"Come on!",
"Wao!",
"Shout",
"Ooh! 1",
"Ooh! 2",
"Voice Loop",
"Pa!",
"Canvas",
"Punch",
"Chiki!",
"Hey!",
"Laugh",
"Aah Formant",
"Eeh Formant",
"Iih Formant",
"Ooh Formant",
"Uuh Formant",
"Dist Ooh Vox",
"Auh Voice",
"Stream",
"Bird",
"Tom Menu",
"TR909 Tom",
"TR909 DstTom",
"TR808 Tom",
"TR606 Tom",
"TR606 CmpTom",
"TR707 Tom",
"Syn Tom",
"Deep Tom",
"Can Tom",
"Kick Tom",
"Natural Tom",
"PERCUS MENU1",
"PERCUS MENU2",
"TR808 Conga",
"HiBongo Open",
"LoBongo Open",
"HiConga Mute",
"HiConga Open",
"LoConga Open",
"HiBongo LoFi",
"LoBongo Lofi",
"HiConga Mt LF",
"HiConga Op LF",
"Loconga LoFi",
"Timpani",
"Mute Surdo",
"Open Surdo",
"Hi Timbale",
"Lo Timbale",
"Hi Timbale LF",
"Lo Timbale LF",
"Tabla",
"TablaBaya",
"Udo",
"AfroDrum Rat",
"ChenChen",
"Op Pandeiro",
"Mt Pandeiro",
"Tambourine 1",
"Tambourine 2",
"Tambourine 3",
"Tambourine 4",
"CR78 Tamb",
"Cowbell MENU",
"TR808Cowbell",
"TR707Cowbell",
"CR78Cowbell",
"Cowbell",
"TR727 Agogo",
"CR78 Beat",
"Triangle 1",
"Triangle 2",
"SHKR+ Menu",
"808 Maracas",
"Maracas",
"Cabasa Up",
"TechnoShaker",
"TR626Shaker",
"DanceShaker",
"CR78 Guiro",
"Long Guiro",
"Short Guiro",
"Mute Cuica",
"Open Cuica",
"Whistle",
"TR727Quijada",
"Jingle Bell",
"Belltree",
"Wind Chime",
"RIM MENU",
"TR909 RIM",
"TR808 RIM",
"TR808 RimLng",
"TR707 Rim",
"Analog Rim",
"Natural Rim",
"Ragga Rim 1",
"Lo-Fi Rim",
"Wood Block",
"Jungle Snap",
"TR808 Claves",
"Hyoshigi",
"CHH MENU 1",
"CHH MENU 2",
"TR909 CHH 1",
"TR909 CHH 2",
"TR808 CHH 1",
"TR808 CHH 2",
"TR808 CHH 3",
"TR606 CHH 1",
"TR606 CHH 2",
"TR606 DstCHH",
"TR707 CHH",
"CR78 CHH",
"DR55 CHH 1",
"Closed Hat",
"Pop CHH",
"Real CHH",
"Bristol CHH",
"DR550 CHH2",
"Tight CHH",
"Hip CHH",
"Room CHH",
"R8 Brush CHH",
"Jungle Hat",
"PHH MENU",
"TR909 PHH 1",
"TR909 PHH 2",
"TR808 PHH 1",
"TR808 PHH 2",
"TR606 PHH 1",
"TR606 PHH 2",
"TR707 PHH",
"HIP PHH",
"Tight PHH",
"Pedal Hat 1",
"Real PHH",
"Pedal Hat 2",
"OHH MENU 1",
"OHH MENU 2",
"TR909 OHH 1",
"TR909 OHH 2",
"TR909 OHH 3",
"TR909 DstOHH",
"TR808 OHH 1",
"TR808 OHH 2",
"TR606 OHH",
"TR606 DstOHH",
"TR707 OHH",
"CR78 OHH",
"HIP OHH",
"Pop Hat Open",
"Open Hat",
"Cym OHH",
"DR550 OHH",
"Funk OHH",
"Real OHH",
"R8 OHH",
"Cymbal MENU",
"TR606 Cym 1",
"TR606 Cym 2",
"TR909 Ride",
"TR707 Ride",
"Natural Ride",
"Cup Cym",
"TR909 Crash",
"Natural Crash",
"Jungle Crash",
"Asian Gong",
"CLAP MENU1",
"CLAP MENU2",
"TR909 Clap 1",
"TR909 Clap 2",
"TR808 Clap",
"TR707 Clap",
"Cheap Clap",
"Funk Clap",
"Little Clap",
"Real Clap 1",
"Real Clap 2",
"Funky Clap",
"Comp Clap",
"Hip Clap",
"Down Clap",
"Group Clap",
"Big Clap",
"ClapTail",
"Clap Snare 1",
"Fuzzy Clap",
"Snap",
"Finger Snap",
"SNR MENU 1",
"SNR MENU 2",
"SNR MENU 3",
"SNR MENU 4",
"SNR MENU 5",
"SNR MENU 6",
"TR909 Snr 1",
"TR909 Snr 2",
"TR909 Snr 3",
"TR909 Snr 4",
"TR909 Snr 5",
"TR909 Snr 6",
"TR909 Snr 7",
"TR909 DstSnr",
"TR808 Snr 1",
"TR808 Snr 2",
"TR808 Snr 3",
"TR808 Snr 4",
"TR808 Snr 5",
"TR808 Snr 6",
"TR808 Snr 7",
"TR808 Snr 8",
"TR808 Snr 9",
"TR606 Snr 1",
"TR606 Snr 2",
"TR606 Snr 3",
"DanceHall SD",
"TR707 Snare",
"CR78 Snare",
"Clap Snare 2",
"Jungle Tiny SD",
"Jazz Snare",
"Headz Snare",
"Whack Snare",
"Rap Snare",
"Jungle Snr 1",
"Antigua Snr",
"Real Snr",
"Tiny Snare 1",
"Tiny Snare 2",
"Break Snare 1",
"Break Snare 2",
"MC Snare",
"East Snare",
"Phat Snare",
"Brush Slap 1",
"Brush Slap 2",
"Deep Snare",
"Fat Snare",
"Disco Snare",
"Dj Snare",
"Macho Snare",
"Hash Snare",
"Lo-Hard Snr",
"Indus Snare",
"Rage Snare",
"TekRok Snare",
"Big Trash SD",
"Ragga Rim 2",
"Gate Rim",
"Sidestiker",
"HipJazz Snr",
"HH Soul Snr",
"Cross Snr",
"Jungle Rim 1",
"Ragg Snr 2",
"Upper Snare",
"Lo-Fi Snare",
"Ragga Tight SD",
"Flange Snr",
"Machine Snr",
"Clap Snare 3",
"Solid Snare",
"Funk Clap 2",
"Jungle Rim 2",
"Jungle Rim 3",
"Jungle Snr 2",
"Urban Snare",
"Urban RollSD",
"R&B Snare",
"R8 Brush Tap",
"R8 BrshSwill",
"R8 BrushRoll",
"Sim Snare",
"Electro Snr 1",
"Electro Snr 2",
"Synth Snr",
"Roll Snare",
"Kick MENU 1",
"KICK MENU 2",
"KICK MENU 3",
"TR909 Kick 1",
"TR909 Kick 2",
"TR909 Kick 3",
"TR909 Kick 4",
"Plastic BD 1",
"Plastic BD 2",
"Plastic BD 3",
"Plastic BD 4",
"TR909 Kick 5",
"TR808 Kick 1",
"TR808 Kick 2",
"TR808 Kick 3",
"TR808 Kick 4",
"TR808 Kick 5",
"TR606 Kick",
"TR606 Dst BD",
"TR707 Kick 1",
"TR707 Kick 2",
"Toy Kick",
"Analog Kick",
"Boost Kick",
"West Kick",
"Jungle Kick 1",
"Optic Kick",
"Wet Kick",
"Lo-Fi Kick",
"Hazy Kick",
"Hip Kick",
"Video Kick",
"Tight Kick",
"Break Kick",
"Turbo Kick",
"Ele Kick",
"Dance Kick 1",
"Kick Ghost",
"Lo-Fi Kick 2",
"Jungle Kick 2",
"TR909 Dst BD",
"Amsterdam BD",
"Gabba Kick",
"Roll Kick"]
WAVES =
(0..253).collect{ |n| '1-%d %s' % [n+1, WAVENAMES[n]] } +
(0..250).collect{ |n| '2-%d %s ' % [n+1, WAVENAMES[n+254]] }
class WaveParameter < Qt::Object
include ParameterRangeMod
slots 'change(int)'
def initialize(offset)
super()
@offset = offset
@parameters = []
add(ByteParameter.new('Wave group type', (0..0)))
add(ByteParameter.new('Wave group ID', (1..2)))
add(ByteParameter.new('Wave number (high nibble)', (0..15)))
add(ByteParameter.new('Wave number (low nibble)', (0..15)))
end
def write(offset, value)
super
if offset == @offset+3
if @parameters[1].read == 2
num = 254
else
num = 0
end
num += @parameters[2].read << 4
num += @parameters[3].read
if @list
@list.block_signals(true)
@list.set_selected(num, true)
@list.block_signals(false)
@list.top_item = num - 4
end
end
end
def build_widgets(parent)
@label = Qt::Label.new('Waveform', parent)
box = Qt::HBox.new(parent)
@list = Qt::ListBox.new(box)
@list.insert_string_list(WAVES)
connect(@list, SIGNAL('highlighted(int)'), self, SLOT('change(int)'))
end
def change(wave)
if wave > 253
gid = 2
num = wave - 254
else
gid = 1
num = wave
end
high = num >> 4
low = num & 0xf
@parameters[0].write(0)
@parameters[1].write(gid)
@parameters[2].write(high)
@parameters[3].write(low)
str = @parameters.collect{ |p| p.read }.pack('CCCC')
send_sysex(data_set(@offset, str))
@parameters[0].auto_trigger
end
end
class PatchName < Qt::Object
include ParameterRangeMod
slots 'change()'
def initialize(offset)
super()
@offset = offset
@parameters = []
12.times do |n|
add(ByteParameter.new('Patch name %d' % (n + 1), (32..125)))
end
end
def write(offset, value)
super
if offset == @offset+11
if @lineedit
@lineedit.set_text(@parameters.collect{ |p| p.read.chr }.join.strip)
end
end
end
def build_widgets(parent)
@label = Qt::Label.new('Name', parent)
@lineedit = Qt::LineEdit.new(parent)
@lineedit.max_length = 12
connect(@lineedit, SIGNAL('textChanged(const QString &)'), self, SLOT('change()'))
end
def change()
send_sysex(data_set(@offset, "%-12s" % (@lineedit.text[0...12])))
end
end
class ParameterSet
attr_accessor :parent
attr_reader :name
attr_accessor :trigger_channel
attr_accessor :trigger_note
def initialize(offset = 0, name = nil)
@offset = offset
@name = name
@ranges = []
yield self
end
def dump(indent = 0)
if @name
print " " * indent
print "%s\n" % @name
end
@ranges.each do |r, o|
print " " * (indent+1)
print "(%8x...%8x)\n" % [r.first, r.last]
o.dump(indent + 2)
end
end
def subsets
@ranges.collect{ |r, o| o }
end
def build_widgets(parent)
g = Qt::GroupBox.new(2, Qt::GroupBox::Horizontal, parent)
if @name
g.title = @name
end
build_child_widgets(g)
end
def build_child_widgets(parent)
@ranges.each do |r, o|
o.build_widgets(parent)
end
end
def add_range(offset, klass = ParameterRange)
o = offset + @offset
range = klass.new(o)
range.parent = self
yield range
@ranges.push([(o...o + range.length), range])
end
def end
@ranges.collect{ |r| r.first.last }.max
end
def add_group(offset, name, &block)
o = offset + @offset
group = ParameterSet.new(o, name, &block)
group.parent = self
@ranges.push([(o...group.end), group])
end
def load
if self.end - @offset > 127
@ranges.each do |r, o|
o.load
end
else
send_sysex(data_request(@offset, self.end - @offset))
end
end
def write(offset, value)
@ranges.each do |r|
if r.first.member?(offset)
r.last.write(offset, value)
return
end
end
#print "Unmapped parameter: %8x\n" % offset
end
def read(offset)
@ranges.each do |r|
if r.first.member?(offset)
r.last.read(offset)
return
end
end
end
def auto_trigger
ref = self
loop do
break if ref.respond_to?(:trigger_channel) and ref.trigger_channel
if ref.respond_to?(:parent)
ref = ref.parent
else
return
end
end
$note_trigger.auto_trigger(ref.trigger_channel, ref.trigger_note)
end
end
######################################################################
KEYFOLLOW = %w[-100 -70 -50 -30 -10 0 +10 +20 +30 +40 +50 +70 +100 +120 +150 +200]
KEYFOLLOW2 = %w[-100 -70 -50 -40 -30 -20 -10 0 +10 +20 +30 +40 +50 +70 +100]
WAVE_GAIN = %w[-6 0 +6 +12]
RANDOM_PITCH_DEPTH = %w[0 1 2 3 4 5 6 7 8 9 10 20 30 40 50 60 70 80 90 100 200 300 400 500 600 700 800 900 1000 1100 1200]
FILTER_TYPE = %w[Off LPF BF HPF PRG]
HF_DAMP = %w[200 250 315 400 500 630 800 1000 1250 1600 2000 2500 3150 4000 5000 6300 8000 Bypass]
MFX_TYPE = ['4 band EQ',
'Spectrum',
'Enhancer',
'Overdrive',
'Distortion',
'Lo-Fi',
'Noise',
'Radio tuning',
'Phonograph',
'Compressor',
'Limiter',
'Slicer',
'Tremolo',
'Phaser',
'Chorus',
'Space-D',
'Tetra chorus',
'Flanger',
'Stereo flanger',
'Short delay',
'Auto pan',
'FB pitch shifter',
'Reverb',
'Gate reverb',
'Isolator']
$pages = []
$params = ParameterSet.new(0, 'Parameter map') do |p|
p.add_group(0, 'System') do |g0|
$pages.push(g0)
g0.add_group(0, 'Common') do |g1|
g1.add_range(6) do |r|
r.add(ByteParameter.new('Master tune', (0..126)))
r.add(ByteParameter.new('Scale tune switch', (0..1), %w[Off On]))
r.add(ByteParameter.new('MFX switch', (0..1), %w[Off On]))
r.add(ByteParameter.new('Delay switch', (0..1), %w[Off On]))
r.add(ByteParameter.new('Reverb switch', (0..1), %w[Off On]))
r.add(ByteParameter.new('Patch remain', (0..1), %w[Off On]))
end
g1.add_range(0x14) do |r|
r.add(ByteParameter.new('Receive program change switch', (0..1), %w[Off On]))
r.add(ByteParameter.new('Receive bank select switch', (0..1), %w[Off On]))
end
g1.add_range(0x28) do |r|
r.add(ByteParameter.new('Transmit program change switch', (0..1), %w[Off On]))
r.add(ByteParameter.new('Transmit bank select switch', (0..1), %w[Off On]))
end
end
7.times do |n0|
g0.add_group(0x1000 + 0x100 * n0, 'Part %d scale tune' % (n0 + 1)) do |g1|
g1.add_range(0) do |r|
%w[C C# D D# E F F# G G# A A# B].each do |note|
r.add(ByteParameter.new('Scale tune for ' + note, (0..127)))
end
end
end
end
end
p.add_group(0x1000000, 'Part info') do |g0|
$pages.push(g0)
g0.add_group(0, 'Common') do |g1|
g1.add_range(0xd) do |r|
r.add(ByteParameter.new('MFX type', (0..24), MFX_TYPE))
11.times do |n0|
r.add(ByteParameter.new('MFX control %d' % (n0 + 1), (0..127)))
end
end
g1.add_range(0x1c) do |r|
r.add(ByteParameter.new('MFX delay send level', (0..127)))
r.add(ByteParameter.new('MFX reverb send level', (0..127)))
end
g1.add_range(0x22) do |r|
r.add(ByteParameter.new('Delay level', (0..127)))
r.add(ByteParameter.new('Delay type', (0..1), %w[Short Long]))
r.add(ByteParameter.new('Delay HF damp', (0..17), HF_DAMP))
r.add(ByteParameter.new('Delay time', (0..120)))
r.add(ByteParameter.new('Delay feedback level', (0..98)))
r.add(ByteParameter.new('Delay output assign', (0..2), %w[Line Reverb Line+Reverb]))
r.add(ByteParameter.new('Reverb type', (0..5), %w[Room1 Room2 Stage1 Stage2 Hall1 Hall2]))
r.add(ByteParameter.new('Reverb level', (0..127)))
r.add(ByteParameter.new('Reverb time', (0..127)))
r.add(ByteParameter.new('Reverb HF damp', (0..17), HF_DAMP))
end
g1.add_range(0x30) do |r|
7.times do |n0|
r.add(ByteParameter.new('Voice reserve %d' % (n0 + 1), (0..64)))
end
end
g1.add_range(0x39) do |r|
r.add(ByteParameter.new('Voice reserve R', (0..64)))
end
end
[0,1,2,3,4,5,6,9].each do |n0|
if n0 < 9
name = (n0 + 1).to_s
else
name = 'R'
end
g0.add_group(0x1000 + 0x100 * n0, 'Part ' + name) do |g1|
g1.add_range(0) do |r|
r.add(ByteParameter.new('Receive switch', (0..1)))
end
g1.add_range(2) do |r|
r.add(ByteParameter.new('Patch group type', (0..3)))
r.add(ByteParameter.new('Patch group ID', (1..9)))
r.add(ByteParameter.new('Patch number (high nibble)', (0..15)))
r.add(ByteParameter.new('Patch number (low nibble)', (0..15)))
r.add(ByteParameter.new('Part level', (0..127)))
r.add(ByteParameter.new('Part pan', (0..127)))
r.add(ByteParameter.new('Part key shift', (0..96)))
r.add(ByteParameter.new('Part fine tune', (0..100)))
r.add(ByteParameter.new('MFX switch', (0..4), %w[Off On Reserved Reserved Rythm]))
end
g1.add_range(0xc) do |r|
r.add(ByteParameter.new('Delay send level', (0..127)))
r.add(ByteParameter.new('Reverb send level', (0..127)))
end
end
end
end
p.add_group(0x2000000, 'Patches') do |g0|
7.times do |n0|
g0.add_group(0x10000 * n0, 'Patch %d' % (n0 + 1)) do |g1|
$pages.push(g1)
g1.trigger_channel = n0
g1.add_group(0, 'Common') do |g2|
g2.add_range(0, PatchName) do |r|
end
g2.add_range(0x31) do |r|
r.add(ByteParameter.new('Bend range up', (0..12)))
r.add(ByteParameter.new('Bend range down', (0..48)))
r.add(ByteParameter.new('Solo switch', (0..1), %w[Off On]))
r.add(ByteParameter.new('Solo legato switch', (0..1), %w[Off On]))
r.add(ByteParameter.new('Portamento switch', (0..1), %w[Off On]))
r.add(ByteParameter.new('Portamento mode', (0..1), %w[Normal Legato]))
r.add(ByteParameter.new('Portamento type', (0..1), %w[Rate Time]))
r.add(ByteParameter.new('Portamento start', (0..1), %w[Pitch Note]))
r.add(ByteParameter.new('Portamento time', (0..127)))
end
g2.add_range(0x40) do |r|
r.add(ByteParameter.new('Velocity range switch', (0..1), %w[Off On]))
end
g2.add_range(0x42) do |r|
r.add(ByteParameter.new('Stretch tune depth', (0..3), %w[Off 1 2 3]))
r.add(ByteParameter.new('Voice priority', (0..1), %w[Last Loudest]))
r.add(ByteParameter.new('Structure type 1/2', (0..9)))
r.add(ByteParameter.new('Booster 1/2', (0..3), %w[0 +6 +12 +18]))
r.add(ByteParameter.new('Structure type 3/4', (0..9)))
r.add(ByteParameter.new('Booster 3/4', (0..3), %w[0 +6 +12 +18]))
end
end
4.times do |n1|
g1.add_group(0x1000 + 0x200 * n1, 'Tone %d' % (n1 + 1)) do |g2|
g2.add_range(0) do |r|
r.add(ByteParameter.new('Tone switch', (0..1), %w[Off On]))
end
g2.add_range(1, WaveParameter) do |r|
end
g2.add_range(5) do |r|
r.add(ByteParameter.new('Wave gain', (0..3), WAVE_GAIN))
r.add(ByteParameter.new('FXM switch', (0..1), %w[Off On]))
r.add(ByteParameter.new('FXM color', (0..3)))
r.add(ByteParameter.new('FXM depth', (0..15)))
end
g2.add_range(0xb) do |r|
r.add(ByteParameter.new('Velocity crossfade', (0..127)))
r.add(ByteParameter.new('Velocity range lower', (1..127)))