summaryrefslogtreecommitdiff
path: root/muse2/muse
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2010-10-13 19:34:22 +0000
committerRobert Jonsson <spamatica@gmail.com>2010-10-13 19:34:22 +0000
commit8a2c2824a59d7644e13bc52c9a0ecbd641f21f95 (patch)
tree064ad3f2bf8daab0ad27b128abd86a9bbdb1e496 /muse2/muse
parenta27706d9629e8b592cca4659f865b70adef24e6d (diff)
new branch muse2, first checkin
Diffstat (limited to 'muse2/muse')
-rw-r--r--muse2/muse/Makefile.am168
-rw-r--r--muse2/muse/Makefile.in1067
-rw-r--r--muse2/muse/app.cpp4767
-rw-r--r--muse2/muse/app.cpp.orig3969
-rw-r--r--muse2/muse/app.h327
-rw-r--r--muse2/muse/appearance.cpp718
-rw-r--r--muse2/muse/appearance.h56
-rw-r--r--muse2/muse/arranger/Makefile.am20
-rw-r--r--muse2/muse/arranger/Makefile.in612
-rw-r--r--muse2/muse/arranger/alayout.cpp161
-rw-r--r--muse2/muse/arranger/alayout.h48
-rw-r--r--muse2/muse/arranger/arranger.cpp971
-rw-r--r--muse2/muse/arranger/arranger.h227
-rw-r--r--muse2/muse/arranger/pcanvas.cpp2825
-rw-r--r--muse2/muse/arranger/pcanvas.h139
-rw-r--r--muse2/muse/arranger/tlist.cpp1555
-rw-r--r--muse2/muse/arranger/tlist.h131
-rw-r--r--muse2/muse/arranger/trackautomationview.cpp53
-rw-r--r--muse2/muse/arranger/trackautomationview.h21
-rw-r--r--muse2/muse/arranger/trackinfo.cpp1570
-rw-r--r--muse2/muse/audio.cpp1431
-rw-r--r--muse2/muse/audio.h299
-rw-r--r--muse2/muse/audioconvert.cpp886
-rw-r--r--muse2/muse/audioconvert.h129
-rw-r--r--muse2/muse/audioprefetch.cpp262
-rw-r--r--muse2/muse/audioprefetch.h46
-rw-r--r--muse2/muse/audiotrack.cpp1639
-rw-r--r--muse2/muse/cliplist/Makefile.am14
-rw-r--r--muse2/muse/cliplist/Makefile.in596
-rw-r--r--muse2/muse/cliplist/cliplist.cpp260
-rw-r--r--muse2/muse/cliplist/cliplist.h51
-rw-r--r--muse2/muse/cobject.cpp62
-rw-r--r--muse2/muse/cobject.h66
-rw-r--r--muse2/muse/conf.cpp1499
-rw-r--r--muse2/muse/conf.h38
-rw-r--r--muse2/muse/confmport.cpp897
-rw-r--r--muse2/muse/confmport.h83
-rw-r--r--muse2/muse/ctrl.cpp297
-rw-r--r--muse2/muse/ctrl.h144
-rw-r--r--muse2/muse/ctrl/Makefile.am17
-rw-r--r--muse2/muse/ctrl/Makefile.in604
-rw-r--r--muse2/muse/ctrl/ctrlcanvas.cpp1533
-rw-r--r--muse2/muse/ctrl/ctrlcanvas.h165
-rw-r--r--muse2/muse/ctrl/ctrledit.cpp134
-rw-r--r--muse2/muse/ctrl/ctrledit.h56
-rw-r--r--muse2/muse/ctrl/ctrlpanel.cpp694
-rw-r--r--muse2/muse/ctrl/ctrlpanel.h66
-rw-r--r--muse2/muse/debug.h31
-rw-r--r--muse2/muse/default_click.h1213
-rw-r--r--muse2/muse/device.h46
-rw-r--r--muse2/muse/driver/Makefile.am10
-rw-r--r--muse2/muse/driver/Makefile.in595
-rw-r--r--muse2/muse/driver/alsamidi.cpp917
-rw-r--r--muse2/muse/driver/alsamidi.h53
-rw-r--r--muse2/muse/driver/alsatimer.cpp225
-rw-r--r--muse2/muse/driver/alsatimer.h52
-rw-r--r--muse2/muse/driver/audiodev.h74
-rw-r--r--muse2/muse/driver/dummyaudio.cpp454
-rw-r--r--muse2/muse/driver/jack.cpp2173
-rw-r--r--muse2/muse/driver/jackaudio.h97
-rw-r--r--muse2/muse/driver/jackmidi.cpp1563
-rw-r--r--muse2/muse/driver/jackmidi.h156
-rw-r--r--muse2/muse/driver/rtctimer.cpp155
-rw-r--r--muse2/muse/driver/rtctimer.h44
-rw-r--r--muse2/muse/driver/timerdev.h41
-rw-r--r--muse2/muse/dssihost.cpp3055
-rw-r--r--muse2/muse/dssihost.h256
-rw-r--r--muse2/muse/evdata.h67
-rw-r--r--muse2/muse/event.cpp328
-rw-r--r--muse2/muse/event.h150
-rw-r--r--muse2/muse/eventbase.h97
-rw-r--r--muse2/muse/eventlist.cpp112
-rw-r--r--muse2/muse/exportmidi.cpp379
-rw-r--r--muse2/muse/fastlog.h38
-rw-r--r--muse2/muse/gconfig.cpp135
-rw-r--r--muse2/muse/gconfig.h132
-rw-r--r--muse2/muse/givertcap.c94
-rw-r--r--muse2/muse/globaldefs.h34
-rw-r--r--muse2/muse/globals.cpp396
-rw-r--r--muse2/muse/globals.h192
-rw-r--r--muse2/muse/help.cpp112
-rw-r--r--muse2/muse/helper.cpp40
-rw-r--r--muse2/muse/helper.h16
-rw-r--r--muse2/muse/icons.cpp612
-rw-r--r--muse2/muse/icons.h220
-rw-r--r--muse2/muse/importmidi.cpp608
-rw-r--r--muse2/muse/instruments/Makefile.am15
-rw-r--r--muse2/muse/instruments/Makefile.in599
-rw-r--r--muse2/muse/instruments/ccontrolbase.ui525
-rw-r--r--muse2/muse/instruments/editinstrument.cpp3541
-rw-r--r--muse2/muse/instruments/editinstrument.h92
-rw-r--r--muse2/muse/instruments/editinstrumentbase.ui1840
-rw-r--r--muse2/muse/instruments/midictrledit.cpp733
-rw-r--r--muse2/muse/instruments/midictrledit.h56
-rw-r--r--muse2/muse/instruments/minstrument.cpp850
-rw-r--r--muse2/muse/instruments/minstrument.h135
-rw-r--r--muse2/muse/key.cpp35
-rw-r--r--muse2/muse/key.h54
-rw-r--r--muse2/muse/ladspa.h599
-rw-r--r--muse2/muse/liste/Makefile.am16
-rw-r--r--muse2/muse/liste/Makefile.in601
-rw-r--r--muse2/muse/liste/editctrlbase.ui702
-rw-r--r--muse2/muse/liste/editevent.cpp853
-rw-r--r--muse2/muse/liste/editevent.h196
-rw-r--r--muse2/muse/liste/listedit.cpp909
-rw-r--r--muse2/muse/liste/listedit.h81
-rw-r--r--muse2/muse/make.inc164
-rw-r--r--muse2/muse/marker/Makefile.am15
-rw-r--r--muse2/muse/marker/Makefile.in596
-rw-r--r--muse2/muse/marker/marker.cpp90
-rw-r--r--muse2/muse/marker/marker.h51
-rw-r--r--muse2/muse/marker/markerview.cpp597
-rw-r--r--muse2/muse/marker/markerview.h84
-rw-r--r--muse2/muse/master/Makefile.am19
-rw-r--r--muse2/muse/master/Makefile.in609
-rw-r--r--muse2/muse/master/lmaster.cpp715
-rw-r--r--muse2/muse/master/lmaster.h145
-rw-r--r--muse2/muse/master/master.cpp341
-rw-r--r--muse2/muse/master/master.h69
-rw-r--r--muse2/muse/master/masteredit.cpp403
-rw-r--r--muse2/muse/master/masteredit.h83
-rw-r--r--muse2/muse/master/tscale.cpp61
-rw-r--r--muse2/muse/master/tscale.h38
-rw-r--r--muse2/muse/memory.cpp100
-rw-r--r--muse2/muse/memory.h180
-rw-r--r--muse2/muse/midi.cpp1542
-rw-r--r--muse2/muse/midi.h72
-rw-r--r--muse2/muse/midictrl.cpp781
-rw-r--r--muse2/muse/midictrl.h255
-rw-r--r--muse2/muse/mididev.cpp548
-rw-r--r--muse2/muse/mididev.h157
-rw-r--r--muse2/muse/midiedit/Makefile.am36
-rw-r--r--muse2/muse/midiedit/Makefile.in636
-rw-r--r--muse2/muse/midiedit/cmd.h26
-rw-r--r--muse2/muse/midiedit/dcanvas.cpp1291
-rw-r--r--muse2/muse/midiedit/dcanvas.h93
-rw-r--r--muse2/muse/midiedit/dlist.cpp754
-rw-r--r--muse2/muse/midiedit/dlist.h105
-rw-r--r--muse2/muse/midiedit/drumedit.cpp1167
-rw-r--r--muse2/muse/midiedit/drumedit.h151
-rw-r--r--muse2/muse/midiedit/drummap.cpp503
-rw-r--r--muse2/muse/midiedit/drummap.h47
-rw-r--r--muse2/muse/midiedit/ecanvas.cpp363
-rw-r--r--muse2/muse/midiedit/ecanvas.h87
-rw-r--r--muse2/muse/midiedit/piano.cpp557
-rw-r--r--muse2/muse/midiedit/piano.h63
-rw-r--r--muse2/muse/midiedit/pianoroll.cpp1107
-rw-r--r--muse2/muse/midiedit/pianoroll.h146
-rw-r--r--muse2/muse/midiedit/prcanvas.cpp1695
-rw-r--r--muse2/muse/midiedit/prcanvas.h113
-rw-r--r--muse2/muse/midiedit/quantconfig.cpp59
-rw-r--r--muse2/muse/midiedit/quantconfig.h32
-rw-r--r--muse2/muse/midieditor.cpp237
-rw-r--r--muse2/muse/midieditor.h86
-rw-r--r--muse2/muse/midievent.cpp175
-rw-r--r--muse2/muse/midievent.h62
-rw-r--r--muse2/muse/midifile.cpp678
-rw-r--r--muse2/muse/midifile.h113
-rw-r--r--muse2/muse/midiport.cpp1027
-rw-r--r--muse2/muse/midiport.h130
-rw-r--r--muse2/muse/midiseq.cpp766
-rw-r--r--muse2/muse/midiseq.h102
-rw-r--r--muse2/muse/miditransform.cpp1702
-rw-r--r--muse2/muse/miditransform.h105
-rw-r--r--muse2/muse/mixer/Makefile.am26
-rw-r--r--muse2/muse/mixer/Makefile.in628
-rw-r--r--muse2/muse/mixer/amixer.cpp592
-rw-r--r--muse2/muse/mixer/amixer.h119
-rw-r--r--muse2/muse/mixer/astrip.cpp2830
-rw-r--r--muse2/muse/mixer/astrip.h97
-rw-r--r--muse2/muse/mixer/auxknob.cpp40
-rw-r--r--muse2/muse/mixer/auxknob.h33
-rw-r--r--muse2/muse/mixer/meter.cpp184
-rw-r--r--muse2/muse/mixer/meter.h52
-rw-r--r--muse2/muse/mixer/midiportroutebase.ui85
-rw-r--r--muse2/muse/mixer/mstrip.cpp1216
-rw-r--r--muse2/muse/mixer/mstrip.h83
-rw-r--r--muse2/muse/mixer/panknob.cpp32
-rw-r--r--muse2/muse/mixer/panknob.h32
-rw-r--r--muse2/muse/mixer/rack.cpp531
-rw-r--r--muse2/muse/mixer/rack.h58
-rw-r--r--muse2/muse/mixer/routedialog.cpp185
-rw-r--r--muse2/muse/mixer/routedialog.h43
-rw-r--r--muse2/muse/mixer/routedialogbase.ui234
-rw-r--r--muse2/muse/mixer/strip.cpp238
-rw-r--r--muse2/muse/mixer/strip.h77
-rw-r--r--muse2/muse/mpevent.cpp160
-rw-r--r--muse2/muse/mpevent.h183
-rw-r--r--muse2/muse/mplugins/.cvsignore2
-rw-r--r--muse2/muse/mplugins/Makefile.am26
-rw-r--r--muse2/muse/mplugins/Makefile.in624
-rw-r--r--muse2/muse/mplugins/midifilter.ui879
-rw-r--r--muse2/muse/mplugins/midifilterimpl.cpp131
-rw-r--r--muse2/muse/mplugins/midifilterimpl.h92
-rw-r--r--muse2/muse/mplugins/midiitransform.cpp1696
-rw-r--r--muse2/muse/mplugins/midiitransform.h101
-rw-r--r--muse2/muse/mplugins/mitplugin.cpp145
-rw-r--r--muse2/muse/mplugins/mitplugin.h39
-rw-r--r--muse2/muse/mplugins/mittranspose.cpp181
-rw-r--r--muse2/muse/mplugins/mittranspose.h70
-rw-r--r--muse2/muse/mplugins/mrconfig.cpp71
-rw-r--r--muse2/muse/mplugins/mrconfig.h40
-rw-r--r--muse2/muse/mplugins/mrconfigbase.ui200
-rw-r--r--muse2/muse/mplugins/random.cpp758
-rw-r--r--muse2/muse/mplugins/random.h192
-rw-r--r--muse2/muse/mplugins/rhythm.cpp516
-rw-r--r--muse2/muse/mplugins/rhythm.h196
-rw-r--r--muse2/muse/mplugins/rhythmbase.ui1004
-rw-r--r--muse2/muse/mtc.cpp130
-rw-r--r--muse2/muse/mtc.h56
-rw-r--r--muse2/muse/muse.log1875
-rw-r--r--muse2/muse/muse.pro369
-rw-r--r--muse2/muse/node.cpp1911
-rw-r--r--muse2/muse/node.h132
-rw-r--r--muse2/muse/osc.cpp1386
-rw-r--r--muse2/muse/osc.h212
-rw-r--r--muse2/muse/part.cpp1432
-rw-r--r--muse2/muse/part.h175
-rw-r--r--muse2/muse/patchbay/Makefile.am9
-rw-r--r--muse2/muse/patchbay/patchbay.cpp10
-rw-r--r--muse2/muse/patchbay/patchbay.h16
-rw-r--r--muse2/muse/patchbay/patchbaybase.ui36
-rw-r--r--muse2/muse/plugin.cpp3871
-rw-r--r--muse2/muse/plugin.h536
-rw-r--r--muse2/muse/pos.cpp567
-rw-r--r--muse2/muse/pos.h99
-rw-r--r--muse2/muse/remote/Makefile.am15
-rw-r--r--muse2/muse/remote/Makefile.in590
-rw-r--r--muse2/muse/remote/pyapi.cpp1142
-rw-r--r--muse2/muse/remote/pyapi.h40
-rw-r--r--muse2/muse/route.cpp1633
-rw-r--r--muse2/muse/route.h102
-rw-r--r--muse2/muse/seqmsg.cpp1184
-rw-r--r--muse2/muse/shortcuts.cpp312
-rw-r--r--muse2/muse/shortcuts.h285
-rw-r--r--muse2/muse/sig.cpp439
-rw-r--r--muse2/muse/sig.h79
-rw-r--r--muse2/muse/song.cpp3681
-rw-r--r--muse2/muse/song.h413
-rw-r--r--muse2/muse/songfile.cpp1507
-rw-r--r--muse2/muse/stringparam.cpp113
-rw-r--r--muse2/muse/stringparam.h49
-rw-r--r--muse2/muse/sync.cpp1380
-rw-r--r--muse2/muse/sync.h153
-rw-r--r--muse2/muse/synth.cpp947
-rw-r--r--muse2/muse/synth.h290
-rw-r--r--muse2/muse/tempo.cpp503
-rw-r--r--muse2/muse/tempo.h89
-rw-r--r--muse2/muse/thread.cpp455
-rw-r--r--muse2/muse/thread.h104
-rw-r--r--muse2/muse/ticksynth.cpp215
-rw-r--r--muse2/muse/ticksynth.h22
-rw-r--r--muse2/muse/track.cpp980
-rw-r--r--muse2/muse/track.h675
-rw-r--r--muse2/muse/transport.cpp673
-rw-r--r--muse2/muse/transport.h129
-rw-r--r--muse2/muse/transpose.cpp92
-rw-r--r--muse2/muse/transpose.h21
-rw-r--r--muse2/muse/undo.cpp968
-rw-r--r--muse2/muse/undo.h102
-rw-r--r--muse2/muse/value.cpp60
-rw-r--r--muse2/muse/value.h61
-rw-r--r--muse2/muse/vst.cpp630
-rw-r--r--muse2/muse/vst.h83
-rw-r--r--muse2/muse/wave.cpp1175
-rw-r--r--muse2/muse/wave.h264
-rw-r--r--muse2/muse/waveedit/Makefile.am18
-rw-r--r--muse2/muse/waveedit/Makefile.in606
-rw-r--r--muse2/muse/waveedit/editgain.cpp91
-rw-r--r--muse2/muse/waveedit/editgain.h37
-rw-r--r--muse2/muse/waveedit/editgainbase.ui302
-rw-r--r--muse2/muse/waveedit/waveedit.cpp413
-rw-r--r--muse2/muse/waveedit/waveedit.h79
-rw-r--r--muse2/muse/waveedit/waveview.cpp936
-rw-r--r--muse2/muse/waveedit/waveview.h98
-rw-r--r--muse2/muse/waveevent.cpp453
-rw-r--r--muse2/muse/waveevent.h64
-rw-r--r--muse2/muse/wavetrack.cpp360
-rw-r--r--muse2/muse/widgets/.cvsignore23
-rw-r--r--muse2/muse/widgets/Makefile.am262
-rw-r--r--muse2/muse/widgets/Makefile.in2647
-rw-r--r--muse2/muse/widgets/aboutbox.ui129
-rw-r--r--muse2/muse/widgets/aboutbox_impl.cpp10
-rw-r--r--muse2/muse/widgets/aboutbox_impl.h16
-rw-r--r--muse2/muse/widgets/action.h32
-rw-r--r--muse2/muse/widgets/appearancebase.ui1764
-rw-r--r--muse2/muse/widgets/bigtime.cpp442
-rw-r--r--muse2/muse/widgets/bigtime.h55
-rw-r--r--muse2/muse/widgets/canvas.cpp1405
-rw-r--r--muse2/muse/widgets/canvas.h185
-rw-r--r--muse2/muse/widgets/checkbox.cpp58
-rw-r--r--muse2/muse/widgets/checkbox.h45
-rw-r--r--muse2/muse/widgets/citem.cpp93
-rw-r--r--muse2/muse/widgets/citem.h90
-rw-r--r--muse2/muse/widgets/cliplisteditorbase.ui168
-rw-r--r--muse2/muse/widgets/comboQuant.cpp61
-rw-r--r--muse2/muse/widgets/comboQuant.h33
-rw-r--r--muse2/muse/widgets/combobox.cpp74
-rw-r--r--muse2/muse/widgets/combobox.h49
-rw-r--r--muse2/muse/widgets/comment.cpp86
-rw-r--r--muse2/muse/widgets/comment.h53
-rw-r--r--muse2/muse/widgets/commentbase.ui116
-rw-r--r--muse2/muse/widgets/configmidifilebase.ui259
-rw-r--r--muse2/muse/widgets/ctrlcombo.cpp56
-rw-r--r--muse2/muse/widgets/ctrlcombo.cw22
-rw-r--r--muse2/muse/widgets/ctrlcombo.h22
-rw-r--r--muse2/muse/widgets/dentry.cpp243
-rw-r--r--muse2/muse/widgets/dentry.h79
-rw-r--r--muse2/muse/widgets/didyouknow.ui102
-rw-r--r--muse2/muse/widgets/dimap.cpp308
-rw-r--r--muse2/muse/widgets/dimap.h55
-rw-r--r--muse2/muse/widgets/doublelabel.cpp189
-rw-r--r--muse2/muse/widgets/doublelabel.h60
-rw-r--r--muse2/muse/widgets/drange.cpp262
-rw-r--r--muse2/muse/widgets/drange.h71
-rw-r--r--muse2/muse/widgets/editctrl7dialogbase.ui214
-rw-r--r--muse2/muse/widgets/editmetadialogbase.ui254
-rw-r--r--muse2/muse/widgets/editnotedialogbase.ui202
-rw-r--r--muse2/muse/widgets/editsysexdialogbase.ui209
-rw-r--r--muse2/muse/widgets/fdialogbuttons.ui204
-rw-r--r--muse2/muse/widgets/filedialog.cpp534
-rw-r--r--muse2/muse/widgets/filedialog.h92
-rw-r--r--muse2/muse/widgets/fontsel.cpp137
-rw-r--r--muse2/muse/widgets/fontsel.h45
-rw-r--r--muse2/muse/widgets/gatetime.cpp46
-rw-r--r--muse2/muse/widgets/gatetime.h36
-rw-r--r--muse2/muse/widgets/gatetimebase.ui285
-rw-r--r--muse2/muse/widgets/genset.cpp444
-rw-r--r--muse2/muse/widgets/genset.h41
-rw-r--r--muse2/muse/widgets/gensetbase.ui1470
-rw-r--r--muse2/muse/widgets/header.cpp62
-rw-r--r--muse2/muse/widgets/header.h30
-rw-r--r--muse2/muse/widgets/hitscale.cpp134
-rw-r--r--muse2/muse/widgets/hitscale.h50
-rw-r--r--muse2/muse/widgets/intlabel.cpp144
-rw-r--r--muse2/muse/widgets/intlabel.h46
-rw-r--r--muse2/muse/widgets/itransformbase.ui1296
-rw-r--r--muse2/muse/widgets/knob.cpp506
-rw-r--r--muse2/muse/widgets/knob.h78
-rw-r--r--muse2/muse/widgets/lcombo.cpp49
-rw-r--r--muse2/muse/widgets/lcombo.h40
-rw-r--r--muse2/muse/widgets/listitem.h85
-rw-r--r--muse2/muse/widgets/menutitleitem.h29
-rw-r--r--muse2/muse/widgets/metronome.cpp186
-rw-r--r--muse2/muse/widgets/metronome.h34
-rw-r--r--muse2/muse/widgets/metronomebase.ui604
-rw-r--r--muse2/muse/widgets/midisync.ui443
-rw-r--r--muse2/muse/widgets/midisyncimpl.cpp1294
-rw-r--r--muse2/muse/widgets/midisyncimpl.h150
-rw-r--r--muse2/muse/widgets/mittransposebase.ui117
-rw-r--r--muse2/muse/widgets/mixdowndialog.cpp108
-rw-r--r--muse2/muse/widgets/mixdowndialog.h37
-rw-r--r--muse2/muse/widgets/mixdowndialogbase.ui224
-rw-r--r--muse2/muse/widgets/mktest5
-rw-r--r--muse2/muse/widgets/mlabel.cpp17
-rw-r--r--muse2/muse/widgets/mlabel.h39
-rw-r--r--muse2/muse/widgets/mmath.cpp300
-rw-r--r--muse2/muse/widgets/mmath.h77
-rw-r--r--muse2/muse/widgets/moc_aboutbox.cpp81
-rw-r--r--muse2/muse/widgets/moc_didyouknow.cpp81
-rw-r--r--muse2/muse/widgets/moc_songinfo.cpp84
-rw-r--r--muse2/muse/widgets/moc_ttoolbar.cpp0
-rw-r--r--muse2/muse/widgets/mtrackinfobase.ui1067
-rw-r--r--muse2/muse/widgets/mtscale.cpp425
-rw-r--r--muse2/muse/widgets/mtscale.h53
-rw-r--r--muse2/muse/widgets/musewidgetsplug.cpp539
-rw-r--r--muse2/muse/widgets/nentry.cpp407
-rw-r--r--muse2/muse/widgets/nentry.h93
-rw-r--r--muse2/muse/widgets/noteinfo.cpp178
-rw-r--r--muse2/muse/widgets/noteinfo.h52
-rw-r--r--muse2/muse/widgets/pitchedit.cpp64
-rw-r--r--muse2/muse/widgets/pitchedit.h33
-rw-r--r--muse2/muse/widgets/pitchlabel.cpp95
-rw-r--r--muse2/muse/widgets/pitchlabel.h41
-rw-r--r--muse2/muse/widgets/popupmenu.cpp2770
-rw-r--r--muse2/muse/widgets/popupmenu.h303
-rw-r--r--muse2/muse/widgets/posedit.cpp875
-rw-r--r--muse2/muse/widgets/posedit.h106
-rw-r--r--muse2/muse/widgets/poslabel.cpp152
-rw-r--r--muse2/muse/widgets/poslabel.h45
-rw-r--r--muse2/muse/widgets/scldiv.cpp652
-rw-r--r--muse2/muse/widgets/scldiv.h57
-rw-r--r--muse2/muse/widgets/scldraw.cpp881
-rw-r--r--muse2/muse/widgets/scldraw.h89
-rw-r--r--muse2/muse/widgets/sclif.cpp205
-rw-r--r--muse2/muse/widgets/sclif.h51
-rw-r--r--muse2/muse/widgets/scrollscale.cpp499
-rw-r--r--muse2/muse/widgets/scrollscale.h90
-rw-r--r--muse2/muse/widgets/section.h19
-rw-r--r--muse2/muse/widgets/shortcutcapturedialog.cpp87
-rw-r--r--muse2/muse/widgets/shortcutcapturedialog.h35
-rw-r--r--muse2/muse/widgets/shortcutcapturedialogbase.ui134
-rw-r--r--muse2/muse/widgets/shortcutconfig.cpp115
-rw-r--r--muse2/muse/widgets/shortcutconfig.h61
-rw-r--r--muse2/muse/widgets/shortcutconfigbase.ui207
-rw-r--r--muse2/muse/widgets/sigedit.cpp755
-rw-r--r--muse2/muse/widgets/sigedit.h90
-rw-r--r--muse2/muse/widgets/siglabel.cpp157
-rw-r--r--muse2/muse/widgets/siglabel.h42
-rw-r--r--muse2/muse/widgets/sigscale.cpp152
-rw-r--r--muse2/muse/widgets/sigscale.h50
-rw-r--r--muse2/muse/widgets/slider.cpp930
-rw-r--r--muse2/muse/widgets/slider.h98
-rw-r--r--muse2/muse/widgets/sliderbase.cpp726
-rw-r--r--muse2/muse/widgets/sliderbase.h107
-rw-r--r--muse2/muse/widgets/songinfo.ui115
-rw-r--r--muse2/muse/widgets/spinbox.cpp83
-rw-r--r--muse2/muse/widgets/spinbox.h44
-rw-r--r--muse2/muse/widgets/spinboxFP.cpp80
-rw-r--r--muse2/muse/widgets/spinboxFP.h35
-rw-r--r--muse2/muse/widgets/splitter.cpp77
-rw-r--r--muse2/muse/widgets/splitter.h29
-rw-r--r--muse2/muse/widgets/swidget.cpp20
-rw-r--r--muse2/muse/widgets/swidget.h33
-rw-r--r--muse2/muse/widgets/synthconfigbase.ui247
-rw-r--r--muse2/muse/widgets/synthwizardbase.h58
-rw-r--r--muse2/muse/widgets/tb1.cpp225
-rw-r--r--muse2/muse/widgets/tb1.h57
-rw-r--r--muse2/muse/widgets/tempolabel.cpp126
-rw-r--r--muse2/muse/widgets/tempolabel.h60
-rw-r--r--muse2/muse/widgets/tools.cpp139
-rw-r--r--muse2/muse/widgets/tools.h57
-rw-r--r--muse2/muse/widgets/transformbase.ui1146
-rw-r--r--muse2/muse/widgets/transposebase.ui252
-rw-r--r--muse2/muse/widgets/ttoolbar.cpp24
-rw-r--r--muse2/muse/widgets/ttoolbar.h9
-rw-r--r--muse2/muse/widgets/ttoolbutton.cpp30
-rw-r--r--muse2/muse/widgets/ttoolbutton.h28
-rw-r--r--muse2/muse/widgets/utils.cpp358
-rw-r--r--muse2/muse/widgets/utils.h33
-rw-r--r--muse2/muse/widgets/velocity.cpp46
-rw-r--r--muse2/muse/widgets/velocity.h36
-rw-r--r--muse2/muse/widgets/velocitybase.ui232
-rw-r--r--muse2/muse/widgets/view.cpp514
-rw-r--r--muse2/muse/widgets/view.h108
-rw-r--r--muse2/muse/widgets/vscale.cpp27
-rw-r--r--muse2/muse/widgets/vscale.h29
-rw-r--r--muse2/muse/widgets/wtrackinfobase.ui224
-rw-r--r--muse2/muse/widgets/wtscale.cpp289
-rw-r--r--muse2/muse/widgets/wtscale.h51
-rw-r--r--muse2/muse/xml.cpp733
-rw-r--r--muse2/muse/xml.h95
442 files changed, 172964 insertions, 0 deletions
diff --git a/muse2/muse/Makefile.am b/muse2/muse/Makefile.am
new file mode 100644
index 00000000..253add16
--- /dev/null
+++ b/muse2/muse/Makefile.am
@@ -0,0 +1,168 @@
+include $(top_srcdir)/common.am
+
+ACLOCAL_AMFLAGS = -I m4
+
+AM_CPPFLAGS += -Imidiedit -Iarranger -Iliste \
+ -Iwidgets -Imixer -Idriver -Iwaveedit -Implugins -Iinstruments -Iremote\
+ -DINSTPREFIX=\"$(prefix)\" -DINSTLIBDIR=\"$(libdir)\"
+
+SUBDIRS = widgets master midiedit mixer arranger \
+ liste driver waveedit ctrl cliplist \
+ instruments marker mplugins
+
+if PCH
+AM_CXXFLAGS += $(LASH_CFLAGS) -include $(top_srcdir)/all.h
+else
+AM_CXXFLAGS += $(LASH_CFLAGS)
+endif
+
+if ENABLE_PYTHON
+AM_CPPFLAGS += -DENABLE_PYTHON
+SUBDIRS += remote
+PYLIBS=$(PYTHON_LIB) remote/libremote.a
+endif
+AM_CXXFLAGS +=-DSVNVERSION=\"$(shell svnversion)\"
+
+
+EXTRA_PROGRAMS = givertcap
+bin_PROGRAMS = muse @GIVERTCAP@
+
+givertcap_LDADD = -lcap
+
+dist_muse_SOURCES = \
+ ticksynth.h ticksynth.cpp \
+ vst.h vst.cpp \
+ dssihost.h dssihost.cpp \
+ osc.cpp osc.h \
+ stringparam.cpp stringparam.h \
+ synth.h synth.cpp \
+ plugin.cpp plugin.h \
+ mtc.cpp mtc.h \
+ thread.cpp thread.h \
+ audio.cpp audio.h \
+ audioprefetch.cpp audioprefetch.h \
+ audioconvert.cpp audioconvert.h \
+ globals.cpp globals.h \
+ sync.cpp sync.h \
+ midiport.cpp midiport.h \
+ part.cpp part.h \
+ tempo.cpp tempo.h \
+ pos.cpp pos.h \
+ sig.cpp sig.h \
+ key.cpp key.h \
+ undo.cpp undo.h \
+ songfile.cpp \
+ midi.cpp midi.h \
+ importmidi.cpp \
+ exportmidi.cpp \
+ midifile.h midifile.cpp \
+ xml.cpp xml.h \
+ icons.cpp icons.h \
+ event.cpp event.h eventbase.h evdata.h \
+ eventlist.cpp \
+ midievent.h midievent.cpp \
+ waveevent.h waveevent.cpp \
+ mpevent.cpp mpevent.h \
+ track.cpp track.h \
+ audiotrack.cpp wavetrack.cpp \
+ wave.cpp wave.h \
+ seqmsg.cpp \
+ device.h \
+ globaldefs.h \
+ ladspa.h \
+ app.cpp app.h \
+ song.cpp song.h \
+ transport.cpp transport.h \
+ conf.cpp conf.h \
+ confmport.cpp confmport.h \
+ help.cpp \
+ midieditor.cpp midieditor.h \
+ cobject.cpp cobject.h \
+ value.cpp value.h \
+ midictrl.cpp midictrl.h \
+ transpose.cpp transpose.h \
+ miditransform.cpp miditransform.h \
+ appearance.cpp appearance.h \
+ node.cpp node.h \
+ midiseq.cpp midiseq.h \
+ helper.cpp helper.h \
+ debug.h memory.h memory.cpp \
+ mididev.h mididev.cpp \
+ route.h route.cpp\
+ shortcuts.h shortcuts.cpp \
+ ctrl.cpp ctrl.h \
+ gconfig.h gconfig.cpp \
+ fastlog.h \
+ default_click.h
+
+nodist_muse_SOURCES = \
+ moc_plugin.cpp \
+ moc_app.cpp \
+ moc_song.cpp \
+ moc_transport.cpp \
+ moc_conf.cpp \
+ moc_confmport.cpp \
+ moc_midieditor.cpp \
+ moc_cobject.cpp \
+ moc_value.cpp \
+ moc_transpose.cpp \
+ moc_miditransform.cpp \
+ moc_appearance.cpp
+
+muse_LDADD = $(X_LIBS) $(QT_LIBS) -lasound $(SNDFILE_LIBS) $(SAMPLERATE_LIBS) $(JACK_LIBS) $(PYLIBS) \
+ $(LASH_LIBS) $(FST_LIBS) $(UUID_LIBS) $(LO_LIBS) midiedit/libmidiedit.a ctrl/libctrl.a \
+ liste/libliste.a mixer/libmixer.a driver/libdriver.a marker/libmarker.a \
+ master/libmaster.a waveedit/libwaveedit.a mplugins/libmplugins.a arranger/libarranger.a \
+ cliplist/libcliplist.a instruments/libinstruments.a widgets/libwidgets.a \
+ ../synti/libsynti/libsynti.la ../al/libal.a
+muse_LDFLAGS = -fno_exceptions
+
+
+
+CLEANFILES = stamp-chown
+
+DISTCLEANFILES = .muse.bin.bak
+
+MAINTAINERCLEANFILES = depcomp config.guess \
+ install-sh config.sub missing mkinstalldirs INSTALL COPYING
+
+EXTRA_DIST =
+
+all-local: stamp-chown .muse.bin.bak
+
+stamp-chown: muse @GIVERTCAP@
+ if test "$(SUIDBUILD)" = "yes"; then \
+ su -c "chown root muse; chmod +s muse"; \
+ fi
+if RTCAP
+ su -c "chown root givertcap; chmod +s givertcap";
+endif
+ touch stamp-chown
+
+install-exec-local:
+ if test "$(SUIDINSTALL)" = "yes"; then \
+ su -c "chown root $(bindir)/muse; chmod +s $(bindir)/muse"; \
+ fi
+if RTCAP
+ su -c "chown root $(bindir)/givertcap; chmod +s $(bindir)/givertcap";
+endif
+
+update_translations:
+ genpro > muse.pro
+ lupdate muse.pro
+
+release_translations:
+ lrelease muse.pro
+
+.muse.bin.bak:
+ if test -e muse; then cp muse .muse.bin.bak; fi
+
+clean-local:
+ if test -e .muse.bin.bak; then cp .muse.bin.bak muse; fi
+
+
+dox: stamp-doxygen
+
+stamp-doxygen: $(shell find -name "*.cpp" -or -name "*.h")
+ $(DOXYGEN) Doxyfile
+ touch stamp-doxygen
diff --git a/muse2/muse/Makefile.in b/muse2/muse/Makefile.in
new file mode 100644
index 00000000..927c49c5
--- /dev/null
+++ b/muse2/muse/Makefile.in
@@ -0,0 +1,1067 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/common.am
+@PCH_TRUE@am__append_1 = $(LASH_CFLAGS) -include $(top_srcdir)/all.h
+@PCH_FALSE@am__append_2 = $(LASH_CFLAGS)
+@ENABLE_PYTHON_TRUE@am__append_3 = -DENABLE_PYTHON
+@ENABLE_PYTHON_TRUE@am__append_4 = remote
+EXTRA_PROGRAMS = givertcap$(EXEEXT)
+bin_PROGRAMS = muse$(EXEEXT) @GIVERTCAP@
+subdir = muse
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
+ $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+givertcap_SOURCES = givertcap.c
+givertcap_OBJECTS = givertcap.$(OBJEXT)
+givertcap_DEPENDENCIES =
+dist_muse_OBJECTS = ticksynth.$(OBJEXT) vst.$(OBJEXT) \
+ dssihost.$(OBJEXT) osc.$(OBJEXT) stringparam.$(OBJEXT) \
+ synth.$(OBJEXT) plugin.$(OBJEXT) mtc.$(OBJEXT) \
+ thread.$(OBJEXT) audio.$(OBJEXT) audioprefetch.$(OBJEXT) \
+ audioconvert.$(OBJEXT) globals.$(OBJEXT) sync.$(OBJEXT) \
+ midiport.$(OBJEXT) part.$(OBJEXT) tempo.$(OBJEXT) \
+ pos.$(OBJEXT) sig.$(OBJEXT) key.$(OBJEXT) undo.$(OBJEXT) \
+ songfile.$(OBJEXT) midi.$(OBJEXT) importmidi.$(OBJEXT) \
+ exportmidi.$(OBJEXT) midifile.$(OBJEXT) xml.$(OBJEXT) \
+ icons.$(OBJEXT) event.$(OBJEXT) eventlist.$(OBJEXT) \
+ midievent.$(OBJEXT) waveevent.$(OBJEXT) mpevent.$(OBJEXT) \
+ track.$(OBJEXT) audiotrack.$(OBJEXT) wavetrack.$(OBJEXT) \
+ wave.$(OBJEXT) seqmsg.$(OBJEXT) app.$(OBJEXT) song.$(OBJEXT) \
+ transport.$(OBJEXT) conf.$(OBJEXT) confmport.$(OBJEXT) \
+ help.$(OBJEXT) midieditor.$(OBJEXT) cobject.$(OBJEXT) \
+ value.$(OBJEXT) midictrl.$(OBJEXT) transpose.$(OBJEXT) \
+ miditransform.$(OBJEXT) appearance.$(OBJEXT) node.$(OBJEXT) \
+ midiseq.$(OBJEXT) helper.$(OBJEXT) memory.$(OBJEXT) \
+ mididev.$(OBJEXT) route.$(OBJEXT) shortcuts.$(OBJEXT) \
+ ctrl.$(OBJEXT) gconfig.$(OBJEXT)
+nodist_muse_OBJECTS = moc_plugin.$(OBJEXT) moc_app.$(OBJEXT) \
+ moc_song.$(OBJEXT) moc_transport.$(OBJEXT) moc_conf.$(OBJEXT) \
+ moc_confmport.$(OBJEXT) moc_midieditor.$(OBJEXT) \
+ moc_cobject.$(OBJEXT) moc_value.$(OBJEXT) \
+ moc_transpose.$(OBJEXT) moc_miditransform.$(OBJEXT) \
+ moc_appearance.$(OBJEXT)
+muse_OBJECTS = $(dist_muse_OBJECTS) $(nodist_muse_OBJECTS)
+am__DEPENDENCIES_1 =
+@ENABLE_PYTHON_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) \
+@ENABLE_PYTHON_TRUE@ remote/libremote.a
+muse_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ midiedit/libmidiedit.a ctrl/libctrl.a liste/libliste.a \
+ mixer/libmixer.a driver/libdriver.a marker/libmarker.a \
+ master/libmaster.a waveedit/libwaveedit.a \
+ mplugins/libmplugins.a arranger/libarranger.a \
+ cliplist/libcliplist.a instruments/libinstruments.a \
+ widgets/libwidgets.a ../synti/libsynti/libsynti.la \
+ ../al/libal.a
+muse_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(muse_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = givertcap.c $(dist_muse_SOURCES) $(nodist_muse_SOURCES)
+DIST_SOURCES = givertcap.c $(dist_muse_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = widgets master midiedit mixer arranger liste driver \
+ waveedit ctrl cliplist instruments marker mplugins remote
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCBOOKSTYLE = @DOCBOOKSTYLE@
+DOCBOOKTARGETS = @DOCBOOKTARGETS@
+DOT = @DOT@
+DOTPATH = @DOTPATH@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@
+FST_CFLAGS = @FST_CFLAGS@
+FST_LIBS = @FST_LIBS@
+Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@
+Fluidsynth_LIBS = @Fluidsynth_LIBS@
+GIVERTCAP = @GIVERTCAP@
+GREP = @GREP@
+HAVEDOT = @HAVEDOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JADE = @JADE@
+LASH_CFLAGS = @LASH_CFLAGS@
+LASH_LIBS = @LASH_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LO_CFLAGS = @LO_CFLAGS@
+LO_LIBS = @LO_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUSECXXFLAGS = @MUSECXXFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSGMLS = @NSGMLS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCH = @PCH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIB = @PYTHON_LIB@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+QTDIR_BIN = @QTDIR_BIN@
+QTDIR_INC = @QTDIR_INC@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+SUIDBUILD = @SUIDBUILD@
+SUIDINSTALL = @SUIDINSTALL@
+USE_SSE = @USE_SSE@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+have_docbook = @have_docbook@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+synth_fluid = @synth_fluid@
+synth_fluidsynth = @synth_fluidsynth@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \
+ -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(am__append_1) \
+ $(am__append_2) -DSVNVERSION=\"$(shell svnversion)\"
+AM_CPPFLAGS = -Imidiedit -Iarranger -Iliste -Iwidgets -Imixer -Idriver \
+ -Iwaveedit -Implugins -Iinstruments -Iremote \
+ -DINSTPREFIX=\"$(prefix)\" -DINSTLIBDIR=\"$(libdir)\" \
+ $(am__append_3)
+MOC = $(QTDIR_BIN)/moc
+#UIC = $(QTDIR_BIN)/uic3
+UIC = /usr/bin/uic3
+UIFILES = $(wildcard *.ui)
+MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \
+ if grep -q Q_OBJECT $$h; then \
+ echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \
+ fi; \
+ done)
+
+BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+SUFFIXES = .ui .h.gch
+ACLOCAL_AMFLAGS = -I m4
+SUBDIRS = widgets master midiedit mixer arranger liste driver waveedit \
+ ctrl cliplist instruments marker mplugins $(am__append_4)
+@ENABLE_PYTHON_TRUE@PYLIBS = $(PYTHON_LIB) remote/libremote.a
+givertcap_LDADD = -lcap
+dist_muse_SOURCES = \
+ ticksynth.h ticksynth.cpp \
+ vst.h vst.cpp \
+ dssihost.h dssihost.cpp \
+ osc.cpp osc.h \
+ stringparam.cpp stringparam.h \
+ synth.h synth.cpp \
+ plugin.cpp plugin.h \
+ mtc.cpp mtc.h \
+ thread.cpp thread.h \
+ audio.cpp audio.h \
+ audioprefetch.cpp audioprefetch.h \
+ audioconvert.cpp audioconvert.h \
+ globals.cpp globals.h \
+ sync.cpp sync.h \
+ midiport.cpp midiport.h \
+ part.cpp part.h \
+ tempo.cpp tempo.h \
+ pos.cpp pos.h \
+ sig.cpp sig.h \
+ key.cpp key.h \
+ undo.cpp undo.h \
+ songfile.cpp \
+ midi.cpp midi.h \
+ importmidi.cpp \
+ exportmidi.cpp \
+ midifile.h midifile.cpp \
+ xml.cpp xml.h \
+ icons.cpp icons.h \
+ event.cpp event.h eventbase.h evdata.h \
+ eventlist.cpp \
+ midievent.h midievent.cpp \
+ waveevent.h waveevent.cpp \
+ mpevent.cpp mpevent.h \
+ track.cpp track.h \
+ audiotrack.cpp wavetrack.cpp \
+ wave.cpp wave.h \
+ seqmsg.cpp \
+ device.h \
+ globaldefs.h \
+ ladspa.h \
+ app.cpp app.h \
+ song.cpp song.h \
+ transport.cpp transport.h \
+ conf.cpp conf.h \
+ confmport.cpp confmport.h \
+ help.cpp \
+ midieditor.cpp midieditor.h \
+ cobject.cpp cobject.h \
+ value.cpp value.h \
+ midictrl.cpp midictrl.h \
+ transpose.cpp transpose.h \
+ miditransform.cpp miditransform.h \
+ appearance.cpp appearance.h \
+ node.cpp node.h \
+ midiseq.cpp midiseq.h \
+ helper.cpp helper.h \
+ debug.h memory.h memory.cpp \
+ mididev.h mididev.cpp \
+ route.h route.cpp\
+ shortcuts.h shortcuts.cpp \
+ ctrl.cpp ctrl.h \
+ gconfig.h gconfig.cpp \
+ fastlog.h \
+ default_click.h
+
+nodist_muse_SOURCES = \
+ moc_plugin.cpp \
+ moc_app.cpp \
+ moc_song.cpp \
+ moc_transport.cpp \
+ moc_conf.cpp \
+ moc_confmport.cpp \
+ moc_midieditor.cpp \
+ moc_cobject.cpp \
+ moc_value.cpp \
+ moc_transpose.cpp \
+ moc_miditransform.cpp \
+ moc_appearance.cpp
+
+muse_LDADD = $(X_LIBS) $(QT_LIBS) -lasound $(SNDFILE_LIBS) $(SAMPLERATE_LIBS) $(JACK_LIBS) $(PYLIBS) \
+ $(LASH_LIBS) $(FST_LIBS) $(UUID_LIBS) $(LO_LIBS) midiedit/libmidiedit.a ctrl/libctrl.a \
+ liste/libliste.a mixer/libmixer.a driver/libdriver.a marker/libmarker.a \
+ master/libmaster.a waveedit/libwaveedit.a mplugins/libmplugins.a arranger/libarranger.a \
+ cliplist/libcliplist.a instruments/libinstruments.a widgets/libwidgets.a \
+ ../synti/libsynti/libsynti.la ../al/libal.a
+
+muse_LDFLAGS = -fno_exceptions
+CLEANFILES = stamp-chown
+DISTCLEANFILES = .muse.bin.bak
+MAINTAINERCLEANFILES = depcomp config.guess \
+ install-sh config.sub missing mkinstalldirs INSTALL COPYING
+
+EXTRA_DIST =
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .ui .h.gch .c .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu muse/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+givertcap$(EXEEXT): $(givertcap_OBJECTS) $(givertcap_DEPENDENCIES)
+ @rm -f givertcap$(EXEEXT)
+ $(LINK) $(givertcap_OBJECTS) $(givertcap_LDADD) $(LIBS)
+muse$(EXEEXT): $(muse_OBJECTS) $(muse_DEPENDENCIES)
+ @rm -f muse$(EXEEXT)
+ $(muse_LINK) $(muse_OBJECTS) $(muse_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/app.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/appearance.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audio.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audioconvert.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audioprefetch.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audiotrack.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cobject.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/confmport.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctrl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dssihost.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eventlist.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exportmidi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gconfig.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/givertcap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/globals.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/help.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icons.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/importmidi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/key.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midictrl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mididev.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midieditor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midievent.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midifile.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midiport.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midiseq.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miditransform.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_app.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_appearance.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_cobject.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_conf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_confmport.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_midieditor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_miditransform.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_plugin.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_song.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_transport.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_transpose.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_value.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpevent.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/node.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/osc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/part.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pos.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/route.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seqmsg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shortcuts.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sig.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/song.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/songfile.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stringparam.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sync.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/synth.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tempo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ticksynth.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/track.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transport.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transpose.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/undo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/value.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vst.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wave.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/waveevent.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wavetrack.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xml.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-recursive
+all-am: Makefile $(PROGRAMS) all-local
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool clean-local \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS install-exec-local
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \
+ ctags-recursive install install-am install-strip \
+ tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am all-local check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-local ctags ctags-recursive \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-exec-local install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-binPROGRAMS
+
+
+de:
+ @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done
+
+nde:
+ @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done
+
+.ui.o: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(CXXCOMPILE) -c $*.cpp -o $*.o
+ $(RM) $*.cpp moc_$*.cpp moc_$*.o
+
+.ui.lo: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(LTCXXCOMPILE) -c $*.cpp -o $*.lo
+ $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o
+
+moc_%.cpp: %.h
+ $(MOC) $< -o $@
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $<
+
+all-local: stamp-chown .muse.bin.bak
+
+stamp-chown: muse @GIVERTCAP@
+ if test "$(SUIDBUILD)" = "yes"; then \
+ su -c "chown root muse; chmod +s muse"; \
+ fi
+@RTCAP_TRUE@ su -c "chown root givertcap; chmod +s givertcap";
+ touch stamp-chown
+
+install-exec-local:
+ if test "$(SUIDINSTALL)" = "yes"; then \
+ su -c "chown root $(bindir)/muse; chmod +s $(bindir)/muse"; \
+ fi
+@RTCAP_TRUE@ su -c "chown root $(bindir)/givertcap; chmod +s $(bindir)/givertcap";
+
+update_translations:
+ genpro > muse.pro
+ lupdate muse.pro
+
+release_translations:
+ lrelease muse.pro
+
+.muse.bin.bak:
+ if test -e muse; then cp muse .muse.bin.bak; fi
+
+clean-local:
+ if test -e .muse.bin.bak; then cp .muse.bin.bak muse; fi
+
+dox: stamp-doxygen
+
+stamp-doxygen: $(shell find -name "*.cpp" -or -name "*.h")
+ $(DOXYGEN) Doxyfile
+ touch stamp-doxygen
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
new file mode 100644
index 00000000..707c3734
--- /dev/null
+++ b/muse2/muse/app.cpp
@@ -0,0 +1,4767 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: app.cpp,v 1.113.2.68 2009/12/21 14:51:51 spamatica Exp $
+//
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "config.h"
+
+#include <string>
+#include <map>
+#include <assert.h>
+#include <getopt.h>
+#include <errno.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <time.h>
+#include <signal.h>
+#include <stdarg.h>
+
+#include <q3buttongroup.h>
+#include <q3popupmenu.h>
+#include <qmessagebox.h>
+#include <qclipboard.h>
+#include <qsocketnotifier.h>
+#include <qtextcodec.h>
+#include <qstylefactory.h>
+#include <qmenubar.h>
+#include <qapplication.h>
+#include <qtimer.h>
+#include <qstyle.h>
+#include <qsplashscreen.h>
+#include <qobject.h>
+//Added by qt3to4:
+#include <QTimerEvent>
+#include <Q3CString>
+#include <QFocusEvent>
+#include <QTranslator>
+#include <QKeyEvent>
+#include <QEvent>
+#include <Q3ActionGroup>
+#include <QPixmap>
+#include <QCloseEvent>
+
+#include "app.h"
+#include "popupmenu.h"
+#include "transport.h"
+#include "bigtime.h"
+#include "arranger.h"
+#include "pianoroll.h"
+#include "xml.h"
+#include "midi.h"
+#include "conf.h"
+#include "listedit.h"
+#include "master/masteredit.h"
+#include "master/lmaster.h"
+#include "drumedit.h"
+#include "ttoolbar.h"
+#include "amixer.h"
+#include "cliplist/cliplist.h"
+#include "midiport.h"
+#include "audiodev.h"
+#include "mididev.h"
+#include "waveedit.h"
+#include "icons.h"
+#include "minstrument.h"
+#include "mixdowndialog.h"
+#include "midictrl.h"
+#include "filedialog.h"
+#include "plugin.h"
+#include "marker/markerview.h"
+#include "transpose.h"
+#include "appearance.h"
+#include "gatetime.h"
+#include "metronome.h"
+#include "debug.h"
+#include "event.h"
+#include "audio.h"
+#include "midiseq.h"
+#include "audioprefetch.h"
+#include "wave.h"
+#include "shortcutconfig.h"
+#include "gconfig.h"
+#include "driver/jackaudio.h"
+#include "track.h"
+#include "ticksynth.h"
+#include "instruments/editinstrument.h"
+#include "synth.h"
+#include "remote/pyapi.h"
+#include "al/dsp.h"
+
+#ifdef DSSI_SUPPORT
+#include "dssihost.h"
+#endif
+
+#ifdef VST_SUPPORT
+#include "vst.h"
+#endif
+
+#include <alsa/asoundlib.h>
+#include "songinfo.h"
+#include "didyouknow.h"
+#include <q3textedit.h>
+
+//extern void cacheJackRouteNames();
+
+static pthread_t watchdogThread;
+//ErrorHandler *error;
+static const char* fileOpenText =
+ QT_TR_NOOP("Click this button to open a <em>new song</em>.<br>"
+ "You can also select the <b>Open command</b> from the File menu.");
+static const char* fileSaveText =
+ QT_TR_NOOP("Click this button to save the song you are "
+ "editing. You will be prompted for a file name.\n"
+ "You can also select the Save command from the File menu.");
+static const char* fileNewText = QT_TR_NOOP("Create New Song");
+
+static const char* infoLoopButton = QT_TR_NOOP("loop between left mark and right mark");
+static const char* infoPunchinButton = QT_TR_NOOP("record starts at left mark");
+static const char* infoPunchoutButton = QT_TR_NOOP("record stops at right mark");
+static const char* infoStartButton = QT_TR_NOOP("rewind to start position");
+static const char* infoRewindButton = QT_TR_NOOP("rewind current position");
+static const char* infoForwardButton = QT_TR_NOOP("move current position");
+static const char* infoStopButton = QT_TR_NOOP("stop sequencer");
+static const char* infoPlayButton = QT_TR_NOOP("start sequencer play");
+static const char* infoRecordButton = QT_TR_NOOP("to record press record and then play");
+static const char* infoPanicButton = QT_TR_NOOP("send note off to all midi channels");
+
+#define PROJECT_LIST_LEN 6
+static QString* projectList[PROJECT_LIST_LEN];
+
+extern void initIcons();
+extern void initMidiSynth();
+extern bool initJackAudio();
+extern void exitJackAudio();
+extern bool initDummyAudio();
+extern void exitDummyAudio();
+extern void initVST_fst_init();
+extern void initVST();
+extern void initDSSI();
+// p3.3.39
+extern void initOSC();
+extern void exitOSC();
+
+#ifdef HAVE_LASH
+#include <lash/lash.h>
+lash_client_t * lash_client = 0;
+extern snd_seq_t * alsaSeq;
+#endif /* HAVE_LASH */
+
+int watchAudio, watchAudioPrefetch, watchMidi;
+pthread_t splashThread;
+
+
+//PyScript *pyscript;
+// void MusE::runPythonScript()
+// {
+// QString script("test.py");
+// // pyscript->runPythonScript(script);
+// }
+
+//---------------------------------------------------------
+// getCapabilities
+//---------------------------------------------------------
+
+static void getCapabilities()
+ {
+#ifdef RTCAP
+#ifdef __linux__
+ const char* napp = getenv("GIVERTCAP");
+ if (napp == 0)
+ napp = "givertcap";
+ int pid = fork();
+ if (pid == 0) {
+ if (execlp(napp, napp, 0) == -1)
+ perror("exec givertcap failed");
+ }
+ else if (pid == -1) {
+ perror("fork givertcap failed");
+ }
+ else {
+ waitpid(pid, 0, 0);
+ }
+#endif // __linux__
+#endif
+ }
+
+
+//---------------------------------------------------------
+// sleep function
+//---------------------------------------------------------
+void microSleep(long msleep)
+{
+ bool sleepOk=-1;
+
+ while(sleepOk==-1)
+ sleepOk=usleep(msleep);
+}
+
+// Removed p3.3.17
+/*
+//---------------------------------------------------------
+// watchdog thread
+//---------------------------------------------------------
+
+static void* watchdog(void*)
+ {
+ doSetuid();
+
+ struct sched_param rt_param;
+ memset(&rt_param, 0, sizeof(rt_param));
+ rt_param.sched_priority = sched_get_priority_max(SCHED_FIFO);
+ int rv = pthread_setschedparam(pthread_self(), SCHED_FIFO, &rt_param);
+ if (rv != 0)
+ perror("Set realtime scheduler");
+
+ int policy;
+ if (pthread_getschedparam(pthread_self(), &policy, &rt_param)!= 0) {
+ printf("Cannot get current client scheduler: %s\n", strerror(errno));
+ }
+ if (policy != SCHED_FIFO)
+ printf("watchdog process %d _NOT_ running SCHED_FIFO\n", getpid());
+ else if (debugMsg)
+ printf("watchdog set to SCHED_FIFO priority %d\n",
+ sched_get_priority_max(SCHED_FIFO));
+
+ undoSetuid();
+ int fatal = 0;
+ for (;;) {
+ watchAudio = 0;
+ watchMidi = 0;
+ static const int WD_TIMEOUT = 3;
+
+ // sleep can be interrpted by signals:
+ int to = WD_TIMEOUT;
+ while (to > 0)
+ to = sleep(to);
+
+ bool timeout = false;
+ if (midiSeqRunning && watchMidi == 0)
+ {
+ printf("midiSeqRunning = %i watchMidi %i\n", midiSeqRunning, watchMidi);
+ timeout = true;
+ }
+ if (watchAudio == 0)
+ timeout = true;
+ if (watchAudio > 500000)
+ timeout = true;
+ if (timeout)
+ ++fatal;
+ else
+ fatal = 0;
+ if (fatal >= 3) {
+ printf("WatchDog: fatal error, realtime task timeout\n");
+ printf(" (%d,%d-%d) - stopping all services\n",
+ watchMidi, watchAudio, fatal);
+ break;
+ }
+// printf("wd %d %d %d\n", watchMidi, watchAudio, fatal);
+ }
+ audio->stop(true);
+ audioPrefetch->stop(true);
+ printf("watchdog exit\n");
+ exit(-1);
+ }
+*/
+
+//---------------------------------------------------------
+// seqStart
+//---------------------------------------------------------
+
+bool MusE::seqStart()
+ {
+ // Changed by Tim. p3.3.17
+
+ /*
+ if (audio->isRunning()) {
+ printf("seqStart(): already running\n");
+ return true;
+ }
+
+ if (realTimeScheduling) {
+ //
+ // create watchdog thread with max priority
+ //
+ doSetuid();
+ struct sched_param rt_param;
+ memset(&rt_param, 0, sizeof(rt_param));
+ rt_param.sched_priority = realTimePriority +1;//sched_get_priority_max(SCHED_FIFO);
+
+ pthread_attr_t* attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t));
+ pthread_attr_init(attributes);
+
+// if (pthread_attr_setschedpolicy(attributes, SCHED_FIFO)) {
+// printf("MusE: cannot set FIFO scheduling class for RT thread\n");
+// }
+// if (pthread_attr_setschedparam (attributes, &rt_param)) {
+// // printf("Cannot set scheduling priority for RT thread (%s)\n", strerror(errno));
+// }
+// if (pthread_attr_setscope (attributes, PTHREAD_SCOPE_SYSTEM)) {
+// printf("MusE: Cannot set scheduling scope for RT thread\n");
+// }
+ if (pthread_create(&watchdogThread, attributes, ::watchdog, 0))
+ perror("MusE: creating watchdog thread failed:");
+ pthread_attr_destroy(attributes);
+ undoSetuid();
+ }
+ audioPrefetch->start();
+ audioPrefetch->msgSeek(0, true); // force
+ midiSeqRunning = !midiSeq->start();
+
+ if (!audio->start()) {
+ QMessageBox::critical( muse, tr(QString("Failed to start audio!")),
+ tr(QString("Was not able to start audio, check if jack is running.\n")));
+ return false;
+ }
+
+ return true;
+ */
+
+ if (audio->isRunning()) {
+ printf("seqStart(): already running\n");
+ return true;
+ }
+
+ if (!audio->start()) {
+ QMessageBox::critical( muse, tr(QString("Failed to start audio!")),
+ tr(QString("Was not able to start audio, check if jack is running.\n")));
+ return false;
+ }
+
+ //
+ // wait for jack callback
+ //
+ for(int i = 0; i < 60; ++i)
+ {
+ //if (audioState == AUDIO_START2)
+ if(audio->isRunning())
+ break;
+ sleep(1);
+ }
+ //if (audioState != AUDIO_START2) {
+ if(!audio->isRunning())
+ {
+ QMessageBox::critical( muse, tr("Failed to start audio!"),
+ tr("Timeout waiting for audio to run. Check if jack is running.\n"));
+ }
+ //
+ // now its safe to ask the driver for realtime
+ // priority
+
+ realTimePriority = audioDevice->realtimePriority();
+ if(debugMsg)
+ printf("MusE::seqStart: getting audio driver realTimePriority:%d\n", realTimePriority);
+
+ // Disabled by Tim. p3.3.22
+ /*
+ if(realTimeScheduling)
+ {
+ //
+ // create watchdog thread with max priority
+ //
+ doSetuid();
+ struct sched_param rt_param;
+ memset(&rt_param, 0, sizeof(rt_param));
+ rt_param.sched_priority = realTimePriority + 1;//sched_get_priority_max(SCHED_FIFO);
+
+ pthread_attr_t* attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t));
+ pthread_attr_init(attributes);
+
+// if (pthread_attr_setschedpolicy(attributes, SCHED_FIFO)) {
+// printf("MusE: cannot set FIFO scheduling class for RT thread\n");
+// }
+// if (pthread_attr_setschedparam (attributes, &rt_param)) {
+// // printf("Cannot set scheduling priority for RT thread (%s)\n", strerror(errno));
+// }
+// if (pthread_attr_setscope (attributes, PTHREAD_SCOPE_SYSTEM)) {
+// printf("MusE: Cannot set scheduling scope for RT thread\n");
+// }
+ if (pthread_create(&watchdogThread, attributes, ::watchdog, 0))
+ perror("MusE: creating watchdog thread failed");
+ pthread_attr_destroy(attributes);
+ undoSetuid();
+ }
+ */
+
+ //int policy;
+ //if ((policy = sched_getscheduler (0)) < 0) {
+ // printf("Cannot get current client scheduler: %s\n", strerror(errno));
+ // }
+ //if (policy != SCHED_FIFO)
+ // printf("midi thread %d _NOT_ running SCHED_FIFO\n", getpid());
+
+
+ //audioState = AUDIO_RUNNING;
+ // Changed by Tim. p3.3.22
+ /*
+ //if(realTimePriority)
+ if(realTimeScheduling)
+ {
+ int pr = realTimePriority;
+ if(pr > 5)
+ pr -= 5;
+ else
+ pr = 0;
+ audioPrefetch->start(pr);
+ //audioWriteback->start(realTimePriority - 5);
+ }
+ else
+ {
+ audioPrefetch->start(0);
+ //audioWriteback->start(0);
+ }
+ */
+
+ int pfprio = 0;
+ int midiprio = 0;
+
+ // NOTE: realTimeScheduling can be true (gotten using jack_is_realtime()),
+ // while the determined realTimePriority can be 0.
+ // realTimePriority is gotten using pthread_getschedparam() on the client thread
+ // in JackAudioDevice::realtimePriority() which is a bit flawed - it reports there's no RT...
+ if(realTimeScheduling)
+ {
+ //if(realTimePriority < 5)
+ // printf("MusE: WARNING: Recommend setting audio realtime priority to a higher value!\n");
+ /*
+ if(realTimePriority == 0)
+ {
+ pfprio = 1;
+ midiprio = 2;
+ }
+ else
+ if(realTimePriority == 1)
+ {
+ pfprio = 2;
+ midiprio = 3;
+ }
+ else
+ if(realTimePriority == 2)
+ {
+ pfprio = 1;
+ midiprio = 3;
+ }
+ else
+ if(realTimePriority == 3)
+ {
+ pfprio = 1;
+ //midiprio = 2;
+ // p3.3.37
+ midiprio = 4;
+ }
+ else
+ if(realTimePriority == 4)
+ {
+ pfprio = 1;
+ //midiprio = 3;
+ // p3.3.37
+ midiprio = 5;
+ }
+ else
+ if(realTimePriority == 5)
+ {
+ pfprio = 1;
+ //midiprio = 3;
+ // p3.3.37
+ midiprio = 6;
+ }
+ else
+ */
+ {
+ //pfprio = realTimePriority - 5;
+ // p3.3.40
+ pfprio = realTimePriority + 1;
+
+ //midiprio = realTimePriority - 2;
+ // p3.3.37
+ //midiprio = realTimePriority + 1;
+ // p3.3.40
+ midiprio = realTimePriority + 2;
+ }
+ }
+
+ if(midiRTPrioOverride > 0)
+ midiprio = midiRTPrioOverride;
+
+ // FIXME FIXME: The realTimePriority of the Jack thread seems to always be 5 less than the value passed to jackd command.
+ //if(midiprio == realTimePriority)
+ // printf("MusE: WARNING: Midi realtime priority %d is the same as audio realtime priority %d. Try a different setting.\n",
+ // midiprio, realTimePriority);
+ //if(midiprio == pfprio)
+ // printf("MusE: WARNING: Midi realtime priority %d is the same as audio prefetch realtime priority %d. Try a different setting.\n",
+ // midiprio, pfprio);
+
+ audioPrefetch->start(pfprio);
+
+ audioPrefetch->msgSeek(0, true); // force
+
+ //midiSeqRunning = !midiSeq->start(realTimeScheduling ? realTimePriority : 0);
+ // Changed by Tim. p3.3.22
+ //midiSeq->start(realTimeScheduling ? realTimePriority : 0);
+ midiSeq->start(midiprio);
+
+ int counter=0;
+ while (++counter) {
+ //if (counter > 10) {
+ if (counter > 1000) {
+ fprintf(stderr,"midi sequencer thread does not start!? Exiting...\n");
+ exit(33);
+ }
+ midiSeqRunning = midiSeq->isRunning();
+ if (midiSeqRunning)
+ break;
+ usleep(1000);
+ printf("looping waiting for sequencer thread to start\n");
+ }
+ if(!midiSeqRunning)
+ {
+ fprintf(stderr, "midiSeq is not running! Exiting...\n");
+ exit(33);
+ }
+ return true;
+ }
+
+//---------------------------------------------------------
+// stop
+//---------------------------------------------------------
+
+void MusE::seqStop()
+ {
+ // label sequencer as disabled before it actually happened to minimize race condition
+ midiSeqRunning = false;
+
+ song->setStop(true);
+ song->setStopPlay(false);
+ midiSeq->stop(true);
+ audio->stop(true);
+ audioPrefetch->stop(true);
+ if (realTimeScheduling && watchdogThread)
+ pthread_cancel(watchdogThread);
+ }
+
+//---------------------------------------------------------
+// seqRestart
+//---------------------------------------------------------
+
+bool MusE::seqRestart()
+{
+ bool restartSequencer = audio->isRunning();
+ if (restartSequencer) {
+ if (audio->isPlaying()) {
+ audio->msgPlay(false);
+ while (audio->isPlaying())
+ qApp->processEvents();
+ }
+ seqStop();
+ }
+ if(!seqStart())
+ return false;
+
+ audioDevice->graphChanged();
+ return true;
+}
+
+//---------------------------------------------------------
+// addProject
+//---------------------------------------------------------
+
+void addProject(const QString& name)
+ {
+ for (int i = 0; i < PROJECT_LIST_LEN; ++i) {
+ if (projectList[i] == 0)
+ break;
+ if (name == *projectList[i]) {
+ int dst = i;
+ int src = i+1;
+ int n = PROJECT_LIST_LEN - i - 1;
+ delete projectList[i];
+ for (int k = 0; k < n; ++k)
+ projectList[dst++] = projectList[src++];
+ projectList[dst] = 0;
+ break;
+ }
+ }
+ QString** s = &projectList[PROJECT_LIST_LEN - 2];
+ QString** d = &projectList[PROJECT_LIST_LEN - 1];
+ if (*d)
+ delete *d;
+ for (int i = 0; i < PROJECT_LIST_LEN-1; ++i)
+ *d-- = *s--;
+ projectList[0] = new QString(name);
+ }
+
+//---------------------------------------------------------
+// populateAddSynth
+//---------------------------------------------------------
+
+/*
+struct addSynth_cmp_str
+{
+ bool operator()(std::string a, std::string b)
+ {
+ return (a < b);
+ }
+};
+*/
+
+Q3PopupMenu* populateAddSynth(QWidget* parent, QObject* obj = 0, const char* slot = 0)
+{
+ Q3PopupMenu* synp = new Q3PopupMenu(parent);
+
+ //typedef std::multimap<std::string, int, addSynth_cmp_str > asmap;
+ typedef std::multimap<std::string, int > asmap;
+
+ //typedef std::multimap<std::string, int, addSynth_cmp_str >::iterator imap;
+ typedef std::multimap<std::string, int >::iterator imap;
+
+ MessSynth* synMESS = 0;
+ Q3PopupMenu* synpMESS = 0;
+ asmap mapMESS;
+
+ #ifdef DSSI_SUPPORT
+ DssiSynth* synDSSI = 0;
+ Q3PopupMenu* synpDSSI = 0;
+ asmap mapDSSI;
+ #endif
+
+ #ifdef VST_SUPPORT
+ VstSynth* synVST = 0;
+ Q3PopupMenu* synpVST = 0;
+ asmap mapVST;
+ #endif
+
+ // Not necessary, but what the heck.
+ Q3PopupMenu* synpOther = 0;
+ asmap mapOther;
+
+ //const int synth_base_id = 0x1000;
+ int ii = 0;
+ for(std::vector<Synth*>::iterator i = synthis.begin(); i != synthis.end(); ++i)
+ {
+ synMESS = dynamic_cast<MessSynth*>(*i);
+ if(synMESS)
+ {
+ mapMESS.insert( std::pair<std::string, int> (std::string(synMESS->description().lower().latin1()), ii) );
+ }
+ else
+ {
+
+ #ifdef DSSI_SUPPORT
+ synDSSI = dynamic_cast<DssiSynth*>(*i);
+ if(synDSSI)
+ {
+ mapDSSI.insert( std::pair<std::string, int> (std::string(synDSSI->description().lower().latin1()), ii) );
+ }
+ else
+ #endif
+
+ {
+ #ifdef VST_SUPPORT
+ synVST = dynamic_cast<VstSynth*>(*i);
+ if(synVST)
+ {
+ mapVST.insert( std::pair<std::string, int> (std::string(synVST->description().lower().latin1()), ii) );
+ }
+ else
+ #endif
+
+ {
+ mapOther.insert( std::pair<std::string, int> (std::string((*i)->description().lower().latin1()), ii) );
+ }
+ }
+ }
+
+ ++ii;
+ }
+
+ int sz = synthis.size();
+ for(imap i = mapMESS.begin(); i != mapMESS.end(); ++i)
+ {
+ int idx = i->second;
+ if(idx > sz) // Sanity check
+ continue;
+ Synth* s = synthis[idx];
+ if(s)
+ {
+ // No MESS sub-menu yet? Create it now.
+ if(!synpMESS)
+ synpMESS = new Q3PopupMenu(parent);
+ synpMESS->insertItem(QT_TR_NOOP(s->description()) + " <" + QT_TR_NOOP(s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx);
+ }
+ }
+
+ #ifdef DSSI_SUPPORT
+ for(imap i = mapDSSI.begin(); i != mapDSSI.end(); ++i)
+ {
+ int idx = i->second;
+ if(idx > sz)
+ continue;
+ Synth* s = synthis[idx];
+ if(s)
+ {
+ // No DSSI sub-menu yet? Create it now.
+ if(!synpDSSI)
+ synpDSSI = new Q3PopupMenu(parent);
+ synpDSSI->insertItem(QT_TR_NOOP(s->description()) + " <" + QT_TR_NOOP(s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx);
+ }
+ }
+ #endif
+
+ #ifdef VST_SUPPORT
+ for(imap i = mapVST.begin(); i != mapVST.end(); ++i)
+ {
+ int idx = i->second;
+ if(idx > sz)
+ continue;
+ Synth* s = synthis[idx];
+ if(s)
+ {
+ // No VST sub-menu yet? Create it now.
+ if(!synpVST)
+ synpVST = new Q3PopupMenu(parent);
+ synpVST->insertItem(QT_TR_NOOP(s->description()) + " <" + QT_TR_NOOP(s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx);
+ }
+ }
+ #endif
+
+ for(imap i = mapOther.begin(); i != mapOther.end(); ++i)
+ {
+ int idx = i->second;
+ if(idx > sz)
+ continue;
+ Synth* s = synthis[idx];
+ // No Other sub-menu yet? Create it now.
+ if(!synpOther)
+ synpOther = new Q3PopupMenu(parent);
+ synpOther->insertItem(QT_TR_NOOP(s->description()) + " <" + QT_TR_NOOP(s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx);
+ }
+
+ if(synpMESS)
+ {
+ synp->insertItem(*synthIcon, QT_TR_NOOP("MESS"), synpMESS, Track::AUDIO_SOFTSYNTH);
+ if(obj && slot)
+ QObject::connect(synpMESS, SIGNAL(activated(int)), obj, slot);
+ }
+
+ #ifdef DSSI_SUPPORT
+ if(synpDSSI)
+ {
+ synp->insertItem(*synthIcon, QT_TR_NOOP("DSSI"), synpDSSI, Track::AUDIO_SOFTSYNTH);
+ if(obj && slot)
+ QObject::connect(synpDSSI, SIGNAL(activated(int)), obj, slot);
+ }
+ #endif
+
+ #ifdef VST_SUPPORT
+ if(synpVST)
+ {
+ synp->insertItem(*synthIcon, QT_TR_NOOP("FST"), synpVST, Track::AUDIO_SOFTSYNTH);
+ if(obj && slot)
+ QObject::connect(synpVST, SIGNAL(activated(int)), obj, slot);
+ }
+ #endif
+
+ if(synpOther)
+ {
+ synp->insertItem(*synthIcon, QObject::tr("Other"), synpOther, Track::AUDIO_SOFTSYNTH);
+ if(obj && slot)
+ QObject::connect(synpOther, SIGNAL(activated(int)), obj, slot);
+ }
+
+ return synp;
+}
+
+//---------------------------------------------------------
+// populateAddTrack
+// this is also used in "mixer"
+//---------------------------------------------------------
+
+void populateAddTrack(Q3PopupMenu* addTrack)
+ {
+ addTrack->insertItem(QIcon(*addtrack_addmiditrackIcon),
+ QT_TR_NOOP("Add Midi Track"), Track::MIDI);
+ addTrack->insertItem(QIcon(*addtrack_drumtrackIcon),
+ QT_TR_NOOP("Add Drum Track"), Track::DRUM);
+ addTrack->insertItem(QIcon(*addtrack_wavetrackIcon),
+ QT_TR_NOOP("Add Wave Track"), Track::WAVE);
+ addTrack->insertItem(QIcon(*addtrack_audiooutputIcon),
+ QT_TR_NOOP("Add Audio Output"), Track::AUDIO_OUTPUT);
+ addTrack->insertItem(QIcon(*addtrack_audiogroupIcon),
+ QT_TR_NOOP("Add Audio Group"), Track::AUDIO_GROUP);
+ addTrack->insertItem(QIcon(*addtrack_audioinputIcon),
+ QT_TR_NOOP("Add Audio Input"), Track::AUDIO_INPUT);
+ addTrack->insertItem(QIcon(*addtrack_auxsendIcon),
+ QT_TR_NOOP("Add Aux Send"), Track::AUDIO_AUX);
+
+ // Create a sub-menu and fill it with found synth types. Make addTrack the owner.
+ Q3PopupMenu* synp = populateAddSynth(addTrack, song, SLOT(addNewTrack(int)));
+ // Add the sub-menu to the given menu.
+ addTrack->insertItem(*synthIcon, QT_TR_NOOP("Add Synth"), synp, Track::AUDIO_SOFTSYNTH);
+
+ //addTrack->connect(addTrack, SIGNAL(activated(int)), song, SLOT(addTrack(int)));
+ addTrack->connect(addTrack, SIGNAL(activated(int)), song, SLOT(addNewTrack(int)));
+ //synp->connect(synp, SIGNAL(activated(int)), song, SLOT(addNewTrack(int)));
+ }
+
+//---------------------------------------------------------
+// MusE
+//---------------------------------------------------------
+
+MusE::MusE(int argc, char** argv) : Q3MainWindow(0, "mainwindow")
+ {
+ // By T356. For LADSPA plugins in plugin.cpp
+ // QWidgetFactory::addWidgetFactory( new PluginWidgetFactory ); ddskrjo
+
+ setFocusPolicy(Qt::WheelFocus);
+ muse = this; // hack
+ clipListEdit = 0;
+ midiSyncConfig = 0;
+ midiRemoteConfig = 0;
+ midiPortConfig = 0;
+ metronomeConfig = 0;
+ audioConfig = 0;
+ midiFileConfig = 0;
+ midiFilterConfig = 0;
+ midiInputTransform = 0;
+ midiRhythmGenerator = 0;
+ globalSettingsConfig = 0;
+ markerView = 0;
+ softSynthesizerConfig = 0;
+ midiTransformerDialog = 0;
+ shortcutConfig = 0;
+ appearance = 0;
+ //audioMixer = 0;
+ mixer1 = 0;
+ mixer2 = 0;
+ watchdogThread = 0;
+ editInstrument = 0;
+ routingPopupMenu = 0;
+
+ appName = QString("MusE");
+
+ song = new Song("song");
+ song->blockSignals(true);
+ heartBeatTimer = new QTimer(this, "timer");
+ connect(heartBeatTimer, SIGNAL(timeout()), song, SLOT(beat()));
+
+#ifdef ENABLE_PYTHON
+ //---------------------------------------------------
+ // Python bridge
+ //---------------------------------------------------
+ // Uncomment in order to enable MusE Python bridge:
+ if (usePythonBridge) {
+ printf("Initializing python bridge!\n");
+ if (initPythonBridge() == false) {
+ printf("Could not initialize Python bridge\n");
+ exit(1);
+ }
+ }
+#endif
+
+ //---------------------------------------------------
+ // undo/redo
+ //---------------------------------------------------
+ undoRedo = new Q3ActionGroup(this, tr("UndoRedo"), false);
+ undoAction = new Q3Action(tr("undo"), QIcon(*undoIconS), tr("Und&o"), // ddskrjo
+ Qt::CTRL+Qt::Key_Z, undoRedo, "undo");
+ redoAction = new Q3Action(tr("redo"), QIcon(*redoIconS), tr("Re&do"), // ddskrjo
+ Qt::CTRL+Qt::Key_Y, undoRedo, "redo");
+ undoAction->setWhatsThis(tr("undo last change to song"));
+ redoAction->setWhatsThis(tr("redo last undo"));
+ undoAction->setEnabled(false);
+ redoAction->setEnabled(false);
+ connect(redoAction, SIGNAL(activated()), song, SLOT(redo()));
+ connect(undoAction, SIGNAL(activated()), song, SLOT(undo()));
+
+ //---------------------------------------------------
+ // Transport
+ //---------------------------------------------------
+
+ transportAction = new Q3ActionGroup(this, tr("Transport"), false);
+
+ loopAction = new Q3Action(tr("loop"), QIcon(*loop1Icon),
+ tr("Loop"), 0, transportAction, "loop", true);
+ loopAction->setWhatsThis(tr(infoLoopButton));
+ connect(loopAction, SIGNAL(toggled(bool)), song, SLOT(setLoop(bool)));
+
+ punchinAction = new Q3Action(tr("punchin"), QIcon(*punchin1Icon),
+ tr("Punchin"), 0, transportAction, "Punchin", true);
+ punchinAction->setWhatsThis(tr(infoPunchinButton));
+ connect(punchinAction, SIGNAL(toggled(bool)), song, SLOT(setPunchin(bool)));
+
+ punchoutAction = new Q3Action(tr("punchout"), QIcon(*punchout1Icon),
+ tr("Punchout"), 0, transportAction, "punchout", true);
+ punchoutAction->setWhatsThis(tr(infoPunchoutButton));
+ connect(punchoutAction, SIGNAL(toggled(bool)), song, SLOT(setPunchout(bool)));
+
+ transportAction->addSeparator();
+
+ startAction = new Q3Action(tr("start"), QIcon(*startIcon),
+ tr("Start"), 0, transportAction, "start");
+ startAction->setWhatsThis(tr(infoStartButton));
+ connect(startAction, SIGNAL(activated()), song, SLOT(rewindStart()));
+
+ rewindAction = new Q3Action(tr("rewind"), QIcon(*frewindIcon),
+ tr("Rewind"), 0, transportAction, "rewind");
+ rewindAction->setWhatsThis(tr(infoRewindButton));
+ connect(rewindAction, SIGNAL(activated()), song, SLOT(rewind()));
+
+ forwardAction = new Q3Action(tr("forward"), QIcon(*fforwardIcon),
+ tr("Forward"), 0, transportAction, "forward");
+ forwardAction->setWhatsThis(tr(infoForwardButton));
+ connect(forwardAction, SIGNAL(activated()), song, SLOT(forward()));
+
+ stopAction = new Q3Action(tr("stop"), QIcon(*stopIcon),
+ tr("Stop"), 0, transportAction, "stop", true);
+ stopAction->setWhatsThis(tr(infoStopButton));
+ stopAction->setOn(true);
+ connect(stopAction, SIGNAL(toggled(bool)), song, SLOT(setStop(bool)));
+
+ playAction = new Q3Action(tr("play"), QIcon(*playIcon),
+ tr("Play"), 0, transportAction, "play", true);
+ playAction->setWhatsThis(tr(infoPlayButton));
+ playAction->setOn(false);
+ connect(playAction, SIGNAL(toggled(bool)), song, SLOT(setPlay(bool)));
+
+ recordAction = new Q3Action(tr("record"), QIcon(*recordIcon),
+ tr("Record"), 0, transportAction, "record", true);
+ recordAction->setWhatsThis(tr(infoRecordButton));
+ connect(recordAction, SIGNAL(toggled(bool)), song, SLOT(setRecord(bool)));
+
+ panicAction = new Q3Action(tr("panic"), QIcon(*panicIcon),
+ tr("Panic"), 0, 0, "panic", false);
+ panicAction->setWhatsThis(tr(infoPanicButton));
+ connect(panicAction, SIGNAL(activated()), song, SLOT(panic()));
+
+ initMidiInstruments();
+ initMidiPorts();
+ ::initMidiDevices();
+
+ //----Actions
+
+ fileNewAction = new Q3Action(tr("new"),
+ QIcon(*filenewIcon), tr("&New"), 0, this, "new"); // ddskrjo
+ fileNewAction->setToolTip(tr(fileNewText));
+ fileNewAction->setWhatsThis(tr(fileNewText));
+
+ fileOpenAction = new Q3Action(tr("open"),
+ QIcon(*openIcon), tr("&Open"), 0, this, "open"); // ddskrjo
+ fileOpenAction->setToolTip(tr(fileOpenText));
+ fileOpenAction->setWhatsThis(tr(fileOpenText));
+
+ fileSaveAction = new Q3Action(tr("save"),
+ QIcon(*saveIcon), tr("&Save"), 0, this, "save"); // ddskrjo
+ fileSaveAction->setToolTip(tr(fileSaveText));
+ fileSaveAction->setWhatsThis(tr(fileSaveText));
+
+ pianoAction = new Q3Action(tr("pianoroll"),
+ *pianoIconSet, tr("Pianoroll"), 0, this, "pianoroll");
+ connect(pianoAction, SIGNAL(activated()), SLOT(startPianoroll()));
+
+// markerAction = new QAction(tr("marker"), QIconSet(*view_markerIcon), tr("Marker"),
+// 0, this, "marker");
+// connect(markerAction, SIGNAL(activated()), SLOT(startMarkerView()));
+
+ connect(fileNewAction, SIGNAL(activated()), SLOT(loadTemplate()));
+ connect(fileOpenAction, SIGNAL(activated()), SLOT(loadProject()));
+ connect(fileSaveAction, SIGNAL(activated()), SLOT(save()));
+
+ //--------------------------------------------------
+ // Toolbar
+ //--------------------------------------------------
+
+ tools = new Q3ToolBar(tr("File Buttons"), this);
+ fileNewAction->addTo(tools);
+ fileOpenAction->addTo(tools);
+ fileSaveAction->addTo(tools);
+
+ //
+ // Whats This
+ //
+ Q3WhatsThis::whatsThisButton(tools);
+
+ tools->addSeparator();
+ undoRedo->addTo(tools);
+
+ tools1 = new EditToolBar(this, arrangerTools);
+
+ Q3ToolBar* transportToolbar = new Q3ToolBar(this);
+ transportAction->addTo(transportToolbar);
+
+ Q3ToolBar* panicToolbar = new Q3ToolBar(this);
+ panicAction->addTo(panicToolbar);
+
+ if (realTimePriority < sched_get_priority_min(SCHED_FIFO))
+ realTimePriority = sched_get_priority_min(SCHED_FIFO);
+ else if (realTimePriority > sched_get_priority_max(SCHED_FIFO))
+ realTimePriority = sched_get_priority_max(SCHED_FIFO);
+
+ // If we requested to force the midi thread priority...
+ if(midiRTPrioOverride > 0)
+ {
+ if (midiRTPrioOverride < sched_get_priority_min(SCHED_FIFO))
+ midiRTPrioOverride = sched_get_priority_min(SCHED_FIFO);
+ else if (midiRTPrioOverride > sched_get_priority_max(SCHED_FIFO))
+ midiRTPrioOverride = sched_get_priority_max(SCHED_FIFO);
+ }
+
+ // Changed by Tim. p3.3.17
+ //midiSeq = new MidiSeq(realTimeScheduling ? realTimePriority : 0, "Midi");
+ midiSeq = new MidiSeq("Midi");
+ audio = new Audio();
+ //audioPrefetch = new AudioPrefetch(0, "Disc");
+ audioPrefetch = new AudioPrefetch("Prefetch");
+
+ //---------------------------------------------------
+ // Popups
+ //---------------------------------------------------
+
+// QPopupMenu *foo = new QPopupMenu(this);
+// testAction = new QAction(foo,"testPython");
+// testAction->addTo(foo);
+// menuBar()->insertItem(tr("&testpython"), foo);
+// connect(testAction, SIGNAL(activated()), this, SLOT(runPythonScript()));
+
+
+ //-------------------------------------------------------------
+ // popup File
+ //-------------------------------------------------------------
+
+ menu_file = new Q3PopupMenu(this);
+ menuBar()->insertItem(tr("&File"), menu_file);
+ fileNewAction->addTo(menu_file);
+ fileOpenAction->addTo(menu_file);
+ openRecent = new Q3PopupMenu(menu_file);
+ connect(openRecent, SIGNAL(aboutToShow()), this, SLOT(openRecentMenu()));
+ connect(openRecent, SIGNAL(activated(int)), this, SLOT(selectProject(int)));
+ menu_ids[CMD_OPEN_RECENT] = menu_file->insertItem(tr("Open &Recent"), openRecent, 0);
+ menu_file->insertSeparator();
+ fileSaveAction->addTo(menu_file);
+ menu_ids[CMD_SAVE_AS] = menu_file->insertItem(tr("Save &As"), this, SLOT(saveAs()), 0, -2);
+ menu_file->insertSeparator();
+ menu_ids[CMD_IMPORT_MIDI] = menu_file->insertItem(*openIconS, tr("Import Midifile"), this, SLOT(importMidi()), 0, -2);
+ menu_ids[CMD_EXPORT_MIDI] = menu_file->insertItem(*saveIconS, tr("Export Midifile"), this, SLOT(exportMidi()), 0, -2);
+ menu_ids[CMD_IMPORT_PART] = menu_file->insertItem(*openIconS, tr("Import Part"), this, SLOT(importPart()), 0, -2);
+ menu_file->insertSeparator();
+ menu_ids[CMD_IMPORT_AUDIO] = menu_file->insertItem(*openIconS, tr("Import Wave File"), this, SLOT(importWave()), 0, -2);
+
+
+ menu_file->insertSeparator();
+ menu_ids[CMD_QUIT] = menu_file->insertItem(*exitIconS, tr("&Quit"), this, SLOT(quitDoc()), 0, -2);
+ menu_file->insertSeparator();
+
+ //-------------------------------------------------------------
+ // popup Edit
+ //-------------------------------------------------------------
+
+ menuEdit = new Q3PopupMenu(this);
+ undoRedo->addTo(menuEdit);
+ menuEdit->insertSeparator();
+ menuBar()->insertItem(tr("&Edit"), menuEdit);
+
+ menuEdit->insertItem(*editcutIconSet, tr("C&ut"), CMD_CUT);
+ menuEdit->setAccel(Qt::CTRL+Qt::Key_X, CMD_CUT);
+ menuEdit->insertItem(*editcopyIconSet, tr("&Copy"), CMD_COPY);
+ menuEdit->setAccel(Qt::CTRL+Qt::Key_C, CMD_COPY);
+ menuEdit->insertItem(*editpasteIconSet, tr("&Paste"), CMD_PASTE);
+ menuEdit->setAccel(Qt::CTRL+Qt::Key_V, CMD_PASTE);
+ menuEdit->insertItem(*editpasteIconSet, tr("&Insert"), CMD_INSERT);
+ menuEdit->setAccel(Qt::CTRL+Qt::SHIFT+Qt::Key_I, CMD_INSERT);
+ menuEdit->insertItem(*editpasteCloneIconSet, tr("Paste c&lone"), CMD_PASTE_CLONE);
+ menuEdit->setAccel(Qt::CTRL+Qt::SHIFT+Qt::Key_V, CMD_PASTE_CLONE);
+ menuEdit->insertItem(*editpaste2TrackIconSet, tr("Paste to &track"), CMD_PASTE_TO_TRACK);
+ menuEdit->setAccel(Qt::CTRL+Qt::Key_B, CMD_PASTE_TO_TRACK);
+ menuEdit->insertItem(*editpasteClone2TrackIconSet, tr("Paste clone to trac&k"), CMD_PASTE_CLONE_TO_TRACK);
+ menuEdit->setAccel(Qt::CTRL+Qt::SHIFT+Qt::Key_B, CMD_PASTE_CLONE_TO_TRACK);
+
+ menuEdit->insertItem(*editpasteIconSet, tr("&Insert empty measure"), CMD_INSERTMEAS);
+ menuEdit->setAccel(Qt::CTRL+Qt::SHIFT+Qt::Key_X, CMD_INSERTMEAS);
+ menuEdit->insertSeparator();
+ menuEdit->insertItem(QIcon(*edit_track_delIcon),
+ tr("Delete Selected Tracks"), CMD_DELETE_TRACK);
+
+ addTrack = new Q3PopupMenu(this);
+ // Moved below. Have to wait until synths are available...
+ //populateAddTrack(addTrack);
+
+ menuEdit->insertItem(QIcon(*edit_track_addIcon),
+ tr("Add Track"), addTrack);
+
+ select = new Q3PopupMenu(this);
+ select->insertItem(QIcon(*select_allIcon),
+ tr("Select &All"), CMD_SELECT_ALL);
+ select->insertItem(QIcon(*select_deselect_allIcon),
+ tr("&Deselect All"), CMD_SELECT_NONE);
+ menuEdit->insertSeparator();
+ select->insertItem(QIcon(*select_invert_selectionIcon),
+ tr("Invert &Selection"), CMD_SELECT_INVERT);
+ select->insertItem(QIcon(*select_inside_loopIcon),
+ tr("&Inside Loop"), CMD_SELECT_ILOOP);
+ select->insertItem(QIcon(*select_outside_loopIcon),
+ tr("&Outside Loop"), CMD_SELECT_OLOOP);
+ select->insertItem(QIcon(*select_all_parts_on_trackIcon),
+ tr("All &Parts on Track"), CMD_SELECT_PARTS);
+ menuEdit->insertItem(QIcon(*selectIcon),
+ tr("Select"), select);
+ menuEdit->insertSeparator();
+
+ pianoAction->addTo(menuEdit);
+ menu_ids[CMD_OPEN_DRUMS] = menuEdit->insertItem(
+ QIcon(*edit_drummsIcon), tr("Drums"), this, SLOT(startDrumEditor()), 0);
+ menu_ids[CMD_OPEN_LIST] = menuEdit->insertItem(
+ QIcon(*edit_listIcon), tr("List"), this, SLOT(startListEditor()), 0);
+ menu_ids[CMD_OPEN_WAVE] = menuEdit->insertItem(
+ QIcon(*edit_waveIcon), tr("Wave"), this, SLOT(startWaveEditor()), 0);
+
+ master = new Q3PopupMenu(this);
+ master->setCheckable(false);
+ menu_ids[CMD_OPEN_GRAPHIC_MASTER] = master->insertItem(
+ QIcon(*mastertrack_graphicIcon),tr("Graphic"), this, SLOT(startMasterEditor()), 0);
+ menu_ids[CMD_OPEN_LIST_MASTER] = master->insertItem(
+ QIcon(*mastertrack_listIcon),tr("List"), this, SLOT(startLMasterEditor()), 0);
+ menuEdit->insertItem(QIcon(*edit_mastertrackIcon),
+ tr("Mastertrack"), master, Qt::Key_F);
+
+ menuEdit->insertSeparator();
+ connect(menuEdit, SIGNAL(activated(int)), SLOT(cmd(int)));
+ connect(select, SIGNAL(activated(int)), SLOT(cmd(int)));
+
+ midiEdit = new Q3PopupMenu(this);
+ midiEdit->setCheckable(false);
+#if 0 // TODO
+ menu_ids[CMD_OPEN_MIDI_TRANSFORM] = midiEdit->insertItem(
+ QIcon(*midi_transformIcon), tr("Midi &Transform"), this, SLOT(startMidiTransformer()), 0);
+ midiEdit->insertItem(tr("Modify Gate Time"), this, SLOT(modifyGateTime()));
+ midiEdit->insertItem(tr("Modify Velocity"), this, SLOT(modifyVelocity()));
+ midiEdit->insertItem(tr("Crescendo"), this, SLOT(crescendo()));
+ midiEdit->insertItem(tr("Transpose"), this, SLOT(transpose()));
+ midiEdit->insertItem(tr("Thin Out"), this, SLOT(thinOut()));
+ midiEdit->insertItem(tr("Erase Event"), this, SLOT(eraseEvent()));
+ midiEdit->insertItem(tr("Note Shift"), this, SLOT(noteShift()));
+ midiEdit->insertItem(tr("Move Clock"), this, SLOT(moveClock()));
+ midiEdit->insertItem(tr("Copy Measure"), this, SLOT(copyMeasure()));
+ midiEdit->insertItem(tr("Erase Measure"), this, SLOT(eraseMeasure()));
+ midiEdit->insertItem(tr("Delete Measure"), this, SLOT(deleteMeasure()));
+ midiEdit->insertItem(tr("Create Measure"), this, SLOT(createMeasure()));
+ midiEdit->insertItem(tr("Mix Track"), this, SLOT(mixTrack()));
+#endif
+ menu_ids[CMD_TRANSPOSE] = midiEdit->insertItem(
+ QIcon(*midi_transposeIcon), tr("Transpose"), this, SLOT(transpose()), 0);
+ menuEdit->insertItem(
+ QIcon(*edit_midiIcon), tr("Midi"), midiEdit);
+
+ menuEdit->insertSeparator();
+ menuEdit->insertItem(
+ QIcon(*edit_listIcon), tr("Song info"), this, SLOT(startSongInfo()), 0);
+ //-------------------------------------------------------------
+ // popup View
+ //-------------------------------------------------------------
+
+ menuView = new Q3PopupMenu(this);
+ menuView->setCheckable(true);
+ menuBar()->insertItem(tr("View"), menuView);
+
+ tr_id = menuView->insertItem(
+ QIcon(*view_transport_windowIcon), tr("Transport Panel"), this, SLOT(toggleTransport()), 0);
+ bt_id = menuView->insertItem(
+ QIcon(*view_bigtime_windowIcon), tr("Bigtime window"), this, SLOT(toggleBigTime()), 0);
+ //aid1 = menuView->insertItem(
+ // QIconSet(*mixerSIcon), tr("Mixer"), this, SLOT(toggleMixer()), 0);
+ aid1a = menuView->insertItem(
+ QIcon(*mixerSIcon), tr("Mixer A"), this, SLOT(toggleMixer1()), 0);
+ aid1b = menuView->insertItem(
+ QIcon(*mixerSIcon), tr("Mixer B"), this, SLOT(toggleMixer2()), 0);
+ // p3.2.24
+ aid2 = menuView->insertItem(
+ QIcon(*cliplistSIcon), tr("Cliplist"), this, SLOT(startClipList()), 0);
+ mr_id = menuView->insertItem(
+ QIcon(*view_markerIcon), tr("Marker View"), this, SLOT(toggleMarker()), 0);
+ //markerAction->addTo(menuView);
+
+
+ //-------------------------------------------------------------
+ // popup Structure
+ //-------------------------------------------------------------
+
+ menuStructure = new Q3PopupMenu(this);
+ menuStructure->setCheckable(false);
+ menuBar()->insertItem(tr("&Structure"), menuStructure);
+ menu_ids[CMD_GLOBAL_CUT] = menuStructure->insertItem(tr("Global Cut"), this, SLOT(globalCut()), 0);
+ menu_ids[CMD_GLOBAL_INSERT] = menuStructure->insertItem(tr("Global Insert"), this, SLOT(globalInsert()), 0);
+ menu_ids[CMD_GLOBAL_SPLIT] = menuStructure->insertItem(tr("Global Split"), this, SLOT(globalSplit()), 0);
+ menu_ids[CMD_COPY_RANGE] = menuStructure->insertItem(tr("Copy Range"), this, SLOT(copyRange()), 0);
+ menuStructure->setItemEnabled(menu_ids[CMD_COPY_RANGE], false);
+ menuStructure->insertSeparator();
+ menu_ids[CMD_CUT_EVENTS] = menuStructure->insertItem(tr("Cut Events"), this, SLOT(cutEvents()), 0);
+ menuStructure->setItemEnabled(menu_ids[CMD_CUT_EVENTS], false);
+
+ //-------------------------------------------------------------
+ // popup Midi
+ //-------------------------------------------------------------
+
+ midiInputPlugins = new Q3PopupMenu(this);
+ midiInputPlugins->setCheckable(false);
+ mpid0 = midiInputPlugins->insertItem(
+ QIcon(*midi_inputplugins_transposeIcon), tr("Transpose"), 0);
+ mpid1 = midiInputPlugins->insertItem(
+ QIcon(*midi_inputplugins_midi_input_transformIcon), tr("Midi Input Transform"), 1);
+ mpid2 = midiInputPlugins->insertItem(
+ QIcon(*midi_inputplugins_midi_input_filterIcon), tr("Midi Input Filter"), 2);
+ mpid3 = midiInputPlugins->insertItem(
+ QIcon(*midi_inputplugins_remote_controlIcon), tr("Midi Remote Control"), 3);
+/*
+** mpid4 = midiInputPlugins->insertItem(
+** QIconSet(*midi_inputplugins_random_rhythm_generatorIcon), tr("Random Rhythm Generator"), 4);
+*/
+ connect(midiInputPlugins, SIGNAL(activated(int)), SLOT(startMidiInputPlugin(int)));
+
+// midiInputPlugins->setItemEnabled(mpid4, false);
+
+ menu_functions = new Q3PopupMenu(this);
+ menu_functions->setCheckable(true);
+ menuBar()->insertItem(tr("&Midi"), menu_functions);
+ menu_functions->setCaption(tr("Midi"));
+
+ menuScriptPlugins = new Q3PopupMenu(this);
+ song->populateScriptMenu(menuScriptPlugins, this);
+ menu_functions->insertItem(tr("&Plugins"), menuScriptPlugins);
+
+ menu_ids[CMD_MIDI_EDIT_INSTRUMENTS] = menu_functions->insertItem(
+ QIcon(*midi_edit_instrumentIcon), tr("Edit Instrument"), this, SLOT(startEditInstrument()), 0);
+ menu_functions->insertItem(
+ QIcon(*midi_inputpluginsIcon), tr("Input Plugins"), midiInputPlugins, Qt::Key_P);
+ menu_functions->insertSeparator();
+ menu_ids[CMD_MIDI_RESET] = menu_functions->insertItem(
+ QIcon(*midi_reset_instrIcon), tr("Reset Instr."), this, SLOT(resetMidiDevices()), 0);
+ menu_ids[CMD_MIDI_INIT] = menu_functions->insertItem(
+ QIcon(*midi_init_instrIcon), tr("Init Instr."), this, SLOT(initMidiDevices()), 0);
+ menu_ids[CMD_MIDI_LOCAL_OFF] = menu_functions->insertItem(
+ QIcon(*midi_local_offIcon), tr("local off"), this, SLOT(localOff()), 0);
+
+ //-------------------------------------------------------------
+ // popup Audio
+ //-------------------------------------------------------------
+
+ menu_audio = new Q3PopupMenu(this);
+ menu_audio->setCheckable(true);
+ menuBar()->insertItem(tr("&Audio"), menu_audio);
+ menu_ids[CMD_AUDIO_BOUNCE_TO_TRACK] = menu_audio->insertItem(
+ QIcon(*audio_bounce_to_trackIcon), tr("Bounce to Track"), this, SLOT(bounceToTrack()), 0);
+ menu_ids[CMD_AUDIO_BOUNCE_TO_FILE] = menu_audio->insertItem(
+ QIcon(*audio_bounce_to_fileIcon), tr("Bounce to File"), this, SLOT(bounceToFile()), 0);
+ menu_audio->insertSeparator();
+ menu_ids[CMD_AUDIO_RESTART] = menu_audio->insertItem(
+ QIcon(*audio_restartaudioIcon), tr("Restart Audio"), this, SLOT(seqRestart()), 0);
+
+ //-------------------------------------------------------------
+ // popup Automation
+ //-------------------------------------------------------------
+
+ menuAutomation = new Q3PopupMenu(this);
+ menuAutomation->setCheckable(true);
+ menuBar()->insertItem(tr("Automation"), menuAutomation);
+ autoId = menuAutomation->insertItem(
+ QIcon(*automation_mixerIcon), tr("Mixer Automation"), this, SLOT(switchMixerAutomation()), 0);
+ menuAutomation->insertSeparator();
+ menu_ids[CMD_MIXER_SNAPSHOT] = menuAutomation->insertItem(
+ QIcon(*automation_take_snapshotIcon), tr("Take Snapshot"), this, SLOT(takeAutomationSnapshot()), 0);
+ menu_ids[CMD_MIXER_AUTOMATION_CLEAR] = menuAutomation->insertItem(
+ QIcon(*automation_clear_dataIcon), tr("Clear Automation Data"), this, SLOT(clearAutomation()), 0);
+ menuAutomation->setItemEnabled(menu_ids[CMD_MIXER_AUTOMATION_CLEAR], false);
+
+ //-------------------------------------------------------------
+ // popup Settings
+ //-------------------------------------------------------------
+
+ follow = new Q3PopupMenu(this);
+ follow->setCheckable(false);
+ fid0 = follow->insertItem(tr("dont follow Song"), CMD_FOLLOW_NO);
+ fid1 = follow->insertItem(tr("follow page"), CMD_FOLLOW_JUMP);
+ fid2 = follow->insertItem(tr("follow continuous"), CMD_FOLLOW_CONTINUOUS);
+ follow->setItemChecked(fid1, true);
+ connect(follow, SIGNAL(activated(int)), SLOT(cmd(int)));
+
+ menuSettings = new Q3PopupMenu(this);
+ menuSettings->setCheckable(false);
+ menuBar()->insertItem(tr("Settings"), menuSettings);
+ menu_ids[CMD_GLOBAL_CONFIG] = menuSettings->insertItem(
+ QIcon(*settings_globalsettingsIcon), tr("Global Settings"), this, SLOT(configGlobalSettings()),0);
+ menu_ids[CMD_CONFIG_SHORTCUTS] = menuSettings->insertItem(
+ QIcon(*settings_configureshortcutsIcon), tr("Configure shortcuts"), this, SLOT(configShortCuts()), 0);
+ menuSettings->insertItem(
+ QIcon(*settings_follow_songIcon), tr("follow song"), follow, Qt::Key_F);
+ menu_ids[CMD_CONFIG_METRONOME] = menuSettings->insertItem(
+ QIcon(*settings_metronomeIcon), tr("Metronome"), this, SLOT(configMetronome()), 0);
+ menuSettings->insertSeparator();
+ menu_ids[CMD_CONFIG_MIDISYNC] = menuSettings->insertItem(
+ QIcon(*settings_midisyncIcon), tr("Midi Sync"), this, SLOT(configMidiSync()), 0);
+ menu_ids[CMD_MIDI_FILE_CONFIG] = menuSettings->insertItem(
+ QIcon(*settings_midifileexportIcon), tr("Midi File Import/Export"), this, SLOT(configMidiFile()), 0);
+ menuSettings->insertSeparator();
+ menu_ids[CMD_APPEARANCE_SETTINGS] = menuSettings->insertItem(
+ QIcon(*settings_appearance_settingsIcon), tr("Appearance settings"), this, SLOT(configAppearance()), 0);
+ menuSettings->insertSeparator();
+ menu_ids[CMD_CONFIG_MIDI_PORTS] = menuSettings->insertItem(
+ QIcon(*settings_midiport_softsynthsIcon), tr("Midi Ports / Soft Synth"), this, SLOT(configMidiPorts()), 0);
+
+ //---------------------------------------------------
+ // popup Help
+ //---------------------------------------------------
+
+ menuBar()->insertSeparator();
+ menu_help = new Q3PopupMenu(this);
+ menu_help->setCheckable(false);
+ menuBar()->insertItem(tr("&Help"), menu_help);
+
+ menu_ids[CMD_OPEN_HELP] = menu_help->insertItem(tr("&Manual"), this, SLOT(startHelpBrowser()), 0);
+ menu_ids[CMD_OPEN_HOMEPAGE] = menu_help->insertItem(tr("&MusE homepage"), this, SLOT(startHomepageBrowser()), 0);
+ menu_help->insertSeparator();
+ menu_ids[CMD_OPEN_BUG] = menu_help->insertItem(tr("&Report Bug..."), this, SLOT(startBugBrowser()), 0);
+ menu_help->insertSeparator();
+ menu_help->insertItem(tr("&About MusE"), this, SLOT(about()));
+ //menu_help->insertItem(tr("About&Qt"), this, SLOT(aboutQt()));
+ //menu_help->insertSeparator();
+ //menu_ids[CMD_START_WHATSTHIS] = menu_help->insertItem(tr("What's &This?"), this, SLOT(whatsThis()), 0);
+
+ //---------------------------------------------------
+ // Central Widget
+ //---------------------------------------------------
+
+ arranger = new Arranger(this, "arranger");
+ setCentralWidget(arranger);
+
+ connect(tools1, SIGNAL(toolChanged(int)), arranger, SLOT(setTool(int)));
+ connect(arranger, SIGNAL(editPart(Track*)), SLOT(startEditor(Track*)));
+ connect(arranger, SIGNAL(dropSongFile(const QString&)), SLOT(loadProjectFile(const QString&)));
+ connect(arranger, SIGNAL(dropMidiFile(const QString&)), SLOT(importMidi(const QString&)));
+ connect(arranger, SIGNAL(startEditor(PartList*,int)), SLOT(startEditor(PartList*,int)));
+ connect(arranger, SIGNAL(toolChanged(int)), tools1, SLOT(set(int)));
+ connect(this, SIGNAL(configChanged()), arranger, SLOT(configChanged()));
+
+ connect(arranger, SIGNAL(setUsedTool(int)), SLOT(setUsedTool(int)));
+
+ //---------------------------------------------------
+ // read list of "Recent Projects"
+ //---------------------------------------------------
+
+ QString prjPath(getenv("HOME"));
+ prjPath += QString("/.musePrj");
+ FILE* f = fopen(prjPath.latin1(), "r");
+ if (f == 0) {
+ perror("open projectfile");
+ for (int i = 0; i < PROJECT_LIST_LEN; ++i)
+ projectList[i] = 0;
+ }
+ else {
+ for (int i = 0; i < PROJECT_LIST_LEN; ++i) {
+ char buffer[256];
+ if (fgets(buffer, 256, f)) {
+ int n = strlen(buffer);
+ if (n && buffer[n-1] == '\n')
+ buffer[n-1] = 0;
+ projectList[i] = *buffer ? new QString(buffer) : 0;
+ }
+ else
+ break;
+ }
+ fclose(f);
+ }
+
+ initMidiSynth();
+
+ populateAddTrack(addTrack);
+
+ transport = new Transport(this, "transport");
+ bigtime = 0;
+
+ QClipboard* cb = QApplication::clipboard();
+ connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged()));
+ connect(cb, SIGNAL(selectionChanged()), SLOT(clipboardChanged()));
+ connect(arranger, SIGNAL(selectionChanged()), SLOT(selectionChanged()));
+
+ //---------------------------------------------------
+ // load project
+ // if no songname entered on command line:
+ // startMode: 0 - load last song
+ // 1 - load default template
+ // 2 - load configured start song
+ //---------------------------------------------------
+
+ QString name;
+ bool useTemplate = false;
+ if (argc >= 2)
+ name = argv[0];
+ else if (config.startMode == 0) {
+ if (argc < 2)
+ name = projectList[0] ? *projectList[0] : QString("untitled");
+ else
+ name = argv[0];
+ printf("starting with selected song %s\n", config.startSong.latin1());
+ }
+ else if (config.startMode == 1) {
+ printf("starting with default template\n");
+ name = museGlobalShare + QString("/templates/default.med");
+ useTemplate = true;
+ }
+ else if (config.startMode == 2) {
+ printf("starting with pre configured song %s\n", config.startSong.latin1());
+ name = config.startSong;
+ }
+ song->blockSignals(false);
+ loadProjectFile(name, useTemplate, true);
+ changeConfig(false);
+
+ song->update();
+ }
+
+//---------------------------------------------------------
+// setHeartBeat
+//---------------------------------------------------------
+
+void MusE::setHeartBeat()
+ {
+ heartBeatTimer->start(1000/config.guiRefresh);
+ }
+
+//---------------------------------------------------------
+// resetDevices
+//---------------------------------------------------------
+
+void MusE::resetMidiDevices()
+ {
+ audio->msgResetMidiDevices();
+ }
+
+//---------------------------------------------------------
+// initMidiDevices
+//---------------------------------------------------------
+
+void MusE::initMidiDevices()
+ {
+ // Added by T356
+ //audio->msgIdle(true);
+
+ audio->msgInitMidiDevices();
+
+ // Added by T356
+ //audio->msgIdle(false);
+ }
+
+//---------------------------------------------------------
+// localOff
+//---------------------------------------------------------
+
+void MusE::localOff()
+ {
+ audio->msgLocalOff();
+ }
+
+//---------------------------------------------------------
+// loadProjectFile
+// load *.med, *.mid, *.kar
+//
+// template - if true, load file but do not change
+// project name
+//---------------------------------------------------------
+
+// for drop:
+void MusE::loadProjectFile(const QString& name)
+ {
+ loadProjectFile(name, false, false);
+ }
+
+void MusE::loadProjectFile(const QString& name, bool songTemplate, bool loadAll)
+ {
+ //
+ // stop audio threads if running
+ //
+ bool restartSequencer = audio->isRunning();
+ if (restartSequencer) {
+ if (audio->isPlaying()) {
+ audio->msgPlay(false);
+ while (audio->isPlaying())
+ qApp->processEvents();
+ }
+ seqStop();
+ }
+ microSleep(200000);
+ loadProjectFile1(name, songTemplate, loadAll);
+ microSleep(200000);
+ if (restartSequencer)
+ seqStart();
+
+ if (song->getSongInfo().length()>0)
+ startSongInfo(false);
+ }
+
+//---------------------------------------------------------
+// loadProjectFile
+// load *.med, *.mid, *.kar
+//
+// template - if true, load file but do not change
+// project name
+// loadAll - load song data + configuration data
+//---------------------------------------------------------
+
+void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll)
+ {
+ //if (audioMixer)
+ // audioMixer->clear();
+ if (mixer1)
+ mixer1->clear();
+ if (mixer2)
+ mixer2->clear();
+ arranger->clear(); // clear track info
+ if (clearSong())
+ return;
+
+ QFileInfo fi(name);
+ if (songTemplate) {
+ if (!fi.isReadable()) {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("Cannot read template"));
+ return;
+ }
+ project.setFile("untitled");
+ }
+ else {
+ printf("Setting project path to %s\n", fi.dirPath(true).latin1());
+ museProject = fi.dirPath(true);
+ project.setFile(name);
+ }
+ // Changed by T356. 01/19/2010. We want the complete extension here.
+ //QString ex = fi.extension(false).lower();
+ //if (ex.length() == 3)
+ // ex += ".";
+ //ex = ex.left(4);
+ QString ex = fi.extension(true).lower();
+ QString mex = ex.section('.', -1, -1);
+ if((mex == "gz") || (mex == "bz2"))
+ mex = ex.section('.', -2, -2);
+
+ //if (ex.isEmpty() || ex == "med.") {
+ if (ex.isEmpty() || mex == "med") {
+ //
+ // read *.med file
+ //
+ bool popenFlag;
+ FILE* f = fileOpen(this, fi.filePath(), QString(".med"), "r", popenFlag, true);
+ if (f == 0) {
+ if (errno != ENOENT) {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("File open error"));
+ setUntitledProject();
+ }
+ else
+ setConfigDefaults();
+ }
+ else {
+ Xml xml(f);
+ read(xml, !loadAll);
+ bool fileError = ferror(f);
+ popenFlag ? pclose(f) : fclose(f);
+ if (fileError) {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("File read error"));
+ setUntitledProject();
+ }
+ }
+ }
+ //else if (ex == "mid." || ex == "kar.") {
+ else if (mex == "mid" || mex == "kar") {
+ setConfigDefaults();
+ if (!importMidi(name, false))
+ setUntitledProject();
+ }
+ else {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("Unknown File Format: ") + ex);
+ setUntitledProject();
+ }
+ if (!songTemplate) {
+ addProject(project.absFilePath());
+ setCaption(QString("MusE: Song: ") + project.baseName(true));
+ }
+ song->dirty = false;
+
+ menuView->setItemChecked(tr_id, config.transportVisible);
+ menuView->setItemChecked(bt_id, config.bigTimeVisible);
+ menuView->setItemChecked(mr_id, config.markerVisible);
+ menuAutomation->setItemChecked(autoId, automation);
+
+ if (loadAll) {
+ showBigtime(config.bigTimeVisible);
+ //showMixer(config.mixerVisible);
+ showMixer1(config.mixer1Visible);
+ showMixer2(config.mixer2Visible);
+
+ // Added p3.3.43 Make sure the geometry is correct because showMixerX() will NOT
+ // set the geometry if the mixer has already been created.
+ if(mixer1)
+ {
+ //if(mixer1->geometry().size() != config.mixer1.geometry.size()) // p3.3.53 Moved below
+ // mixer1->resize(config.mixer1.geometry.size());
+
+ if(mixer1->geometry().topLeft() != config.mixer1.geometry.topLeft())
+ mixer1->move(config.mixer1.geometry.topLeft());
+ }
+ if(mixer2)
+ {
+ //if(mixer2->geometry().size() != config.mixer2.geometry.size()) // p3.3.53 Moved below
+ // mixer2->resize(config.mixer2.geometry.size());
+
+ if(mixer2->geometry().topLeft() != config.mixer2.geometry.topLeft())
+ mixer2->move(config.mixer2.geometry.topLeft());
+ }
+
+ showMarker(config.markerVisible);
+ resize(config.geometryMain.size());
+ move(config.geometryMain.topLeft());
+
+ if (config.transportVisible)
+ transport->show();
+ transport->move(config.geometryTransport.topLeft());
+ showTransport(config.transportVisible);
+ }
+
+ transport->setMasterFlag(song->masterFlag());
+ punchinAction->setOn(song->punchin());
+ punchoutAction->setOn(song->punchout());
+ loopAction->setOn(song->loop());
+ song->update();
+ song->updatePos();
+ clipboardChanged(); // enable/disable "Paste"
+ selectionChanged(); // enable/disable "Copy" & "Paste"
+
+ // p3.3.53 Try this AFTER the song update above which does a mixer update... Tested OK - mixers resize properly now.
+ if (loadAll)
+ {
+ if(mixer1)
+ {
+ if(mixer1->geometry().size() != config.mixer1.geometry.size())
+ {
+ //printf("MusE::loadProjectFile1 resizing mixer1 x:%d y:%d w:%d h:%d\n", config.mixer1.geometry.x(),
+ // config.mixer1.geometry.y(),
+ // config.mixer1.geometry.width(),
+ // config.mixer1.geometry.height()
+ // );
+ mixer1->resize(config.mixer1.geometry.size());
+ }
+ }
+ if(mixer2)
+ {
+ if(mixer2->geometry().size() != config.mixer2.geometry.size())
+ {
+ //printf("MusE::loadProjectFile1 resizing mixer2 x:%d y:%d w:%d h:%d\n", config.mixer2.geometry.x(),
+ // config.mixer2.geometry.y(),
+ // config.mixer2.geometry.width(),
+ // config.mixer2.geometry.height()
+ // );
+ mixer2->resize(config.mixer2.geometry.size());
+ }
+ }
+ }
+
+ }
+
+//---------------------------------------------------------
+// setUntitledProject
+//---------------------------------------------------------
+
+void MusE::setUntitledProject()
+ {
+ setConfigDefaults();
+ QString name("untitled");
+ museProject = QFileInfo(name).dirPath(true);
+ project.setFile(name);
+ setCaption(tr("MusE: Song: ") + project.baseName(true));
+ }
+
+//---------------------------------------------------------
+// setConfigDefaults
+//---------------------------------------------------------
+
+void MusE::setConfigDefaults()
+ {
+ readConfiguration(); // used for reading midi files
+#if 0
+ if (readConfiguration()) {
+ //
+ // failed to load config file
+ // set buildin defaults
+ //
+ configTransportVisible = false;
+ configBigTimeVisible = false;
+
+ for (int channel = 0; channel < 2; ++channel)
+ song->addTrack(Track::AUDIO_GROUP);
+ AudioTrack* out = (AudioTrack*)song->addTrack(Track::AUDIO_OUTPUT);
+ AudioTrack* in = (AudioTrack*)song->addTrack(Track::AUDIO_INPUT);
+
+ // set some default routes
+ std::list<QString> il = audioDevice->inputPorts();
+ int channel = 0;
+ for (std::list<QString>::iterator i = il.begin(); i != il.end(); ++i, ++channel) {
+ if (channel == 2)
+ break;
+ audio->msgAddRoute(Route(out,channel), Route(*i,channel));
+ }
+ channel = 0;
+ std::list<QString> ol = audioDevice->outputPorts();
+ for (std::list<QString>::iterator i = ol.begin(); i != ol.end(); ++i, ++channel) {
+ if (channel == 2)
+ break;
+ audio->msgAddRoute(Route(*i, channel), Route(in,channel));
+ }
+ }
+#endif
+ song->dirty = false;
+ }
+
+//---------------------------------------------------------
+// setFollow
+//---------------------------------------------------------
+
+void MusE::setFollow()
+ {
+ Song::FollowMode fm = song->follow();
+ follow->setItemChecked(fid0, fm == Song::NO);
+ follow->setItemChecked(fid1, fm == Song::JUMP);
+ follow->setItemChecked(fid2, fm == Song::CONTINUOUS);
+ }
+
+//---------------------------------------------------------
+// MusE::loadProject
+//---------------------------------------------------------
+
+void MusE::loadProject()
+ {
+ bool loadAll;
+ QString fn = getOpenFileName(QString(""), med_file_pattern, this,
+ tr("MusE: load project"), &loadAll);
+ if (!fn.isEmpty()) {
+ museProject = QFileInfo(fn).dirPath(true);
+ loadProjectFile(fn, false, loadAll);
+ }
+ }
+
+//---------------------------------------------------------
+// loadTemplate
+//---------------------------------------------------------
+
+void MusE::loadTemplate()
+ {
+ QString fn = getOpenFileName(QString("templates"), med_file_pattern, this,
+ tr("MusE: load template"), 0);
+ if (!fn.isEmpty()) {
+ // museProject = QFileInfo(fn).dirPath(true);
+ loadProjectFile(fn, true, true);
+ setUntitledProject();
+ }
+ }
+
+//---------------------------------------------------------
+// save
+//---------------------------------------------------------
+
+bool MusE::save()
+ {
+ if (project.baseName(true) == "untitled")
+ return saveAs();
+ else
+ return save(project.filePath(), false);
+ }
+
+//---------------------------------------------------------
+// save
+//---------------------------------------------------------
+
+bool MusE::save(const QString& name, bool overwriteWarn)
+ {
+ QString backupCommand;
+
+ // By T356. Cache the jack in/out route names BEFORE saving.
+ // Because jack often shuts down during save, causing the routes to be lost in the file.
+ // Not required any more...
+ //cacheJackRouteNames();
+
+ if (QFile::exists(name)) {
+ backupCommand.sprintf("cp \"%s\" \"%s.backup\"", name.latin1(), name.latin1());
+ }
+ else if (QFile::exists(name + QString(".med"))) {
+ backupCommand.sprintf("cp \"%s.med\" \"%s.med.backup\"", name.latin1(), name.latin1());
+ }
+ if (!backupCommand.isEmpty())
+ system(backupCommand.latin1());
+
+ bool popenFlag;
+ FILE* f = fileOpen(this, name, QString(".med"), "w", popenFlag, false, overwriteWarn);
+ if (f == 0)
+ return false;
+ Xml xml(f);
+ write(xml);
+ if (ferror(f)) {
+ QString s = "Write File\n" + name + "\nfailed: "
+ + strerror(errno);
+ QMessageBox::critical(this,
+ tr("MusE: Write File failed"), s);
+ popenFlag? pclose(f) : fclose(f);
+ unlink(name.latin1());
+ return false;
+ }
+ else {
+ popenFlag? pclose(f) : fclose(f);
+ song->dirty = false;
+ return true;
+ }
+ }
+
+//---------------------------------------------------------
+// quitDoc
+//---------------------------------------------------------
+
+void MusE::quitDoc()
+ {
+ close(true);
+ }
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void MusE::closeEvent(QCloseEvent*)
+ {
+ song->setStop(true);
+ //
+ // wait for sequencer
+ //
+ while (audio->isPlaying()) {
+ qApp->processEvents();
+ }
+ if (song->dirty) {
+ int n = 0;
+ n = QMessageBox::warning(this, appName,
+ tr("The current Project contains unsaved data\n"
+ "Save Current Project?"),
+ tr("&Save"), tr("&Skip"), tr("&Abort"), 0, 2);
+ if (n == 0) {
+ if (!save()) // dont quit if save failed
+ return;
+ }
+ else if (n == 2)
+ return;
+ }
+ seqStop();
+
+ WaveTrackList* wt = song->waves();
+ for (iWaveTrack iwt = wt->begin(); iwt != wt->end(); ++iwt) {
+ WaveTrack* t = *iwt;
+ if (t->recFile() && t->recFile()->samples() == 0) {
+ t->recFile()->remove();
+ }
+ }
+
+ // save "Open Recent" list
+ QString prjPath(getenv("HOME"));
+ prjPath += "/.musePrj";
+ FILE* f = fopen(prjPath.latin1(), "w");
+ if (f) {
+ for (int i = 0; i < PROJECT_LIST_LEN; ++i) {
+ fprintf(f, "%s\n", projectList[i] ? projectList[i]->latin1() : "");
+ }
+ fclose(f);
+ }
+ if(debugMsg)
+ printf("Muse: Exiting JackAudio\n");
+ exitJackAudio();
+ if(debugMsg)
+ printf("Muse: Exiting DummyAudio\n");
+ exitDummyAudio();
+ if(debugMsg)
+ printf("Muse: Exiting Metronome\n");
+ exitMetronome();
+
+ // p3.3.47
+ // Make sure to clear the menu, which deletes any sub menus.
+ if(routingPopupMenu)
+ routingPopupMenu->clear();
+
+ // Changed by Tim. p3.3.14
+ //SynthIList* sl = song->syntis();
+ //for (iSynthI i = sl->begin(); i != sl->end(); ++i)
+ // delete *i;
+ song->cleanupForQuit();
+
+ if(debugMsg)
+ printf("Muse: Cleaning up temporary wavefiles + peakfiles\n");
+ // Cleanup temporary wavefiles + peakfiles used for undo
+ for (std::list<QString>::iterator i = temporaryWavFiles.begin(); i != temporaryWavFiles.end(); i++) {
+ QString filename = *i;
+ QFileInfo f(filename);
+ QDir d = f.dir();
+ d.remove(filename);
+ d.remove(f.baseName(true) + ".wca");
+ }
+
+ // Added by Tim. p3.3.14
+
+#ifdef HAVE_LASH
+ // Disconnect gracefully from LASH.
+ if(lash_client)
+ {
+ if(debugMsg)
+ printf("Muse: Disconnecting from LASH\n");
+ lash_event_t* lashev = lash_event_new_with_type (LASH_Quit);
+ lash_send_event(lash_client, lashev);
+ }
+#endif
+
+ if(debugMsg)
+ printf("Muse: Exiting Dsp\n");
+ AL::exitDsp();
+
+ if(debugMsg)
+ printf("Muse: Exiting OSC\n");
+ exitOSC();
+
+ // p3.3.47
+ delete audioPrefetch;
+ delete audio;
+ delete midiSeq;
+ delete song;
+
+ qApp->quit();
+ }
+
+//---------------------------------------------------------
+// toggleMarker
+//---------------------------------------------------------
+
+void MusE::toggleMarker()
+ {
+ showMarker(!menuView->isItemChecked(mr_id));
+ }
+
+//---------------------------------------------------------
+// showMarker
+//---------------------------------------------------------
+
+void MusE::showMarker(bool flag)
+ {
+ //printf("showMarker %d\n",flag);
+ if (markerView == 0) {
+ markerView = new MarkerView(this);
+
+ // Removed p3.3.43
+ // Song::addMarker() already emits a 'markerChanged'.
+ //connect(arranger, SIGNAL(addMarker(int)), markerView, SLOT(addMarker(int)));
+
+ connect(markerView, SIGNAL(closed()), SLOT(markerClosed()));
+ toplevels.push_back(Toplevel(Toplevel::MARKER, (unsigned long)(markerView), markerView));
+ markerView->show();
+ }
+
+ markerView->setShown(flag);
+ menuView->setItemChecked(mr_id, flag);
+ }
+
+//---------------------------------------------------------
+// markerClosed
+//---------------------------------------------------------
+
+void MusE::markerClosed()
+ {
+ menuView->setItemChecked(mr_id, false);
+ }
+
+//---------------------------------------------------------
+// toggleTransport
+//---------------------------------------------------------
+
+void MusE::toggleTransport()
+ {
+ showTransport(!menuView->isItemChecked(tr_id));
+ }
+
+//---------------------------------------------------------
+// showTransport
+//---------------------------------------------------------
+
+void MusE::showTransport(bool flag)
+ {
+ transport->setShown(flag);
+ menuView->setItemChecked(tr_id, flag);
+ }
+
+//---------------------------------------------------------
+// getRoutingPopupMenu
+//---------------------------------------------------------
+
+PopupMenu* MusE::getRoutingPopupMenu()
+{
+ if(!routingPopupMenu)
+ routingPopupMenu = new PopupMenu(this);
+ return routingPopupMenu;
+}
+
+//---------------------------------------------------------
+// updateRouteMenus
+//---------------------------------------------------------
+
+//void MusE::updateRouteMenus(Track* track)
+void MusE::updateRouteMenus(Track* track, QObject* master) // p3.3.50
+{
+ //if(!track || track != gRoutingPopupMenuMaster || track->type() == Track::AUDIO_AUX)
+ //if(!track || track->type() == Track::AUDIO_AUX)
+ if(!track || gRoutingPopupMenuMaster != master) // p3.3.50
+ return;
+
+ //QPopupMenu* pup = muse->getORoutesPopup();
+ PopupMenu* pup = getRoutingPopupMenu();
+
+ if(pup->count() == 0)
+ return;
+
+ //AudioTrack* t = (AudioTrack*)track;
+ RouteList* rl = gIsOutRoutingPopupMenu ? track->outRoutes() : track->inRoutes();
+
+ /*
+ iRoute iorl = orl->begin();
+ for(; iorl != orl->end(); ++iorl)
+ {
+ iRouteMenuMap imm = ormm->begin();
+ for(; imm != ormm->end(); ++imm)
+ {
+ if(*iorl == imm->second)
+ {
+ orpup->setItemChecked(imm->first, true);
+ break;
+ }
+ }
+ //if(imm == ormm->end())
+ //{
+ //}
+
+ }
+ //if (iorl == orl->end())
+ //{
+ //}
+ */
+
+ iRouteMenuMap imm = gRoutingMenuMap.begin();
+ for(; imm != gRoutingMenuMap.end(); ++imm)
+ {
+ // p3.3.50 Ignore the 'toggle' items.
+ if(imm->second.type == Route::MIDI_PORT_ROUTE &&
+ imm->first >= (MIDI_PORTS * MIDI_CHANNELS) && imm->first < (MIDI_PORTS * MIDI_CHANNELS + MIDI_PORTS))
+ continue;
+
+ //bool found = false;
+ iRoute irl = rl->begin();
+ for(; irl != rl->end(); ++irl)
+ {
+ if(imm->second.type == Route::MIDI_PORT_ROUTE) // p3.3.50 Is the map route a midi port route?
+ {
+ if(irl->type == Route::MIDI_PORT_ROUTE && irl->midiPort == imm->second.midiPort // Is the track route a midi port route?
+ && (irl->channel & imm->second.channel) == imm->second.channel) // Is the exact channel mask bit(s) set?
+ {
+ //found = true;
+ break;
+ }
+ }
+ else
+ if(*irl == imm->second)
+ {
+ //found = true;
+ break;
+ }
+ }
+ //pup->setItemChecked(imm->first, found);
+ pup->setItemChecked(imm->first, irl != rl->end());
+ }
+
+
+ return;
+}
+
+//---------------------------------------------------------
+// routingPopupMenuActivated
+//---------------------------------------------------------
+
+void MusE::routingPopupMenuActivated(Track* track, int n)
+{
+ //if(!track || (track != gRoutingPopupMenuMaster))
+ if(!track)
+ return;
+
+ if(track->isMidiTrack())
+ {
+ PopupMenu* pup = getRoutingPopupMenu();
+
+ //printf("MusE::routingPopupMenuActivated midi n:%d count:%d\n", n, pup->count());
+
+ if(pup->count() == 0)
+ return;
+
+ //MidiTrack* t = (MidiTrack*)track;
+ RouteList* rl = gIsOutRoutingPopupMenu ? track->outRoutes() : track->inRoutes();
+
+ if(n == -1)
+ {
+ //printf("MusE::routingPopupMenuActivated midi n = -1\n");
+ ///delete pup;
+ ///pup = 0;
+ return;
+ }
+ else
+ {
+ //int mdidx = n / MIDI_CHANNELS;
+ //int ch = n % MIDI_CHANNELS;
+ //int chbit = 1 << ch; // p3.3.50
+ //int chmask = 0;
+
+ //if(n >= MIDI_PORTS * MIDI_CHANNELS) // p3.3.50 Toggle channels.
+ //{
+ //for (int i = 0; i < MIDI_CHANNELS; i++)
+ //muse->routingPopupMenuActivated(selected, i + MIDI_CHANNELS * (n-1000));
+ //muse->routingPopupMenuActivated(selected, i + MIDI_CHANNELS * (n - MIDI_PORTS * MIDI_CHANNELS)); // p3.3.50
+ // chbit = (1 << MIDI_CHANNELS) - 1;
+ //}
+ //if(debugMsg)
+ //printf("MusE::routingPopupMenuActivated mdidx:%d ch:%d\n", mdidx, ch);
+
+ // p3.3.50
+ iRouteMenuMap imm = gRoutingMenuMap.find(n);
+ if(imm == gRoutingMenuMap.end())
+ return;
+ if(imm->second.type != Route::MIDI_PORT_ROUTE)
+ return;
+ Route &aRoute = imm->second;
+ int chbit = aRoute.channel;
+ Route bRoute(track, chbit);
+ int mdidx = aRoute.midiPort;
+
+ MidiPort* mp = &midiPorts[mdidx];
+ MidiDevice* md = mp->device();
+ if(!md)
+ {
+ ///delete pup;
+ return;
+ }
+
+ //if(!(md->rwFlags() & 2))
+ if(!(md->rwFlags() & (gIsOutRoutingPopupMenu ? 1 : 2)))
+ {
+ ///delete pup;
+ return;
+ }
+
+ //QString s(pup->text(n));
+ //QT_TR_NOOP(md->name())
+
+ //Route srcRoute(s, false, -1);
+
+ //Route aRoute(md, ch);
+ //Route aRoute(mdidx, ch); // p3.3.49
+ //Route aRoute(mdidx, chbit); // p3.3.50 In accordance with new channel mask, use the bit position.
+
+ //Route srcRoute(md, -1);
+ //Route dstRoute(track, -1);
+ //Route bRoute(track, ch);
+ //Route bRoute(track, chbit); // p3.3.50
+
+ //if (track->type() == Track::AUDIO_INPUT)
+ // srcRoute.channel = dstRoute.channel = n & 0xf;
+
+ int chmask = 0;
+ iRoute iir = rl->begin();
+ for (; iir != rl->end(); ++iir)
+ {
+ //if(*iir == (dst ? bRoute : aRoute))
+ //if(*iir == aRoute)
+ if(iir->type == Route::MIDI_PORT_ROUTE && iir->midiPort == mdidx) // p3.3.50 Is there already a route to this port?
+ {
+ chmask = iir->channel; // p3.3.50 Grab the channel mask.
+ break;
+ }
+ }
+ //if (iir != rl->end())
+ if ((chmask & chbit) == chbit) // p3.3.50 Is the channel's bit(s) set?
+ {
+ // disconnect
+ if(gIsOutRoutingPopupMenu)
+ {
+ //printf("MusE::routingPopupMenuActivated removing route src track name: %s dst device name: %s\n", track->name().latin1(), md->name().latin1());
+ audio->msgRemoveRoute(bRoute, aRoute);
+ }
+ else
+ {
+ //printf("MusE::routingPopupMenuActivated removing route src device name: %s dst track name: %s\n", md->name().latin1(), track->name().latin1());
+ audio->msgRemoveRoute(aRoute, bRoute);
+ }
+ }
+ else
+ {
+ // connect
+ if(gIsOutRoutingPopupMenu)
+ {
+ //printf("MusE::routingPopupMenuActivated adding route src track name: %s dst device name: %s\n", track->name().latin1(), md->name().latin1());
+ audio->msgAddRoute(bRoute, aRoute);
+ }
+ else
+ {
+ //printf("MusE::routingPopupMenuActivated adding route src device name: %s dst track name: %s\n", md->name().latin1(), track->name().latin1());
+ audio->msgAddRoute(aRoute, bRoute);
+ }
+ }
+
+ //printf("MusE::routingPopupMenuActivated calling msgUpdateSoloStates\n");
+ audio->msgUpdateSoloStates();
+ //printf("MusE::routingPopupMenuActivated calling song->update\n");
+ song->update(SC_ROUTE);
+ }
+ }
+ else
+ {
+ // TODO: Try to move code from AudioStrip::routingPopupMenuActivated into here.
+
+ /*
+ PopupMenu* pup = getRoutingPopupMenu();
+
+ printf("MusE::routingPopupMenuActivated audio n:%d count:%d\n", n, pup->count());
+
+ if(pup->count() == 0)
+ return;
+
+ AudioTrack* t = (AudioTrack*)track;
+ RouteList* rl = gIsOutRoutingPopupMenu ? t->outRoutes() : t->inRoutes();
+
+ //QPoint ppt = QCursor::pos();
+
+ if(n == -1)
+ {
+ //printf("MusE::routingPopupMenuActivated audio n = -1 deleting popup...\n");
+ printf("MusE::routingPopupMenuActivated audio n = -1\n");
+ ///delete pup;
+ ///pup = 0;
+ return;
+ }
+ else
+ //if(n == 0)
+ //{
+ //printf("MusE::routingPopupMenuActivated audio n = 0 = tearOffHandle\n");
+ //oR->setDown(false);
+ // return;
+ //}
+ //else
+ {
+ if(gIsOutRoutingPopupMenu)
+ {
+ QString s(pup->text(n));
+
+ //printf("AudioStrip::routingPopupMenuActivated audio text:%s\n", s.latin1());
+
+ if(track->type() == Track::AUDIO_OUTPUT)
+ {
+ ///delete orpup;
+
+ int chan = n & 0xf;
+
+ //Route srcRoute(t, -1);
+ //Route srcRoute(t, chan, chans);
+ //Route srcRoute(t, chan, 1);
+ Route srcRoute(t, chan);
+
+ //Route dstRoute(s, true, -1);
+ Route dstRoute(s, true, -1, Route::JACK_ROUTE);
+ //Route dstRoute(s, true, 0, Route::JACK_ROUTE);
+
+ //srcRoute.channel = dstRoute.channel = chan;
+ dstRoute.channel = chan;
+ //dstRoute.channels = 1;
+
+ // check if route src->dst exists:
+ iRoute irl = rl->begin();
+ for (; irl != rl->end(); ++irl) {
+ if (*irl == dstRoute)
+ break;
+ }
+ if (irl != rl->end()) {
+ // disconnect if route exists
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect if route does not exist
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+
+ // p3.3.47
+ //pup->popup(ppt, 0);
+
+ //oR->setDown(false);
+ return;
+
+ // p3.3.46
+ ///goto _redisplay;
+ }
+
+ iRouteMenuMap imm = gRoutingMenuMap.find(n);
+ if(imm == gRoutingMenuMap.end())
+ {
+ ///delete orpup;
+ //oR->setDown(false); // orpup->exec() catches mouse release event
+ return;
+ }
+
+ //int chan = n >> 16;
+ //int chans = (chan >> 15) + 1; // Bit 31 MSB: Mono or stereo.
+ //chan &= 0xffff;
+ //int chan = imm->second.channel;
+ //int chans = imm->second.channels;
+
+ //Route srcRoute(t, -1);
+ //srcRoute.remoteChannel = chan;
+ //Route srcRoute(t, chan, chans);
+ Route srcRoute(t, imm->second.channel, imm->second.channels);
+ //Route srcRoute(t, imm->second.channel);
+ srcRoute.remoteChannel = imm->second.remoteChannel;
+
+ //Route dstRoute(s, true, -1);
+ //Route dstRoute(s, true, -1, Route::TRACK_ROUTE);
+ Route &dstRoute = imm->second;
+
+ // check if route src->dst exists:
+ iRoute irl = rl->begin();
+ for (; irl != rl->end(); ++irl) {
+ if (*irl == dstRoute)
+ break;
+ }
+ if (irl != rl->end()) {
+ // disconnect if route exists
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect if route does not exist
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+
+ // p3.3.46
+ //oR->setDown(false);
+ ///goto _redisplay;
+
+ // p3.3.47
+ //pup->popup(ppt, 0);
+ }
+ else
+ {
+ QString s(pup->text(n));
+
+ if(track->type() == Track::AUDIO_INPUT)
+ {
+ ///delete pup;
+ int chan = n & 0xf;
+
+ Route srcRoute(s, false, -1, Route::JACK_ROUTE);
+ Route dstRoute(t, chan);
+
+ srcRoute.channel = chan;
+
+ iRoute irl = rl->begin();
+ for(; irl != rl->end(); ++irl)
+ {
+ if(*irl == srcRoute)
+ break;
+ }
+ if(irl != rl->end())
+ // disconnect
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ else
+ // connect
+ audio->msgAddRoute(srcRoute, dstRoute);
+
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+ //iR->setDown(false); // pup->exec() catches mouse release event
+ return;
+
+ // p3.3.46
+ ///goto _redisplay;
+ }
+
+ iRouteMenuMap imm = gRoutingMenuMap.find(n);
+ if(imm == gRoutingMenuMap.end())
+ {
+ //delete pup;
+ //iR->setDown(false); // pup->exec() catches mouse release event
+ return;
+ }
+
+ //int chan = n >> 16;
+ //int chans = (chan >> 15) + 1; // Bit 31 MSB: Mono or stereo.
+ //chan &= 0xffff;
+ //int chan = imm->second.channel;
+ //int chans = imm->second.channels;
+
+ //Route srcRoute(s, false, -1);
+ //Route srcRoute(s, false, -1, Route::TRACK_ROUTE);
+ Route &srcRoute = imm->second;
+
+ //Route dstRoute(t, -1);
+ //Route dstRoute(t, chan, chans);
+ Route dstRoute(t, imm->second.channel, imm->second.channels);
+ //Route dstRoute(t, imm->second.channel);
+ dstRoute.remoteChannel = imm->second.remoteChannel;
+
+ iRoute irl = rl->begin();
+ for (; irl != rl->end(); ++irl) {
+ if (*irl == srcRoute)
+ break;
+ }
+ if (irl != rl->end()) {
+ // disconnect
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+
+ // p3.3.46
+ //iR->setDown(false);
+ ///goto _redisplay;
+
+
+
+
+ }
+
+ }
+ */
+
+ }
+ //else
+ //{
+ //}
+
+ ///delete pup;
+ //oR->setDown(false);
+}
+
+//---------------------------------------------------------
+// routingPopupMenuAboutToHide
+//---------------------------------------------------------
+
+void MusE::routingPopupMenuAboutToHide()
+{
+ // p3.3.47
+ //printf("MusE::routingPopupMenuAboutToHide\n");
+ //if(track)
+ // printf("%s", track->name().latin1());
+ //printf("\n");
+
+ // Hmm, can't do this? Sub-menus stay open with this. Re-arranged, testing... Nope.
+ //PopupMenu* pup = muse->getRoutingPopupMenu();
+ //pup->disconnect();
+ //pup->clear();
+ gRoutingMenuMap.clear();
+ gRoutingPopupMenuMaster = 0;
+}
+
+//---------------------------------------------------------
+// prepareRoutingPopupMenu
+//---------------------------------------------------------
+
+PopupMenu* MusE::prepareRoutingPopupMenu(Track* track, bool dst)
+{
+ if(!track)
+ return 0;
+
+ //QPoint ppt = QCursor::pos();
+
+ if(track->isMidiTrack())
+ {
+
+ //QPoint ppt = parent->rect().bottomLeft();
+
+ //if(dst)
+ //{
+ // TODO
+
+ //}
+ //else
+ //{
+ RouteList* rl = dst ? track->outRoutes() : track->inRoutes();
+ //Route dst(track, -1);
+
+ ///QPopupMenu* pup = new QPopupMenu(parent);
+
+ PopupMenu* pup = getRoutingPopupMenu();
+ pup->disconnect();
+ //connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
+ //connect(pup, SIGNAL(aboutToHide()), SLOT(routingPopupMenuAboutToHide()));
+
+ pup->setCheckable(true);
+
+ int gid = 0;
+ //int n;
+
+ // Routes can't be re-read until the message sent from msgAddRoute1()
+ // has had time to be sent and actually affected the routes.
+ ///_redisplay:
+
+ pup->clear();
+ gRoutingMenuMap.clear();
+ gid = 0;
+
+ //MidiInPortList* tl = song->midiInPorts();
+ //for(iMidiInPort i = tl->begin();i != tl->end(); ++i)
+ for(int i = 0; i < MIDI_PORTS; ++i)
+ {
+ //MidiInPort* track = *i;
+ // NOTE: Could possibly list all devices, bypassing ports, but no, let's stick with ports.
+ MidiPort* mp = &midiPorts[i];
+ MidiDevice* md = mp->device();
+ if(!md)
+ continue;
+
+ if(!(md->rwFlags() & (dst ? 1 : 2)))
+ continue;
+
+ //printf("MusE::prepareRoutingPopupMenu adding submenu portnum:%d\n", i);
+
+ //QMenu* m = menu->addMenu(track->name());
+ //QPopupMenu* subp = new QPopupMenu(parent);
+ //PopupMenu* subp = new PopupMenu(this);
+ PopupMenu* subp = new PopupMenu();
+ connect(subp, SIGNAL(activated(int)), pup, SIGNAL(activated(int)));
+ //connect(subp, SIGNAL(aboutToHide()), pup, SIGNAL(aboutToHide()));
+
+ int chanmask = 0;
+ // p3.3.50 To reduce number of routes required, from one per channel to just one containing a channel mask.
+ // Look for the first route to this midi port. There should always be only a single route for each midi port, now.
+ for(iRoute ir = rl->begin(); ir != rl->end(); ++ir)
+ {
+ if(ir->type == Route::MIDI_PORT_ROUTE && ir->midiPort == i)
+ {
+ // We have a route to the midi port. Grab the channel mask.
+ chanmask = ir->channel;
+ break;
+ }
+ }
+
+ for(int ch = 0; ch < MIDI_CHANNELS; ++ch)
+ {
+ //QAction* a = m->addAction(QString("Channel %1").arg(ch+1));
+ //subp->insertItem(QT_TR_NOOP(QString("Channel %1").arg(ch+1)), i * MIDI_CHANNELS + ch);
+ gid = i * MIDI_CHANNELS + ch;
+
+ //printf("MusE::prepareRoutingPopupMenu inserting gid:%d\n", gid);
+
+ subp->insertItem(QString("Channel %1").arg(ch+1), gid);
+ //a->setCheckable(true);
+ //Route src(track, ch, RouteNode::TRACK);
+ //Route src(md, ch);
+ //Route r = Route(src, dst);
+ //a->setData(QVariant::fromValue(r));
+ //a->setChecked(rl->indexOf(r) != -1);
+
+ //Route srcRoute(md, ch);
+ //Route srcRoute(i, ch); // p3.3.49 New: Midi port route.
+ int chbit = 1 << ch;
+ Route srcRoute(i, chbit); // p3.3.50 In accordance with new channel mask, use the bit position.
+
+ gRoutingMenuMap.insert( pRouteMenuMap(gid, srcRoute) );
+
+ //for(iRoute ir = rl->begin(); ir != rl->end(); ++ir) // p3.3.50 Removed.
+ //{
+ //if(*ir == dst)
+ // if(*ir == srcRoute)
+ // {
+ // subp->setItemChecked(id, true);
+ // break;
+ // }
+ //}
+ if(chanmask & chbit) // p3.3.50 Is the channel already set? Show item check mark.
+ subp->setItemChecked(gid, true);
+ }
+ //subp->insertItem(QString("Toggle all"), 1000+i);
+ // p3.3.50 One route with all channel bits set.
+ gid = MIDI_PORTS * MIDI_CHANNELS + i; // Make sure each 'toggle' item gets a unique id.
+ subp->insertItem(QString("Toggle all"), gid);
+ Route togRoute(i, (1 << MIDI_CHANNELS) - 1); // Set all channel bits.
+ gRoutingMenuMap.insert( pRouteMenuMap(gid, togRoute) );
+
+ pup->insertItem(QT_TR_NOOP(md->name()), subp);
+ }
+
+ /*
+ QPopupMenu* pup = new QPopupMenu(iR);
+ pup->setCheckable(true);
+ //MidiTrack* t = (MidiTrack*)track;
+ RouteList* irl = track->inRoutes();
+
+ MidiTrack* t = (MidiTrack*)track;
+ int gid = 0;
+ for (int i = 0; i < channel; ++i)
+ {
+ char buffer[128];
+ snprintf(buffer, 128, "%s %d", tr("Channel").latin1(), i+1);
+ MenuTitleItem* titel = new MenuTitleItem(QString(buffer));
+ pup->insertItem(titel);
+
+ if (!checkAudioDevice()) return;
+ std::list<QString> ol = audioDevice->outputPorts();
+ for (std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip) {
+ int id = pup->insertItem(*ip, (gid * 16) + i);
+ Route dst(*ip, true, i);
+ ++gid;
+ for (iRoute ir = irl->begin(); ir != irl->end(); ++ir) {
+ if (*ir == dst) {
+ pup->setItemChecked(id, true);
+ break;
+ }
+ }
+ }
+ if (i+1 != channel)
+ pup->insertSeparator();
+ }
+ */
+
+ if(pup->count() == 0)
+ {
+ ///delete pup;
+ gRoutingPopupMenuMaster = 0;
+ //pup->clear();
+ //pup->disconnect();
+ gRoutingMenuMap.clear();
+ //oR->setDown(false);
+ return 0;
+ }
+
+ gIsOutRoutingPopupMenu = dst;
+ return pup;
+ }
+
+ return 0;
+}
+
+//---------------------------------------------------------
+// saveAs
+//---------------------------------------------------------
+
+bool MusE::saveAs()
+ {
+// QString name = getSaveFileName(museProject, med_file_pattern, this,
+// QString name = getSaveFileName(QString(""), med_file_pattern, this,
+ QString name = getSaveFileName(QString(""), med_file_save_pattern, this,
+ tr("MusE: Save As"));
+ bool ok = false;
+ if (!name.isEmpty()) {
+ QString tempOldProj = museProject;
+ museProject = QFileInfo(name).dirPath(true);
+ ok = save(name, true);
+ if (ok) {
+ project.setFile(name);
+ setCaption(tr("MusE: Song: ") + project.baseName(true));
+ addProject(name);
+ }
+ else
+ museProject = tempOldProj;
+ }
+
+ return ok;
+ }
+
+//---------------------------------------------------------
+// printVersion
+//---------------------------------------------------------
+
+static void printVersion(const char* prog)
+ {
+ fprintf(stderr, "%s: Linux Music Editor; Version %s, (svn revision %s)\n", prog, VERSION, SVNVERSION);
+ }
+
+//---------------------------------------------------------
+// startEditor
+//---------------------------------------------------------
+
+void MusE::startEditor(PartList* pl, int type)
+ {
+ switch (type) {
+ case 0: startPianoroll(pl); break;
+ case 1: startListEditor(pl); break;
+ case 3: startDrumEditor(pl); break;
+ case 4: startWaveEditor(pl); break;
+ }
+ }
+
+//---------------------------------------------------------
+// startEditor
+//---------------------------------------------------------
+
+void MusE::startEditor(Track* t)
+ {
+ switch (t->type()) {
+ case Track::MIDI: startPianoroll(); break;
+ case Track::DRUM: startDrumEditor(); break;
+ case Track::WAVE: startWaveEditor(); break;
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// getMidiPartsToEdit
+//---------------------------------------------------------
+
+PartList* MusE::getMidiPartsToEdit()
+ {
+ PartList* pl = song->getSelectedMidiParts();
+ if (pl->empty()) {
+ QMessageBox::critical(this, QString("MusE"), tr("Nothing to edit"));
+ return 0;
+ }
+ return pl;
+ }
+
+//---------------------------------------------------------
+// startPianoroll
+//---------------------------------------------------------
+
+void MusE::startPianoroll()
+ {
+ PartList* pl = getMidiPartsToEdit();
+ if (pl == 0)
+ return;
+ startPianoroll(pl);
+ }
+
+void MusE::startPianoroll(PartList* pl)
+ {
+
+ PianoRoll* pianoroll = new PianoRoll(pl, this, 0, arranger->cursorValue());
+ pianoroll->show();
+ toplevels.push_back(Toplevel(Toplevel::PIANO_ROLL, (unsigned long)(pianoroll), pianoroll));
+ connect(pianoroll, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long)));
+ connect(muse, SIGNAL(configChanged()), pianoroll, SLOT(configChanged()));
+ }
+
+//---------------------------------------------------------
+// startListenEditor
+//---------------------------------------------------------
+
+void MusE::startListEditor()
+ {
+ PartList* pl = getMidiPartsToEdit();
+ if (pl == 0)
+ return;
+ startListEditor(pl);
+ }
+
+void MusE::startListEditor(PartList* pl)
+ {
+ ListEdit* listEditor = new ListEdit(pl);
+ listEditor->show();
+ toplevels.push_back(Toplevel(Toplevel::LISTE, (unsigned long)(listEditor), listEditor));
+ connect(listEditor, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long)));
+ connect(muse,SIGNAL(configChanged()), listEditor, SLOT(configChanged()));
+ }
+
+//---------------------------------------------------------
+// startMasterEditor
+//---------------------------------------------------------
+
+void MusE::startMasterEditor()
+ {
+ MasterEdit* masterEditor = new MasterEdit();
+ masterEditor->show();
+ toplevels.push_back(Toplevel(Toplevel::MASTER, (unsigned long)(masterEditor), masterEditor));
+ connect(masterEditor, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long)));
+ }
+
+//---------------------------------------------------------
+// startLMasterEditor
+//---------------------------------------------------------
+
+void MusE::startLMasterEditor()
+ {
+ LMaster* lmaster = new LMaster();
+ lmaster->show();
+ toplevels.push_back(Toplevel(Toplevel::LMASTER, (unsigned long)(lmaster), lmaster));
+ connect(lmaster, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long)));
+ connect(muse, SIGNAL(configChanged()), lmaster, SLOT(configChanged()));
+ }
+
+//---------------------------------------------------------
+// startDrumEditor
+//---------------------------------------------------------
+
+void MusE::startDrumEditor()
+ {
+ PartList* pl = getMidiPartsToEdit();
+ if (pl == 0)
+ return;
+ startDrumEditor(pl);
+ }
+
+void MusE::startDrumEditor(PartList* pl)
+ {
+
+ DrumEdit* drumEditor = new DrumEdit(pl, this, 0, arranger->cursorValue());
+ drumEditor->show();
+ toplevels.push_back(Toplevel(Toplevel::DRUM, (unsigned long)(drumEditor), drumEditor));
+ connect(drumEditor, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long)));
+ connect(muse, SIGNAL(configChanged()), drumEditor, SLOT(configChanged()));
+ }
+
+//---------------------------------------------------------
+// startWaveEditor
+//---------------------------------------------------------
+
+void MusE::startWaveEditor()
+ {
+ PartList* pl = song->getSelectedWaveParts();
+ if (pl->empty()) {
+ QMessageBox::critical(this, QString("MusE"), tr("Nothing to edit"));
+ return;
+ }
+ startWaveEditor(pl);
+ }
+
+void MusE::startWaveEditor(PartList* pl)
+ {
+ WaveEdit* waveEditor = new WaveEdit(pl);
+ waveEditor->show();
+ connect(muse, SIGNAL(configChanged()), waveEditor, SLOT(configChanged()));
+ toplevels.push_back(Toplevel(Toplevel::WAVE, (unsigned long)(waveEditor), waveEditor));
+ connect(waveEditor, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long)));
+ }
+
+
+//---------------------------------------------------------
+// startSongInfo
+//---------------------------------------------------------
+void MusE::startSongInfo(bool editable)
+ {
+ printf("startSongInfo!!!!\n");
+ SongInfo info;
+ info.songInfoText->setText(song->getSongInfo());
+ info.songInfoText->setReadOnly(!editable);
+ info.show();
+ if( info.exec() == QDialog::Accepted) {
+ if (editable)
+ song->setSongInfo(info.songInfoText->text());
+ }
+
+ }
+
+//---------------------------------------------------------
+// showDidYouKnowDialog
+//---------------------------------------------------------
+void MusE::showDidYouKnowDialog()
+ {
+ if ((bool)config.showDidYouKnow == true) {
+ printf("show did you know dialog!!!!\n");
+ DidYouKnow dyk;
+ dyk.tipText->setText("To get started with MusE why don't you try some demo songs available at http://demos.muse-sequencer.org/");
+ dyk.show();
+ if( dyk.exec()) {
+ if (dyk.dontShowCheckBox->isChecked()) {
+ printf("disables dialog!\n");
+ config.showDidYouKnow=false;
+ muse->changeConfig(true); // save settings
+ }
+ }
+ }
+ }
+//---------------------------------------------------------
+// startDefineController
+//---------------------------------------------------------
+
+
+//---------------------------------------------------------
+// startClipList
+//---------------------------------------------------------
+
+void MusE::startClipList()
+ {
+ if (clipListEdit == 0) {
+ clipListEdit = new ClipListEdit();
+ toplevels.push_back(Toplevel(Toplevel::CLIPLIST, (unsigned long)(clipListEdit), clipListEdit));
+ connect(clipListEdit, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long)));
+ }
+ clipListEdit->show();
+ menu_audio->setItemChecked(aid2, true);
+ }
+
+//---------------------------------------------------------
+// fileMenu
+//---------------------------------------------------------
+
+void MusE::openRecentMenu()
+ {
+ openRecent->clear();
+ for (int i = 0; i < PROJECT_LIST_LEN; ++i) {
+ if (projectList[i] == 0)
+ break;
+ const char* path = projectList[i]->latin1();
+ const char* p = strrchr(path, '/');
+ if (p == 0)
+ p = path;
+ else
+ ++p;
+ openRecent->insertItem(QString(p), i);
+ }
+ }
+
+//---------------------------------------------------------
+// selectProject
+//---------------------------------------------------------
+
+void MusE::selectProject(int id)
+ {
+ if (id < 0)
+ return;
+ assert(id < PROJECT_LIST_LEN);
+ QString* name = projectList[id];
+ if (name == 0)
+ return;
+ loadProjectFile(*name, false, true);
+ }
+
+//---------------------------------------------------------
+// toplevelDeleted
+//---------------------------------------------------------
+
+void MusE::toplevelDeleted(unsigned long tl)
+ {
+ for (iToplevel i = toplevels.begin(); i != toplevels.end(); ++i) {
+ if (i->object() == tl) {
+ switch(i->type()) {
+ case Toplevel::MARKER:
+ break;
+ case Toplevel::CLIPLIST:
+ menu_audio->setItemChecked(aid2, false);
+ return;
+ // the followin editors can exist in more than
+ // one instantiation:
+ case Toplevel::PIANO_ROLL:
+ case Toplevel::LISTE:
+ case Toplevel::DRUM:
+ case Toplevel::MASTER:
+ case Toplevel::WAVE:
+ case Toplevel::LMASTER:
+ break;
+ }
+ toplevels.erase(i);
+ return;
+ }
+ }
+ printf("topLevelDeleted: top level %lx not found\n", tl);
+ //assert(false);
+ }
+
+//---------------------------------------------------------
+// ctrlChanged
+// midi ctrl value changed
+//---------------------------------------------------------
+
+#if 0
+void MusE::ctrlChanged()
+ {
+ arranger->updateInspector();
+ }
+#endif
+
+//---------------------------------------------------------
+// kbAccel
+//---------------------------------------------------------
+
+void MusE::kbAccel(int key)
+ {
+ if (key == shortcuts[SHRT_TOGGLE_METRO].key) {
+ song->setClick(!song->click());
+ }
+ else if (key == shortcuts[SHRT_PLAY_TOGGLE].key) {
+ if (audio->isPlaying())
+ //song->setStopPlay(false);
+ song->setStop(true);
+ else if (!config.useOldStyleStopShortCut)
+ song->setPlay(true);
+ else if (song->cpos() != song->lpos())
+ song->setPos(0, song->lPos());
+ else {
+ Pos p(0, true);
+ song->setPos(0, p);
+ }
+ }
+ else if (key == shortcuts[SHRT_STOP].key) {
+ //song->setPlay(false);
+ song->setStop(true);
+ }
+ else if (key == shortcuts[SHRT_GOTO_START].key) {
+ Pos p(0, true);
+ song->setPos(0, p);
+ }
+ else if (key == shortcuts[SHRT_PLAY_SONG].key ) {
+ song->setPlay(true);
+ }
+ else if (key == shortcuts[SHRT_GOTO_LEFT].key) {
+ if (!song->record())
+ song->setPos(0, song->lPos());
+ }
+ else if (key == shortcuts[SHRT_GOTO_RIGHT].key) {
+ if (!song->record())
+ song->setPos(0, song->rPos());
+ }
+ else if (key == shortcuts[SHRT_TOGGLE_LOOP].key) {
+ song->setLoop(!song->loop());
+ }
+ else if (key == shortcuts[SHRT_START_REC].key) {
+ if (!audio->isPlaying()) {
+ song->setRecord(!song->record());
+ }
+ }
+ else if (key == shortcuts[SHRT_REC_CLEAR].key) {
+ if (!audio->isPlaying()) {
+ song->clearTrackRec();
+ }
+ }
+ else if (key == shortcuts[SHRT_OPEN_TRANSPORT].key) {
+ toggleTransport();
+ }
+ else if (key == shortcuts[SHRT_OPEN_BIGTIME].key) {
+ toggleBigTime();
+ }
+ //else if (key == shortcuts[SHRT_OPEN_MIXER].key) {
+ // toggleMixer();
+ // }
+ else if (key == shortcuts[SHRT_OPEN_MIXER].key) {
+ toggleMixer1();
+ }
+ else if (key == shortcuts[SHRT_OPEN_MIXER2].key) {
+ toggleMixer2();
+ }
+ else if (key == shortcuts[SHRT_NEXT_MARKER].key) {
+ if (markerView)
+ markerView->nextMarker();
+ }
+ else if (key == shortcuts[SHRT_PREV_MARKER].key) {
+ if (markerView)
+ markerView->prevMarker();
+ }
+ else {
+ if (debugMsg)
+ printf("unknown kbAccel 0x%x\n", key);
+ }
+ }
+
+//---------------------------------------------------------
+// MuseApplication
+//---------------------------------------------------------
+
+class MuseApplication : public QApplication {
+ MusE* muse;
+
+ public:
+ MuseApplication(int& argc, char** argv)
+ : QApplication(argc, argv)
+ {
+ muse = 0;
+ }
+
+
+ void setMuse(MusE* m) {
+ muse = m;
+#ifdef HAVE_LASH
+ if(useLASH)
+ startTimer (300);
+#endif
+ }
+
+ bool notify(QObject* receiver, QEvent* event) {
+ bool flag = QApplication::notify(receiver, event);
+ if (event->type() == QEvent::KeyPress) {
+ QKeyEvent* ke = (QKeyEvent*)event;
+ globalKeyState = ke->stateAfter();
+ bool accepted = ke->isAccepted();
+ if (!accepted) {
+ int key = ke->key();
+ if (ke->state() & Qt::ShiftModifier)
+ key += Qt::SHIFT;
+ if (ke->state() & Qt::AltModifier)
+ key += Qt::ALT;
+ if (ke->state() & Qt::ControlModifier)
+ key+= Qt::CTRL;
+ muse->kbAccel(key);
+ return true;
+ }
+ }
+ if (event->type() == QEvent::KeyRelease) {
+ QKeyEvent* ke = (QKeyEvent*)event;
+ globalKeyState = ke->stateAfter();
+ }
+
+ return flag;
+ }
+
+#ifdef HAVE_LASH
+ virtual void timerEvent (QTimerEvent * /* e */) {
+ if(useLASH)
+ muse->lash_idle_cb ();
+ }
+#endif /* HAVE_LASH */
+
+ };
+
+//---------------------------------------------------------
+// usage
+//---------------------------------------------------------
+
+static void usage(const char* prog, const char* txt)
+ {
+ fprintf(stderr, "%s: %s\nusage: %s flags midifile\n Flags:\n",
+ prog, txt, prog);
+ fprintf(stderr, " -h this help\n");
+ fprintf(stderr, " -v print version\n");
+ fprintf(stderr, " -d debug mode: no threads, no RT\n");
+ fprintf(stderr, " -D debug mode: enable some debug messages\n");
+ fprintf(stderr, " -m debug mode: trace midi Input\n");
+ fprintf(stderr, " -M debug mode: trace midi Output\n");
+ fprintf(stderr, " -s debug mode: trace sync\n");
+ fprintf(stderr, " -a no audio\n");
+ //fprintf(stderr, " -P n set real time priority to n (default: 50)\n");
+ fprintf(stderr, " -P n set audio driver real time priority to n (Dummy only, default 40. Else fixed by Jack.)\n");
+ fprintf(stderr, " -Y n force midi real time priority to n (default: audio driver prio +2)\n");
+ fprintf(stderr, " -p don't load LADSPA plugins\n");
+#ifdef ENABLE_PYTHON
+ fprintf(stderr, " -y enable Python control support\n");
+#endif
+#ifdef VST_SUPPORT
+ fprintf(stderr, " -V don't load VST plugins\n");
+#endif
+#ifdef DSSI_SUPPORT
+ fprintf(stderr, " -I don't load DSSI plugins\n");
+#endif
+#ifdef HAVE_LASH
+ fprintf(stderr, " -L don't use LASH\n");
+#endif
+ fprintf(stderr, "useful environment variables:\n");
+ fprintf(stderr, " MUSE override library and shared directories location\n");
+ fprintf(stderr, " MUSEHOME override user home directory (HOME/)\n");
+ fprintf(stderr, " MUSEINSTRUMENTS override user instrument directory (MUSEHOME/muse_instruments)\n");
+ }
+
+//---------------------------------------------------------
+// catchSignal
+// only for debugging
+//---------------------------------------------------------
+
+#if 0
+static void catchSignal(int sig)
+ {
+ if (debugMsg)
+ fprintf(stderr, "MusE: signal %d catched\n", sig);
+ if (sig == SIGSEGV) {
+ fprintf(stderr, "MusE: segmentation fault\n");
+ abort();
+ }
+ if (sig == SIGCHLD) {
+ M_DEBUG("caught SIGCHLD - child died\n");
+ int status;
+ int n = waitpid (-1, &status, WNOHANG);
+ if (n > 0) {
+ fprintf(stderr, "SIGCHLD for unknown process %d received\n", n);
+ }
+ }
+ }
+#endif
+
+//---------------------------------------------------------
+// main
+//---------------------------------------------------------
+
+int main(int argc, char* argv[])
+ {
+
+// error = ErrorHandler::create(argv[0]);
+ ruid = getuid();
+ euid = geteuid();
+ undoSetuid();
+ getCapabilities();
+ int noAudio = false;
+
+ const char* mu = getenv("MUSEHOME");
+ if(mu)
+ museUser = QString(mu);
+ if(museUser.isEmpty())
+ museUser = QString(getenv("HOME"));
+
+ QString museGlobal;
+ const char* p = getenv("MUSE");
+ if (p)
+ museGlobal = p;
+
+ if (museGlobal.isEmpty()) {
+ QString museGlobal(INSTPREFIX);
+ QString museGlobalLibDir(INSTLIBDIR);
+ museGlobalLib = museGlobalLibDir + "/muse";
+ museGlobalShare = museGlobal + "/share/muse";
+ }
+ else {
+ museGlobalLib = museGlobal + "/lib";
+ museGlobalShare = museGlobal + "/share";
+ }
+ museProject = museProjectInitPath; //getcwd(0, 0);
+ configName = QString(getenv("HOME")) + QString("/.MusE");
+
+ museInstruments = museGlobalShare + QString("/instruments");
+
+ const char* ins = getenv("MUSEINSTRUMENTS");
+ if(ins)
+ museUserInstruments = QString(ins);
+ if(museUserInstruments.isEmpty())
+ museUserInstruments = museUser + QString("/muse_instruments");
+
+#ifdef HAVE_LASH
+ lash_args_t * lash_args = 0;
+ if(useLASH)
+ lash_args = lash_extract_args (&argc, &argv);
+#endif
+
+ srand(time(0)); // initialize random number generator
+// signal(SIGCHLD, catchSignal); // interferes with initVST()
+ initMidiController();
+ QApplication::setColorSpec(QApplication::ManyColor);
+ MuseApplication app(argc, argv);
+
+ initShortCuts();
+ readConfiguration();
+
+ if (config.useDenormalBias)
+ printf("Denormal protection enabled.\n");
+ // SHOW MUSE SPLASH SCREEN
+ if (config.showSplashScreen) {
+ QPixmap splsh(museGlobalShare + "/splash.png");
+
+ if (!splsh.isNull()) {
+ QSplashScreen* muse_splash = new QSplashScreen(splsh,
+ Qt::WStyle_StaysOnTop | Qt::WDestructiveClose);
+ muse_splash->show();
+ QTimer* stimer = new QTimer(0);
+ muse_splash->connect(stimer, SIGNAL(timeout()), muse_splash, SLOT(close()));
+ stimer->start(6000, true);
+ }
+ }
+ int i;
+
+ QString optstr("ahvdDmMsP:Y:py");
+#ifdef VST_SUPPORT
+ optstr += QString("V");
+#endif
+#ifdef DSSI_SUPPORT
+ optstr += QString("I");
+#endif
+#ifdef HAVE_LASH
+ optstr += QString("L");
+#endif
+
+//#ifdef VST_SUPPORT
+// while ((i = getopt(argc, argv, "ahvdDmMsVP:py")) != EOF) {
+//#else
+// while ((i = getopt(argc, argv, "ahvdDmMsP:py")) != EOF) {
+//#endif
+
+ while ((i = getopt(argc, argv, optstr.latin1())) != EOF) {
+ char c = (char)i;
+ switch (c) {
+ case 'v': printVersion(argv[0]); return 0;
+ case 'd':
+ debugMode = true;
+ realTimeScheduling = false;
+ break;
+ case 'a':
+ noAudio = true;
+ break;
+ case 'D': debugMsg = true; break;
+ case 'm': midiInputTrace = true; break;
+ case 'M': midiOutputTrace = true; break;
+ case 's': debugSync = true; break;
+ case 'P': realTimePriority = atoi(optarg); break;
+ case 'Y': midiRTPrioOverride = atoi(optarg); break;
+ case 'p': loadPlugins = false; break;
+ case 'V': loadVST = false; break;
+ case 'I': loadDSSI = false; break;
+ case 'L': useLASH = false; break;
+ case 'y': usePythonBridge = true; break;
+ case 'h': usage(argv[0], argv[1]); return -1;
+ default: usage(argv[0], "bad argument"); return -1;
+ }
+ }
+
+ AL::initDsp();
+
+ if (debugMsg)
+ printf("Start euid: %d ruid: %d, Now euid %d\n",
+ euid, ruid, geteuid());
+ if (debugMode) {
+ initDummyAudio();
+ realTimeScheduling = false;
+ }
+ else if (noAudio) {
+ initDummyAudio();
+ realTimeScheduling = true;
+ //if (debugMode) { // ??
+ // realTimeScheduling = false;
+ // }
+ }
+ else if (initJackAudio()) {
+ if (!debugMode)
+ {
+ QMessageBox::critical(NULL, "MusE fatal error", "MusE <b>failed</b> to find a <b>Jack audio server</b>.<br><br>"
+ "<i>MusE will continue without audio support (-a switch)!</i><br><br>"
+ "If this was not intended check that Jack was started. "
+ "If Jack <i>was</i> started check that it was\n"
+ "started as the same user as MusE.\n");
+
+ initDummyAudio();
+ noAudio = true;
+ realTimeScheduling = true;
+ if (debugMode) {
+ realTimeScheduling = false;
+ }
+ }
+ else
+ {
+ fprintf(stderr, "fatal error: no JACK audio server found\n");
+ fprintf(stderr, "no audio functions available\n");
+ fprintf(stderr, "*** experimental mode -- no play possible ***\n");
+ initDummyAudio();
+ //realTimeScheduling = audioDevice->isRealtime();
+ }
+ realTimeScheduling = true;
+ }
+ else
+ realTimeScheduling = audioDevice->isRealtime();
+
+ useJackTransport.setValue(true);
+ // setup the prefetch fifo length now that the segmentSize is known
+ // Changed by Tim. p3.3.17
+ // Changed to 4 *, JUST FOR TEST!!!
+ fifoLength = 131072/segmentSize;
+ //fifoLength = (131072/segmentSize) * 4;
+
+
+ argc -= optind;
+ ++argc;
+
+ if (debugMsg) {
+ printf("global lib: <%s>\n", museGlobalLib.latin1());
+ printf("global share: <%s>\n", museGlobalShare.latin1());
+ printf("muse home: <%s>\n", museUser.latin1());
+ printf("project dir: <%s>\n", museProject.latin1());
+ printf("user instruments: <%s>\n", museUserInstruments.latin1());
+ }
+
+ static QTranslator translator(0);
+ QString locale(QTextCodec::locale());
+ if (locale != "C") {
+ QString loc("muse_");
+ loc += QString(QTextCodec::locale());
+ if (translator.load(loc, QString(".")) == false) {
+ QString lp(museGlobalShare);
+ lp += QString("/locale");
+ if (translator.load(loc, lp) == false) {
+ printf("no locale <%s>/<%s>\n", loc.latin1(), lp.latin1());
+ }
+ }
+ app.installTranslator(&translator);
+ }
+
+ if (locale == "de") {
+ printf("locale de\n");
+ hIsB = false;
+ }
+
+ if (loadPlugins)
+ initPlugins();
+
+ if (loadVST)
+ initVST();
+
+ if(loadDSSI)
+ initDSSI();
+
+ // p3.3.39
+ initOSC();
+
+ initIcons();
+
+ initMetronome();
+ //QApplication::clipboard()->setSelectionMode(false); ddskrjo
+
+ QApplication::addLibraryPath(museGlobalLib + "/qtplugins");
+ if (debugMsg) {
+ QStringList list = app.libraryPaths();
+ QStringList::Iterator it = list.begin();
+ printf("QtLibraryPath:\n");
+ while(it != list.end()) {
+ printf(" <%s>\n", (*it).latin1());
+ ++it;
+ }
+ }
+
+ muse = new MusE(argc, &argv[optind]);
+ app.setMuse(muse);
+ muse->setIcon(*museIcon);
+ // Added by Tim. p3.3.22
+ if (!debugMode) {
+ if (mlockall(MCL_CURRENT | MCL_FUTURE))
+ perror("WARNING: Cannot lock memory:");
+ }
+
+ muse->show();
+ muse->seqStart();
+
+#ifdef HAVE_LASH
+ {
+ if(useLASH)
+ {
+ int lash_flags = LASH_Config_File;
+ const char *muse_name = PACKAGE_NAME;
+ lash_client = lash_init (lash_args, muse_name, lash_flags, LASH_PROTOCOL(2,0));
+ lash_alsa_client_id (lash_client, snd_seq_client_id (alsaSeq));
+ if (!noAudio) {
+ // p3.3.38
+ //char *jack_name = ((JackAudioDevice*)audioDevice)->getJackName();
+ const char *jack_name = audioDevice->clientName();
+ lash_jack_client_name (lash_client, jack_name);
+ }
+ }
+ }
+#endif /* HAVE_LASH */
+ QTimer::singleShot(100, muse, SLOT(showDidYouKnowDialog()));
+
+ return app.exec();
+ // p3.3.47
+ //int rv = app.exec();
+ // FIXME: Can't do, seg fault at MarkerView::~MarkerView()
+ // due to already deleted undoRedo.
+ //delete muse;
+ //return rv;
+
+ }
+
+#if 0
+//---------------------------------------------------------
+// configPart
+//---------------------------------------------------------
+
+void MusE::configPart(int id)
+ {
+ if (id < 3) {
+ partConfig->setItemChecked(0, id == 0);
+ partConfig->setItemChecked(1, id == 1);
+ partConfig->setItemChecked(2, id == 2);
+ arranger->setShowPartType(id);
+ for (int i = 3; i < 10; ++i) {
+ partConfig->setItemEnabled(i, id == 2);
+ }
+ }
+ else {
+ bool flag = !partConfig->isItemChecked(id);
+ partConfig->setItemChecked(id, flag);
+ int val = arranger->showPartEvent();
+ if (flag) {
+ val |= 1 << (id-3);
+ }
+ else {
+ val &= ~(1 << (id-3));
+ }
+ arranger->setShowPartEvent(val);
+ }
+ }
+#endif
+
+//---------------------------------------------------------
+// cmd
+// some cmd's from pulldown menu
+//---------------------------------------------------------
+
+void MusE::cmd(int cmd)
+ {
+ TrackList* tracks = song->tracks();
+ int l = song->lpos();
+ int r = song->rpos();
+
+ switch(cmd) {
+ case CMD_CUT:
+ arranger->cmd(Arranger::CMD_CUT_PART);
+ break;
+ case CMD_COPY:
+ arranger->cmd(Arranger::CMD_COPY_PART);
+ break;
+ case CMD_PASTE:
+ arranger->cmd(Arranger::CMD_PASTE_PART);
+ break;
+ case CMD_PASTE_CLONE:
+ arranger->cmd(Arranger::CMD_PASTE_CLONE_PART);
+ break;
+ case CMD_PASTE_TO_TRACK:
+ arranger->cmd(Arranger::CMD_PASTE_PART_TO_TRACK);
+ break;
+ case CMD_PASTE_CLONE_TO_TRACK:
+ arranger->cmd(Arranger::CMD_PASTE_CLONE_PART_TO_TRACK);
+ break;
+ case CMD_INSERT:
+ arranger->cmd(Arranger::CMD_INSERT_PART);
+ break;
+ case CMD_INSERTMEAS:
+ arranger->cmd(Arranger::CMD_INSERT_EMPTYMEAS);
+ break;
+ case CMD_DELETE:
+ song->startUndo();
+ if (song->msgRemoveParts()) {
+ song->endUndo(SC_PART_REMOVED);
+ break;
+ }
+ else
+ audio->msgRemoveTracks();
+ song->endUndo(SC_TRACK_REMOVED);
+ break;
+ case CMD_DELETE_TRACK:
+ song->startUndo();
+ audio->msgRemoveTracks();
+ song->endUndo(SC_TRACK_REMOVED);
+ audio->msgUpdateSoloStates();
+ break;
+
+ case CMD_SELECT_ALL:
+ case CMD_SELECT_NONE:
+ case CMD_SELECT_INVERT:
+ case CMD_SELECT_ILOOP:
+ case CMD_SELECT_OLOOP:
+ for (iTrack i = tracks->begin(); i != tracks->end(); ++i) {
+ PartList* parts = (*i)->parts();
+ for (iPart p = parts->begin(); p != parts->end(); ++p) {
+ bool f = false;
+ int t1 = p->second->tick();
+ int t2 = t1 + p->second->lenTick();
+ bool inside =
+ ((t1 >= l) && (t1 < r))
+ || ((t2 > l) && (t2 < r))
+ || ((t1 <= l) && (t2 > r));
+ switch(cmd) {
+ case CMD_SELECT_INVERT:
+ f = !p->second->selected();
+ break;
+ case CMD_SELECT_NONE:
+ f = false;
+ break;
+ case CMD_SELECT_ALL:
+ f = true;
+ break;
+ case CMD_SELECT_ILOOP:
+ f = inside;
+ break;
+ case CMD_SELECT_OLOOP:
+ f = !inside;
+ break;
+ }
+ p->second->setSelected(f);
+ }
+ }
+ song->update();
+ break;
+
+ case CMD_SELECT_PARTS:
+ for (iTrack i = tracks->begin(); i != tracks->end(); ++i) {
+ if (!(*i)->selected())
+ continue;
+ PartList* parts = (*i)->parts();
+ for (iPart p = parts->begin(); p != parts->end(); ++p)
+ p->second->setSelected(true);
+ }
+ song->update();
+ break;
+ case CMD_FOLLOW_NO:
+ song->setFollow(Song::NO);
+ setFollow();
+ break;
+ case CMD_FOLLOW_JUMP:
+ song->setFollow(Song::JUMP);
+ setFollow();
+ break;
+ case CMD_FOLLOW_CONTINUOUS:
+ song->setFollow(Song::CONTINUOUS);
+ setFollow();
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// clipboardChanged
+//---------------------------------------------------------
+
+void MusE::clipboardChanged()
+ {
+ Q3CString subtype("partlist");
+ QMimeSource* ms = QApplication::clipboard()->data(QClipboard::Clipboard);
+ if (ms == 0)
+ return;
+ bool flag = false;
+ for (int i = 0; ms->format(i); ++i) {
+// printf("Format <%s\n", ms->format(i));
+ if ((strncmp(ms->format(i), "text/midipartlist", 17) == 0)
+ || (strncmp(ms->format(i), "text/wavepartlist", 17) == 0)
+ // Added by T356. Support mixed .mpt files.
+ || (strncmp(ms->format(i), "text/mixedpartlist", 18) == 0)) {
+ flag = true;
+ break;
+ }
+ }
+ menuEdit->setItemEnabled(CMD_PASTE, flag);
+ menuEdit->setItemEnabled(CMD_INSERT, flag);
+ menuEdit->setItemEnabled(CMD_PASTE_CLONE, flag);
+ menuEdit->setItemEnabled(CMD_PASTE_TO_TRACK, flag);
+ menuEdit->setItemEnabled(CMD_PASTE_CLONE_TO_TRACK, flag);
+ }
+
+//---------------------------------------------------------
+// selectionChanged
+//---------------------------------------------------------
+
+void MusE::selectionChanged()
+ {
+ bool flag = arranger->isSingleSelection();
+ menuEdit->setItemEnabled(CMD_CUT, flag);
+ //menuEdit->setItemEnabled(CMD_COPY, flag); // Now possible
+ }
+
+//---------------------------------------------------------
+// transpose
+//---------------------------------------------------------
+
+void MusE::transpose()
+ {
+ Transpose *w = new Transpose();
+ w->show();
+ }
+
+//---------------------------------------------------------
+// modifyGateTime
+//---------------------------------------------------------
+
+void MusE::modifyGateTime()
+ {
+ GateTime* w = new GateTime(this);
+ w->show();
+ }
+
+//---------------------------------------------------------
+// modifyVelocity
+//---------------------------------------------------------
+
+void MusE::modifyVelocity()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// crescendo
+//---------------------------------------------------------
+
+void MusE::crescendo()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// thinOut
+//---------------------------------------------------------
+
+void MusE::thinOut()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// eraseEvent
+//---------------------------------------------------------
+
+void MusE::eraseEvent()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// noteShift
+//---------------------------------------------------------
+
+void MusE::noteShift()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// moveClock
+//---------------------------------------------------------
+
+void MusE::moveClock()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// copyMeasure
+//---------------------------------------------------------
+
+void MusE::copyMeasure()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// eraseMeasure
+//---------------------------------------------------------
+
+void MusE::eraseMeasure()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// deleteMeasure
+//---------------------------------------------------------
+
+void MusE::deleteMeasure()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// createMeasure
+//---------------------------------------------------------
+
+void MusE::createMeasure()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// mixTrack
+//---------------------------------------------------------
+
+void MusE::mixTrack()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// configAppearance
+//---------------------------------------------------------
+
+void MusE::configAppearance()
+ {
+ if (!appearance)
+ appearance = new Appearance(arranger);
+ appearance->resetValues();
+ if(appearance->isVisible()) {
+ appearance->raise();
+ appearance->setActiveWindow();
+ }
+ else
+ appearance->show();
+ }
+
+//---------------------------------------------------------
+// loadTheme
+//---------------------------------------------------------
+
+void MusE::loadTheme(QString s)
+ {
+ if (style()->name() != s)
+ QApplication::setStyle(s);
+ }
+
+//---------------------------------------------------------
+// configChanged
+// - called whenever configuration has changed
+// - when configuration has changed by user, call with
+// writeFlag=true to save configuration in ~/.MusE
+//---------------------------------------------------------
+
+void MusE::changeConfig(bool writeFlag)
+ {
+ if (writeFlag)
+ writeGlobalConfiguration();
+ loadTheme(config.style);
+ QApplication::setFont(config.fonts[0], true);
+ // Added by Tim. p3.3.6
+ //printf("MusE::changeConfig writeFlag:%d emitting configChanged\n", writeFlag);
+
+ emit configChanged();
+ updateConfiguration();
+ }
+
+//---------------------------------------------------------
+// configMetronome
+//---------------------------------------------------------
+
+void MusE::configMetronome()
+ {
+ if (!metronomeConfig)
+ metronomeConfig = new MetronomeConfig(this, "metronome");
+
+ if(metronomeConfig->isVisible()) {
+ metronomeConfig->raise();
+ metronomeConfig->setActiveWindow();
+ }
+ else
+ metronomeConfig->show();
+ }
+
+
+//---------------------------------------------------------
+// configShortCuts
+//---------------------------------------------------------
+
+void MusE::configShortCuts()
+ {
+ if (!shortcutConfig)
+ shortcutConfig = new ShortcutConfig(this, "shortcutconfig");
+ shortcutConfig->_config_changed = false;
+ if (shortcutConfig->exec())
+ changeConfig(true);
+ }
+
+//---------------------------------------------------------
+// globalCut
+// - remove area between left and right locator
+// - do not touch muted track
+// - cut master track
+//---------------------------------------------------------
+
+void MusE::globalCut()
+ {
+ int lpos = song->lpos();
+ int rpos = song->rpos();
+ if ((lpos - rpos) >= 0)
+ return;
+
+ song->startUndo();
+ TrackList* tracks = song->tracks();
+ for (iTrack it = tracks->begin(); it != tracks->end(); ++it) {
+ MidiTrack* track = dynamic_cast<MidiTrack*>(*it);
+ if (track == 0 || track->mute())
+ continue;
+ PartList* pl = track->parts();
+ for (iPart p = pl->begin(); p != pl->end(); ++p) {
+ Part* part = p->second;
+ int t = part->tick();
+ int l = part->lenTick();
+ if (t + l <= lpos)
+ continue;
+ if ((t >= lpos) && ((t+l) <= rpos)) {
+ audio->msgRemovePart(part, false);
+ }
+ else if ((t < lpos) && ((t+l) > lpos) && ((t+l) <= rpos)) {
+ // remove part tail
+ int len = lpos - t;
+ MidiPart* nPart = new MidiPart(*(MidiPart*)part);
+ nPart->setLenTick(len);
+ //
+ // cut Events in nPart
+ EventList* el = nPart->events();
+ iEvent ie = el->lower_bound(t + len);
+ for (; ie != el->end();) {
+ iEvent i = ie;
+ ++ie;
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgDeleteEvent(i->second, nPart, false);
+ audio->msgDeleteEvent(i->second, nPart, false, false, false);
+ }
+ // Indicate no undo, and do port controller values and clone parts.
+ //audio->msgChangePart(part, nPart, false);
+ audio->msgChangePart(part, nPart, false, true, true);
+ }
+ else if ((t < lpos) && ((t+l) > lpos) && ((t+l) > rpos)) {
+ //----------------------
+ // remove part middle
+ //----------------------
+
+ MidiPart* nPart = new MidiPart(*(MidiPart*)part);
+ EventList* el = nPart->events();
+ iEvent is = el->lower_bound(lpos);
+ iEvent ie = el->upper_bound(rpos);
+ for (iEvent i = is; i != ie;) {
+ iEvent ii = i;
+ ++i;
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgDeleteEvent(ii->second, nPart, false);
+ audio->msgDeleteEvent(ii->second, nPart, false, false, false);
+ }
+
+ ie = el->lower_bound(rpos);
+ for (; ie != el->end();) {
+ iEvent i = ie;
+ ++ie;
+ Event event = i->second;
+ Event nEvent = event.clone();
+ nEvent.setTick(nEvent.tick() - (rpos-lpos));
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, nEvent, nPart, false);
+ audio->msgChangeEvent(event, nEvent, nPart, false, false, false);
+ }
+ nPart->setLenTick(l - (rpos-lpos));
+ // Indicate no undo, and do port controller values and clone parts.
+ //audio->msgChangePart(part, nPart, false);
+ audio->msgChangePart(part, nPart, false, true, true);
+ }
+ else if ((t >= lpos) && (t < rpos) && (t+l) > rpos) {
+ // TODO: remove part head
+ }
+ else if (t >= rpos) {
+ MidiPart* nPart = new MidiPart(*(MidiPart*)part);
+ int nt = part->tick();
+ nPart->setTick(nt - (rpos -lpos));
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(part, nPart, false);
+ audio->msgChangePart(part, nPart, false, true, false);
+ }
+ }
+ }
+ // TODO: cut tempo track
+ // TODO: process marker
+ song->endUndo(SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_REMOVED);
+ }
+
+//---------------------------------------------------------
+// globalInsert
+// - insert empty space at left locator position upto
+// right locator
+// - do not touch muted track
+// - insert in master track
+//---------------------------------------------------------
+
+void MusE::globalInsert()
+ {
+ unsigned lpos = song->lpos();
+ unsigned rpos = song->rpos();
+ if (lpos >= rpos)
+ return;
+
+ song->startUndo();
+ TrackList* tracks = song->tracks();
+ for (iTrack it = tracks->begin(); it != tracks->end(); ++it) {
+ MidiTrack* track = dynamic_cast<MidiTrack*>(*it);
+ //
+ // process only non muted midi tracks
+ //
+ if (track == 0 || track->mute())
+ continue;
+ PartList* pl = track->parts();
+ for (iPart p = pl->begin(); p != pl->end(); ++p) {
+ Part* part = p->second;
+ unsigned t = part->tick();
+ int l = part->lenTick();
+ if (t + l <= lpos)
+ continue;
+ if (lpos >= t && lpos < (t+l)) {
+ MidiPart* nPart = new MidiPart(*(MidiPart*)part);
+ nPart->setLenTick(l + (rpos-lpos));
+ EventList* el = nPart->events();
+
+ iEvent i = el->end();
+ while (i != el->begin()) {
+ --i;
+ if (i->first < lpos)
+ break;
+ Event event = i->second;
+ Event nEvent = i->second.clone();
+ nEvent.setTick(nEvent.tick() + (rpos-lpos));
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, nEvent, nPart, false);
+ audio->msgChangeEvent(event, nEvent, nPart, false, false, false);
+ }
+ // Indicate no undo, and do port controller values and clone parts.
+ //audio->msgChangePart(part, nPart, false);
+ audio->msgChangePart(part, nPart, false, true, true);
+ }
+ else if (t > lpos) {
+ MidiPart* nPart = new MidiPart(*(MidiPart*)part);
+ nPart->setTick(t + (rpos -lpos));
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(part, nPart, false);
+ audio->msgChangePart(part, nPart, false, true, false);
+ }
+ }
+ }
+ // TODO: process tempo track
+ // TODO: process marker
+ song->endUndo(SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_REMOVED);
+ }
+
+//---------------------------------------------------------
+// globalSplit
+// - split all parts at the song position pointer
+// - do not touch muted track
+//---------------------------------------------------------
+
+void MusE::globalSplit()
+ {
+ int pos = song->cpos();
+ song->startUndo();
+ TrackList* tracks = song->tracks();
+ for (iTrack it = tracks->begin(); it != tracks->end(); ++it) {
+ Track* track = *it;
+ PartList* pl = track->parts();
+ for (iPart p = pl->begin(); p != pl->end(); ++p) {
+ Part* part = p->second;
+ int p1 = part->tick();
+ int l0 = part->lenTick();
+ if (pos > p1 && pos < (p1+l0)) {
+ Part* p1;
+ Part* p2;
+ track->splitPart(part, pos, p1, p2);
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(part, p1, false);
+ audio->msgChangePart(part, p1, false, true, false);
+ audio->msgAddPart(p2, false);
+ break;
+ }
+ }
+ }
+ song->endUndo(SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_INSERTED);
+ }
+
+//---------------------------------------------------------
+// copyRange
+// - copy space between left and right locator position
+// to song position pointer
+// - dont process muted tracks
+// - create a new part for every track containing the
+// copied events
+//---------------------------------------------------------
+
+void MusE::copyRange()
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Copy Range"),
+ tr("not implemented")
+ );
+ }
+
+//---------------------------------------------------------
+// cutEvents
+// - make sure that all events in a part end where the
+// part ends
+// - process only marked parts
+//---------------------------------------------------------
+
+void MusE::cutEvents()
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Cut Events"),
+ tr("not implemented")
+ );
+ }
+
+//---------------------------------------------------------
+// checkRegionNotNull
+// return true if (rPos - lPos) <= 0
+//---------------------------------------------------------
+
+bool MusE::checkRegionNotNull()
+ {
+ int start = song->lPos().frame();
+ int end = song->rPos().frame();
+ if (end - start <= 0) {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce"),
+ tr("set left/right marker for bounce range")
+ );
+ return true;
+ }
+ return false;
+ }
+
+#if 0
+//---------------------------------------------------------
+// openAudioFileManagement
+//---------------------------------------------------------
+void MusE::openAudioFileManagement()
+ {
+ if (!audioFileManager) {
+ audioFileManager = new AudioFileManager(this, "audiofilemanager", false);
+ audioFileManager->show();
+ }
+ audioFileManager->setShown(true);
+ }
+#endif
+//---------------------------------------------------------
+// bounceToTrack
+//---------------------------------------------------------
+
+void MusE::bounceToTrack()
+ {
+ if(audio->bounce())
+ return;
+
+ song->bounceOutput = 0;
+
+ if(song->waves()->empty())
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce to Track"),
+ tr("No wave tracks found")
+ );
+ return;
+ }
+
+ OutputList* ol = song->outputs();
+ if(ol->empty())
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce to Track"),
+ tr("No audio output tracks found")
+ );
+ return;
+ }
+
+ if(checkRegionNotNull())
+ return;
+
+ AudioOutput* out = 0;
+ // If only one output, pick it, else pick the first selected.
+ if(ol->size() == 1)
+ out = ol->front();
+ else
+ {
+ for(iAudioOutput iao = ol->begin(); iao != ol->end(); ++iao)
+ {
+ AudioOutput* o = *iao;
+ if(o->selected())
+ {
+ if(out)
+ {
+ out = 0;
+ break;
+ }
+ out = o;
+ }
+ }
+ if(!out)
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce to Track"),
+ tr("Select one audio output track,\nand one target wave track")
+ );
+ return;
+ }
+ }
+
+ // search target track
+ TrackList* tl = song->tracks();
+ WaveTrack* track = 0;
+
+ for (iTrack it = tl->begin(); it != tl->end(); ++it) {
+ Track* t = *it;
+ if (t->selected()) {
+ if(t->type() != Track::WAVE && t->type() != Track::AUDIO_OUTPUT) {
+ track = 0;
+ break;
+ }
+ if(t->type() == Track::WAVE)
+ {
+ if(track)
+ {
+ track = 0;
+ break;
+ }
+ track = (WaveTrack*)t;
+ }
+
+ }
+ }
+
+ if (track == 0) {
+ if(ol->size() == 1) {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce to Track"),
+ tr("Select one target wave track")
+ );
+ return;
+ }
+ else
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce to Track"),
+ tr("Select one target wave track,\nand one audio output track")
+ );
+ return;
+ }
+ }
+ song->bounceOutput = out;
+ song->bounceTrack = track;
+ song->setRecord(true);
+ song->setRecordFlag(track, true);
+ audio->msgBounce();
+ }
+
+//---------------------------------------------------------
+// bounceToFile
+//---------------------------------------------------------
+
+void MusE::bounceToFile(AudioOutput* ao)
+ {
+ if(audio->bounce())
+ return;
+ song->bounceOutput = 0;
+ if(!ao)
+ {
+ OutputList* ol = song->outputs();
+ if(ol->empty())
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce to Track"),
+ tr("No audio output tracks found")
+ );
+ return;
+ }
+ // If only one output, pick it, else pick the first selected.
+ if(ol->size() == 1)
+ ao = ol->front();
+ else
+ {
+ for(iAudioOutput iao = ol->begin(); iao != ol->end(); ++iao)
+ {
+ AudioOutput* o = *iao;
+ if(o->selected())
+ {
+ if(ao)
+ {
+ ao = 0;
+ break;
+ }
+ ao = o;
+ }
+ }
+ if (ao == 0) {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce to File"),
+ tr("Select one audio output track")
+ );
+ return;
+ }
+ }
+ }
+
+ if (checkRegionNotNull())
+ return;
+
+ SndFile* sf = getSndFile(0, this, 0);
+ if (sf == 0)
+ return;
+
+ song->bounceOutput = ao;
+ ao->setRecFile(sf);
+ song->setRecord(true, false);
+ song->setRecordFlag(ao, true);
+ audio->msgBounce();
+ }
+
+#ifdef HAVE_LASH
+//---------------------------------------------------------
+// lash_idle_cb
+//---------------------------------------------------------
+#include <iostream>
+void
+MusE::lash_idle_cb ()
+{
+ lash_event_t * event;
+ if (!lash_client)
+ return;
+
+ while ( (event = lash_get_event (lash_client)) )
+ {
+ switch (lash_event_get_type (event))
+ {
+ case LASH_Save_File:
+ {
+ /* save file */
+ QString ss = QString(lash_event_get_string(event)) + QString("/lash-project-muse.med");
+ int ok = save (ss.ascii(), false);
+ if (ok) {
+ project.setFile(ss.ascii());
+ setCaption(tr("MusE: Song: ") + project.baseName(true));
+ addProject(ss.ascii());
+ museProject = QFileInfo(ss.ascii()).dirPath(true);
+ }
+ lash_send_event (lash_client, event);
+ }
+ break;
+
+ case LASH_Restore_File:
+ {
+ /* load file */
+ QString sr = QString(lash_event_get_string(event)) + QString("/lash-project-muse.med");
+ loadProjectFile(sr.ascii(), false, true);
+ lash_send_event (lash_client, event);
+ }
+ break;
+
+ case LASH_Quit:
+ {
+ /* quit muse */
+ std::cout << "MusE::lash_idle_cb Received LASH_Quit"
+ << std::endl;
+ lash_event_destroy (event);
+ }
+ break;
+
+ default:
+ {
+ std::cout << "MusE::lash_idle_cb Received unknown LASH event of type "
+ << lash_event_get_type (event)
+ << std::endl;
+ lash_event_destroy (event);
+ }
+ break;
+ }
+ }
+}
+#endif /* HAVE_LASH */
+
+//---------------------------------------------------------
+// clearSong
+// return true if operation aborted
+// called with sequencer stopped
+//---------------------------------------------------------
+
+bool MusE::clearSong()
+ {
+ if (song->dirty) {
+ int n = 0;
+ n = QMessageBox::warning(this, appName,
+ tr("The current Project contains unsaved data\n"
+ "Load overwrites current Project:\n"
+ "Save Current Project?"),
+ tr("&Save"), tr("&Skip"), tr("&Abort"), 0, 2);
+ switch (n) {
+ case 0:
+ if (!save()) // abort if save failed
+ return true;
+ break;
+ case 1:
+ break;
+ case 2:
+ return true;
+ default:
+ printf("InternalError: gibt %d\n", n);
+ }
+ }
+ if (audio->isPlaying()) {
+ audio->msgPlay(false);
+ while (audio->isPlaying())
+ qApp->processEvents();
+ }
+
+again:
+ for (iToplevel i = toplevels.begin(); i != toplevels.end(); ++i) {
+ Toplevel tl = *i;
+ unsigned long obj = tl.object();
+ switch (tl.type()) {
+ case Toplevel::CLIPLIST:
+ case Toplevel::MARKER:
+ break;
+ case Toplevel::PIANO_ROLL:
+ case Toplevel::LISTE:
+ case Toplevel::DRUM:
+ case Toplevel::MASTER:
+ case Toplevel::WAVE:
+ case Toplevel::LMASTER:
+ ((QWidget*)(obj))->close(true);
+ goto again;
+ }
+ }
+ song->clear(false);
+ return false;
+ }
+
+//---------------------------------------------------------
+// startEditInstrument
+//---------------------------------------------------------
+
+void MusE::startEditInstrument()
+ {
+ if(editInstrument == 0)
+ {
+ editInstrument = new EditInstrument(this);
+ editInstrument->show();
+ }
+ else
+ {
+ if(editInstrument->isShown())
+ editInstrument->hide();
+ else
+ editInstrument->show();
+ }
+
+ }
+
+//---------------------------------------------------------
+// switchMixerAutomation
+//---------------------------------------------------------
+
+void MusE::switchMixerAutomation()
+ {
+ automation = !automation;
+ // Clear all pressed and touched and rec event lists.
+ song->clearRecAutomation(true);
+
+printf("automation = %d\n", automation);
+ menuAutomation->setItemChecked(autoId, automation);
+ }
+
+//---------------------------------------------------------
+// clearAutomation
+//---------------------------------------------------------
+
+void MusE::clearAutomation()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// takeAutomationSnapshot
+//---------------------------------------------------------
+
+void MusE::takeAutomationSnapshot()
+ {
+ int frame = song->cPos().frame();
+ TrackList* tracks = song->tracks();
+ for (iTrack i = tracks->begin(); i != tracks->end(); ++i) {
+ if ((*i)->isMidiTrack())
+ continue;
+ AudioTrack* track = (AudioTrack*)*i;
+ CtrlListList* cll = track->controller();
+ for (iCtrlList icl = cll->begin(); icl != cll->end(); ++icl) {
+ double val = icl->second->curVal();
+ icl->second->add(frame, val);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// updateConfiguration
+// called whenever the configuration has changed
+//---------------------------------------------------------
+
+void MusE::updateConfiguration()
+ {
+ fileOpenAction->setAccel(shortcuts[SHRT_OPEN].key);
+ fileNewAction->setAccel(shortcuts[SHRT_NEW].key);
+ fileSaveAction->setAccel(shortcuts[SHRT_SAVE].key);
+
+ menu_file->setAccel(shortcuts[SHRT_OPEN_RECENT].key, menu_ids[CMD_OPEN_RECENT]);
+ menu_file->setAccel(shortcuts[SHRT_LOAD_TEMPLATE].key, menu_ids[CMD_LOAD_TEMPLATE]);
+ menu_file->setAccel(shortcuts[SHRT_SAVE_AS].key, menu_ids[CMD_SAVE_AS]);
+ menu_file->setAccel(shortcuts[SHRT_IMPORT_MIDI].key, menu_ids[CMD_IMPORT_MIDI]);
+ menu_file->setAccel(shortcuts[SHRT_EXPORT_MIDI].key, menu_ids[CMD_EXPORT_MIDI]);
+ menu_file->setAccel(shortcuts[SHRT_IMPORT_PART].key, menu_ids[CMD_IMPORT_PART]);
+ menu_file->setAccel(shortcuts[SHRT_IMPORT_AUDIO].key, menu_ids[CMD_IMPORT_AUDIO]);
+ menu_file->setAccel(shortcuts[SHRT_QUIT].key, menu_ids[CMD_QUIT]);
+
+ menuEdit->setAccel(Qt::Key_Delete, CMD_DELETE);
+ menuEdit->setAccel(shortcuts[SHRT_OPEN_DRUMS].key, menu_ids[CMD_OPEN_DRUMS]);
+ menuEdit->setAccel(shortcuts[SHRT_OPEN_LIST].key, menu_ids[CMD_OPEN_LIST]);
+ menuEdit->setAccel(shortcuts[SHRT_OPEN_WAVE].key, menu_ids[CMD_OPEN_WAVE]);
+ menuEdit->setAccel(shortcuts[SHRT_OPEN_MIDI_TRANSFORM].key, menu_ids[CMD_OPEN_MIDI_TRANSFORM]);
+
+ midiEdit->setAccel(shortcuts[SHRT_TRANSPOSE].key, menu_ids[CMD_TRANSPOSE]);
+
+ master->setAccel(shortcuts[SHRT_OPEN_GRAPHIC_MASTER].key, menu_ids[CMD_OPEN_GRAPHIC_MASTER]);
+ master->setAccel(shortcuts[SHRT_OPEN_LIST_MASTER].key, menu_ids[CMD_OPEN_LIST_MASTER]);
+
+ menuStructure->setAccel(shortcuts[SHRT_GLOBAL_CUT].key, menu_ids[CMD_GLOBAL_CUT]);
+ menuStructure->setAccel(shortcuts[SHRT_GLOBAL_INSERT].key, menu_ids[CMD_GLOBAL_INSERT]);
+ menuStructure->setAccel(shortcuts[SHRT_GLOBAL_SPLIT].key, menu_ids[CMD_GLOBAL_SPLIT]);
+ menuStructure->setAccel(shortcuts[SHRT_COPY_RANGE].key, menu_ids[CMD_COPY_RANGE]);
+ menuStructure->setAccel(shortcuts[SHRT_CUT_EVENTS].key, menu_ids[CMD_CUT_EVENTS]);
+
+ menuView->setAccel(shortcuts[SHRT_OPEN_TRANSPORT].key, tr_id);
+ menuView->setAccel(shortcuts[SHRT_OPEN_BIGTIME].key, bt_id);
+ //menuView->setAccel(shortcuts[SHRT_OPEN_MIXER].key, aid1);
+ menuView->setAccel(shortcuts[SHRT_OPEN_MIXER].key, aid1a);
+ menuView->setAccel(shortcuts[SHRT_OPEN_MIXER2].key, aid1b);
+// menuView->setAccel(shortcuts[SHRT_OPEN_CLIPS].key, aid2);
+// markerAction->setAccel(shortcuts[SHRT_OPEN_MARKER].key );
+ menuView->setAccel(shortcuts[SHRT_OPEN_MARKER].key, mr_id );
+
+ menuSettings->setAccel(shortcuts[SHRT_GLOBAL_CONFIG].key, menu_ids[CMD_GLOBAL_CONFIG]);
+ menuSettings->setAccel(shortcuts[SHRT_CONFIG_SHORTCUTS].key, menu_ids[CMD_CONFIG_SHORTCUTS]);
+ menuSettings->setAccel(shortcuts[SHRT_CONFIG_METRONOME].key, menu_ids[CMD_CONFIG_METRONOME]);
+ menuSettings->setAccel(shortcuts[SHRT_CONFIG_MIDISYNC].key, menu_ids[CMD_CONFIG_MIDISYNC]);
+ menuSettings->setAccel(shortcuts[SHRT_APPEARANCE_SETTINGS].key, menu_ids[CMD_APPEARANCE_SETTINGS]);
+ menuSettings->setAccel(shortcuts[SHRT_CONFIG_MIDI_PORTS].key, menu_ids[CMD_CONFIG_MIDI_PORTS]);
+ menuSettings->setAccel(shortcuts[SHRT_CONFIG_AUDIO_PORTS].key, menu_ids[CMD_CONFIG_AUDIO_PORTS]);
+
+// menu_functions->setAccel(shortcuts[SHRT_MIDI_EDIT_INSTRUMENTS].key, menu_ids[CMD_MIDI_EDIT_INSTRUMENTS]);
+ menu_functions->setAccel(shortcuts[SHRT_MIDI_RESET].key, menu_ids[CMD_MIDI_RESET]);
+ menu_functions->setAccel(shortcuts[SHRT_MIDI_INIT].key, menu_ids[CMD_MIDI_INIT]);
+ menu_functions->setAccel(shortcuts[SHRT_MIDI_LOCAL_OFF].key, menu_ids[CMD_MIDI_LOCAL_OFF]);
+
+ menu_audio->setAccel(shortcuts[SHRT_AUDIO_BOUNCE_TO_TRACK].key, menu_ids[CMD_AUDIO_BOUNCE_TO_TRACK]);
+ menu_audio->setAccel(shortcuts[SHRT_AUDIO_BOUNCE_TO_FILE].key , menu_ids[CMD_AUDIO_BOUNCE_TO_FILE]);
+ menu_audio->setAccel(shortcuts[SHRT_AUDIO_RESTART].key, menu_ids[CMD_AUDIO_RESTART]);
+
+ menuAutomation->setAccel(shortcuts[SHRT_MIXER_AUTOMATION].key, autoId);
+ menuAutomation->setAccel(shortcuts[SHRT_MIXER_SNAPSHOT].key, menu_ids[CMD_MIXER_SNAPSHOT]);
+ menuAutomation->setAccel(shortcuts[SHRT_MIXER_AUTOMATION_CLEAR].key, menu_ids[CMD_MIXER_AUTOMATION_CLEAR]);
+
+ menu_help->setAccel(menu_ids[CMD_OPEN_HELP], shortcuts[SHRT_OPEN_HELP].key);
+ menu_help->setAccel(menu_ids[CMD_START_WHATSTHIS], shortcuts[SHRT_START_WHATSTHIS].key);
+ pianoAction->setAccel(shortcuts[SHRT_OPEN_PIANO].key);
+
+ select->setAccel(shortcuts[SHRT_SELECT_ALL].key, CMD_SELECT_ALL);
+
+// select->setAccel(shortcuts[SHRT_DESEL_PARTS].key, CMD_SELECT_NONE);
+ select->setAccel(shortcuts[SHRT_SELECT_NONE].key, CMD_SELECT_NONE);
+
+ select->setAccel(shortcuts[SHRT_SELECT_INVERT].key, CMD_SELECT_INVERT);
+ select->setAccel(shortcuts[SHRT_SELECT_ILOOP].key, CMD_SELECT_ILOOP);
+ select->setAccel(shortcuts[SHRT_SELECT_OLOOP].key, CMD_SELECT_OLOOP);
+ select->setAccel(shortcuts[SHRT_SELECT_PRTSTRACK].key, CMD_SELECT_PARTS);
+ follow->setAccel(shortcuts[SHRT_FOLLOW_JUMP].key, CMD_FOLLOW_JUMP);
+ follow->setAccel(shortcuts[SHRT_FOLLOW_NO].key, CMD_FOLLOW_NO);
+ follow->setAccel(shortcuts[SHRT_FOLLOW_CONTINUOUS].key, CMD_FOLLOW_CONTINUOUS);
+ midiInputPlugins->setAccel(shortcuts[SHRT_MIDI_INPUT_TRANSPOSE].key, 0);
+ midiInputPlugins->setAccel(shortcuts[SHRT_MIDI_INPUT_TRANSFORM].key, 1);
+ midiInputPlugins->setAccel(shortcuts[SHRT_MIDI_INPUT_FILTER].key, 2);
+ midiInputPlugins->setAccel(shortcuts[SHRT_MIDI_REMOTE_CONTROL].key, 3);
+ midiInputPlugins->setAccel(shortcuts[SHRT_RANDOM_RHYTHM_GENERATOR].key, 4);
+
+ addTrack->setAccel(shortcuts[SHRT_ADD_MIDI_TRACK].key, Track::MIDI);
+ addTrack->setAccel(shortcuts[SHRT_ADD_DRUM_TRACK].key, Track::DRUM);
+ addTrack->setAccel(shortcuts[SHRT_ADD_WAVE_TRACK].key, Track::WAVE);
+ addTrack->setAccel(shortcuts[SHRT_ADD_AUDIO_OUTPUT].key, Track::AUDIO_OUTPUT);
+ addTrack->setAccel(shortcuts[SHRT_ADD_AUDIO_GROUP].key, Track::AUDIO_GROUP);
+ addTrack->setAccel(shortcuts[SHRT_ADD_AUDIO_INPUT].key, Track::AUDIO_INPUT);
+ addTrack->setAccel(shortcuts[SHRT_ADD_AUDIO_AUX].key, Track::AUDIO_AUX);
+ }
+
+//---------------------------------------------------------
+// showBigtime
+//---------------------------------------------------------
+
+void MusE::showBigtime(bool on)
+ {
+ if (on && bigtime == 0) {
+ bigtime = new BigTime(0);
+ bigtime->setPos(0, song->cpos(), false);
+ connect(song, SIGNAL(posChanged(int, unsigned, bool)), bigtime, SLOT(setPos(int, unsigned, bool)));
+ connect(muse, SIGNAL(configChanged()), bigtime, SLOT(configChanged()));
+ connect(bigtime, SIGNAL(closed()), SLOT(bigtimeClosed()));
+ bigtime->resize(config.geometryBigTime.size());
+ bigtime->move(config.geometryBigTime.topLeft());
+ }
+ if (bigtime)
+ bigtime->setShown(on);
+ menuView->setItemChecked(bt_id, on);
+ }
+
+//---------------------------------------------------------
+// toggleBigTime
+//---------------------------------------------------------
+
+void MusE::toggleBigTime()
+ {
+ showBigtime(!menuView->isItemChecked(bt_id));
+ }
+
+//---------------------------------------------------------
+// bigtimeClosed
+//---------------------------------------------------------
+
+void MusE::bigtimeClosed()
+ {
+ menuView->setItemChecked(bt_id, false);
+ }
+
+//---------------------------------------------------------
+// showMixer
+//---------------------------------------------------------
+
+/*
+void MusE::showMixer(bool on)
+ {
+ if (on && audioMixer == 0) {
+ audioMixer = new AudioMixerApp(this);
+ connect(audioMixer, SIGNAL(closed()), SLOT(mixerClosed()));
+ audioMixer->resize(config.geometryMixer.size());
+ audioMixer->move(config.geometryMixer.topLeft());
+ }
+ if (audioMixer)
+ audioMixer->setShown(on);
+ menuView->setItemChecked(aid1, on);
+ }
+*/
+
+//---------------------------------------------------------
+// showMixer1
+//---------------------------------------------------------
+
+void MusE::showMixer1(bool on)
+ {
+ if (on && mixer1 == 0) {
+ mixer1 = new AudioMixerApp(this, &(config.mixer1));
+ connect(mixer1, SIGNAL(closed()), SLOT(mixer1Closed()));
+ mixer1->resize(config.mixer1.geometry.size());
+ mixer1->move(config.mixer1.geometry.topLeft());
+ }
+ if (mixer1)
+ mixer1->setShown(on);
+ menuView->setItemChecked(aid1a, on);
+ }
+
+//---------------------------------------------------------
+// showMixer2
+//---------------------------------------------------------
+
+void MusE::showMixer2(bool on)
+ {
+ if (on && mixer2 == 0) {
+ mixer2 = new AudioMixerApp(this, &(config.mixer2));
+ connect(mixer2, SIGNAL(closed()), SLOT(mixer2Closed()));
+ mixer2->resize(config.mixer2.geometry.size());
+ mixer2->move(config.mixer2.geometry.topLeft());
+ }
+ if (mixer2)
+ mixer2->setShown(on);
+ menuView->setItemChecked(aid1b, on);
+ }
+
+//---------------------------------------------------------
+// toggleMixer
+//---------------------------------------------------------
+
+/*
+void MusE::toggleMixer()
+ {
+ showMixer(!menuView->isItemChecked(aid1));
+ }
+*/
+
+//---------------------------------------------------------
+// toggleMixer1
+//---------------------------------------------------------
+
+void MusE::toggleMixer1()
+ {
+ printf("toggle mixer1\n");
+ //showMixer1(!menuView->isItemChecked(aid1a));
+ showMixer1(true);
+ }
+
+//---------------------------------------------------------
+// toggleMixer2
+//---------------------------------------------------------
+
+void MusE::toggleMixer2()
+ {
+ showMixer2(!menuView->isItemChecked(aid1b));
+ }
+
+//---------------------------------------------------------
+// mixerClosed
+//---------------------------------------------------------
+
+/*
+void MusE::mixerClosed()
+ {
+ menuView->setItemChecked(aid1, false);
+ }
+*/
+
+//---------------------------------------------------------
+// mixer1Closed
+//---------------------------------------------------------
+
+void MusE::mixer1Closed()
+ {
+ //aid1a->setChecked(false);
+ menuView->setItemChecked(aid1a, false);
+ }
+
+//---------------------------------------------------------
+// mixer2Closed
+//---------------------------------------------------------
+
+void MusE::mixer2Closed()
+ {
+ //aid1b->setChecked(false);
+ menuView->setItemChecked(aid1b, false);
+ }
+
+
+//QWidget* MusE::mixerWindow() { return audioMixer; }
+QWidget* MusE::mixer1Window() { return mixer1; }
+QWidget* MusE::mixer2Window() { return mixer2; }
+
+QWidget* MusE::transportWindow() { return transport; }
+QWidget* MusE::bigtimeWindow() { return bigtime; }
+
+//---------------------------------------------------------
+// focusInEvent
+//---------------------------------------------------------
+
+void MusE::focusInEvent(QFocusEvent* ev)
+ {
+ //if (audioMixer)
+ // audioMixer->raise();
+ if (mixer1)
+ mixer1->raise();
+ if (mixer2)
+ mixer2->raise();
+ raise();
+ Q3MainWindow::focusInEvent(ev);
+ }
+
+//---------------------------------------------------------
+// setUsedTool
+//---------------------------------------------------------
+
+void MusE::setUsedTool(int tool)
+ {
+ tools1->set(tool);
+ }
+
+
+//---------------------------------------------------------
+// execDeliveredScript
+//---------------------------------------------------------
+void MusE::execDeliveredScript(int id)
+{
+ //QString scriptfile = QString(INSTPREFIX) + SCRIPTSSUFFIX + deliveredScriptNames[id];
+ song->executeScript(song->getScriptPath(id, true), song->getSelectedMidiParts(), 0, false); // TODO: get quant from arranger
+}
+//---------------------------------------------------------
+// execUserScript
+//---------------------------------------------------------
+void MusE::execUserScript(int id)
+{
+ song->executeScript(song->getScriptPath(id, false), song->getSelectedMidiParts(), 0, false); // TODO: get quant from arranger
+}
+
diff --git a/muse2/muse/app.cpp.orig b/muse2/muse/app.cpp.orig
new file mode 100644
index 00000000..219f59bd
--- /dev/null
+++ b/muse2/muse/app.cpp.orig
@@ -0,0 +1,3969 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: app.cpp,v 1.113.2.68 2009/12/21 14:51:51 spamatica Exp $
+//
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "config.h"
+
+#include <string>
+#include <map>
+#include <assert.h>
+#include <getopt.h>
+#include <errno.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <time.h>
+#include <signal.h>
+#include <stdarg.h>
+
+#include <qbuttongroup.h>
+#include <qpopupmenu.h>
+#include <qmessagebox.h>
+#include <qclipboard.h>
+#include <qsocketnotifier.h>
+#include <qtextcodec.h>
+#include <qstylefactory.h>
+#include <qmenubar.h>
+#include <qapplication.h>
+#include <qtimer.h>
+#include <qstyle.h>
+#include <qsplashscreen.h>
+#include <qobject.h>
+
+#include "app.h"
+#include "transport.h"
+#include "bigtime.h"
+#include "arranger.h"
+#include "pianoroll.h"
+#include "xml.h"
+#include "midi.h"
+#include "conf.h"
+#include "listedit.h"
+#include "master/masteredit.h"
+#include "master/lmaster.h"
+#include "drumedit.h"
+#include "ttoolbar.h"
+#include "amixer.h"
+#include "cliplist/cliplist.h"
+#include "midiport.h"
+#include "audiodev.h"
+#include "mididev.h"
+#include "waveedit.h"
+#include "icons.h"
+#include "minstrument.h"
+#include "mixdowndialog.h"
+#include "midictrl.h"
+#include "filedialog.h"
+#include "plugin.h"
+#include "marker/markerview.h"
+#include "transpose.h"
+#include "appearance.h"
+#include "gatetime.h"
+#include "metronome.h"
+#include "debug.h"
+#include "event.h"
+#include "audio.h"
+#include "midiseq.h"
+#include "audioprefetch.h"
+#include "wave.h"
+#include "shortcutconfig.h"
+#include "gconfig.h"
+#include "driver/jackaudio.h"
+#include "track.h"
+#include "ticksynth.h"
+#include "instruments/editinstrument.h"
+#include "synth.h"
+#include "remote/pyapi.h"
+#include "al/dsp.h"
+
+#ifdef DSSI_SUPPORT
+#include "dssihost.h"
+#endif
+
+#ifdef VST_SUPPORT
+#include "vst.h"
+#endif
+
+#include <alsa/asoundlib.h>
+#include "songinfo.h"
+#include "didyouknow.h"
+#include <qtextedit.h>
+
+//extern void cacheJackRouteNames();
+
+static pthread_t watchdogThread;
+//ErrorHandler *error;
+static const char* fileOpenText =
+ QT_TR_NOOP("Click this button to open a <em>new song</em>.<br>"
+ "You can also select the <b>Open command</b> from the File menu.");
+static const char* fileSaveText =
+ QT_TR_NOOP("Click this button to save the song you are "
+ "editing. You will be prompted for a file name.\n"
+ "You can also select the Save command from the File menu.");
+static const char* fileNewText = QT_TR_NOOP("Create New Song");
+
+static const char* infoLoopButton = QT_TR_NOOP("loop between left mark and right mark");
+static const char* infoPunchinButton = QT_TR_NOOP("record starts at left mark");
+static const char* infoPunchoutButton = QT_TR_NOOP("record stops at right mark");
+static const char* infoStartButton = QT_TR_NOOP("rewind to start position");
+static const char* infoRewindButton = QT_TR_NOOP("rewind current position");
+static const char* infoForwardButton = QT_TR_NOOP("move current position");
+static const char* infoStopButton = QT_TR_NOOP("stop sequencer");
+static const char* infoPlayButton = QT_TR_NOOP("start sequencer play");
+static const char* infoRecordButton = QT_TR_NOOP("to record press record and then play");
+static const char* infoPanicButton = QT_TR_NOOP("send note off to all midi channels");
+
+#define PROJECT_LIST_LEN 6
+static QString* projectList[PROJECT_LIST_LEN];
+
+extern void initIcons();
+extern void initMidiSynth();
+extern bool initJackAudio();
+extern void exitJackAudio();
+extern bool initDummyAudio();
+extern void exitDummyAudio();
+extern void initVST_fst_init();
+extern void initVST();
+extern void initDSSI();
+
+#ifdef HAVE_LASH
+#include <lash/lash.h>
+lash_client_t * lash_client = 0;
+extern snd_seq_t * alsaSeq;
+#endif /* HAVE_LASH */
+
+int watchAudio, watchAudioPrefetch, watchMidi;
+pthread_t splashThread;
+
+
+//PyScript *pyscript;
+// void MusE::runPythonScript()
+// {
+// QString script("test.py");
+// // pyscript->runPythonScript(script);
+// }
+
+//---------------------------------------------------------
+// getCapabilities
+//---------------------------------------------------------
+
+static void getCapabilities()
+ {
+#ifdef RTCAP
+#ifdef __linux__
+ const char* napp = getenv("GIVERTCAP");
+ if (napp == 0)
+ napp = "givertcap";
+ int pid = fork();
+ if (pid == 0) {
+ if (execlp(napp, napp, 0) == -1)
+ perror("exec givertcap failed");
+ }
+ else if (pid == -1) {
+ perror("fork givertcap failed");
+ }
+ else {
+ waitpid(pid, 0, 0);
+ }
+#endif // __linux__
+#endif
+ }
+
+
+//---------------------------------------------------------
+// sleep function
+//---------------------------------------------------------
+void microSleep(long msleep)
+{
+ bool sleepOk=-1;
+
+ while(sleepOk==-1)
+ sleepOk=usleep(msleep);
+}
+
+// Removed p3.3.17
+/*
+//---------------------------------------------------------
+// watchdog thread
+//---------------------------------------------------------
+
+static void* watchdog(void*)
+ {
+ doSetuid();
+
+ struct sched_param rt_param;
+ memset(&rt_param, 0, sizeof(rt_param));
+ rt_param.sched_priority = sched_get_priority_max(SCHED_FIFO);
+ int rv = pthread_setschedparam(pthread_self(), SCHED_FIFO, &rt_param);
+ if (rv != 0)
+ perror("Set realtime scheduler");
+
+ int policy;
+ if (pthread_getschedparam(pthread_self(), &policy, &rt_param)!= 0) {
+ printf("Cannot get current client scheduler: %s\n", strerror(errno));
+ }
+ if (policy != SCHED_FIFO)
+ printf("watchdog process %d _NOT_ running SCHED_FIFO\n", getpid());
+ else if (debugMsg)
+ printf("watchdog set to SCHED_FIFO priority %d\n",
+ sched_get_priority_max(SCHED_FIFO));
+
+ undoSetuid();
+ int fatal = 0;
+ for (;;) {
+ watchAudio = 0;
+ watchMidi = 0;
+ static const int WD_TIMEOUT = 3;
+
+ // sleep can be interrpted by signals:
+ int to = WD_TIMEOUT;
+ while (to > 0)
+ to = sleep(to);
+
+ bool timeout = false;
+ if (midiSeqRunning && watchMidi == 0)
+ {
+ printf("midiSeqRunning = %i watchMidi %i\n", midiSeqRunning, watchMidi);
+ timeout = true;
+ }
+ if (watchAudio == 0)
+ timeout = true;
+ if (watchAudio > 500000)
+ timeout = true;
+ if (timeout)
+ ++fatal;
+ else
+ fatal = 0;
+ if (fatal >= 3) {
+ printf("WatchDog: fatal error, realtime task timeout\n");
+ printf(" (%d,%d-%d) - stopping all services\n",
+ watchMidi, watchAudio, fatal);
+ break;
+ }
+// printf("wd %d %d %d\n", watchMidi, watchAudio, fatal);
+ }
+ audio->stop(true);
+ audioPrefetch->stop(true);
+ printf("watchdog exit\n");
+ exit(-1);
+ }
+*/
+
+//---------------------------------------------------------
+// seqStart
+//---------------------------------------------------------
+
+bool MusE::seqStart()
+ {
+ // Changed by Tim. p3.3.17
+
+ /*
+ if (audio->isRunning()) {
+ printf("seqStart(): already running\n");
+ return true;
+ }
+
+ if (realTimeScheduling) {
+ //
+ // create watchdog thread with max priority
+ //
+ doSetuid();
+ struct sched_param rt_param;
+ memset(&rt_param, 0, sizeof(rt_param));
+ rt_param.sched_priority = realTimePriority +1;//sched_get_priority_max(SCHED_FIFO);
+
+ pthread_attr_t* attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t));
+ pthread_attr_init(attributes);
+
+// if (pthread_attr_setschedpolicy(attributes, SCHED_FIFO)) {
+// printf("MusE: cannot set FIFO scheduling class for RT thread\n");
+// }
+// if (pthread_attr_setschedparam (attributes, &rt_param)) {
+// // printf("Cannot set scheduling priority for RT thread (%s)\n", strerror(errno));
+// }
+// if (pthread_attr_setscope (attributes, PTHREAD_SCOPE_SYSTEM)) {
+// printf("MusE: Cannot set scheduling scope for RT thread\n");
+// }
+ if (pthread_create(&watchdogThread, attributes, ::watchdog, 0))
+ perror("MusE: creating watchdog thread failed:");
+ pthread_attr_destroy(attributes);
+ undoSetuid();
+ }
+ audioPrefetch->start();
+ audioPrefetch->msgSeek(0, true); // force
+ midiSeqRunning = !midiSeq->start();
+
+ if (!audio->start()) {
+ QMessageBox::critical( muse, tr(QString("Failed to start audio!")),
+ tr(QString("Was not able to start audio, check if jack is running.\n")));
+ return false;
+ }
+
+ return true;
+ */
+
+ if (audio->isRunning()) {
+ printf("seqStart(): already running\n");
+ return true;
+ }
+
+ if (!audio->start()) {
+ QMessageBox::critical( muse, tr(QString("Failed to start audio!")),
+ tr(QString("Was not able to start audio, check if jack is running.\n")));
+ return false;
+ }
+
+ //
+ // wait for jack callback
+ //
+ for(int i = 0; i < 60; ++i)
+ {
+ //if (audioState == AUDIO_START2)
+ if(audio->isRunning())
+ break;
+ sleep(1);
+ }
+ //if (audioState != AUDIO_START2) {
+ if(!audio->isRunning())
+ {
+ QMessageBox::critical( muse, tr("Failed to start audio!"),
+ tr("Timeout waiting for audio to run. Check if jack is running.\n"));
+ }
+ //
+ // now its safe to ask the driver for realtime
+ // priority
+
+ realTimePriority = audioDevice->realtimePriority();
+ if(debugMsg)
+ printf("MusE::seqStart: getting audio driver realTimePriority:%d\n", realTimePriority);
+
+ // Disabled by Tim. p3.3.22
+ /*
+ if(realTimeScheduling)
+ {
+ //
+ // create watchdog thread with max priority
+ //
+ doSetuid();
+ struct sched_param rt_param;
+ memset(&rt_param, 0, sizeof(rt_param));
+ rt_param.sched_priority = realTimePriority + 1;//sched_get_priority_max(SCHED_FIFO);
+
+ pthread_attr_t* attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t));
+ pthread_attr_init(attributes);
+
+// if (pthread_attr_setschedpolicy(attributes, SCHED_FIFO)) {
+// printf("MusE: cannot set FIFO scheduling class for RT thread\n");
+// }
+// if (pthread_attr_setschedparam (attributes, &rt_param)) {
+// // printf("Cannot set scheduling priority for RT thread (%s)\n", strerror(errno));
+// }
+// if (pthread_attr_setscope (attributes, PTHREAD_SCOPE_SYSTEM)) {
+// printf("MusE: Cannot set scheduling scope for RT thread\n");
+// }
+ if (pthread_create(&watchdogThread, attributes, ::watchdog, 0))
+ perror("MusE: creating watchdog thread failed");
+ pthread_attr_destroy(attributes);
+ undoSetuid();
+ }
+ */
+
+ //int policy;
+ //if ((policy = sched_getscheduler (0)) < 0) {
+ // printf("Cannot get current client scheduler: %s\n", strerror(errno));
+ // }
+ //if (policy != SCHED_FIFO)
+ // printf("midi thread %d _NOT_ running SCHED_FIFO\n", getpid());
+
+
+ //audioState = AUDIO_RUNNING;
+ // Changed by Tim. p3.3.22
+ /*
+ //if(realTimePriority)
+ if(realTimeScheduling)
+ {
+ int pr = realTimePriority;
+ if(pr > 5)
+ pr -= 5;
+ else
+ pr = 0;
+ audioPrefetch->start(pr);
+ //audioWriteback->start(realTimePriority - 5);
+ }
+ else
+ {
+ audioPrefetch->start(0);
+ //audioWriteback->start(0);
+ }
+ */
+ int pfprio = 0;
+ int midiprio = 0;
+ if(realTimeScheduling)
+ {
+ if(realTimePriority < 5)
+ printf("MusE: WARNING: Recommend setting audio realtime priority to at least 5!\n");
+ if(realTimePriority == 1)
+ {
+ pfprio = 2;
+ midiprio = 3;
+ }
+ else
+ if(realTimePriority == 2)
+ {
+ pfprio = 1;
+ midiprio = 3;
+ }
+ else
+ if(realTimePriority == 3)
+ {
+ pfprio = 1;
+ //midiprio = 2;
+ // p3.3.37
+ midiprio = 4;
+ }
+ else
+ if(realTimePriority == 4)
+ {
+ pfprio = 1;
+ //midiprio = 3;
+ // p3.3.37
+ midiprio = 5;
+ }
+ else
+ if(realTimePriority == 5)
+ {
+ pfprio = 1;
+ //midiprio = 3;
+ // p3.3.37
+ midiprio = 6;
+ }
+ else
+ {
+ pfprio = realTimePriority - 5;
+ //midiprio = realTimePriority - 2;
+ // p3.3.37
+ midiprio = realTimePriority + 1;
+ }
+ }
+
+ if(midiRTPrioOverride > 0)
+ midiprio = midiRTPrioOverride;
+
+ // FIXME FIXME: The realTimePriority of the Jack thread seems to always be 5 less than the value passed to jackd command.
+ //if(midiprio == realTimePriority)
+ // printf("MusE: WARNING: Midi realtime priority %d is the same as audio realtime priority %d. Try a different setting.\n",
+ // midiprio, realTimePriority);
+ //if(midiprio == pfprio)
+ // printf("MusE: WARNING: Midi realtime priority %d is the same as audio prefetch realtime priority %d. Try a different setting.\n",
+ // midiprio, pfprio);
+
+ audioPrefetch->start(pfprio);
+
+ audioPrefetch->msgSeek(0, true); // force
+
+ //midiSeqRunning = !midiSeq->start(realTimeScheduling ? realTimePriority : 0);
+ // Changed by Tim. p3.3.22
+ //midiSeq->start(realTimeScheduling ? realTimePriority : 0);
+ midiSeq->start(midiprio);
+
+ int counter=0;
+ while (++counter) {
+ //if (counter > 10) {
+ if (counter > 1000) {
+ fprintf(stderr,"midi sequencer thread does not start!? Exiting...\n");
+ exit(33);
+ }
+ midiSeqRunning = midiSeq->isRunning();
+ if (midiSeqRunning)
+ break;
+ usleep(1000);
+ printf("looping waiting for sequencer thread to start\n");
+ }
+ if(!midiSeqRunning)
+ {
+ fprintf(stderr, "midiSeq is not running! Exiting...\n");
+ exit(33);
+ }
+ return true;
+ }
+
+//---------------------------------------------------------
+// stop
+//---------------------------------------------------------
+
+void MusE::seqStop()
+ {
+ // label sequencer as disabled before it actually happened to minimize race condition
+ midiSeqRunning = false;
+
+ song->setStop(true);
+ song->setStopPlay(false);
+ midiSeq->stop(true);
+ audio->stop(true);
+ audioPrefetch->stop(true);
+ if (realTimeScheduling && watchdogThread)
+ pthread_cancel(watchdogThread);
+ }
+
+//---------------------------------------------------------
+// seqRestart
+//---------------------------------------------------------
+
+bool MusE::seqRestart()
+{
+ bool restartSequencer = audio->isRunning();
+ if (restartSequencer) {
+ if (audio->isPlaying()) {
+ audio->msgPlay(false);
+ while (audio->isPlaying())
+ qApp->processEvents();
+ }
+ seqStop();
+ }
+ if(!seqStart())
+ return false;
+
+ audioDevice->graphChanged();
+ return true;
+}
+
+//---------------------------------------------------------
+// addProject
+//---------------------------------------------------------
+
+void addProject(const QString& name)
+ {
+ for (int i = 0; i < PROJECT_LIST_LEN; ++i) {
+ if (projectList[i] == 0)
+ break;
+ if (name == *projectList[i]) {
+ int dst = i;
+ int src = i+1;
+ int n = PROJECT_LIST_LEN - i - 1;
+ delete projectList[i];
+ for (int k = 0; k < n; ++k)
+ projectList[dst++] = projectList[src++];
+ projectList[dst] = 0;
+ break;
+ }
+ }
+ QString** s = &projectList[PROJECT_LIST_LEN - 2];
+ QString** d = &projectList[PROJECT_LIST_LEN - 1];
+ if (*d)
+ delete *d;
+ for (int i = 0; i < PROJECT_LIST_LEN-1; ++i)
+ *d-- = *s--;
+ projectList[0] = new QString(name);
+ }
+
+//---------------------------------------------------------
+// populateAddSynth
+//---------------------------------------------------------
+
+/*
+struct addSynth_cmp_str
+{
+ bool operator()(std::string a, std::string b)
+ {
+ return (a < b);
+ }
+};
+*/
+
+QPopupMenu* populateAddSynth(QWidget* parent, QObject* obj = 0, const char* slot = 0)
+{
+ QPopupMenu* synp = new QPopupMenu(parent);
+
+ //typedef std::multimap<std::string, int, addSynth_cmp_str > asmap;
+ typedef std::multimap<std::string, int > asmap;
+
+ //typedef std::multimap<std::string, int, addSynth_cmp_str >::iterator imap;
+ typedef std::multimap<std::string, int >::iterator imap;
+
+ MessSynth* synMESS = 0;
+ QPopupMenu* synpMESS = 0;
+ asmap mapMESS;
+
+ #ifdef DSSI_SUPPORT
+ DssiSynth* synDSSI = 0;
+ QPopupMenu* synpDSSI = 0;
+ asmap mapDSSI;
+ #endif
+
+ #ifdef VST_SUPPORT
+ VstSynth* synVST = 0;
+ QPopupMenu* synpVST = 0;
+ asmap mapVST;
+ #endif
+
+ // Not neccessary, but what the heck.
+ QPopupMenu* synpOther = 0;
+ asmap mapOther;
+
+ //const int synth_base_id = 0x1000;
+ int ii = 0;
+ for(std::vector<Synth*>::iterator i = synthis.begin(); i != synthis.end(); ++i)
+ {
+ synMESS = dynamic_cast<MessSynth*>(*i);
+ if(synMESS)
+ {
+ mapMESS.insert( std::pair<std::string, int> (std::string(synMESS->description().lower().latin1()), ii) );
+ }
+ else
+ {
+
+ #ifdef DSSI_SUPPORT
+ synDSSI = dynamic_cast<DssiSynth*>(*i);
+ if(synDSSI)
+ {
+ mapDSSI.insert( std::pair<std::string, int> (std::string(synDSSI->description().lower().latin1()), ii) );
+ }
+ else
+ #endif
+
+ {
+ #ifdef VST_SUPPORT
+ synVST = dynamic_cast<VstSynth*>(*i);
+ if(synVST)
+ {
+ mapVST.insert( std::pair<std::string, int> (std::string(synVST->description().lower().latin1()), ii) );
+ }
+ else
+ #endif
+
+ {
+ mapOther.insert( std::pair<std::string, int> (std::string((*i)->description().lower().latin1()), ii) );
+ }
+ }
+ }
+
+ ++ii;
+ }
+
+ int sz = synthis.size();
+ for(imap i = mapMESS.begin(); i != mapMESS.end(); ++i)
+ {
+ int idx = i->second;
+ if(idx > sz) // Sanity check
+ continue;
+ Synth* s = synthis[idx];
+ if(s)
+ {
+ // No MESS sub-menu yet? Create it now.
+ if(!synpMESS)
+ synpMESS = new QPopupMenu(parent);
+ synpMESS->insertItem(QT_TR_NOOP(s->description()) + " <" + QT_TR_NOOP(s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx);
+ }
+ }
+
+ #ifdef DSSI_SUPPORT
+ for(imap i = mapDSSI.begin(); i != mapDSSI.end(); ++i)
+ {
+ int idx = i->second;
+ if(idx > sz)
+ continue;
+ Synth* s = synthis[idx];
+ if(s)
+ {
+ // No DSSI sub-menu yet? Create it now.
+ if(!synpDSSI)
+ synpDSSI = new QPopupMenu(parent);
+ synpDSSI->insertItem(QT_TR_NOOP(s->description()) + " <" + QT_TR_NOOP(s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx);
+ }
+ }
+ #endif
+
+ #ifdef VST_SUPPORT
+ for(imap i = mapVST.begin(); i != mapVST.end(); ++i)
+ {
+ int idx = i->second;
+ if(idx > sz)
+ continue;
+ Synth* s = synthis[idx];
+ if(s)
+ {
+ // No VST sub-menu yet? Create it now.
+ if(!synpVST)
+ synpVST = new QPopupMenu(parent);
+ synpVST->insertItem(QT_TR_NOOP(s->description()) + " <" + QT_TR_NOOP(s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx);
+ }
+ }
+ #endif
+
+ for(imap i = mapOther.begin(); i != mapOther.end(); ++i)
+ {
+ int idx = i->second;
+ if(idx > sz)
+ continue;
+ Synth* s = synthis[idx];
+ // No Other sub-menu yet? Create it now.
+ if(!synpOther)
+ synpOther = new QPopupMenu(parent);
+ synpOther->insertItem(QT_TR_NOOP(s->description()) + " <" + QT_TR_NOOP(s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx);
+ }
+
+ if(synpMESS)
+ {
+ synp->insertItem(*synthIcon, QT_TR_NOOP("MESS"), synpMESS, Track::AUDIO_SOFTSYNTH);
+ if(obj && slot)
+ QObject::connect(synpMESS, SIGNAL(activated(int)), obj, slot);
+ }
+
+ #ifdef DSSI_SUPPORT
+ if(synpDSSI)
+ {
+ synp->insertItem(*synthIcon, QT_TR_NOOP("DSSI"), synpDSSI, Track::AUDIO_SOFTSYNTH);
+ if(obj && slot)
+ QObject::connect(synpDSSI, SIGNAL(activated(int)), obj, slot);
+ }
+ #endif
+
+ #ifdef VST_SUPPORT
+ if(synpVST)
+ {
+ synp->insertItem(*synthIcon, QT_TR_NOOP("FST"), synpVST, Track::AUDIO_SOFTSYNTH);
+ if(obj && slot)
+ QObject::connect(synpVST, SIGNAL(activated(int)), obj, slot);
+ }
+ #endif
+
+ if(synpOther)
+ {
+ synp->insertItem(*synthIcon, QObject::tr("Other"), synpOther, Track::AUDIO_SOFTSYNTH);
+ if(obj && slot)
+ QObject::connect(synpOther, SIGNAL(activated(int)), obj, slot);
+ }
+
+ return synp;
+}
+
+//---------------------------------------------------------
+// populateAddTrack
+// this is also used in "mixer"
+//---------------------------------------------------------
+
+void populateAddTrack(QPopupMenu* addTrack)
+ {
+ addTrack->insertItem(QIconSet(*addtrack_addmiditrackIcon),
+ QT_TR_NOOP("Add Midi Track"), Track::MIDI);
+ addTrack->insertItem(QIconSet(*addtrack_drumtrackIcon),
+ QT_TR_NOOP("Add Drum Track"), Track::DRUM);
+ addTrack->insertItem(QIconSet(*addtrack_wavetrackIcon),
+ QT_TR_NOOP("Add Wave Track"), Track::WAVE);
+ addTrack->insertItem(QIconSet(*addtrack_audiooutputIcon),
+ QT_TR_NOOP("Add Audio Output"), Track::AUDIO_OUTPUT);
+ addTrack->insertItem(QIconSet(*addtrack_audiogroupIcon),
+ QT_TR_NOOP("Add Audio Group"), Track::AUDIO_GROUP);
+ addTrack->insertItem(QIconSet(*addtrack_audioinputIcon),
+ QT_TR_NOOP("Add Audio Input"), Track::AUDIO_INPUT);
+ addTrack->insertItem(QIconSet(*addtrack_auxsendIcon),
+ QT_TR_NOOP("Add Aux Send"), Track::AUDIO_AUX);
+
+ // Create a sub-menu and fill it with found synth types. Make addTrack the owner.
+ QPopupMenu* synp = populateAddSynth(addTrack, song, SLOT(addNewTrack(int)));
+ // Add the sub-menu to the given menu.
+ addTrack->insertItem(*synthIcon, QT_TR_NOOP("Add Synth"), synp, Track::AUDIO_SOFTSYNTH);
+
+ //addTrack->connect(addTrack, SIGNAL(activated(int)), song, SLOT(addTrack(int)));
+ addTrack->connect(addTrack, SIGNAL(activated(int)), song, SLOT(addNewTrack(int)));
+ //synp->connect(synp, SIGNAL(activated(int)), song, SLOT(addNewTrack(int)));
+ }
+
+//---------------------------------------------------------
+// MusE
+//---------------------------------------------------------
+
+MusE::MusE(int argc, char** argv) : QMainWindow(0, "mainwindow")
+ {
+ // By T356. For LADSPA plugins in plugin.cpp
+ QWidgetFactory::addWidgetFactory( new PluginWidgetFactory );
+
+ setFocusPolicy(WheelFocus);
+ muse = this; // hack
+ clipListEdit = 0;
+ midiSyncConfig = 0;
+ midiRemoteConfig = 0;
+ midiPortConfig = 0;
+ metronomeConfig = 0;
+ audioConfig = 0;
+ midiFileConfig = 0;
+ midiFilterConfig = 0;
+ midiInputTransform = 0;
+ midiRhythmGenerator = 0;
+ globalSettingsConfig = 0;
+ markerView = 0;
+ softSynthesizerConfig = 0;
+ midiTransformerDialog = 0;
+ shortcutConfig = 0;
+ appearance = 0;
+ //audioMixer = 0;
+ mixer1 = 0;
+ mixer2 = 0;
+ watchdogThread = 0;
+ editInstrument = 0;
+
+ appName = QString("MusE");
+
+ song = new Song("song");
+ song->blockSignals(true);
+ heartBeatTimer = new QTimer(this, "timer");
+ connect(heartBeatTimer, SIGNAL(timeout()), song, SLOT(beat()));
+
+#ifdef ENABLE_PYTHON
+ //---------------------------------------------------
+ // Python bridge
+ //---------------------------------------------------
+ // Uncomment in order to enable MusE Python bridge:
+ if (usePythonBridge) {
+ printf("Initializing python bridge!\n");
+ if (initPythonBridge() == false) {
+ printf("Could not initialize Python bridge\n");
+ exit(1);
+ }
+ }
+#endif
+
+ //---------------------------------------------------
+ // undo/redo
+ //---------------------------------------------------
+ undoRedo = new QActionGroup(this, tr("UndoRedo"), false);
+ undoAction = new QAction(tr("undo"), QIconSet(*undoIconS, *undoIcon), tr("Und&o"),
+ CTRL+Key_Z, undoRedo, "undo");
+ redoAction = new QAction(tr("redo"), QIconSet(*redoIconS, *redoIcon), tr("Re&do"),
+ CTRL+Key_Y, undoRedo, "redo");
+ undoAction->setWhatsThis(tr("undo last change to song"));
+ redoAction->setWhatsThis(tr("redo last undo"));
+ undoAction->setEnabled(false);
+ redoAction->setEnabled(false);
+ connect(redoAction, SIGNAL(activated()), song, SLOT(redo()));
+ connect(undoAction, SIGNAL(activated()), song, SLOT(undo()));
+
+ //---------------------------------------------------
+ // Transport
+ //---------------------------------------------------
+
+ transportAction = new QActionGroup(this, tr("Transport"), false);
+
+ loopAction = new QAction(tr("loop"), QIconSet(*loop1Icon),
+ tr("Loop"), 0, transportAction, "loop", true);
+ loopAction->setWhatsThis(tr(infoLoopButton));
+ connect(loopAction, SIGNAL(toggled(bool)), song, SLOT(setLoop(bool)));
+
+ punchinAction = new QAction(tr("punchin"), QIconSet(*punchin1Icon),
+ tr("Punchin"), 0, transportAction, "Punchin", true);
+ punchinAction->setWhatsThis(tr(infoPunchinButton));
+ connect(punchinAction, SIGNAL(toggled(bool)), song, SLOT(setPunchin(bool)));
+
+ punchoutAction = new QAction(tr("punchout"), QIconSet(*punchout1Icon),
+ tr("Punchout"), 0, transportAction, "punchout", true);
+ punchoutAction->setWhatsThis(tr(infoPunchoutButton));
+ connect(punchoutAction, SIGNAL(toggled(bool)), song, SLOT(setPunchout(bool)));
+
+ transportAction->addSeparator();
+
+ startAction = new QAction(tr("start"), QIconSet(*startIcon),
+ tr("Start"), 0, transportAction, "start");
+ startAction->setWhatsThis(tr(infoStartButton));
+ connect(startAction, SIGNAL(activated()), song, SLOT(rewindStart()));
+
+ rewindAction = new QAction(tr("rewind"), QIconSet(*frewindIcon),
+ tr("Rewind"), 0, transportAction, "rewind");
+ rewindAction->setWhatsThis(tr(infoRewindButton));
+ connect(rewindAction, SIGNAL(activated()), song, SLOT(rewind()));
+
+ forwardAction = new QAction(tr("forward"), QIconSet(*fforwardIcon),
+ tr("Forward"), 0, transportAction, "forward");
+ forwardAction->setWhatsThis(tr(infoForwardButton));
+ connect(forwardAction, SIGNAL(activated()), song, SLOT(forward()));
+
+ stopAction = new QAction(tr("stop"), QIconSet(*stopIcon),
+ tr("Stop"), 0, transportAction, "stop", true);
+ stopAction->setWhatsThis(tr(infoStopButton));
+ stopAction->setOn(true);
+ connect(stopAction, SIGNAL(toggled(bool)), song, SLOT(setStop(bool)));
+
+ playAction = new QAction(tr("play"), QIconSet(*playIcon),
+ tr("Play"), 0, transportAction, "play", true);
+ playAction->setWhatsThis(tr(infoPlayButton));
+ playAction->setOn(false);
+ connect(playAction, SIGNAL(toggled(bool)), song, SLOT(setPlay(bool)));
+
+ recordAction = new QAction(tr("record"), QIconSet(*recordIcon),
+ tr("Record"), 0, transportAction, "record", true);
+ recordAction->setWhatsThis(tr(infoRecordButton));
+ connect(recordAction, SIGNAL(toggled(bool)), song, SLOT(setRecord(bool)));
+
+ panicAction = new QAction(tr("panic"), QIconSet(*panicIcon),
+ tr("Panic"), 0, 0, "panic", false);
+ panicAction->setWhatsThis(tr(infoPanicButton));
+ connect(panicAction, SIGNAL(activated()), song, SLOT(panic()));
+
+ initMidiInstruments();
+ initMidiPorts();
+ ::initMidiDevices();
+
+ //----Actions
+
+ fileNewAction = new QAction(tr("new"),
+ QIconSet(*filenewIconS, *filenewIcon), tr("&New"), 0, this, "new");
+ fileNewAction->setToolTip(tr(fileNewText));
+ fileNewAction->setWhatsThis(tr(fileNewText));
+
+ fileOpenAction = new QAction(tr("open"),
+ QIconSet(*openIconS, *openIcon), tr("&Open"), 0, this, "open");
+ fileOpenAction->setToolTip(tr(fileOpenText));
+ fileOpenAction->setWhatsThis(tr(fileOpenText));
+
+ fileSaveAction = new QAction(tr("save"),
+ QIconSet(*saveIconS, *saveIcon), tr("&Save"), 0, this, "save");
+ fileSaveAction->setToolTip(tr(fileSaveText));
+ fileSaveAction->setWhatsThis(tr(fileSaveText));
+
+ pianoAction = new QAction(tr("pianoroll"),
+ *pianoIconSet, tr("Pianoroll"), 0, this, "pianoroll");
+ connect(pianoAction, SIGNAL(activated()), SLOT(startPianoroll()));
+
+// markerAction = new QAction(tr("marker"), QIconSet(*view_markerIcon), tr("Marker"),
+// 0, this, "marker");
+// connect(markerAction, SIGNAL(activated()), SLOT(startMarkerView()));
+
+ connect(fileNewAction, SIGNAL(activated()), SLOT(loadTemplate()));
+ connect(fileOpenAction, SIGNAL(activated()), SLOT(loadProject()));
+ connect(fileSaveAction, SIGNAL(activated()), SLOT(save()));
+
+ //--------------------------------------------------
+ // Toolbar
+ //--------------------------------------------------
+
+ tools = new QToolBar(tr("File Buttons"), this);
+ fileNewAction->addTo(tools);
+ fileOpenAction->addTo(tools);
+ fileSaveAction->addTo(tools);
+
+ //
+ // Whats This
+ //
+ QWhatsThis::whatsThisButton(tools);
+
+ tools->addSeparator();
+ undoRedo->addTo(tools);
+
+ tools1 = new EditToolBar(this, arrangerTools);
+
+ QToolBar* transportToolbar = new QToolBar(this);
+ transportAction->addTo(transportToolbar);
+
+ QToolBar* panicToolbar = new QToolBar(this);
+ panicAction->addTo(panicToolbar);
+
+ if (realTimePriority < sched_get_priority_min(SCHED_FIFO))
+ realTimePriority = sched_get_priority_min(SCHED_FIFO);
+ else if (realTimePriority > sched_get_priority_max(SCHED_FIFO))
+ realTimePriority = sched_get_priority_max(SCHED_FIFO);
+
+ // If we requested to force the midi thread priority...
+ if(midiRTPrioOverride > 0)
+ {
+ if (midiRTPrioOverride < sched_get_priority_min(SCHED_FIFO))
+ midiRTPrioOverride = sched_get_priority_min(SCHED_FIFO);
+ else if (midiRTPrioOverride > sched_get_priority_max(SCHED_FIFO))
+ midiRTPrioOverride = sched_get_priority_max(SCHED_FIFO);
+ }
+
+ // Changed by Tim. p3.3.17
+ //midiSeq = new MidiSeq(realTimeScheduling ? realTimePriority : 0, "Midi");
+ midiSeq = new MidiSeq("Midi");
+ audio = new Audio();
+ //audioPrefetch = new AudioPrefetch(0, "Disc");
+ audioPrefetch = new AudioPrefetch("Prefetch");
+
+ //---------------------------------------------------
+ // Popups
+ //---------------------------------------------------
+
+// QPopupMenu *foo = new QPopupMenu(this);
+// testAction = new QAction(foo,"testPython");
+// testAction->addTo(foo);
+// menuBar()->insertItem(tr("&testpython"), foo);
+// connect(testAction, SIGNAL(activated()), this, SLOT(runPythonScript()));
+
+
+ //-------------------------------------------------------------
+ // popup File
+ //-------------------------------------------------------------
+
+ menu_file = new QPopupMenu(this);
+ menuBar()->insertItem(tr("&File"), menu_file);
+ fileNewAction->addTo(menu_file);
+ fileOpenAction->addTo(menu_file);
+ openRecent = new QPopupMenu(menu_file);
+ connect(openRecent, SIGNAL(aboutToShow()), this, SLOT(openRecentMenu()));
+ connect(openRecent, SIGNAL(activated(int)), this, SLOT(selectProject(int)));
+ menu_ids[CMD_OPEN_RECENT] = menu_file->insertItem(tr("Open &Recent"), openRecent, 0);
+ menu_file->insertSeparator();
+ fileSaveAction->addTo(menu_file);
+ menu_ids[CMD_SAVE_AS] = menu_file->insertItem(tr("Save &As"), this, SLOT(saveAs()), 0, -2);
+ menu_file->insertSeparator();
+ menu_ids[CMD_IMPORT_MIDI] = menu_file->insertItem(*openIconS, tr("Import Midifile"), this, SLOT(importMidi()), 0, -2);
+ menu_ids[CMD_EXPORT_MIDI] = menu_file->insertItem(*saveIconS, tr("Export Midifile"), this, SLOT(exportMidi()), 0, -2);
+ menu_ids[CMD_IMPORT_PART] = menu_file->insertItem(*openIconS, tr("Import Part"), this, SLOT(importPart()), 0, -2);
+ menu_file->insertSeparator();
+ menu_ids[CMD_IMPORT_AUDIO] = menu_file->insertItem(*openIconS, tr("Import Wave File"), this, SLOT(importWave()), 0, -2);
+
+
+ menu_file->insertSeparator();
+ menu_ids[CMD_QUIT] = menu_file->insertItem(*exitIconS, tr("&Quit"), this, SLOT(quitDoc()), 0, -2);
+ menu_file->insertSeparator();
+
+ //-------------------------------------------------------------
+ // popup Edit
+ //-------------------------------------------------------------
+
+ menuEdit = new QPopupMenu(this);
+ undoRedo->addTo(menuEdit);
+ menuEdit->insertSeparator();
+ menuBar()->insertItem(tr("&Edit"), menuEdit);
+
+ menuEdit->insertItem(*editcutIconSet, tr("C&ut"), CMD_CUT);
+ menuEdit->setAccel(CTRL+Key_X, CMD_CUT);
+ menuEdit->insertItem(*editcopyIconSet, tr("&Copy"), CMD_COPY);
+ menuEdit->setAccel(CTRL+Key_C, CMD_COPY);
+ menuEdit->insertItem(*editpasteIconSet, tr("&Paste"), CMD_PASTE);
+ menuEdit->setAccel(CTRL+Key_V, CMD_PASTE);
+ menuEdit->insertItem(*editpasteCloneIconSet, tr("Paste c&lone"), CMD_PASTE_CLONE);
+ menuEdit->setAccel(CTRL+SHIFT+Key_V, CMD_PASTE_CLONE);
+ menuEdit->insertItem(*editpaste2TrackIconSet, tr("Paste to &track"), CMD_PASTE_TO_TRACK);
+ menuEdit->setAccel(CTRL+Key_B, CMD_PASTE_TO_TRACK);
+ menuEdit->insertItem(*editpasteClone2TrackIconSet, tr("Paste clone to trac&k"), CMD_PASTE_CLONE_TO_TRACK);
+ menuEdit->setAccel(CTRL+SHIFT+Key_B, CMD_PASTE_CLONE_TO_TRACK);
+
+ menuEdit->insertSeparator();
+ menuEdit->insertItem(QIconSet(*edit_track_delIcon),
+ tr("Delete Selected Tracks"), CMD_DELETE_TRACK);
+
+ addTrack = new QPopupMenu(this);
+ // Moved below. Have to wait until synths are available...
+ //populateAddTrack(addTrack);
+
+ menuEdit->insertItem(QIconSet(*edit_track_addIcon),
+ tr("Add Track"), addTrack);
+
+ select = new QPopupMenu(this);
+ select->insertItem(QIconSet(*select_allIcon),
+ tr("Select &All"), CMD_SELECT_ALL);
+ select->insertItem(QIconSet(*select_deselect_allIcon),
+ tr("&Deselect All"), CMD_SELECT_NONE);
+ menuEdit->insertSeparator();
+ select->insertItem(QIconSet(*select_invert_selectionIcon),
+ tr("Invert &Selection"), CMD_SELECT_INVERT);
+ select->insertItem(QIconSet(*select_inside_loopIcon),
+ tr("&Inside Loop"), CMD_SELECT_ILOOP);
+ select->insertItem(QIconSet(*select_outside_loopIcon),
+ tr("&Outside Loop"), CMD_SELECT_OLOOP);
+ select->insertItem(QIconSet(*select_all_parts_on_trackIcon),
+ tr("All &Parts on Track"), CMD_SELECT_PARTS);
+ menuEdit->insertItem(QIconSet(*selectIcon),
+ tr("Select"), select);
+ menuEdit->insertSeparator();
+
+ pianoAction->addTo(menuEdit);
+ menu_ids[CMD_OPEN_DRUMS] = menuEdit->insertItem(
+ QIconSet(*edit_drummsIcon), tr("Drums"), this, SLOT(startDrumEditor()), 0);
+ menu_ids[CMD_OPEN_LIST] = menuEdit->insertItem(
+ QIconSet(*edit_listIcon), tr("List"), this, SLOT(startListEditor()), 0);
+ menu_ids[CMD_OPEN_WAVE] = menuEdit->insertItem(
+ QIconSet(*edit_waveIcon), tr("Wave"), this, SLOT(startWaveEditor()), 0);
+
+ master = new QPopupMenu(this);
+ master->setCheckable(false);
+ menu_ids[CMD_OPEN_GRAPHIC_MASTER] = master->insertItem(
+ QIconSet(*mastertrack_graphicIcon),tr("Graphic"), this, SLOT(startMasterEditor()), 0);
+ menu_ids[CMD_OPEN_LIST_MASTER] = master->insertItem(
+ QIconSet(*mastertrack_listIcon),tr("List"), this, SLOT(startLMasterEditor()), 0);
+ menuEdit->insertItem(QIconSet(*edit_mastertrackIcon),
+ tr("Mastertrack"), master, Key_F);
+
+ menuEdit->insertSeparator();
+ connect(menuEdit, SIGNAL(activated(int)), SLOT(cmd(int)));
+ connect(select, SIGNAL(activated(int)), SLOT(cmd(int)));
+
+ midiEdit = new QPopupMenu(this);
+ midiEdit->setCheckable(false);
+#if 0 // TODO
+ menu_ids[CMD_OPEN_MIDI_TRANSFORM] = midiEdit->insertItem(
+ QIconSet(*midi_transformIcon), tr("Midi &Transform"), this, SLOT(startMidiTransformer()), 0);
+ midiEdit->insertItem(tr("Modify Gate Time"), this, SLOT(modifyGateTime()));
+ midiEdit->insertItem(tr("Modify Velocity"), this, SLOT(modifyVelocity()));
+ midiEdit->insertItem(tr("Crescendo"), this, SLOT(crescendo()));
+ midiEdit->insertItem(tr("Transpose"), this, SLOT(transpose()));
+ midiEdit->insertItem(tr("Thin Out"), this, SLOT(thinOut()));
+ midiEdit->insertItem(tr("Erase Event"), this, SLOT(eraseEvent()));
+ midiEdit->insertItem(tr("Note Shift"), this, SLOT(noteShift()));
+ midiEdit->insertItem(tr("Move Clock"), this, SLOT(moveClock()));
+ midiEdit->insertItem(tr("Copy Measure"), this, SLOT(copyMeasure()));
+ midiEdit->insertItem(tr("Erase Measure"), this, SLOT(eraseMeasure()));
+ midiEdit->insertItem(tr("Delete Measure"), this, SLOT(deleteMeasure()));
+ midiEdit->insertItem(tr("Create Measure"), this, SLOT(createMeasure()));
+ midiEdit->insertItem(tr("Mix Track"), this, SLOT(mixTrack()));
+#endif
+ menu_ids[CMD_TRANSPOSE] = midiEdit->insertItem(
+ QIconSet(*midi_transposeIcon), tr("Transpose"), this, SLOT(transpose()), 0);
+ menuEdit->insertItem(
+ QIconSet(*edit_midiIcon), tr("Midi"), midiEdit);
+
+ menuEdit->insertSeparator();
+ menuEdit->insertItem(
+ QIconSet(*edit_listIcon), tr("Song info"), this, SLOT(startSongInfo()), 0);
+ //-------------------------------------------------------------
+ // popup View
+ //-------------------------------------------------------------
+
+ menuView = new QPopupMenu(this);
+ menuView->setCheckable(true);
+ menuBar()->insertItem(tr("View"), menuView);
+
+ tr_id = menuView->insertItem(
+ QIconSet(*view_transport_windowIcon), tr("Transport Panel"), this, SLOT(toggleTransport()), 0);
+ bt_id = menuView->insertItem(
+ QIconSet(*view_bigtime_windowIcon), tr("Bigtime window"), this, SLOT(toggleBigTime()), 0);
+ //aid1 = menuView->insertItem(
+ // QIconSet(*mixerSIcon), tr("Mixer"), this, SLOT(toggleMixer()), 0);
+ aid1a = menuView->insertItem(
+ QIconSet(*mixerSIcon), tr("Mixer A"), this, SLOT(toggleMixer1()), 0);
+ aid1b = menuView->insertItem(
+ QIconSet(*mixerSIcon), tr("Mixer B"), this, SLOT(toggleMixer2()), 0);
+ // p3.2.24
+ aid2 = menuView->insertItem(
+ QIconSet(*cliplistSIcon), tr("Cliplist"), this, SLOT(startClipList()), 0);
+ mr_id = menuView->insertItem(
+ QIconSet(*view_markerIcon), tr("Marker View"), this, SLOT(toggleMarker()), 0);
+ //markerAction->addTo(menuView);
+
+
+ //-------------------------------------------------------------
+ // popup Structure
+ //-------------------------------------------------------------
+
+ menuStructure = new QPopupMenu(this);
+ menuStructure->setCheckable(false);
+ menuBar()->insertItem(tr("&Structure"), menuStructure);
+ menu_ids[CMD_GLOBAL_CUT] = menuStructure->insertItem(tr("Global Cut"), this, SLOT(globalCut()), 0);
+ menu_ids[CMD_GLOBAL_INSERT] = menuStructure->insertItem(tr("Global Insert"), this, SLOT(globalInsert()), 0);
+ menu_ids[CMD_GLOBAL_SPLIT] = menuStructure->insertItem(tr("Global Split"), this, SLOT(globalSplit()), 0);
+ menu_ids[CMD_COPY_RANGE] = menuStructure->insertItem(tr("Copy Range"), this, SLOT(copyRange()), 0);
+ menuStructure->setItemEnabled(menu_ids[CMD_COPY_RANGE], false);
+ menuStructure->insertSeparator();
+ menu_ids[CMD_CUT_EVENTS] = menuStructure->insertItem(tr("Cut Events"), this, SLOT(cutEvents()), 0);
+ menuStructure->setItemEnabled(menu_ids[CMD_CUT_EVENTS], false);
+
+ //-------------------------------------------------------------
+ // popup Midi
+ //-------------------------------------------------------------
+
+ midiInputPlugins = new QPopupMenu(this);
+ midiInputPlugins->setCheckable(false);
+ mpid0 = midiInputPlugins->insertItem(
+ QIconSet(*midi_inputplugins_transposeIcon), tr("Transpose"), 0);
+ mpid1 = midiInputPlugins->insertItem(
+ QIconSet(*midi_inputplugins_midi_input_transformIcon), tr("Midi Input Transform"), 1);
+ mpid2 = midiInputPlugins->insertItem(
+ QIconSet(*midi_inputplugins_midi_input_filterIcon), tr("Midi Input Filter"), 2);
+ mpid3 = midiInputPlugins->insertItem(
+ QIconSet(*midi_inputplugins_remote_controlIcon), tr("Midi Remote Control"), 3);
+/*
+** mpid4 = midiInputPlugins->insertItem(
+** QIconSet(*midi_inputplugins_random_rhythm_generatorIcon), tr("Random Rhythm Generator"), 4);
+*/
+ connect(midiInputPlugins, SIGNAL(activated(int)), SLOT(startMidiInputPlugin(int)));
+
+// midiInputPlugins->setItemEnabled(mpid4, false);
+
+ menu_functions = new QPopupMenu(this);
+ menu_functions->setCheckable(true);
+ menuBar()->insertItem(tr("&Midi"), menu_functions);
+ menu_functions->setCaption(tr("Midi"));
+
+ menuScriptPlugins = new QPopupMenu(this);
+ song->populateScriptMenu(menuScriptPlugins, this);
+ menu_functions->insertItem(tr("&Plugins"), menuScriptPlugins);
+
+ menu_ids[CMD_MIDI_EDIT_INSTRUMENTS] = menu_functions->insertItem(
+ QIconSet(*midi_edit_instrumentIcon), tr("Edit Instrument"), this, SLOT(startEditInstrument()), 0);
+ menu_functions->insertItem(
+ QIconSet(*midi_inputpluginsIcon), tr("Input Plugins"), midiInputPlugins, Key_P);
+ menu_functions->insertSeparator();
+ menu_ids[CMD_MIDI_RESET] = menu_functions->insertItem(
+ QIconSet(*midi_reset_instrIcon), tr("Reset Instr."), this, SLOT(resetMidiDevices()), 0);
+ menu_ids[CMD_MIDI_INIT] = menu_functions->insertItem(
+ QIconSet(*midi_init_instrIcon), tr("Init Instr."), this, SLOT(initMidiDevices()), 0);
+ menu_ids[CMD_MIDI_LOCAL_OFF] = menu_functions->insertItem(
+ QIconSet(*midi_local_offIcon), tr("local off"), this, SLOT(localOff()), 0);
+
+ //-------------------------------------------------------------
+ // popup Audio
+ //-------------------------------------------------------------
+
+ menu_audio = new QPopupMenu(this);
+ menu_audio->setCheckable(true);
+ menuBar()->insertItem(tr("&Audio"), menu_audio);
+ menu_ids[CMD_AUDIO_BOUNCE_TO_TRACK] = menu_audio->insertItem(
+ QIconSet(*audio_bounce_to_trackIcon), tr("Bounce to Track"), this, SLOT(bounceToTrack()), 0);
+ menu_ids[CMD_AUDIO_BOUNCE_TO_FILE] = menu_audio->insertItem(
+ QIconSet(*audio_bounce_to_fileIcon), tr("Bounce to File"), this, SLOT(bounceToFile()), 0);
+ menu_audio->insertSeparator();
+ menu_ids[CMD_AUDIO_RESTART] = menu_audio->insertItem(
+ QIconSet(*audio_restartaudioIcon), tr("Restart Audio"), this, SLOT(seqRestart()), 0);
+
+ //-------------------------------------------------------------
+ // popup Automation
+ //-------------------------------------------------------------
+
+ menuAutomation = new QPopupMenu(this);
+ menuAutomation->setCheckable(true);
+ menuBar()->insertItem(tr("Automation"), menuAutomation);
+ autoId = menuAutomation->insertItem(
+ QIconSet(*automation_mixerIcon), tr("Mixer Automation"), this, SLOT(switchMixerAutomation()), 0);
+ menuAutomation->insertSeparator();
+ menu_ids[CMD_MIXER_SNAPSHOT] = menuAutomation->insertItem(
+ QIconSet(*automation_take_snapshotIcon), tr("Take Snapshot"), this, SLOT(takeAutomationSnapshot()), 0);
+ menu_ids[CMD_MIXER_AUTOMATION_CLEAR] = menuAutomation->insertItem(
+ QIconSet(*automation_clear_dataIcon), tr("Clear Automation Data"), this, SLOT(clearAutomation()), 0);
+ menuAutomation->setItemEnabled(menu_ids[CMD_MIXER_AUTOMATION_CLEAR], false);
+
+ //-------------------------------------------------------------
+ // popup Settings
+ //-------------------------------------------------------------
+
+ follow = new QPopupMenu(this);
+ follow->setCheckable(false);
+ fid0 = follow->insertItem(tr("dont follow Song"), CMD_FOLLOW_NO);
+ fid1 = follow->insertItem(tr("follow page"), CMD_FOLLOW_JUMP);
+ fid2 = follow->insertItem(tr("follow continuous"), CMD_FOLLOW_CONTINUOUS);
+ follow->setItemChecked(fid1, true);
+ connect(follow, SIGNAL(activated(int)), SLOT(cmd(int)));
+
+ menuSettings = new QPopupMenu(this);
+ menuSettings->setCheckable(false);
+ menuBar()->insertItem(tr("Settings"), menuSettings);
+ menu_ids[CMD_GLOBAL_CONFIG] = menuSettings->insertItem(
+ QIconSet(*settings_globalsettingsIcon), tr("Global Settings"), this, SLOT(configGlobalSettings()),0);
+ menu_ids[CMD_CONFIG_SHORTCUTS] = menuSettings->insertItem(
+ QIconSet(*settings_configureshortcutsIcon), tr("Configure shortcuts"), this, SLOT(configShortCuts()), 0);
+ menuSettings->insertItem(
+ QIconSet(*settings_follow_songIcon), tr("follow song"), follow, Key_F);
+ menu_ids[CMD_CONFIG_METRONOME] = menuSettings->insertItem(
+ QIconSet(*settings_metronomeIcon), tr("Metronome"), this, SLOT(configMetronome()), 0);
+ menuSettings->insertSeparator();
+ menu_ids[CMD_CONFIG_MIDISYNC] = menuSettings->insertItem(
+ QIconSet(*settings_midisyncIcon), tr("Midi Sync"), this, SLOT(configMidiSync()), 0);
+ menu_ids[CMD_MIDI_FILE_CONFIG] = menuSettings->insertItem(
+ QIconSet(*settings_midifileexportIcon), tr("Midi File Import/Export"), this, SLOT(configMidiFile()), 0);
+ menuSettings->insertSeparator();
+ menu_ids[CMD_APPEARANCE_SETTINGS] = menuSettings->insertItem(
+ QIconSet(*settings_appearance_settingsIcon), tr("Appearance settings"), this, SLOT(configAppearance()), 0);
+ menuSettings->insertSeparator();
+ menu_ids[CMD_CONFIG_MIDI_PORTS] = menuSettings->insertItem(
+ QIconSet(*settings_midiport_softsynthsIcon), tr("Midi Ports / Soft Synth"), this, SLOT(configMidiPorts()), 0);
+
+ //---------------------------------------------------
+ // popup Help
+ //---------------------------------------------------
+
+ menuBar()->insertSeparator();
+ menu_help = new QPopupMenu(this);
+ menu_help->setCheckable(false);
+ menuBar()->insertItem(tr("&Help"), menu_help);
+
+ menu_ids[CMD_OPEN_HELP] = menu_help->insertItem(tr("&Manual"), this, SLOT(startHelpBrowser()), 0);
+ menu_ids[CMD_OPEN_HOMEPAGE] = menu_help->insertItem(tr("&MusE homepage"), this, SLOT(startHomepageBrowser()), 0);
+ menu_help->insertSeparator();
+ menu_ids[CMD_OPEN_BUG] = menu_help->insertItem(tr("&Report Bug..."), this, SLOT(startBugBrowser()), 0);
+ menu_help->insertSeparator();
+ menu_help->insertItem(tr("&About MusE"), this, SLOT(about()));
+ menu_help->insertItem(tr("About&Qt"), this, SLOT(aboutQt()));
+ menu_help->insertSeparator();
+ menu_ids[CMD_START_WHATSTHIS] = menu_help->insertItem(tr("What's &This?"), this, SLOT(whatsThis()), 0);
+
+ //---------------------------------------------------
+ // Central Widget
+ //---------------------------------------------------
+
+ arranger = new Arranger(this, "arranger");
+ setCentralWidget(arranger);
+
+ connect(tools1, SIGNAL(toolChanged(int)), arranger, SLOT(setTool(int)));
+ connect(arranger, SIGNAL(editPart(Track*)), SLOT(startEditor(Track*)));
+ connect(arranger, SIGNAL(dropSongFile(const QString&)), SLOT(loadProjectFile(const QString&)));
+ connect(arranger, SIGNAL(dropMidiFile(const QString&)), SLOT(importMidi(const QString&)));
+ connect(arranger, SIGNAL(startEditor(PartList*,int)), SLOT(startEditor(PartList*,int)));
+ connect(arranger, SIGNAL(toolChanged(int)), tools1, SLOT(set(int)));
+ connect(this, SIGNAL(configChanged()), arranger, SLOT(configChanged()));
+
+ connect(arranger, SIGNAL(setUsedTool(int)), SLOT(setUsedTool(int)));
+
+ //---------------------------------------------------
+ // read list of "Recent Projects"
+ //---------------------------------------------------
+
+ QString prjPath(getenv("HOME"));
+ prjPath += QString("/.musePrj");
+ FILE* f = fopen(prjPath.latin1(), "r");
+ if (f == 0) {
+ perror("open projectfile");
+ for (int i = 0; i < PROJECT_LIST_LEN; ++i)
+ projectList[i] = 0;
+ }
+ else {
+ for (int i = 0; i < PROJECT_LIST_LEN; ++i) {
+ char buffer[256];
+ if (fgets(buffer, 256, f)) {
+ int n = strlen(buffer);
+ if (n && buffer[n-1] == '\n')
+ buffer[n-1] = 0;
+ projectList[i] = *buffer ? new QString(buffer) : 0;
+ }
+ else
+ break;
+ }
+ fclose(f);
+ }
+
+ initMidiSynth();
+
+ populateAddTrack(addTrack);
+
+ transport = new Transport(this, "transport");
+ bigtime = 0;
+
+ QClipboard* cb = QApplication::clipboard();
+ connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged()));
+ connect(cb, SIGNAL(selectionChanged()), SLOT(clipboardChanged()));
+ connect(arranger, SIGNAL(selectionChanged()), SLOT(selectionChanged()));
+
+ //---------------------------------------------------
+ // load project
+ // if no songname entered on command line:
+ // startMode: 0 - load last song
+ // 1 - load default template
+ // 2 - load configured start song
+ //---------------------------------------------------
+
+ QString name;
+ bool useTemplate = false;
+ if (argc >= 2)
+ name = argv[0];
+ else if (config.startMode == 0) {
+ if (argc < 2)
+ name = projectList[0] ? *projectList[0] : QString("untitled");
+ else
+ name = argv[0];
+ printf("starting with selected song %s\n", config.startSong.latin1());
+ }
+ else if (config.startMode == 1) {
+ printf("starting with default template\n");
+ name = museGlobalShare + QString("/templates/default.med");
+ useTemplate = true;
+ }
+ else if (config.startMode == 2) {
+ printf("starting with pre configured song %s\n", config.startSong.latin1());
+ name = config.startSong;
+ }
+ song->blockSignals(false);
+ loadProjectFile(name, useTemplate, true);
+ changeConfig(false);
+
+ song->update();
+ }
+
+//---------------------------------------------------------
+// setHeartBeat
+//---------------------------------------------------------
+
+void MusE::setHeartBeat()
+ {
+ heartBeatTimer->start(1000/config.guiRefresh);
+ }
+
+//---------------------------------------------------------
+// resetDevices
+//---------------------------------------------------------
+
+void MusE::resetMidiDevices()
+ {
+ audio->msgResetMidiDevices();
+ }
+
+//---------------------------------------------------------
+// initMidiDevices
+//---------------------------------------------------------
+
+void MusE::initMidiDevices()
+ {
+ // Added by T356
+ //audio->msgIdle(true);
+
+ audio->msgInitMidiDevices();
+
+ // Added by T356
+ //audio->msgIdle(false);
+ }
+
+//---------------------------------------------------------
+// localOff
+//---------------------------------------------------------
+
+void MusE::localOff()
+ {
+ audio->msgLocalOff();
+ }
+
+//---------------------------------------------------------
+// loadProjectFile
+// load *.med, *.mid, *.kar
+//
+// template - if true, load file but do not change
+// project name
+//---------------------------------------------------------
+
+// for drop:
+void MusE::loadProjectFile(const QString& name)
+ {
+ loadProjectFile(name, false, false);
+ }
+
+void MusE::loadProjectFile(const QString& name, bool songTemplate, bool loadAll)
+ {
+ //
+ // stop audio threads if running
+ //
+ bool restartSequencer = audio->isRunning();
+ if (restartSequencer) {
+ if (audio->isPlaying()) {
+ audio->msgPlay(false);
+ while (audio->isPlaying())
+ qApp->processEvents();
+ }
+ seqStop();
+ }
+ microSleep(200000);
+ loadProjectFile1(name, songTemplate, loadAll);
+ microSleep(200000);
+ if (restartSequencer)
+ seqStart();
+
+ if (song->getSongInfo().length()>0)
+ startSongInfo(false);
+ }
+
+//---------------------------------------------------------
+// loadProjectFile
+// load *.med, *.mid, *.kar
+//
+// template - if true, load file but do not change
+// project name
+// loadAll - load song data + configuration data
+//---------------------------------------------------------
+
+void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll)
+ {
+ //if (audioMixer)
+ // audioMixer->clear();
+ if (mixer1)
+ mixer1->clear();
+ if (mixer2)
+ mixer2->clear();
+ arranger->clear(); // clear track info
+ if (clearSong())
+ return;
+
+ QFileInfo fi(name);
+ if (songTemplate) {
+ if (!fi.isReadable()) {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("Cannot read template"));
+ return;
+ }
+ project.setFile("untitled");
+ }
+ else {
+ printf("Setting project path to %s\n", fi.dirPath(true).latin1());
+ museProject = fi.dirPath(true);
+ project.setFile(name);
+ }
+ // Changed by T356. 01/19/2010. We want the complete extension here.
+ //QString ex = fi.extension(false).lower();
+ //if (ex.length() == 3)
+ // ex += ".";
+ //ex = ex.left(4);
+ QString ex = fi.extension(true).lower();
+ QString mex = ex.section('.', -1, -1);
+ if((mex == "gz") || (mex == "bz2"))
+ mex = ex.section('.', -2, -2);
+
+ //if (ex.isEmpty() || ex == "med.") {
+ if (ex.isEmpty() || mex == "med") {
+ //
+ // read *.med file
+ //
+ bool popenFlag;
+ FILE* f = fileOpen(this, fi.filePath(), QString(".med"), "r", popenFlag, true);
+ if (f == 0) {
+ if (errno != ENOENT) {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("File open error"));
+ setUntitledProject();
+ }
+ else
+ setConfigDefaults();
+ }
+ else {
+ Xml xml(f);
+ read(xml, !loadAll);
+ bool fileError = ferror(f);
+ popenFlag ? pclose(f) : fclose(f);
+ if (fileError) {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("File read error"));
+ setUntitledProject();
+ }
+ }
+ }
+ //else if (ex == "mid." || ex == "kar.") {
+ else if (mex == "mid" || mex == "kar") {
+ setConfigDefaults();
+ if (!importMidi(name, false))
+ setUntitledProject();
+ }
+ else {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("Unknown File Format: ") + ex);
+ setUntitledProject();
+ }
+ if (!songTemplate) {
+ addProject(project.absFilePath());
+ setCaption(QString("MusE: Song: ") + project.baseName(true));
+ }
+ song->dirty = false;
+
+ menuView->setItemChecked(tr_id, config.transportVisible);
+ menuView->setItemChecked(bt_id, config.bigTimeVisible);
+ menuView->setItemChecked(mr_id, config.markerVisible);
+ menuAutomation->setItemChecked(autoId, automation);
+
+ if (loadAll) {
+ showBigtime(config.bigTimeVisible);
+ //showMixer(config.mixerVisible);
+ showMixer1(config.mixer1Visible);
+ showMixer2(config.mixer1Visible);
+ showMarker(config.markerVisible);
+ resize(config.geometryMain.size());
+ move(config.geometryMain.topLeft());
+
+ if (config.transportVisible)
+ transport->show();
+ transport->move(config.geometryTransport.topLeft());
+ showTransport(config.transportVisible);
+ }
+
+ transport->setMasterFlag(song->masterFlag());
+ punchinAction->setOn(song->punchin());
+ punchoutAction->setOn(song->punchout());
+ loopAction->setOn(song->loop());
+ song->update();
+ song->updatePos();
+ clipboardChanged(); // enable/disable "Paste"
+ selectionChanged(); // enable/disable "Copy" & "Paste"
+ }
+
+//---------------------------------------------------------
+// setUntitledProject
+//---------------------------------------------------------
+
+void MusE::setUntitledProject()
+ {
+ setConfigDefaults();
+ QString name("untitled");
+ museProject = QFileInfo(name).dirPath(true);
+ project.setFile(name);
+ setCaption(tr("MusE: Song: ") + project.baseName(true));
+ }
+
+//---------------------------------------------------------
+// setConfigDefaults
+//---------------------------------------------------------
+
+void MusE::setConfigDefaults()
+ {
+ readConfiguration(); // used for reading midi files
+#if 0
+ if (readConfiguration()) {
+ //
+ // failed to load config file
+ // set buildin defaults
+ //
+ configTransportVisible = false;
+ configBigTimeVisible = false;
+
+ for (int channel = 0; channel < 2; ++channel)
+ song->addTrack(Track::AUDIO_GROUP);
+ AudioTrack* out = (AudioTrack*)song->addTrack(Track::AUDIO_OUTPUT);
+ AudioTrack* in = (AudioTrack*)song->addTrack(Track::AUDIO_INPUT);
+
+ // set some default routes
+ std::list<QString> il = audioDevice->inputPorts();
+ int channel = 0;
+ for (std::list<QString>::iterator i = il.begin(); i != il.end(); ++i, ++channel) {
+ if (channel == 2)
+ break;
+ audio->msgAddRoute(Route(out,channel), Route(*i,channel));
+ }
+ channel = 0;
+ std::list<QString> ol = audioDevice->outputPorts();
+ for (std::list<QString>::iterator i = ol.begin(); i != ol.end(); ++i, ++channel) {
+ if (channel == 2)
+ break;
+ audio->msgAddRoute(Route(*i, channel), Route(in,channel));
+ }
+ }
+#endif
+ song->dirty = false;
+ }
+
+//---------------------------------------------------------
+// setFollow
+//---------------------------------------------------------
+
+void MusE::setFollow()
+ {
+ Song::FollowMode fm = song->follow();
+ follow->setItemChecked(fid0, fm == Song::NO);
+ follow->setItemChecked(fid1, fm == Song::JUMP);
+ follow->setItemChecked(fid2, fm == Song::CONTINUOUS);
+ }
+
+//---------------------------------------------------------
+// MusE::loadProject
+//---------------------------------------------------------
+
+void MusE::loadProject()
+ {
+ bool loadAll;
+ QString fn = getOpenFileName(QString(""), med_file_pattern, this,
+ tr("MusE: load project"), &loadAll);
+ if (!fn.isEmpty()) {
+ museProject = QFileInfo(fn).dirPath(true);
+ loadProjectFile(fn, false, loadAll);
+ }
+ }
+
+//---------------------------------------------------------
+// loadTemplate
+//---------------------------------------------------------
+
+void MusE::loadTemplate()
+ {
+ QString fn = getOpenFileName(QString("templates"), med_file_pattern, this,
+ tr("MusE: load template"), 0);
+ if (!fn.isEmpty()) {
+ // museProject = QFileInfo(fn).dirPath(true);
+ loadProjectFile(fn, true, true);
+ setUntitledProject();
+ }
+ }
+
+//---------------------------------------------------------
+// save
+//---------------------------------------------------------
+
+bool MusE::save()
+ {
+ if (project.baseName(true) == "untitled")
+ return saveAs();
+ else
+ return save(project.filePath(), false);
+ }
+
+//---------------------------------------------------------
+// save
+//---------------------------------------------------------
+
+bool MusE::save(const QString& name, bool overwriteWarn)
+ {
+ QString backupCommand;
+
+ // By T356. Cache the jack in/out route names BEFORE saving.
+ // Because jack often shuts down during save, causing the routes to be lost in the file.
+ // Not required any more...
+ //cacheJackRouteNames();
+
+ if (QFile::exists(name)) {
+ backupCommand.sprintf("cp \"%s\" \"%s.backup\"", name.latin1(), name.latin1());
+ }
+ else if (QFile::exists(name + QString(".med"))) {
+ backupCommand.sprintf("cp \"%s.med\" \"%s.med.backup\"", name.latin1(), name.latin1());
+ }
+ if (!backupCommand.isEmpty())
+ system(backupCommand.latin1());
+
+ bool popenFlag;
+ FILE* f = fileOpen(this, name, QString(".med"), "w", popenFlag, false, overwriteWarn);
+ if (f == 0)
+ return false;
+ Xml xml(f);
+ write(xml);
+ if (ferror(f)) {
+ QString s = "Write File\n" + name + "\nfailed: "
+ + strerror(errno);
+ QMessageBox::critical(this,
+ tr("MusE: Write File failed"), s);
+ popenFlag? pclose(f) : fclose(f);
+ unlink(name.latin1());
+ return false;
+ }
+ else {
+ popenFlag? pclose(f) : fclose(f);
+ song->dirty = false;
+ return true;
+ }
+ }
+
+//---------------------------------------------------------
+// quitDoc
+//---------------------------------------------------------
+
+void MusE::quitDoc()
+ {
+ close(true);
+ }
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void MusE::closeEvent(QCloseEvent*)
+ {
+ song->setStop(true);
+ //
+ // wait for sequencer
+ //
+ while (audio->isPlaying()) {
+ qApp->processEvents();
+ }
+ if (song->dirty) {
+ int n = 0;
+ n = QMessageBox::warning(this, appName,
+ tr("The current Project contains unsaved data\n"
+ "Save Current Project?"),
+ tr("&Save"), tr("&Skip"), tr("&Abort"), 0, 2);
+ if (n == 0) {
+ if (!save()) // dont quit if save failed
+ return;
+ }
+ else if (n == 2)
+ return;
+ }
+ seqStop();
+
+ WaveTrackList* wt = song->waves();
+ for (iWaveTrack iwt = wt->begin(); iwt != wt->end(); ++iwt) {
+ WaveTrack* t = *iwt;
+ if (t->recFile() && t->recFile()->samples() == 0) {
+ t->recFile()->remove();
+ }
+ }
+
+ // save "Open Recent" list
+ QString prjPath(getenv("HOME"));
+ prjPath += "/.musePrj";
+ FILE* f = fopen(prjPath.latin1(), "w");
+ if (f) {
+ for (int i = 0; i < PROJECT_LIST_LEN; ++i) {
+ fprintf(f, "%s\n", projectList[i] ? projectList[i]->latin1() : "");
+ }
+ fclose(f);
+ }
+ if(debugMsg)
+ printf("Muse: Exiting JackAudio\n");
+ exitJackAudio();
+ if(debugMsg)
+ printf("Muse: Exiting DummyAudio\n");
+ exitDummyAudio();
+ if(debugMsg)
+ printf("Muse: Exiting Metronome\n");
+ exitMetronome();
+
+ // Changed by Tim. p3.3.14
+ //SynthIList* sl = song->syntis();
+ //for (iSynthI i = sl->begin(); i != sl->end(); ++i)
+ // delete *i;
+ song->cleanupForQuit();
+
+ if(debugMsg)
+ printf("Muse: Cleaning up temporary wavefiles + peakfiles\n");
+ // Cleanup temporary wavefiles + peakfiles used for undo
+ for (std::list<QString>::iterator i = temporaryWavFiles.begin(); i != temporaryWavFiles.end(); i++) {
+ QString filename = *i;
+ QFileInfo f(filename);
+ QDir d = f.dir();
+ d.remove(filename);
+ d.remove(f.baseName(true) + ".wca");
+ }
+
+ // Added by Tim. p3.3.14
+
+#ifdef HAVE_LASH
+ // Disconnect gracefully from LASH.
+ if(lash_client)
+ {
+ if(debugMsg)
+ printf("Muse: Disconnecting from LASH\n");
+ lash_event_t* lashev = lash_event_new_with_type (LASH_Quit);
+ lash_send_event(lash_client, lashev);
+ }
+#endif
+
+ if(debugMsg)
+ printf("Muse: Exiting Dsp\n");
+ AL::exitDsp();
+
+ qApp->quit();
+ }
+
+//---------------------------------------------------------
+// toggleMarker
+//---------------------------------------------------------
+
+void MusE::toggleMarker()
+ {
+ showMarker(!menuView->isItemChecked(mr_id));
+ }
+
+//---------------------------------------------------------
+// showMarker
+//---------------------------------------------------------
+
+void MusE::showMarker(bool flag)
+ {
+ //printf("showMarker %d\n",flag);
+ if (markerView == 0) {
+ markerView = new MarkerView(this);
+
+ connect(arranger, SIGNAL(addMarker(int)), markerView, SLOT(addMarker(int)));
+ connect(markerView, SIGNAL(closed()), SLOT(markerClosed()));
+ toplevels.push_back(Toplevel(Toplevel::MARKER, (unsigned long)(markerView), markerView));
+ markerView->show();
+ }
+
+ markerView->setShown(flag);
+ menuView->setItemChecked(mr_id, flag);
+ }
+
+//---------------------------------------------------------
+// markerClosed
+//---------------------------------------------------------
+
+void MusE::markerClosed()
+ {
+ menuView->setItemChecked(mr_id, false);
+ }
+
+//---------------------------------------------------------
+// toggleTransport
+//---------------------------------------------------------
+
+void MusE::toggleTransport()
+ {
+ showTransport(!menuView->isItemChecked(tr_id));
+ }
+
+//---------------------------------------------------------
+// showTransport
+//---------------------------------------------------------
+
+void MusE::showTransport(bool flag)
+ {
+ transport->setShown(flag);
+ menuView->setItemChecked(tr_id, flag);
+ }
+
+//---------------------------------------------------------
+// saveAs
+//---------------------------------------------------------
+
+bool MusE::saveAs()
+ {
+// QString name = getSaveFileName(museProject, med_file_pattern, this,
+// QString name = getSaveFileName(QString(""), med_file_pattern, this,
+ QString name = getSaveFileName(QString(""), med_file_save_pattern, this,
+ tr("MusE: Save As"));
+ bool ok = false;
+ if (!name.isEmpty()) {
+ QString tempOldProj = museProject;
+ museProject = QFileInfo(name).dirPath(true);
+ ok = save(name, true);
+ if (ok) {
+ project.setFile(name);
+ setCaption(tr("MusE: Song: ") + project.baseName(true));
+ addProject(name);
+ }
+ else
+ museProject = tempOldProj;
+ }
+
+ return ok;
+ }
+
+//---------------------------------------------------------
+// printVersion
+//---------------------------------------------------------
+
+static void printVersion(const char* prog)
+ {
+ fprintf(stderr, "%s: Linux Music Editor; Version %s\n", prog, VERSION);
+ }
+
+//---------------------------------------------------------
+// startEditor
+//---------------------------------------------------------
+
+void MusE::startEditor(PartList* pl, int type)
+ {
+ switch (type) {
+ case 0: startPianoroll(pl); break;
+ case 1: startListEditor(pl); break;
+ case 3: startDrumEditor(pl); break;
+ case 4: startWaveEditor(pl); break;
+ }
+ }
+
+//---------------------------------------------------------
+// startEditor
+//---------------------------------------------------------
+
+void MusE::startEditor(Track* t)
+ {
+ switch (t->type()) {
+ case Track::MIDI: startPianoroll(); break;
+ case Track::DRUM: startDrumEditor(); break;
+ case Track::WAVE: startWaveEditor(); break;
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// getMidiPartsToEdit
+//---------------------------------------------------------
+
+PartList* MusE::getMidiPartsToEdit()
+ {
+ PartList* pl = song->getSelectedMidiParts();
+ if (pl->empty()) {
+ QMessageBox::critical(this, QString("MusE"), tr("Nothing to edit"));
+ return 0;
+ }
+ return pl;
+ }
+
+//---------------------------------------------------------
+// startPianoroll
+//---------------------------------------------------------
+
+void MusE::startPianoroll()
+ {
+ PartList* pl = getMidiPartsToEdit();
+ if (pl == 0)
+ return;
+ startPianoroll(pl);
+ }
+
+void MusE::startPianoroll(PartList* pl)
+ {
+
+ PianoRoll* pianoroll = new PianoRoll(pl, this, 0, arranger->cursorValue());
+ pianoroll->show();
+ toplevels.push_back(Toplevel(Toplevel::PIANO_ROLL, (unsigned long)(pianoroll), pianoroll));
+ connect(pianoroll, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long)));
+ connect(muse, SIGNAL(configChanged()), pianoroll, SLOT(configChanged()));
+ }
+
+//---------------------------------------------------------
+// startListenEditor
+//---------------------------------------------------------
+
+void MusE::startListEditor()
+ {
+ PartList* pl = getMidiPartsToEdit();
+ if (pl == 0)
+ return;
+ startListEditor(pl);
+ }
+
+void MusE::startListEditor(PartList* pl)
+ {
+ ListEdit* listEditor = new ListEdit(pl);
+ listEditor->show();
+ toplevels.push_back(Toplevel(Toplevel::LISTE, (unsigned long)(listEditor), listEditor));
+ connect(listEditor, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long)));
+ connect(muse,SIGNAL(configChanged()), listEditor, SLOT(configChanged()));
+ }
+
+//---------------------------------------------------------
+// startMasterEditor
+//---------------------------------------------------------
+
+void MusE::startMasterEditor()
+ {
+ MasterEdit* masterEditor = new MasterEdit();
+ masterEditor->show();
+ toplevels.push_back(Toplevel(Toplevel::MASTER, (unsigned long)(masterEditor), masterEditor));
+ connect(masterEditor, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long)));
+ }
+
+//---------------------------------------------------------
+// startLMasterEditor
+//---------------------------------------------------------
+
+void MusE::startLMasterEditor()
+ {
+ LMaster* lmaster = new LMaster();
+ lmaster->show();
+ toplevels.push_back(Toplevel(Toplevel::LMASTER, (unsigned long)(lmaster), lmaster));
+ connect(lmaster, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long)));
+ connect(muse, SIGNAL(configChanged()), lmaster, SLOT(configChanged()));
+ }
+
+//---------------------------------------------------------
+// startDrumEditor
+//---------------------------------------------------------
+
+void MusE::startDrumEditor()
+ {
+ PartList* pl = getMidiPartsToEdit();
+ if (pl == 0)
+ return;
+ startDrumEditor(pl);
+ }
+
+void MusE::startDrumEditor(PartList* pl)
+ {
+
+ DrumEdit* drumEditor = new DrumEdit(pl, this, 0, arranger->cursorValue());
+ drumEditor->show();
+ toplevels.push_back(Toplevel(Toplevel::DRUM, (unsigned long)(drumEditor), drumEditor));
+ connect(drumEditor, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long)));
+ connect(muse, SIGNAL(configChanged()), drumEditor, SLOT(configChanged()));
+ }
+
+//---------------------------------------------------------
+// startWaveEditor
+//---------------------------------------------------------
+
+void MusE::startWaveEditor()
+ {
+ PartList* pl = song->getSelectedWaveParts();
+ if (pl->empty()) {
+ QMessageBox::critical(this, QString("MusE"), tr("Nothing to edit"));
+ return;
+ }
+ startWaveEditor(pl);
+ }
+
+void MusE::startWaveEditor(PartList* pl)
+ {
+ WaveEdit* waveEditor = new WaveEdit(pl);
+ waveEditor->show();
+ connect(muse, SIGNAL(configChanged()), waveEditor, SLOT(configChanged()));
+ toplevels.push_back(Toplevel(Toplevel::WAVE, (unsigned long)(waveEditor), waveEditor));
+ connect(waveEditor, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long)));
+ }
+
+
+//---------------------------------------------------------
+// startSongInfo
+//---------------------------------------------------------
+void MusE::startSongInfo(bool editable)
+ {
+ printf("startSongInfo!!!!\n");
+ SongInfo info;
+ info.songInfoText->setText(song->getSongInfo());
+ info.songInfoText->setReadOnly(!editable);
+ info.show();
+ if( info.exec() == QDialog::Accepted) {
+ if (editable)
+ song->setSongInfo(info.songInfoText->text());
+ }
+
+ }
+
+//---------------------------------------------------------
+// showDidYouKnowDialog
+//---------------------------------------------------------
+void MusE::showDidYouKnowDialog()
+ {
+ if ((bool)config.showDidYouKnow == true) {
+ printf("show did you know dialog!!!!\n");
+ DidYouKnow dyk;
+ dyk.tipText->setText("To get started with MusE why don't you try some demo songs available at http://demos.muse-sequencer.org/");
+ dyk.show();
+ if( dyk.exec()) {
+ if (dyk.dontShowCheckBox->isChecked()) {
+ printf("disables dialog!\n");
+ config.showDidYouKnow=false;
+ muse->changeConfig(true); // save settings
+ }
+ }
+ }
+ }
+//---------------------------------------------------------
+// startDefineController
+//---------------------------------------------------------
+
+
+//---------------------------------------------------------
+// startClipList
+//---------------------------------------------------------
+
+void MusE::startClipList()
+ {
+ if (clipListEdit == 0) {
+ clipListEdit = new ClipListEdit();
+ toplevels.push_back(Toplevel(Toplevel::CLIPLIST, (unsigned long)(clipListEdit), clipListEdit));
+ connect(clipListEdit, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long)));
+ }
+ clipListEdit->show();
+ menu_audio->setItemChecked(aid2, true);
+ }
+
+//---------------------------------------------------------
+// fileMenu
+//---------------------------------------------------------
+
+void MusE::openRecentMenu()
+ {
+ openRecent->clear();
+ for (int i = 0; i < PROJECT_LIST_LEN; ++i) {
+ if (projectList[i] == 0)
+ break;
+ const char* path = projectList[i]->latin1();
+ const char* p = strrchr(path, '/');
+ if (p == 0)
+ p = path;
+ else
+ ++p;
+ openRecent->insertItem(QString(p), i);
+ }
+ }
+
+//---------------------------------------------------------
+// selectProject
+//---------------------------------------------------------
+
+void MusE::selectProject(int id)
+ {
+ if (id < 0)
+ return;
+ assert(id < PROJECT_LIST_LEN);
+ QString* name = projectList[id];
+ if (name == 0)
+ return;
+ loadProjectFile(*name, false, true);
+ }
+
+//---------------------------------------------------------
+// toplevelDeleted
+//---------------------------------------------------------
+
+void MusE::toplevelDeleted(unsigned long tl)
+ {
+ for (iToplevel i = toplevels.begin(); i != toplevels.end(); ++i) {
+ if (i->object() == tl) {
+ switch(i->type()) {
+ case Toplevel::MARKER:
+ break;
+ case Toplevel::CLIPLIST:
+ menu_audio->setItemChecked(aid2, false);
+ return;
+ // the followin editors can exist in more than
+ // one instantiation:
+ case Toplevel::PIANO_ROLL:
+ case Toplevel::LISTE:
+ case Toplevel::DRUM:
+ case Toplevel::MASTER:
+ case Toplevel::WAVE:
+ case Toplevel::LMASTER:
+ break;
+ }
+ toplevels.erase(i);
+ return;
+ }
+ }
+ printf("topLevelDeleted: top level %lx not found\n", tl);
+ //assert(false);
+ }
+
+//---------------------------------------------------------
+// ctrlChanged
+// midi ctrl value changed
+//---------------------------------------------------------
+
+#if 0
+void MusE::ctrlChanged()
+ {
+ arranger->updateInspector();
+ }
+#endif
+
+//---------------------------------------------------------
+// kbAccel
+//---------------------------------------------------------
+
+void MusE::kbAccel(int key)
+ {
+ if (key == shortcuts[SHRT_TOGGLE_METRO].key) {
+ song->setClick(!song->click());
+ }
+ else if (key == shortcuts[SHRT_PLAY_TOGGLE].key) {
+ if (audio->isPlaying())
+ //song->setStopPlay(false);
+ song->setStop(true);
+ else if (!config.useOldStyleStopShortCut)
+ song->setPlay(true);
+ else if (song->cpos() != song->lpos())
+ song->setPos(0, song->lPos());
+ else {
+ Pos p(0, true);
+ song->setPos(0, p);
+ }
+ }
+ else if (key == shortcuts[SHRT_STOP].key) {
+ //song->setPlay(false);
+ song->setStop(true);
+ }
+ else if (key == shortcuts[SHRT_GOTO_START].key) {
+ Pos p(0, true);
+ song->setPos(0, p);
+ }
+ else if (key == shortcuts[SHRT_PLAY_SONG].key ) {
+ song->setPlay(true);
+ }
+ else if (key == shortcuts[SHRT_GOTO_LEFT].key) {
+ if (!song->record())
+ song->setPos(0, song->lPos());
+ }
+ else if (key == shortcuts[SHRT_GOTO_RIGHT].key) {
+ if (!song->record())
+ song->setPos(0, song->rPos());
+ }
+ else if (key == shortcuts[SHRT_TOGGLE_LOOP].key) {
+ song->setLoop(!song->loop());
+ }
+ else if (key == shortcuts[SHRT_START_REC].key) {
+ if (!audio->isPlaying()) {
+ song->setRecord(!song->record());
+ }
+ }
+ else if (key == shortcuts[SHRT_OPEN_TRANSPORT].key) {
+ toggleTransport();
+ }
+ else if (key == shortcuts[SHRT_OPEN_BIGTIME].key) {
+ toggleBigTime();
+ }
+ //else if (key == shortcuts[SHRT_OPEN_MIXER].key) {
+ // toggleMixer();
+ // }
+ else if (key == shortcuts[SHRT_OPEN_MIXER].key) {
+ toggleMixer1();
+ }
+ else if (key == shortcuts[SHRT_OPEN_MIXER2].key) {
+ toggleMixer2();
+ }
+ else if (key == shortcuts[SHRT_NEXT_MARKER].key) {
+ if (markerView)
+ markerView->nextMarker();
+ }
+ else if (key == shortcuts[SHRT_PREV_MARKER].key) {
+ if (markerView)
+ markerView->prevMarker();
+ }
+ else {
+ if (debugMsg)
+ printf("unknown kbAccel 0x%x\n", key);
+ }
+ }
+
+//---------------------------------------------------------
+// MuseApplication
+//---------------------------------------------------------
+
+class MuseApplication : public QApplication {
+ MusE* muse;
+
+ public:
+ MuseApplication(int& argc, char** argv)
+ : QApplication(argc, argv)
+ {
+ muse = 0;
+ }
+
+
+ void setMuse(MusE* m) {
+ muse = m;
+#ifdef HAVE_LASH
+ if(useLASH)
+ startTimer (300);
+#endif
+ }
+
+ bool notify(QObject* receiver, QEvent* event) {
+ bool flag = QApplication::notify(receiver, event);
+ if (event->type() == QEvent::KeyPress) {
+ QKeyEvent* ke = (QKeyEvent*)event;
+ globalKeyState = ke->stateAfter();
+ bool accepted = ke->isAccepted();
+ if (!accepted) {
+ muse->kbAccel(ke->key());
+ return true;
+ }
+ }
+ if (event->type() == QEvent::KeyRelease) {
+ QKeyEvent* ke = (QKeyEvent*)event;
+ globalKeyState = ke->stateAfter();
+ }
+
+ return flag;
+ }
+
+#ifdef HAVE_LASH
+ virtual void timerEvent (QTimerEvent * /* e */) {
+ if(useLASH)
+ muse->lash_idle_cb ();
+ }
+#endif /* HAVE_LASH */
+
+ };
+
+//---------------------------------------------------------
+// usage
+//---------------------------------------------------------
+
+static void usage(const char* prog, const char* txt)
+ {
+ fprintf(stderr, "%s: %s\nusage: %s flags midifile\n Flags:\n",
+ prog, txt, prog);
+ fprintf(stderr, " -h this help\n");
+ fprintf(stderr, " -v print version\n");
+ fprintf(stderr, " -d debug mode: no threads, no RT\n");
+ fprintf(stderr, " -D debug mode: enable some debug messages\n");
+ fprintf(stderr, " -m debug mode: trace midi Input\n");
+ fprintf(stderr, " -M debug mode: trace midi Output\n");
+ fprintf(stderr, " -s debug mode: trace sync\n");
+ fprintf(stderr, " -a no audio\n");
+ //fprintf(stderr, " -P n set real time priority to n (default: 50)\n");
+ fprintf(stderr, " -P n set audio driver real time priority to n (Dummy only, default 40. Else fixed by Jack.)\n");
+ fprintf(stderr, " -Y n force midi real time priority to n (default: audio driver prio +1)\n");
+ fprintf(stderr, " -p don't load LADSPA plugins\n");
+#ifdef ENABLE_PYTHON
+ fprintf(stderr, " -y enable Python control support\n");
+#endif
+#ifdef VST_SUPPORT
+ fprintf(stderr, " -V don't load VST plugins\n");
+#endif
+#ifdef DSSI_SUPPORT
+ fprintf(stderr, " -I don't load DSSI plugins\n");
+#endif
+#ifdef HAVE_LASH
+ fprintf(stderr, " -L don't use LASH\n");
+#endif
+ fprintf(stderr, "useful environment variables:\n");
+ fprintf(stderr, " MUSE override library and shared directories location\n");
+ fprintf(stderr, " MUSEHOME override user home directory (HOME/)\n");
+ fprintf(stderr, " MUSEINSTRUMENTS override user instrument directory (MUSEHOME/muse_instruments)\n");
+ }
+
+//---------------------------------------------------------
+// catchSignal
+// only for debugging
+//---------------------------------------------------------
+
+#if 0
+static void catchSignal(int sig)
+ {
+ if (debugMsg)
+ fprintf(stderr, "MusE: signal %d catched\n", sig);
+ if (sig == SIGSEGV) {
+ fprintf(stderr, "MusE: segmentation fault\n");
+ abort();
+ }
+ if (sig == SIGCHLD) {
+ M_DEBUG("caught SIGCHLD - child died\n");
+ int status;
+ int n = waitpid (-1, &status, WNOHANG);
+ if (n > 0) {
+ fprintf(stderr, "SIGCHLD for unknown process %d received\n", n);
+ }
+ }
+ }
+#endif
+
+//---------------------------------------------------------
+// main
+//---------------------------------------------------------
+
+int main(int argc, char* argv[])
+ {
+
+// error = ErrorHandler::create(argv[0]);
+ ruid = getuid();
+ euid = geteuid();
+ undoSetuid();
+ getCapabilities();
+ int noAudio = false;
+
+ const char* mu = getenv("MUSEHOME");
+ if(mu)
+ museUser = QString(mu);
+ if(museUser.isEmpty())
+ museUser = QString(getenv("HOME"));
+
+ QString museGlobal;
+ const char* p = getenv("MUSE");
+ if (p)
+ museGlobal = p;
+
+ if (museGlobal.isEmpty()) {
+ QString museGlobal(INSTPREFIX);
+ museGlobalLib = museGlobal + "/lib/muse";
+ museGlobalShare = museGlobal + "/share/muse";
+ }
+ else {
+ museGlobalLib = museGlobal + "/lib";
+ museGlobalShare = museGlobal + "/share";
+ }
+ museProject = museProjectInitPath; //getcwd(0, 0);
+ configName = QString(getenv("HOME")) + QString("/.MusE");
+
+ museInstruments = museGlobalShare + QString("/instruments");
+
+ const char* ins = getenv("MUSEINSTRUMENTS");
+ if(ins)
+ museUserInstruments = QString(ins);
+ if(museUserInstruments.isEmpty())
+ museUserInstruments = museUser + QString("/muse_instruments");
+
+#ifdef HAVE_LASH
+ lash_args_t * lash_args = 0;
+ if(useLASH)
+ lash_args = lash_extract_args (&argc, &argv);
+#endif
+
+ srand(time(0)); // initialize random number generator
+// signal(SIGCHLD, catchSignal); // interferes with initVST()
+ initMidiController();
+ QApplication::setColorSpec(QApplication::ManyColor);
+ MuseApplication app(argc, argv);
+
+ initShortCuts();
+ readConfiguration();
+
+ if (config.useDenormalBias)
+ printf("Denormal protection enabled.\n");
+ // SHOW MUSE SPLASH SCREEN
+ if (config.showSplashScreen) {
+ QPixmap splsh(museGlobalShare + "/splash.png");
+
+ if (!splsh.isNull()) {
+ QSplashScreen* muse_splash = new QSplashScreen(splsh,
+ Qt::WStyle_StaysOnTop | Qt::WDestructiveClose);
+ muse_splash->show();
+ QTimer* stimer = new QTimer(0);
+ muse_splash->connect(stimer, SIGNAL(timeout()), muse_splash, SLOT(close()));
+ stimer->start(6000, true);
+ }
+ }
+ int i;
+
+ QString optstr("ahvdDmMsP:Y:py");
+#ifdef VST_SUPPORT
+ optstr += QString("V");
+#endif
+#ifdef DSSI_SUPPORT
+ optstr += QString("I");
+#endif
+#ifdef HAVE_LASH
+ optstr += QString("L");
+#endif
+
+//#ifdef VST_SUPPORT
+// while ((i = getopt(argc, argv, "ahvdDmMsVP:py")) != EOF) {
+//#else
+// while ((i = getopt(argc, argv, "ahvdDmMsP:py")) != EOF) {
+//#endif
+
+ while ((i = getopt(argc, argv, optstr.latin1())) != EOF) {
+ char c = (char)i;
+ switch (c) {
+ case 'v': printVersion(argv[0]); return 0;
+ case 'd':
+ debugMode = true;
+ realTimeScheduling = false;
+ break;
+ case 'a':
+ noAudio = true;
+ break;
+ case 'D': debugMsg = true; break;
+ case 'm': midiInputTrace = true; break;
+ case 'M': midiOutputTrace = true; break;
+ case 's': debugSync = true; break;
+ case 'P': realTimePriority = atoi(optarg); break;
+ case 'Y': midiRTPrioOverride = atoi(optarg); break;
+ case 'p': loadPlugins = false; break;
+ case 'V': loadVST = false; break;
+ case 'I': loadDSSI = false; break;
+ case 'L': useLASH = false; break;
+ case 'y': usePythonBridge = true; break;
+ case 'h': usage(argv[0], argv[1]); return -1;
+ default: usage(argv[0], "bad argument"); return -1;
+ }
+ }
+
+ AL::initDsp();
+
+ if (debugMsg)
+ printf("Start euid: %d ruid: %d, Now euid %d\n",
+ euid, ruid, geteuid());
+ if (debugMode) {
+ initDummyAudio();
+ realTimeScheduling = false;
+ }
+ else if (noAudio) {
+ initDummyAudio();
+ realTimeScheduling = true;
+ //if (debugMode) { // ??
+ // realTimeScheduling = false;
+ // }
+ }
+ else if (initJackAudio()) {
+ if (!debugMode)
+ {
+ QMessageBox::critical(NULL, "MusE fatal error", "MusE <b>failed</b> to find a <b>Jack audio server</b>.<br><br>"
+ "<i>MusE will continue without audio support (-a switch)!</i><br><br>"
+ "If this was not intended check that Jack was started. "
+ "If Jack <i>was</i> started check that it was\n"
+ "started as the same user as MusE.\n");
+
+ initDummyAudio();
+ noAudio = true;
+ realTimeScheduling = true;
+ if (debugMode) {
+ realTimeScheduling = false;
+ }
+ }
+ else
+ {
+ fprintf(stderr, "fatal error: no JACK audio server found\n");
+ fprintf(stderr, "no audio functions available\n");
+ fprintf(stderr, "*** experimental mode -- no play possible ***\n");
+ initDummyAudio();
+ //realTimeScheduling = audioDevice->isRealtime();
+ }
+ realTimeScheduling = true;
+ }
+ else
+ realTimeScheduling = audioDevice->isRealtime();
+
+ // setup the prefetch fifo length now that the segmentSize is known
+ // Changed by Tim. p3.3.17
+ // Changed to 4 *, JUST FOR TEST!!!
+ fifoLength = 131072/segmentSize;
+ //fifoLength = (131072/segmentSize) * 4;
+
+
+ argc -= optind;
+ ++argc;
+
+ if (debugMsg) {
+ printf("global lib: <%s>\n", museGlobalLib.latin1());
+ printf("global share: <%s>\n", museGlobalShare.latin1());
+ printf("muse home: <%s>\n", museUser.latin1());
+ printf("project dir: <%s>\n", museProject.latin1());
+ printf("user instruments: <%s>\n", museUserInstruments.latin1());
+ }
+
+ static QTranslator translator(0);
+ QString locale(QTextCodec::locale());
+ if (locale != "C") {
+ QString loc("muse_");
+ loc += QString(QTextCodec::locale());
+ if (translator.load(loc, QString(".")) == false) {
+ QString lp(museGlobalShare);
+ lp += QString("/locale");
+ if (translator.load(loc, lp) == false) {
+ printf("no locale <%s>/<%s>\n", loc.latin1(), lp.latin1());
+ }
+ }
+ app.installTranslator(&translator);
+ }
+
+ if (locale == "de") {
+ printf("locale de\n");
+ hIsB = false;
+ }
+
+ if (loadPlugins)
+ initPlugins();
+
+ if (loadVST)
+ initVST();
+
+ if(loadDSSI)
+ initDSSI();
+
+ initIcons();
+
+ initMetronome();
+ QApplication::clipboard()->setSelectionMode(false);
+
+ QApplication::addLibraryPath(museGlobalLib + "/qtplugins");
+ if (debugMsg) {
+ QStringList list = app.libraryPaths();
+ QStringList::Iterator it = list.begin();
+ printf("QtLibraryPath:\n");
+ while(it != list.end()) {
+ printf(" <%s>\n", (*it).latin1());
+ ++it;
+ }
+ }
+
+ muse = new MusE(argc, &argv[optind]);
+ app.setMuse(muse);
+ muse->setIcon(*museIcon);
+ // Added by Tim. p3.3.22
+ if (!debugMode) {
+ if (mlockall(MCL_CURRENT | MCL_FUTURE))
+ perror("WARNING: Cannot lock memory:");
+ }
+
+ muse->show();
+ muse->seqStart();
+
+#ifdef HAVE_LASH
+ {
+ if(useLASH)
+ {
+ int lash_flags = LASH_Config_File;
+ const char *muse_name = PACKAGE_NAME;
+ lash_client = lash_init (lash_args, muse_name, lash_flags, LASH_PROTOCOL(2,0));
+ lash_alsa_client_id (lash_client, snd_seq_client_id (alsaSeq));
+ if (!noAudio) {
+ // p3.3.38
+ //char *jack_name = ((JackAudioDevice*)audioDevice)->getJackName();
+ const char *jack_name = audioDevice->clientName();
+ lash_jack_client_name (lash_client, jack_name);
+ }
+ }
+ }
+#endif /* HAVE_LASH */
+ QTimer::singleShot(100, muse, SLOT(showDidYouKnowDialog()));
+ return app.exec();
+ }
+
+#if 0
+//---------------------------------------------------------
+// configPart
+//---------------------------------------------------------
+
+void MusE::configPart(int id)
+ {
+ if (id < 3) {
+ partConfig->setItemChecked(0, id == 0);
+ partConfig->setItemChecked(1, id == 1);
+ partConfig->setItemChecked(2, id == 2);
+ arranger->setShowPartType(id);
+ for (int i = 3; i < 10; ++i) {
+ partConfig->setItemEnabled(i, id == 2);
+ }
+ }
+ else {
+ bool flag = !partConfig->isItemChecked(id);
+ partConfig->setItemChecked(id, flag);
+ int val = arranger->showPartEvent();
+ if (flag) {
+ val |= 1 << (id-3);
+ }
+ else {
+ val &= ~(1 << (id-3));
+ }
+ arranger->setShowPartEvent(val);
+ }
+ }
+#endif
+
+//---------------------------------------------------------
+// cmd
+// some cmd's from pulldown menu
+//---------------------------------------------------------
+
+void MusE::cmd(int cmd)
+ {
+ TrackList* tracks = song->tracks();
+ int l = song->lpos();
+ int r = song->rpos();
+
+ switch(cmd) {
+ case CMD_CUT:
+ arranger->cmd(Arranger::CMD_CUT_PART);
+ break;
+ case CMD_COPY:
+ arranger->cmd(Arranger::CMD_COPY_PART);
+ break;
+ case CMD_PASTE:
+ arranger->cmd(Arranger::CMD_PASTE_PART);
+ break;
+ case CMD_PASTE_CLONE:
+ arranger->cmd(Arranger::CMD_PASTE_CLONE_PART);
+ break;
+ case CMD_PASTE_TO_TRACK:
+ arranger->cmd(Arranger::CMD_PASTE_PART_TO_TRACK);
+ break;
+ case CMD_PASTE_CLONE_TO_TRACK:
+ arranger->cmd(Arranger::CMD_PASTE_CLONE_PART_TO_TRACK);
+ break;
+ case CMD_DELETE:
+ song->startUndo();
+ if (song->msgRemoveParts()) {
+ song->endUndo(SC_PART_REMOVED);
+ break;
+ }
+ else
+ audio->msgRemoveTracks();
+ song->endUndo(SC_TRACK_REMOVED);
+ break;
+ case CMD_DELETE_TRACK:
+ song->startUndo();
+ audio->msgRemoveTracks();
+ song->endUndo(SC_TRACK_REMOVED);
+ audio->msgUpdateSoloStates();
+ break;
+
+ case CMD_SELECT_ALL:
+ case CMD_SELECT_NONE:
+ case CMD_SELECT_INVERT:
+ case CMD_SELECT_ILOOP:
+ case CMD_SELECT_OLOOP:
+ for (iTrack i = tracks->begin(); i != tracks->end(); ++i) {
+ PartList* parts = (*i)->parts();
+ for (iPart p = parts->begin(); p != parts->end(); ++p) {
+ bool f = false;
+ int t1 = p->second->tick();
+ int t2 = t1 + p->second->lenTick();
+ bool inside =
+ ((t1 >= l) && (t1 < r))
+ || ((t2 > l) && (t2 < r))
+ || ((t1 <= l) && (t2 > r));
+ switch(cmd) {
+ case CMD_SELECT_INVERT:
+ f = !p->second->selected();
+ break;
+ case CMD_SELECT_NONE:
+ f = false;
+ break;
+ case CMD_SELECT_ALL:
+ f = true;
+ break;
+ case CMD_SELECT_ILOOP:
+ f = inside;
+ break;
+ case CMD_SELECT_OLOOP:
+ f = !inside;
+ break;
+ }
+ p->second->setSelected(f);
+ }
+ }
+ song->update();
+ break;
+
+ case CMD_SELECT_PARTS:
+ for (iTrack i = tracks->begin(); i != tracks->end(); ++i) {
+ if (!(*i)->selected())
+ continue;
+ PartList* parts = (*i)->parts();
+ for (iPart p = parts->begin(); p != parts->end(); ++p)
+ p->second->setSelected(true);
+ }
+ song->update();
+ break;
+ case CMD_FOLLOW_NO:
+ song->setFollow(Song::NO);
+ setFollow();
+ break;
+ case CMD_FOLLOW_JUMP:
+ song->setFollow(Song::JUMP);
+ setFollow();
+ break;
+ case CMD_FOLLOW_CONTINUOUS:
+ song->setFollow(Song::CONTINUOUS);
+ setFollow();
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// clipboardChanged
+//---------------------------------------------------------
+
+void MusE::clipboardChanged()
+ {
+ QCString subtype("partlist");
+ QMimeSource* ms = QApplication::clipboard()->data(QClipboard::Clipboard);
+ if (ms == 0)
+ return;
+ bool flag = false;
+ for (int i = 0; ms->format(i); ++i) {
+// printf("Format <%s\n", ms->format(i));
+ if ((strncmp(ms->format(i), "text/midipartlist", 17) == 0)
+ || (strncmp(ms->format(i), "text/wavepartlist", 17) == 0)
+ // Added by T356. Support mixed .mpt files.
+ || (strncmp(ms->format(i), "text/mixedpartlist", 18) == 0)) {
+ flag = true;
+ break;
+ }
+ }
+ menuEdit->setItemEnabled(CMD_PASTE, flag);
+ menuEdit->setItemEnabled(CMD_PASTE_CLONE, flag);
+ menuEdit->setItemEnabled(CMD_PASTE_TO_TRACK, flag);
+ menuEdit->setItemEnabled(CMD_PASTE_CLONE_TO_TRACK, flag);
+ }
+
+//---------------------------------------------------------
+// selectionChanged
+//---------------------------------------------------------
+
+void MusE::selectionChanged()
+ {
+ bool flag = arranger->isSingleSelection();
+ menuEdit->setItemEnabled(CMD_CUT, flag);
+ //menuEdit->setItemEnabled(CMD_COPY, flag); // Now possible
+ }
+
+//---------------------------------------------------------
+// transpose
+//---------------------------------------------------------
+
+void MusE::transpose()
+ {
+ Transpose *w = new Transpose();
+ w->show();
+ }
+
+//---------------------------------------------------------
+// modifyGateTime
+//---------------------------------------------------------
+
+void MusE::modifyGateTime()
+ {
+ GateTime* w = new GateTime(this);
+ w->show();
+ }
+
+//---------------------------------------------------------
+// modifyVelocity
+//---------------------------------------------------------
+
+void MusE::modifyVelocity()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// crescendo
+//---------------------------------------------------------
+
+void MusE::crescendo()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// thinOut
+//---------------------------------------------------------
+
+void MusE::thinOut()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// eraseEvent
+//---------------------------------------------------------
+
+void MusE::eraseEvent()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// noteShift
+//---------------------------------------------------------
+
+void MusE::noteShift()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// moveClock
+//---------------------------------------------------------
+
+void MusE::moveClock()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// copyMeasure
+//---------------------------------------------------------
+
+void MusE::copyMeasure()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// eraseMeasure
+//---------------------------------------------------------
+
+void MusE::eraseMeasure()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// deleteMeasure
+//---------------------------------------------------------
+
+void MusE::deleteMeasure()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// createMeasure
+//---------------------------------------------------------
+
+void MusE::createMeasure()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// mixTrack
+//---------------------------------------------------------
+
+void MusE::mixTrack()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// configAppearance
+//---------------------------------------------------------
+
+void MusE::configAppearance()
+ {
+ if (!appearance)
+ appearance = new Appearance(arranger);
+ appearance->resetValues();
+ if(appearance->isVisible()) {
+ appearance->raise();
+ appearance->setActiveWindow();
+ }
+ else
+ appearance->show();
+ }
+
+//---------------------------------------------------------
+// loadTheme
+//---------------------------------------------------------
+
+void MusE::loadTheme(QString s)
+ {
+ if (style().name() != s)
+ QApplication::setStyle(s);
+ }
+
+//---------------------------------------------------------
+// configChanged
+// - called whenever configuration has changed
+// - when configuration has changed by user, call with
+// writeFlag=true to save configuration in ~/.MusE
+//---------------------------------------------------------
+
+void MusE::changeConfig(bool writeFlag)
+ {
+ if (writeFlag)
+ writeGlobalConfiguration();
+ loadTheme(config.style);
+ QApplication::setFont(config.fonts[0], true);
+ // Added by Tim. p3.3.6
+ //printf("MusE::changeConfig writeFlag:%d emitting configChanged\n", writeFlag);
+
+ emit configChanged();
+ updateConfiguration();
+ }
+
+//---------------------------------------------------------
+// configMetronome
+//---------------------------------------------------------
+
+void MusE::configMetronome()
+ {
+ if (!metronomeConfig)
+ metronomeConfig = new MetronomeConfig(this, "metronome");
+
+ if(metronomeConfig->isVisible()) {
+ metronomeConfig->raise();
+ metronomeConfig->setActiveWindow();
+ }
+ else
+ metronomeConfig->show();
+ }
+
+
+//---------------------------------------------------------
+// configShortCuts
+//---------------------------------------------------------
+
+void MusE::configShortCuts()
+ {
+ if (!shortcutConfig)
+ shortcutConfig = new ShortcutConfig(this, "shortcutconfig");
+ shortcutConfig->_config_changed = false;
+ if (shortcutConfig->exec())
+ changeConfig(true);
+ }
+
+//---------------------------------------------------------
+// globalCut
+// - remove area between left and right locator
+// - do not touch muted track
+// - cut master track
+//---------------------------------------------------------
+
+void MusE::globalCut()
+ {
+ int lpos = song->lpos();
+ int rpos = song->rpos();
+ if ((lpos - rpos) >= 0)
+ return;
+
+ song->startUndo();
+ TrackList* tracks = song->tracks();
+ for (iTrack it = tracks->begin(); it != tracks->end(); ++it) {
+ MidiTrack* track = dynamic_cast<MidiTrack*>(*it);
+ if (track == 0 || track->mute())
+ continue;
+ PartList* pl = track->parts();
+ for (iPart p = pl->begin(); p != pl->end(); ++p) {
+ Part* part = p->second;
+ int t = part->tick();
+ int l = part->lenTick();
+ if (t + l <= lpos)
+ continue;
+ if ((t >= lpos) && ((t+l) <= rpos)) {
+ audio->msgRemovePart(part, false);
+ }
+ else if ((t < lpos) && ((t+l) > lpos) && ((t+l) <= rpos)) {
+ // remove part tail
+ int len = lpos - t;
+ MidiPart* nPart = new MidiPart(*(MidiPart*)part);
+ nPart->setLenTick(len);
+ //
+ // cut Events in nPart
+ EventList* el = nPart->events();
+ iEvent ie = el->lower_bound(t + len);
+ for (; ie != el->end();) {
+ iEvent i = ie;
+ ++ie;
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgDeleteEvent(i->second, nPart, false);
+ audio->msgDeleteEvent(i->second, nPart, false, false, false);
+ }
+ // Indicate no undo, and do port controller values and clone parts.
+ //audio->msgChangePart(part, nPart, false);
+ audio->msgChangePart(part, nPart, false, true, true);
+ }
+ else if ((t < lpos) && ((t+l) > lpos) && ((t+l) > rpos)) {
+ //----------------------
+ // remove part middle
+ //----------------------
+
+ MidiPart* nPart = new MidiPart(*(MidiPart*)part);
+ EventList* el = nPart->events();
+ iEvent is = el->lower_bound(lpos);
+ iEvent ie = el->upper_bound(rpos);
+ for (iEvent i = is; i != ie;) {
+ iEvent ii = i;
+ ++i;
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgDeleteEvent(ii->second, nPart, false);
+ audio->msgDeleteEvent(ii->second, nPart, false, false, false);
+ }
+
+ ie = el->lower_bound(rpos);
+ for (; ie != el->end();) {
+ iEvent i = ie;
+ ++ie;
+ Event event = i->second;
+ Event nEvent = event.clone();
+ nEvent.setTick(nEvent.tick() - (rpos-lpos));
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, nEvent, nPart, false);
+ audio->msgChangeEvent(event, nEvent, nPart, false, false, false);
+ }
+ nPart->setLenTick(l - (rpos-lpos));
+ // Indicate no undo, and do port controller values and clone parts.
+ //audio->msgChangePart(part, nPart, false);
+ audio->msgChangePart(part, nPart, false, true, true);
+ }
+ else if ((t >= lpos) && (t < rpos) && (t+l) > rpos) {
+ // TODO: remove part head
+ }
+ else if (t >= rpos) {
+ MidiPart* nPart = new MidiPart(*(MidiPart*)part);
+ int nt = part->tick();
+ nPart->setTick(nt - (rpos -lpos));
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(part, nPart, false);
+ audio->msgChangePart(part, nPart, false, true, false);
+ }
+ }
+ }
+ // TODO: cut tempo track
+ // TODO: process marker
+ song->endUndo(SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_REMOVED);
+ }
+
+//---------------------------------------------------------
+// globalInsert
+// - insert empty space at left locator position upto
+// right locator
+// - do not touch muted track
+// - insert in master track
+//---------------------------------------------------------
+
+void MusE::globalInsert()
+ {
+ unsigned lpos = song->lpos();
+ unsigned rpos = song->rpos();
+ if (lpos >= rpos)
+ return;
+
+ song->startUndo();
+ TrackList* tracks = song->tracks();
+ for (iTrack it = tracks->begin(); it != tracks->end(); ++it) {
+ MidiTrack* track = dynamic_cast<MidiTrack*>(*it);
+ //
+ // process only non muted midi tracks
+ //
+ if (track == 0 || track->mute())
+ continue;
+ PartList* pl = track->parts();
+ for (iPart p = pl->begin(); p != pl->end(); ++p) {
+ Part* part = p->second;
+ unsigned t = part->tick();
+ int l = part->lenTick();
+ if (t + l <= lpos)
+ continue;
+ if (lpos >= t && lpos < (t+l)) {
+ MidiPart* nPart = new MidiPart(*(MidiPart*)part);
+ nPart->setLenTick(l + (rpos-lpos));
+ EventList* el = nPart->events();
+
+ iEvent i = el->end();
+ while (i != el->begin()) {
+ --i;
+ if (i->first < lpos)
+ break;
+ Event event = i->second;
+ Event nEvent = i->second.clone();
+ nEvent.setTick(nEvent.tick() + (rpos-lpos));
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, nEvent, nPart, false);
+ audio->msgChangeEvent(event, nEvent, nPart, false, false, false);
+ }
+ // Indicate no undo, and do port controller values and clone parts.
+ //audio->msgChangePart(part, nPart, false);
+ audio->msgChangePart(part, nPart, false, true, true);
+ }
+ else if (t > lpos) {
+ MidiPart* nPart = new MidiPart(*(MidiPart*)part);
+ nPart->setTick(t + (rpos -lpos));
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(part, nPart, false);
+ audio->msgChangePart(part, nPart, false, true, false);
+ }
+ }
+ }
+ // TODO: process tempo track
+ // TODO: process marker
+ song->endUndo(SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_REMOVED);
+ }
+
+//---------------------------------------------------------
+// globalSplit
+// - split all parts at the song position pointer
+// - do not touch muted track
+//---------------------------------------------------------
+
+void MusE::globalSplit()
+ {
+ int pos = song->cpos();
+ song->startUndo();
+ TrackList* tracks = song->tracks();
+ for (iTrack it = tracks->begin(); it != tracks->end(); ++it) {
+ Track* track = *it;
+ PartList* pl = track->parts();
+ for (iPart p = pl->begin(); p != pl->end(); ++p) {
+ Part* part = p->second;
+ int p1 = part->tick();
+ int l0 = part->lenTick();
+ if (pos > p1 && pos < (p1+l0)) {
+ Part* p1;
+ Part* p2;
+ track->splitPart(part, pos, p1, p2);
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(part, p1, false);
+ audio->msgChangePart(part, p1, false, true, false);
+ audio->msgAddPart(p2, false);
+ break;
+ }
+ }
+ }
+ song->endUndo(SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_INSERTED);
+ }
+
+//---------------------------------------------------------
+// copyRange
+// - copy space between left and right locator position
+// to song position pointer
+// - dont process muted tracks
+// - create a new part for every track containing the
+// copied events
+//---------------------------------------------------------
+
+void MusE::copyRange()
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Copy Range"),
+ tr("not implemented")
+ );
+ }
+
+//---------------------------------------------------------
+// cutEvents
+// - make sure that all events in a part end where the
+// part ends
+// - process only marked parts
+//---------------------------------------------------------
+
+void MusE::cutEvents()
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Cut Events"),
+ tr("not implemented")
+ );
+ }
+
+//---------------------------------------------------------
+// checkRegionNotNull
+// return true if (rPos - lPos) <= 0
+//---------------------------------------------------------
+
+bool MusE::checkRegionNotNull()
+ {
+ int start = song->lPos().frame();
+ int end = song->rPos().frame();
+ if (end - start <= 0) {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce"),
+ tr("set left/right marker for bounce range")
+ );
+ return true;
+ }
+ return false;
+ }
+
+#if 0
+//---------------------------------------------------------
+// openAudioFileManagement
+//---------------------------------------------------------
+void MusE::openAudioFileManagement()
+ {
+ if (!audioFileManager) {
+ audioFileManager = new AudioFileManager(this, "audiofilemanager", false);
+ audioFileManager->show();
+ }
+ audioFileManager->setShown(true);
+ }
+#endif
+//---------------------------------------------------------
+// bounceToTrack
+//---------------------------------------------------------
+
+void MusE::bounceToTrack()
+ {
+ if(audio->bounce())
+ return;
+
+ song->bounceOutput = 0;
+
+ if(song->waves()->empty())
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce to Track"),
+ tr("No wave tracks found")
+ );
+ return;
+ }
+
+ OutputList* ol = song->outputs();
+ if(ol->empty())
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce to Track"),
+ tr("No audio output tracks found")
+ );
+ return;
+ }
+
+ if(checkRegionNotNull())
+ return;
+
+ AudioOutput* out = 0;
+ // If only one output, pick it, else pick the first selected.
+ if(ol->size() == 1)
+ out = ol->front();
+ else
+ {
+ for(iAudioOutput iao = ol->begin(); iao != ol->end(); ++iao)
+ {
+ AudioOutput* o = *iao;
+ if(o->selected())
+ {
+ if(out)
+ {
+ out = 0;
+ break;
+ }
+ out = o;
+ }
+ }
+ if(!out)
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce to Track"),
+ tr("Select one audio output track,\nand one target wave track")
+ );
+ return;
+ }
+ }
+
+ // search target track
+ TrackList* tl = song->tracks();
+ WaveTrack* track = 0;
+
+ for (iTrack it = tl->begin(); it != tl->end(); ++it) {
+ Track* t = *it;
+ if (t->selected()) {
+ if(t->type() != Track::WAVE && t->type() != Track::AUDIO_OUTPUT) {
+ track = 0;
+ break;
+ }
+ if(t->type() == Track::WAVE)
+ {
+ if(track)
+ {
+ track = 0;
+ break;
+ }
+ track = (WaveTrack*)t;
+ }
+
+ }
+ }
+
+ if (track == 0) {
+ if(ol->size() == 1) {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce to Track"),
+ tr("Select one target wave track")
+ );
+ return;
+ }
+ else
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce to Track"),
+ tr("Select one target wave track,\nand one audio output track")
+ );
+ return;
+ }
+ }
+ song->bounceOutput = out;
+ song->bounceTrack = track;
+ song->setRecord(true);
+ song->setRecordFlag(track, true);
+ audio->msgBounce();
+ }
+
+//---------------------------------------------------------
+// bounceToFile
+//---------------------------------------------------------
+
+void MusE::bounceToFile(AudioOutput* ao)
+ {
+ if(audio->bounce())
+ return;
+ song->bounceOutput = 0;
+ if(!ao)
+ {
+ OutputList* ol = song->outputs();
+ if(ol->empty())
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce to Track"),
+ tr("No audio output tracks found")
+ );
+ return;
+ }
+ // If only one output, pick it, else pick the first selected.
+ if(ol->size() == 1)
+ ao = ol->front();
+ else
+ {
+ for(iAudioOutput iao = ol->begin(); iao != ol->end(); ++iao)
+ {
+ AudioOutput* o = *iao;
+ if(o->selected())
+ {
+ if(ao)
+ {
+ ao = 0;
+ break;
+ }
+ ao = o;
+ }
+ }
+ if (ao == 0) {
+ QMessageBox::critical(this,
+ tr("MusE: Bounce to File"),
+ tr("Select one audio output track")
+ );
+ return;
+ }
+ }
+ }
+
+ if (checkRegionNotNull())
+ return;
+
+ SndFile* sf = getSndFile(0, this, 0);
+ if (sf == 0)
+ return;
+
+ song->bounceOutput = ao;
+ ao->setRecFile(sf);
+ song->setRecord(true, false);
+ song->setRecordFlag(ao, true);
+ audio->msgBounce();
+ }
+
+#ifdef HAVE_LASH
+//---------------------------------------------------------
+// lash_idle_cb
+//---------------------------------------------------------
+#include <iostream>
+void
+MusE::lash_idle_cb ()
+{
+ lash_event_t * event;
+ if (!lash_client)
+ return;
+
+ while ( (event = lash_get_event (lash_client)) )
+ {
+ switch (lash_event_get_type (event))
+ {
+ case LASH_Save_File:
+ {
+ /* save file */
+ QString ss = QString(lash_event_get_string(event)) + QString("/lash-project-muse.med");
+ int ok = save (ss.ascii(), false);
+ if (ok) {
+ project.setFile(ss.ascii());
+ setCaption(tr("MusE: Song: ") + project.baseName(true));
+ addProject(ss.ascii());
+ museProject = QFileInfo(ss.ascii()).dirPath(true);
+ }
+ lash_send_event (lash_client, event);
+ }
+ break;
+
+ case LASH_Restore_File:
+ {
+ /* load file */
+ QString sr = QString(lash_event_get_string(event)) + QString("/lash-project-muse.med");
+ loadProjectFile(sr.ascii(), false, true);
+ lash_send_event (lash_client, event);
+ }
+ break;
+
+ case LASH_Quit:
+ {
+ /* quit muse */
+ std::cout << "MusE::lash_idle_cb Received LASH_Quit"
+ << std::endl;
+ lash_event_destroy (event);
+ }
+ break;
+
+ default:
+ {
+ std::cout << "MusE::lash_idle_cb Received unknown LASH event of type "
+ << lash_event_get_type (event)
+ << std::endl;
+ lash_event_destroy (event);
+ }
+ break;
+ }
+ }
+}
+#endif /* HAVE_LASH */
+
+//---------------------------------------------------------
+// clearSong
+// return true if operation aborted
+// called with sequencer stopped
+//---------------------------------------------------------
+
+bool MusE::clearSong()
+ {
+ if (song->dirty) {
+ int n = 0;
+ n = QMessageBox::warning(this, appName,
+ tr("The current Project contains unsaved data\n"
+ "Load overwrites current Project:\n"
+ "Save Current Project?"),
+ tr("&Save"), tr("&Skip"), tr("&Abort"), 0, 2);
+ switch (n) {
+ case 0:
+ if (!save()) // abort if save failed
+ return true;
+ break;
+ case 1:
+ break;
+ case 2:
+ return true;
+ default:
+ printf("InternalError: gibt %d\n", n);
+ }
+ }
+ if (audio->isPlaying()) {
+ audio->msgPlay(false);
+ while (audio->isPlaying())
+ qApp->processEvents();
+ }
+
+again:
+ for (iToplevel i = toplevels.begin(); i != toplevels.end(); ++i) {
+ Toplevel tl = *i;
+ unsigned long obj = tl.object();
+ switch (tl.type()) {
+ case Toplevel::CLIPLIST:
+ case Toplevel::MARKER:
+ break;
+ case Toplevel::PIANO_ROLL:
+ case Toplevel::LISTE:
+ case Toplevel::DRUM:
+ case Toplevel::MASTER:
+ case Toplevel::WAVE:
+ case Toplevel::LMASTER:
+ ((QWidget*)(obj))->close(true);
+ goto again;
+ }
+ }
+ song->clear(false);
+ return false;
+ }
+
+//---------------------------------------------------------
+// startEditInstrument
+//---------------------------------------------------------
+
+void MusE::startEditInstrument()
+ {
+ if(editInstrument == 0)
+ {
+ editInstrument = new EditInstrument(this);
+ editInstrument->show();
+ }
+ else
+ {
+ if(editInstrument->isShown())
+ editInstrument->hide();
+ else
+ editInstrument->show();
+ }
+
+ }
+
+//---------------------------------------------------------
+// switchMixerAutomation
+//---------------------------------------------------------
+
+void MusE::switchMixerAutomation()
+ {
+ automation = !automation;
+ // Clear all pressed and touched and rec event lists.
+ song->clearRecAutomation(true);
+
+printf("automation = %d\n", automation);
+ menuAutomation->setItemChecked(autoId, automation);
+ }
+
+//---------------------------------------------------------
+// clearAutomation
+//---------------------------------------------------------
+
+void MusE::clearAutomation()
+ {
+ printf("not implemented\n");
+ }
+
+//---------------------------------------------------------
+// takeAutomationSnapshot
+//---------------------------------------------------------
+
+void MusE::takeAutomationSnapshot()
+ {
+ int frame = song->cPos().frame();
+ TrackList* tracks = song->tracks();
+ for (iTrack i = tracks->begin(); i != tracks->end(); ++i) {
+ if ((*i)->isMidiTrack())
+ continue;
+ AudioTrack* track = (AudioTrack*)*i;
+ CtrlListList* cll = track->controller();
+ for (iCtrlList icl = cll->begin(); icl != cll->end(); ++icl) {
+ double val = icl->second->curVal();
+ icl->second->add(frame, val);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// updateConfiguration
+// called whenever the configuration has changed
+//---------------------------------------------------------
+
+void MusE::updateConfiguration()
+ {
+ fileOpenAction->setAccel(shortcuts[SHRT_OPEN].key);
+ fileNewAction->setAccel(shortcuts[SHRT_NEW].key);
+ fileSaveAction->setAccel(shortcuts[SHRT_SAVE].key);
+
+ menu_file->setAccel(shortcuts[SHRT_OPEN_RECENT].key, menu_ids[CMD_OPEN_RECENT]);
+ menu_file->setAccel(shortcuts[SHRT_LOAD_TEMPLATE].key, menu_ids[CMD_LOAD_TEMPLATE]);
+ menu_file->setAccel(shortcuts[SHRT_SAVE_AS].key, menu_ids[CMD_SAVE_AS]);
+ menu_file->setAccel(shortcuts[SHRT_IMPORT_MIDI].key, menu_ids[CMD_IMPORT_MIDI]);
+ menu_file->setAccel(shortcuts[SHRT_EXPORT_MIDI].key, menu_ids[CMD_EXPORT_MIDI]);
+ menu_file->setAccel(shortcuts[SHRT_IMPORT_PART].key, menu_ids[CMD_IMPORT_PART]);
+ menu_file->setAccel(shortcuts[SHRT_IMPORT_AUDIO].key, menu_ids[CMD_IMPORT_AUDIO]);
+ menu_file->setAccel(shortcuts[SHRT_QUIT].key, menu_ids[CMD_QUIT]);
+
+ menuEdit->setAccel(Key_Delete, CMD_DELETE);
+ menuEdit->setAccel(shortcuts[SHRT_OPEN_DRUMS].key, menu_ids[CMD_OPEN_DRUMS]);
+ menuEdit->setAccel(shortcuts[SHRT_OPEN_LIST].key, menu_ids[CMD_OPEN_LIST]);
+ menuEdit->setAccel(shortcuts[SHRT_OPEN_WAVE].key, menu_ids[CMD_OPEN_WAVE]);
+ menuEdit->setAccel(shortcuts[SHRT_OPEN_MIDI_TRANSFORM].key, menu_ids[CMD_OPEN_MIDI_TRANSFORM]);
+
+ midiEdit->setAccel(shortcuts[SHRT_TRANSPOSE].key, menu_ids[CMD_TRANSPOSE]);
+
+ master->setAccel(shortcuts[SHRT_OPEN_GRAPHIC_MASTER].key, menu_ids[CMD_OPEN_GRAPHIC_MASTER]);
+ master->setAccel(shortcuts[SHRT_OPEN_LIST_MASTER].key, menu_ids[CMD_OPEN_LIST_MASTER]);
+
+ menuStructure->setAccel(shortcuts[SHRT_GLOBAL_CUT].key, menu_ids[CMD_GLOBAL_CUT]);
+ menuStructure->setAccel(shortcuts[SHRT_GLOBAL_INSERT].key, menu_ids[CMD_GLOBAL_INSERT]);
+ menuStructure->setAccel(shortcuts[SHRT_GLOBAL_SPLIT].key, menu_ids[CMD_GLOBAL_SPLIT]);
+ menuStructure->setAccel(shortcuts[SHRT_COPY_RANGE].key, menu_ids[CMD_COPY_RANGE]);
+ menuStructure->setAccel(shortcuts[SHRT_CUT_EVENTS].key, menu_ids[CMD_CUT_EVENTS]);
+
+ menuView->setAccel(shortcuts[SHRT_OPEN_TRANSPORT].key, tr_id);
+ menuView->setAccel(shortcuts[SHRT_OPEN_BIGTIME].key, bt_id);
+ //menuView->setAccel(shortcuts[SHRT_OPEN_MIXER].key, aid1);
+ menuView->setAccel(shortcuts[SHRT_OPEN_MIXER].key, aid1a);
+ menuView->setAccel(shortcuts[SHRT_OPEN_MIXER2].key, aid1b);
+// menuView->setAccel(shortcuts[SHRT_OPEN_CLIPS].key, aid2);
+// markerAction->setAccel(shortcuts[SHRT_OPEN_MARKER].key );
+ menuView->setAccel(shortcuts[SHRT_OPEN_MARKER].key, mr_id );
+
+ menuSettings->setAccel(shortcuts[SHRT_GLOBAL_CONFIG].key, menu_ids[CMD_GLOBAL_CONFIG]);
+ menuSettings->setAccel(shortcuts[SHRT_CONFIG_SHORTCUTS].key, menu_ids[CMD_CONFIG_SHORTCUTS]);
+ menuSettings->setAccel(shortcuts[SHRT_CONFIG_METRONOME].key, menu_ids[CMD_CONFIG_METRONOME]);
+ menuSettings->setAccel(shortcuts[SHRT_CONFIG_MIDISYNC].key, menu_ids[CMD_CONFIG_MIDISYNC]);
+ menuSettings->setAccel(shortcuts[SHRT_APPEARANCE_SETTINGS].key, menu_ids[CMD_APPEARANCE_SETTINGS]);
+ menuSettings->setAccel(shortcuts[SHRT_CONFIG_MIDI_PORTS].key, menu_ids[CMD_CONFIG_MIDI_PORTS]);
+ menuSettings->setAccel(shortcuts[SHRT_CONFIG_AUDIO_PORTS].key, menu_ids[CMD_CONFIG_AUDIO_PORTS]);
+
+// menu_functions->setAccel(shortcuts[SHRT_MIDI_EDIT_INSTRUMENTS].key, menu_ids[CMD_MIDI_EDIT_INSTRUMENTS]);
+ menu_functions->setAccel(shortcuts[SHRT_MIDI_RESET].key, menu_ids[CMD_MIDI_RESET]);
+ menu_functions->setAccel(shortcuts[SHRT_MIDI_INIT].key, menu_ids[CMD_MIDI_INIT]);
+ menu_functions->setAccel(shortcuts[SHRT_MIDI_LOCAL_OFF].key, menu_ids[CMD_MIDI_LOCAL_OFF]);
+
+ menu_audio->setAccel(shortcuts[SHRT_AUDIO_BOUNCE_TO_TRACK].key, menu_ids[CMD_AUDIO_BOUNCE_TO_TRACK]);
+ menu_audio->setAccel(shortcuts[SHRT_AUDIO_BOUNCE_TO_FILE].key , menu_ids[CMD_AUDIO_BOUNCE_TO_FILE]);
+ menu_audio->setAccel(shortcuts[SHRT_AUDIO_RESTART].key, menu_ids[CMD_AUDIO_RESTART]);
+
+ menuAutomation->setAccel(shortcuts[SHRT_MIXER_AUTOMATION].key, autoId);
+ menuAutomation->setAccel(shortcuts[SHRT_MIXER_SNAPSHOT].key, menu_ids[CMD_MIXER_SNAPSHOT]);
+ menuAutomation->setAccel(shortcuts[SHRT_MIXER_AUTOMATION_CLEAR].key, menu_ids[CMD_MIXER_AUTOMATION_CLEAR]);
+
+ menu_help->setAccel(menu_ids[CMD_OPEN_HELP], shortcuts[SHRT_OPEN_HELP].key);
+ menu_help->setAccel(menu_ids[CMD_START_WHATSTHIS], shortcuts[SHRT_START_WHATSTHIS].key);
+ pianoAction->setAccel(shortcuts[SHRT_OPEN_PIANO].key);
+
+ select->setAccel(shortcuts[SHRT_SELECT_ALL].key, CMD_SELECT_ALL);
+
+// select->setAccel(shortcuts[SHRT_DESEL_PARTS].key, CMD_SELECT_NONE);
+ select->setAccel(shortcuts[SHRT_SELECT_NONE].key, CMD_SELECT_NONE);
+
+ select->setAccel(shortcuts[SHRT_SELECT_INVERT].key, CMD_SELECT_INVERT);
+ select->setAccel(shortcuts[SHRT_SELECT_ILOOP].key, CMD_SELECT_ILOOP);
+ select->setAccel(shortcuts[SHRT_SELECT_OLOOP].key, CMD_SELECT_OLOOP);
+ select->setAccel(shortcuts[SHRT_SELECT_PRTSTRACK].key, CMD_SELECT_PARTS);
+ follow->setAccel(shortcuts[SHRT_FOLLOW_JUMP].key, CMD_FOLLOW_JUMP);
+ follow->setAccel(shortcuts[SHRT_FOLLOW_NO].key, CMD_FOLLOW_NO);
+ follow->setAccel(shortcuts[SHRT_FOLLOW_CONTINUOUS].key, CMD_FOLLOW_CONTINUOUS);
+ midiInputPlugins->setAccel(shortcuts[SHRT_MIDI_INPUT_TRANSPOSE].key, 0);
+ midiInputPlugins->setAccel(shortcuts[SHRT_MIDI_INPUT_TRANSFORM].key, 1);
+ midiInputPlugins->setAccel(shortcuts[SHRT_MIDI_INPUT_FILTER].key, 2);
+ midiInputPlugins->setAccel(shortcuts[SHRT_MIDI_REMOTE_CONTROL].key, 3);
+ midiInputPlugins->setAccel(shortcuts[SHRT_RANDOM_RHYTHM_GENERATOR].key, 4);
+
+ addTrack->setAccel(shortcuts[SHRT_ADD_MIDI_TRACK].key, Track::MIDI);
+ addTrack->setAccel(shortcuts[SHRT_ADD_DRUM_TRACK].key, Track::DRUM);
+ addTrack->setAccel(shortcuts[SHRT_ADD_WAVE_TRACK].key, Track::WAVE);
+ addTrack->setAccel(shortcuts[SHRT_ADD_AUDIO_OUTPUT].key, Track::AUDIO_OUTPUT);
+ addTrack->setAccel(shortcuts[SHRT_ADD_AUDIO_GROUP].key, Track::AUDIO_GROUP);
+ addTrack->setAccel(shortcuts[SHRT_ADD_AUDIO_INPUT].key, Track::AUDIO_INPUT);
+ addTrack->setAccel(shortcuts[SHRT_ADD_AUDIO_AUX].key, Track::AUDIO_AUX);
+ }
+
+//---------------------------------------------------------
+// showBigtime
+//---------------------------------------------------------
+
+void MusE::showBigtime(bool on)
+ {
+ if (on && bigtime == 0) {
+ bigtime = new BigTime(0);
+ bigtime->setPos(0, song->cpos(), false);
+ connect(song, SIGNAL(posChanged(int, unsigned, bool)), bigtime, SLOT(setPos(int, unsigned, bool)));
+ connect(muse, SIGNAL(configChanged()), bigtime, SLOT(configChanged()));
+ connect(bigtime, SIGNAL(closed()), SLOT(bigtimeClosed()));
+ bigtime->resize(config.geometryBigTime.size());
+ bigtime->move(config.geometryBigTime.topLeft());
+ }
+ if (bigtime)
+ bigtime->setShown(on);
+ menuView->setItemChecked(bt_id, on);
+ }
+
+//---------------------------------------------------------
+// toggleBigTime
+//---------------------------------------------------------
+
+void MusE::toggleBigTime()
+ {
+ showBigtime(!menuView->isItemChecked(bt_id));
+ }
+
+//---------------------------------------------------------
+// bigtimeClosed
+//---------------------------------------------------------
+
+void MusE::bigtimeClosed()
+ {
+ menuView->setItemChecked(bt_id, false);
+ }
+
+//---------------------------------------------------------
+// showMixer
+//---------------------------------------------------------
+
+/*
+void MusE::showMixer(bool on)
+ {
+ if (on && audioMixer == 0) {
+ audioMixer = new AudioMixerApp(this);
+ connect(audioMixer, SIGNAL(closed()), SLOT(mixerClosed()));
+ audioMixer->resize(config.geometryMixer.size());
+ audioMixer->move(config.geometryMixer.topLeft());
+ }
+ if (audioMixer)
+ audioMixer->setShown(on);
+ menuView->setItemChecked(aid1, on);
+ }
+*/
+
+//---------------------------------------------------------
+// showMixer1
+//---------------------------------------------------------
+
+void MusE::showMixer1(bool on)
+ {
+ if (on && mixer1 == 0) {
+ mixer1 = new AudioMixerApp(this, &(config.mixer1));
+ connect(mixer1, SIGNAL(closed()), SLOT(mixer1Closed()));
+ mixer1->resize(config.mixer1.geometry.size());
+ mixer1->move(config.mixer1.geometry.topLeft());
+ }
+ if (mixer1)
+ mixer1->setShown(on);
+ menuView->setItemChecked(aid1a, on);
+ }
+
+//---------------------------------------------------------
+// showMixer2
+//---------------------------------------------------------
+
+void MusE::showMixer2(bool on)
+ {
+ if (on && mixer2 == 0) {
+ mixer2 = new AudioMixerApp(this, &(config.mixer2));
+ connect(mixer2, SIGNAL(closed()), SLOT(mixer2Closed()));
+ mixer2->resize(config.mixer2.geometry.size());
+ mixer2->move(config.mixer2.geometry.topLeft());
+ }
+ if (mixer2)
+ mixer2->setShown(on);
+ menuView->setItemChecked(aid1b, on);
+ }
+
+//---------------------------------------------------------
+// toggleMixer
+//---------------------------------------------------------
+
+/*
+void MusE::toggleMixer()
+ {
+ showMixer(!menuView->isItemChecked(aid1));
+ }
+*/
+
+//---------------------------------------------------------
+// toggleMixer1
+//---------------------------------------------------------
+
+void MusE::toggleMixer1()
+ {
+ showMixer1(!menuView->isItemChecked(aid1a));
+ }
+
+//---------------------------------------------------------
+// toggleMixer2
+//---------------------------------------------------------
+
+void MusE::toggleMixer2()
+ {
+ showMixer2(!menuView->isItemChecked(aid1b));
+ }
+
+//---------------------------------------------------------
+// mixerClosed
+//---------------------------------------------------------
+
+/*
+void MusE::mixerClosed()
+ {
+ menuView->setItemChecked(aid1, false);
+ }
+*/
+
+//---------------------------------------------------------
+// mixer1Closed
+//---------------------------------------------------------
+
+void MusE::mixer1Closed()
+ {
+ //aid1a->setChecked(false);
+ menuView->setItemChecked(aid1a, false);
+ }
+
+//---------------------------------------------------------
+// mixer2Closed
+//---------------------------------------------------------
+
+void MusE::mixer2Closed()
+ {
+ //aid1b->setChecked(false);
+ menuView->setItemChecked(aid1b, false);
+ }
+
+
+//QWidget* MusE::mixerWindow() { return audioMixer; }
+QWidget* MusE::mixer1Window() { return mixer1; }
+QWidget* MusE::mixer2Window() { return mixer2; }
+
+QWidget* MusE::transportWindow() { return transport; }
+QWidget* MusE::bigtimeWindow() { return bigtime; }
+
+//---------------------------------------------------------
+// focusInEvent
+//---------------------------------------------------------
+
+void MusE::focusInEvent(QFocusEvent* ev)
+ {
+ //if (audioMixer)
+ // audioMixer->raise();
+ if (mixer1)
+ mixer1->raise();
+ if (mixer2)
+ mixer2->raise();
+ raise();
+ QMainWindow::focusInEvent(ev);
+ }
+
+//---------------------------------------------------------
+// setUsedTool
+//---------------------------------------------------------
+
+void MusE::setUsedTool(int tool)
+ {
+ tools1->set(tool);
+ }
+
+
+//---------------------------------------------------------
+// execDeliveredScript
+//---------------------------------------------------------
+void MusE::execDeliveredScript(int id)
+{
+ //QString scriptfile = QString(INSTPREFIX) + SCRIPTSSUFFIX + deliveredScriptNames[id];
+ song->executeScript(song->getScriptPath(id, true), song->getSelectedMidiParts(), 0, false); // TODO: get quant from arranger
+}
+//---------------------------------------------------------
+// execUserScript
+//---------------------------------------------------------
+void MusE::execUserScript(int id)
+{
+ song->executeScript(song->getScriptPath(id, false), song->getSelectedMidiParts(), 0, false); // TODO: get quant from arranger
+}
+
diff --git a/muse2/muse/app.h b/muse2/muse/app.h
new file mode 100644
index 00000000..3e0d36a6
--- /dev/null
+++ b/muse2/muse/app.h
@@ -0,0 +1,327 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: app.h,v 1.34.2.14 2009/11/16 11:29:33 lunar_shuttle Exp $
+//
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __APP_H__
+#define __APP_H__
+
+#include "config.h"
+
+#include <q3mainwindow.h>
+#include <qrect.h>
+//Added by qt3to4:
+#include <Qt3Support>
+#include <Q3PopupMenu>
+#include <QFocusEvent>
+#include <QCloseEvent>
+#include "cobject.h"
+#include "tools.h"
+#include <qfileinfo.h>
+
+class Part;
+class PartList;
+class Q3ToolBar;
+class Q3PopupMenu;
+class Transport;
+class BigTime;
+class Arranger;
+class Instrument;
+class Q3ListView;
+class Q3ListViewItem;
+class QPoint;
+class QToolButton;
+class PopupMenu;
+class Track;
+class PrinterConfig;
+class MidiSyncConfig;
+class MRConfig;
+class MetronomeConfig;
+class AudioConf;
+class Xml;
+class AudioMixerApp;
+class ClipListEdit;
+class AudioRecord;
+class MidiFileConfig;
+class MidiFilterConfig;
+class MarkerView;
+class GlobalSettingsConfig;
+class MidiControllerEditDialog;
+class MidiInputTransformDialog;
+class MidiTransformerDialog;
+class SynthI;
+class RhythmGen;
+class MidiTrack;
+class MidiInstrument;
+class MidiPort;
+class ShortcutConfig;
+class Appearance;
+class WaveTrack;
+class AudioOutput;
+class EditInstrument;
+
+#define MENU_ADD_SYNTH_ID_BASE 0x1000
+
+//---------------------------------------------------------
+// MusE
+//---------------------------------------------------------
+
+class MusE : public Q3MainWindow
+ {
+ Q_OBJECT
+ enum {CMD_CUT, CMD_COPY, CMD_PASTE, CMD_INSERT, CMD_INSERTMEAS, CMD_PASTE_CLONE,
+ CMD_PASTE_TO_TRACK, CMD_PASTE_CLONE_TO_TRACK, CMD_DELETE,
+ CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT,
+ CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PARTS,
+ CMD_FOLLOW_NO, CMD_FOLLOW_JUMP, CMD_FOLLOW_CONTINUOUS ,
+ CMD_DELETE_TRACK
+ };
+
+ //File menu items:
+ enum { CMD_OPEN_RECENT=0, CMD_LOAD_TEMPLATE, CMD_SAVE_AS, CMD_IMPORT_MIDI,
+ CMD_EXPORT_MIDI, CMD_IMPORT_PART, CMD_IMPORT_AUDIO, CMD_QUIT, CMD_OPEN_DRUMS, CMD_OPEN_WAVE,
+ CMD_OPEN_LIST, CMD_OPEN_LIST_MASTER, CMD_GLOBAL_CONFIG,
+ CMD_OPEN_GRAPHIC_MASTER, CMD_OPEN_MIDI_TRANSFORM, CMD_TRANSPOSE,
+ CMD_GLOBAL_CUT, CMD_GLOBAL_INSERT, CMD_GLOBAL_SPLIT, CMD_COPY_RANGE,
+ CMD_CUT_EVENTS, CMD_CONFIG_SHORTCUTS, CMD_CONFIG_METRONOME, CMD_CONFIG_MIDISYNC,
+ CMD_MIDI_FILE_CONFIG, CMD_APPEARANCE_SETTINGS, CMD_CONFIG_MIDI_PORTS, CMD_CONFIG_AUDIO_PORTS,
+ CMD_MIDI_EDIT_INSTRUMENTS, CMD_MIDI_RESET, CMD_MIDI_INIT, CMD_MIDI_LOCAL_OFF,
+ CMD_MIXER_SNAPSHOT, CMD_MIXER_AUTOMATION_CLEAR, CMD_OPEN_HELP, CMD_OPEN_HOMEPAGE,
+ CMD_OPEN_BUG, CMD_START_WHATSTHIS,
+ CMD_AUDIO_BOUNCE_TO_FILE, CMD_AUDIO_BOUNCE_TO_TRACK, CMD_AUDIO_RESTART,
+ CMD_LAST };
+
+ int menu_ids[CMD_LAST];
+ Q3Action *fileSaveAction, *fileOpenAction, *pianoAction, *fileNewAction, /* *markerAction,*/ *testAction;
+ QString appName;
+
+ QFileInfo project;
+ Q3ToolBar *tools;
+ EditToolBar *tools1;
+
+ Transport* transport;
+ BigTime* bigtime;
+ EditInstrument* editInstrument;
+
+ Q3PopupMenu *menu_file, *menuView, *menuSettings, *menu_help;
+ Q3PopupMenu *menuEdit, *menuStructure;
+ Q3PopupMenu* menu_audio, *menuAutomation;
+ Q3PopupMenu* menu_functions, *menuScriptPlugins;
+ Q3PopupMenu* select, *master, *midiEdit, *addTrack;
+
+ // Special 'stay-open' menu for routes.
+ PopupMenu* routingPopupMenu;
+
+ int aid1a, aid1b, aid2, aid3, autoId;
+ int tr_id, bt_id, mr_id;
+ int cc_id;
+ Q3PopupMenu* follow;
+ int fid0, fid1, fid2;
+ Q3PopupMenu* midiInputPlugins;
+ int mpid0, mpid1, mpid2, mpid3, mpid4;
+
+ QWidget* midiPortConfig;
+ QWidget* softSynthesizerConfig;
+ MidiSyncConfig* midiSyncConfig;
+ MRConfig* midiRemoteConfig;
+ RhythmGen* midiRhythmGenerator;
+ MetronomeConfig* metronomeConfig;
+ AudioConf* audioConfig;
+ MidiFileConfig* midiFileConfig;
+ GlobalSettingsConfig* globalSettingsConfig;
+ MidiFilterConfig* midiFilterConfig;
+ MidiInputTransformDialog* midiInputTransform;
+ ShortcutConfig* shortcutConfig;
+ Appearance* appearance;
+ AudioMixerApp* mixer1;
+ AudioMixerApp* mixer2;
+
+ ToplevelList toplevels;
+ ClipListEdit* clipListEdit;
+ MarkerView* markerView;
+ MidiTransformerDialog* midiTransformerDialog;
+ Q3PopupMenu* openRecent;
+
+ bool readMidi(FILE*);
+ void read(Xml& xml, bool skipConfig);
+ void processTrack(MidiTrack* track);
+
+ void write(Xml& xml) const;
+ bool clearSong();
+ bool save(const QString&, bool);
+ void setUntitledProject();
+ void setConfigDefaults();
+
+ void setFollow();
+ void readConfigParts(Xml& xml);
+ void readMidiport(Xml& xml);
+ void readMidichannel(Xml& xml, int port);
+ void readCtrl(Xml& xml, int port, int channel);
+ void readToplevels(Xml& xml);
+ PartList* getMidiPartsToEdit();
+ Part* readPart(Xml& xml);
+ bool checkRegionNotNull();
+ void loadProjectFile1(const QString&, bool songTemplate, bool loadAll);
+ void writeGlobalConfiguration(int level, Xml&) const;
+ void writeConfiguration(int level, Xml&) const;
+ void updateConfiguration();
+
+ virtual void focusInEvent(QFocusEvent*);
+
+ signals:
+ void configChanged();
+
+ private slots:
+ //void runPythonScript();
+ void loadProject();
+ bool save();
+ void configGlobalSettings();
+ void quitDoc();
+ void about();
+ void aboutQt();
+ void startHelpBrowser();
+ void startHomepageBrowser();
+ void startBugBrowser();
+ void launchBrowser(QString &whereTo);
+ void importMidi();
+ void importWave();
+ void importPart();
+ void exportMidi();
+
+ void toggleTransport();
+ void toggleMarker();
+ void toggleBigTime();
+ //void toggleMixer();
+ void toggleMixer1();
+ void toggleMixer2();
+
+ void configMidiPorts();
+ void configMidiSync();
+ void configMidiFile();
+ void configShortCuts();
+ void configMetronome();
+ void configAppearance();
+ void startEditor(PartList*, int);
+ void startMasterEditor();
+ void startLMasterEditor();
+ void startListEditor();
+ void startListEditor(PartList*);
+ void startDrumEditor();
+ void startDrumEditor(PartList*);
+ void startEditor(Track*);
+ void startPianoroll();
+ void startPianoroll(PartList* pl);
+ void startWaveEditor();
+ void startWaveEditor(PartList*);
+ void startSongInfo(bool editable=true);
+
+ void startMidiTransformer();
+ void writeGlobalConfiguration() const;
+ void startEditInstrument();
+ void startClipList();
+
+ void openRecentMenu();
+ void selectProject(int id);
+ void cmd(int);
+ void clipboardChanged();
+ void selectionChanged();
+ void transpose();
+ void modifyGateTime();
+ void modifyVelocity();
+ void crescendo();
+ void thinOut();
+ void eraseEvent();
+ void noteShift();
+ void moveClock();
+ void copyMeasure();
+ void eraseMeasure();
+ void deleteMeasure();
+ void createMeasure();
+ void mixTrack();
+ void startMidiInputPlugin(int);
+ void hideMitPluginTranspose();
+ void hideMidiInputTransform();
+ void hideMidiFilterConfig();
+ void hideMidiRemoteConfig();
+ void hideMidiRhythmGenerator();
+ void globalCut();
+ void globalInsert();
+ void globalSplit();
+ void copyRange();
+ void cutEvents();
+ void bounceToTrack();
+ void resetMidiDevices();
+ void initMidiDevices();
+ void localOff();
+ void switchMixerAutomation();
+ void takeAutomationSnapshot();
+ void clearAutomation();
+ void bigtimeClosed();
+ //void mixerClosed();
+ void mixer1Closed();
+ void mixer2Closed();
+ void markerClosed();
+
+ void execDeliveredScript(int);
+ void execUserScript(int);
+
+ public slots:
+ bool saveAs();
+ void bounceToFile(AudioOutput* ao = 0);
+ void closeEvent(QCloseEvent*e);
+ void loadProjectFile(const QString&);
+ void loadProjectFile(const QString&, bool songTemplate, bool loadAll);
+ void toplevelDeleted(unsigned long tl);
+ void loadTheme(QString);
+ bool seqRestart();
+ void loadTemplate();
+ void showBigtime(bool);
+ //void showMixer(bool);
+ void showMixer1(bool);
+ void showMixer2(bool);
+ void showMarker(bool);
+ void importMidi(const QString &file);
+ void setUsedTool(int);
+ void showDidYouKnowDialog();
+
+ void routingPopupMenuAboutToHide();
+
+ public:
+ MusE(int argc, char** argv);
+ Arranger* arranger;
+ QRect configGeometryMain;
+ bool importMidi(const QString name, bool merge);
+ void kbAccel(int);
+ void changeConfig(bool writeFlag);
+
+ void seqStop();
+ bool seqStart();
+ void setHeartBeat();
+ void importController(int, MidiPort*, int);
+ //QWidget* mixerWindow();
+ QWidget* mixer1Window();
+ QWidget* mixer2Window();
+ QWidget* transportWindow();
+ QWidget* bigtimeWindow();
+ bool importWaveToTrack(QString& name, unsigned tick=0, Track* track=NULL);
+ void importPartToTrack(QString& filename, unsigned tick, Track* track);
+
+ void showTransport(bool flag);
+
+ // Special 'stay-open' menu for routes.
+ PopupMenu* getRoutingPopupMenu();
+ PopupMenu* prepareRoutingPopupMenu(Track* /*track*/, bool /*dst*/);
+ void routingPopupMenuActivated(Track* /*track*/, int /*id*/);
+ void updateRouteMenus(Track* /*track*/, QObject* /*master*/);
+
+#ifdef HAVE_LASH
+ void lash_idle_cb ();
+#endif
+ };
+
+extern void addProject(const QString& name);
+#endif
+
diff --git a/muse2/muse/appearance.cpp b/muse2/muse/appearance.cpp
new file mode 100644
index 00000000..201d0c4b
--- /dev/null
+++ b/muse2/muse/appearance.cpp
@@ -0,0 +1,718 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: appearance.cpp,v 1.11.2.5 2009/11/14 03:37:48 terminator356 Exp $
+//=========================================================
+
+#include <stdio.h>
+#include <q3button.h>
+#include <qstring.h>
+#include <qcombobox.h>
+#include <qspinbox.h>
+#include <q3buttongroup.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qpixmap.h>
+#include <qcolor.h>
+#include <qcolordialog.h>
+#include <q3listbox.h>
+#include <qlineedit.h>
+#include <qtoolbutton.h>
+#include <qfontdialog.h>
+#include <qapplication.h>
+#include <qstylefactory.h>
+#include <q3listview.h>
+#include <qslider.h>
+#include <qstyle.h>
+#include <qtooltip.h>
+
+#include "icons.h"
+#include "appearance.h"
+#include "track.h"
+#include "app.h"
+#include "song.h"
+#include "event.h"
+#include "arranger.h"
+#include "widgets/filedialog.h"
+#include "waveedit/waveedit.h"
+#include "globals.h"
+#include "conf.h"
+#include "gconfig.h"
+
+//---------------------------------------------------------
+// IdListViewItem
+//---------------------------------------------------------
+
+class IdListViewItem : public Q3ListViewItem {
+ int _id;
+
+ public:
+ IdListViewItem(int id, Q3ListViewItem* parent, QString s)
+ : Q3ListViewItem(parent, s)
+ {
+ _id = id;
+ }
+ IdListViewItem(int id, Q3ListView* parent, QString s)
+ : Q3ListViewItem(parent, s)
+ {
+ _id = id;
+ }
+ int id() const { return _id; }
+ };
+
+//---------------------------------------------------------
+// Appearance
+//---------------------------------------------------------
+
+Appearance::Appearance(Arranger* a, QWidget* parent, const char* name)
+ : AppearanceDialogBase(parent, name)
+ {
+ arr = a;
+ color = 0;
+ config = new GlobalConfigValues;
+
+ QToolTip::add(fontName0, tr("Main application font, and default font for any\n controls not defined here."));
+ QToolTip::add(fontName1, tr("For small controls like mixer strips.\nAlso timescale small numbers, arranger part name overlay,\n and effects rack."));
+ QToolTip::add(fontName2, tr("Midi track info panel. Transport controls."));
+ QToolTip::add(fontName3, tr("Controller graph and S/X buttons. Large numbers for time\n and tempo scale, and time signature."));
+ QToolTip::add(fontName4, tr("Time scale markers."));
+ QToolTip::add(fontName5, tr("List editor: meta event edit dialog multi-line edit box."));
+ QToolTip::add(fontName6, tr("Mixer label font. Auto-font-sizing up to chosen font size.\nWord-breaking but only with spaces."));
+ QToolTip::add(fontSize6, tr("Maximum mixer label auto-font-sizing font size."));
+
+ // ARRANGER
+
+ /*
+ currentBg = ::config.canvasBgPixmap;
+ if (currentBg.isEmpty())
+ currentBg = "<none>";
+ currentBgLabel->setText(currentBg);
+
+ partShownames->setChecked(config->canvasShowPartType & 1);
+ partShowevents->setChecked(config->canvasShowPartType & 2);
+ partShowCakes->setChecked(!(config->canvasShowPartType & 2));
+
+ eventNoteon->setChecked(config->canvasShowPartEvent & (1 << 0));
+ eventPolypressure->setChecked(config->canvasShowPartEvent & (1 << 1));
+ eventController->setChecked(config->canvasShowPartEvent & (1 << 2));
+ eventProgramchange->setChecked(config->canvasShowPartEvent & (1 << 3));
+ eventAftertouch->setChecked(config->canvasShowPartEvent & (1 << 4));
+ eventPitchbend->setChecked(config->canvasShowPartEvent & (1 << 5));
+ eventSpecial->setChecked(config->canvasShowPartEvent & (1 << 6));
+ eventButtonGroup->setEnabled(config->canvasShowPartType == 2);
+ arrGrid->setChecked(config->canvasShowGrid);
+ */
+
+ // COLORS
+ IdListViewItem* id;
+ IdListViewItem* aid;
+ itemList->clear();
+ aid = new IdListViewItem(0, itemList, "Arranger");
+ id = new IdListViewItem(0, aid, "PartColors");
+ new IdListViewItem(0x400, id, "Default");
+ new IdListViewItem(0x401, id, "Refrain");
+ new IdListViewItem(0x402, id, "Bridge");
+ new IdListViewItem(0x403, id, "Intro");
+ new IdListViewItem(0x404, id, "Coda");
+ new IdListViewItem(0x405, id, "Chorus");
+ new IdListViewItem(0x406, id, "Solo");
+ new IdListViewItem(0x407, id, "Brass");
+ new IdListViewItem(0x408, id, "Percussion");
+ new IdListViewItem(0x409, id, "Drums");
+ new IdListViewItem(0x40a, id, "Guitar");
+ new IdListViewItem(0x40b, id, "Bass");
+ new IdListViewItem(0x40c, id, "Flute");
+ new IdListViewItem(0x40d, id, "Strings");
+ new IdListViewItem(0x40e, id, "Keyboard");
+ new IdListViewItem(0x40f, id, "Piano");
+ new IdListViewItem(0x410, id, "Saxophon");
+ new IdListViewItem(0x41c, aid, "part canvas background");
+ id = new IdListViewItem(0, aid, "Track List");
+ new IdListViewItem(0x411, id, "background");
+ new IdListViewItem(0x412, id, "midi background");
+ new IdListViewItem(0x413, id, "drum background");
+ new IdListViewItem(0x414, id, "wave background");
+ new IdListViewItem(0x415, id, "output background");
+ new IdListViewItem(0x416, id, "input background");
+ new IdListViewItem(0x417, id, "group background");
+ new IdListViewItem(0x418, id, "aux background");
+ new IdListViewItem(0x419, id, "synth background");
+ new IdListViewItem(0x41a, id, "selected track background");
+ new IdListViewItem(0x41b, id, "selected track foreground");
+ id = new IdListViewItem(0, itemList, "BigTime");
+ new IdListViewItem(0x100, id, "background");
+ new IdListViewItem(0x101, id, "foreground");
+ id = new IdListViewItem(0, itemList, "Transport");
+ new IdListViewItem(0x200, id, "handle");
+ id = new IdListViewItem(0, itemList, "Midi Editor");
+ new IdListViewItem(0x41d, id, "controller graph");
+ id = new IdListViewItem(0, itemList, "Wave Editor");
+ new IdListViewItem(0x300, id, "background");
+
+ connect(itemList, SIGNAL(selectionChanged()), SLOT(colorItemSelectionChanged()));
+ connect(aPalette, SIGNAL(clicked(int)), SLOT(paletteClicked(int)));
+ connect(rslider, SIGNAL(valueChanged(int)), SLOT(rsliderChanged(int)));
+ connect(gslider, SIGNAL(valueChanged(int)), SLOT(gsliderChanged(int)));
+ connect(bslider, SIGNAL(valueChanged(int)), SLOT(bsliderChanged(int)));
+ connect(hslider, SIGNAL(valueChanged(int)), SLOT(hsliderChanged(int)));
+ connect(sslider, SIGNAL(valueChanged(int)), SLOT(ssliderChanged(int)));
+ connect(vslider, SIGNAL(valueChanged(int)), SLOT(vsliderChanged(int)));
+
+ connect(rval, SIGNAL(valueChanged(int)), SLOT(rsliderChanged(int)));
+ connect(gval, SIGNAL(valueChanged(int)), SLOT(gsliderChanged(int)));
+ connect(bval, SIGNAL(valueChanged(int)), SLOT(bsliderChanged(int)));
+ connect(hval, SIGNAL(valueChanged(int)), SLOT(hsliderChanged(int)));
+ connect(sval, SIGNAL(valueChanged(int)), SLOT(ssliderChanged(int)));
+ connect(vval, SIGNAL(valueChanged(int)), SLOT(vsliderChanged(int)));
+
+ connect(addToPalette, SIGNAL(clicked()), SLOT(addToPaletteClicked()));
+
+ //---------------------------------------------------
+ // STYLE
+ //---------------------------------------------------
+
+ /*
+ themeComboBox->clear();
+ QString cs = muse->style().name();
+ cs = cs.lower();
+
+ themeComboBox->insertStringList(QStyleFactory::keys());
+ for (int i = 0; i < themeComboBox->count(); ++i) {
+ if (themeComboBox->text(i).lower() == cs) {
+ themeComboBox->setCurrentItem(i);
+ }
+ }
+ */
+
+ //---------------------------------------------------
+ // Fonts
+ //---------------------------------------------------
+
+ fontBrowse0->setPixmap(*openIcon);
+ fontBrowse1->setPixmap(*openIcon);
+ fontBrowse2->setPixmap(*openIcon);
+ fontBrowse3->setPixmap(*openIcon);
+ fontBrowse4->setPixmap(*openIcon);
+ fontBrowse5->setPixmap(*openIcon);
+ fontBrowse6->setPixmap(*openIcon);
+ connect(fontBrowse0, SIGNAL(clicked()), SLOT(browseFont0()));
+ connect(fontBrowse1, SIGNAL(clicked()), SLOT(browseFont1()));
+ connect(fontBrowse2, SIGNAL(clicked()), SLOT(browseFont2()));
+ connect(fontBrowse3, SIGNAL(clicked()), SLOT(browseFont3()));
+ connect(fontBrowse4, SIGNAL(clicked()), SLOT(browseFont4()));
+ connect(fontBrowse5, SIGNAL(clicked()), SLOT(browseFont5()));
+ connect(fontBrowse6, SIGNAL(clicked()), SLOT(browseFont6()));
+
+ connect(applyButton, SIGNAL(clicked()), SLOT(apply()));
+ connect(okButton, SIGNAL(clicked()), SLOT(ok()));
+ connect(cancelButton, SIGNAL(clicked()), SLOT(cancel()));
+ connect(selectBgButton, SIGNAL(clicked()), SLOT(configBackground()));
+ connect(clearBgButton, SIGNAL(clicked()), SLOT(clearBackground()));
+ connect(partShowevents, SIGNAL(toggled(bool)), eventButtonGroup, SLOT(setEnabled(bool)));
+ //updateColor();
+ }
+
+//---------------------------------------------------------
+// resetValues
+//---------------------------------------------------------
+
+void Appearance::resetValues()
+ {
+ *config = ::config; // init with global config values
+ updateFonts();
+ palette0->setPaletteBackgroundColor(config->palette[0]);
+ palette1->setPaletteBackgroundColor(config->palette[1]);
+ palette2->setPaletteBackgroundColor(config->palette[2]);
+ palette3->setPaletteBackgroundColor(config->palette[3]);
+ palette4->setPaletteBackgroundColor(config->palette[4]);
+ palette5->setPaletteBackgroundColor(config->palette[5]);
+ palette6->setPaletteBackgroundColor(config->palette[6]);
+ palette7->setPaletteBackgroundColor(config->palette[7]);
+ palette8->setPaletteBackgroundColor(config->palette[8]);
+ palette9->setPaletteBackgroundColor(config->palette[9]);
+ palette10->setPaletteBackgroundColor(config->palette[10]);
+ palette11->setPaletteBackgroundColor(config->palette[11]);
+ palette12->setPaletteBackgroundColor(config->palette[12]);
+ palette13->setPaletteBackgroundColor(config->palette[13]);
+ palette14->setPaletteBackgroundColor(config->palette[14]);
+ palette15->setPaletteBackgroundColor(config->palette[15]);
+
+ currentBg = ::config.canvasBgPixmap;
+ if (currentBg.isEmpty())
+ currentBg = tr("<none>");
+ currentBgLabel->setText(currentBg);
+
+ partShownames->setChecked(config->canvasShowPartType & 1);
+ partShowevents->setChecked(config->canvasShowPartType & 2);
+ partShowCakes->setChecked(!(config->canvasShowPartType & 2));
+
+ eventNoteon->setChecked(config->canvasShowPartEvent & (1 << 0));
+ eventPolypressure->setChecked(config->canvasShowPartEvent & (1 << 1));
+ eventController->setChecked(config->canvasShowPartEvent & (1 << 2));
+ eventProgramchange->setChecked(config->canvasShowPartEvent & (1 << 3));
+ eventAftertouch->setChecked(config->canvasShowPartEvent & (1 << 4));
+ eventPitchbend->setChecked(config->canvasShowPartEvent & (1 << 5));
+ eventSpecial->setChecked(config->canvasShowPartEvent & (1 << 6));
+ //eventButtonGroup->setEnabled(config->canvasShowPartType == 2);
+ eventButtonGroup->setEnabled(config->canvasShowPartType & 2);
+ arrGrid->setChecked(config->canvasShowGrid);
+
+ themeComboBox->clear();
+ QString cs = muse->style()->name();
+ cs = cs.lower();
+
+ themeComboBox->insertStringList(QStyleFactory::keys());
+ for (int i = 0; i < themeComboBox->count(); ++i) {
+ if (themeComboBox->text(i).lower() == cs) {
+ themeComboBox->setCurrentItem(i);
+ }
+ }
+
+ updateColor();
+
+ }
+
+//---------------------------------------------------------
+// Appearance
+//---------------------------------------------------------
+
+Appearance::~Appearance()
+ {
+ delete config;
+ }
+
+//---------------------------------------------------------
+// updateFonts
+//---------------------------------------------------------
+
+void Appearance::updateFonts()
+ {
+ fontSize0->setValue(config->fonts[0].pointSize());
+ fontName0->setText(config->fonts[0].family());
+ italic0->setChecked(config->fonts[0].italic());
+ bold0->setChecked(config->fonts[0].bold());
+
+ fontSize1->setValue(config->fonts[1].pointSize());
+ fontName1->setText(config->fonts[1].family());
+ italic1->setChecked(config->fonts[1].italic());
+ bold1->setChecked(config->fonts[1].bold());
+
+ fontSize2->setValue(config->fonts[2].pointSize());
+ fontName2->setText(config->fonts[2].family());
+ italic2->setChecked(config->fonts[2].italic());
+ bold2->setChecked(config->fonts[2].bold());
+
+ fontSize3->setValue(config->fonts[3].pointSize());
+ fontName3->setText(config->fonts[3].family());
+ italic3->setChecked(config->fonts[3].italic());
+ bold3->setChecked(config->fonts[3].bold());
+
+ fontSize4->setValue(config->fonts[4].pointSize());
+ fontName4->setText(config->fonts[4].family());
+ italic4->setChecked(config->fonts[4].italic());
+ bold4->setChecked(config->fonts[4].bold());
+
+ fontSize5->setValue(config->fonts[5].pointSize());
+ fontName5->setText(config->fonts[5].family());
+ italic5->setChecked(config->fonts[5].italic());
+ bold5->setChecked(config->fonts[5].bold());
+
+ fontSize6->setValue(config->fonts[6].pointSize());
+ fontName6->setText(config->fonts[6].family());
+ italic6->setChecked(config->fonts[6].italic());
+ bold6->setChecked(config->fonts[6].bold());
+ }
+
+//---------------------------------------------------------
+// apply
+//---------------------------------------------------------
+
+void Appearance::apply()
+ {
+ int showPartEvent = 0;
+ int showPartType = 0;
+
+ if (partShownames->isChecked())
+ showPartType |= 1;
+ if (partShowevents->isChecked())
+ showPartType |= 2;
+ //if (partShowCakes->isChecked())
+ // showPartType |= 4;
+
+ config->canvasShowPartType = showPartType;
+
+ if (eventNoteon->isChecked())
+ showPartEvent |= (1 << 0);
+ if (eventPolypressure->isChecked())
+ showPartEvent |= (1 << 1);
+ if (eventController->isChecked())
+ showPartEvent |= (1 << 2);
+ if (eventProgramchange->isChecked())
+ showPartEvent |= (1 << 3);
+ if (eventAftertouch->isChecked())
+ showPartEvent |= (1 << 4);
+ if (eventPitchbend->isChecked())
+ showPartEvent |= (1 << 5);
+ if (eventSpecial->isChecked())
+ showPartEvent |= (1 << 6);
+
+ config->canvasShowPartEvent = showPartEvent;
+
+ if (currentBg == tr("<none>"))
+ config->canvasBgPixmap = QString();
+ else
+ config->canvasBgPixmap = currentBg;
+
+ // Added by Tim. p3.3.9
+ config->fonts[0].setFamily(fontName0->text());
+
+ config->fonts[0].setPointSize(fontSize0->value());
+ config->fonts[0].setItalic(italic0->isChecked());
+ config->fonts[0].setBold(bold0->isChecked());
+ QApplication::setFont(config->fonts[0], true);
+
+ config->fonts[1].setFamily(fontName1->text());
+ config->fonts[1].setPointSize(fontSize1->value());
+ config->fonts[1].setItalic(italic1->isChecked());
+ config->fonts[1].setBold(bold1->isChecked());
+
+ config->fonts[2].setFamily(fontName2->text());
+ config->fonts[2].setPointSize(fontSize2->value());
+ config->fonts[2].setItalic(italic2->isChecked());
+ config->fonts[2].setBold(bold2->isChecked());
+
+ config->fonts[3].setFamily(fontName3->text());
+ config->fonts[3].setPointSize(fontSize3->value());
+ config->fonts[3].setItalic(italic3->isChecked());
+ config->fonts[3].setBold(bold3->isChecked());
+
+ config->fonts[4].setFamily(fontName4->text());
+ config->fonts[4].setPointSize(fontSize4->value());
+ config->fonts[4].setItalic(italic4->isChecked());
+ config->fonts[4].setBold(bold4->isChecked());
+
+ config->fonts[5].setFamily(fontName5->text());
+ config->fonts[5].setPointSize(fontSize5->value());
+ config->fonts[5].setItalic(italic5->isChecked());
+ config->fonts[5].setBold(bold5->isChecked());
+
+ config->fonts[6].setFamily(fontName6->text());
+ config->fonts[6].setPointSize(fontSize6->value());
+ config->fonts[6].setItalic(italic6->isChecked());
+ config->fonts[6].setBold(bold6->isChecked());
+
+ config->style = themeComboBox->currentText();
+ // setting up a new theme might change the fontsize, so re-read
+ fontSize0->setValue(QApplication::font().pointSize());
+
+ config->canvasShowGrid = arrGrid->isChecked();
+
+ // set colors...
+ ::config = *config;
+ muse->changeConfig(true);
+ }
+
+//---------------------------------------------------------
+// ok
+//---------------------------------------------------------
+
+void Appearance::ok()
+ {
+ apply();
+ close(false);
+ }
+
+//---------------------------------------------------------
+// cancel
+//---------------------------------------------------------
+
+void Appearance::cancel()
+ {
+ close(false);
+ }
+
+//---------------------------------------------------------
+// configBackground
+//---------------------------------------------------------
+
+void Appearance::configBackground()
+ {
+ QString cur(currentBg);
+ if (cur == tr("<none>"))
+ cur = museGlobalShare + "/wallpapers";
+ currentBg = getImageFileName(cur, image_file_pattern, this,
+ tr("MusE: load image"));
+ if (currentBg.isEmpty())
+ currentBg = tr("<none>");
+ currentBgLabel->setText(currentBg);
+ }
+
+//---------------------------------------------------------
+// clearBackground
+//---------------------------------------------------------
+
+void Appearance::clearBackground()
+ {
+ currentBg = tr("<none>");
+ currentBgLabel->setText(currentBg);
+ }
+
+//---------------------------------------------------------
+// selectionChanged
+//---------------------------------------------------------
+
+void Appearance::colorItemSelectionChanged()
+ {
+ IdListViewItem* item = (IdListViewItem*)itemList->selectedItem();
+ QString txt = item->text(0);
+ int id = item->id();
+ if (id == 0) {
+ color = 0;
+ return;
+ }
+ switch(id) {
+ case 0x400: // "Default"
+ case 0x401: // "Refrain"
+ case 0x402: // "Bridge"
+ case 0x403: // "Intro"
+ case 0x404: // "Coda"
+ case 0x405: // "Chorus"
+ case 0x406: // "Solo"
+ case 0x407: // "Brass"
+ case 0x408: // "Percussion"
+ case 0x409: // "Drums"
+ case 0x40a: // "Guitar"
+ case 0x40b: // "Bass"
+ case 0x40c: // "Flute"
+ case 0x40d: // "Strings
+ case 0x40e: // "Keyboard
+ case 0x40f: // "Piano
+ case 0x410: // "Saxophon
+ color = &config->partColors[id & 0xff];
+ break;
+ case 0x100: color = &config->bigTimeBackgroundColor; break;
+ case 0x101: color = &config->bigTimeForegroundColor; break;
+ case 0x200: color = &config->transportHandleColor; break;
+ case 0x300: color = &config->waveEditBackgroundColor; break;
+ case 0x411: color = &config->trackBg; break;
+ case 0x412: color = &config->midiTrackBg; break;
+ case 0x413: color = &config->drumTrackBg; break;
+ case 0x414: color = &config->waveTrackBg; break;
+ case 0x415: color = &config->outputTrackBg; break;
+ case 0x416: color = &config->inputTrackBg; break;
+ case 0x417: color = &config->groupTrackBg; break;
+ case 0x418: color = &config->auxTrackBg; break;
+ case 0x419: color = &config->synthTrackBg; break;
+ case 0x41a: color = &config->selectTrackBg; break;
+ case 0x41b: color = &config->selectTrackFg; break;
+ case 0x41c: color = &config->partCanvasBg; break;
+ case 0x41d: color = &config->ctrlGraphFg; break;
+
+ default:
+ color = 0;
+ break;
+ }
+ updateColor();
+ }
+
+void Appearance::updateColor()
+ {
+ int r, g, b, h, s, v;
+ rslider->setEnabled(color);
+ gslider->setEnabled(color);
+ bslider->setEnabled(color);
+ hslider->setEnabled(color);
+ sslider->setEnabled(color);
+ vslider->setEnabled(color);
+ rval->setEnabled(color);
+ gval->setEnabled(color);
+ bval->setEnabled(color);
+ hval->setEnabled(color);
+ sval->setEnabled(color);
+ vval->setEnabled(color);
+ if (color == 0)
+ return;
+ colorframe->setBackgroundColor(*color);
+ color->getRgb(&r, &g, &b);
+ color->getHsv(&h, &s, &v);
+
+ rslider->blockSignals(true);
+ gslider->blockSignals(true);
+ bslider->blockSignals(true);
+ hslider->blockSignals(true);
+ sslider->blockSignals(true);
+ vslider->blockSignals(true);
+ rval->blockSignals(true);
+ gval->blockSignals(true);
+ bval->blockSignals(true);
+ hval->blockSignals(true);
+ sval->blockSignals(true);
+ vval->blockSignals(true);
+
+ rslider->setValue(r);
+ gslider->setValue(g);
+ bslider->setValue(b);
+ hslider->setValue(h);
+ sslider->setValue(s);
+ vslider->setValue(v);
+ rval->setValue(r);
+ gval->setValue(g);
+ bval->setValue(b);
+ hval->setValue(h);
+ sval->setValue(s);
+ vval->setValue(v);
+
+ rslider->blockSignals(false);
+ gslider->blockSignals(false);
+ bslider->blockSignals(false);
+ hslider->blockSignals(false);
+ sslider->blockSignals(false);
+ vslider->blockSignals(false);
+ rval->blockSignals(false);
+ gval->blockSignals(false);
+ bval->blockSignals(false);
+ hval->blockSignals(false);
+ sval->blockSignals(false);
+ vval->blockSignals(false);
+ }
+
+void Appearance::rsliderChanged(int val)
+ {
+ int r, g, b;
+ if (color) {
+ color->getRgb(&r, &g, &b);
+ color->setRgb(val, g, b);
+ }
+ updateColor();
+ }
+
+void Appearance::gsliderChanged(int val)
+ {
+ int r, g, b;
+ if (color) {
+ color->getRgb(&r, &g, &b);
+ color->setRgb(r, val, b);
+ }
+ updateColor();
+ }
+
+void Appearance::bsliderChanged(int val)
+ {
+ int r, g, b;
+ if (color) {
+ color->getRgb(&r, &g, &b);
+ color->setRgb(r, g, val);
+ }
+ updateColor();
+ }
+
+void Appearance::hsliderChanged(int val)
+ {
+ int h, s, v;
+ if (color) {
+ color->getHsv(&h, &s, &v);
+ color->setHsv(val, s, v);
+ }
+ updateColor();
+ }
+
+void Appearance::ssliderChanged(int val)
+ {
+ int h, s, v;
+ if (color) {
+ color->getHsv(&h, &s, &v);
+ color->setHsv(h, val, v);
+ }
+ updateColor();
+ }
+
+void Appearance::vsliderChanged(int val)
+ {
+ int h, s, v;
+ if (color) {
+ color->getHsv(&h, &s, &v);
+ color->setHsv(h, s, val);
+ }
+ updateColor();
+ }
+
+//---------------------------------------------------------
+// addToPaletteClicked
+//---------------------------------------------------------
+
+void Appearance::addToPaletteClicked()
+ {
+ if (!color)
+ return;
+ Q3Button* button = (Q3Button*)aPalette->selected(); // ddskrjo
+ int r, g, b;
+ QColor c;
+ if (button) {
+ int id = aPalette->id(button);
+ c = config->palette[id];
+ c.getRgb(&r, &g, &b);
+ }
+ if (button == 0 || r != 0xff || g != 0xff || b != 0xff) {
+ for (int i = 0; i < 16; ++i) {
+ c = config->palette[i];
+ c.getRgb(&r, &g, &b);
+ if (r == 0xff && g == 0xff && b == 0xff) {
+ // found empty slot
+ aPalette->setButton(i);
+ //aPalette->moveFocus(i); ddskrjo
+ button = (Q3Button*)aPalette->find(i); // ddskrjo
+ break;
+ }
+ }
+ }
+ if (button) {
+ int id = aPalette->id(button);
+ config->palette[id] = *color;
+ button->setPaletteBackgroundColor(*color);
+ button->update(); //??
+ }
+ }
+
+//---------------------------------------------------------
+// paletteClicked
+//---------------------------------------------------------
+
+void Appearance::paletteClicked(int id)
+ {
+ if (!color)
+ return;
+ Q3Button* button = (Q3Button*)aPalette->find(id); // ddskrjo
+ if (button) {
+ QColor c = button->paletteBackgroundColor();
+ int r, g, b;
+ c.getRgb(&r, &g, &b);
+ if (r == 0xff && g == 0xff && b == 0xff)
+ return; // interpret palette slot as empty
+ *color = c;
+ updateColor();
+ }
+ }
+
+//---------------------------------------------------------
+// browseFont
+//---------------------------------------------------------
+
+void Appearance::browseFont0() { browseFont(0); }
+void Appearance::browseFont1() { browseFont(1); }
+void Appearance::browseFont2() { browseFont(2); }
+void Appearance::browseFont3() { browseFont(3); }
+void Appearance::browseFont4() { browseFont(4); }
+void Appearance::browseFont5() { browseFont(5); }
+void Appearance::browseFont6() { browseFont(6); }
+
+void Appearance::browseFont(int n)
+ {
+ bool ok;
+ QFont font = QFontDialog::getFont(&ok, config->fonts[n], this, "browseFont");
+ if (ok) {
+ config->fonts[n] = font;
+ updateFonts();
+ }
+ }
+
diff --git a/muse2/muse/appearance.h b/muse2/muse/appearance.h
new file mode 100644
index 00000000..1225d96a
--- /dev/null
+++ b/muse2/muse/appearance.h
@@ -0,0 +1,56 @@
+#ifndef __APPEARANCE_H__
+#define __APPEARANCE_H__
+
+#include "appearancebase.h"
+#include <qfont.h>
+
+class MusE;
+class Arranger;
+class QColor;
+class GlobalConfigValues;
+
+//---------------------------------------------------------
+// Appearance Dialog
+//---------------------------------------------------------
+
+class Appearance : public AppearanceDialogBase {
+ Arranger* arr;
+ QColor* color;
+ QString currentBg;
+ GlobalConfigValues* config;
+
+ Q_OBJECT
+ void updateFonts();
+ void updateColor();
+
+ private slots:
+ void apply();
+ void ok();
+ void cancel();
+ void configBackground();
+ void clearBackground();
+ void colorItemSelectionChanged();
+ void browseFont(int);
+ void browseFont0();
+ void browseFont1();
+ void browseFont2();
+ void browseFont3();
+ void browseFont4();
+ void browseFont5();
+ void browseFont6();
+ void rsliderChanged(int);
+ void gsliderChanged(int);
+ void bsliderChanged(int);
+ void hsliderChanged(int);
+ void ssliderChanged(int);
+ void vsliderChanged(int);
+ void addToPaletteClicked();
+ void paletteClicked(int);
+
+ public:
+ Appearance(Arranger*, QWidget* parent=0, const char* name=0);
+ ~Appearance();
+ void resetValues();
+ };
+
+#endif
diff --git a/muse2/muse/arranger/Makefile.am b/muse2/muse/arranger/Makefile.am
new file mode 100644
index 00000000..7b99b4c4
--- /dev/null
+++ b/muse2/muse/arranger/Makefile.am
@@ -0,0 +1,20 @@
+include $(top_srcdir)/common.am
+
+noinst_LIBRARIES = libarranger.a
+
+if PCH
+AM_CXXFLAGS += -include $(top_srcdir)/all.h
+endif
+
+dist_libarranger_a_SOURCES = \
+ arranger.cpp arranger.h \
+ pcanvas.cpp pcanvas.h \
+ tlist.cpp tlist.h \
+ alayout.cpp alayout.h \
+ trackinfo.cpp trackautomationview.h
+
+nodist_libarranger_a_SOURCES = \
+ moc_arranger.cpp \
+ moc_pcanvas.cpp \
+ moc_tlist.cpp \
+ moc_alayout.cpp
diff --git a/muse2/muse/arranger/Makefile.in b/muse2/muse/arranger/Makefile.in
new file mode 100644
index 00000000..02bb5920
--- /dev/null
+++ b/muse2/muse/arranger/Makefile.in
@@ -0,0 +1,612 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/common.am
+@PCH_TRUE@am__append_1 = -include $(top_srcdir)/all.h
+subdir = muse/arranger
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
+ $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libarranger_a_AR = $(AR) $(ARFLAGS)
+libarranger_a_LIBADD =
+dist_libarranger_a_OBJECTS = arranger.$(OBJEXT) pcanvas.$(OBJEXT) \
+ tlist.$(OBJEXT) alayout.$(OBJEXT) trackinfo.$(OBJEXT)
+nodist_libarranger_a_OBJECTS = moc_arranger.$(OBJEXT) \
+ moc_pcanvas.$(OBJEXT) moc_tlist.$(OBJEXT) \
+ moc_alayout.$(OBJEXT)
+libarranger_a_OBJECTS = $(dist_libarranger_a_OBJECTS) \
+ $(nodist_libarranger_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(dist_libarranger_a_SOURCES) \
+ $(nodist_libarranger_a_SOURCES)
+DIST_SOURCES = $(dist_libarranger_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCBOOKSTYLE = @DOCBOOKSTYLE@
+DOCBOOKTARGETS = @DOCBOOKTARGETS@
+DOT = @DOT@
+DOTPATH = @DOTPATH@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@
+FST_CFLAGS = @FST_CFLAGS@
+FST_LIBS = @FST_LIBS@
+Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@
+Fluidsynth_LIBS = @Fluidsynth_LIBS@
+GIVERTCAP = @GIVERTCAP@
+GREP = @GREP@
+HAVEDOT = @HAVEDOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JADE = @JADE@
+LASH_CFLAGS = @LASH_CFLAGS@
+LASH_LIBS = @LASH_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LO_CFLAGS = @LO_CFLAGS@
+LO_LIBS = @LO_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUSECXXFLAGS = @MUSECXXFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSGMLS = @NSGMLS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCH = @PCH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIB = @PYTHON_LIB@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+QTDIR_BIN = @QTDIR_BIN@
+QTDIR_INC = @QTDIR_INC@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+SUIDBUILD = @SUIDBUILD@
+SUIDINSTALL = @SUIDINSTALL@
+USE_SSE = @USE_SSE@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+have_docbook = @have_docbook@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+synth_fluid = @synth_fluid@
+synth_fluidsynth = @synth_fluidsynth@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \
+ -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(am__append_1)
+AM_CPPFLAGS =
+MOC = $(QTDIR_BIN)/moc
+#UIC = $(QTDIR_BIN)/uic3
+UIC = /usr/bin/uic3
+UIFILES = $(wildcard *.ui)
+MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \
+ if grep -q Q_OBJECT $$h; then \
+ echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \
+ fi; \
+ done)
+
+BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+SUFFIXES = .ui .h.gch
+noinst_LIBRARIES = libarranger.a
+dist_libarranger_a_SOURCES = \
+ arranger.cpp arranger.h \
+ pcanvas.cpp pcanvas.h \
+ tlist.cpp tlist.h \
+ alayout.cpp alayout.h \
+ trackinfo.cpp trackautomationview.h
+
+nodist_libarranger_a_SOURCES = \
+ moc_arranger.cpp \
+ moc_pcanvas.cpp \
+ moc_tlist.cpp \
+ moc_alayout.cpp
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .ui .h.gch .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/arranger/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu muse/arranger/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libarranger.a: $(libarranger_a_OBJECTS) $(libarranger_a_DEPENDENCIES)
+ -rm -f libarranger.a
+ $(libarranger_a_AR) libarranger.a $(libarranger_a_OBJECTS) $(libarranger_a_LIBADD)
+ $(RANLIB) libarranger.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alayout.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arranger.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_alayout.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_arranger.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_pcanvas.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_tlist.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcanvas.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlist.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trackinfo.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+de:
+ @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done
+
+nde:
+ @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done
+
+.ui.o: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(CXXCOMPILE) -c $*.cpp -o $*.o
+ $(RM) $*.cpp moc_$*.cpp moc_$*.o
+
+.ui.lo: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(LTCXXCOMPILE) -c $*.cpp -o $*.lo
+ $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o
+
+moc_%.cpp: %.h
+ $(MOC) $< -o $@
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/muse2/muse/arranger/alayout.cpp b/muse2/muse/arranger/alayout.cpp
new file mode 100644
index 00000000..04665b24
--- /dev/null
+++ b/muse2/muse/arranger/alayout.cpp
@@ -0,0 +1,161 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: alayout.cpp,v 1.8 2004/02/28 14:58:24 wschweer Exp $
+// (C) Copyright 2002 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "alayout.h"
+#include <qscrollbar.h>
+//Added by qt3to4:
+#include <Q3PtrList>
+
+#include "arranger.h"
+
+//---------------------------------------------------------
+// wadd
+//---------------------------------------------------------
+
+void TLLayout::wadd(int idx, QWidget* w)
+ {
+ li[idx] = new QWidgetItem(w);
+ if (idx == 0)
+ stack = (WidgetStack*)w;
+ if (idx == 1)
+ sb = (QScrollBar*)w;
+ addItem(li[idx]);
+ }
+
+//---------------------------------------------------------
+// TLLayoutIterator
+//---------------------------------------------------------
+
+class TLLayoutIterator // : public QGLayoutIterator ddskrjo
+ {
+ int idx;
+ Q3PtrList<QLayoutItem> *list;
+
+ public:
+ TLLayoutIterator(Q3PtrList<QLayoutItem> *l) : idx(0), list(l) {}
+ QLayoutItem *current() { return idx < int(list->count()) ? list->at(idx) : 0; }
+ QLayoutItem *next() { idx++; return current(); }
+ QLayoutItem *takeCurrent() { return list->take( idx ); }
+ };
+
+//---------------------------------------------------------
+// iterator
+//---------------------------------------------------------
+
+QLayoutIterator TLLayout::iterator()
+ {
+ return QLayoutIterator(0); //new TLLayoutIterator(&ilist)); ddskrjo
+ }
+
+void TLLayout::addItem(QLayoutItem *item)
+ {
+ ilist.append(item);
+ }
+
+TLLayout::~TLLayout()
+ {
+ deleteAllItems();
+ }
+
+//---------------------------------------------------------
+// setGeometry
+// perform geometry management for tracklist:
+//
+// 0 1 2
+// +-----------+--------+---------+
+// | Trackinfo | scroll | header 2|
+// | | bar +---------+ y1
+// | ^ | | ^ |
+// | | | <list> |
+// | 0 | 1 | 3 |
+// +-----------+--------+---------+ y2
+// | hline 4 |
+// +----------+-------------------+ y3
+// | button 5 | |
+// +----------+-------------------+
+//---------------------------------------------------------
+
+void TLLayout::setGeometry(const QRect &rect)
+ {
+ int w = rect.width();
+ int h = rect.height();
+
+ QSize s0;
+ if (stack->visibleWidget()) {
+ s0 = stack->visibleWidget()->minimumSizeHint();
+ if (!s0.isValid()) // widget has no geometry management
+ s0 = stack->visibleWidget()->size();
+ }
+ else
+ s0 = stack->minimumSizeHint();
+
+ QSize s1 = li[1]->sizeHint();
+ QSize s2 = li[2]->sizeHint();
+ QSize s3 = li[3]->sizeHint();
+ QSize s4 = li[4]->sizeHint();
+ QSize s5 = li[5]->sizeHint();
+
+ int y1 = 30; // fixed header height
+ int ah = h - s5.height() - s4.height() - y1; // list height
+ int aw = w - s1.width() - s0.width(); // list width
+
+ int y2 = ah + s2.height();
+ int y3 = y2 + s4.height();
+ int x1 = s0.width();
+ int x2 = x1 + s1.width();
+
+ li[0]->setGeometry(QRect(0, 0, s0.width(), y2));
+
+ QWidget* widget = stack->visibleWidget();
+ int range = s0.height() - y2;
+ if (range < 0)
+ range = 0;
+ sb->setShown(range != 0);
+ if (range)
+ sb->setMaxValue(range);
+
+ if (widget) {
+ QSize r(s0.width(), y2);
+ widget->setGeometry(0, 0, r.width(), r.height());
+ }
+
+ li[1]->setGeometry(QRect(x1, 0, s1.width(), y2));
+ li[2]->setGeometry(QRect(x2, 0, aw, s2.height()));
+ li[3]->setGeometry(QRect(x2, y1, aw, ah));
+ li[4]->setGeometry(QRect(0, y2, w, s4.height()));
+ li[5]->setGeometry(QRect(3, y3, s5.width(), s5.height()));
+ }
+
+//---------------------------------------------------------
+// sizeHint
+//---------------------------------------------------------
+
+QSize TLLayout::sizeHint() const
+ {
+ return QSize(150, 100);
+ }
+
+//---------------------------------------------------------
+// minimumSize
+//---------------------------------------------------------
+
+QSize TLLayout::minimumSize() const
+ {
+ int w = stack->minimumSizeHint().width();
+ w += li[1]->sizeHint().width();
+ return QSize(w, 50);
+ }
+
+//---------------------------------------------------------
+// maximumSize
+//---------------------------------------------------------
+
+QSize TLLayout::maximumSize() const
+ {
+ return QSize(440, 100000);
+ }
+
diff --git a/muse2/muse/arranger/alayout.h b/muse2/muse/arranger/alayout.h
new file mode 100644
index 00000000..1a1d5ee2
--- /dev/null
+++ b/muse2/muse/arranger/alayout.h
@@ -0,0 +1,48 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: alayout.h,v 1.3.2.1 2008/01/19 13:33:46 wschweer Exp $
+// (C) Copyright 2002 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __ALAYOUT_H__
+#define __ALAYOUT_H__
+
+#include <qlayout.h>
+#include <q3ptrlist.h>
+
+class QScrollBar;
+class WidgetStack;
+
+//---------------------------------------------------------
+// TLLayout
+// arranger trackList layout manager
+//---------------------------------------------------------
+
+class TLLayout : public QLayout
+ {
+ Q_OBJECT
+
+ Q3PtrList<QLayoutItem> ilist;
+ QLayoutItem* li[6];
+ QScrollBar* sb;
+ WidgetStack* stack;
+
+ public:
+ TLLayout(QWidget *parent) : QLayout(parent, 0, -1) {}
+ ~TLLayout();
+
+ void addItem(QLayoutItem *item);
+
+ void wadd(int idx, QWidget* w);
+ virtual QSize sizeHint() const;
+ virtual QSize minimumSize() const;
+ virtual QSize maximumSize() const;
+ QLayoutIterator iterator();
+ void setGeometry(const QRect &rect);
+
+ virtual QLayoutItem* itemAt(int) const { return 0;} // ddskrjo, is pure virtual, overridden
+ virtual QLayoutItem* takeAt(int) { return 0;} // ddskrjo, is pure virtual, overridden
+ virtual int count() const { return ilist.count(); } // ddskrjo, is pure virtual, overridden
+ };
+#endif
diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp
new file mode 100644
index 00000000..d25911cd
--- /dev/null
+++ b/muse2/muse/arranger/arranger.cpp
@@ -0,0 +1,971 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: arranger.cpp,v 1.33.2.21 2009/11/17 22:08:22 terminator356 Exp $
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "config.h"
+
+#include <stdio.h>
+
+#include <values.h>
+#include <qlayout.h>
+#include <qcombobox.h>
+#include <qtoolbutton.h>
+#include <q3buttongroup.h>
+#include <qlabel.h>
+#include <q3accel.h>
+#include <qcombobox.h>
+#include <q3whatsthis.h>
+#include <q3toolbar.h>
+#include <qtooltip.h>
+#include <q3popupmenu.h>
+#include <q3hbox.h>
+#include <qstringlist.h>
+#include <q3filedialog.h>
+#include <qcheckbox.h>
+#include <qpushbutton.h>
+#include <q3mainwindow.h>
+#include <q3widgetstack.h>
+#include <qscrollbar.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include <Q3ValueList>
+#include <Q3GridLayout>
+#include <QPixmap>
+#include <Q3VBoxLayout>
+#include <QWheelEvent>
+
+#include "arranger.h"
+#include "song.h"
+#include "mtscale.h"
+#include "scrollscale.h"
+#include "pcanvas.h"
+#include "poslabel.h"
+#include "xml.h"
+#include "splitter.h"
+#include "lcombo.h"
+#include "midiport.h"
+#include "mididev.h"
+#include "utils.h"
+#include "globals.h"
+#include "tlist.h"
+#include "icons.h"
+#include "mtrackinfobase.h"
+#include "header.h"
+#include "utils.h"
+#include "alayout.h"
+#include "audio.h"
+#include "event.h"
+#include "midiseq.h"
+#include "midictrl.h"
+#include "mpevent.h"
+#include "gconfig.h"
+#include "mixer/astrip.h"
+#include "spinbox.h"
+//---------------------------------------------------------
+// TWhatsThis::text
+//---------------------------------------------------------
+
+QString TWhatsThis::text(const QPoint& pos)
+ {
+ int section = header->sectionAt(pos.x());
+ if (section == -1)
+ return QString::null;
+ switch(section) {
+ case COL_RECORD: return Q3Header::tr("Enable recording. Click to toggle."); break;
+ case COL_MUTE: return Q3Header::tr("Mute indicator. Click to toggle.\nRight-click to toggle track on/off.\nMute is designed for rapid, repeated action.\nOn/Off is not!"); break;
+ case COL_SOLO: return Q3Header::tr("Solo indicator. Click to toggle.\nConnected tracks are also 'phantom' soloed,\n indicated by a dark square."); break;
+ case COL_CLASS: return Q3Header::tr("Track type. Right-click to change\n midi and drum track types."); break;
+ case COL_NAME: return Q3Header::tr("Track name. Double-click to edit.\nRight-click for more options."); break;
+ case COL_OCHANNEL: return Q3Header::tr("Midi/drum track: Output channel number.\nAudio track: Channels.\nMid/right-click to change."); break;
+ case COL_OPORT: return Q3Header::tr("Midi/drum track: Output port.\nSynth track: Assigned midi port.\nLeft-click to change.\nRight-click to show GUI."); break;
+ case COL_TIMELOCK: return Q3Header::tr("Time lock"); break;
+ default: break;
+ }
+ return QString::null;
+ }
+
+//---------------------------------------------------------
+// Arranger
+// is the central widget in app
+//---------------------------------------------------------
+
+Arranger::Arranger(Q3MainWindow* parent, const char* name)
+ : QWidget(parent, name)
+ {
+ _raster = 0; // measure
+ selected = 0;
+ // Since program covers 3 controls at once, it is in 'midi controller' units rather than 'gui control' units.
+ //program = -1;
+ program = CTRL_VAL_UNKNOWN;
+ pan = -65;
+ volume = -1;
+ setMinimumSize(600, 50);
+ showTrackinfoFlag = true;
+
+ cursVal = MAXINT;
+ //---------------------------------------------------
+ // ToolBar
+ // create toolbar in toplevel widget
+ //---------------------------------------------------
+
+ Q3ToolBar* toolbar = new Q3ToolBar(tr("Arranger"), parent);
+
+ QLabel* label = new QLabel(tr("Cursor"), toolbar, "Cursor");
+ label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ label->setIndent(3);
+ cursorPos = new PosLabel(toolbar);
+ cursorPos->setEnabled(false);
+
+ const char* rastval[] = {
+ QT_TR_NOOP("Off"), QT_TR_NOOP("Bar"), "1/2", "1/4", "1/8", "1/16"
+ };
+ label = new QLabel(tr("Snap"), toolbar, "Snap");
+ label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ label->setIndent(3);
+ QComboBox* raster = new QComboBox(toolbar);
+ for (int i = 0; i < 6; i++)
+ raster->insertItem(tr(rastval[i]), i);
+ raster->setCurrentItem(1);
+ connect(raster, SIGNAL(activated(int)), SLOT(_setRaster(int)));
+ raster->setFocusPolicy(Qt::NoFocus);
+
+ // Song len
+ label = new QLabel(tr("Len"), toolbar, "Len");
+ label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ label->setIndent(3);
+
+ // song length is limited to 10000 bars; the real song len is limited
+ // by overflows in tick computations
+ //
+ lenEntry = new SpinBox(1, 10000, 1, toolbar);
+ lenEntry->setValue(song->len());
+ connect(lenEntry, SIGNAL(valueChanged(int)), SLOT(songlenChanged(int)));
+ QToolTip::add(lenEntry, tr("song length - bars"));
+ Q3WhatsThis::add(lenEntry, tr("song length - bars"));
+
+ typeBox = new LabelCombo(tr("Type"), toolbar);
+ typeBox->insertItem(tr("NO"), 0);
+ typeBox->insertItem(tr("GM"), 1);
+ typeBox->insertItem(tr("GS"), 2);
+ typeBox->insertItem(tr("XG"), 3);
+ typeBox->setCurrentItem(0);
+ connect(typeBox, SIGNAL(activated(int)), SLOT(modeChange(int)));
+ QToolTip::add(typeBox, tr("midi song type"));
+ Q3WhatsThis::add(typeBox, tr("midi song type"));
+ typeBox->setFocusPolicy(Qt::NoFocus);
+
+ label = new QLabel(tr("Pitch"), toolbar, "Pitch");
+ label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ label->setIndent(3);
+ globalPitchSpinBox = new SpinBox(-127, 127, 1, toolbar);
+ globalPitchSpinBox->setValue(song->globalPitchShift());
+ QToolTip::add(globalPitchSpinBox, tr("midi pitch"));
+ Q3WhatsThis::add(globalPitchSpinBox, tr("global midi pitch shift"));
+ connect(globalPitchSpinBox, SIGNAL(valueChanged(int)), SLOT(globalPitchChanged(int)));
+ label = new QLabel(tr("Tempo"), toolbar, "Tempo");
+ label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ label->setIndent(3);
+ globalTempoSpinBox = new SpinBox(50, 200, 1, toolbar);
+ globalTempoSpinBox->setSuffix(QString("%"));
+ globalTempoSpinBox->setValue(tempomap.globalTempo());
+ QToolTip::add(globalTempoSpinBox, tr("midi tempo"));
+ Q3WhatsThis::add(globalTempoSpinBox, tr("midi tempo"));
+ connect(globalTempoSpinBox, SIGNAL(valueChanged(int)), SLOT(globalTempoChanged(int)));
+ QToolButton* tempo50 = new QToolButton(toolbar, "tempo50");
+ tempo50->setText(QString("50%"));
+ connect(tempo50, SIGNAL(clicked()), SLOT(setTempo50()));
+ QToolButton* tempo100 = new QToolButton(toolbar, "tempo100");
+ tempo100->setText(tr("N"));
+ connect(tempo100, SIGNAL(clicked()), SLOT(setTempo100()));
+ QToolButton* tempo200 = new QToolButton(toolbar, "tempo200");
+ tempo200->setText(QString("200%"));
+ connect(tempo200, SIGNAL(clicked()), SLOT(setTempo200()));
+
+ Q3VBoxLayout* box = new Q3VBoxLayout(this);
+ box->addWidget(hLine(this), Qt::AlignTop);
+
+ //---------------------------------------------------
+ // Tracklist
+ //---------------------------------------------------
+
+ int xscale = -100;
+ int yscale = 1;
+
+ split = new Splitter(Qt::Horizontal, this, "split");
+ split->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
+ box->addWidget(split, 1000);
+
+ QWidget* tracklist = new QWidget(split);
+ split->setResizeMode(tracklist, QSplitter::KeepSize);
+ tracklist->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding, 0, 100));
+
+ QWidget* editor = new QWidget(split);
+ split->setResizeMode(editor, QSplitter::Stretch);
+ editor->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding,
+ // Changed by T356. Was causing "large int implicitly truncated" warning. These are UCHAR values...
+ //1000, 100));
+ //232, 100)); // 232 is what it was being truncated to, but what is the right value?...
+ 255, 100));
+
+ //---------------------------------------------------
+ // Track Info
+ //---------------------------------------------------
+
+ infoScroll = new QScrollBar(Qt::Vertical, tracklist, "infoScrollBar");
+ genTrackInfo(tracklist);
+
+ // Track-Info Button
+ ib = new QToolButton(tracklist);
+ ib->setText(tr("TrackInfo"));
+ ib->setToggleButton(true);
+ ib->setOn(showTrackinfoFlag);
+
+ connect(ib, SIGNAL(toggled(bool)), SLOT(showTrackInfo(bool)));
+
+ // Changed by T356 Mar 8 2008. Did someone accidentally change to header1 recently?
+ // Muse was saying Tlist: unknown tag <header> at line 32
+ //header = new Header(tracklist, "header1");
+ header = new Header(tracklist, "header");
+
+ header->setFixedHeight(30);
+
+ QFontMetrics fm1(header->font());
+ int fw = 8;
+
+ header->addLabel(tr("R"), fm1.width('R')+fw);
+ header->addLabel(tr("M"), fm1.width('M')+fw);
+ header->addLabel(tr("S"), fm1.width('S')+fw);
+ header->addLabel(tr("C"), fm1.width('C')+fw);
+ header->addLabel(tr("Track"), 100);
+ //header->addLabel(tr("O-Port"), 60);
+ header->addLabel(tr("Port"), 60);
+ header->addLabel(tr("Ch"), 30);
+ header->addLabel(tr("T"), fm1.width('T')+fw);
+ //header->addLabel(tr("Automation"),30);
+ header->setResizeEnabled(false, COL_RECORD);
+ header->setResizeEnabled(false, COL_MUTE);
+ header->setResizeEnabled(false, COL_SOLO);
+ header->setResizeEnabled(false, COL_CLASS);
+ header->setResizeEnabled(false, COL_OCHANNEL);
+ header->setResizeEnabled(false, COL_TIMELOCK);
+ //header->setResizeEnabled(true, COL_AUTOMATION);
+ header->setResizeEnabled(true, COL_NAME);
+ header->setResizeEnabled(true, COL_OPORT);
+
+ header->setTracking(true);
+
+ new THeaderTip(header);
+ new TWhatsThis(header, header);
+
+ list = new TList(header, tracklist, "tracklist");
+
+ connect(list, SIGNAL(selectionChanged()), SLOT(trackSelectionChanged()));
+ connect(header, SIGNAL(sizeChange(int,int,int)), list, SLOT(redraw()));
+ connect(header, SIGNAL(moved(int,int)), list, SLOT(redraw()));
+ connect(header, SIGNAL(moved(int,int)), this, SLOT(headerMoved()));
+
+ // tracklist:
+ //
+ // 0 1 2
+ // +-----------+--------+---------+
+ // | Trackinfo | scroll | Header | 0
+ // | | bar +---------+
+ // | | | TList | 1
+ // +-----------+--------+---------+
+ // | hline | 2
+ // +-----+------------------------+
+ // | ib | | 3
+ // +-----+------------------------+
+
+ connect(infoScroll, SIGNAL(valueChanged(int)), SLOT(trackInfoScroll(int)));
+ tgrid = new TLLayout(tracklist); // layout manager for this
+ tgrid->wadd(0, trackInfo);
+ tgrid->wadd(1, infoScroll);
+ tgrid->wadd(2, header);
+ tgrid->wadd(3, list);
+ tgrid->wadd(4, hLine(tracklist));
+ tgrid->wadd(5, ib);
+
+ //---------------------------------------------------
+ // Editor
+ //---------------------------------------------------
+
+ int offset = sigmap.ticksMeasure(0);
+ hscroll = new ScrollScale(-1000, -10, xscale, song->len(), Qt::Horizontal, editor, -offset);
+ ib->setFixedHeight(hscroll->sizeHint().height());
+
+ // Changed p3.3.43 Too small steps for me...
+ //vscroll = new QScrollBar(1, 20*20, 1, 5, 0, Vertical, editor);
+ vscroll = new QScrollBar(1, 20*20, 5, 25, 0, Qt::Vertical, editor);
+
+ list->setScroll(vscroll);
+
+ Q3ValueList<int> vallist;
+ vallist.append(tgrid->maximumSize().width());
+ split->setSizes(vallist);
+
+ Q3GridLayout* egrid = new Q3GridLayout(editor);
+ egrid->setColStretch(0, 50);
+ egrid->setRowStretch(2, 50);
+
+ time = new MTScale(&_raster, editor, xscale);
+ time->setOrigin(-offset, 0);
+ canvas = new PartCanvas(&_raster, editor, xscale, yscale);
+ canvas->setBg(config.partCanvasBg);
+ canvas->setCanvasTools(arrangerTools);
+ canvas->setOrigin(-offset, 0);
+ canvas->setFocus();
+ connect(canvas, SIGNAL(setUsedTool(int)), this, SIGNAL(setUsedTool(int)));
+ connect(canvas, SIGNAL(trackChanged(Track*)), list, SLOT(selectTrack(Track*)));
+ connect(list, SIGNAL(keyPressExt(QKeyEvent*)), canvas, SLOT(redirKeypress(QKeyEvent*)));
+ connect(canvas, SIGNAL(selectTrackAbove()), list, SLOT(selectTrackAbove()));
+ connect(canvas, SIGNAL(selectTrackBelow()), list, SLOT(selectTrackBelow()));
+
+ connect(this, SIGNAL(redirectWheelEvent(QWheelEvent*)), canvas, SLOT(redirectedWheelEvent(QWheelEvent*)));
+ connect(list, SIGNAL(redirectWheelEvent(QWheelEvent*)), canvas, SLOT(redirectedWheelEvent(QWheelEvent*)));
+
+ egrid->addMultiCellWidget(time, 0, 0, 0, 1);
+ egrid->addMultiCellWidget(hLine(editor), 1, 1, 0, 1);
+ egrid->addWidget(canvas, 2, 0);
+ egrid->addWidget(vscroll, 2, 1);
+ egrid->addWidget(hscroll, 3, 0, Qt::AlignBottom);
+
+ connect(vscroll, SIGNAL(valueChanged(int)), canvas, SLOT(setYPos(int)));
+ connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int)));
+ connect(hscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setXMag(int)));
+ connect(vscroll, SIGNAL(valueChanged(int)), list, SLOT(setYPos(int)));
+ connect(hscroll, SIGNAL(scrollChanged(int)), time, SLOT(setXPos(int)));
+ connect(hscroll, SIGNAL(scaleChanged(int)), time, SLOT(setXMag(int)));
+ connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
+ connect(canvas, SIGNAL(verticalScroll(unsigned)),SLOT(verticalScrollSetYpos(unsigned)));
+ connect(canvas, SIGNAL(horizontalScroll(unsigned)),hscroll, SLOT(setPos(unsigned)));
+ connect(canvas, SIGNAL(horizontalScrollNoLimit(unsigned)),hscroll, SLOT(setPosNoLimit(unsigned)));
+ connect(time, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
+
+ connect(canvas, SIGNAL(tracklistChanged()), list, SLOT(tracklistChanged()));
+ connect(canvas, SIGNAL(dclickPart(Track*)), SIGNAL(editPart(Track*)));
+ connect(canvas, SIGNAL(startEditor(PartList*,int)), SIGNAL(startEditor(PartList*, int)));
+
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int)));
+ connect(canvas, SIGNAL(selectionChanged()), SIGNAL(selectionChanged()));
+ connect(canvas, SIGNAL(dropSongFile(const QString&)), SIGNAL(dropSongFile(const QString&)));
+ connect(canvas, SIGNAL(dropMidiFile(const QString&)), SIGNAL(dropMidiFile(const QString&)));
+
+ connect(canvas, SIGNAL(toolChanged(int)), SIGNAL(toolChanged(int)));
+// connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(seek()));
+
+ // Removed p3.3.43
+ // Song::addMarker() already emits a 'markerChanged'.
+ //connect(time, SIGNAL(addMarker(int)), SIGNAL(addMarker(int)));
+
+ configChanged(); // set configuration values
+ showTrackInfo(showTrackinfoFlag);
+ }
+
+//---------------------------------------------------------
+// updateHScrollRange
+//---------------------------------------------------------
+
+//void Arranger::updateHScrollRange()
+//{
+// int s = 0, e = song->len();
+ // Show one more measure.
+// e += sigmap.ticksMeasure(e);
+ // Show another quarter measure due to imprecise drawing at canvas end point.
+// e += sigmap.ticksMeasure(e) / 4;
+ // Compensate for the fixed vscroll width.
+// e += canvas->rmapxDev(-vscroll->width());
+// int s1, e1;
+// hscroll->range(&s1, &e1);
+// if(s != s1 || e != e1)
+// hscroll->setRange(s, e);
+//}
+
+//---------------------------------------------------------
+// headerMoved
+//---------------------------------------------------------
+
+void Arranger::headerMoved()
+ {
+ header->setStretchEnabled(true, COL_NAME);
+ }
+
+//---------------------------------------------------------
+// setTime
+//---------------------------------------------------------
+
+void Arranger::setTime(unsigned tick)
+ {
+ if (tick == MAXINT)
+ cursorPos->setEnabled(false);
+ else {
+ cursVal = tick;
+ cursorPos->setEnabled(true);
+ cursorPos->setValue(tick);
+ time->setPos(3, tick, false);
+ }
+ }
+
+//---------------------------------------------------------
+// toolChange
+//---------------------------------------------------------
+
+void Arranger::setTool(int t)
+ {
+ canvas->setTool(t);
+ }
+
+//---------------------------------------------------------
+// dclickPart
+//---------------------------------------------------------
+
+void Arranger::dclickPart(Track* t)
+ {
+ emit editPart(t);
+ }
+
+//---------------------------------------------------------
+// configChanged
+//---------------------------------------------------------
+
+void Arranger::configChanged()
+ {
+ // Added by Tim. p3.3.6
+ //printf("Arranger::configChanged\n");
+
+ if (config.canvasBgPixmap.isEmpty()) {
+ canvas->setBg(config.partCanvasBg);
+ canvas->setBg(QPixmap());
+ //printf("Arranger::configChanged - no bitmap!\n");
+ }
+ else {
+
+ //printf("Arranger::configChanged - bitmap %s!\n", config.canvasBgPixmap.ascii());
+ canvas->setBg(QPixmap(config.canvasBgPixmap));
+ }
+ midiTrackInfo->setFont(config.fonts[2]);
+ //updateTrackInfo(type);
+ }
+
+//---------------------------------------------------------
+// songlenChanged
+//---------------------------------------------------------
+
+void Arranger::songlenChanged(int n)
+ {
+ int newLen = sigmap.bar2tick(n, 0, 0);
+ song->setLen(newLen);
+ }
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void Arranger::songChanged(int type)
+ {
+ // Is it simply a midi controller value adjustment? Forget it.
+ if(type != SC_MIDI_CONTROLLER)
+ {
+ unsigned endTick = song->len();
+ int offset = sigmap.ticksMeasure(endTick);
+ hscroll->setRange(-offset, endTick + offset); //DEBUG
+ canvas->setOrigin(-offset, 0);
+ time->setOrigin(-offset, 0);
+
+ int bar, beat;
+ unsigned tick;
+ sigmap.tickValues(endTick, &bar, &beat, &tick);
+ if (tick || beat)
+ ++bar;
+ lenEntry->blockSignals(true);
+ lenEntry->setValue(bar);
+ lenEntry->blockSignals(false);
+
+ trackSelectionChanged();
+ canvas->partsChanged();
+ typeBox->setCurrentItem(int(song->mtype()));
+ if (type & SC_SIG)
+ time->redraw();
+ if (type & SC_TEMPO)
+ setGlobalTempo(tempomap.globalTempo());
+
+ if(type & SC_TRACK_REMOVED)
+ {
+ AudioStrip* w = (AudioStrip*)(trackInfo->getWidget(2));
+ if(w)
+ {
+ Track* t = w->getTrack();
+ if(t)
+ {
+ TrackList* tl = song->tracks();
+ iTrack it = tl->find(t);
+ if(it == tl->end())
+ {
+ delete w;
+ trackInfo->addWidget(0, 2);
+ selected = 0;
+ }
+ }
+ }
+ }
+ }
+
+ updateTrackInfo(type);
+ }
+
+//---------------------------------------------------------
+// trackSelectionChanged
+//---------------------------------------------------------
+
+void Arranger::trackSelectionChanged()
+ {
+ TrackList* tracks = song->tracks();
+ Track* track = 0;
+ for (iTrack t = tracks->begin(); t != tracks->end(); ++t) {
+ if ((*t)->selected()) {
+ track = *t;
+ break;
+ }
+ }
+ if (track == selected)
+ return;
+ selected = track;
+ updateTrackInfo(-1);
+ }
+
+//---------------------------------------------------------
+// modeChange
+//---------------------------------------------------------
+
+void Arranger::modeChange(int mode)
+ {
+ song->setMType(MType(mode));
+ updateTrackInfo(-1);
+ }
+
+//---------------------------------------------------------
+// setMode
+//---------------------------------------------------------
+
+void Arranger::setMode(int mode)
+ {
+ typeBox->setCurrentItem(mode);
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void Arranger::writeStatus(int level, Xml& xml)
+ {
+ xml.tag(level++, "arranger");
+ xml.intTag(level, "info", ib->isOn());
+ split->writeStatus(level, xml);
+ list->writeStatus(level, xml, "list");
+
+ xml.intTag(level, "xpos", hscroll->pos());
+ xml.intTag(level, "xmag", hscroll->mag());
+ xml.intTag(level, "ypos", vscroll->value());
+ xml.etag(level, "arranger");
+ }
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void Arranger::readStatus(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token(xml.parse());
+ const QString& tag(xml.s1());
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "info")
+ showTrackinfoFlag = xml.parseInt();
+ else if (tag == split->name())
+ split->readStatus(xml);
+ else if (tag == "list")
+ list->readStatus(xml, "list");
+ else if (tag == "xmag")
+ hscroll->setMag(xml.parseInt());
+ else if (tag == "xpos") {
+ int hpos = xml.parseInt();
+ hscroll->setPos(hpos);
+ }
+ else if (tag == "ypos")
+ vscroll->setValue(xml.parseInt());
+ else
+ xml.unknown("Arranger");
+ break;
+ case Xml::TagEnd:
+ if (tag == "arranger") {
+ ib->setOn(showTrackinfoFlag);
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// setRaster
+//---------------------------------------------------------
+
+void Arranger::_setRaster(int index)
+ {
+ static int rasterTable[] = {
+ 1, 0, 768, 384, 192, 96
+ };
+ _raster = rasterTable[index];
+ // Set the audio record part snapping.
+ song->setRecRaster(_raster);
+ canvas->redraw();
+ }
+
+//---------------------------------------------------------
+// reset
+//---------------------------------------------------------
+
+void Arranger::reset()
+ {
+ canvas->setXPos(0);
+ canvas->setYPos(0);
+ hscroll->setPos(0);
+ vscroll->setValue(0);
+ time->setXPos(0);
+ time->setYPos(0);
+ }
+
+//---------------------------------------------------------
+// cmd
+//---------------------------------------------------------
+
+void Arranger::cmd(int cmd)
+ {
+ int ncmd;
+ switch (cmd) {
+ case CMD_CUT_PART:
+ ncmd = PartCanvas::CMD_CUT_PART;
+ break;
+ case CMD_COPY_PART:
+ ncmd = PartCanvas::CMD_COPY_PART;
+ break;
+ case CMD_PASTE_PART:
+ ncmd = PartCanvas::CMD_PASTE_PART;
+ break;
+ case CMD_PASTE_CLONE_PART:
+ ncmd = PartCanvas::CMD_PASTE_CLONE_PART;
+ break;
+ case CMD_PASTE_PART_TO_TRACK:
+ ncmd = PartCanvas::CMD_PASTE_PART_TO_TRACK;
+ break;
+ case CMD_PASTE_CLONE_PART_TO_TRACK:
+ ncmd = PartCanvas::CMD_PASTE_CLONE_PART_TO_TRACK;
+ break;
+ case CMD_INSERT_PART:
+ ncmd = PartCanvas::CMD_INSERT_PART;
+ break;
+ case CMD_INSERT_EMPTYMEAS:
+ ncmd = PartCanvas::CMD_INSERT_EMPTYMEAS;
+ break;
+ default:
+ return;
+ }
+ canvas->cmd(ncmd);
+ }
+
+//---------------------------------------------------------
+// globalPitchChanged
+//---------------------------------------------------------
+
+void Arranger::globalPitchChanged(int val)
+ {
+ song->setGlobalPitchShift(val);
+ }
+
+//---------------------------------------------------------
+// globalTempoChanged
+//---------------------------------------------------------
+
+void Arranger::globalTempoChanged(int val)
+ {
+ audio->msgSetGlobalTempo(val);
+ song->tempoChanged();
+ }
+
+//---------------------------------------------------------
+// setTempo50
+//---------------------------------------------------------
+
+void Arranger::setTempo50()
+ {
+ setGlobalTempo(50);
+ }
+
+//---------------------------------------------------------
+// setTempo100
+//---------------------------------------------------------
+
+void Arranger::setTempo100()
+ {
+ setGlobalTempo(100);
+ }
+
+//---------------------------------------------------------
+// setTempo200
+//---------------------------------------------------------
+
+void Arranger::setTempo200()
+ {
+ setGlobalTempo(200);
+ }
+
+//---------------------------------------------------------
+// setGlobalTempo
+//---------------------------------------------------------
+
+void Arranger::setGlobalTempo(int val)
+ {
+ if(val != globalTempoSpinBox->value())
+ globalTempoSpinBox->setValue(val);
+ }
+
+//---------------------------------------------------------
+// verticalScrollSetYpos
+//---------------------------------------------------------
+void Arranger::verticalScrollSetYpos(unsigned ypos)
+ {
+ vscroll->setValue(ypos);
+ }
+
+//---------------------------------------------------------
+// progRecClicked
+//---------------------------------------------------------
+
+void Arranger::progRecClicked()
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ int portno = track->outPort();
+ int channel = track->outChannel();
+ MidiPort* port = &midiPorts[portno];
+ int program = port->hwCtrlState(channel, CTRL_PROGRAM);
+ if(program == CTRL_VAL_UNKNOWN || program == 0xffffff)
+ return;
+
+ unsigned tick = song->cpos();
+ Event a(Controller);
+ a.setTick(tick);
+ a.setA(CTRL_PROGRAM);
+ a.setB(program);
+
+ song->recordEvent(track, a);
+ }
+
+//---------------------------------------------------------
+// volRecClicked
+//---------------------------------------------------------
+
+void Arranger::volRecClicked()
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ int portno = track->outPort();
+ int channel = track->outChannel();
+ MidiPort* port = &midiPorts[portno];
+ int volume = port->hwCtrlState(channel, CTRL_VOLUME);
+ if(volume == CTRL_VAL_UNKNOWN)
+ return;
+
+ unsigned tick = song->cpos();
+ Event a(Controller);
+ a.setTick(tick);
+ a.setA(CTRL_VOLUME);
+ a.setB(volume);
+
+ song->recordEvent(track, a);
+ }
+
+//---------------------------------------------------------
+// panRecClicked
+//---------------------------------------------------------
+
+void Arranger::panRecClicked()
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ int portno = track->outPort();
+ int channel = track->outChannel();
+ MidiPort* port = &midiPorts[portno];
+ int pan = port->hwCtrlState(channel, CTRL_PANPOT);
+ if(pan == CTRL_VAL_UNKNOWN)
+ return;
+
+ unsigned tick = song->cpos();
+ Event a(Controller);
+ a.setTick(tick);
+ a.setA(CTRL_PANPOT);
+ a.setB(pan);
+
+ song->recordEvent(track, a);
+ }
+
+//---------------------------------------------------------
+// recordClicked
+//---------------------------------------------------------
+
+void Arranger::recordClicked()
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ int portno = track->outPort();
+ int channel = track->outChannel();
+ MidiPort* port = &midiPorts[portno];
+ unsigned tick = song->cpos();
+
+ int program = port->hwCtrlState(channel, CTRL_PROGRAM);
+ if(program != CTRL_VAL_UNKNOWN && program != 0xffffff)
+ {
+ Event a(Controller);
+ a.setTick(tick);
+ a.setA(CTRL_PROGRAM);
+ a.setB(program);
+ song->recordEvent(track, a);
+ }
+ int volume = port->hwCtrlState(channel, CTRL_VOLUME);
+ if(volume != CTRL_VAL_UNKNOWN)
+ {
+ Event a(Controller);
+ a.setTick(tick);
+ a.setA(CTRL_VOLUME);
+ a.setB(volume);
+ song->recordEvent(track, a);
+ }
+ int pan = port->hwCtrlState(channel, CTRL_PANPOT);
+ if(pan != CTRL_VAL_UNKNOWN)
+ {
+ Event a(Controller);
+ a.setTick(tick);
+ a.setA(CTRL_PANPOT);
+ a.setB(pan);
+ song->recordEvent(track, a);
+ }
+ }
+
+//---------------------------------------------------------
+// trackInfoScroll
+//---------------------------------------------------------
+
+void Arranger::trackInfoScroll(int y)
+ {
+ if (trackInfo->visibleWidget())
+ trackInfo->visibleWidget()->move(0, -y);
+ }
+
+//---------------------------------------------------------
+// WidgetStack
+//---------------------------------------------------------
+
+WidgetStack::WidgetStack(QWidget* parent, const char* name)
+ : QWidget(parent, name)
+ {
+ top = -1;
+ }
+
+//---------------------------------------------------------
+// raiseWidget
+//---------------------------------------------------------
+
+void WidgetStack::raiseWidget(int idx)
+ {
+ if (top != -1) {
+ if (stack[top])
+ stack[top]->hide();
+ }
+ top = idx;
+ if (idx == -1)
+ return;
+ int n = stack.size();
+ if (idx >= n)
+ return;
+ if (stack[idx])
+ stack[idx]->show();
+ }
+
+//---------------------------------------------------------
+// addWidget
+//---------------------------------------------------------
+
+void WidgetStack::addWidget(QWidget* w, unsigned int n)
+ {
+ if (w)
+ w->hide();
+ if (stack.size() <= n )
+ stack.push_back(w);
+ else
+ stack[n] = w;
+ }
+
+QWidget* WidgetStack::getWidget(unsigned int n)
+ {
+ if (stack.size() <= n )
+ return 0;
+ return stack[n];
+ }
+
+//---------------------------------------------------------
+// visibleWidget
+//---------------------------------------------------------
+
+QWidget* WidgetStack::visibleWidget() const
+ {
+ if (top != -1)
+ return stack[top];
+ return 0;
+ }
+
+//---------------------------------------------------------
+// minimumSizeHint
+//---------------------------------------------------------
+
+QSize WidgetStack::minimumSizeHint() const
+ {
+ if (top == -1)
+ return (QSize(0, 0));
+ QSize s(0,0);
+ for (unsigned int i = 0; i < stack.size(); ++i) {
+ if (stack[i]) {
+ QSize ss = stack[i]->minimumSizeHint();
+ if (!ss.isValid())
+ ss = stack[i]->minimumSize();
+ s = s.expandedTo(ss);
+ }
+ }
+ return s;
+ }
+
+//---------------------------------------------------------
+// clear
+//---------------------------------------------------------
+
+void Arranger::clear()
+ {
+ AudioStrip* w = (AudioStrip*)(trackInfo->getWidget(2));
+ if (w)
+ delete w;
+ trackInfo->addWidget(0, 2);
+ selected = 0;
+ }
+
+void Arranger::wheelEvent(QWheelEvent* ev)
+ {
+ emit redirectWheelEvent(ev);
+ }
+
+void Arranger::controllerChanged(Track *t)
+{
+ canvas->controllerChanged(t);
+}
diff --git a/muse2/muse/arranger/arranger.h b/muse2/muse/arranger/arranger.h
new file mode 100644
index 00000000..b96a5602
--- /dev/null
+++ b/muse2/muse/arranger/arranger.h
@@ -0,0 +1,227 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: arranger.h,v 1.17.2.15 2009/11/14 03:37:48 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __ARRANGER_H__
+#define __ARRANGER_H__
+
+#include <vector>
+
+#include <qwidget.h>
+#include <q3header.h>
+#include <q3whatsthis.h>
+//Added by qt3to4:
+#include <QWheelEvent>
+#include <Q3PopupMenu>
+
+#include "midieditor.h"
+#include "pcanvas.h"
+#include "mtrackinfobase.h"
+#include "trackautomationview.h"
+
+class Q3MainWindow;
+class QToolButton;
+class Header;
+class TList;
+class ScrollScale;
+class QScrollBar;
+class MTScale;
+class Track;
+class Xml;
+class Splitter;
+class LabelCombo;
+class PosLabel;
+class QCheckBox;
+class MidiTrackInfoBase;
+class WaveTrackInfoBase;
+class TLLayout;
+class WidgetStack;
+class AudioStrip;
+class SpinBox;
+//---------------------------------------------------------
+// TWhatsThis
+//---------------------------------------------------------
+
+class TWhatsThis : public Q3WhatsThis {
+ Header* header;
+ protected:
+ QString text(const QPoint&);
+ public:
+ TWhatsThis(QWidget* parent, Header* h) : Q3WhatsThis(parent) {
+ header = h;
+ }
+ };
+
+//---------------------------------------------------------
+// WidgetStack
+//---------------------------------------------------------
+
+class WidgetStack : public QWidget {
+ Q_OBJECT
+ std::vector<QWidget*> stack;
+ int top;
+
+ public:
+ WidgetStack(QWidget* parent, const char* name = 0);
+ void raiseWidget(int idx);
+ void addWidget(QWidget* w, unsigned int idx);
+ QWidget* getWidget(unsigned int idx);
+ QWidget* visibleWidget() const;
+ int curIdx() const { return top; }
+ QSize minimumSizeHint() const;
+ };
+
+//---------------------------------------------------------
+// MidiTrackInfo
+//---------------------------------------------------------
+
+class MidiTrackInfo : public MidiTrackInfoBase {
+ public:
+ bool _midiDetect;
+ MidiTrackInfo(QWidget* parent) : MidiTrackInfoBase(parent) { _midiDetect = false; }
+ };
+
+//---------------------------------------------------------
+// Arranger
+//---------------------------------------------------------
+
+class Arranger : public QWidget {
+ Q_OBJECT
+
+ int _quant, _raster;
+ PartCanvas* canvas;
+ ScrollScale* hscroll;
+ QScrollBar* vscroll;
+ TList* list;
+ Header* header;
+ MTScale* time;
+ SpinBox* lenEntry;
+ bool showTrackinfoFlag;
+ WidgetStack* trackInfo;
+ QScrollBar* infoScroll;
+ //MidiTrackInfoBase* midiTrackInfo;
+ MidiTrackInfo* midiTrackInfo;
+ AudioStrip* waveTrackInfo;
+ QWidget* noTrackInfo;
+ TLLayout* tgrid;
+
+ Track* selected;
+
+ LabelCombo* typeBox;
+ QToolButton* ib;
+ int trackInfoType;
+ Splitter* split;
+ Q3PopupMenu* pop;
+ int songType;
+ PosLabel* cursorPos;
+ SpinBox* globalTempoSpinBox;
+ SpinBox* globalPitchSpinBox;
+ int program, pan, volume;
+
+ unsigned cursVal;
+ void genTrackInfo(QWidget* parent);
+ void genMidiTrackInfo();
+ void genWaveTrackInfo();
+ void updateMidiTrackInfo(int flags);
+ void switchInfo(int);
+
+ private slots:
+ void _setRaster(int);
+ void songlenChanged(int);
+ void showTrackInfo(bool);
+ void trackSelectionChanged();
+ void trackInfoScroll(int);
+
+ //void iNameChanged();
+ ///void iInputChannelChanged(const QString&);
+ void iOutputChannelChanged(int);
+ ///void iInputPortChanged(const QString&);
+ void iOutputPortChanged(int);
+ void iProgHBankChanged();
+ void iProgLBankChanged();
+ void iProgramChanged();
+ void iProgramDoubleClicked();
+ void iLautstChanged(int);
+ void iLautstDoubleClicked();
+ void iTranspChanged(int);
+ void iAnschlChanged(int);
+ void iVerzChanged(int);
+ void iLenChanged(int);
+ void iKomprChanged(int);
+ void iPanChanged(int);
+ void iPanDoubleClicked();
+ void songChanged(int);
+ void modeChange(int);
+ void instrPopup();
+ void setTime(unsigned);
+ void headerMoved();
+ void globalPitchChanged(int);
+ void globalTempoChanged(int);
+ void setTempo50();
+ void setTempo100();
+ void setTempo200();
+ //void seek();
+ void recordClicked();
+ void progRecClicked();
+ void volRecClicked();
+ void panRecClicked();
+ void recEchoToggled(bool);
+ void verticalScrollSetYpos(unsigned);
+ void inRoutesPressed();
+ void outRoutesPressed();
+ void routingPopupMenuActivated(int /*id*/);
+
+ signals:
+ void redirectWheelEvent(QWheelEvent*);
+ void editPart(Track*);
+ void selectionChanged();
+ void dropSongFile(const QString&);
+ void dropMidiFile(const QString&);
+ void startEditor(PartList*, int);
+ void toolChanged(int);
+ //void addMarker(int);
+ void setUsedTool(int);
+
+
+ protected:
+
+ virtual void wheelEvent(QWheelEvent* e);
+
+ protected slots:
+ virtual void midiTrackInfoHeartBeat();
+
+ public slots:
+ void dclickPart(Track*);
+ void setTool(int);
+ void updateTrackInfo(int flags);
+ void configChanged();
+ void controllerChanged(Track *t);
+
+ public:
+ enum { CMD_CUT_PART, CMD_COPY_PART, CMD_PASTE_PART, CMD_PASTE_CLONE_PART, CMD_PASTE_PART_TO_TRACK, CMD_PASTE_CLONE_PART_TO_TRACK,
+ CMD_INSERT_PART, CMD_INSERT_EMPTYMEAS };
+
+ Arranger(Q3MainWindow* parent, const char* name = 0);
+ void setMode(int);
+ void reset();
+
+ void setTrackInfoLabelText();
+ void setTrackInfoLabelFont();
+
+ void writeStatus(int level, Xml&);
+ void readStatus(Xml&);
+
+ Track* curTrack() const { return selected; }
+ void cmd(int);
+ bool isSingleSelection() { return canvas->isSingleSelection(); }
+ void setGlobalTempo(int);
+ void clear();
+
+ unsigned cursorValue() { return cursVal; }
+ };
+
+#endif
+
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp
new file mode 100644
index 00000000..0569f03d
--- /dev/null
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -0,0 +1,2825 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: pcanvas.cpp,v 1.48.2.26 2009/11/22 11:08:33 spamatica Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <errno.h>
+#include <values.h>
+#include <uuid/uuid.h>
+#include <math.h>
+
+#include <qapplication.h>
+#include <qclipboard.h>
+#include <qpainter.h>
+#include <qpoint.h>
+#include <qlineedit.h>
+#include <qmessagebox.h>
+#include <q3dragobject.h>
+#include <q3popupmenu.h>
+#include <q3url.h>
+#include <qmenudata.h>
+//Added by qt3to4:
+#include <QDragLeaveEvent>
+#include <QMouseEvent>
+#include <QDragEnterEvent>
+#include <QKeyEvent>
+#include <QEvent>
+#include <QDropEvent>
+#include <QDragMoveEvent>
+#include <Q3CString>
+
+#include "widgets/tools.h"
+#include "pcanvas.h"
+#include "midieditor.h"
+#include "globals.h"
+#include "icons.h"
+#include "event.h"
+#include "xml.h"
+#include "wave.h"
+#include "audio.h"
+#include "shortcuts.h"
+#include "gconfig.h"
+#include "app.h"
+#include "filedialog.h"
+#include "marker/marker.h"
+
+const char* partColorNames[] = {
+ "Default",
+ "Refrain",
+ "Bridge",
+ "Intro",
+ "Coda",
+ "Chorus",
+ "Solo",
+ "Brass",
+ "Percussion",
+ "Drums",
+ "Guitar",
+ "Bass",
+ "Flute",
+ "Strings",
+ "Keyboard",
+ "Piano",
+ "Saxophon",
+ };
+
+//---------------------------------------------------------
+// ColorListItem
+//---------------------------------------------------------
+
+class ColorListItem { //: public QCustomMenuItem { ddskrjo
+ QColor color;
+ int h;
+ int fontheight;
+ QString label;
+ virtual QSize sizeHint() { return QSize(80, h); }
+ virtual void paint(QPainter* p, const QColorGroup&, bool /*act*/, bool /*enabled*/, int x, int y, int /*w*/, int h)
+ {
+ p->fillRect(x+5, y+2, h-4, h-4, QBrush(color));
+ p->drawText(x+5 + h - 4 + 3, y+(fontheight * 3) / 4, label);
+ }
+
+ public:
+ ColorListItem(const QColor& c, int _h, int _fh, const char* txt)
+ : color(c), h(_h), fontheight(_fh), label(txt) {
+ }
+ QString text() const { return QString("PartColor"); }
+ };
+
+//---------------------------------------------------------
+// NPart
+//---------------------------------------------------------
+
+NPart::NPart(Part* e) : CItem(Event(), e)
+ {
+ int th = track()->height();
+ int y = track()->y();
+ setPos(QPoint(e->tick(), y + 1));
+ setBBox(QRect(e->tick(), y + 1, e->lenTick(), th));
+ }
+
+//---------------------------------------------------------
+// PartCanvas
+//---------------------------------------------------------
+
+PartCanvas::PartCanvas(int* r, QWidget* parent, int sx, int sy)
+ : Canvas(parent, sx, sy)
+ {
+ setAcceptDrops(true);
+ _raster = r;
+
+ setFocusPolicy(Qt::StrongFocus);
+ // Defaults:
+ lineEditor = 0;
+ editMode = false;
+
+ tracks = song->tracks();
+ setMouseTracking(true);
+ drag = DRAG_OFF;
+ curColorIndex = 0;
+ partsChanged();
+ }
+
+//---------------------------------------------------------
+// y2pitch
+//---------------------------------------------------------
+
+int PartCanvas::y2pitch(int y) const
+ {
+ TrackList* tl = song->tracks();
+ int yy = 0;
+ int idx = 0;
+ for (iTrack it = tl->begin(); it != tl->end(); ++it, ++idx) {
+ int h = (*it)->height();
+ // if ((y >= yy) && (y < yy+h))
+ if (y < yy+h)
+ break;
+ yy += h;
+ }
+ return idx;
+ }
+
+//---------------------------------------------------------
+// pitch2y
+//---------------------------------------------------------
+
+int PartCanvas::pitch2y(int p) const
+ {
+ TrackList* tl = song->tracks();
+ int yy = 0;
+ int idx = 0;
+ for (iTrack it = tl->begin(); it != tl->end(); ++it, ++idx) {
+ if (idx == p)
+ break;
+ yy += (*it)->height();
+ }
+ return yy;
+ }
+
+//---------------------------------------------------------
+// leaveEvent
+//---------------------------------------------------------
+
+void PartCanvas::leaveEvent(QEvent*)
+ {
+ emit timeChanged(MAXINT);
+ }
+
+//---------------------------------------------------------
+// returnPressed
+//---------------------------------------------------------
+
+void PartCanvas::returnPressed()
+ {
+ lineEditor->hide();
+ Part* oldPart = editPart->part();
+ Part* newPart = oldPart->clone();
+ // Added by Tim. p3.3.6
+ //printf("PartCanvas::returnPressed before msgChangePart oldPart refs:%d Arefs:%d newPart refs:%d Arefs:%d\n", oldPart->events()->refCount(), oldPart->events()->arefCount(), newPart->events()->refCount(), newPart->events()->arefCount());
+
+ newPart->setName(lineEditor->text());
+ // Indicate do undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(oldPart, newPart);
+ audio->msgChangePart(oldPart, newPart, true, true, false);
+ // Added by Tim. p3.3.6
+ //printf("PartCanvas::returnPressed after msgChangePart oldPart refs:%d Arefs:%d newPart refs:%d Arefs:%d\n", oldPart->events()->refCount(), oldPart->events()->arefCount(), newPart->events()->refCount(), newPart->events()->arefCount());
+
+ editMode = false;
+ }
+
+//---------------------------------------------------------
+// viewMouseDoubleClick
+//---------------------------------------------------------
+
+void PartCanvas::viewMouseDoubleClickEvent(QMouseEvent* event)
+ {
+ if (_tool != PointerTool) {
+ viewMousePressEvent(event);
+ return;
+ }
+ QPoint cpos = event->pos();
+ curItem = items.find(cpos);
+ bool shift = event->state() & Qt::ShiftButton;
+ if (curItem) {
+ if (event->button() == Qt::LeftButton && shift) {
+ editPart = (NPart*)curItem;
+ QRect r = map(curItem->bbox());
+ if (lineEditor == 0) {
+ lineEditor = new QLineEdit(this);
+ lineEditor->setFrame(true);
+ }
+ editMode = true;
+ lineEditor->setGeometry(r);
+ lineEditor->setText(editPart->name());
+ lineEditor->setFocus();
+ lineEditor->show();
+ }
+ else if (event->button() == Qt::LeftButton) {
+ deselectAll();
+ selectItem(curItem, true);
+ emit dclickPart(((NPart*)(curItem))->track());
+ }
+ }
+ //
+ // double click creates new part between left and
+ // right mark
+
+ else {
+ TrackList* tl = song->tracks();
+ iTrack it;
+ int yy = 0;
+ int y = event->y();
+ for (it = tl->begin(); it != tl->end(); ++it) {
+ int h = (*it)->height();
+ if (y >= yy && y < (yy + h))
+ break;
+ yy += h;
+ }
+ if (pos[2] - pos[1] > 0 && it != tl->end()) {
+ Track* track = *it;
+ switch(track->type()) {
+ case Track::MIDI:
+ case Track::DRUM:
+ {
+ MidiPart* part = new MidiPart((MidiTrack*)track);
+ part->setTick(pos[1]);
+ part->setLenTick(pos[2]-pos[1]);
+ part->setName(track->name());
+ NPart* np = new NPart(part);
+ items.add(np);
+ deselectAll();
+ part->setSelected(true);
+ audio->msgAddPart(part);
+ }
+ break;
+ case Track::WAVE:
+ case Track::AUDIO_OUTPUT:
+ case Track::AUDIO_INPUT:
+ case Track::AUDIO_GROUP:
+ case Track::AUDIO_AUX:
+ case Track::AUDIO_SOFTSYNTH:
+ break;
+ }
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// startUndo
+//---------------------------------------------------------
+
+void PartCanvas::startUndo(DragType)
+ {
+ song->startUndo();
+ }
+
+//---------------------------------------------------------
+// endUndo
+//---------------------------------------------------------
+
+void PartCanvas::endUndo(DragType t, int flags)
+ {
+ song->endUndo(flags | ((t == MOVE_COPY || t == MOVE_CLONE)
+ ? SC_PART_INSERTED : SC_PART_MODIFIED));
+ }
+
+//---------------------------------------------------------
+// moveCanvasItems
+//---------------------------------------------------------
+
+void PartCanvas::moveCanvasItems(CItemList& items, int dp, int dx, DragType dtype, int*)
+{
+ /*
+ if(editor->parts()->empty())
+ return;
+
+ //struct p2c
+ //{
+ // Part* newp;
+ // int xdiff;
+ //}
+
+ //std::set<Part*> parts2change;
+ //typedef std::set<Part*>::iterator iptc;
+ std::map<Part*, Part*> parts2change;
+ typedef std::map<Part*, Part*>::iterator iP2C;
+
+ int modified = 0;
+ for(iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip)
+ {
+ Part* part = ip->second;
+ if(!part)
+ continue;
+
+ int npartoffset = 0;
+ for(iCItem ici = items.begin(); ici != items.end(); ++ici)
+ {
+ CItem* ci = ici->second;
+ //Part* pt = ci->part();
+ //if(!pt)
+ if(ci->part() != part)
+ continue;
+
+ int x = ci->pos().x() + dx;
+ int y = pitch2y(y2pitch(ci->pos().y()) + dp);
+ QPoint newpos = raster(QPoint(x, y));
+
+ // Test moving the item...
+
+ //int offset = testMoveItem(ci, newpos, dragtype);
+ NEvent* nevent = (NEvent*) ci;
+ Event event = nevent->event();
+ //int npitch = y2pitch(newpos.y());
+ x = newpos.x();
+ if (x < 0)
+ x = 0;
+
+ int ntick = editor->rasterVal(x) - part->tick();
+ if (ntick < 0)
+ ntick = 0;
+ int diff = ntick + event.lenTick() - part->lenTick();
+
+ // If moving the item would require a new part size...
+ if(diff > npartoffset)
+ npartoffset = diff;
+ }
+
+ if(npartoffset > 0)
+ {
+ // Create new part...
+ // if there are several events that are moved outside the part, it will be recreated for each
+ // so the part _in_ the event will not be valid, ask the authority.
+ Part* newPart = part->clone();
+ //Part* newPart = Canvas::part()->clone();
+
+ newPart->setLenTick(newPart->lenTick() + npartoffset);
+ audio->msgChangePart(part, newPart,false);
+
+ modified = SC_PART_MODIFIED;
+
+ // BUG FIX: #1650953
+ // Added by T356.
+ // Fixes posted "select and drag past end of part - crashing" bug
+ for(iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip)
+ {
+ if(ip->second == part)
+ {
+ editor->parts()->erase(ip);
+ break;
+ }
+ }
+
+ editor->parts()->add(newPart);
+ if(parts2change.find(part) == parts2change.end())
+ parts2change.insert(std::pair<Part*, Part*> (part, newPart));
+
+// part = newPart; // reassign
+// item->setPart(part);
+// item->setEvent(newEvent);
+// curPart = part;
+// curPartId = curPart->sn();
+
+ }
+ }
+*/
+
+// int modified = 0;
+ for(iCItem ici = items.begin(); ici != items.end(); ++ici)
+ {
+ CItem* ci = ici->second;
+
+ // If this item's part is in the parts2change list, change the item's part to the new part.
+ //Part* pt = ci->part();
+ //iP2C ip2c = parts2change.find(pt);
+ //if(ip2c != parts2change.end())
+ // ci->setPart(ip2c->second);
+
+ int x = ci->pos().x();
+ int y = ci->pos().y();
+ int nx = x + dx;
+ int ny = pitch2y(y2pitch(y) + dp);
+ QPoint newpos = raster(QPoint(nx, ny));
+ selectItem(ci, true);
+
+ if(moveItem(ci, newpos, dtype))
+ ci->move(newpos);
+ if(moving.size() == 1) {
+ itemReleased(curItem, newpos);
+ }
+ if(dtype == MOVE_COPY || dtype == MOVE_CLONE)
+ selectItem(ci, false);
+ }
+
+
+ //if(pflags)
+ // *pflags = modified;
+}
+
+//---------------------------------------------------------
+// moveItem
+// return false, if copy/move not allowed
+//---------------------------------------------------------
+
+// Changed by T356.
+//bool PartCanvas::moveItem(CItem* item, const QPoint& newpos, DragType t, int*)
+bool PartCanvas::moveItem(CItem* item, const QPoint& newpos, DragType t)
+ {
+ NPart* npart = (NPart*) item;
+ Part* spart = npart->part();
+ Track* track = npart->track();
+ unsigned dtick = newpos.x();
+ unsigned ntrack = y2pitch(item->mp().y());
+ Track::TrackType type = track->type();
+ if (tracks->index(track) == ntrack && (dtick == spart->tick())) {
+ return false;
+ }
+ if (ntrack >= tracks->size()) {
+ ntrack = tracks->size();
+ Track* newTrack = song->addTrack(int(type));
+ if (type == Track::WAVE) {
+ WaveTrack* st = (WaveTrack*) track;
+ WaveTrack* dt = (WaveTrack*) newTrack;
+ dt->setChannels(st->channels());
+ }
+ emit tracklistChanged();
+ }
+ Track* dtrack = tracks->index(ntrack);
+
+ if (dtrack->type() != type) {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("Cannot copy/move/clone to different Track-Type"));
+ return false;
+ }
+
+ Part* dpart;
+ //bool clone = (t == MOVE_CLONE) || (spart->events()->arefCount() > 1);
+ //bool clone = (t == MOVE_CLONE);
+ bool clone = (t == MOVE_CLONE || (t == MOVE_COPY && spart->events()->arefCount() > 1));
+
+ if(t == MOVE_MOVE)
+ {
+ // This doesn't increment aref count, and doesn't chain clones.
+ // It also gives the new part a new serial number, but it is
+ // overwritten with the old one by Song::changePart(), from Audio::msgChangePart() below.
+ dpart = spart->clone();
+ dpart->setTrack(dtrack);
+ }
+ else
+ // This increments aref count if cloned, and chains clones.
+ // It also gives the new part a new serial number.
+ dpart = dtrack->newPart(spart, clone);
+
+ dpart->setTick(dtick);
+
+ // Added by Tim. p3.3.6
+ //printf("PartCanvas::moveItem before add/changePart clone:%d spart:%p events:%p refs:%d Arefs:%d sn:%d dpart:%p events:%p refs:%d Arefs:%d sn:%d\n", clone, spart, spart->events(), spart->events()->refCount(), spart->events()->arefCount(), spart->sn(), dpart, dpart->events(), dpart->events()->refCount(), dpart->events()->arefCount(), dpart->sn());
+
+ if(t == MOVE_MOVE)
+ item->setPart(dpart);
+ //if (!clone) {
+ if (t == MOVE_COPY && !clone) {
+ //
+ // Copy Events
+ //
+ EventList* se = spart->events();
+ EventList* de = dpart->events();
+ for (iEvent i = se->begin(); i != se->end(); ++i) {
+ Event oldEvent = i->second;
+ Event ev = oldEvent.clone();
+ de->add(ev);
+ }
+ }
+ if (t == MOVE_COPY || t == MOVE_CLONE) {
+ // These will not increment ref count, and will not chain clones...
+ if (dtrack->type() == Track::WAVE)
+ audio->msgAddPart((WavePart*)dpart,false);
+ else
+ audio->msgAddPart(dpart,false);
+ }
+ else if (t == MOVE_MOVE) {
+ dpart->setSelected(spart->selected());
+ // These will increment ref count if not a clone, and will chain clones...
+ if (dtrack->type() == Track::WAVE)
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangePart((WavePart*)spart, (WavePart*)dpart,false);
+ audio->msgChangePart((WavePart*)spart, (WavePart*)dpart, false, false, false);
+ else
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(spart, dpart, false);
+ audio->msgChangePart(spart, dpart, false, true, false);
+
+ spart->setSelected(false);
+ }
+ // Added by Tim. p3.3.6
+ //printf("PartCanvas::moveItem after add/changePart spart:%p events:%p refs:%d Arefs:%d dpart:%p events:%p refs:%d Arefs:%d\n", spart, spart->events(), spart->events()->refCount(), spart->events()->arefCount(), dpart, dpart->events(), dpart->events()->refCount(), dpart->events()->arefCount());
+
+ if (song->len() < (dpart->lenTick() + dpart->tick()))
+ song->setLen(dpart->lenTick() + dpart->tick());
+ //endUndo(t);
+ return true;
+ }
+
+//---------------------------------------------------------
+// raster
+//---------------------------------------------------------
+
+QPoint PartCanvas::raster(const QPoint& p) const
+ {
+ int y = pitch2y(y2pitch(p.y()));
+ int x = p.x();
+ if (x < 0)
+ x = 0;
+ x = sigmap.raster(x, *_raster);
+ if (x < 0)
+ x = 0;
+ return QPoint(x, y);
+ }
+
+//---------------------------------------------------------
+// partsChanged
+//---------------------------------------------------------
+
+void PartCanvas::partsChanged()
+ {
+ items.clear();
+ int idx = 0;
+ for (iTrack t = tracks->begin(); t != tracks->end(); ++t) {
+ PartList* pl = (*t)->parts();
+ for (iPart i = pl->begin(); i != pl->end(); ++i) {
+ NPart* np = new NPart(i->second);
+ items.add(np);
+ if (i->second->selected()) {
+ selectItem(np, true);
+ }
+ }
+ ++idx;
+ }
+ redraw();
+ }
+
+//---------------------------------------------------------
+// updateSelection
+//---------------------------------------------------------
+
+void PartCanvas::updateSelection()
+ {
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ NPart* part = (NPart*)(i->second);
+ part->part()->setSelected(i->second->isSelected());
+ }
+ emit selectionChanged();
+ redraw();
+ }
+
+//---------------------------------------------------------
+// resizeItem
+//---------------------------------------------------------
+
+void PartCanvas::resizeItem(CItem* i, bool noSnap)
+ {
+ Track* t = ((NPart*)(i))->track();
+ Part* p = ((NPart*)(i))->part();
+
+ int pos = p->tick() + i->width();
+ int snappedpos = p->tick();
+ if (!noSnap) {
+ snappedpos = sigmap.raster(pos, *_raster);
+ }
+ unsigned int newwidth = snappedpos - p->tick();
+ if (newwidth == 0)
+ newwidth = sigmap.rasterStep(p->tick(), *_raster);
+
+ song->cmdResizePart(t, p, newwidth);
+ }
+
+//---------------------------------------------------------
+// newItem
+// first create local Item
+//---------------------------------------------------------
+
+CItem* PartCanvas::newItem(const QPoint& pos, int)
+ {
+ int x = pos.x();
+ if (x < 0)
+ x = 0;
+ x = sigmap.raster(x, *_raster);
+ unsigned trackIndex = y2pitch(pos.y());
+ if (trackIndex >= tracks->size())
+ return 0;
+ Track* track = tracks->index(trackIndex);
+ if(!track)
+ return 0;
+
+ Part* pa = 0;
+ NPart* np = 0;
+ switch(track->type()) {
+ case Track::MIDI:
+ case Track::DRUM:
+ pa = new MidiPart((MidiTrack*)track);
+ pa->setTick(x);
+ pa->setLenTick(0);
+ break;
+ case Track::WAVE:
+ pa = new WavePart((WaveTrack*)track);
+ pa->setTick(x);
+ pa->setLenTick(0);
+ break;
+ case Track::AUDIO_OUTPUT:
+ case Track::AUDIO_INPUT:
+ case Track::AUDIO_GROUP:
+ case Track::AUDIO_AUX:
+ case Track::AUDIO_SOFTSYNTH:
+ return 0;
+ }
+ pa->setName(track->name());
+ pa->setColorIndex(curColorIndex);
+ np = new NPart(pa);
+ return np;
+ }
+
+//---------------------------------------------------------
+// newItem
+//---------------------------------------------------------
+
+void PartCanvas::newItem(CItem* i, bool noSnap)
+ {
+ Part* p = ((NPart*)(i))->part();
+
+ int len = i->width();
+ if (!noSnap)
+ len = sigmap.raster(len, *_raster);
+ if (len == 0)
+ len = sigmap.rasterStep(p->tick(), *_raster);
+ p->setLenTick(len);
+ p->setSelected(true);
+ audio->msgAddPart(p);
+ }
+
+//---------------------------------------------------------
+// deleteItem
+//---------------------------------------------------------
+
+bool PartCanvas::deleteItem(CItem* i)
+ {
+ Part* p = ((NPart*)(i))->part();
+ audio->msgRemovePart(p); //Invokes songChanged which calls partsChanged which makes it difficult to delete them there
+ return true;
+ }
+
+//---------------------------------------------------------
+// splitItem
+//---------------------------------------------------------
+
+void PartCanvas::splitItem(CItem* item, const QPoint& pt)
+ {
+ NPart* np = (NPart*) item;
+ Track* t = np->track();
+ Part* p = np->part();
+ int x = pt.x();
+ if (x < 0)
+ x = 0;
+ song->cmdSplitPart(t, p, sigmap.raster(x, *_raster));
+ }
+
+//---------------------------------------------------------
+// glueItem
+//---------------------------------------------------------
+
+void PartCanvas::glueItem(CItem* item)
+ {
+ NPart* np = (NPart*) item;
+ Track* t = np->track();
+ Part* p = np->part();
+ song->cmdGluePart(t, p);
+ }
+
+//---------------------------------------------------------
+// genItemPopup
+//---------------------------------------------------------
+
+Q3PopupMenu* PartCanvas::genItemPopup(CItem* item)
+ {
+ NPart* npart = (NPart*) item;
+ Track::TrackType trackType = npart->track()->type();
+
+ Q3PopupMenu* partPopup = new Q3PopupMenu(this);
+
+ partPopup->insertItem(*editcutIconSet, tr("C&ut"), 4);
+ partPopup->setAccel(Qt::CTRL+Qt::Key_X, 4);
+
+ partPopup->insertItem(*editcopyIconSet, tr("&Copy"), 5);
+ partPopup->setAccel(Qt::CTRL+Qt::Key_C, 5);
+
+ partPopup->insertSeparator();
+ int rc = npart->part()->events()->arefCount();
+ QString st = QString(tr("s&elect "));
+ if(rc > 1)
+ st += (QString().setNum(rc) + QString(" "));
+ st += QString(tr("clones"));
+ partPopup->insertItem(st, 18);
+
+ partPopup->insertSeparator();
+ partPopup->insertItem(tr("rename"), 0);
+ Q3PopupMenu* colorPopup = new Q3PopupMenu(this);
+ partPopup->insertItem(tr("color"), colorPopup);
+
+ // part color selection
+ const QFontMetrics& fm = colorPopup->fontMetrics();
+ int h = fm.lineSpacing();
+
+ for (int i = 0; i < NUM_PARTCOLORS; ++i) {
+ ColorListItem* item = new ColorListItem(config.partColors[i], h, fontMetrics().height(), partColorNames[i]);
+ //colorPopup->insertItem(item, 20+i); ddskrjo
+ }
+
+ partPopup->insertItem(QIcon(*deleteIcon), tr("delete"), 1); // ddskrjo added QIcon to all
+ partPopup->insertItem(QIcon(*cutIcon), tr("split"), 2);
+ partPopup->insertItem(QIcon(*glueIcon), tr("glue"), 3);
+ partPopup->insertItem(tr("de-clone"), 15);
+
+ partPopup->insertSeparator();
+ switch(trackType) {
+ case Track::MIDI:
+ partPopup->insertItem(QIcon(*pianoIconSet), tr("pianoroll"), 10);
+ partPopup->insertItem(QIcon(*edit_listIcon), tr("list"), 12);
+ partPopup->insertItem(tr("export"), 16);
+ break;
+ case Track::DRUM:
+ partPopup->insertItem(QIcon(*edit_listIcon), tr("list"), 12);
+ partPopup->insertItem(QIcon(*edit_drummsIcon), tr("drums"), 13);
+ partPopup->insertItem(tr("export"), 16);
+ break;
+ case Track::WAVE:
+ partPopup->insertItem(QIcon(*edit_waveIcon), tr("wave edit"), 14);
+ partPopup->insertItem(tr("export"), 16);
+ partPopup->insertItem(tr("file info"), 17);
+ break;
+ case Track::AUDIO_OUTPUT:
+ case Track::AUDIO_INPUT:
+ case Track::AUDIO_GROUP:
+ case Track::AUDIO_AUX:
+ case Track::AUDIO_SOFTSYNTH:
+ break;
+ }
+
+ partPopup->setItemEnabled(18, rc > 1);
+ partPopup->setItemEnabled(1, true);
+ partPopup->setItemEnabled(4, true);
+ partPopup->setItemEnabled(15, rc > 1);
+
+ return partPopup;
+ }
+
+//---------------------------------------------------------
+// itemPopup
+//---------------------------------------------------------
+
+void PartCanvas::itemPopup(CItem* item, int n, const QPoint& pt)
+ {
+ PartList* pl = new PartList;
+ NPart* npart = (NPart*)(item);
+ pl->add(npart->part());
+ switch(n) {
+ case 0: // rename
+ {
+ editPart = npart;
+ QRect r = map(curItem->bbox());
+ if (lineEditor == 0) {
+ lineEditor = new QLineEdit(this);
+ lineEditor->setFrame(true);
+ }
+ lineEditor->setText(editPart->name());
+ lineEditor->setFocus();
+ lineEditor->show();
+ lineEditor->setGeometry(r);
+ editMode = true;
+ }
+ break;
+ case 1: // delete
+ deleteItem(item);
+ break;
+ case 2: // split
+ splitItem(item, pt);
+ break;
+ case 3: // glue
+ glueItem(item);
+ break;
+ case 4:
+ copy(pl);
+ audio->msgRemovePart(npart->part());
+ break;
+ case 5:
+ copy(pl);
+ break;
+ case 10: // pianoroll edit
+ emit startEditor(pl, 0);
+ return;
+ case 12: // list edit
+ emit startEditor(pl, 1);
+ return;
+ case 13: // drum edit
+ emit startEditor(pl, 3);
+ return;
+ case 14: // wave edit
+ {
+ // Changed to allow multiple selected parts to be shown. By T356
+ // Slightly inefficient to add (above), then clear here.
+ // Should really only add npart->part() to pl only if NOT here.
+ // Removed. Added wave editor menu item instead.
+ //pl->clear();
+ //PartList* ptl = npart->track()->parts();
+ //for(ciPart pi = ptl->begin(); pi != ptl->end(); pi++)
+ //{
+ // if(pi->second->selected())
+ // pl->add(pi->second);
+ //}
+ emit startEditor(pl, 4);
+ }
+ return;
+ case 15: // declone
+ {
+ Part* spart = npart->part();
+ Track* track = npart->track();
+ Part* dpart = track->newPart(spart, false);
+ // Added by Tim. p3.3.6
+ //printf("PartCanvas::itemPopup: #1 spart %s %p next:%s %p prev:%s %p\n", spart->name().latin1(), spart, spart->nextClone()->name().latin1(), spart->nextClone(), spart->prevClone()->name().latin1(), spart->prevClone());
+ //printf("PartCanvas::itemPopup: #1 dpart %s %p next:%s %p prev:%s %p\n", dpart->name().latin1(), dpart, dpart->nextClone()->name().latin1(), dpart->nextClone(), dpart->prevClone()->name().latin1(), dpart->prevClone());
+
+ EventList* se = spart->events();
+ EventList* de = dpart->events();
+ for (iEvent i = se->begin(); i != se->end(); ++i) {
+ Event oldEvent = i->second;
+ Event ev = oldEvent.clone();
+ de->add(ev);
+ }
+ song->startUndo();
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(spart, dpart, false);
+ audio->msgChangePart(spart, dpart, false, true, false);
+ // Added by Tim. p3.3.6
+ //printf("PartCanvas::itemPopup: #2 spart %s %p next:%s %p prev:%s %p\n", spart->name().latin1(), spart, spart->nextClone()->name().latin1(), spart->nextClone(), spart->prevClone()->name().latin1(), spart->prevClone());
+ //printf("PartCanvas::itemPopup: #2 dpart %s %p next:%s %p prev:%s %p\n", dpart->name().latin1(), dpart, dpart->nextClone()->name().latin1(), dpart->nextClone(), dpart->prevClone()->name().latin1(), dpart->prevClone());
+
+ song->endUndo(SC_PART_MODIFIED);
+ break; // Has to be break here, right?
+ }
+ case 16: // Export to file
+ {
+ const Part* part = item->part();
+ bool popenFlag = false;
+ //QString fn = getSaveFileName(QString(""), part_file_pattern, this, tr("MusE: save part"));
+ QString fn = getSaveFileName(QString(""), part_file_save_pattern, this, tr("MusE: save part"));
+ if (!fn.isEmpty()) {
+ FILE* fp = fileOpen(this, fn, ".mpt", "w", popenFlag, false, false);
+ if (fp) {
+ Xml tmpXml = Xml(fp);
+ //part->write(0, tmpXml);
+ // Write the part. Indicate that it's a copy operation - to add special markers,
+ // and force full wave paths.
+ part->write(0, tmpXml, true, true);
+ fclose(fp);
+ }
+ }
+ break;
+ }
+
+ case 17: // File info
+ {
+ Part* p = item->part();
+ EventList* el = p->events();
+ QString str = tr("Part name") + ": " + p->name() + "\n" + tr("Files") + ":";
+ for (iEvent e = el->begin(); e != el->end(); ++e)
+ {
+ Event event = e->second;
+ SndFileR f = event.sndFile();
+ if (f.isNull())
+ continue;
+ //str.append("\n" + f.path());
+ str.append(QString("\n@") + QString().setNum(event.tick()) + QString(" len:") +
+ QString().setNum(event.lenTick()) + QString(" ") + f.path());
+ }
+ QMessageBox::information(this, "File info", str, "Ok", 0);
+ break;
+ }
+ case 18: // Select clones
+ {
+ Part* part = item->part();
+
+ // Traverse and process the clone chain ring until we arrive at the same part again.
+ // The loop is a safety net.
+ Part* p = part;
+ int j = part->cevents()->arefCount();
+ if(j > 0)
+ {
+ for(int i = 0; i < j; ++i)
+ {
+ // Added by Tim. p3.3.6
+ //printf("PartCanvas::itemPopup i:%d %s %p events %p refs:%d arefs:%d\n", i, p->name().latin1(), p, part->cevents(), part->cevents()->refCount(), j);
+
+ p->setSelected(true);
+ p = p->nextClone();
+ if(p == part)
+ break;
+ }
+ //song->update();
+ song->update(SC_SELECTION);
+ }
+
+ break;
+ }
+ case 20 ... NUM_PARTCOLORS+20:
+ {
+ curColorIndex = n - 20;
+ bool selfound = false;
+ //Loop through all parts and set color on selected:
+ for (iCItem i = items.begin(); i != items.end(); i++) {
+ if (i->second->isSelected()) {
+ selfound = true;
+ i->second->part()->setColorIndex(curColorIndex);
+ }
+ }
+
+ // If no items selected, use the one clicked on.
+ if(!selfound)
+ item->part()->setColorIndex(curColorIndex);
+
+ redraw();
+ break;
+ }
+ default:
+ printf("unknown action %d\n", n);
+ break;
+ }
+ delete pl;
+ }
+
+//---------------------------------------------------------
+// viewMousePressEvent
+//---------------------------------------------------------
+
+void PartCanvas::mousePress(QMouseEvent* event)
+ {
+ if (event->state() & Qt::ShiftButton) {
+ return;
+ }
+ QPoint pt = event->pos();
+ CItem* item = items.find(pt);
+ if (item == 0)
+ return;
+ switch (_tool) {
+ default:
+ emit trackChanged(item->part()->track());
+ break;
+ case CutTool:
+ splitItem(item, pt);
+ break;
+ case GlueTool:
+ glueItem(item);
+ break;
+ case MuteTool:
+ {
+ NPart* np = (NPart*) item;
+ Part* p = np->part();
+ p->setMute(!p->mute());
+ redraw();
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// viewMouseReleaseEvent
+//---------------------------------------------------------
+
+void PartCanvas::mouseRelease(const QPoint&)
+ {
+ }
+
+//---------------------------------------------------------
+// viewMouseMoveEvent
+//---------------------------------------------------------
+
+void PartCanvas::mouseMove(const QPoint& pos)
+ {
+ int x = pos.x();
+ if (x < 0)
+ x = 0;
+ emit timeChanged(sigmap.raster(x, *_raster));
+ }
+
+//---------------------------------------------------------
+// y2Track
+//---------------------------------------------------------
+
+Track* PartCanvas::y2Track(int y) const
+ {
+ TrackList* l = song->tracks();
+ int ty = 0;
+ for (iTrack it = l->begin(); it != l->end(); ++it) {
+ int h = (*it)->height();
+ if (y >= ty && y < ty + h)
+ return *it;
+ ty += h;
+ }
+ return 0;
+ }
+
+//---------------------------------------------------------
+// keyPress
+//---------------------------------------------------------
+
+void PartCanvas::keyPress(QKeyEvent* event)
+ {
+ int key = event->key();
+ if (editMode) {
+ returnPressed();
+ return;
+ }
+
+ if (event->state() & Qt::ShiftButton)
+ key += Qt::SHIFT;
+ if (event->state() & Qt::AltButton)
+ key += Qt::ALT;
+ if (event->state() & Qt::ControlButton)
+ key += Qt::CTRL;
+
+ if (key == shortcuts[SHRT_DELETE].key) {
+ if (getCurrentDrag()) {
+ //printf("dragging!!\n");
+ return;
+ }
+
+ song->startUndo();
+ song->msgRemoveParts();
+ song->endUndo(SC_PART_REMOVED);
+ return;
+ }
+ else if (key == shortcuts[SHRT_POS_DEC].key) {
+ int frames = pos[0] - sigmap.rasterStep(pos[0], *_raster);
+ if (frames < 0)
+ frames = 0;
+ Pos p(frames,true);
+ song->setPos(0, p, true, true, true);
+ return;
+ }
+ else if (key == shortcuts[SHRT_POS_INC].key) {
+ Pos p(pos[0] + sigmap.rasterStep(pos[0], *_raster), true);
+ song->setPos(0, p, true, true, true); //CDW
+ return;
+ }
+ else if (key == shortcuts[SHRT_TOOL_POINTER].key) {
+ emit setUsedTool(PointerTool);
+ return;
+ }
+ else if (key == shortcuts[SHRT_TOOL_PENCIL].key) {
+ emit setUsedTool(PencilTool);
+ return;
+ }
+ else if (key == shortcuts[SHRT_TOOL_RUBBER].key) {
+ emit setUsedTool(RubberTool);
+ return;
+ }
+ else if (key == shortcuts[SHRT_TOOL_SCISSORS].key) {
+ emit setUsedTool(CutTool);
+ return;
+ }
+ else if (key == shortcuts[SHRT_TOOL_GLUE].key) {
+ emit setUsedTool(GlueTool);
+ return;
+ }
+ else if (key == shortcuts[SHRT_TOOL_MUTE].key) {
+ emit setUsedTool(MuteTool);
+ return;
+ }
+ else if (key == shortcuts[SHRT_SEL_TRACK_ABOVE].key) {
+ emit selectTrackAbove();
+ return;
+ }
+ else if (key == shortcuts[SHRT_SEL_TRACK_BELOW].key) {
+ emit selectTrackBelow();
+ return;
+ }
+
+ //
+ // Shortcuts that require selected parts from here
+ //
+ if (!curItem) {
+ if (items.size()==0) {
+ return;
+ }
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ NPart* part = (NPart*)(i->second);
+ if (part->isSelected()) {
+ curItem=part;
+ break;
+ }
+ }
+ if (!curItem)
+ curItem = (NPart*)items.begin()->second; // just grab the first part
+ }
+
+ CItem* newItem = 0;
+ bool singleSelection = isSingleSelection();
+ bool add = false;
+ //Locators to selection
+ if (key == shortcuts[SHRT_LOCATORS_TO_SELECTION].key) {
+ CItem *leftmost = 0, *rightmost = 0;
+ for (iCItem i = items.begin(); i != items.end(); i++) {
+ if (i->second->isSelected()) {
+ // Check leftmost:
+ if (!leftmost)
+ leftmost = i->second;
+ else
+ if (leftmost->x() > i->second->x())
+ leftmost = i->second;
+
+ // Check rightmost:
+ if (!rightmost)
+ rightmost = i->second;
+ else
+ if (rightmost->x() < i->second->x())
+ rightmost = i->second;
+ }
+ }
+
+ int left_tick = leftmost->part()->tick();
+ int right_tick = rightmost->part()->tick() + rightmost->part()->lenTick();
+ Pos p1(left_tick, true);
+ Pos p2(right_tick, true);
+ song->setPos(1, p1);
+ song->setPos(2, p2);
+ return;
+ }
+
+ // Select part to the right
+ else if (key == shortcuts[SHRT_SEL_RIGHT].key || key == shortcuts[SHRT_SEL_RIGHT_ADD].key) {
+ if (key == shortcuts[SHRT_SEL_RIGHT_ADD].key)
+ add = true;
+
+ Part* part = curItem->part();
+ Track* track = part->track();
+ unsigned int tick = part->tick();
+ bool afterthis = false;
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ NPart* npart = (NPart*)(i->second);
+ Part* ipart = npart->part();
+ if (ipart->track() != track)
+ continue;
+ if (ipart->tick() < tick)
+ continue;
+ if (ipart == part)
+ {
+ afterthis = true;
+ continue;
+ }
+ if(afterthis)
+ {
+ newItem = i->second;
+ break;
+ }
+ }
+ }
+ // Select part to the left
+ else if (key == shortcuts[SHRT_SEL_LEFT].key || key == shortcuts[SHRT_SEL_LEFT_ADD].key) {
+ if (key == shortcuts[SHRT_SEL_LEFT_ADD].key)
+ add = true;
+
+ Part* part = curItem->part();
+ Track* track = part->track();
+ unsigned int tick = part->tick();
+
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ NPart* npart = (NPart*)(i->second);
+ Part* ipart = npart->part();
+
+ if (ipart->track() != track)
+ continue;
+ if (ipart->tick() > tick)
+ continue;
+ if (ipart == part)
+ break;
+ newItem = i->second;
+ }
+ }
+
+ // Select nearest part on track above
+ else if (key == shortcuts[SHRT_SEL_ABOVE].key || key == shortcuts[SHRT_SEL_ABOVE_ADD].key) {
+ if (key == shortcuts[SHRT_SEL_ABOVE_ADD].key)
+ add = true;
+ //To get an idea of which track is above us:
+ int stepsize = rmapxDev(1);
+ Track* track = curItem->part()->track();//top->part()->track();
+ track = y2Track(track->y() - 1);
+
+ //If we're at topmost, leave
+ if (!track) {
+ printf("no track above!\n");
+ return;
+ }
+ int middle = curItem->x() + curItem->part()->lenTick()/2;
+ CItem *aboveL = 0, *aboveR = 0;
+ //Upper limit: song end, lower limit: song start
+ int ulimit = song->len();
+ int llimit = 0;
+
+ while (newItem == 0) {
+ int y = track->y() + 2;
+ int xoffset = 0;
+ int xleft = middle - xoffset;
+ int xright = middle + xoffset;
+ while ((xleft > llimit || xright < ulimit) && (aboveL == 0) && (aboveR == 0)) {
+ xoffset += stepsize;
+ xleft = middle - xoffset;
+ xright = middle + xoffset;
+ if (xleft >= 0)
+ aboveL = items.find(QPoint(xleft,y));
+ if (xright <= ulimit)
+ aboveR = items.find(QPoint(xright,y));
+ }
+
+ if ((aboveL || aboveR) != 0) { //We've hit something
+ CItem* above = 0;
+ above = (aboveL !=0) ? aboveL : aboveR;
+ newItem = above;
+ }
+ else { //We didn't hit anything. Move to track above, if there is one
+ track = y2Track(track->y() - 1);
+ if (track == 0)
+ return;
+ }
+ }
+ emit trackChanged(track);
+ }
+ // Select nearest part on track below
+ else if (key == shortcuts[SHRT_SEL_BELOW].key || key == shortcuts[SHRT_SEL_BELOW_ADD].key) {
+ if (key == shortcuts[SHRT_SEL_BELOW_ADD].key)
+ add = true;
+
+ //To get an idea of which track is below us:
+ int stepsize = rmapxDev(1);
+ Track* track = curItem->part()->track();//bottom->part()->track();
+ track = y2Track(track->y() + track->height() + 1 );
+ int middle = curItem->x() + curItem->part()->lenTick()/2;
+ //If we're at bottommost, leave
+ if (!track)
+ return;
+
+ CItem *belowL = 0, *belowR = 0;
+ //Upper limit: song end , lower limit: song start
+ int ulimit = song->len();
+ int llimit = 0;
+ while (newItem == 0) {
+ int y = track->y() + 1;
+ int xoffset = 0;
+ int xleft = middle - xoffset;
+ int xright = middle + xoffset;
+ while ((xleft > llimit || xright < ulimit) && (belowL == 0) && (belowR == 0)) {
+ xoffset += stepsize;
+ xleft = middle - xoffset;
+ xright = middle + xoffset;
+ if (xleft >= 0)
+ belowL = items.find(QPoint(xleft,y));
+ if (xright <= ulimit)
+ belowR = items.find(QPoint(xright,y));
+ }
+
+ if ((belowL || belowR) != 0) { //We've hit something
+ CItem* below = 0;
+ below = (belowL !=0) ? belowL : belowR;
+ newItem = below;
+ }
+ else {
+ //Get next track below, or abort if this is the lowest
+ track = y2Track(track->y() + track->height() + 1 );
+ if (track == 0)
+ return;
+ }
+ }
+ emit trackChanged(track);
+ }
+ else if (key == shortcuts[SHRT_EDIT_PART].key && curItem) { //This should be the other way around - singleSelection first.
+ if (!singleSelection) {
+ event->ignore();
+ return;
+ }
+ PartList* pl = new PartList;
+ NPart* npart = (NPart*)(curItem);
+ Track* track = npart->part()->track();
+ pl->add(npart->part());
+ int type = 0;
+
+ // Check if track is wave or drum,
+ // else track is midi
+
+ switch (track->type()) {
+ case Track::DRUM:
+ type = 3;
+ break;
+
+ case Track::WAVE:
+ type = 4;
+ break;
+
+ case Track::MIDI:
+ case Track::AUDIO_OUTPUT:
+ case Track::AUDIO_INPUT:
+ case Track::AUDIO_GROUP:
+ case Track::AUDIO_AUX:
+ case Track::AUDIO_SOFTSYNTH: //TODO
+ break;
+ }
+ emit startEditor(pl, type);
+ }
+ else {
+ event->ignore(); // give global accelerators a chance
+ return;
+ }
+
+
+ // Check if anything happened to the selected parts
+ if (newItem) {
+ //If this is a single selection, toggle previous item
+ if (singleSelection && !add)
+ selectItem(curItem, false);
+ else if(!add)
+ deselectAll();
+
+ curItem = newItem;
+ selectItem(newItem, true);
+
+ //Check if we've hit the upper or lower boundaries of the window. If so, set a new position
+ if (newItem->x() < mapxDev(0)) {
+ int curpos = pos[0];
+ setPos(0,newItem->x(),true);
+ setPos(0,curpos,false); //Dummy to put the current position back once we've scrolled
+ }
+ else if (newItem->x() > mapxDev(width())) {
+ int curpos = pos[0];
+ setPos(0,newItem->x(),true);
+ setPos(0,curpos,false); //Dummy to put the current position back once we've scrolled
+ }
+ redraw();
+ }
+ }
+
+//---------------------------------------------------------
+// drawPart
+// draws a part
+//---------------------------------------------------------
+
+void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect)
+ {
+ int from = rect.x();
+ int to = from + rect.width();
+
+ //printf("from %d to %d\n", from,to);
+ Part* part = ((NPart*)item)->part();
+ int pTick = part->tick();
+ from -= pTick;
+ to -= pTick;
+ if(from < 0)
+ from = 0;
+ if((unsigned int)to > part->lenTick())
+ to = part->lenTick();
+
+ QRect r = item->bbox();
+ //QRect r = item->bbox().intersect(rect);
+ int i = part->colorIndex();
+
+ //printf("part start tick %d part start pixel %d\n", part->tick(), r.x());
+
+ // Added by Tim. p3.3.6
+ //printf("PartCanvas::drawItem %s evRefs:%d pTick:%d pLen:%d bb.x:%d bb.w:%d rect.x:%d rect.w:%d r.x:%d r.w:%d\n", part->name().latin1(), part->events()->arefCount(), pTick, part->lenTick(), item->bbox().x(), item->bbox().width(), rect.x(), rect.width(), r.x(), r.width());
+
+ // Must be reasonable about very low negative x values! With long songs > 15min
+ // and with high horizontal magnification, 'ghost' drawings appeared,
+ // apparently the result of truncation later (xp = -65006 caused ghosting
+ // at bar 245 with magnification at max.), even with correct clipping region
+ // applied to painter in View::paint(). Tim. Apr 5 2009
+ // Quote: "Warning: Note that QPainter does not attempt to work around
+ // coordinate limitations in the underlying window system. Some platforms may
+ // behave incorrectly with coordinates as small as +/-4000."
+ //if(r.isEmpty())
+ // return;
+
+ p.setPen(Qt::black);
+ if (part->mute()) {
+ p.setBrush(Qt::gray);
+ p.drawRect(r);
+ return;
+ }
+ if (item->isMoving()) {
+ p.setBrush(Qt::gray);
+ p.drawRect(r);
+ }
+ //else if (part->mute())
+ // return;
+ else if (part->selected()) {
+ bool clone = part->events()->arefCount() > 1;
+ //p.setPen(config.partColors[i]);
+ p.setPen(QPen(config.partColors[i], 2, clone ? Qt::DashLine : Qt::SolidLine));
+ p.setBrush(Qt::black);
+ p.drawRect(r);
+ }
+ else {
+ bool clone = part->events()->arefCount() > 1;
+ p.setPen(QPen(Qt::black, 2, clone ? Qt::DashLine : Qt::SolidLine));
+ p.setBrush(config.partColors[i]);
+ p.drawRect(r);
+ }
+
+ MidiPart* mp = 0;
+ WavePart* wp = 0;
+ Track::TrackType type = part->track()->type();
+ if (type == Track::WAVE) {
+ wp =(WavePart*)part;
+ }
+ else {
+ mp = (MidiPart*)part;
+ }
+
+ if (config.canvasShowPartType & 2) { // show events
+ if (mp)
+ {
+ // Do not allow this, causes segfault.
+ if(from <= to)
+ {
+ p.setPen(Qt::darkGray);
+ EventList* events = mp->events();
+ iEvent ito(events->lower_bound(to));
+
+ for (iEvent i = events->lower_bound(from); i != ito; ++i) {
+ EventType type = i->second.type();
+ if (
+ ((config.canvasShowPartEvent & 1) && (type == Note))
+ || ((config.canvasShowPartEvent & 2) && (type == PAfter))
+ || ((config.canvasShowPartEvent & 4) && (type == Controller))
+ || ((config.canvasShowPartEvent &16) && (type == CAfter))
+ || ((config.canvasShowPartEvent &64) && (type == Sysex || type == Meta))
+ ) {
+ int t = i->first + pTick;
+ int th = part->track()->height();
+ if(t >= r.left() && t <= r.right())
+ p.drawLine(t, r.y()+2, t, r.y()+th-4);
+ }
+ }
+ }
+ }
+ else if (wp)
+ drawWavePart(p, rect, wp, r);
+ }
+
+ else { // show Cakewalk Style
+ if (mp) {
+ p.setPen(Qt::darkGray);
+ EventList* events = mp->events();
+ iEvent ito(events->lower_bound(to));
+ //printf("PartCanvas::drawItem pTick:%d from:%d to:%d part len:%d\n", pTick, from, to, part->lenTick());
+
+ for (iEvent i = events->begin(); i != ito; ++i) {
+ int t = i->first + pTick;
+ int te = t + i->second.lenTick();
+
+ if (t > (to + pTick))
+ {
+ printf("PartCanvas::drawItem t:%d > to:%d + pTick:%d i->first:%d\n", t, to, pTick, i->first);
+
+ break;
+ }
+
+ if (te < (from + pTick))
+ continue;
+
+ if (te > (to + pTick))
+ te = to + pTick;
+
+ EventType type = i->second.type();
+ if (type == Note) {
+ int pitch = i->second.pitch();
+ int th = int(part->track()->height() * 0.75); // only draw on three quarters
+ int hoffset = (part->track()->height() - th ) / 2; // offset from bottom
+ int y = hoffset + (r.y() + th - (pitch * (th) / 127));
+ p.drawLine(t, y, te, y);
+ }
+ }
+ }
+ else if (wp)
+ drawWavePart(p, rect, wp, r);
+ }
+ if (config.canvasShowPartType & 1) { // show names
+ // draw name
+ // FN: Set text color depending on part color (black / white)
+ int part_r, part_g, part_b, brightness;
+ config.partColors[i].getRgb(&part_r, &part_g, &part_b);
+ brightness = part_r*29 + part_g*59 + part_b*12;
+ if (brightness < 12000 || part->selected())
+ p.setPen(Qt::white); /* too dark: use white for text color */
+ else
+ p.setPen(Qt::black); /* otherwise use black */
+ QRect rr = map(r);
+ rr.setX(rr.x() + 3);
+ p.save();
+ p.setFont(config.fonts[1]);
+ p.setWorldXForm(false);
+ p.drawText(rr, Qt::AlignVCenter|Qt::AlignLeft, part->name());
+ p.restore();
+ }
+ }
+
+//---------------------------------------------------------
+// drawMoving
+// draws moving items
+//---------------------------------------------------------
+
+void PartCanvas::drawMoving(QPainter& p, const CItem* item, const QRect&)
+ {
+ //if(!item->isMoving())
+ // return;
+ p.setPen( Qt::black);
+ p.setBrush( Qt::NoBrush);
+ p.drawRect(item->mp().x(), item->mp().y()+1, item->width(), item->height());
+ }
+
+//---------------------------------------------------------
+// drawWavePart
+// bb - bounding box of paint area
+// pr - part rectangle
+//---------------------------------------------------------
+
+void PartCanvas::drawWavePart(QPainter& p,
+ const QRect& bb, WavePart* wp, const QRect& _pr)
+ {
+ QRect rr = p.worldMatrix().map(bb);
+ QRect pr = p.worldMatrix().map(_pr);
+
+ p.save();
+ p.resetXForm();
+
+ int x2 = 1;
+ int x1 = rr.x() > pr.x() ? rr.x() : pr.x();
+ x2 += rr.right() < pr.right() ? rr.right() : pr.right();
+
+ if (x1 < 0)
+ x1 = 0;
+ if (x2 > width())
+ x2 = width();
+ int hh = pr.height();
+ int h = hh/2;
+ int y = pr.y() + h;
+
+ EventList* el = wp->events();
+ for (iEvent e = el->begin(); e != el->end(); ++e) {
+ int cc = hh % 2 ? 0 : 1;
+ Event event = e->second;
+ SndFileR f = event.sndFile();
+ if (f.isNull())
+ continue;
+ unsigned channels = f.channels();
+ if (channels == 0) {
+ printf("drawWavePart: channels==0! %s\n", f.name().latin1());
+ continue;
+ }
+
+ int xScale;
+ int pos;
+ int tickstep = rmapxDev(1);
+ int postick = tempomap.frame2tick(wp->frame() + event.frame());
+ int eventx = mapx(postick);
+ int drawoffset;
+ if((x1 - eventx) < 0)
+ drawoffset = 0;
+ else
+ drawoffset = rmapxDev(x1 - eventx);
+ postick += drawoffset;
+ pos = event.spos() + tempomap.tick2frame(postick) - wp->frame() - event.frame();
+
+ int i;
+ if(x1 < eventx)
+ i = eventx;
+ else
+ i = x1;
+ int ex = mapx(tempomap.frame2tick(wp->frame() + event.frame() + event.lenFrame()));
+ if(ex > x2)
+ ex = x2;
+ if (h < 20) {
+ //
+ // combine multi channels into one waveform
+ //
+ for (; i < ex; i++) {
+ SampleV sa[channels];
+ xScale = tempomap.deltaTick2frame(postick, postick + tickstep);
+ f.read(sa, xScale, pos);
+ postick += tickstep;
+ pos += xScale;
+ int peak = 0;
+ int rms = 0;
+ for (unsigned k = 0; k < channels; ++k) {
+ if (sa[k].peak > peak)
+ peak = sa[k].peak;
+ rms += sa[k].rms;
+ }
+ rms /= channels;
+ peak = (peak * (hh-2)) >> 9;
+ rms = (rms * (hh-2)) >> 9;
+ p.setPen(QColor(Qt::darkGray));
+ p.drawLine(i, y - peak - cc, i, y + peak);
+ p.setPen(QColor(Qt::black));
+ p.drawLine(i, y - rms - cc, i, y + rms);
+ }
+ }
+ else {
+ //
+ // multi channel display
+ //
+ int hm = hh / (channels * 2);
+ int cc = hh % (channels * 2) ? 0 : 1;
+ for (; i < ex; i++) {
+ y = pr.y() + hm;
+ SampleV sa[channels];
+ xScale = tempomap.deltaTick2frame(postick, postick + tickstep);
+ f.read(sa, xScale, pos);
+ postick += tickstep;
+ pos += xScale;
+ for (unsigned k = 0; k < channels; ++k) {
+ int peak = (sa[k].peak * (hm - 1)) >> 8;
+ int rms = (sa[k].rms * (hm - 1)) >> 8;
+ p.setPen(QColor(Qt::darkGray));
+ p.drawLine(i, y - peak - cc, i, y + peak);
+ p.setPen(QColor(Qt::black));
+ p.drawLine(i, y - rms - cc, i, y + rms);
+
+ y += 2 * hm;
+ }
+ }
+ }
+ }
+ p.restore();
+ }
+//---------------------------------------------------------
+// cmd
+//---------------------------------------------------------
+
+void PartCanvas::cmd(int cmd)
+ {
+ PartList pl;
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (!i->second->isSelected())
+ continue;
+ NPart* npart = (NPart*)(i->second);
+ pl.add(npart->part());
+ }
+ switch (cmd) {
+ case CMD_CUT_PART:
+ copy(&pl);
+ song->startUndo();
+
+ bool loop;
+ do
+ {
+ loop = false;
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (!i->second->isSelected())
+ continue;
+ NPart* p = (NPart*)(i->second);
+ Part* part = p->part();
+ audio->msgRemovePart(part);
+
+ loop = true;
+ break;
+ }
+ } while (loop);
+ song->endUndo(SC_PART_REMOVED);
+ break;
+ case CMD_COPY_PART:
+ copy(&pl);
+ break;
+ case CMD_PASTE_PART:
+ paste(false, false);
+ break;
+ case CMD_PASTE_CLONE_PART:
+ paste(true, false);
+ break;
+ case CMD_PASTE_PART_TO_TRACK:
+ paste();
+ break;
+ case CMD_PASTE_CLONE_PART_TO_TRACK:
+ paste(true);
+ break;
+ case CMD_INSERT_PART:
+ paste(false, false, true);
+ break;
+ case CMD_INSERT_EMPTYMEAS:
+ song->startUndo();
+ int startPos=song->vcpos();
+ int oneMeas=sigmap.ticksMeasure(startPos);
+ movePartsTotheRight(startPos,oneMeas);
+ song->endUndo(SC_PART_INSERTED);
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// copy
+// cut copy paste
+//---------------------------------------------------------
+
+void PartCanvas::copy(PartList* pl)
+ {
+ //printf("void PartCanvas::copy(PartList* pl)\n");
+ if (pl->empty())
+ return;
+ // Changed by T356. Support mixed .mpt files.
+ //bool isWave = pl->begin()->second->track()->type() == Track::WAVE;
+ bool wave = false;
+ bool midi = false;
+ for(ciPart p = pl->begin(); p != pl->end(); ++p)
+ {
+ if(p->second->track()->isMidiTrack())
+ midi = true;
+ else
+ if(p->second->track()->type() == Track::WAVE)
+ wave = true;
+ if(midi && wave)
+ break;
+ }
+ if(!(midi || wave))
+ return;
+
+ //---------------------------------------------------
+ // write parts as XML into tmp file
+ //---------------------------------------------------
+
+ FILE* tmp = tmpfile();
+ if (tmp == 0) {
+ fprintf(stderr, "PartCanvas::copy() fopen failed: %s\n",
+ strerror(errno));
+ return;
+ }
+ Xml xml(tmp);
+
+ // Clear the copy clone list.
+ cloneList.clear();
+ //copyCloneList.clear();
+
+ int level = 0;
+ int tick = 0;
+ for (ciPart p = pl->begin(); p != pl->end(); ++p) {
+ // Indicate this is a copy operation. Also force full wave paths.
+ //p->second->write(level, xml);
+ p->second->write(level, xml, true, true);
+
+ int endTick = p->second->endTick();
+ if (endTick > tick)
+ tick = endTick;
+ }
+ Pos p(tick, true);
+ song->setPos(0, p);
+
+ //---------------------------------------------------
+ // read tmp file into QTextDrag Object
+ //---------------------------------------------------
+
+ fflush(tmp);
+ struct stat f_stat;
+ if (fstat(fileno(tmp), &f_stat) == -1) {
+ fprintf(stderr, "PartCanvas::copy() fstat failed:<%s>\n",
+ strerror(errno));
+ fclose(tmp);
+ return;
+ }
+ int n = f_stat.st_size;
+ char* fbuf = (char*)mmap(0, n+1, PROT_READ|PROT_WRITE,
+ MAP_PRIVATE, fileno(tmp), 0);
+ fbuf[n] = 0;
+ Q3TextDrag* drag = new Q3TextDrag(QString(fbuf));
+ // Changed by T356. Support mixed .mpt files.
+ //drag->setSubtype(QCString(isWave ? "wavepartlist" : "midipartlist"));
+ if(midi && wave)
+ drag->setSubtype(Q3CString("mixedpartlist"));
+ else
+ if(midi)
+ drag->setSubtype(Q3CString("midipartlist"));
+ else
+ if(wave)
+ drag->setSubtype(Q3CString("wavepartlist"));
+
+ QApplication::clipboard()->setData(drag, QClipboard::Clipboard);
+ munmap(fbuf, n);
+ fclose(tmp);
+ }
+
+//---------------------------------------------------------
+// pasteAt
+//---------------------------------------------------------
+
+int PartCanvas::pasteAt(const QString& pt, Track* track, int pos, bool clone, bool toTrack)
+ {
+ //printf("int PartCanvas::pasteAt(const QString& pt, Track* track, int pos)\n");
+ const char* ptxt = pt.latin1();
+ Xml xml(ptxt);
+ bool firstPart=true;
+ int posOffset=0;
+ //int finalPos=0;
+ int finalPos = pos;
+ int notDone = 0;
+ int done = 0;
+ bool end = false;
+
+ //song->startUndo();
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ end = true;
+ break;
+ case Xml::TagStart:
+ if (tag == "part") {
+ /*
+ Part* p = 0;
+ if(clone)
+ {
+ if(!(p = readClone(xml, track, toTrack)))
+ break;
+ }
+ else
+ {
+ if (track->type() == Track::MIDI || track->type() == Track::DRUM)
+ p = new MidiPart((MidiTrack*)track);
+ else if (track->type() == Track::WAVE)
+ p = new WavePart((WaveTrack*)track);
+ else
+ break;
+ p->read(xml, 0, toTrack);
+ }
+ */
+
+ // Read the part.
+ Part* p = 0;
+ p = readXmlPart(xml, track, clone, toTrack);
+ // If it could not be created...
+ if(!p)
+ {
+ // Increment the number of parts not done and break.
+ ++notDone;
+ break;
+ }
+
+ // Increment the number of parts done.
+ ++done;
+
+ if (firstPart) {
+ firstPart=false;
+ posOffset=pos-p->tick();
+ }
+ p->setTick(p->tick()+posOffset);
+ if (p->tick()+p->lenTick()>finalPos) {
+ finalPos=p->tick()+p->lenTick();
+ }
+ //pos += p->lenTick();
+ audio->msgAddPart(p,false);
+ }
+ else
+ xml.unknown("PartCanvas::pasteAt");
+ break;
+ case Xml::TagEnd:
+ break;
+ default:
+ end = true;
+ break;
+ }
+ if(end)
+ break;
+ }
+
+ //song->endUndo(SC_PART_INSERTED);
+ //return pos;
+
+ if(notDone)
+ {
+ int tot = notDone + done;
+ QMessageBox::critical(this, QString("MusE"),
+ QString().setNum(notDone) + (tot > 1 ? (tr(" out of ") + QString().setNum(tot)) : QString("")) +
+ (tot > 1 ? tr(" parts") : tr(" part")) +
+ tr(" could not be pasted.\nLikely the selected track is the wrong type."));
+ }
+
+ return finalPos;
+ }
+
+/*
+//---------------------------------------------------------
+// PartCanvas::readPart
+//---------------------------------------------------------
+
+Part* PartCanvas::readPart(Xml& xml, Track* track, bool doClone, bool toTrack)
+ {
+ int id = -1;
+ Part* npart = 0;
+ uuid_t uuid;
+ uuid_clear(uuid);
+ bool uuidvalid = false;
+ bool clone = true;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return npart;
+ case Xml::TagStart:
+ // If the part has not been created yet...
+ if(!npart)
+ {
+ // Attribute section did not create a clone from any matching part. Create a non-clone part now.
+ if(!track)
+ {
+ xml.skip("part");
+ return 0;
+ }
+ if (track->type() == Track::MIDI || track->type() == Track::DRUM)
+ npart = new MidiPart((MidiTrack*)track);
+ else if (track->type() == Track::WAVE)
+ npart = new WavePart((WaveTrack*)track);
+ else
+ {
+ xml.skip("part");
+ return 0;
+ }
+
+ // Signify a new non-clone part was created.
+ // Even if the original part was itself a clone, clear this because the
+ // attribute section did not create a clone from any matching part.
+ clone = false;
+
+ // If an id or uuid was found, add the part to the clone list
+ // so that subsequent parts can look it up and clone from it...
+ if(id != -1)
+ {
+ ClonePart ncp(npart, id);
+ cloneList.push_back(ncp);
+ }
+ else
+ if(uuidvalid)
+ {
+ ClonePart ncp(npart);
+ // New ClonePart creates its own uuid, but we need to replace it.
+ uuid_copy(ncp.uuid, uuid);
+ cloneList.push_back(ncp);
+ }
+ }
+
+ if (tag == "name")
+ npart->setName(xml.parse1());
+ else if (tag == "poslen") {
+ ((PosLen*)npart)->read(xml, "poslen");
+ }
+ else if (tag == "pos") {
+ Pos pos;
+ pos.read(xml, "pos"); // obsolete
+ npart->setTick(pos.tick());
+ }
+ else if (tag == "len") {
+ Pos len;
+ len.read(xml, "len"); // obsolete
+ npart->setLenTick(len.tick());
+ }
+ else if (tag == "selected")
+ npart->setSelected(xml.parseInt());
+ else if (tag == "color")
+ npart->setColorIndex(xml.parseInt());
+ else if (tag == "mute")
+ npart->setMute(xml.parseInt());
+ else if (tag == "event")
+ {
+ // If a new non-clone part was created, accept the events...
+ if(!clone)
+ {
+ EventType type = Wave;
+ if(track->isMidiTrack())
+ type = Note;
+ Event e(type);
+ e.read(xml);
+ // stored tickpos for event has absolute value. However internally
+ // tickpos is relative to start of part, we substract tick().
+ // TODO: better handling for wave event
+ e.move( -npart->tick() );
+ int tick = e.tick();
+
+ // Do not discard events belonging to clone parts,
+ // at least not yet. A later clone might have a longer,
+ // fully accommodating part length!
+ //if ((tick < 0) || (tick >= (int) lenTick())) {
+ //if ((tick < 0) || ( id == -1 && !clone && (tick >= (int)lenTick()) ))
+ // No way to tell at the moment whether there will be clones referencing this...
+ // No choice but to accept all events past 0.
+ if(tick < 0)
+ {
+ //printf("readClone: warning: event not in part: %d - %d -%d, discarded\n",
+ printf("readClone: warning: event at tick:%d not in part:%s, discarded\n",
+ tick, npart->name().latin1());
+ }
+ else
+ {
+ npart->events()->add(e);
+ }
+ }
+ else
+ // ...Otherwise a clone was created, so we don't need the events.
+ xml.skip(tag);
+ }
+ else
+ xml.unknown("PartCanvas::readClone");
+ break;
+ case Xml::Attribut:
+ if (tag == "cloneId")
+ {
+ id = xml.s2().toInt();
+ if(id != -1)
+ {
+ for(iClone i = cloneList.begin(); i != cloneList.end(); ++i)
+ {
+ // Is a matching part found in the clone list?
+ if(i->id == id)
+ {
+ // If it's a regular paste (not paste clone), and the original part is
+ // not a clone, defer so that a new copy is created in TagStart above.
+ if(!doClone && i->cp->cevents()->arefCount() <= 1)
+ break;
+
+ // This makes a clone, chains the part, and increases ref counts.
+ npart = track->newPart((Part*)i->cp, true);
+ break;
+ }
+ }
+ }
+ }
+ else if (tag == "uuid")
+ {
+ uuid_parse(xml.s2().latin1(), uuid);
+ if(!uuid_is_null(uuid))
+ {
+ uuidvalid = true;
+ for(iClone i = cloneList.begin(); i != cloneList.end(); ++i)
+ {
+ // Is a matching part found in the clone list?
+ if(uuid_compare(uuid, i->uuid) == 0)
+ {
+ Track* cpt = i->cp->track();
+ // If we want to paste to the given track...
+ if(toTrack)
+ {
+ // If the given track type is not the same as the part's
+ // original track type, we can't continue. Just return.
+ if(!track || cpt->type() != track->type())
+ {
+ xml.skip("part");
+ return 0;
+ }
+ }
+ else
+ // ...else we want to paste to the part's original track.
+ {
+ // Make sure the track exists (has not been deleted).
+ if((cpt->isMidiTrack() && song->midis()->find(cpt) != song->midis()->end()) ||
+ (cpt->type() == Track::WAVE && song->waves()->find(cpt) != song->waves()->end()))
+ track = cpt;
+ else
+ // Track was not found. Try pasting to the given track, as above...
+ {
+ if(!track || cpt->type() != track->type())
+ {
+ // No luck. Just return.
+ xml.skip("part");
+ return 0;
+ }
+ }
+ }
+
+ // If it's a regular paste (not paste clone), and the original part is
+ // not a clone, defer so that a new copy is created in TagStart above.
+ if(!doClone && i->cp->cevents()->arefCount() <= 1)
+ break;
+
+ // This makes a clone, chains the part, and increases ref counts.
+ npart = track->newPart((Part*)i->cp, true);
+ break;
+ }
+ }
+ }
+ }
+ //else if(tag == "isclone") // Ignore
+ // clone = xml.s2().toInt();
+ break;
+ case Xml::TagEnd:
+ if (tag == "part")
+ return npart;
+ default:
+ break;
+ }
+ }
+ return npart;
+}
+*/
+
+/*
+//---------------------------------------------------------
+// PartCanvas::readClone
+//---------------------------------------------------------
+
+Part* PartCanvas::readClone(Xml& xml, Track* track, bool toTrack)
+ {
+ int id = -1;
+ Part* npart = 0;
+ uuid_t uuid;
+ uuid_clear(uuid);
+ bool uuidvalid = false;
+ bool clone = true;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return npart;
+ case Xml::TagStart:
+ // If the part has not been created yet...
+ if(!npart)
+ {
+ // Attribute section did not create a clone from any matching part. Create a non-clone part now.
+ if (track->type() == Track::MIDI || track->type() == Track::DRUM)
+ npart = new MidiPart((MidiTrack*)track);
+ else if (track->type() == Track::WAVE)
+ npart = new WavePart((WaveTrack*)track);
+ else
+ return 0;
+
+ // Signify a new non-clone part was created.
+ // Even if the original part was itself a clone, clear this because the
+ // attribute section did not create a clone from any matching part.
+ clone = false;
+
+ // If an id or uuid was found, add the part to the clone list
+ // so that subsequent parts can look it up and clone from it...
+ if(id != -1)
+ {
+ ClonePart ncp(npart, id);
+ cloneList.push_back(ncp);
+ }
+ else
+ if(uuidvalid)
+ {
+ ClonePart ncp(npart);
+ // New ClonePart creates its own uuid, but we need to replace it.
+ uuid_copy(ncp.uuid, uuid);
+ cloneList.push_back(ncp);
+ }
+ }
+
+ if (tag == "name")
+ npart->setName(xml.parse1());
+ else if (tag == "poslen") {
+ ((PosLen*)npart)->read(xml, "poslen");
+ }
+ else if (tag == "pos") {
+ Pos pos;
+ pos.read(xml, "pos"); // obsolete
+ npart->setTick(pos.tick());
+ }
+ else if (tag == "len") {
+ Pos len;
+ len.read(xml, "len"); // obsolete
+ npart->setLenTick(len.tick());
+ }
+ else if (tag == "selected")
+ npart->setSelected(xml.parseInt());
+ else if (tag == "color")
+ npart->setColorIndex(xml.parseInt());
+ else if (tag == "mute")
+ npart->setMute(xml.parseInt());
+ else if (tag == "event")
+ {
+ // If a new non-clone part was created, accept the events...
+ if(!clone)
+ {
+ EventType type = Wave;
+ if(track->isMidiTrack())
+ type = Note;
+ Event e(type);
+ e.read(xml);
+ // stored tickpos for event has absolute value. However internally
+ // tickpos is relative to start of part, we substract tick().
+ // TODO: better handling for wave event
+ e.move( -npart->tick() );
+ int tick = e.tick();
+
+ // Do not discard events belonging to clone parts,
+ // at least not yet. A later clone might have a longer,
+ // fully accommodating part length!
+ //if ((tick < 0) || (tick >= (int) lenTick())) {
+ //if ((tick < 0) || ( id == -1 && !clone && (tick >= (int)lenTick()) ))
+ // No way to tell at the moment whether there will be clones referencing this...
+ // No choice but to accept all events past 0.
+ if(tick < 0)
+ {
+ //printf("readClone: warning: event not in part: %d - %d -%d, discarded\n",
+ printf("readClone: warning: event at tick:%d not in part:%s, discarded\n",
+ tick, npart->name().latin1());
+ }
+ else
+ {
+ npart->events()->add(e);
+ }
+ }
+ else
+ // ...Otherwise a clone was created, so we don't need the events.
+ xml.skip(tag);
+ }
+ else
+ xml.unknown("PartCanvas::readClone");
+ break;
+ case Xml::Attribut:
+ if (tag == "cloneId")
+ {
+ id = xml.s2().toInt();
+ if(id != -1)
+ {
+ for(iClone i = cloneList.begin(); i != cloneList.end(); ++i)
+ {
+ // Is a matching part found in the clone list?
+ if(i->id == id)
+ {
+ // This makes a clone, chains the part, and increases ref counts.
+ npart = track->newPart((Part*)i->cp, true);
+ break;
+ }
+ }
+ }
+ }
+ else if (tag == "uuid")
+ {
+ uuid_parse(xml.s2().latin1(), uuid);
+ if(!uuid_is_null(uuid))
+ {
+ uuidvalid = true;
+ for(iClone i = cloneList.begin(); i != cloneList.end(); ++i)
+ {
+ // Is a matching part found in the clone list?
+ if(uuid_compare(uuid, i->uuid) == 0)
+ {
+ // If we want to paste to the part's original track...
+ if(!toTrack)
+ {
+ // Make sure the track exists (has not been deleted).
+ if((i->cp->track()->isMidiTrack() && song->midis()->find(i->cp->track()) != song->midis()->end()) ||
+ (i->cp->track()->type() == Track::WAVE && song->waves()->find(i->cp->track()) != song->waves()->end()))
+ track = i->cp->track();
+ }
+ // This makes a clone, chains the part, and increases ref counts.
+ npart = track->newPart((Part*)i->cp, true);
+ break;
+ }
+ }
+ }
+ }
+ //else if(tag == "isclone") // Ignore
+ // clone = xml.s2().toInt();
+ break;
+ case Xml::TagEnd:
+ if (tag == "part")
+ return npart;
+ default:
+ break;
+ }
+ }
+ return npart;
+}
+*/
+
+//---------------------------------------------------------
+// paste
+// paste part to current selected track at cpos
+//---------------------------------------------------------
+
+//void PartCanvas::paste()
+void PartCanvas::paste(bool clone, bool toTrack, bool doInsert)
+{
+ Track* track = 0;
+
+ if (doInsert) // logic depends on keeping track of newly selected tracks
+ deselectAll();
+
+
+ // If we want to paste to a selected track...
+ if(toTrack)
+ {
+ TrackList* tl = song->tracks();
+ for (iTrack i = tl->begin(); i != tl->end(); ++i) {
+ if ((*i)->selected()) {
+ if (track) {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("Cannot paste: multiple tracks selected"));
+ return;
+ }
+ else
+ track = *i;
+ }
+ }
+ if (track == 0) {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("Cannot paste: no track selected"));
+ return;
+ }
+ }
+
+ QClipboard* cb = QApplication::clipboard();
+ QMimeSource* ms = cb->data(QClipboard::Clipboard);
+
+ bool midiPart = false;
+ bool wavePart = false;
+
+ // If we want to paste to a selected track...
+ if(toTrack)
+ {
+ for (int i = 0; const char* format = ms->format(i); ++i) {
+ format = ms->format(i);
+ if (strcmp(format, "text/midipartlist") == 0) {
+ if (!track->isMidiTrack()) {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("Can only paste to midi/drum track"));
+ return;
+ }
+ midiPart = true;
+ }
+ else if (strcmp(format, "text/wavepartlist") == 0) {
+ if (track->type() != Track::WAVE) {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("Can only paste to wave track"));
+ return;
+ }
+ wavePart = true;
+ }
+ // Added by T356. Support mixed .mpt files.
+ else if (strcmp(format, "text/mixedpartlist") == 0) {
+ if (!track->isMidiTrack() && track->type() != Track::WAVE) {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("Can only paste to midi or wave track"));
+ return;
+ }
+ midiPart = true;
+ wavePart = true;
+ }
+ }
+
+ if (!(midiPart || wavePart)) {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("Cannot paste: wrong data type"));
+ return;
+ }
+ }
+
+ QString subtype = 0;
+ QString txt = cb->text(subtype);
+ int endPos=0;
+ int startPos=song->vcpos();
+ if (!txt.isEmpty())
+ {
+ song->startUndo();
+ endPos=pasteAt(txt, track, startPos, clone, toTrack);
+ Pos p(endPos, true);
+ song->setPos(0, p);
+ if (!doInsert)
+ song->endUndo(SC_PART_INSERTED);
+
+ }
+
+ if (doInsert) {
+ int offset = endPos-startPos;
+ movePartsTotheRight(startPos, offset);
+ song->endUndo(SC_PART_INSERTED);
+ }
+ }
+
+//---------------------------------------------------------
+// movePartsToTheRight
+//---------------------------------------------------------
+void PartCanvas::movePartsTotheRight(int startTicks, int length)
+{
+ // all parts that start after the pasted parts will be moved the entire length of the pasted parts
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (!i->second->isSelected()) {
+ Part* part = i->second->part();
+ if (part->tick() >= startTicks) {
+ //void Audio::msgChangePart(Part* oldPart, Part* newPart, bool doUndoFlag, bool doCtrls, bool doClones)
+ Part *newPart = part->clone();
+ newPart->setTick(newPart->tick()+length);
+ if (part->track()->type() == Track::WAVE) {
+ audio->msgChangePart((WavePart*)part,(WavePart*)newPart,false,false,false);
+ } else {
+ audio->msgChangePart(part,newPart,false,false,false);
+ }
+
+ }
+ }
+ }
+ // perhaps ask if markers should be moved?
+ MarkerList *markerlist = song->marker();
+ for(iMarker i = markerlist->begin(); i != markerlist->end(); ++i)
+ {
+ Marker* m = &i->second;
+ if (m->tick() >= startTicks) {
+ Marker *oldMarker = new Marker();
+ *oldMarker = *m;
+ m->setTick(m->tick()+length);
+ song->undoOp(UndoOp::ModifyMarker,oldMarker, m);
+ }
+ }
+}
+//---------------------------------------------------------
+// startDrag
+//---------------------------------------------------------
+
+void PartCanvas::startDrag(CItem* item, DragType t)
+ {
+ //printf("PartCanvas::startDrag(CItem* item, DragType t)\n");
+ NPart* p = (NPart*)(item);
+ Part* part = p->part();
+
+ //---------------------------------------------------
+ // write part as XML into tmp file
+ //---------------------------------------------------
+
+ FILE* tmp = tmpfile();
+ if (tmp == 0) {
+ fprintf(stderr, "PartCanvas::startDrag() fopen failed: %s\n",
+ strerror(errno));
+ return;
+ }
+ Xml xml(tmp);
+ int level = 0;
+ part->write(level, xml);
+
+ //---------------------------------------------------
+ // read tmp file into QTextDrag Object
+ //---------------------------------------------------
+
+ fflush(tmp);
+ struct stat f_stat;
+ if (fstat(fileno(tmp), &f_stat) == -1) {
+ fprintf(stderr, "PartCanvas::startDrag fstat failed:<%s>\n",
+ strerror(errno));
+ fclose(tmp);
+ return;
+ }
+ int n = f_stat.st_size + 1;
+ char* fbuf = (char*)mmap(0, n, PROT_READ|PROT_WRITE,
+ MAP_PRIVATE, fileno(tmp), 0);
+ fbuf[n] = 0;
+ Q3TextDrag* drag = new Q3TextDrag(QString(fbuf), this);
+ drag->setSubtype("partlist");
+ if (t == MOVE_COPY || t == MOVE_CLONE)
+ drag->dragCopy();
+ else
+ drag->dragMove();
+ munmap(fbuf, n);
+ fclose(tmp);
+ }
+
+//---------------------------------------------------------
+// dragEnterEvent
+//---------------------------------------------------------
+
+void PartCanvas::dragEnterEvent(QDragEnterEvent* event)
+ {
+ event->accept(Q3TextDrag::canDecode(event));
+ }
+
+//---------------------------------------------------------
+// dragMoveEvent
+//---------------------------------------------------------
+
+void PartCanvas::dragMoveEvent(QDragMoveEvent*)
+ {
+// printf("drag move %x\n", this);
+ }
+
+//---------------------------------------------------------
+// dragLeaveEvent
+//---------------------------------------------------------
+
+void PartCanvas::dragLeaveEvent(QDragLeaveEvent*)
+ {
+// printf("drag leave\n");
+ }
+
+//---------------------------------------------------------
+// dropEvent
+//---------------------------------------------------------
+
+void PartCanvas::viewDropEvent(QDropEvent* event)
+ {
+ //printf("void PartCanvas::viewDropEvent(QDropEvent* event)\n");
+ if (event->source() == this) {
+ printf("no local DROP\n");
+ return;
+ }
+ int type = 0; // 0 = unknown, 1 = partlist, 2 = uri-list
+ QString text;
+ for (int i = 0; ; ++i) {
+ const char* p= event->format(i);
+ if (p == 0)
+ break;
+ if (strncmp(p, "text/partlist", 13) == 0) {
+ type = 1;
+ break;
+ }
+ else if (strcmp(p, "text/uri-list") == 0) {
+ type = 2;
+ break;
+ }
+ else {
+ if (debugMsg)
+ printf("unknown drop format <%s>\n", p);
+ }
+ }
+ if (type == 0)
+ return;
+
+ // Make a backup of the current clone list, to retain any 'copy' items,
+ // so that pasting works properly after.
+ CloneList copyCloneList = cloneList;
+ // Clear the clone list to prevent any dangerous associations with
+ // current non-original parts.
+ cloneList.clear();
+
+ if (Q3TextDrag::decode(event, text)) {
+ if (type == 1) {
+ int x = sigmap.raster(event->pos().x(), *_raster);
+ if (x < 0)
+ x = 0;
+ unsigned trackNo = y2pitch(event->pos().y());
+ Track* track = 0;
+ if (trackNo < tracks->size())
+ track = tracks->index(trackNo);
+ if (track) {
+ song->startUndo();
+ pasteAt(text, track, x);
+ song->endUndo(SC_PART_INSERTED);
+ }
+ }
+ else if (type == 2) {
+ text = text.stripWhiteSpace();
+ if (text.endsWith(".wav",false) || text.endsWith(".ogg",false) || text.endsWith(".mpt", false) )
+ {
+ int x = sigmap.raster(event->pos().x(), *_raster);
+ if (x < 0)
+ x = 0;
+ unsigned trackNo = y2pitch(event->pos().y());
+ Track* track = 0;
+ if (trackNo < tracks->size())
+ track = tracks->index(trackNo);
+ if (track)
+ {
+ Q3Url url(text);
+ QString newPath = url.path();
+ if (track->type() == Track::WAVE && (text.endsWith(".wav", false) || (text.endsWith(".ogg", false))))
+ {
+ unsigned tick = x;
+ muse->importWaveToTrack(newPath, tick, track);
+ }
+ // Changed by T356. Support mixed .mpt files.
+ //else if ((track->type() == Track::MIDI || track->type() == Track::DRUM) && text.endsWith(".mpt", false))
+ else if ((track->isMidiTrack() || track->type() == Track::WAVE) && text.endsWith(".mpt", false))
+ {
+ unsigned tick = x;
+ muse->importPartToTrack(newPath, tick, track);
+ }
+ }
+ }
+ else if(text.endsWith(".med",false))
+ {
+ Q3Url url(text);
+ emit dropSongFile(url.path());
+ }
+ else if(text.endsWith(".mid",false))
+ {
+ Q3Url url(text);
+ emit dropMidiFile(url.path());
+ }
+ else
+ {
+ printf("dropped... something... no hable...\n");
+ }
+ }
+ }
+ // Restore backup of the clone list, to retain any 'copy' items,
+ // so that pasting works properly after.
+ cloneList.clear();
+ cloneList = copyCloneList;
+ }
+
+//---------------------------------------------------------
+// drawCanvas
+//---------------------------------------------------------
+
+void PartCanvas::drawCanvas(QPainter& p, const QRect& rect)
+{
+ int x = rect.x();
+ int y = rect.y();
+ int w = rect.width();
+ int h = rect.height();
+
+ //////////
+ // GRID //
+ //////////
+ QColor baseColor(config.partCanvasBg.light(104));
+ p.setPen(baseColor);
+
+ //--------------------------------
+ // vertical lines
+ //-------------------------------
+ //printf("raster=%d\n", *_raster);
+ if (config.canvasShowGrid) {
+ int bar, beat;
+ unsigned tick;
+
+ sigmap.tickValues(x, &bar, &beat, &tick);
+ for (;;) {
+ int xt = sigmap.bar2tick(bar++, 0, 0);
+ if (xt >= x + w)
+ break;
+ if (!((bar-1) % 4))
+ p.setPen(baseColor.dark(115));
+ else
+ p.setPen(baseColor);
+ p.drawLine(xt, y, xt, y+h);
+
+ // append
+ int noDivisors=0;
+ if (*_raster == config.division *2) // 1/2
+ noDivisors=2;
+ else if (*_raster== config.division) // 1/4
+ noDivisors=4;
+ else if (*_raster==config.division/2) // 1/8
+ noDivisors=8;
+ else if (*_raster==config.division/4) // 1/16
+ noDivisors=16;
+ else if (*_raster==config.division/8) // 1/16
+ noDivisors=32;
+ else if (*_raster==config.division/16) // 1/16
+ noDivisors=64;
+
+ int r = *_raster;
+ int rr = rmapx(r);
+ if (*_raster > 1) {
+ while (rr < 4) {
+ r *= 2;
+ rr = rmapx(r);
+ noDivisors=noDivisors/2;
+ }
+ p.setPen(baseColor);
+ for (int t=1;t< noDivisors;t++)
+ p.drawLine(xt+r*t, y, xt+r*t, y+h);
+ }
+ }
+ }
+ //--------------------------------
+ // horizontal lines
+ //--------------------------------
+
+ TrackList* tl = song->tracks();
+ int yy = 0;
+ for (iTrack it = tl->begin(); it != tl->end(); ++it) {
+ if (yy > y + h)
+ break;
+ Track* track = *it;
+ if (/*config.canvasShowGrid ||*/ !track->isMidiTrack()) {
+ p.setPen(baseColor.dark(130));
+ p.drawLine(x, yy, x + w, yy);
+ p.setPen(baseColor);
+ }
+ if (!track->isMidiTrack() && (track->type() != Track::WAVE)) {
+ QRect r = rect & QRect(x, yy, w, track->height());
+ drawAudioTrack(p, r, (AudioTrack*)track);
+ p.setPen(baseColor);
+ }
+ if (!track->isMidiTrack()) { // draw automation
+ QRect r = rect & QRect(x, yy, w, track->height());
+ drawAutomation(p, r, (AudioTrack*)track);
+ p.setPen(baseColor);
+
+ }
+ yy += track->height();
+ }
+}
+
+//---------------------------------------------------------
+// drawAudioTrack
+//---------------------------------------------------------
+
+void PartCanvas::drawAudioTrack(QPainter& p, const QRect& r, AudioTrack *t)
+{
+ p.setPen(QPen(Qt::black, 2, Qt::SolidLine));
+ p.setBrush(Qt::gray);
+ p.drawRect(r);
+}
+
+//---------------------------------------------------------
+// drawAutomation
+//---------------------------------------------------------
+
+void PartCanvas::drawAutomation(QPainter& p, const QRect& r, AudioTrack *t)
+{
+// printf("drawAudioTrack %d x %d y %d w %d h %d\n",t, r.x(), r.y(), r.width(), r.height());
+ //int v2=r.x()+r.width();
+ //printf("v2=%d mapx=%d rmapx=%d mapxdev=%d rmapxdev=%d\n",v2, mapx(v2),rmapx(v2),mapxDev(v2),rmapxDev(v2));
+ return;
+
+ p.setPen(QPen(Qt::black, 2, Qt::SolidLine));
+ int height=r.bottom()-r.top()-4; // limit height
+
+ CtrlListList* cll = t->controller();
+ QColor cols[10];
+ cols[0]=Qt::white;
+ cols[1]=Qt::red;
+ cols[2]=Qt::yellow;
+ cols[3]=Qt::black;
+ cols[4]=Qt::blue;
+ int colIndex=0;
+ bool firstRun=true;
+ for(CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll)
+ {
+ //iCtrlList *icl = icll->second;
+ CtrlList *cl = icll->second;
+ double prevVal;
+ iCtrl ic=cl->begin();
+ p.setPen(QPen(cols[colIndex++],1,Qt::SolidLine));
+
+ if (ic!=cl->end()) { // if there are no automation values we don't draw at all
+ CtrlVal cvFirst = ic->second;
+ ic++;
+ int prevPos=cvFirst.frame;
+ prevVal = cvFirst.val;
+ if (cl->id() == AC_VOLUME ) { // use db scale for volume
+ prevVal = (20.0*log10(cvFirst.val)+60) / 70.0; // represent volume between 0 and 1
+ if (prevVal < 0) prevVal = 0.0;
+ }
+ else {
+ // we need to set curVal between 0 and 1
+ double min, max;
+ cl->range(&min,&max);
+ prevVal = (prevVal- min)/(max-min);
+ }
+ for (; ic !=cl->end(); ++ic)
+ {
+ CtrlVal cv = ic->second;
+ double nextVal = cv.val; // was curVal
+ if (cl->id() == AC_VOLUME ) { // use db scale for volume
+ nextVal = (20.0*log10(cv.val)+60) / 70.0; // represent volume between 0 and 1
+ if (nextVal < 0) nextVal = 0.0;
+ }
+ else {
+ // we need to set curVal between 0 and 1
+ double min, max;
+ cl->range(&min,&max);
+ nextVal = (nextVal- min)/(max-min);
+ }
+ //printf("volume automation event %d %f %f %d\n",cv.frame,cv.val, tempomap.frame2tick(cv.frame));
+ //p.drawLine(r.x(),(r.bottom()-2)-lastVal*height,r.x()+r.width(),(r.bottom()-2)-curVal*height); // debuggingtest
+ int leftX=tempomap.frame2tick(prevPos);
+ if (firstRun && leftX>r.x()) {
+ printf("first run\n");
+ leftX=r.x();
+ }
+
+ printf("inner draw\n");
+ p.drawLine(leftX,(r.bottom()-2)-prevVal*height,tempomap.frame2tick(cv.frame),(r.bottom()-2)-prevVal*height);
+ firstRun=false;
+ //printf("draw line: %d %f %d %f\n",tempomap.frame2tick(lastPos),r.bottom()-lastVal*height,tempomap.frame2tick(cv.frame),r.bottom()-curVal*height);
+ prevPos=cv.frame;
+ prevVal=nextVal;
+ }
+ printf("outer draw %f\n", cvFirst.val);
+ p.drawLine(tempomap.frame2tick(prevPos),(r.bottom()-2)-prevVal*height,tempomap.frame2tick(prevPos)+r.width(),(r.bottom()-2)-prevVal*height);
+ //printf("draw last line: %d %f %d %f\n",tempomap.frame2tick(lastPos),r.bottom()-lastVal*height,150000,r.bottom()-lastVal*height);
+ }
+// if (height >100) {
+// p.drawText(tempomap.frame2tick(0)+1000,40,"FOOO");
+// printf("drawText %s\n", cl->name().latin1());
+// }
+ }
+}
+
+
+void PartCanvas::controllerChanged(Track *t)
+{
+ redraw();
+}
diff --git a/muse2/muse/arranger/pcanvas.h b/muse2/muse/arranger/pcanvas.h
new file mode 100644
index 00000000..b8f133fe
--- /dev/null
+++ b/muse2/muse/arranger/pcanvas.h
@@ -0,0 +1,139 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: pcanvas.h,v 1.11.2.4 2009/05/24 21:43:44 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __PCANVAS_H__
+#define __PCANVAS_H__
+
+#include "song.h"
+#include "canvas.h"
+#include "trackautomationview.h"
+//Added by qt3to4:
+#include <QDragMoveEvent>
+#include <QDropEvent>
+#include <QDragLeaveEvent>
+#include <QMouseEvent>
+#include <Q3PopupMenu>
+#include <QKeyEvent>
+#include <QEvent>
+#include <QDragEnterEvent>
+#define beats 4
+
+//---------------------------------------------------------
+// NPart
+// ''visual'' Part
+// wraps Parts with additional information needed
+// for displaying
+//---------------------------------------------------------
+
+class NPart : public CItem {
+ public:
+ NPart(Part* e);
+ const QString name() const { return part()->name(); }
+ void setName(const QString& s) { part()->setName(s); }
+ Track* track() const { return part()->track(); }
+ };
+
+class QLineEdit;
+class MidiEditor;
+class Q3PopupMenu;
+class Xml;
+
+//---------------------------------------------------------
+// PartCanvas
+//---------------------------------------------------------
+
+class PartCanvas : public Canvas {
+ int* _raster;
+ TrackList* tracks;
+
+ Part* resizePart;
+ QLineEdit* lineEditor;
+ NPart* editPart;
+ int curColorIndex;
+ bool editMode;
+
+ std::vector<TrackAutomationView*> automationViews;
+ Q_OBJECT
+ virtual void keyPress(QKeyEvent*);
+ virtual void mousePress(QMouseEvent*);
+ virtual void mouseMove(const QPoint&);
+ virtual void mouseRelease(const QPoint&);
+ virtual void viewMouseDoubleClickEvent(QMouseEvent*);
+ virtual void leaveEvent(QEvent*e);
+ virtual void drawItem(QPainter&, const CItem*, const QRect&);
+ virtual void drawMoving(QPainter&, const CItem*, const QRect&);
+ virtual void updateSelection();
+ virtual QPoint raster(const QPoint&) const;
+ virtual int y2pitch(int y) const;
+ virtual int pitch2y(int p) const;
+
+ virtual void moveCanvasItems(CItemList&, int, int, DragType, int*);
+ // Changed by T356.
+ //virtual bool moveItem(CItem*, const QPoint&, DragType, int*);
+ virtual bool moveItem(CItem*, const QPoint&, DragType);
+ virtual CItem* newItem(const QPoint&, int);
+ virtual void resizeItem(CItem*,bool);
+ virtual void newItem(CItem*,bool);
+ virtual bool deleteItem(CItem*);
+ virtual void startUndo(DragType);
+
+ virtual void endUndo(DragType, int);
+ virtual void startDrag(CItem*, DragType);
+ virtual void dragEnterEvent(QDragEnterEvent*);
+ virtual void dragMoveEvent(QDragMoveEvent*);
+ virtual void dragLeaveEvent(QDragLeaveEvent*);
+ virtual void viewDropEvent(QDropEvent*);
+
+ virtual Q3PopupMenu* genItemPopup(CItem*);
+ virtual void itemPopup(CItem*, int, const QPoint&);
+
+ void glueItem(CItem* item);
+ void splitItem(CItem* item, const QPoint&);
+
+ void copy(PartList*);
+ void paste(bool clone = false, bool toTrack = true, bool doInsert=false);
+ int pasteAt(const QString&, Track*, int, bool clone = false, bool toTrack = true);
+ void movePartsTotheRight(int startTick, int length);
+ //Part* readClone(Xml&, Track*, bool toTrack = true);
+ void drawWavePart(QPainter&, const QRect&, WavePart*, const QRect&);
+ Track* y2Track(int) const;
+ void drawAudioTrack(QPainter& p, const QRect& r, AudioTrack* track);
+ void drawAutomation(QPainter& p, const QRect& r, AudioTrack* track);
+
+
+ protected:
+ virtual void drawCanvas(QPainter&, const QRect&);
+
+ signals:
+ void timeChanged(unsigned);
+ void tracklistChanged();
+ void dclickPart(Track*);
+ void selectionChanged();
+ void dropSongFile(const QString&);
+ void dropMidiFile(const QString&);
+ void setUsedTool(int);
+ void trackChanged(Track*);
+ void selectTrackAbove();
+ void selectTrackBelow();
+
+ void startEditor(PartList*, int);
+
+ private slots:
+ void returnPressed();
+
+ public:
+ enum { CMD_CUT_PART, CMD_COPY_PART, CMD_PASTE_PART, CMD_PASTE_CLONE_PART, CMD_PASTE_PART_TO_TRACK, CMD_PASTE_CLONE_PART_TO_TRACK,
+ CMD_INSERT_PART, CMD_INSERT_EMPTYMEAS };
+
+ PartCanvas(int* raster, QWidget* parent, int, int);
+ void partsChanged();
+ void cmd(int);
+ void controllerChanged(Track *t);
+ public slots:
+ void redirKeypress(QKeyEvent* e) { keyPress(e); }
+ };
+#endif
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp
new file mode 100644
index 00000000..618dc2e6
--- /dev/null
+++ b/muse2/muse/arranger/tlist.cpp
@@ -0,0 +1,1555 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: tlist.cpp,v 1.31.2.31 2009/12/15 03:39:58 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+//#include "config.h"
+
+#include <cmath>
+
+#include <qpainter.h>
+#include <qlineedit.h>
+#include <q3popupmenu.h>
+#include <qmessagebox.h>
+#include <qscrollbar.h>
+#include <qtimer.h>
+#include <qfileinfo.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include <QPixmap>
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <QPaintEvent>
+#include <QWheelEvent>
+
+#include "globals.h"
+#include "icons.h"
+#include "scrollscale.h"
+#include "tlist.h"
+#include "xml.h"
+#include "mididev.h"
+#include "midiport.h"
+#include "midiseq.h"
+#include "comment.h"
+#include "track.h"
+#include "song.h"
+#include "header.h"
+#include "node.h"
+#include "audio.h"
+#include "instruments/minstrument.h"
+#include "app.h"
+#include "gconfig.h"
+#include "event.h"
+#include "midiedit/drummap.h"
+#include "synth.h"
+#include "config.h"
+
+#ifdef DSSI_SUPPORT
+#include "dssihost.h"
+#endif
+
+extern Q3PopupMenu* populateAddSynth(QWidget* parent, QObject* obj = 0, const char* slot = 0);
+
+static const int MIN_TRACKHEIGHT = 20;
+static const int WHEEL_DELTA = 120;
+
+//---------------------------------------------------------
+// THeaderTip::maybeTip
+//---------------------------------------------------------
+
+void THeaderTip::maybeTip(const QPoint &pos)
+ {
+#if 0 //ddskrjo
+ Header* w = (Header*)parentWidget();
+ int section = w->sectionAt(pos.x());
+ if (section == -1)
+ return;
+ QRect r(w->sectionPos(section), 0, w->sectionSize(section),
+ w->height());
+ QString p;
+ switch (section) {
+ case COL_RECORD: p = Q3Header::tr("Enable Recording"); break;
+ case COL_MUTE: p = Q3Header::tr("Mute/Off Indicator"); break;
+ case COL_SOLO: p = Q3Header::tr("Solo Indicator"); break;
+ case COL_CLASS: p = Q3Header::tr("Track Type"); break;
+ case COL_NAME: p = Q3Header::tr("Track Name"); break;
+ case COL_OCHANNEL: p = Q3Header::tr("Midi output channel number or audio channels"); break;
+ //case COL_OPORT: p = QHeader::tr("Output Port"); break;
+ case COL_OPORT: p = Q3Header::tr("Midi output port or synth midi port"); break;
+ case COL_TIMELOCK: p = Q3Header::tr("Time Lock"); break;
+// case COL_AUTOMATION: p = QHeader::tr("Automation parameter selection"); break;
+ default: return;
+ }
+ tip(r, p);
+#endif
+ }
+
+//---------------------------------------------------------
+// TList
+//---------------------------------------------------------
+
+TList::TList(Header* hdr, QWidget* parent, const char* name)
+ : QWidget(parent, name, Qt::WNoAutoErase | Qt::WResizeNoErase)
+ {
+ ypos = 0;
+ editMode = false;
+ setFocusPolicy(Qt::StrongFocus);
+ setMouseTracking(true);
+ header = hdr;
+
+ scroll = 0;
+ editTrack = 0;
+ editor = 0;
+ mode = NORMAL;
+
+ setBackgroundMode(Qt::NoBackground);
+ resizeFlag = false;
+
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ connect(muse, SIGNAL(configChanged()), SLOT(redraw()));
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void TList::songChanged(int flags)
+ {
+ if (flags & (SC_MUTE | SC_SOLO | SC_RECFLAG | SC_TRACK_INSERTED
+ | SC_TRACK_REMOVED | SC_TRACK_MODIFIED | SC_ROUTE | SC_CHANNELS | SC_MIDI_CHANNEL))
+ redraw();
+ if (flags & (SC_TRACK_INSERTED | SC_TRACK_REMOVED | SC_TRACK_MODIFIED))
+ adjustScrollbar();
+ }
+
+//---------------------------------------------------------
+// drawCenteredPixmap
+// small helper function for "draw()" below
+//---------------------------------------------------------
+
+static void drawCenteredPixmap(QPainter& p, const QPixmap* pm, const QRect& r)
+ {
+ p.drawPixmap(r.x() + (r.width() - pm->width())/2, r.y() + (r.height() - pm->height())/2, *pm);
+ }
+
+//---------------------------------------------------------
+// paintEvent
+//---------------------------------------------------------
+
+void TList::paintEvent(QPaintEvent* ev)
+ {
+ if (!pmValid)
+ paint(ev->rect());
+ bitBlt(this, ev->rect().topLeft(), &pm, ev->rect(), true); //CopyROP, true); ddskrjo
+ }
+
+//---------------------------------------------------------
+// redraw
+//---------------------------------------------------------
+
+void TList::redraw()
+ {
+ paint(QRect(0, 0, pm.width(), pm.height()));
+ update();
+ }
+
+//---------------------------------------------------------
+// redraw
+//---------------------------------------------------------
+
+void TList::redraw(const QRect& r)
+ {
+ paint(r);
+ update(r);
+ }
+
+//---------------------------------------------------------
+// paint
+//---------------------------------------------------------
+
+void TList::paint(const QRect& r)
+ {
+ if (!isVisible())
+ return;
+ QRect rect(r);
+ if (!pmValid) {
+ pmValid = true;
+ rect = QRect(0, 0, pm.width(), pm.height());
+ }
+ QPainter p(&pm);
+
+ if (bgPixmap.isNull())
+ p.fillRect(rect, config.trackBg);
+ else
+ p.drawTiledPixmap(rect, bgPixmap, QPoint(rect.x(), ypos + rect.y()));
+ p.setClipRegion(rect);
+
+ //printf("TList::paint hasClipping:%d\n", p.hasClipping()); // Tested true.
+
+ int y = rect.y();
+ int w = rect.width();
+ int h = rect.height();
+ int x1 = rect.x();
+ int x2 = rect.x() + w;
+
+ //---------------------------------------------------
+ // Tracks
+ //---------------------------------------------------
+
+ TrackList* l = song->tracks();
+ int idx = 0;
+ int yy = -ypos;
+ for (iTrack i = l->begin(); i != l->end(); ++idx, yy += (*i)->height(), ++i) {
+ Track* track = *i;
+ Track::TrackType type = track->type();
+ int trackHeight = track->height();
+ if (yy >= (y + h))
+ break;
+ if ((yy + trackHeight) < y)
+ continue;
+ //
+ // clear one row
+ //
+ QColor bg;
+ if (track->selected()) {
+ bg = config.selectTrackBg;
+ p.setPen(config.selectTrackFg);
+ }
+ else {
+ switch(type) {
+ case Track::MIDI:
+ bg = config.midiTrackBg;
+ break;
+ case Track::DRUM:
+ bg = config.drumTrackBg;
+ break;
+ case Track::WAVE:
+ bg = config.waveTrackBg;
+ break;
+ case Track::AUDIO_OUTPUT:
+ bg = config.outputTrackBg;
+ break;
+ case Track::AUDIO_INPUT:
+ bg = config.inputTrackBg;
+ break;
+ case Track::AUDIO_GROUP:
+ bg = config.groupTrackBg;
+ break;
+ case Track::AUDIO_AUX:
+ bg = config.auxTrackBg;
+ break;
+ case Track::AUDIO_SOFTSYNTH:
+ bg = config.synthTrackBg;
+ break;
+ }
+ p.setPen(palette().active().text());
+ }
+ p.fillRect(x1, yy, w, trackHeight, bg);
+
+ int x = 0;
+ for (int index = 0; index < header->count(); ++index) {
+ int section = header->mapToSection(index);
+ int w = header->sectionSize(section);
+ QRect r = p.xForm(QRect(x+2, yy, w-4, trackHeight));
+
+ switch (section) {
+ case COL_RECORD:
+ if (track->canRecord()) {
+ drawCenteredPixmap(p,
+ track->recordFlag() ? record_on_Icon : record_off_Icon, r);
+ }
+ break;
+ case COL_CLASS:
+ {
+ const QPixmap* pm = 0;
+ switch(type) {
+ case Track::MIDI:
+ pm = addtrack_addmiditrackIcon;
+ break;
+ case Track::DRUM:
+ pm = addtrack_drumtrackIcon;
+ break;
+ case Track::WAVE:
+ pm = addtrack_wavetrackIcon;
+ break;
+ case Track::AUDIO_OUTPUT:
+ pm = addtrack_audiooutputIcon;
+ break;
+ case Track::AUDIO_INPUT:
+ pm = addtrack_audioinputIcon;
+ break;
+ case Track::AUDIO_GROUP:
+ pm = addtrack_audiogroupIcon;
+ break;
+ case Track::AUDIO_AUX:
+ pm = addtrack_auxsendIcon;
+ break;
+ case Track::AUDIO_SOFTSYNTH:
+ //pm = waveIcon;
+ pm = synthIcon;
+ break;
+ }
+ drawCenteredPixmap(p, pm, r);
+ }
+ break;
+ case COL_MUTE:
+ if (track->off())
+ drawCenteredPixmap(p, offIcon, r);
+ else if (track->mute())
+ drawCenteredPixmap(p, editmuteSIcon, r);
+ break;
+ case COL_SOLO:
+ if(track->solo() && track->internalSolo())
+ drawCenteredPixmap(p, blacksqcheckIcon, r);
+ else
+ if(track->internalSolo())
+ drawCenteredPixmap(p, blacksquareIcon, r);
+ else
+ if (track->solo())
+ drawCenteredPixmap(p, bluedotIcon, r);
+ break;
+ case COL_TIMELOCK:
+ if (track->isMidiTrack()
+ && track->locked()) {
+ drawCenteredPixmap(p, lockIcon, r);
+ }
+ break;
+ case COL_NAME:
+ p.drawText(r, Qt::AlignVCenter|Qt::AlignLeft, track->name());
+ break;
+ case COL_OCHANNEL:
+ {
+ QString s;
+ int n;
+ if (track->isMidiTrack()) {
+ n = ((MidiTrack*)track)->outChannel() + 1;
+ }
+ else {
+ // show number of ports
+ n = ((WaveTrack*)track)->channels();
+ }
+ s.setNum(n);
+ p.drawText(r, Qt::AlignVCenter|Qt::AlignHCenter, s);
+ }
+ break;
+ case COL_OPORT:
+ {
+ QString s;
+ if (track->isMidiTrack()) {
+ int outport = ((MidiTrack*)track)->outPort();
+ s.sprintf("%d:%s", outport+1, midiPorts[outport].portname().latin1());
+ }
+ // Added by Tim. p3.3.9
+
+ else
+ if(track->type() == Track::AUDIO_SOFTSYNTH)
+ {
+ MidiDevice* md = dynamic_cast<MidiDevice*>(track);
+ if(md)
+ {
+ int outport = md->midiPort();
+ if((outport >= 0) && (outport < MIDI_PORTS))
+ s.sprintf("%d:%s", outport+1, midiPorts[outport].portname().latin1());
+ else
+ s = tr("<none>");
+ }
+ }
+
+ p.drawText(r, Qt::AlignVCenter|Qt::AlignLeft, s);
+ }
+ break;
+// case COL_AUTOMATION:
+// {
+// QString s="-";
+//
+// if (!track->isMidiTrack()) {
+// int count = ((AudioTrack*)track)->controller()->size();
+// s.sprintf("%d", count);
+// }
+//
+//
+// p.drawText(r, Qt::AlignVCenter|Qt::AlignLeft, s);
+// }
+// break;
+ default:
+ break;
+ }
+ x += header->sectionSize(section);
+ }
+ p.setPen(Qt::gray);
+ p.drawLine(x1, yy, x2, yy);
+ }
+ p.drawLine(x1, yy, x2, yy);
+
+ if (mode == DRAG) {
+ int yy = curY - dragYoff;
+ p.setPen(Qt::green);
+ p.drawLine(x1, yy, x2, yy);
+ p.drawLine(x1, yy + dragHeight, x2, yy+dragHeight);
+ }
+
+ //---------------------------------------------------
+ // draw vertical lines
+ //---------------------------------------------------
+
+ int n = header->count();
+ int xpos = 0;
+ p.setPen(Qt::gray);
+ for (int index = 0; index < n; index++) {
+ int section = header->mapToSection(index);
+ xpos += header->sectionSize(section);
+ p.drawLine(xpos, 0, xpos, height());
+ }
+ }
+
+//---------------------------------------------------------
+// returnPressed
+//---------------------------------------------------------
+
+void TList::returnPressed()
+ {
+ editor->hide();
+ if (editor->text() != editTrack->name()) {
+ TrackList* tl = song->tracks();
+ for (iTrack i = tl->begin(); i != tl->end(); ++i) {
+ if ((*i)->name() == editor->text()) {
+ QMessageBox::critical(this,
+ tr("MusE: bad trackname"),
+ tr("please choose a unique track name"),
+ QMessageBox::Ok,
+ Qt::NoButton,
+ Qt::NoButton);
+ editTrack = 0;
+ setFocus();
+ return;
+ }
+ }
+ //Track* track = editTrack->clone();
+ Track* track = editTrack->clone(false);
+ editTrack->setName(editor->text());
+ audio->msgChangeTrack(track, editTrack);
+ }
+ editTrack = 0;
+ editMode = false;
+ setFocus();
+ }
+
+//---------------------------------------------------------
+// adjustScrollbar
+//---------------------------------------------------------
+
+void TList::adjustScrollbar()
+ {
+ int h = 0;
+ TrackList* l = song->tracks();
+ for (iTrack it = l->begin(); it != l->end(); ++it)
+ h += (*it)->height();
+ scroll->setMaxValue(h +30);
+ redraw();
+ }
+
+//---------------------------------------------------------
+// y2Track
+//---------------------------------------------------------
+
+Track* TList::y2Track(int y) const
+ {
+ TrackList* l = song->tracks();
+ int ty = 0;
+ for (iTrack it = l->begin(); it != l->end(); ++it) {
+ int h = (*it)->height();
+ if (y >= ty && y < ty + h)
+ return *it;
+ ty += h;
+ }
+ return 0;
+ }
+
+//---------------------------------------------------------
+// viewMouseDoubleClickEvent
+//---------------------------------------------------------
+
+void TList::mouseDoubleClickEvent(QMouseEvent* ev)
+ {
+ int x = ev->x();
+ int section = header->sectionAt(x);
+ if (section == -1)
+ return;
+
+ Track* t = y2Track(ev->y() + ypos);
+
+ if (t) {
+ int colx = header->sectionPos(section);
+ int colw = header->sectionSize(section);
+ int coly = t->y() - ypos;
+ int colh = t->height();
+
+ if (section == COL_NAME) {
+ editTrack = t;
+ if (editor == 0) {
+ editor = new QLineEdit(this);
+ /*connect(editor, SIGNAL(returnPressed()),
+ SLOT(returnPressed()));*/
+ editor->setFrame(true);
+ }
+ editor->setText(editTrack->name());
+ editor->end(false);
+ editor->setGeometry(colx, coly, colw, colh);
+ editMode = true;
+ editor->show();
+ }
+ else
+ mousePressEvent(ev);
+ }
+ }
+
+//---------------------------------------------------------
+// portsPopupMenu
+//---------------------------------------------------------
+
+void TList::portsPopupMenu(Track* t, int x, int y)
+ {
+ switch(t->type()) {
+ case Track::MIDI:
+ case Track::DRUM:
+ case Track::AUDIO_SOFTSYNTH:
+ {
+ MidiTrack* track = (MidiTrack*)t;
+
+ //QPopupMenu* p = midiPortsPopup(0);
+ MidiDevice* md = 0;
+ int port = -1;
+ if(t->type() == Track::AUDIO_SOFTSYNTH)
+ {
+ //MidiDevice* md = dynamic_cast<MidiDevice*>((SynthI*)t);
+ md = dynamic_cast<MidiDevice*>(t);
+ if(md)
+ port = md->midiPort();
+ }
+ else
+ port = track->outPort();
+
+ Q3PopupMenu* p = midiPortsPopup(0, port);
+ int n = p->exec(mapToGlobal(QPoint(x, y)), 0);
+ if (n != -1) {
+ // Changed by T356.
+ //track->setOutPort(n);
+ //audio->msgSetTrackOutPort(track, n);
+
+ //song->update();
+ if (t->type() == Track::DRUM) {
+ bool change = QMessageBox::question(this, tr("Update drummap?"),
+ tr("Do you want to use same port for all instruments in the drummap?"),
+ tr("&Yes"), tr("&No"), QString::null, 0, 1);
+ audio->msgIdle(true);
+ if (!change)
+ {
+ // Delete all port controller events.
+ //audio->msgChangeAllPortDrumCtrlEvents(false);
+ song->changeAllPortDrumCtrlEvents(false);
+ track->setOutPort(n);
+
+ for (int i=0; i<DRUM_MAPSIZE; i++) //Remap all drum instruments to this port
+ drumMap[i].port = track->outPort();
+ // Add all port controller events.
+ //audio->msgChangeAllPortDrumCtrlEvents(true);
+ song->changeAllPortDrumCtrlEvents(true);
+ }
+ else
+ {
+ //audio->msgSetTrackOutPort(track, n);
+ track->setOutPortAndUpdate(n);
+ }
+ audio->msgIdle(false);
+ song->update();
+ }
+ else
+ if (t->type() == Track::AUDIO_SOFTSYNTH)
+ {
+ if(md != 0)
+ {
+ // Idling is already handled in msgSetMidiDevice.
+ //audio->msgIdle(true);
+
+ // Compiler complains if simple cast from Track to SynthI...
+ midiSeq->msgSetMidiDevice(&midiPorts[n], (midiPorts[n].device() == md) ? 0 : md);
+ muse->changeConfig(true); // save configuration file
+
+ //audio->msgIdle(false);
+ song->update();
+ }
+ }
+ else
+ {
+ audio->msgIdle(true);
+ //audio->msgSetTrackOutPort(track, n);
+ track->setOutPortAndUpdate(n);
+ audio->msgIdle(false);
+ song->update();
+ }
+ }
+ delete p;
+ }
+ break;
+
+ case Track::WAVE:
+ case Track::AUDIO_OUTPUT:
+ case Track::AUDIO_INPUT:
+ case Track::AUDIO_GROUP:
+ case Track::AUDIO_AUX: //TODO
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// oportPropertyPopupMenu
+//---------------------------------------------------------
+
+void TList::oportPropertyPopupMenu(Track* t, int x, int y)
+ {
+ // Added by Tim. p3.3.9
+ if(t->type() == Track::AUDIO_SOFTSYNTH)
+ {
+ SynthI* synth = (SynthI*)t;
+
+ Q3PopupMenu* p = new Q3PopupMenu(this);
+ p->setCheckable(true);
+ p->insertItem(tr("Show Gui"), 0);
+ printf("synth hasgui %d, gui visible %d\n",synth->hasGui(), synth->guiVisible());
+ p->setItemEnabled(0, synth->hasGui());
+ p->setItemChecked(0, synth->guiVisible());
+
+ #ifndef OSC_SUPPORT
+ #ifdef DSSI_SUPPORT
+ if(dynamic_cast<DssiSynthIF*>(synth->sif()))
+ {
+ printf("entering this wierd if statement\n");
+ p->setItemChecked(0, false);
+ p->setItemEnabled(0, false);
+ }
+ #endif
+ #endif
+
+ int n = p->exec(mapToGlobal(QPoint(x, y)), 0);
+ if (n == 0) {
+ bool show = !synth->guiVisible();
+ audio->msgShowInstrumentGui(synth, show);
+ }
+ delete p;
+ return;
+ }
+
+
+ if (t->type() != Track::MIDI && t->type() != Track::DRUM)
+ return;
+ int oPort = ((MidiTrack*)t)->outPort();
+ MidiPort* port = &midiPorts[oPort];
+
+ Q3PopupMenu* p = new Q3PopupMenu(this);
+ p->setCheckable(true);
+ p->insertItem(tr("Show Gui"), 0);
+
+ p->setItemEnabled(0, port->hasGui());
+ p->setItemChecked(0, port->guiVisible());
+
+ #ifndef OSC_SUPPORT
+ #ifdef DSSI_SUPPORT
+ MidiDevice* dev = port->device();
+ if(dev && dev->isSynti() && (dynamic_cast<DssiSynthIF*>(((SynthI*)dev)->sif())))
+ {
+ p->setItemChecked(0, false);
+ p->setItemEnabled(0, false);
+ }
+ #endif
+ #endif
+
+ int n = p->exec(mapToGlobal(QPoint(x, y)), 0);
+ if (n == 0) {
+ bool show = !port->guiVisible();
+ audio->msgShowInstrumentGui(port->instrument(), show);
+ }
+ delete p;
+
+ }
+
+//---------------------------------------------------------
+// tracklistChanged
+//---------------------------------------------------------
+
+void TList::tracklistChanged()
+ {
+ redraw();
+ }
+
+//---------------------------------------------------------
+// keyPressEvent
+//---------------------------------------------------------
+
+void TList::keyPressEvent(QKeyEvent* e)
+ {
+ if (editMode) {
+ // First time we get a keypress event when lineedit is open is on the return key:
+ returnPressed();
+ return;
+ }
+ emit keyPressExt(e); //redirect keypress events to main app
+ e->ignore();
+ /*
+ int key = e->key();
+ switch (key) {
+ case Key_Up:
+ moveSelection(-1);
+ break;
+ case Key_Down:
+ moveSelection(1);
+ break;
+ default:
+
+ break;
+ }
+ */
+ }
+
+//---------------------------------------------------------
+// moveSelection
+//---------------------------------------------------------
+
+void TList::moveSelection(int n)
+ {
+ TrackList* tracks = song->tracks();
+
+ // check for single selection
+ int nselect = 0;
+ for (iTrack t = tracks->begin(); t != tracks->end(); ++t)
+ if ((*t)->selected())
+ ++nselect;
+ if (nselect != 1)
+ return;
+ for (iTrack t = tracks->begin(); t != tracks->end(); ++t) {
+ iTrack s = t;
+ if ((*t)->selected()) {
+ if (n > 0) {
+ while (n--) {
+ ++t;
+ if (t == tracks->end()) {
+ --t;
+ break;
+ }
+ }
+ }
+ else {
+ while (n++ != 0) {
+ if (t == tracks->begin())
+ break;
+ --t;
+ }
+ }
+ (*s)->setSelected(false);
+ (*t)->setSelected(true);
+
+ // rec enable track if expected
+ TrackList recd = getRecEnabledTracks();
+ if (recd.size() == 1 && config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection
+ song->setRecordFlag((Track*)recd.front(),false);
+ song->setRecordFlag((*t),true);
+ }
+
+ if (editTrack && editTrack != *t)
+ returnPressed();
+ redraw();
+ break;
+ }
+ }
+ emit selectionChanged();
+ }
+
+TrackList TList::getRecEnabledTracks()
+{
+ //printf("getRecEnabledTracks\n");
+ TrackList recEnabled;
+ TrackList* tracks = song->tracks();
+ for (iTrack t = tracks->begin(); t != tracks->end(); ++t) {
+ if ((*t)->recordFlag()) {
+ //printf("rec enabled track\n");
+ recEnabled.push_back(*t);
+ }
+ }
+ return recEnabled;
+}
+
+//---------------------------------------------------------
+// mousePressEvent
+//---------------------------------------------------------
+
+void TList::mousePressEvent(QMouseEvent* ev)
+ {
+ int x = ev->x();
+ int y = ev->y();
+ int button = ev->button();
+ bool shift = ev->state() & Qt::ShiftModifier;
+
+ Track* t = y2Track(y + ypos);
+
+ TrackColumn col = TrackColumn(header->sectionAt(x));
+ if (t == 0) {
+ if (button == Qt::RightButton) {
+ Q3PopupMenu* p = new Q3PopupMenu(this);
+ p->clear();
+ p->insertItem(*addtrack_addmiditrackIcon,
+ tr("Add Midi Track"), Track::MIDI, 0);
+ p->insertItem(*addtrack_drumtrackIcon,
+ tr("Add Drum Track"),Track::DRUM, 1);
+ p->insertItem(*addtrack_wavetrackIcon,
+ tr("Add Wave Track"), Track::WAVE, 2);
+ p->insertItem(*addtrack_audiooutputIcon,
+ tr("Add Output"), Track::AUDIO_OUTPUT, 3);
+ p->insertItem(*addtrack_audiogroupIcon,
+ tr("Add Group"), Track::AUDIO_GROUP, 4);
+ p->insertItem(*addtrack_audioinputIcon,
+ tr("Add Input"), Track::AUDIO_INPUT, 5);
+ p->insertItem(*addtrack_auxsendIcon,
+ tr("Add Aux Send"), Track::AUDIO_AUX, 6);
+
+ // Create a sub-menu and fill it with found synth types. Make p the owner.
+ Q3PopupMenu* synp = populateAddSynth(p);
+ // Add the 'Add Synth' sub-menu to the menu.
+ p->insertItem(*synthIcon, tr("Add Synth"), synp, Track::AUDIO_SOFTSYNTH);
+
+ // Show the menu
+ int n = p->exec(ev->globalPos(), 0);
+
+ // Valid click?
+ if((n >= 0) && ((Track::TrackType)n != Track::AUDIO_SOFTSYNTH))
+ {
+ // Synth sub-menu id?
+ if(n >= MENU_ADD_SYNTH_ID_BASE)
+ {
+ n -= MENU_ADD_SYNTH_ID_BASE;
+ //if(n < synthis.size())
+ // t = song->createSynthI(synthis[n]->baseName());
+ //if((n - MENU_ADD_SYNTH_ID_BASE) < (int)synthis.size())
+ if(n < (int)synthis.size())
+ {
+ //t = song->createSynthI(synp->text(n));
+ //t = song->createSynthI(synthis[n]->name());
+ t = song->createSynthI(synthis[n]->baseName(), synthis[n]->name());
+
+ if(t)
+ {
+ // Add instance last in midi device list.
+ for (int i = 0; i < MIDI_PORTS; ++i)
+ {
+ MidiPort* port = &midiPorts[i];
+ MidiDevice* dev = port->device();
+ if (dev==0)
+ {
+ midiSeq->msgSetMidiDevice(port, (SynthI*)t);
+ muse->changeConfig(true); // save configuration file
+ song->update();
+ break;
+ }
+ }
+ }
+ }
+ }
+ // Normal track.
+ else
+ t = song->addTrack((Track::TrackType)n);
+
+ if(t)
+ {
+ song->deselectTracks();
+ t->setSelected(true);
+
+ emit selectionChanged();
+ adjustScrollbar();
+ }
+ }
+
+ // Just delete p, and all its children will go too, right?
+ //delete synp;
+ delete p;
+ }
+ return;
+ }
+
+ TrackList* tracks = song->tracks();
+ dragYoff = y - (t->y() - ypos);
+ startY = y;
+
+ if (resizeFlag) {
+ mode = RESIZE;
+ int y = ev->y();
+ int ty = -ypos;
+ sTrack = 0;
+ for (iTrack it = tracks->begin(); it != tracks->end(); ++it, ++sTrack) {
+ int h = (*it)->height();
+ ty += h;
+ if (y >= (ty-2)) {
+
+ if ( (*it) == tracks->back() && y > ty ) {
+ //printf("tracks->back() && y > ty\n");
+ }
+ else if ( y > (ty+2) ) {
+ //printf(" y > (ty+2) \n");
+ }
+ else {
+ //printf("ogga ogga\n");
+
+ break;
+ }
+
+
+ //&& y < (ty))
+ // break;
+ }
+ }
+
+ return;
+ }
+ mode = START_DRAG;
+
+ switch (col) {
+ case COL_RECORD:
+ {
+ bool val = !(t->recordFlag());
+ if (!t->isMidiTrack()) {
+ if (t->type() == Track::AUDIO_OUTPUT) {
+ if (val && t->recordFlag() == false) {
+ muse->bounceToFile((AudioOutput*)t);
+ }
+ audio->msgSetRecord((AudioOutput*)t, val);
+ if (!((AudioOutput*)t)->recFile())
+ val = false;
+ else
+ return;
+ }
+ song->setRecordFlag(t, val);
+ }
+ else
+ song->setRecordFlag(t, val);
+ }
+ break;
+ case COL_NONE:
+ break;
+ case COL_CLASS:
+ if (t->isMidiTrack())
+ classesPopupMenu(t, x, t->y() - ypos);
+ break;
+ case COL_OPORT:
+ // Changed by Tim. p3.3.9
+ // Reverted.
+ if (button == Qt::LeftButton)
+ portsPopupMenu(t, x, t->y() - ypos);
+ else if (button == Qt::RightButton)
+ oportPropertyPopupMenu(t, x, t->y() - ypos);
+ //if(((button == QMouseEvent::LeftButton) && (t->type() == Track::AUDIO_SOFTSYNTH)) || (button == QMouseEvent::RightButton))
+ // oportPropertyPopupMenu(t, x, t->y() - ypos);
+ //else
+ //if(button == QMouseEvent::LeftButton)
+ // portsPopupMenu(t, x, t->y() - ypos);
+
+ break;
+ case COL_MUTE:
+ // p3.3.29
+ if ((button == Qt::RightButton) || (ev->state() & Qt::ControlModifier))
+ t->setOff(!t->off());
+ else
+ {
+ if (t->off())
+ t->setOff(false);
+ else
+ t->setMute(!t->mute());
+ }
+ song->update(SC_MUTE);
+ break;
+ case COL_SOLO:
+ audio->msgSetSolo(t, !t->solo());
+ song->update(SC_SOLO);
+ break;
+
+ case COL_NAME:
+ if (button == Qt::LeftButton) {
+ if (!shift) {
+ song->deselectTracks();
+ t->setSelected(true);
+
+ // rec enable track if expected
+ TrackList recd = getRecEnabledTracks();
+ if (recd.size() == 1 && config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection
+ song->setRecordFlag((Track*)recd.front(),false);
+ song->setRecordFlag(t,true);
+ }
+ }
+ else
+ t->setSelected(!t->selected());
+ if (editTrack && editTrack != t)
+ returnPressed();
+ emit selectionChanged();
+ }
+ else if (button == Qt::RightButton) {
+ mode = NORMAL;
+ Q3PopupMenu* p = new Q3PopupMenu(this);
+ p->clear();
+ p->insertItem(QIcon(*automation_clear_dataIcon), tr("Delete Track"), 0); // ddskrjo
+ p->insertItem(QIcon(*track_commentIcon), tr("Track Comment"), 1);
+ int n = p->exec(ev->globalPos(), 0);
+ if (n != -1) {
+ switch (n) {
+ case 0: // delete track
+ song->removeTrack0(t);
+ audio->msgUpdateSoloStates();
+ break;
+
+ case 1: // show track comment
+ {
+ TrackComment* tc = new TrackComment(t, 0);
+ tc->show();
+ //QToolTip::add( this, "FOOOOOOOOOOOOO" );
+ }
+ break;
+
+ default:
+ printf("action %d\n", n);
+ break;
+ }
+
+ }
+ delete p;
+ }
+ break;
+
+ case COL_TIMELOCK:
+ t->setLocked(!t->locked());
+ break;
+
+ case COL_OCHANNEL:
+ {
+ int delta = 0;
+ if (button == Qt::RightButton)
+ delta = 1;
+ else if (button == Qt::MidButton)
+ delta = -1;
+ if (t->isMidiTrack())
+ {
+ MidiTrack* mt = dynamic_cast<MidiTrack*>(t);
+ if (mt == 0)
+ break;
+
+ int channel = mt->outChannel();
+ channel += delta;
+ if(channel >= MIDI_CHANNELS)
+ channel = MIDI_CHANNELS - 1;
+ if(channel < 0)
+ channel = 0;
+ //if (channel != ((MidiTrack*)t)->outChannel())
+ if (channel != mt->outChannel())
+ {
+ // Changed by T356.
+ //mt->setOutChannel(channel);
+ audio->msgIdle(true);
+ //audio->msgSetTrackOutChannel(mt, channel);
+ mt->setOutChanAndUpdate(channel);
+ audio->msgIdle(false);
+
+ /* --- I really don't like this, you can mess up the whole map "as easy as dell"
+ if (mt->type() == MidiTrack::DRUM) {//Change channel on all drum instruments
+ for (int i=0; i<DRUM_MAPSIZE; i++)
+ drumMap[i].channel = channel;
+ }*/
+
+ // may result in adding/removing mixer strip:
+ //song->update(-1);
+ //song->update(SC_CHANNELS);
+ song->update(SC_MIDI_CHANNEL);
+ }
+ }
+ else
+ {
+ if(t->type() != Track::AUDIO_SOFTSYNTH)
+ {
+ AudioTrack* at = dynamic_cast<AudioTrack*>(t);
+ if (at == 0)
+ break;
+
+ int n = t->channels() + delta;
+ if (n > MAX_CHANNELS)
+ n = MAX_CHANNELS;
+ else if (n < 1)
+ n = 1;
+ if (n != t->channels()) {
+ audio->msgSetChannels(at, n);
+ song->update(SC_CHANNELS);
+ }
+ }
+ }
+ }
+ break;
+ }
+ redraw();
+ }
+
+//---------------------------------------------------------
+// selectTrack
+//---------------------------------------------------------
+void TList::selectTrack(Track* tr)
+ {
+ song->deselectTracks();
+ tr->setSelected(true);
+
+
+ // rec enable track if expected
+ TrackList recd = getRecEnabledTracks();
+ if (recd.size() == 1 && config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection
+ song->setRecordFlag((Track*)recd.front(),false);
+ song->setRecordFlag(tr,true);
+ }
+
+ // By T356. Force a redraw for wave tracks, since it does not seem to happen.
+ //if(!tr->isMidiTrack())
+ redraw();
+ emit selectionChanged();
+ }
+
+//---------------------------------------------------------
+// selectTrackAbove
+//---------------------------------------------------------
+void TList::selectTrackAbove()
+{
+ moveSelection(-1);
+}
+//---------------------------------------------------------
+// selectTrackBelow
+//---------------------------------------------------------
+void TList::selectTrackBelow()
+{
+ moveSelection(1);
+}
+
+//---------------------------------------------------------
+// mouseMoveEvent
+//---------------------------------------------------------
+
+void TList::mouseMoveEvent(QMouseEvent* ev)
+ {
+ if (ev->state() == 0) {
+ int y = ev->y();
+ int ty = -ypos;
+ TrackList* tracks = song->tracks();
+ iTrack it;
+ for (it = tracks->begin(); it != tracks->end(); ++it) {
+ int h = (*it)->height();
+ ty += h;
+ if (y >= (ty-2)) {
+ if ( (*it) == tracks->back() && y >= ty ) {
+ // outside last track don't change to splitVCursor
+ }
+ else if ( y > (ty+2) ) {
+ //printf(" y > (ty+2) \n");
+ }
+ else {
+ if (!resizeFlag) {
+ resizeFlag = true;
+ setCursor(QCursor(Qt::splitVCursor));
+ }
+ break;
+ }
+ }
+ }
+ if (it == tracks->end() && resizeFlag) {
+ setCursor(QCursor(Qt::arrowCursor));
+ resizeFlag = false;
+ }
+ return;
+ }
+ curY = ev->y();
+ int delta = curY - startY;
+ switch (mode) {
+ case START_DRAG:
+ if (delta < 0)
+ delta = -delta;
+ if (delta <= 2)
+ break;
+ {
+ Track* t = y2Track(startY + ypos);
+ if (t == 0)
+ mode = NORMAL;
+ else {
+ mode = DRAG;
+ dragHeight = t->height();
+ sTrack = song->tracks()->index(t);
+ setCursor(QCursor(Qt::sizeVerCursor));
+ redraw();
+ }
+ }
+ break;
+ case NORMAL:
+ break;
+ case DRAG:
+ redraw();
+ break;
+ case RESIZE:
+ {
+ if(sTrack >= 0 && sTrack < song->tracks()->size())
+ {
+ Track* t = song->tracks()->index(sTrack);
+ if(t)
+ {
+ int h = t->height() + delta;
+ startY = curY;
+ if (h < MIN_TRACKHEIGHT)
+ h = MIN_TRACKHEIGHT;
+ t->setHeight(h);
+ song->update(SC_TRACK_MODIFIED);
+ }
+ }
+ }
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// mouseReleaseEvent
+//---------------------------------------------------------
+
+void TList::mouseReleaseEvent(QMouseEvent* ev)
+ {
+ if (mode == DRAG) {
+ Track* t = y2Track(ev->y() + ypos);
+ if (t) {
+ int dTrack = song->tracks()->index(t);
+ audio->msgMoveTrack(sTrack, dTrack);
+ }
+ }
+ if (mode != NORMAL) {
+ mode = NORMAL;
+ setCursor(QCursor(Qt::arrowCursor));
+ redraw();
+ }
+ if (editTrack)
+ editor->setFocus();
+ adjustScrollbar();
+ }
+
+//---------------------------------------------------------
+// wheelEvent
+//---------------------------------------------------------
+
+void TList::wheelEvent(QWheelEvent* ev)
+ {
+ int x = ev->x();
+ int y = ev->y();
+ Track* t = y2Track(y + ypos);
+ if (t == 0) {
+ emit redirectWheelEvent(ev);
+ return;
+ }
+ TrackColumn col = TrackColumn(header->sectionAt(x));
+ int delta = ev->delta() / WHEEL_DELTA;
+ ev->accept();
+
+ switch (col) {
+ case COL_RECORD:
+ case COL_NONE:
+ case COL_CLASS:
+ case COL_NAME:
+ //case COL_AUTOMATION:
+ break;
+ case COL_MUTE:
+ // p3.3.29
+ if (ev->state() & Qt::ControlModifier)
+ t->setOff(!t->off());
+ else
+ {
+ if (t->off())
+ t->setOff(false);
+ else
+ t->setMute(!t->mute());
+ }
+ song->update(SC_MUTE);
+ break;
+
+ case COL_SOLO:
+ audio->msgSetSolo(t, !t->solo());
+ song->update(SC_SOLO);
+ break;
+
+ case COL_TIMELOCK:
+ t->setLocked(!t->locked());
+ break;
+
+ case COL_OPORT:
+ if (t->isMidiTrack()) {
+ MidiTrack* mt = (MidiTrack*)t;
+ int port = mt->outPort() + delta;
+
+ if (port >= MIDI_PORTS)
+ port = MIDI_PORTS-1;
+ else if (port < 0)
+ port = 0;
+ if (port != ((MidiTrack*)t)->outPort()) {
+ // Changed by T356.
+ //mt->setOutPort(port);
+ audio->msgIdle(true);
+ //audio->msgSetTrackOutPort(mt, port);
+ mt->setOutPortAndUpdate(port);
+ audio->msgIdle(false);
+
+ song->update(SC_ROUTE);
+ }
+ }
+ break;
+
+ case COL_OCHANNEL:
+ if (t->isMidiTrack()) {
+ MidiTrack* mt = (MidiTrack*)t;
+ int channel = mt->outChannel() + delta;
+
+ if (channel >= MIDI_CHANNELS)
+ channel = MIDI_CHANNELS-1;
+ else if (channel < 0)
+ channel = 0;
+ if (channel != ((MidiTrack*)t)->outChannel()) {
+ // Changed by T356.
+ //mt->setOutChannel(channel);
+ audio->msgIdle(true);
+ //audio->msgSetTrackOutChannel(mt, channel);
+ mt->setOutChanAndUpdate(channel);
+ audio->msgIdle(false);
+
+ // may result in adding/removing mixer strip:
+ //song->update(-1);
+ song->update(SC_MIDI_CHANNEL);
+ }
+ }
+ else {
+ int n = t->channels() + delta;
+ if (n > MAX_CHANNELS)
+ n = MAX_CHANNELS;
+ else if (n < 1)
+ n = 1;
+ if (n != t->channels()) {
+ audio->msgSetChannels((AudioTrack*)t, n);
+ song->update(SC_CHANNELS);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void TList::writeStatus(int level, Xml& xml, const char* name) const
+ {
+ xml.tag(level++, name);
+ header->writeStatus(level, xml);
+ xml.etag(level, name);
+ }
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void TList::readStatus(Xml& xml, const char* name)
+ {
+ for (;;) {
+ Xml::Token token(xml.parse());
+ const QString& tag(xml.s1());
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == header->name())
+ header->readStatus(xml);
+ else
+ xml.unknown("Tlist");
+ break;
+ case Xml::TagEnd:
+ if (tag == name)
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// setYPos
+//---------------------------------------------------------
+
+void TList::setYPos(int y)
+ {
+ int delta = ypos - y; // - -> shift up
+ ypos = y;
+ if (pm.isNull())
+ return;
+ if (!pmValid) {
+ //printf("TList::setYPos y:%d delta:%d pmValid is false - redrawing...\n", y, delta);
+ redraw();
+ return;
+ }
+ int w = width();
+ int h = height();
+ QRect r;
+ //printf("TList::setYPos y:%d delta:%d w:%d h:%d\n", y, delta, w, h);
+
+ if (delta >= h || delta <= -h)
+ {
+ //printf("TList::setYPos delta >= h || delta <= -h\n");
+ r = QRect(0, 0, w, h);
+ }
+ else if (delta < 0) { // shift up
+ //printf("TList::setYPos delta < 0 : shift up\n");
+ bitBlt(&pm, 0, 0, &pm, 0, -delta, w, h + delta, true); //CopyROP, true); ddskrjo
+ r = QRect(0, h + delta, w, -delta);
+ }
+ else { // shift down
+ //printf("TList::setYPos delta !< 0 : shift down\n");
+ bitBlt(&pm, 0, delta, &pm, 0, 0, w, h-delta, true); //CopyROP, true); ddskrjo
+
+ // NOTE: June 2 2010: On my machine with an old NV V8200 + prop drivers (curr 96.43.11),
+ // this is a problem. There is severe graphical corruption.
+ // Not just here but several other windows (ex. ladspa browser),
+ // and I believe (?) other QT3 apps. QT4 apps don't do it.
+ // Neither does it happen when xorg drivers used.
+ //
+ // FIXME: This change cures it for me, but we shouldn't leave this in - shouldn't need to do this...
+ //
+ //r = QRect(0, 0, w, delta);
+ // Changed p3.3.43
+ r = QRect(0, 0, w, h);
+
+ }
+ paint(r);
+ update();
+ }
+
+//---------------------------------------------------------
+// resizeEvent
+//---------------------------------------------------------
+
+void TList::resizeEvent(QResizeEvent* ev)
+ {
+ pm.resize(ev->size());
+ pmValid = false;
+ }
+
+//---------------------------------------------------------
+// classesPopupMenu
+//---------------------------------------------------------
+
+void TList::classesPopupMenu(Track* t, int x, int y)
+ {
+ Q3PopupMenu p(this);
+ p.clear();
+ p.insertItem(QIcon(*addtrack_addmiditrackIcon), tr("Midi"), Track::MIDI);
+ p.insertItem(QIcon(*addtrack_drumtrackIcon), tr("Drum"), Track::DRUM);
+ int n = p.exec(mapToGlobal(QPoint(x, y)), 0);
+
+ if (n == -1)
+ return;
+
+ if (Track::TrackType(n) == Track::MIDI && t->type() == Track::DRUM) {
+ //
+ // Drum -> Midi
+ //
+ audio->msgIdle(true);
+ PartList* pl = t->parts();
+ MidiTrack* m = (MidiTrack*) t;
+ for (iPart ip = pl->begin(); ip != pl->end(); ++ip) {
+ EventList* el = ip->second->events();
+ for (iEvent ie = el->begin(); ie != el->end(); ++ie) {
+ Event ev = ie->second;
+ if(ev.type() == Note)
+ {
+ int pitch = ev.pitch();
+ // Changed by T356.
+ // Tested: Notes were being mixed up switching back and forth between midi and drum.
+ //pitch = drumMap[pitch].anote;
+ pitch = drumMap[pitch].enote;
+
+ ev.setPitch(pitch);
+ }
+ else
+ if(ev.type() == Controller)
+ {
+ int ctl = ev.dataA();
+ // Is it a drum controller event, according to the track port's instrument?
+ MidiController *mc = midiPorts[m->outPort()].drumController(ctl);
+ if(mc)
+ // Change the controller event's index into the drum map to an instrument note.
+ ev.setA((ctl & ~0xff) | drumMap[ctl & 0x7f].enote);
+ }
+
+ }
+ }
+ t->setType(Track::MIDI);
+ audio->msgIdle(false);
+ }
+ else if (Track::TrackType(n) == Track::DRUM && t->type() == Track::MIDI) {
+ //
+ // Midi -> Drum
+ //
+ bool change = QMessageBox::question(this, tr("Update drummap?"),
+ tr("Do you want to use same port and channel for all instruments in the drummap?"),
+ tr("&Yes"), tr("&No"), QString::null, 0, 1);
+
+ audio->msgIdle(true);
+ // Delete all port controller events.
+ //audio->msgChangeAllPortDrumCtrlEvents(false);
+ song->changeAllPortDrumCtrlEvents(false);
+
+ if (!change) {
+ MidiTrack* m = (MidiTrack*) t;
+ for (int i=0; i<DRUM_MAPSIZE; i++) {
+ drumMap[i].channel = m->outChannel();
+ drumMap[i].port = m->outPort();
+ }
+ }
+
+ //audio->msgIdle(true);
+ PartList* pl = t->parts();
+ MidiTrack* m = (MidiTrack*) t;
+ for (iPart ip = pl->begin(); ip != pl->end(); ++ip) {
+ EventList* el = ip->second->events();
+ for (iEvent ie = el->begin(); ie != el->end(); ++ie) {
+ Event ev = ie->second;
+ if (ev.type() == Note)
+ {
+ int pitch = ev.pitch();
+ pitch = drumInmap[pitch];
+ ev.setPitch(pitch);
+ }
+ else
+ {
+ if(ev.type() == Controller)
+ {
+ int ctl = ev.dataA();
+ // Is it a drum controller event, according to the track port's instrument?
+ MidiController *mc = midiPorts[m->outPort()].drumController(ctl);
+ if(mc)
+ // Change the controller event's instrument note to an index into the drum map.
+ ev.setA((ctl & ~0xff) | drumInmap[ctl & 0x7f]);
+ }
+
+ }
+
+ }
+ }
+ t->setType(Track::DRUM);
+
+ // Add all port controller events.
+ //audio->msgChangeAllPortDrumCtrlEvents(true);
+ song->changeAllPortDrumCtrlEvents(true);
+
+ audio->msgIdle(false);
+ }
+ }
+
diff --git a/muse2/muse/arranger/tlist.h b/muse2/muse/arranger/tlist.h
new file mode 100644
index 00000000..147a61e2
--- /dev/null
+++ b/muse2/muse/arranger/tlist.h
@@ -0,0 +1,131 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: tlist.h,v 1.8.2.5 2008/01/19 13:33:46 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __TLIST_H__
+#define __TLIST_H__
+
+#include <qtooltip.h>
+#include <q3whatsthis.h>
+#include <q3header.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <QResizeEvent>
+#include <QWheelEvent>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QPaintEvent>
+#include "track.h"
+
+class QPainter;
+class ScrollScale;
+class QScrollBar;
+class QLineEdit;
+class Track;
+class Xml;
+class Header;
+
+enum TrackColumn {
+ COL_RECORD = 0,
+ COL_MUTE,
+ COL_SOLO,
+ COL_CLASS,
+ COL_NAME,
+ COL_OPORT,
+ COL_OCHANNEL,
+ COL_TIMELOCK,
+ COL_NONE = -1
+ };
+// COL_AUTOMATION, -- not enabled
+
+//----------------------------------------------------------
+// THeaderTip
+//----------------------------------------------------------
+
+class THeaderTip { //: public QToolTip { ddskrjo
+
+ public:
+ THeaderTip(QWidget * parent) {} //: QToolTip(parent) {} ddskrjo
+ virtual ~THeaderTip() {}
+ protected:
+ void maybeTip(const QPoint &);
+ };
+
+//---------------------------------------------------------
+// TList
+//---------------------------------------------------------
+
+class TList : public QWidget {
+ Q_OBJECT
+
+ int ypos;
+ bool editMode;
+
+ QPixmap pm; // for double buffering
+ bool pmValid;
+ QPixmap bgPixmap; // background Pixmap
+
+ bool resizeFlag; // true if resize cursor is shown
+
+ Header* header;
+ QScrollBar* scroll;
+ QLineEdit* editor;
+ Track* editTrack;
+
+ int startY;
+ int curY;
+ int sTrack;
+ int dragHeight;
+ int dragYoff;
+
+ enum { NORMAL, START_DRAG, DRAG, RESIZE} mode;
+
+ virtual void paintEvent(QPaintEvent*);
+ virtual void mousePressEvent(QMouseEvent* event);
+ virtual void mouseDoubleClickEvent(QMouseEvent*);
+ virtual void mouseMoveEvent(QMouseEvent*);
+ virtual void mouseReleaseEvent(QMouseEvent*);
+ virtual void keyPressEvent(QKeyEvent* e);
+ virtual void wheelEvent(QWheelEvent* e);
+
+ void portsPopupMenu(Track*, int, int);
+ void oportPropertyPopupMenu(Track*, int x, int y);
+ void moveSelection(int n);
+ void adjustScrollbar();
+ void paint(const QRect& r);
+ virtual void resizeEvent(QResizeEvent*);
+ void redraw(const QRect& r);
+ Track* y2Track(int) const;
+ void classesPopupMenu(Track*, int x, int y);
+ TrackList getRecEnabledTracks();
+
+ private slots:
+ void returnPressed();
+ void songChanged(int flags);
+
+ signals:
+ void selectionChanged();
+ void keyPressExt(QKeyEvent*);
+ void redirectWheelEvent(QWheelEvent*);
+
+ public slots:
+ void tracklistChanged();
+ void setYPos(int);
+ void redraw();
+ void selectTrack(Track*);
+ void selectTrackAbove();
+ void selectTrackBelow();
+
+ public:
+ TList(Header*, QWidget* parent, const char* name);
+ void setScroll(QScrollBar* s) { scroll = s; }
+ Track* track() const { return editTrack; }
+ void writeStatus(int level, Xml&, const char* name) const;
+ void readStatus(Xml&, const char* name);
+ };
+
+#endif
+
diff --git a/muse2/muse/arranger/trackautomationview.cpp b/muse2/muse/arranger/trackautomationview.cpp
new file mode 100644
index 00000000..43abcc69
--- /dev/null
+++ b/muse2/muse/arranger/trackautomationview.cpp
@@ -0,0 +1,53 @@
+#include "trackautomationview.h"
+#include "math.h"
+#include <qpainter.h>
+#include <qbitmap.h>
+#include <qimage.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+#include "track.h"
+
+TrackAutomationView::TrackAutomationView(QWidget *parent, Track *t) : QWidget(parent)
+{
+ printf("created trackautomationview\n");
+ _t = t;
+ //show();
+}
+
+void TrackAutomationView::paintEvent(QPaintEvent* e)
+{
+ QPainter p(this);
+ const QRect &r = e->rect();
+
+ // temporary solution, audio track drawing moved here.
+ // best would be to get transparency to work correctly
+ p.setPen(QPen(Qt::black, 2, Qt::SolidLine));
+ p.setBrush(Qt::gray);
+ p.drawRect(r);
+
+ int height=r.bottom()-r.top();
+ if( _t->type()>1) { // audio type
+ double volume = ((AudioTrack*)_t)->volume();
+ double dbvolume = (20.0*log10(volume)+60) /70.0; // represent volume between 0 and 1
+ if (dbvolume < 0) dbvolume =0.0;
+ printf("height=%d volume=%f dbvolume=%f\n", height, volume, dbvolume);
+ p.setPen(QPen(Qt::yellow,1,Qt::SolidLine));
+ p.drawLine(r.left(),r.bottom()-dbvolume*height,r.right(),r.bottom()-dbvolume*height);
+
+ }
+
+
+
+ printf("paintEvent\n");
+}
+
+void TrackAutomationView::collectAutomationData()
+{
+ // here we should collect all automation data that is currently selected for viewing and
+ // prepare an event list that is easy to draw in paintEvent
+ // the main reason being that the event list in it's entirety likely contains too much data to
+ // be processed in the paintEvent. Better to preprocess.
+
+// CtrlListList cll =((AudioTrack*)_t)->controller();
+// cll.count()
+}
diff --git a/muse2/muse/arranger/trackautomationview.h b/muse2/muse/arranger/trackautomationview.h
new file mode 100644
index 00000000..2631035e
--- /dev/null
+++ b/muse2/muse/arranger/trackautomationview.h
@@ -0,0 +1,21 @@
+#ifndef TRACKAUTOMATIONVIEW_H
+#define TRACKAUTOMATIONVIEW_H
+
+#include <qwidget.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+
+#include "track.h"
+
+class TrackAutomationView : public QWidget
+{
+ Track *_t;
+ void paintEvent(QPaintEvent *e);
+ std::map<int,int> automationList;
+public:
+ TrackAutomationView(QWidget *parent, Track *t);
+ Track *track() { return _t; }
+ void collectAutomationData();
+};
+
+#endif // TRACKAUTOMATIONVIEW_H
diff --git a/muse2/muse/arranger/trackinfo.cpp b/muse2/muse/arranger/trackinfo.cpp
new file mode 100644
index 00000000..a6bf0a4e
--- /dev/null
+++ b/muse2/muse/arranger/trackinfo.cpp
@@ -0,0 +1,1570 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: trackinfo.cpp,v 1.10.2.15 2009/11/14 03:37:48 terminator356 Exp $
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qlayout.h>
+#include <qcombobox.h>
+#include <qtoolbutton.h>
+#include <qlabel.h>
+#include <q3popupmenu.h>
+#include <qmessagebox.h>
+#include <q3hbox.h>
+#include <qcheckbox.h>
+#include <qpushbutton.h>
+#include <q3widgetstack.h>
+#include <qlineedit.h>
+#include <qtimer.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <math.h>
+#include <string.h>
+
+#include "song.h"
+#include "globals.h"
+#include "spinbox.h"
+#include "config.h"
+#include "gconfig.h"
+#include "arranger.h"
+#include "midiport.h"
+#include "mididev.h"
+#include "utils.h"
+#include "tlist.h"
+//#include "mtrackinfobase.h"
+#include "alayout.h"
+#include "audio.h"
+#include "mixer/amixer.h"
+#include "midi.h"
+#include "midictrl.h"
+#include "xpm/muse_leftside_logo.xpm"
+#include "mixer/astrip.h"
+#include "icons.h"
+#include "app.h"
+#include "route.h"
+#include "popupmenu.h"
+
+
+//---------------------------------------------------------
+// midiTrackInfoHeartBeat
+//---------------------------------------------------------
+
+void Arranger::midiTrackInfoHeartBeat()
+{
+ if(!showTrackinfoFlag || !selected)
+ return;
+ switch(selected->type())
+ {
+ case Track::MIDI:
+ case Track::DRUM:
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+
+ int outChannel = track->outChannel();
+ int outPort = track->outPort();
+ ///int ichMask = track->inChannelMask();
+ //int iptMask = track->inPortMask();
+ ///unsigned int iptMask = track->inPortMask();
+
+ MidiPort* mp = &midiPorts[outPort];
+
+ // Set record echo.
+ if(midiTrackInfo->recEchoButton->isOn() != track->recEcho())
+ {
+ midiTrackInfo->recEchoButton->blockSignals(true);
+ midiTrackInfo->recEchoButton->setOn(track->recEcho());
+ midiTrackInfo->recEchoButton->blockSignals(false);
+ }
+
+ // Check for detection of midi general activity on chosen channels...
+ int mpt = 0;
+ //int mch = 0;
+ RouteList* rl = track->inRoutes();
+
+ ciRoute r = rl->begin();
+ //for( ; mpt < MIDI_PORTS; ++mpt)
+ for( ; r != rl->end(); ++r)
+ {
+ //if(!r->isValid() || ((r->type != Route::ALSA_MIDI_ROUTE) && (r->type != Route::JACK_MIDI_ROUTE)))
+ //if(!r->isValid() || (r->type != Route::MIDI_DEVICE_ROUTE))
+ if(!r->isValid() || (r->type != Route::MIDI_PORT_ROUTE)) // p3.3.49
+ continue;
+
+ // NOTE: TODO: Code for channelless events like sysex, ** IF we end up using the 'special channel 17' method.
+ //if(r->channel == -1)
+ if(r->channel == -1 || r->channel == 0) // p3.3.50
+ continue;
+
+ // No port assigned to the device?
+ //mpt = r->device->midiPort();
+ mpt = r->midiPort; // p3.3.49
+ if(mpt < 0 || mpt >= MIDI_PORTS)
+ continue;
+
+ //for(; mch < MIDI_CHANNELS; ++mch)
+ //{
+ //if(midiPorts[mpt].syncInfo().actDetect(mch) && (iptMask & (1 << mpt)) && (ichMask & (1 << mch)) )
+ //if((iptMask & bitShiftLU[mpt]) && (midiPorts[mpt].syncInfo().actDetectBits() & ichMask) )
+ //if(midiPorts[mpt].syncInfo().actDetectBits() & bitShiftLU[r->channel])
+ if(midiPorts[mpt].syncInfo().actDetectBits() & r->channel) // p3.3.50 Use new channel mask.
+ {
+ //if(midiTrackInfo->iChanTextLabel->paletteBackgroundColor() != green)
+ // midiTrackInfo->iChanTextLabel->setPaletteBackgroundColor(green);
+ //if(midiTrackInfo->iChanDetectLabel->pixmap() != greendotIcon)
+ if(!midiTrackInfo->_midiDetect)
+ {
+ //printf("Arranger::midiTrackInfoHeartBeat setting green icon\n");
+
+ midiTrackInfo->_midiDetect = true;
+ //midiTrackInfo->iChanDetectLabel->setPixmap(*greendotIcon);
+ midiTrackInfo->iChanDetectLabel->setPixmap(*redLedIcon);
+ }
+ break;
+ }
+ //}
+ }
+ // No activity detected?
+ //if(mch == MIDI_CHANNELS)
+ //if(mpt == MIDI_PORTS)
+ if(r == rl->end())
+ {
+ //if(midiTrackInfo->iChanTextLabel->paletteBackgroundColor() != darkGreen)
+ // midiTrackInfo->iChanTextLabel->setPaletteBackgroundColor(darkGreen);
+ //if(midiTrackInfo->iChanDetectLabel->pixmap() != darkgreendotIcon)
+ if(midiTrackInfo->_midiDetect)
+ {
+ //printf("Arranger::midiTrackInfoHeartBeat setting darkgreen icon\n");
+
+ midiTrackInfo->_midiDetect = false;
+ //midiTrackInfo->iChanDetectLabel->setPixmap(*darkgreendotIcon);
+ midiTrackInfo->iChanDetectLabel->setPixmap(*darkRedLedIcon);
+ }
+ }
+
+ int nprogram = mp->hwCtrlState(outChannel, CTRL_PROGRAM);
+ if(nprogram == CTRL_VAL_UNKNOWN)
+ {
+ if(program != CTRL_VAL_UNKNOWN)
+ {
+ //printf("Arranger::midiTrackInfoHeartBeat setting program to unknown\n");
+
+ program = CTRL_VAL_UNKNOWN;
+ if(midiTrackInfo->iHBank->value() != 0)
+ {
+ midiTrackInfo->iHBank->blockSignals(true);
+ midiTrackInfo->iHBank->setValue(0);
+ midiTrackInfo->iHBank->blockSignals(false);
+ }
+ if(midiTrackInfo->iLBank->value() != 0)
+ {
+ midiTrackInfo->iLBank->blockSignals(true);
+ midiTrackInfo->iLBank->setValue(0);
+ midiTrackInfo->iLBank->blockSignals(false);
+ }
+ if(midiTrackInfo->iProgram->value() != 0)
+ {
+ midiTrackInfo->iProgram->blockSignals(true);
+ midiTrackInfo->iProgram->setValue(0);
+ midiTrackInfo->iProgram->blockSignals(false);
+ }
+ }
+
+ nprogram = mp->lastValidHWCtrlState(outChannel, CTRL_PROGRAM);
+ if(nprogram == CTRL_VAL_UNKNOWN)
+ {
+ //const char* n = "<unknown>";
+ const QString n(tr("<unknown>"));
+ //if(strcmp(midiTrackInfo->iPatch->text().latin1(), n) != 0)
+ if(midiTrackInfo->iPatch->text() != n)
+ {
+ //printf("Arranger::midiTrackInfoHeartBeat setting patch <unknown>\n");
+
+ midiTrackInfo->iPatch->setText(n);
+ }
+ }
+ else
+ {
+ MidiInstrument* instr = mp->instrument();
+ const char* name = instr->getPatchName(outChannel, nprogram, song->mtype(), track->type() == Track::DRUM);
+ if(!name)
+ {
+ if(midiTrackInfo->iPatch->text() != ("???"))
+ midiTrackInfo->iPatch->setText("???");
+ }
+ else
+ if(strcmp(midiTrackInfo->iPatch->text().latin1(), name) != 0)
+ {
+ //printf("Arranger::midiTrackInfoHeartBeat setting patch name\n");
+
+ midiTrackInfo->iPatch->setText(name);
+ }
+ }
+ }
+ else
+ if(program != nprogram)
+ {
+ program = nprogram;
+
+ //int hb, lb, pr;
+ //if (program == CTRL_VAL_UNKNOWN) {
+ // hb = lb = pr = 0;
+ // iPatch->setText("---");
+ // }
+ //else
+ //{
+ MidiInstrument* instr = mp->instrument();
+ const char* name = instr->getPatchName(outChannel, program, song->mtype(), track->type() == Track::DRUM);
+ if(strcmp(midiTrackInfo->iPatch->text().latin1(), name) != 0)
+ midiTrackInfo->iPatch->setText(QString(name));
+
+ int hb = ((program >> 16) & 0xff) + 1;
+ if (hb == 0x100)
+ hb = 0;
+ int lb = ((program >> 8) & 0xff) + 1;
+ if (lb == 0x100)
+ lb = 0;
+ int pr = (program & 0xff) + 1;
+ if (pr == 0x100)
+ pr = 0;
+ //}
+
+ //printf("Arranger::midiTrackInfoHeartBeat setting program\n");
+
+ if(midiTrackInfo->iHBank->value() != hb)
+ {
+ midiTrackInfo->iHBank->blockSignals(true);
+ midiTrackInfo->iHBank->setValue(hb);
+ midiTrackInfo->iHBank->blockSignals(false);
+ }
+ if(midiTrackInfo->iLBank->value() != lb)
+ {
+ midiTrackInfo->iLBank->blockSignals(true);
+ midiTrackInfo->iLBank->setValue(lb);
+ midiTrackInfo->iLBank->blockSignals(false);
+ }
+ if(midiTrackInfo->iProgram->value() != pr)
+ {
+ midiTrackInfo->iProgram->blockSignals(true);
+ midiTrackInfo->iProgram->setValue(pr);
+ midiTrackInfo->iProgram->blockSignals(false);
+ }
+
+ }
+
+ MidiController* mc = mp->midiController(CTRL_VOLUME);
+ int mn = mc->minVal();
+ int v = mp->hwCtrlState(outChannel, CTRL_VOLUME);
+ if(v == CTRL_VAL_UNKNOWN)
+ //{
+ //v = mc->initVal();
+ //if(v == CTRL_VAL_UNKNOWN)
+ // v = 0;
+ v = mn - 1;
+ //}
+ else
+ // Auto bias...
+ v -= mc->bias();
+ if(volume != v)
+ {
+ volume = v;
+ if(midiTrackInfo->iLautst->value() != v)
+ {
+ //printf("Arranger::midiTrackInfoHeartBeat setting volume\n");
+
+ midiTrackInfo->iLautst->blockSignals(true);
+ //midiTrackInfo->iLautst->setRange(mn - 1, mc->maxVal());
+ midiTrackInfo->iLautst->setValue(v);
+ midiTrackInfo->iLautst->blockSignals(false);
+ }
+ }
+
+ mc = mp->midiController(CTRL_PANPOT);
+ mn = mc->minVal();
+ v = mp->hwCtrlState(outChannel, CTRL_PANPOT);
+ if(v == CTRL_VAL_UNKNOWN)
+ //{
+ //v = mc->initVal();
+ //if(v == CTRL_VAL_UNKNOWN)
+ // v = 0;
+ v = mn - 1;
+ //}
+ else
+ // Auto bias...
+ v -= mc->bias();
+ if(pan != v)
+ {
+ pan = v;
+ if(midiTrackInfo->iPan->value() != v)
+ {
+ //printf("Arranger::midiTrackInfoHeartBeat setting pan\n");
+
+ midiTrackInfo->iPan->blockSignals(true);
+ //midiTrackInfo->iPan->setRange(mn - 1, mc->maxVal());
+ midiTrackInfo->iPan->setValue(v);
+ midiTrackInfo->iPan->blockSignals(false);
+ }
+ }
+
+ // Does it include a midi controller value adjustment? Then handle it...
+ //if(flags & SC_MIDI_CONTROLLER)
+ // seek();
+
+ /*
+ if(midiTrackInfo->iTransp->value() != track->transposition)
+ midiTrackInfo->iTransp->setValue(track->transposition);
+ if(midiTrackInfo->iAnschl->value() != track->velocity)
+ midiTrackInfo->iAnschl->setValue(track->velocity);
+ if(midiTrackInfo->iVerz->value() != track->delay)
+ midiTrackInfo->iVerz->setValue(track->delay);
+ if(midiTrackInfo->iLen->value() != track->len)
+ midiTrackInfo->iLen->setValue(track->len);
+ if(midiTrackInfo->iKompr->value() != track->compression)
+ midiTrackInfo->iKompr->setValue(track->compression);
+ */
+ }
+ break;
+
+ case Track::WAVE:
+ case Track::AUDIO_OUTPUT:
+ case Track::AUDIO_INPUT:
+ case Track::AUDIO_GROUP:
+ case Track::AUDIO_AUX:
+ case Track::AUDIO_SOFTSYNTH:
+ break;
+ }
+}
+
+//---------------------------------------------------------
+// showTrackInfo
+//---------------------------------------------------------
+
+void Arranger::showTrackInfo(bool flag)
+ {
+ showTrackinfoFlag = flag;
+ trackInfo->setShown(flag);
+ infoScroll->setShown(flag);
+ updateTrackInfo(-1);
+ }
+
+//---------------------------------------------------------
+// genTrackInfo
+//---------------------------------------------------------
+
+void Arranger::genTrackInfo(QWidget* parent)
+ {
+ trackInfo = new WidgetStack(parent, "trackInfoStack");
+
+ noTrackInfo = new QWidget(trackInfo);
+ QPixmap *noInfoPix = new QPixmap(160, 1000); //muse_leftside_logo_xpm);
+ const QPixmap *logo = new QPixmap(muse_leftside_logo_xpm);
+ noInfoPix->fill(noTrackInfo->paletteBackgroundColor() );
+ copyBlt(noInfoPix, 10, 0, logo, 0,0, logo->width(), logo->height());
+ noTrackInfo->setPaletteBackgroundPixmap(*noInfoPix);
+ noTrackInfo->setGeometry(0, 0, 65, 200);
+ noTrackInfo->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding));
+
+ midiTrackInfo = new MidiTrackInfo(trackInfo);
+ trackInfo->addWidget(noTrackInfo, 0);
+ trackInfo->addWidget(midiTrackInfo, 1);
+ trackInfo->addWidget(0, 2);
+
+ genMidiTrackInfo();
+ }
+
+//---------------------------------------------------------
+// updateTrackInfo
+//---------------------------------------------------------
+
+void Arranger::updateTrackInfo(int flags)
+ {
+ if (!showTrackinfoFlag) {
+ switchInfo(-1);
+ return;
+ }
+ if (selected == 0) {
+ switchInfo(0);
+ return;
+ }
+ if (selected->isMidiTrack()) {
+ switchInfo(1);
+ updateMidiTrackInfo(flags);
+ }
+ else {
+ switchInfo(2);
+ }
+ }
+
+//---------------------------------------------------------
+// switchInfo
+//---------------------------------------------------------
+
+void Arranger::switchInfo(int n)
+ {
+ if (n == 2) {
+ AudioStrip* w = (AudioStrip*)(trackInfo->getWidget(2));
+ if (w == 0 || selected != w->getTrack()) {
+ if (w)
+ delete w;
+ w = new AudioStrip(trackInfo, (AudioTrack*)selected);
+ connect(song, SIGNAL(songChanged(int)), w, SLOT(songChanged(int)));
+ connect(muse, SIGNAL(configChanged()), w, SLOT(configChanged()));
+ w->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+ trackInfo->addWidget(w, 2);
+ w->show();
+ tgrid->activate();
+ }
+ }
+ if (trackInfo->curIdx() == n)
+ return;
+ trackInfo->raiseWidget(n);
+ tgrid->activate();
+ }
+
+//---------------------------------------------------------
+// setTrackInfoLabelText
+//---------------------------------------------------------
+
+void Arranger::setTrackInfoLabelText()
+{
+ MidiTrack* track = (MidiTrack*)selected;
+ if(track)
+ midiTrackInfo->trackNameLabel->setText(track->name());
+ else
+ midiTrackInfo->trackNameLabel->setText(QString());
+}
+
+//---------------------------------------------------------
+// setTrackInfoLabelFont
+//---------------------------------------------------------
+
+void Arranger::setTrackInfoLabelFont()
+{
+ MidiTrack* track = (MidiTrack*)selected;
+ if(!track)
+ return;
+
+ // Use the new font #6 I created just for these labels (so far).
+ // Set the label's font.
+ midiTrackInfo->trackNameLabel->setFont(config.fonts[6]);
+ // Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size.
+ //autoAdjustFontSize(midiTrackInfo->trackNameLabel, midiTrackInfo->trackNameLabel->text(), false, true, config.fonts[6].pointSize(), 5); ddskrjo
+}
+
+// Removed by Tim. p3.3.9
+
+/*
+//---------------------------------------------------------
+// iNameChanged
+//---------------------------------------------------------
+
+void Arranger::iNameChanged()
+ {
+ QString txt = midiTrackInfo->iName->text();
+ if (txt == selected->name())
+ return;
+
+ TrackList* tl = song->tracks();
+ for(iTrack i = tl->begin(); i != tl->end(); ++i)
+ {
+ if((*i)->name() == txt)
+ {
+ // Restore the text.
+ midiTrackInfo->iName->blockSignals(true);
+ midiTrackInfo->iName->setText(selected->name());
+ midiTrackInfo->iName->blockSignals(false);
+
+ QMessageBox::critical(this,
+ tr("MusE: bad trackname"),
+ tr("please choose a unique track name"),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton);
+
+ midiTrackInfo->iName->setFocus();
+ return;
+ }
+ }
+
+ //Track* track = selected->clone();
+ Track* track = selected->clone(false);
+ selected->setName(txt);
+ audio->msgChangeTrack(track, selected);
+ }
+*/
+
+//---------------------------------------------------------
+// iOutputChannelChanged
+//---------------------------------------------------------
+
+void Arranger::iOutputChannelChanged(int channel)
+ {
+ --channel;
+ MidiTrack* track = (MidiTrack*)selected;
+ if (channel != track->outChannel()) {
+ // Changed by T356.
+ //track->setOutChannel(channel);
+ audio->msgIdle(true);
+ //audio->msgSetTrackOutChannel(track, channel);
+ track->setOutChanAndUpdate(channel);
+ audio->msgIdle(false);
+
+ // may result in adding/removing mixer strip:
+ //song->update(-1);
+ song->update(SC_MIDI_CHANNEL);
+ }
+ }
+
+/*
+//---------------------------------------------------------
+// iKanalChanged
+//---------------------------------------------------------
+
+void Arranger::iInputChannelChanged(const QString& s)
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ int val = string2bitmap(s);
+ if (val != track->inChannelMask()) {
+ track->setInChannelMask(val);
+ list->redraw();
+ }
+ }
+*/
+
+//---------------------------------------------------------
+// iOutputPortChanged
+//---------------------------------------------------------
+
+void Arranger::iOutputPortChanged(int index)
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ if (index == track->outPort())
+ return;
+ // Changed by T356.
+ //track->setOutPort(index);
+ audio->msgIdle(true);
+ //audio->msgSetTrackOutPort(track, index);
+ track->setOutPortAndUpdate(index);
+ audio->msgIdle(false);
+
+ list->redraw();
+ }
+
+/*
+//---------------------------------------------------------
+// iInputPortChanged
+//---------------------------------------------------------
+
+void Arranger::iInputPortChanged(const QString& s)
+ {
+ // Changed by Tim. p3.3.8
+ //int val = string2bitmap(s);
+ unsigned int val = string2u32bitmap(s);
+
+ MidiTrack* track = (MidiTrack*)selected;
+ if (val == track->inPortMask())
+ return;
+ track->setInPortMask(val);
+ list->redraw();
+ }
+*/
+
+//---------------------------------------------------------
+// routingPopupMenuActivated
+//---------------------------------------------------------
+
+void Arranger::routingPopupMenuActivated(int n)
+{
+ //if(gRoutingPopupMenuMaster != this || !track || !track->isMidiTrack())
+ if(!midiTrackInfo || gRoutingPopupMenuMaster != midiTrackInfo || !selected || !selected->isMidiTrack())
+ return;
+ //if (n > 999) {
+ //if (n >= MIDI_PORTS * MIDI_CHANNELS) { // p3.3.50
+ // for (int i = 0; i < MIDI_CHANNELS; i++)
+ //muse->routingPopupMenuActivated(selected, i + MIDI_CHANNELS * (n-1000));
+ // muse->routingPopupMenuActivated(selected, i + MIDI_CHANNELS * (n - MIDI_PORTS * MIDI_CHANNELS)); // p3.3.50
+ //}
+ //else {
+ muse->routingPopupMenuActivated(selected, n);
+ //}
+}
+
+//---------------------------------------------------------
+// inRoutesPressed
+//---------------------------------------------------------
+
+void Arranger::inRoutesPressed()
+{
+ if(!selected)
+ return;
+
+ ///song->chooseMidiRoutes(midiTrackInfo->iRButton, (MidiTrack*)selected, false);
+
+ if(!selected->isMidiTrack())
+ return;
+
+ //song->chooseMidiRoutes(iR, (MidiTrack*)track, false);
+ PopupMenu* pup = muse->prepareRoutingPopupMenu(selected, false);
+ if(!pup)
+ return;
+
+ //pup->disconnect();
+ //gRoutingPopupMenuMaster = this;
+ gRoutingPopupMenuMaster = midiTrackInfo;
+ connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
+ // Nope, can't clear menu and mm list in there, sub-menus stay open. Never mind for now...
+ connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
+ pup->popup(QCursor::pos(), 0);
+ midiTrackInfo->iRButton->setDown(false);
+ return;
+}
+
+//---------------------------------------------------------
+// outRoutesPressed
+//---------------------------------------------------------
+
+void Arranger::outRoutesPressed()
+{
+ if(!selected)
+ return;
+
+ ///song->chooseMidiRoutes(midiTrackInfo->oRButton, (MidiTrack*)selected, true);
+
+ if(!selected->isMidiTrack())
+ return;
+
+ //song->chooseMidiRoutes(iR, (MidiTrack*)track, false);
+ PopupMenu* pup = muse->prepareRoutingPopupMenu(selected, true);
+ if(!pup)
+ return;
+
+ //pup->disconnect();
+ //gRoutingPopupMenuMaster = this;
+ gRoutingPopupMenuMaster = midiTrackInfo;
+ connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
+ // Nope, can't clear menu and mm list in there, sub-menus stay open. Never mind for now...
+ connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
+ pup->popup(QCursor::pos(), 0);
+ midiTrackInfo->oRButton->setDown(false);
+ return;
+}
+
+//---------------------------------------------------------
+// iProgHBankChanged
+//---------------------------------------------------------
+
+void Arranger::iProgHBankChanged()
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ int channel = track->outChannel();
+ int port = track->outPort();
+ int hbank = midiTrackInfo->iHBank->value();
+ int lbank = midiTrackInfo->iLBank->value();
+ int prog = midiTrackInfo->iProgram->value();
+
+ if (hbank > 0 && hbank < 129)
+ hbank -= 1;
+ else
+ hbank = 0xff;
+ if (lbank > 0 && lbank < 129)
+ lbank -= 1;
+ else
+ lbank = 0xff;
+ if (prog > 0 && prog < 129)
+ prog -= 1;
+ else
+ prog = 0xff;
+
+ MidiPort* mp = &midiPorts[port];
+ if(prog == 0xff && hbank == 0xff && lbank == 0xff)
+ {
+ program = CTRL_VAL_UNKNOWN;
+ if(mp->hwCtrlState(channel, CTRL_PROGRAM) != CTRL_VAL_UNKNOWN)
+ audio->msgSetHwCtrlState(mp, channel, CTRL_PROGRAM, CTRL_VAL_UNKNOWN);
+ return;
+ }
+
+ int np = mp->hwCtrlState(channel, CTRL_PROGRAM);
+ if(np == CTRL_VAL_UNKNOWN)
+ {
+ np = mp->lastValidHWCtrlState(channel, CTRL_PROGRAM);
+ if(np != CTRL_VAL_UNKNOWN)
+ {
+ lbank = (np & 0xff00) >> 8;
+ prog = np & 0xff;
+ if(prog == 0xff)
+ prog = 0;
+ int ilbnk = lbank;
+ int iprog = prog;
+ if(ilbnk == 0xff)
+ ilbnk = -1;
+ ++ilbnk;
+ ++iprog;
+ midiTrackInfo->iLBank->blockSignals(true);
+ midiTrackInfo->iProgram->blockSignals(true);
+ midiTrackInfo->iLBank->setValue(ilbnk);
+ midiTrackInfo->iProgram->setValue(iprog);
+ midiTrackInfo->iLBank->blockSignals(false);
+ midiTrackInfo->iProgram->blockSignals(false);
+ }
+ }
+
+ if(prog == 0xff && (hbank != 0xff || lbank != 0xff))
+ {
+ prog = 0;
+ midiTrackInfo->iProgram->blockSignals(true);
+ midiTrackInfo->iProgram->setValue(1);
+ midiTrackInfo->iProgram->blockSignals(false);
+ }
+ program = (hbank << 16) + (lbank << 8) + prog;
+ MidiPlayEvent ev(0, port, channel, ME_CONTROLLER, CTRL_PROGRAM, program);
+ audio->msgPlayMidiEvent(&ev);
+
+ MidiInstrument* instr = mp->instrument();
+ const char* name = instr->getPatchName(channel, program, song->mtype(), track->type() == Track::DRUM);
+ midiTrackInfo->iPatch->setText(QString(name));
+// updateTrackInfo();
+ }
+
+//---------------------------------------------------------
+// iProgLBankChanged
+//---------------------------------------------------------
+
+void Arranger::iProgLBankChanged()
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ int channel = track->outChannel();
+ int port = track->outPort();
+ int hbank = midiTrackInfo->iHBank->value();
+ int lbank = midiTrackInfo->iLBank->value();
+ int prog = midiTrackInfo->iProgram->value();
+
+ if (hbank > 0 && hbank < 129)
+ hbank -= 1;
+ else
+ hbank = 0xff;
+ if (lbank > 0 && lbank < 129)
+ lbank -= 1;
+ else
+ lbank = 0xff;
+ if (prog > 0 && prog < 129)
+ prog -= 1;
+ else
+ prog = 0xff;
+
+ MidiPort* mp = &midiPorts[port];
+ if(prog == 0xff && hbank == 0xff && lbank == 0xff)
+ {
+ program = CTRL_VAL_UNKNOWN;
+ if(mp->hwCtrlState(channel, CTRL_PROGRAM) != CTRL_VAL_UNKNOWN)
+ audio->msgSetHwCtrlState(mp, channel, CTRL_PROGRAM, CTRL_VAL_UNKNOWN);
+ return;
+ }
+
+ int np = mp->hwCtrlState(channel, CTRL_PROGRAM);
+ if(np == CTRL_VAL_UNKNOWN)
+ {
+ np = mp->lastValidHWCtrlState(channel, CTRL_PROGRAM);
+ if(np != CTRL_VAL_UNKNOWN)
+ {
+ hbank = (np & 0xff0000) >> 16;
+ prog = np & 0xff;
+ if(prog == 0xff)
+ prog = 0;
+ int ihbnk = hbank;
+ int iprog = prog;
+ if(ihbnk == 0xff)
+ ihbnk = -1;
+ ++ihbnk;
+ ++iprog;
+ midiTrackInfo->iHBank->blockSignals(true);
+ midiTrackInfo->iProgram->blockSignals(true);
+ midiTrackInfo->iHBank->setValue(ihbnk);
+ midiTrackInfo->iProgram->setValue(iprog);
+ midiTrackInfo->iHBank->blockSignals(false);
+ midiTrackInfo->iProgram->blockSignals(false);
+ }
+ }
+
+ if(prog == 0xff && (hbank != 0xff || lbank != 0xff))
+ {
+ prog = 0;
+ midiTrackInfo->iProgram->blockSignals(true);
+ midiTrackInfo->iProgram->setValue(1);
+ midiTrackInfo->iProgram->blockSignals(false);
+ }
+ program = (hbank << 16) + (lbank << 8) + prog;
+ MidiPlayEvent ev(0, port, channel, ME_CONTROLLER, CTRL_PROGRAM, program);
+ audio->msgPlayMidiEvent(&ev);
+
+ MidiInstrument* instr = mp->instrument();
+ const char* name = instr->getPatchName(channel, program, song->mtype(), track->type() == Track::DRUM);
+ midiTrackInfo->iPatch->setText(QString(name));
+// updateTrackInfo();
+ }
+
+//---------------------------------------------------------
+// iProgramChanged
+//---------------------------------------------------------
+
+void Arranger::iProgramChanged()
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ int channel = track->outChannel();
+ int port = track->outPort();
+ int hbank = midiTrackInfo->iHBank->value();
+ int lbank = midiTrackInfo->iLBank->value();
+ int prog = midiTrackInfo->iProgram->value();
+
+ if (hbank > 0 && hbank < 129)
+ hbank -= 1;
+ else
+ hbank = 0xff;
+ if (lbank > 0 && lbank < 129)
+ lbank -= 1;
+ else
+ lbank = 0xff;
+ if (prog > 0 && prog < 129)
+ prog -= 1;
+ else
+ prog = 0xff;
+
+ MidiPort *mp = &midiPorts[port];
+ if(prog == 0xff)
+ {
+ program = CTRL_VAL_UNKNOWN;
+ midiTrackInfo->iHBank->blockSignals(true);
+ midiTrackInfo->iLBank->blockSignals(true);
+ midiTrackInfo->iHBank->setValue(0);
+ midiTrackInfo->iLBank->setValue(0);
+ midiTrackInfo->iHBank->blockSignals(false);
+ midiTrackInfo->iLBank->blockSignals(false);
+
+ if(mp->hwCtrlState(channel, CTRL_PROGRAM) != CTRL_VAL_UNKNOWN)
+ audio->msgSetHwCtrlState(mp, channel, CTRL_PROGRAM, CTRL_VAL_UNKNOWN);
+ return;
+ }
+ else
+ {
+ int np = mp->hwCtrlState(channel, CTRL_PROGRAM);
+ if(np == CTRL_VAL_UNKNOWN)
+ {
+ np = mp->lastValidHWCtrlState(channel, CTRL_PROGRAM);
+ if(np != CTRL_VAL_UNKNOWN)
+ {
+ hbank = (np & 0xff0000) >> 16;
+ lbank = (np & 0xff00) >> 8;
+ int ihbnk = hbank;
+ int ilbnk = lbank;
+ if(ihbnk == 0xff)
+ ihbnk = -1;
+ if(ilbnk == 0xff)
+ ilbnk = -1;
+ ++ihbnk;
+ ++ilbnk;
+ midiTrackInfo->iHBank->blockSignals(true);
+ midiTrackInfo->iLBank->blockSignals(true);
+ midiTrackInfo->iHBank->setValue(ihbnk);
+ midiTrackInfo->iLBank->setValue(ilbnk);
+ midiTrackInfo->iHBank->blockSignals(false);
+ midiTrackInfo->iLBank->blockSignals(false);
+ }
+ }
+ program = (hbank << 16) + (lbank << 8) + prog;
+ MidiPlayEvent ev(0, port, channel, ME_CONTROLLER, CTRL_PROGRAM, program);
+ audio->msgPlayMidiEvent(&ev);
+
+ MidiInstrument* instr = mp->instrument();
+ const char* name = instr->getPatchName(channel, program, song->mtype(), track->type() == Track::DRUM);
+ midiTrackInfo->iPatch->setText(QString(name));
+ }
+
+// updateTrackInfo();
+ }
+
+//---------------------------------------------------------
+// iLautstChanged
+//---------------------------------------------------------
+
+void Arranger::iLautstChanged(int val)
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ int outPort = track->outPort();
+ int chan = track->outChannel();
+ MidiPort* mp = &midiPorts[outPort];
+ MidiController* mctl = mp->midiController(CTRL_VOLUME);
+ if((val < mctl->minVal()) || (val > mctl->maxVal()))
+ {
+ if(mp->hwCtrlState(chan, CTRL_VOLUME) != CTRL_VAL_UNKNOWN)
+ audio->msgSetHwCtrlState(mp, chan, CTRL_VOLUME, CTRL_VAL_UNKNOWN);
+ }
+ else
+ {
+ val += mctl->bias();
+
+ MidiPlayEvent ev(0, outPort, chan,
+ ME_CONTROLLER, CTRL_VOLUME, val);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ song->update(SC_MIDI_CONTROLLER);
+ }
+
+//---------------------------------------------------------
+// iTranspChanged
+//---------------------------------------------------------
+
+void Arranger::iTranspChanged(int val)
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ track->transposition = val;
+ }
+
+//---------------------------------------------------------
+// iAnschlChanged
+//---------------------------------------------------------
+
+void Arranger::iAnschlChanged(int val)
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ track->velocity = val;
+ }
+
+//---------------------------------------------------------
+// iVerzChanged
+//---------------------------------------------------------
+
+void Arranger::iVerzChanged(int val)
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ track->delay = val;
+ }
+
+//---------------------------------------------------------
+// iLenChanged
+//---------------------------------------------------------
+
+void Arranger::iLenChanged(int val)
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ track->len = val;
+ }
+
+//---------------------------------------------------------
+// iKomprChanged
+//---------------------------------------------------------
+
+void Arranger::iKomprChanged(int val)
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ track->compression = val;
+ }
+
+//---------------------------------------------------------
+// iPanChanged
+//---------------------------------------------------------
+
+void Arranger::iPanChanged(int val)
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ int port = track->outPort();
+ int chan = track->outChannel();
+ MidiPort* mp = &midiPorts[port];
+ MidiController* mctl = mp->midiController(CTRL_PANPOT);
+ if((val < mctl->minVal()) || (val > mctl->maxVal()))
+ {
+ if(mp->hwCtrlState(chan, CTRL_PANPOT) != CTRL_VAL_UNKNOWN)
+ audio->msgSetHwCtrlState(mp, chan, CTRL_PANPOT, CTRL_VAL_UNKNOWN);
+ }
+ else
+ {
+ val += mctl->bias();
+
+ // Realtime Change:
+ MidiPlayEvent ev(0, port, chan,
+ ME_CONTROLLER, CTRL_PANPOT, val);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ song->update(SC_MIDI_CONTROLLER);
+ }
+
+//---------------------------------------------------------
+// instrPopup
+//---------------------------------------------------------
+
+void Arranger::instrPopup()
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ int channel = track->outChannel();
+ int port = track->outPort();
+ MidiInstrument* instr = midiPorts[port].instrument();
+ instr->populatePatchPopup(pop, channel, song->mtype(), track->type() == Track::DRUM);
+
+ if(pop->count() == 0)
+ return;
+ int rv = pop->exec(midiTrackInfo->iPatch->mapToGlobal(QPoint(10,5)));
+ if (rv != -1) {
+ MidiPlayEvent ev(0, port, channel, ME_CONTROLLER, CTRL_PROGRAM, rv);
+ audio->msgPlayMidiEvent(&ev);
+ updateTrackInfo(-1);
+ }
+ }
+
+//---------------------------------------------------------
+// recEchoToggled
+//---------------------------------------------------------
+
+void Arranger::recEchoToggled(bool v)
+{
+ MidiTrack* track = (MidiTrack*)selected;
+ track->setRecEcho(v);
+
+ //song->update(SC_???);
+}
+
+//---------------------------------------------------------
+// iProgramDoubleClicked
+//---------------------------------------------------------
+
+void Arranger::iProgramDoubleClicked()
+{
+ MidiTrack* track = (MidiTrack*)selected;
+ int port = track->outPort();
+ int chan = track->outChannel();
+ MidiPort* mp = &midiPorts[port];
+ MidiController* mctl = mp->midiController(CTRL_PROGRAM);
+
+ if(!track || !mctl)
+ return;
+
+ int lastv = mp->lastValidHWCtrlState(chan, CTRL_PROGRAM);
+ int curv = mp->hwCtrlState(chan, CTRL_PROGRAM);
+
+ if(curv == CTRL_VAL_UNKNOWN)
+ {
+ // If no value has ever been set yet, use the current knob value
+ // (or the controller's initial value?) to 'turn on' the controller.
+ if(lastv == CTRL_VAL_UNKNOWN)
+ {
+ int kiv = mctl->initVal();
+ //int kiv = lrint(_knob->value());
+ if(kiv == CTRL_VAL_UNKNOWN)
+ kiv = 0;
+ //else
+ //{
+ //if(kiv < mctrl->minVal())
+ // kiv = mctrl->minVal();
+ //if(kiv > mctrl->maxVal())
+ // kiv = mctrl->maxVal();
+ //kiv += mctrl->bias();
+ //}
+
+ //MidiPlayEvent ev(0, port, chan, ME_CONTROLLER, num, kiv);
+ MidiPlayEvent ev(0, port, chan, ME_CONTROLLER, CTRL_PROGRAM, kiv);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ else
+ {
+ MidiPlayEvent ev(0, port, chan, ME_CONTROLLER, CTRL_PROGRAM, lastv);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ }
+ else
+ {
+ if(mp->hwCtrlState(chan, CTRL_PROGRAM) != CTRL_VAL_UNKNOWN)
+ audio->msgSetHwCtrlState(mp, chan, CTRL_PROGRAM, CTRL_VAL_UNKNOWN);
+ }
+
+ song->update(SC_MIDI_CONTROLLER);
+}
+
+//---------------------------------------------------------
+// iLautstDoubleClicked
+//---------------------------------------------------------
+
+void Arranger::iLautstDoubleClicked()
+{
+ MidiTrack* track = (MidiTrack*)selected;
+ int port = track->outPort();
+ int chan = track->outChannel();
+ MidiPort* mp = &midiPorts[port];
+ MidiController* mctl = mp->midiController(CTRL_VOLUME);
+
+ if(!track || !mctl)
+ return;
+
+ int lastv = mp->lastValidHWCtrlState(chan, CTRL_VOLUME);
+ int curv = mp->hwCtrlState(chan, CTRL_VOLUME);
+
+ if(curv == CTRL_VAL_UNKNOWN)
+ {
+ // If no value has ever been set yet, use the current knob value
+ // (or the controller's initial value?) to 'turn on' the controller.
+ if(lastv == CTRL_VAL_UNKNOWN)
+ {
+ int kiv = mctl->initVal();
+ //int kiv = lrint(_knob->value());
+ if(kiv == CTRL_VAL_UNKNOWN)
+ // Set volume to 78% of range, so that if range is 0 - 127, then value is 100.
+ kiv = lround(double(mctl->maxVal() - mctl->minVal()) * 0.7874);
+ else
+ {
+ if(kiv < mctl->minVal())
+ kiv = mctl->minVal();
+ if(kiv > mctl->maxVal())
+ kiv = mctl->maxVal();
+ kiv += mctl->bias();
+ }
+
+ MidiPlayEvent ev(0, port, chan, ME_CONTROLLER, CTRL_VOLUME, kiv);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ else
+ {
+ MidiPlayEvent ev(0, port, chan, ME_CONTROLLER, CTRL_VOLUME, lastv);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ }
+ else
+ {
+ if(mp->hwCtrlState(chan, CTRL_VOLUME) != CTRL_VAL_UNKNOWN)
+ audio->msgSetHwCtrlState(mp, chan, CTRL_VOLUME, CTRL_VAL_UNKNOWN);
+ }
+
+ song->update(SC_MIDI_CONTROLLER);
+}
+
+//---------------------------------------------------------
+// iPanDoubleClicked
+//---------------------------------------------------------
+
+void Arranger::iPanDoubleClicked()
+{
+ MidiTrack* track = (MidiTrack*)selected;
+ int port = track->outPort();
+ int chan = track->outChannel();
+ MidiPort* mp = &midiPorts[port];
+ MidiController* mctl = mp->midiController(CTRL_PANPOT);
+
+ if(!track || !mctl)
+ return;
+
+ int lastv = mp->lastValidHWCtrlState(chan, CTRL_PANPOT);
+ int curv = mp->hwCtrlState(chan, CTRL_PANPOT);
+
+ if(curv == CTRL_VAL_UNKNOWN)
+ {
+ // If no value has ever been set yet, use the current knob value
+ // (or the controller's initial value?) to 'turn on' the controller.
+ if(lastv == CTRL_VAL_UNKNOWN)
+ {
+ int kiv = mctl->initVal();
+ //int kiv = lrint(_knob->value());
+ if(kiv == CTRL_VAL_UNKNOWN)
+ // Set volume to 50% of range, so that if range is 0 - 127, then value is 64.
+ kiv = lround(double(mctl->maxVal() - mctl->minVal()) * 0.5);
+ else
+ {
+ if(kiv < mctl->minVal())
+ kiv = mctl->minVal();
+ if(kiv > mctl->maxVal())
+ kiv = mctl->maxVal();
+ kiv += mctl->bias();
+ }
+
+ MidiPlayEvent ev(0, port, chan, ME_CONTROLLER, CTRL_PANPOT, kiv);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ else
+ {
+ MidiPlayEvent ev(0, port, chan, ME_CONTROLLER, CTRL_PANPOT, lastv);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ }
+ else
+ {
+ if(mp->hwCtrlState(chan, CTRL_PANPOT) != CTRL_VAL_UNKNOWN)
+ audio->msgSetHwCtrlState(mp, chan, CTRL_PANPOT, CTRL_VAL_UNKNOWN);
+ }
+
+ song->update(SC_MIDI_CONTROLLER);
+}
+
+//---------------------------------------------------------
+// genMidiTrackInfo
+//---------------------------------------------------------
+
+void Arranger::genMidiTrackInfo()
+ {
+ //midiTrackInfo->iChanDetectLabel->setPixmap(*darkgreendotIcon);
+ midiTrackInfo->iChanDetectLabel->setPixmap(*darkRedLedIcon);
+
+ QIcon recEchoIconSet;
+ recEchoIconSet.setPixmap(*recEchoIconOn, QIcon::Automatic, QIcon::Normal, QIcon::On);
+ recEchoIconSet.setPixmap(*recEchoIconOff, QIcon::Automatic, QIcon::Normal, QIcon::Off);
+ midiTrackInfo->recEchoButton->setIconSet(recEchoIconSet);
+
+ //midiTrackInfo->trackNameLabel->setAlignment(AlignCenter | WordBreak);
+ //midiTrackInfo->trackNameLabel->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
+ //frameShape WinPanel
+ //frameShadow Raised
+ //lineWidth 1
+ //midLineWidth 0
+ midiTrackInfo->trackNameLabel->setBackgroundColor(QColor(0, 160, 255)); // Med blue
+
+ // Added by Tim. p3.3.9
+ setTrackInfoLabelText();
+ setTrackInfoLabelFont();
+
+
+ connect(midiTrackInfo->iPatch, SIGNAL(released()), SLOT(instrPopup()));
+
+ pop = new Q3PopupMenu(midiTrackInfo->iPatch);
+ pop->setCheckable(false);
+
+ // Removed by Tim. p3.3.9
+ //connect(midiTrackInfo->iName, SIGNAL(returnPressed()), SLOT(iNameChanged()));
+
+ connect(midiTrackInfo->iOutputChannel, SIGNAL(valueChanged(int)), SLOT(iOutputChannelChanged(int)));
+ ///connect(midiTrackInfo->iInputChannel, SIGNAL(textChanged(const QString&)), SLOT(iInputChannelChanged(const QString&)));
+ connect(midiTrackInfo->iHBank, SIGNAL(valueChanged(int)), SLOT(iProgHBankChanged()));
+ connect(midiTrackInfo->iLBank, SIGNAL(valueChanged(int)), SLOT(iProgLBankChanged()));
+ connect(midiTrackInfo->iProgram, SIGNAL(valueChanged(int)), SLOT(iProgramChanged()));
+ connect(midiTrackInfo->iHBank, SIGNAL(doubleClicked()), SLOT(iProgramDoubleClicked()));
+ connect(midiTrackInfo->iLBank, SIGNAL(doubleClicked()), SLOT(iProgramDoubleClicked()));
+ connect(midiTrackInfo->iProgram, SIGNAL(doubleClicked()), SLOT(iProgramDoubleClicked()));
+ connect(midiTrackInfo->iLautst, SIGNAL(valueChanged(int)), SLOT(iLautstChanged(int)));
+ connect(midiTrackInfo->iLautst, SIGNAL(doubleClicked()), SLOT(iLautstDoubleClicked()));
+ connect(midiTrackInfo->iTransp, SIGNAL(valueChanged(int)), SLOT(iTranspChanged(int)));
+ connect(midiTrackInfo->iAnschl, SIGNAL(valueChanged(int)), SLOT(iAnschlChanged(int)));
+ connect(midiTrackInfo->iVerz, SIGNAL(valueChanged(int)), SLOT(iVerzChanged(int)));
+ connect(midiTrackInfo->iLen, SIGNAL(valueChanged(int)), SLOT(iLenChanged(int)));
+ connect(midiTrackInfo->iKompr, SIGNAL(valueChanged(int)), SLOT(iKomprChanged(int)));
+ connect(midiTrackInfo->iPan, SIGNAL(valueChanged(int)), SLOT(iPanChanged(int)));
+ connect(midiTrackInfo->iPan, SIGNAL(doubleClicked()), SLOT(iPanDoubleClicked()));
+ connect(midiTrackInfo->iOutput, SIGNAL(activated(int)), SLOT(iOutputPortChanged(int)));
+ ///connect(midiTrackInfo->iInput, SIGNAL(textChanged(const QString&)), SLOT(iInputPortChanged(const QString&)));
+ connect(midiTrackInfo->recordButton, SIGNAL(clicked()), SLOT(recordClicked()));
+ connect(midiTrackInfo->progRecButton, SIGNAL(clicked()), SLOT(progRecClicked()));
+ connect(midiTrackInfo->volRecButton, SIGNAL(clicked()), SLOT(volRecClicked()));
+ connect(midiTrackInfo->panRecButton, SIGNAL(clicked()), SLOT(panRecClicked()));
+ connect(midiTrackInfo->recEchoButton, SIGNAL(toggled(bool)), SLOT(recEchoToggled(bool)));
+ connect(midiTrackInfo->iRButton, SIGNAL(pressed()), SLOT(inRoutesPressed()));
+
+ // TODO: Works OK, but disabled for now, until we figure out what to do about multiple out routes and display values...
+ midiTrackInfo->oRButton->setEnabled(false);
+ connect(midiTrackInfo->oRButton, SIGNAL(pressed()), SLOT(outRoutesPressed()));
+
+ connect(heartBeatTimer, SIGNAL(timeout()), SLOT(midiTrackInfoHeartBeat()));
+ }
+
+//---------------------------------------------------------
+// updateMidiTrackInfo
+//---------------------------------------------------------
+
+void Arranger::updateMidiTrackInfo(int flags)
+{
+ MidiTrack* track = (MidiTrack*)selected;
+
+ // Is it simply a midi controller value adjustment? Forget it.
+ if(flags == SC_MIDI_CONTROLLER)
+ return;
+
+ // p3.3.47 Update the routing popup menu if anything relevant changes.
+ //if(gRoutingPopupMenuMaster == midiTrackInfo && selected && (flags & (SC_ROUTE | SC_CHANNELS | SC_CONFIG)))
+ if(flags & (SC_ROUTE | SC_CHANNELS | SC_CONFIG)) // p3.3.50
+ // Use this handy shared routine.
+ //muse->updateRouteMenus(selected);
+ muse->updateRouteMenus(selected, midiTrackInfo); // p3.3.50
+
+ // Added by Tim. p3.3.9
+ setTrackInfoLabelText();
+ setTrackInfoLabelFont();
+
+ //{
+ int outChannel = track->outChannel();
+ ///int inChannel = track->inChannelMask();
+ int outPort = track->outPort();
+ //int inPort = track->inPortMask();
+ ///unsigned int inPort = track->inPortMask();
+
+ //midiTrackInfo->iInput->clear();
+ midiTrackInfo->iOutput->clear();
+
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ QString name;
+ name.sprintf("%d:%s", i+1, midiPorts[i].portname().latin1());
+ midiTrackInfo->iOutput->insertItem(name, i);
+ if (i == outPort)
+ midiTrackInfo->iOutput->setCurrentItem(i);
+ }
+ //midiTrackInfo->iInput->setText(bitmap2String(inPort));
+ ///midiTrackInfo->iInput->setText(u32bitmap2String(inPort));
+
+ //midiTrackInfo->iInputChannel->setText(bitmap2String(inChannel));
+
+ // Removed by Tim. p3.3.9
+ //if (midiTrackInfo->iName->text() != selected->name()) {
+ // midiTrackInfo->iName->setText(selected->name());
+ // midiTrackInfo->iName->home(false);
+ // }
+
+ midiTrackInfo->iOutputChannel->setValue(outChannel+1);
+ ///midiTrackInfo->iInputChannel->setText(bitmap2String(inChannel));
+
+ // Set record echo.
+ if(midiTrackInfo->recEchoButton->isOn() != track->recEcho())
+ {
+ midiTrackInfo->recEchoButton->blockSignals(true);
+ midiTrackInfo->recEchoButton->setOn(track->recEcho());
+ midiTrackInfo->recEchoButton->blockSignals(false);
+ }
+
+ MidiPort* mp = &midiPorts[outPort];
+ int nprogram = mp->hwCtrlState(outChannel, CTRL_PROGRAM);
+ if(nprogram == CTRL_VAL_UNKNOWN)
+ {
+ midiTrackInfo->iHBank->blockSignals(true);
+ midiTrackInfo->iLBank->blockSignals(true);
+ midiTrackInfo->iProgram->blockSignals(true);
+ midiTrackInfo->iHBank->setValue(0);
+ midiTrackInfo->iLBank->setValue(0);
+ midiTrackInfo->iProgram->setValue(0);
+ midiTrackInfo->iHBank->blockSignals(false);
+ midiTrackInfo->iLBank->blockSignals(false);
+ midiTrackInfo->iProgram->blockSignals(false);
+
+ program = CTRL_VAL_UNKNOWN;
+ nprogram = mp->lastValidHWCtrlState(outChannel, CTRL_PROGRAM);
+ if(nprogram == CTRL_VAL_UNKNOWN)
+ //midiTrackInfo->iPatch->setText(QString("<unknown>"));
+ midiTrackInfo->iPatch->setText(tr("<unknown>"));
+ else
+ {
+ MidiInstrument* instr = mp->instrument();
+ const char* name = instr->getPatchName(outChannel, nprogram, song->mtype(), track->type() == Track::DRUM);
+ midiTrackInfo->iPatch->setText(QString(name));
+ }
+ }
+ else
+ //if (program != nprogram)
+ {
+ program = nprogram;
+
+ //int hb, lb, pr;
+ //if (program == CTRL_VAL_UNKNOWN) {
+ // hb = lb = pr = 0;
+ // midiTrackInfo->iPatch->setText("---");
+ // }
+ //else
+ //{
+ MidiInstrument* instr = mp->instrument();
+ const char* name = instr->getPatchName(outChannel, program, song->mtype(), track->type() == Track::DRUM);
+ midiTrackInfo->iPatch->setText(QString(name));
+
+ int hb = ((program >> 16) & 0xff) + 1;
+ if (hb == 0x100)
+ hb = 0;
+ int lb = ((program >> 8) & 0xff) + 1;
+ if (lb == 0x100)
+ lb = 0;
+ int pr = (program & 0xff) + 1;
+ if (pr == 0x100)
+ pr = 0;
+ //}
+ midiTrackInfo->iHBank->blockSignals(true);
+ midiTrackInfo->iLBank->blockSignals(true);
+ midiTrackInfo->iProgram->blockSignals(true);
+
+ midiTrackInfo->iHBank->setValue(hb);
+ midiTrackInfo->iLBank->setValue(lb);
+ midiTrackInfo->iProgram->setValue(pr);
+
+ midiTrackInfo->iHBank->blockSignals(false);
+ midiTrackInfo->iLBank->blockSignals(false);
+ midiTrackInfo->iProgram->blockSignals(false);
+ }
+
+ MidiController* mc = mp->midiController(CTRL_VOLUME);
+ int mn = mc->minVal();
+ int v = mp->hwCtrlState(outChannel, CTRL_VOLUME);
+ volume = v;
+ if(v == CTRL_VAL_UNKNOWN)
+ //{
+ //v = mc->initVal();
+ //if(v == CTRL_VAL_UNKNOWN)
+ // v = 0;
+ v = mn - 1;
+ //}
+ else
+ // Auto bias...
+ v -= mc->bias();
+ midiTrackInfo->iLautst->blockSignals(true);
+ midiTrackInfo->iLautst->setRange(mn - 1, mc->maxVal());
+ midiTrackInfo->iLautst->setValue(v);
+ midiTrackInfo->iLautst->blockSignals(false);
+
+ mc = mp->midiController(CTRL_PANPOT);
+ mn = mc->minVal();
+ v = mp->hwCtrlState(outChannel, CTRL_PANPOT);
+ pan = v;
+ if(v == CTRL_VAL_UNKNOWN)
+ //{
+ //v = mc->initVal();
+ //if(v == CTRL_VAL_UNKNOWN)
+ // v = 0;
+ v = mn - 1;
+ //}
+ else
+ // Auto bias...
+ v -= mc->bias();
+ midiTrackInfo->iPan->blockSignals(true);
+ midiTrackInfo->iPan->setRange(mn - 1, mc->maxVal());
+ midiTrackInfo->iPan->setValue(v);
+ midiTrackInfo->iPan->blockSignals(false);
+ //}
+
+
+ // Does it include a midi controller value adjustment? Then handle it...
+ //if(flags & SC_MIDI_CONTROLLER)
+ // seek();
+
+ // Is it simply a midi controller value adjustment? Forget it.
+ //if(flags != SC_MIDI_CONTROLLER)
+ //{
+ midiTrackInfo->iTransp->setValue(track->transposition);
+ midiTrackInfo->iAnschl->setValue(track->velocity);
+ midiTrackInfo->iVerz->setValue(track->delay);
+ midiTrackInfo->iLen->setValue(track->len);
+ midiTrackInfo->iKompr->setValue(track->compression);
+ //}
+}
+
+/*
+//---------------------------------------------------------
+// seek
+// change values akkording to seek position
+//---------------------------------------------------------
+
+void Arranger::seek()
+ {
+ if (!showTrackinfoFlag || !selected)
+ return;
+ switch(selected->type()) {
+ case Track::MIDI:
+ case Track::DRUM:
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ int outPort = track->outPort();
+ int outChannel = track->outChannel();
+ MidiPort* mp = &midiPorts[outPort];
+
+ // int nprogram = mp->getCtrl(outChannel, tick, CTRL_PROGRAM);
+ int nprogram = mp->hwCtrlState(outChannel, CTRL_PROGRAM);
+ if(nprogram == CTRL_VAL_UNKNOWN)
+ {
+ midiTrackInfo->iHBank->blockSignals(true);
+ midiTrackInfo->iLBank->blockSignals(true);
+ midiTrackInfo->iProgram->blockSignals(true);
+ midiTrackInfo->iHBank->setValue(0);
+ midiTrackInfo->iLBank->setValue(0);
+ midiTrackInfo->iProgram->setValue(0);
+ midiTrackInfo->iHBank->blockSignals(false);
+ midiTrackInfo->iLBank->blockSignals(false);
+ midiTrackInfo->iProgram->blockSignals(false);
+
+ program = CTRL_VAL_UNKNOWN;
+ nprogram = mp->lastValidHWCtrlState(outChannel, CTRL_PROGRAM);
+ if(nprogram == CTRL_VAL_UNKNOWN)
+ midiTrackInfo->iPatch->setText(QString("<unknown>"));
+ else
+ {
+ MidiInstrument* instr = mp->instrument();
+ const char* name = instr->getPatchName(outChannel, nprogram, song->mtype(), track->type() == Track::DRUM);
+ midiTrackInfo->iPatch->setText(QString(name));
+ }
+ }
+ else
+ if (program != nprogram) {
+ program = nprogram;
+
+ //int hb, lb, pr;
+ //if (program == CTRL_VAL_UNKNOWN) {
+ // hb = lb = pr = 0;
+ // midiTrackInfo->iPatch->setText("---");
+ // }
+ //else
+ //{
+ MidiInstrument* instr = mp->instrument();
+ const char* name = instr->getPatchName(outChannel, program, song->mtype(), track->type() == Track::DRUM);
+ midiTrackInfo->iPatch->setText(QString(name));
+
+ int hb = ((program >> 16) & 0xff) + 1;
+ if (hb == 0x100)
+ hb = 0;
+ int lb = ((program >> 8) & 0xff) + 1;
+ if (lb == 0x100)
+ lb = 0;
+ int pr = (program & 0xff) + 1;
+ if (pr == 0x100)
+ pr = 0;
+ //}
+ midiTrackInfo->iHBank->blockSignals(true);
+ midiTrackInfo->iLBank->blockSignals(true);
+ midiTrackInfo->iProgram->blockSignals(true);
+
+ midiTrackInfo->iHBank->setValue(hb);
+ midiTrackInfo->iLBank->setValue(lb);
+ midiTrackInfo->iProgram->setValue(pr);
+
+ midiTrackInfo->iHBank->blockSignals(false);
+ midiTrackInfo->iLBank->blockSignals(false);
+ midiTrackInfo->iProgram->blockSignals(false);
+ }
+
+ //int nvolume = midiPorts[outPort].getCtrl(outChannel, tick, CTRL_VOLUME);
+ // int npan = midiPorts[outPort].getCtrl(outChannel, tick, CTRL_PANPOT);
+ MidiController* mc = mp->midiController(CTRL_VOLUME);
+ int v = mp->hwCtrlState(outChannel, CTRL_VOLUME);
+ if(v != volume)
+ {
+ volume = v;
+ if(v == CTRL_VAL_UNKNOWN)
+ v = mc->minVal() - 1;
+ else
+ v -= mc->bias();
+ midiTrackInfo->iLautst->blockSignals(true);
+ midiTrackInfo->iLautst->setValue(v);
+ midiTrackInfo->iLautst->blockSignals(false);
+ }
+ mc = mp->midiController(CTRL_PANPOT);
+ v = mp->hwCtrlState(outChannel, CTRL_PANPOT);
+ if(v != pan)
+ {
+ pan = v;
+ if(v == CTRL_VAL_UNKNOWN)
+ //{
+ //v = mc->initVal();
+ //if(v == CTRL_VAL_UNKNOWN)
+ // v = 0;
+ v = mc->minVal() - 1;
+ //}
+ else
+ // Auto bias...
+ v -= mc->bias();
+ midiTrackInfo->iPan->blockSignals(true);
+ midiTrackInfo->iPan->setValue(v);
+ midiTrackInfo->iPan->blockSignals(false);
+ }
+
+ }
+ break;
+ case Track::WAVE:
+ case Track::AUDIO_OUTPUT:
+ case Track::AUDIO_INPUT:
+ case Track::AUDIO_GROUP:
+ case Track::AUDIO_AUX:
+ case Track::AUDIO_SOFTSYNTH:
+ break;
+ }
+ }
+*/
diff --git a/muse2/muse/audio.cpp b/muse2/muse/audio.cpp
new file mode 100644
index 00000000..9a7029db
--- /dev/null
+++ b/muse2/muse/audio.cpp
@@ -0,0 +1,1431 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: audio.cpp,v 1.59.2.30 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2001-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <cmath>
+#include <errno.h>
+
+#include <qsocketnotifier.h>
+
+#include "app.h"
+#include "song.h"
+#include "node.h"
+#include "audiodev.h"
+#include "mididev.h"
+#include "alsamidi.h"
+#include "synth.h"
+#include "audioprefetch.h"
+#include "plugin.h"
+#include "audio.h"
+#include "wave.h"
+#include "midictrl.h"
+#include "midiseq.h"
+#include "sync.h"
+#include "midi.h"
+#include "event.h"
+#include "gconfig.h"
+#include "pos.h"
+#include "ticksynth.h"
+
+extern double curTime();
+Audio* audio;
+AudioDevice* audioDevice; // current audio device in use
+
+// p3.3.25
+extern unsigned int volatile midiExtSyncTicks;
+
+
+//static const unsigned char mmcDeferredPlayMsg[] = { 0x7f, 0x7f, 0x06, 0x03 };
+//static const unsigned char mmcStopMsg[] = { 0x7f, 0x7f, 0x06, 0x01 };
+
+const char* seqMsgList[] = {
+ "SEQM_ADD_TRACK", "SEQM_REMOVE_TRACK", "SEQM_CHANGE_TRACK", "SEQM_MOVE_TRACK",
+ "SEQM_ADD_PART", "SEQM_REMOVE_PART", "SEQM_CHANGE_PART",
+ "SEQM_ADD_EVENT", "SEQM_REMOVE_EVENT", "SEQM_CHANGE_EVENT",
+ "SEQM_ADD_TEMPO", "SEQM_SET_TEMPO", "SEQM_REMOVE_TEMPO", "SEQM_ADD_SIG", "SEQM_REMOVE_SIG",
+ "SEQM_SET_GLOBAL_TEMPO",
+ "SEQM_UNDO", "SEQM_REDO",
+ "SEQM_RESET_DEVICES", "SEQM_INIT_DEVICES", "SEQM_PANIC",
+ "SEQM_MIDI_LOCAL_OFF",
+ "SEQM_SET_MIDI_DEVICE",
+ "SEQM_PLAY_MIDI_EVENT",
+ "SEQM_SET_HW_CTRL_STATE",
+ "SEQM_SET_HW_CTRL_STATES",
+ "SEQM_SET_TRACK_OUT_PORT",
+ "SEQM_SET_TRACK_OUT_CHAN",
+ "SEQM_REMAP_PORT_DRUM_CTL_EVS",
+ "SEQM_CHANGE_ALL_PORT_DRUM_CTL_EVS",
+ "SEQM_SCAN_ALSA_MIDI_PORTS",
+ "SEQM_SET_AUX",
+ "SEQM_UPDATE_SOLO_STATES",
+ "MIDI_SHOW_INSTR_GUI",
+ "AUDIO_RECORD",
+ "AUDIO_ROUTEADD", "AUDIO_ROUTEREMOVE",
+ "AUDIO_VOL", "AUDIO_PAN",
+ "AUDIO_ADDPLUGIN",
+ "AUDIO_SET_SEG_SIZE",
+ "AUDIO_SET_PREFADER", "AUDIO_SET_CHANNELS",
+ "AUDIO_SET_PLUGIN_CTRL_VAL",
+ "AUDIO_SWAP_CONTROLLER_IDX",
+ "AUDIO_CLEAR_CONTROLLER_EVENTS",
+ "AUDIO_SEEK_PREV_AC_EVENT",
+ "AUDIO_SEEK_NEXT_AC_EVENT",
+ "AUDIO_ERASE_AC_EVENT",
+ "AUDIO_ERASE_RANGE_AC_EVENTS",
+ "AUDIO_ADD_AC_EVENT",
+ "AUDIO_SET_SOLO", "AUDIO_SET_SEND_METRONOME",
+ "MS_PROCESS", "MS_STOP", "MS_SET_RTC", "MS_UPDATE_POLL_FD",
+ "SEQM_IDLE", "SEQM_SEEK"
+ };
+
+const char* audioStates[] = {
+ "STOP", "START_PLAY", "PLAY", "LOOP1", "LOOP2", "SYNC", "PRECOUNT"
+ };
+
+
+//---------------------------------------------------------
+// Audio
+//---------------------------------------------------------
+
+Audio::Audio()
+ {
+ _running = false;
+ recording = false;
+ idle = false;
+ _freewheel = false;
+ _bounce = false;
+ //loopPassed = false;
+ _loopFrame = 0;
+ _loopCount = 0;
+
+ _pos.setType(Pos::FRAMES);
+ _pos.setFrame(0);
+ curTickPos = 0;
+
+ midiClick = 0;
+ clickno = 0;
+ clicksMeasure = 0;
+ ticksBeat = 0;
+
+ syncTime = 0.0;
+ syncFrame = 0;
+ frameOffset = 0;
+
+ state = STOP;
+ msg = 0;
+
+ // Changed by Tim. p3.3.8
+ //startRecordPos.setType(Pos::TICKS);
+ //endRecordPos.setType(Pos::TICKS);
+ startRecordPos.setType(Pos::FRAMES);
+ endRecordPos.setType(Pos::FRAMES);
+
+ _audioMonitor = 0;
+ _audioMaster = 0;
+
+ //---------------------------------------------------
+ // establish pipes/sockets
+ //---------------------------------------------------
+
+ int filedes[2]; // 0 - reading 1 - writing
+ if (pipe(filedes) == -1) {
+ perror("creating pipe0");
+ exit(-1);
+ }
+ fromThreadFdw = filedes[1];
+ fromThreadFdr = filedes[0];
+ int rv = fcntl(fromThreadFdw, F_SETFL, O_NONBLOCK);
+ if (rv == -1)
+ perror("set pipe O_NONBLOCK");
+
+ if (pipe(filedes) == -1) {
+ perror("creating pipe1");
+ exit(-1);
+ }
+ sigFd = filedes[1];
+ QSocketNotifier* ss = new QSocketNotifier(filedes[0], QSocketNotifier::Read);
+ song->connect(ss, SIGNAL(activated(int)), song, SLOT(seqSignal(int)));
+ }
+
+//---------------------------------------------------------
+// start
+// start audio processing
+//---------------------------------------------------------
+
+extern bool initJackAudio();
+
+bool Audio::start()
+ {
+ //process(segmentSize); // warm up caches
+ state = STOP;
+ _loopCount = 0;
+ muse->setHeartBeat();
+ if (audioDevice) {
+ // Added by Tim. p3.3.6
+ //_running = true;
+
+ //audioDevice->start();
+ }
+ else {
+ if(false == initJackAudio()) {
+ // Added by Tim. p3.3.6
+ //_running = true;
+
+ InputList* itl = song->inputs();
+ for (iAudioInput i = itl->begin(); i != itl->end(); ++i) {
+ //printf("reconnecting input %s\n", (*i)->name().ascii());
+ for (int x=0; x < (*i)->channels();x++)
+ (*i)->setJackPort(x,0);
+ (*i)->setName((*i)->name()); // restore jack connection
+ }
+
+ OutputList* otl = song->outputs();
+ for (iAudioOutput i = otl->begin(); i != otl->end(); ++i) {
+ //printf("reconnecting output %s\n", (*i)->name().ascii());
+ for (int x=0; x < (*i)->channels();x++)
+ (*i)->setJackPort(x,0);
+ //printf("name=%s\n",(*i)->name().latin1());
+ (*i)->setName((*i)->name()); // restore jack connection
+ }
+ //audioDevice->start();
+ }
+ else {
+ printf("Failed to init audio!\n");
+ return false;
+ }
+ }
+
+ audioDevice->start(realTimePriority);
+
+ _running = true;
+
+ // shall we really stop JACK transport and locate to
+ // saved position?
+
+ audioDevice->stopTransport();
+ //audioDevice->seekTransport(song->cPos().frame());
+ audioDevice->seekTransport(song->cPos());
+ return true;
+ }
+
+//---------------------------------------------------------
+// stop
+// stop audio processing
+//---------------------------------------------------------
+
+void Audio::stop(bool)
+ {
+ if (audioDevice)
+ audioDevice->stop();
+ _running = false;
+ }
+
+//---------------------------------------------------------
+// sync
+// return true if sync is completed
+//---------------------------------------------------------
+
+bool Audio::sync(int jackState, unsigned frame)
+ {
+
+// Changed by Tim. p3.3.24
+/*
+ bool done = true;
+ if (state == LOOP1)
+ state = LOOP2;
+ else {
+ if (_pos.frame() != frame) {
+ Pos p(frame, false);
+ seek(p);
+ }
+ state = State(jackState);
+ if (!_freewheel)
+ //done = audioPrefetch->seekDone;
+ done = audioPrefetch->seekDone();
+ }
+
+ return done;
+*/
+ bool done = true;
+ if (state == LOOP1)
+ state = LOOP2;
+ else {
+ State s = State(jackState);
+ //
+ // STOP -> START_PLAY start rolling
+ // STOP -> STOP seek in stop state
+ // PLAY -> START_PLAY seek in play state
+
+ if (state != START_PLAY) {
+ //Pos p(frame, AL::FRAMES);
+ // seek(p);
+ Pos p(frame, false);
+ seek(p);
+ if (!_freewheel)
+ done = audioPrefetch->seekDone();
+ if (s == START_PLAY)
+ state = START_PLAY;
+ }
+ else {
+ //if (frame != _seqTime.pos.frame()) {
+ if (frame != _pos.frame()) {
+ // seek during seek
+ //seek(Pos(frame, AL::FRAMES));
+ seek(Pos(frame, false));
+ }
+ done = audioPrefetch->seekDone();
+ }
+ }
+ return done;
+
+ }
+
+//---------------------------------------------------------
+// setFreewheel
+//---------------------------------------------------------
+
+void Audio::setFreewheel(bool val)
+ {
+// printf("JACK: freewheel callback %d\n", val);
+ _freewheel = val;
+ }
+
+//---------------------------------------------------------
+// shutdown
+//---------------------------------------------------------
+
+void Audio::shutdown()
+ {
+ _running = false;
+ printf("Audio::shutdown()\n");
+ write(sigFd, "S", 1);
+ }
+
+//---------------------------------------------------------
+// process
+// process one audio buffer at position "_pos "
+// of size "frames"
+//---------------------------------------------------------
+
+void Audio::process(unsigned frames)
+ {
+ // Disabled by Tim. p3.3.22
+// extern int watchAudio;
+// ++watchAudio; // make a simple watchdog happy
+
+ if (!checkAudioDevice()) return;
+ if (msg) {
+ processMsg(msg);
+ int sn = msg->serialNo;
+ msg = 0; // dont process again
+ int rv = write(fromThreadFdw, &sn, sizeof(int));
+ if (rv != sizeof(int)) {
+ fprintf(stderr, "audio: write(%d) pipe failed: %s\n",
+ fromThreadFdw, strerror(errno));
+ }
+ }
+
+ OutputList* ol = song->outputs();
+ if (idle) {
+ // deliver no audio
+ for (iAudioOutput i = ol->begin(); i != ol->end(); ++i)
+ (*i)->silence(frames);
+ return;
+ }
+
+ int jackState = audioDevice->getState();
+
+ //if(debugMsg)
+ // printf("Audio::process Current state:%s jackState:%s\n", audioStates[state], audioStates[jackState]);
+
+ if (state == START_PLAY && jackState == PLAY) {
+ _loopCount = 0;
+ startRolling();
+ if (_bounce)
+ write(sigFd, "f", 1);
+ }
+ else if (state == LOOP2 && jackState == PLAY) {
+ ++_loopCount; // Number of times we have looped so far
+ Pos newPos(_loopFrame, false);
+ seek(newPos);
+ startRolling();
+ }
+ else if (isPlaying() && jackState == STOP) {
+ // p3.3.43 Make sure to stop bounce and freewheel mode, for example if user presses stop
+ // in QJackCtl before right-hand marker is reached (which is handled below).
+ //printf("Audio::process isPlaying() && jackState == STOP\n");
+ //if (_bounce)
+ //{
+ //printf(" stopping bounce...\n");
+ // _bounce = false;
+ // write(sigFd, "F", 1);
+ //}
+
+ stopRolling();
+ }
+ else if (state == START_PLAY && jackState == STOP) {
+ state = STOP;
+ if (_bounce) {
+ audioDevice->startTransport();
+ }
+ else
+ write(sigFd, "3", 1); // abort rolling
+ }
+ else if (state == STOP && jackState == PLAY) {
+ _loopCount = 0;
+ startRolling();
+ }
+ else if (state == LOOP1 && jackState == PLAY)
+ ; // treat as play
+ else if (state == LOOP2 && jackState == START_PLAY) {
+ ; // sync cycle
+ }
+ else if (state != jackState)
+ printf("JACK: state transition %s -> %s ?\n",
+ audioStates[state], audioStates[jackState]);
+
+// printf("p %s %s %d\n", audioStates[jackState], audioStates[state], _pos.frame());
+
+ //
+ // clear aux send buffers
+ //
+ AuxList* al = song->auxs();
+ for (unsigned i = 0; i < al->size(); ++i) {
+ AudioAux* a = (AudioAux*)((*al)[i]);
+ float** dst = a->sendBuffer();
+ for (int ch = 0; ch < a->channels(); ++ch)
+ memset(dst[ch], 0, sizeof(float) * segmentSize);
+ }
+
+ for (iAudioOutput i = ol->begin(); i != ol->end(); ++i)
+ (*i)->processInit(frames);
+ int samplePos = _pos.frame();
+ int offset = 0; // buffer offset in audio buffers
+
+ if (isPlaying()) {
+ if (!freewheel())
+ audioPrefetch->msgTick();
+
+ if (_bounce && _pos >= song->rPos()) {
+ _bounce = false;
+ write(sigFd, "F", 1);
+ return;
+ }
+
+ //
+ // check for end of song
+ //
+ if ((curTickPos >= song->len())
+ && !(song->record()
+ || _bounce
+ || song->loop())) {
+ //if(debugMsg)
+ // printf("Audio::process curTickPos >= song->len\n");
+
+ audioDevice->stopTransport();
+ return;
+ }
+
+ //
+ // check for loop end
+ //
+ if (state == PLAY && song->loop() && !_bounce && !extSyncFlag.value()) {
+ const Pos& loop = song->rPos();
+ unsigned n = loop.frame() - samplePos - (3 * frames);
+ if (n < frames) {
+ // loop end in current cycle
+ unsigned lpos = song->lPos().frame();
+ // adjust loop start so we get exact loop len
+ if (n > lpos)
+ n = 0;
+ state = LOOP1;
+ _loopFrame = lpos - n;
+
+ // clear sustain
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ MidiPort* mp = &midiPorts[i];
+ for (int ch = 0; ch < MIDI_CHANNELS; ++ch) {
+ if (mp->hwCtrlState(ch, CTRL_SUSTAIN) == 127) {
+ if (mp->device()!=NULL) {
+ //printf("send clear sustain!!!!!!!! port %d ch %d\n", i,ch);
+ MidiPlayEvent ev(0, i, ch, ME_CONTROLLER, CTRL_SUSTAIN, 0);
+ // may cause problems, called from audio thread
+ mp->device()->putEvent(ev);
+ }
+ }
+ }
+ }
+
+ //audioDevice->seekTransport(_loopFrame);
+ Pos lp(_loopFrame, false);
+ audioDevice->seekTransport(lp);
+
+
+// printf(" process: seek to %d, end %d\n", _loopFrame, loop.frame());
+ }
+ }
+
+
+ // p3.3.25
+ if(extSyncFlag.value())
+ {
+ nextTickPos = curTickPos + midiExtSyncTicks;
+ // Probably not good - interfere with midi thread.
+ midiExtSyncTicks = 0;
+ }
+ else
+ {
+
+ Pos ppp(_pos);
+ ppp += frames;
+ nextTickPos = ppp.tick();
+ }
+ }
+ //
+ // resync with audio interface
+ //
+ syncFrame = audioDevice->framePos();
+ syncTime = curTime();
+ frameOffset = syncFrame - samplePos;
+
+ //printf("Audio::process calling process1:\n");
+
+ process1(samplePos, offset, frames);
+ for (iAudioOutput i = ol->begin(); i != ol->end(); ++i)
+ (*i)->processWrite();
+ if (isPlaying()) {
+ _pos += frames;
+ curTickPos = nextTickPos;
+ }
+ }
+
+//---------------------------------------------------------
+// process1
+//---------------------------------------------------------
+
+void Audio::process1(unsigned samplePos, unsigned offset, unsigned frames)
+ {
+ if (midiSeqRunning) {
+ processMidi();
+ }
+ //midiSeq->msgProcess();
+
+ //
+ // process not connected tracks
+ // to animate meter display
+ //
+ TrackList* tl = song->tracks();
+ AudioTrack* track;
+ int channels;
+ for(ciTrack it = tl->begin(); it != tl->end(); ++it)
+ {
+ if((*it)->isMidiTrack())
+ continue;
+ track = (AudioTrack*)(*it);
+
+ // Added by T356.
+ // For audio track types, synths etc. which need some kind of non-audio
+ // (but possibly audio-affecting) processing always, even if their output path
+ // is ultimately unconnected.
+ // Example: A fluidsynth instance whose output path ultimately led to nowhere
+ // would not allow us to load a font. Since process() was driven by audio output,
+ // in this case there was nothing driving the process() function which responds to
+ // such gui commands. So I separated the events processing from process(), into this.
+ // It should be used for things like midi events, gui events etc. - things which need to
+ // be done BEFORE all the AudioOutput::process() are called below. That does NOT include
+ // audio processing, because THAT is done at the very end of this routine.
+ // This will also reset the track's processed flag.
+ track->preProcessAlways();
+
+ // Removed by T356
+ /*
+ if (track->noOutRoute() && !track->noInRoute() &&
+ track->type() != Track::AUDIO_AUX && track->type() != Track::AUDIO_OUTPUT) {
+ channels = track->channels();
+ float* buffer[channels];
+ float data[frames * channels];
+ for (int i = 0; i < channels; ++i)
+ buffer[i] = data + i * frames;
+ track->copyData(samplePos, channels, frames, buffer);
+ }
+ */
+
+ }
+ // Pre-process the metronome.
+ ((AudioTrack*)metronome)->preProcessAlways();
+
+ OutputList* ol = song->outputs();
+ for (ciAudioOutput i = ol->begin(); i != ol->end(); ++i)
+ (*i)->process(samplePos, offset, frames);
+
+ // Removed by T356
+ /*
+ AuxList* auxl = song->auxs();
+ for (ciAudioAux ia = auxl->begin(); ia != auxl->end(); ++ia) {
+ track = (AudioTrack*)(*ia);
+ if (track->noOutRoute()) {
+ channels = track->channels();
+ float* buffer[channels];
+ float data[frames * channels];
+ for (int i = 0; i < channels; ++i)
+ buffer[i] = data + i * frames;
+ track->copyData(samplePos, channels, frames, buffer);
+ }
+ }
+ */
+
+ // Added by T356.
+ // Were ANY tracks unprocessed as a result of processing all the AudioOutputs, above?
+ // Not just unconnected ones, as previously done, but ones whose output path ultimately leads nowhere.
+ // Those tracks were missed, until this fix.
+ // Do them now. This will animate meters, and 'quietly' process some audio which needs to be done -
+ // for example synths really need to be processed, 'quietly' or not, otherwise the next time
+ // processing is 'turned on', if there was a backlog of events while it was off, then they all happen at once.
+ for(ciTrack it = tl->begin(); it != tl->end(); ++it)
+ {
+ if((*it)->isMidiTrack())
+ continue;
+ track = (AudioTrack*)(*it);
+ // Ignore unprocessed tracks which have an output route, because they will be processed by
+ // whatever track(s) they are routed to.
+ if(!track->processed() && track->noOutRoute() && (track->type() != Track::AUDIO_OUTPUT))
+ {
+ channels = track->channels();
+ // Just a dummy buffer.
+ float* buffer[channels];
+ float data[frames * channels];
+ for (int i = 0; i < channels; ++i)
+ buffer[i] = data + i * frames;
+ //printf("Audio::process1 calling track->copyData for track:%s\n", track->name().latin1());
+
+ // p3.3.38
+ //track->copyData(samplePos, channels, frames, buffer);
+ track->copyData(samplePos, channels, -1, -1, frames, buffer);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// processMsg
+//---------------------------------------------------------
+
+void Audio::processMsg(AudioMsg* msg)
+ {
+ switch(msg->id) {
+ case AUDIO_RECORD:
+ msg->snode->setRecordFlag2(msg->ival);
+ break;
+ case AUDIO_ROUTEADD:
+ addRoute(msg->sroute, msg->droute);
+ break;
+ case AUDIO_ROUTEREMOVE:
+ removeRoute(msg->sroute, msg->droute);
+ break;
+ case AUDIO_VOL:
+ msg->snode->setVolume(msg->dval);
+ break;
+ case AUDIO_PAN:
+ msg->snode->setPan(msg->dval);
+ break;
+ case SEQM_SET_AUX:
+ msg->snode->setAuxSend(msg->ival, msg->dval);
+ break;
+ case AUDIO_SET_PREFADER:
+ msg->snode->setPrefader(msg->ival);
+ break;
+ case AUDIO_SET_CHANNELS:
+ msg->snode->setChannels(msg->ival);
+ break;
+ case AUDIO_ADDPLUGIN:
+ msg->snode->addPlugin(msg->plugin, msg->ival);
+ break;
+ case AUDIO_SET_PLUGIN_CTRL_VAL:
+ //msg->plugin->track()->setPluginCtrlVal(msg->ival, msg->dval);
+ // p3.3.43
+ msg->snode->setPluginCtrlVal(msg->ival, msg->dval);
+ break;
+ case AUDIO_SWAP_CONTROLLER_IDX:
+ msg->snode->swapControllerIDX(msg->a, msg->b);
+ break;
+ case AUDIO_CLEAR_CONTROLLER_EVENTS:
+ msg->snode->clearControllerEvents(msg->ival);
+ break;
+ case AUDIO_SEEK_PREV_AC_EVENT:
+ msg->snode->seekPrevACEvent(msg->ival);
+ break;
+ case AUDIO_SEEK_NEXT_AC_EVENT:
+ msg->snode->seekNextACEvent(msg->ival);
+ break;
+ case AUDIO_ERASE_AC_EVENT:
+ msg->snode->eraseACEvent(msg->ival, msg->a);
+ break;
+ case AUDIO_ERASE_RANGE_AC_EVENTS:
+ msg->snode->eraseRangeACEvents(msg->ival, msg->a, msg->b);
+ break;
+ case AUDIO_ADD_AC_EVENT:
+ msg->snode->addACEvent(msg->ival, msg->a, msg->dval);
+ break;
+ case AUDIO_SET_SOLO:
+ msg->track->setSolo((bool)msg->ival);
+ break;
+
+ case AUDIO_SET_SEND_METRONOME:
+ msg->snode->setSendMetronome((bool)msg->ival);
+ break;
+
+ case AUDIO_SET_SEG_SIZE:
+ segmentSize = msg->ival;
+ sampleRate = msg->iival;
+#if 0 //TODO
+ audioOutput.segmentSizeChanged();
+ for (int i = 0; i < mixerGroups; ++i)
+ audioGroups[i].segmentSizeChanged();
+ for (iSynthI ii = synthiInstances.begin(); ii != synthiInstances.end();++ii)
+ (*ii)->segmentSizeChanged();
+#endif
+ break;
+
+ case SEQM_RESET_DEVICES:
+ for (int i = 0; i < MIDI_PORTS; ++i)
+ midiPorts[i].instrument()->reset(i, song->mtype());
+ break;
+ case SEQM_INIT_DEVICES:
+ initDevices();
+ break;
+ case SEQM_MIDI_LOCAL_OFF:
+ sendLocalOff();
+ break;
+ case SEQM_PANIC:
+ panic();
+ break;
+ case SEQM_PLAY_MIDI_EVENT:
+ {
+ MidiPlayEvent* ev = (MidiPlayEvent*)(msg->p1);
+ midiPorts[ev->port()].sendEvent(*ev);
+ // Record??
+ }
+ break;
+ case SEQM_SET_HW_CTRL_STATE:
+ {
+ MidiPort* port = (MidiPort*)(msg->p1);
+ port->setHwCtrlState(msg->a, msg->b, msg->c);
+ }
+ break;
+ case SEQM_SET_HW_CTRL_STATES:
+ {
+ MidiPort* port = (MidiPort*)(msg->p1);
+ port->setHwCtrlStates(msg->a, msg->b, msg->c, msg->ival);
+ }
+ break;
+ case SEQM_SCAN_ALSA_MIDI_PORTS:
+ alsaScanMidiPorts();
+ break;
+ case MIDI_SHOW_INSTR_GUI:
+ midiSeq->msgUpdatePollFd();
+ break;
+ case SEQM_ADD_TEMPO:
+ case SEQM_REMOVE_TEMPO:
+ case SEQM_SET_GLOBAL_TEMPO:
+ case SEQM_SET_TEMPO:
+ song->processMsg(msg);
+ if (isPlaying()) {
+ if (!checkAudioDevice()) return;
+ _pos.setTick(curTickPos);
+ int samplePos = _pos.frame();
+ syncFrame = audioDevice->framePos();
+ syncTime = curTime();
+ frameOffset = syncFrame - samplePos;
+ }
+ break;
+ case SEQM_ADD_TRACK:
+ case SEQM_REMOVE_TRACK:
+ case SEQM_CHANGE_TRACK:
+ case SEQM_ADD_PART:
+ case SEQM_REMOVE_PART:
+ case SEQM_CHANGE_PART:
+ case SEQM_SET_TRACK_OUT_CHAN:
+ case SEQM_SET_TRACK_OUT_PORT:
+ case SEQM_REMAP_PORT_DRUM_CTL_EVS:
+ case SEQM_CHANGE_ALL_PORT_DRUM_CTL_EVS:
+ midiSeq->sendMsg(msg);
+ break;
+
+ case SEQM_IDLE:
+ idle = msg->a;
+ midiSeq->sendMsg(msg);
+ break;
+
+ default:
+ song->processMsg(msg);
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// seek
+// - called before start play
+// - initiated from gui
+//---------------------------------------------------------
+
+void Audio::seek(const Pos& p)
+ {
+ if (_pos == p) {
+ if(debugMsg)
+ printf("Audio::seek already there\n");
+ return;
+ }
+
+ // p3.3.23
+ //printf("Audio::seek frame:%d\n", p.frame());
+ _pos = p;
+ if (!checkAudioDevice()) return;
+ syncFrame = audioDevice->framePos();
+ frameOffset = syncFrame - _pos.frame();
+ curTickPos = _pos.tick();
+
+ midiSeq->msgSeek(); // handle stuck notes and set
+ // controller for new position
+
+ // p3.3.31
+ // Don't send if external sync is on. The master, and our sync routing system will take care of that.
+ if(!extSyncFlag.value())
+ {
+
+ for(int port = 0; port < MIDI_PORTS; ++port)
+ {
+ MidiPort* mp = &midiPorts[port];
+ MidiDevice* dev = mp->device();
+ //if(!dev || !mp->syncInfo().MCOut())
+ if(!dev || !mp->syncInfo().MRTOut())
+ continue;
+
+ // Added by T356: Shall we check for device write open flag to see if it's ok to send?...
+ // This means obey what the user has chosen for read/write in the midi port config dialog,
+ // which already takes into account whether the device is writable or not.
+ //if(!(dev->rwFlags() & 0x1) || !(dev->openFlags() & 1))
+ //if(!(dev->openFlags() & 1))
+ // continue;
+
+ //int port = dev->midiPort();
+
+ // By checking for no port here (-1), (and out of bounds), it means
+ // the device must be assigned to a port for these MMC commands to be sent.
+ // Without this check, interesting sync things can be done by the user without ever
+ // assigning any devices to ports !
+ //if(port < 0 || port > MIDI_PORTS)
+ //if(port < -1 || port > MIDI_PORTS)
+ // continue;
+
+ int beat = (curTickPos * 4) / config.division;
+
+ bool isPlaying=false;
+ if(state == PLAY)
+ isPlaying = true;
+
+ mp->sendStop();
+ mp->sendSongpos(beat);
+ if(isPlaying)
+ mp->sendContinue();
+ }
+ }
+
+ /*
+ if(genMCSync)
+ {
+ for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd)
+ {
+ MidiDevice* dev = (*imd);
+ if(!dev->syncInfo().MCOut())
+ continue;
+
+ // Added by T356: Shall we check for device write open flag to see if it's ok to send?...
+ // This means obey what the user has chosen for read/write in the midi port config dialog,
+ // which already takes into account whether the device is writable or not.
+ //if(!(dev->rwFlags() & 0x1) || !(dev->openFlags() & 1))
+ //if(!(dev->openFlags() & 1))
+ // continue;
+
+ int port = dev->midiPort();
+
+ // By checking for no port here (-1), (and out of bounds), it means
+ // the device must be assigned to a port for these MMC commands to be sent.
+ // Without this check, interesting sync things can be done by the user without ever
+ // assigning any devices to ports !
+ //if(port < 0 || port > MIDI_PORTS)
+ if(port < -1 || port > MIDI_PORTS)
+ continue;
+
+ int beat = (curTickPos * 4) / config.division;
+
+ bool isPlaying=false;
+ if(state == PLAY)
+ isPlaying = true;
+
+ if(port == -1)
+ // Send straight to the device... Copied from MidiPort.
+ {
+ MidiPlayEvent event(0, 0, 0, ME_STOP, 0, 0);
+ dev->putEvent(event);
+
+ event.setType(ME_SONGPOS);
+ event.setA(beat);
+ dev->putEvent(event);
+
+ if(isPlaying)
+ {
+ event.setType(ME_CONTINUE);
+ event.setA(0);
+ dev->putEvent(event);
+ }
+ }
+ else
+ // Go through the port...
+ {
+ MidiPort* mp = &midiPorts[port];
+
+ mp->sendStop();
+ mp->sendSongpos(beat);
+ if(isPlaying)
+ mp->sendContinue();
+ }
+ }
+ }
+ */
+
+ //loopPassed = true; // for record loop mode
+ if (state != LOOP2 && !freewheel())
+ {
+ // Changed by T356 08/17/08. We need to force prefetch to update,
+ // to ensure the most recent data. Things can happen to a part
+ // before play is pressed - such as part muting, part moving etc.
+ // Without a force, the wrong data was being played.
+ //audioPrefetch->msgSeek(_pos.frame());
+ audioPrefetch->msgSeek(_pos.frame(), true);
+ }
+
+ write(sigFd, "G", 1); // signal seek to gui
+ }
+
+//---------------------------------------------------------
+// writeTick
+// called from audio prefetch thread context
+// write another buffer to soundfile
+//---------------------------------------------------------
+
+void Audio::writeTick()
+ {
+ AudioOutput* ao = song->bounceOutput;
+ if(ao && song->outputs()->find(ao) != song->outputs()->end())
+ {
+ if(ao->recordFlag())
+ ao->record();
+ }
+ WaveTrackList* tl = song->waves();
+ for (iWaveTrack t = tl->begin(); t != tl->end(); ++t) {
+ WaveTrack* track = *t;
+ if (track->recordFlag())
+ track->record();
+ }
+ }
+
+//---------------------------------------------------------
+// startRolling
+//---------------------------------------------------------
+
+void Audio::startRolling()
+ {
+ // Changed by Tim. p3.3.8
+ //startRecordPos = _pos;
+ if(_loopCount == 0)
+ startRecordPos = _pos;
+
+ if (song->record()) {
+ recording = true;
+ TrackList* tracks = song->tracks();
+ for (iTrack i = tracks->begin(); i != tracks->end(); ++i) {
+ if ((*i)->isMidiTrack())
+ continue;
+ if ((*i)->type() == Track::WAVE)
+ ((WaveTrack*)(*i))->resetMeter();
+ }
+ }
+ state = PLAY;
+ write(sigFd, "1", 1); // Play
+
+ // p3.3.31
+ // Don't send if external sync is on. The master, and our sync routing system will take care of that.
+ if(!extSyncFlag.value())
+ {
+
+ // Changed by Tim. p3.3.6
+ //if (genMMC)
+ // midiPorts[txSyncPort].sendSysex(mmcDeferredPlayMsg, sizeof(mmcDeferredPlayMsg));
+ //if (genMCSync) {
+ // if (curTickPos)
+ // midiPorts[txSyncPort].sendContinue();
+ // else
+ // midiPorts[txSyncPort].sendStart();
+ // }
+ for(int port = 0; port < MIDI_PORTS; ++port)
+ {
+ MidiPort* mp = &midiPorts[port];
+ MidiDevice* dev = mp->device();
+ if(!dev)
+ continue;
+
+ // Shall we check open flags?
+ //if(!(dev->rwFlags() & 0x1) || !(dev->openFlags() & 1))
+ //if(!(dev->openFlags() & 1))
+ // continue;
+
+ MidiSyncInfo& si = mp->syncInfo();
+
+ //if(genMMC && si.MMCOut())
+ if(si.MMCOut())
+ //mp->sendSysex(mmcDeferredPlayMsg, sizeof(mmcDeferredPlayMsg));
+ mp->sendMMCDeferredPlay();
+
+ //if(genMCSync && si.MCOut())
+ //if(si.MCOut())
+ if(si.MRTOut())
+ {
+ if(curTickPos)
+ mp->sendContinue();
+ else
+ mp->sendStart();
+ }
+ }
+ }
+
+ /*
+ for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd)
+ {
+ MidiDevice* dev = (*imd);
+
+ // Shall we check open flags?
+ //if(!(dev->rwFlags() & 0x1) || !(dev->openFlags() & 1))
+ //if(!(dev->openFlags() & 1))
+ // continue;
+
+ int port = dev->midiPort();
+
+ // Without this -1 check, interesting sync things can be done by the user without ever
+ // assigning any devices to ports !
+ //if(port < 0 || port > MIDI_PORTS)
+ if(port < -1 || port > MIDI_PORTS)
+ continue;
+
+ MidiSyncInfo& si = dev->syncInfo();
+
+ if(port == -1)
+ // Send straight to the device... Copied from MidiPort.
+ {
+ if(genMMC && si.MMCOut())
+ {
+ MidiPlayEvent event(0, 0, ME_SYSEX, mmcDeferredPlayMsg, sizeof(mmcDeferredPlayMsg));
+ dev->putEvent(event);
+ }
+
+ if(genMCSync && si.MCOut())
+ {
+ if(curTickPos)
+ {
+ MidiPlayEvent event(0, 0, 0, ME_CONTINUE, 0, 0);
+ dev->putEvent(event);
+ }
+ else
+ {
+ MidiPlayEvent event(0, 0, 0, ME_START, 0, 0);
+ dev->putEvent(event);
+ }
+ }
+ }
+ else
+ // Go through the port...
+ {
+ MidiPort* mp = &midiPorts[port];
+
+ if(genMMC && si.MMCOut())
+ mp->sendSysex(mmcDeferredPlayMsg, sizeof(mmcDeferredPlayMsg));
+
+ if(genMCSync && si.MCOut())
+ {
+ if(curTickPos)
+ mp->sendContinue();
+ else
+ mp->sendStart();
+ }
+ }
+ }
+ */
+
+ if (precountEnableFlag
+ && song->click()
+ && !extSyncFlag.value()
+ && song->record()) {
+#if 0
+ state = PRECOUNT;
+ int z, n;
+ if (precountFromMastertrackFlag)
+ sigmap.timesig(playTickPos, z, n);
+ else {
+ z = precountSigZ;
+ n = precountSigN;
+ }
+ clickno = z * preMeasures;
+ clicksMeasure = z;
+ ticksBeat = (division * 4)/n;
+#endif
+ }
+ else {
+ //
+ // compute next midi metronome click position
+ //
+ int bar, beat;
+ unsigned tick;
+ sigmap.tickValues(curTickPos, &bar, &beat, &tick);
+ if (tick)
+ beat += 1;
+ midiClick = sigmap.bar2tick(bar, beat, 0);
+ }
+
+ // reenable sustain
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ MidiPort* mp = &midiPorts[i];
+ for (int ch = 0; ch < MIDI_CHANNELS; ++ch) {
+ if (mp->hwCtrlState(ch, CTRL_SUSTAIN) == 127) {
+ if(mp->device() != NULL) {
+ //printf("send enable sustain!!!!!!!! port %d ch %d\n", i,ch);
+ MidiPlayEvent ev(0, i, ch, ME_CONTROLLER, CTRL_SUSTAIN, 127);
+
+ // may cause problems, called from audio thread
+ mp->device()->playEvents()->add(ev);
+ }
+ }
+ }
+ }
+
+ //tempomap.clearExtTempoList();
+ }
+
+//---------------------------------------------------------
+// stopRolling
+//---------------------------------------------------------
+
+void Audio::stopRolling()
+ {
+ // Added by Tim. p3.3.20
+ //if(debugMsg)
+ // printf("Audio::stopRolling state %s\n", audioStates[state]);
+
+ state = STOP;
+ midiSeq->msgStop();
+
+#if 1 //TODO
+ //---------------------------------------------------
+ // reset sustain
+ //---------------------------------------------------
+
+
+ // clear sustain
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ MidiPort* mp = &midiPorts[i];
+ for (int ch = 0; ch < MIDI_CHANNELS; ++ch) {
+ if (mp->hwCtrlState(ch, CTRL_SUSTAIN) == 127) {
+ if(mp->device()!=NULL) {
+ //printf("send clear sustain!!!!!!!! port %d ch %d\n", i,ch);
+ MidiPlayEvent ev(0, i, ch, ME_CONTROLLER, CTRL_SUSTAIN, 0);
+ // may cause problems, called from audio thread
+ mp->device()->putEvent(ev);
+ }
+ }
+ }
+ }
+
+#endif
+
+ // p3.3.31
+ // Don't send if external sync is on. The master, and our sync routing system will take care of that.
+ if(!extSyncFlag.value())
+ {
+
+ // Changed by Tim. p3.3.6
+ //MidiPort* syncPort = &midiPorts[txSyncPort];
+ //if (genMMC) {
+ // unsigned char mmcPos[] = {
+ // 0x7f, 0x7f, 0x06, 0x44, 0x06, 0x01,
+ // 0, 0, 0, 0, 0
+ // };
+ // int frame = tempomap.tick2frame(curTickPos);
+ // MTC mtc(double(frame) / double(sampleRate));
+ // mmcPos[6] = mtc.h() | (mtcType << 5);
+ // mmcPos[7] = mtc.m();
+ // mmcPos[8] = mtc.s();
+ // mmcPos[9] = mtc.f();
+ // mmcPos[10] = mtc.sf();
+ // syncPort->sendSysex(mmcStopMsg, sizeof(mmcStopMsg));
+ // syncPort->sendSysex(mmcPos, sizeof(mmcPos));
+ // }
+ //if (genMCSync) { // Midi Clock
+ // send STOP and
+ // "set song position pointer"
+ // syncPort->sendStop();
+ // syncPort->sendSongpos(curTickPos * 4 / config.division);
+ // }
+ for(int port = 0; port < MIDI_PORTS; ++port)
+ {
+ MidiPort* mp = &midiPorts[port];
+ MidiDevice* dev = mp->device();
+ if(!dev)
+ continue;
+
+ // Shall we check open flags?
+ //if(!(dev->rwFlags() & 0x1) || !(dev->openFlags() & 1))
+ //if(!(dev->openFlags() & 1))
+ // continue;
+
+ MidiSyncInfo& si = mp->syncInfo();
+
+ //if(genMMC && si.MMCOut())
+ if(si.MMCOut())
+ {
+ //unsigned char mmcPos[] = {
+ // 0x7f, 0x7f, 0x06, 0x44, 0x06, 0x01,
+ // 0, 0, 0, 0, 0
+ // };
+
+ // p3.3.31
+ /*
+ int frame = tempomap.tick2frame(curTickPos);
+ MTC mtc(double(frame) / double(sampleRate));
+ */
+
+ //mmcPos[6] = mtc.h() | (mtcType << 5);
+ //mmcPos[7] = mtc.m();
+ //mmcPos[8] = mtc.s();
+ //mmcPos[9] = mtc.f();
+ //mmcPos[10] = mtc.sf();
+
+ //mp->sendSysex(mmcStopMsg, sizeof(mmcStopMsg));
+ mp->sendMMCStop();
+ //mp->sendSysex(mmcPos, sizeof(mmcPos));
+
+ // p3.3.31
+ // Added check of option send continue not start.
+ // Hmm, is this required? Seems to make other devices unhappy.
+ /*
+ if(!si.sendContNotStart())
+ mp->sendMMCLocate(mtc.h() | (mtcType << 5),
+ mtc.m(), mtc.s(), mtc.f(), mtc.sf());
+ */
+
+ }
+
+ //if(genMCSync && si.MCOut()) // Midi Clock
+ //if(si.MCOut()) // Midi Clock
+ if(si.MRTOut()) //
+ {
+ // send STOP and
+ // "set song position pointer"
+ mp->sendStop();
+
+ // p3.3.31
+ // Added check of option send continue not start.
+ // Hmm, is this required? Seems to make other devices unhappy.
+ /*
+ if(!si.sendContNotStart())
+ mp->sendSongpos(curTickPos * 4 / config.division);
+ */
+
+ }
+ }
+ }
+
+ /*
+ for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd)
+ {
+ MidiDevice* dev = (*imd);
+
+ // Shall we check open flags?
+ //if(!(dev->rwFlags() & 0x1) || !(dev->openFlags() & 1))
+ //if(!(dev->openFlags() & 1))
+ // continue;
+
+ int port = dev->midiPort();
+
+ // Without this -1 check, interesting sync things can be done by the user without ever
+ // assigning any devices to ports !
+ //if(port < 0 || port > MIDI_PORTS)
+ if(port < -1 || port > MIDI_PORTS)
+ continue;
+
+ MidiSyncInfo& si = dev->syncInfo();
+
+ MidiPort* mp = 0;
+ if(port != -1)
+ mp = &midiPorts[port];
+
+ if(genMMC && si.MMCOut())
+ {
+ unsigned char mmcPos[] = {
+ 0x7f, 0x7f, 0x06, 0x44, 0x06, 0x01,
+ 0, 0, 0, 0, 0
+ };
+ int frame = tempomap.tick2frame(curTickPos);
+ MTC mtc(double(frame) / double(sampleRate));
+ mmcPos[6] = mtc.h() | (mtcType << 5);
+ mmcPos[7] = mtc.m();
+ mmcPos[8] = mtc.s();
+ mmcPos[9] = mtc.f();
+ mmcPos[10] = mtc.sf();
+
+ if(mp)
+ // Go through the port...
+ {
+ mp->sendSysex(mmcStopMsg, sizeof(mmcStopMsg));
+ mp->sendSysex(mmcPos, sizeof(mmcPos));
+ }
+ else
+ // Send straight to the device... Copied from MidiPort.
+ {
+ MidiPlayEvent event(0, 0, ME_SYSEX, mmcStopMsg, sizeof(mmcStopMsg));
+ dev->putEvent(event);
+
+ event.setData(mmcPos, sizeof(mmcPos));
+ dev->putEvent(event);
+ }
+ }
+
+ if(genMCSync && si.MCOut()) // Midi Clock
+ {
+ // send STOP and
+ // "set song position pointer"
+ if(mp)
+ // Go through the port...
+ {
+ mp->sendStop();
+ mp->sendSongpos(curTickPos * 4 / config.division);
+ }
+ else
+ // Send straight to the device... Copied from MidiPort.
+ {
+ MidiPlayEvent event(0, 0, 0, ME_STOP, 0, 0);
+ dev->putEvent(event);
+ event.setType(ME_SONGPOS);
+ event.setA(curTickPos * 4 / config.division);
+ dev->putEvent(event);
+ }
+ }
+ }
+ */
+
+ WaveTrackList* tracks = song->waves();
+ for (iWaveTrack i = tracks->begin(); i != tracks->end(); ++i) {
+ WaveTrack* track = *i;
+ track->resetMeter();
+ }
+ recording = false;
+ endRecordPos = _pos;
+ write(sigFd, "0", 1); // STOP
+ }
+
+//---------------------------------------------------------
+// recordStop
+// execution environment: gui thread
+//---------------------------------------------------------
+
+void Audio::recordStop()
+ {
+ audio->msgIdle(true); // gain access to all data structures
+
+ song->startUndo();
+ WaveTrackList* wl = song->waves();
+
+ for (iWaveTrack it = wl->begin(); it != wl->end(); ++it) {
+ WaveTrack* track = *it;
+ if (track->recordFlag() || song->bounceTrack == track) {
+ song->cmdAddRecordedWave(track, startRecordPos, endRecordPos);
+ // The track's _recFile pointer may have been kept and turned
+ // into a SndFileR and added to a new part.
+ // Or _recFile may have been discarded (no new recorded part created).
+ // Regardless, we are done with the pointer itself. Set to zero so
+ // song->setRecordFlag knows about it...
+ track->setRecFile(0);
+ song->setRecordFlag(track, false);
+ }
+ }
+ MidiTrackList* ml = song->midis();
+ for (iMidiTrack it = ml->begin(); it != ml->end(); ++it) {
+ MidiTrack* mt = *it;
+ MPEventList* mpel = mt->mpevents();
+ EventList* el = mt->events();
+
+ //---------------------------------------------------
+ // resolve NoteOff events, Controller etc.
+ //---------------------------------------------------
+
+ //buildMidiEventList(el, mpel, mt, config.division, true);
+ // Do SysexMeta. Do loops.
+ buildMidiEventList(el, mpel, mt, config.division, true, true);
+ song->cmdAddRecordedEvents(mt, el, startRecordPos.tick());
+ el->clear();
+ mpel->clear();
+ }
+
+ //
+ // bounce to file operates on the only
+ // selected output port
+ //
+
+ AudioOutput* ao = song->bounceOutput;
+ if(ao && song->outputs()->find(ao) != song->outputs()->end())
+ {
+ if(ao->recordFlag())
+ {
+ song->bounceOutput = 0;
+ SndFile* sf = ao->recFile();
+ if (sf)
+ delete sf; // close
+ ao->setRecFile(0);
+ ao->setRecordFlag1(false);
+ msgSetRecord(ao, false);
+ }
+ }
+ audio->msgIdle(false);
+ song->endUndo(0);
+ song->setRecord(false);
+ }
+
+//---------------------------------------------------------
+// curFrame
+// extrapolates current play frame on syncTime/syncFrame
+//---------------------------------------------------------
+
+unsigned int Audio::curFrame() const
+ {
+ return lrint((curTime() - syncTime) * sampleRate) + syncFrame;
+ }
+
+//---------------------------------------------------------
+// timestamp
+//---------------------------------------------------------
+
+int Audio::timestamp() const
+ {
+ int t = curFrame() - frameOffset;
+ return t;
+ }
+
+//---------------------------------------------------------
+// sendMsgToGui
+//---------------------------------------------------------
+
+void Audio::sendMsgToGui(char c)
+ {
+ write(sigFd, &c, 1);
+ }
+
diff --git a/muse2/muse/audio.h b/muse2/muse/audio.h
new file mode 100644
index 00000000..fb51ca03
--- /dev/null
+++ b/muse2/muse/audio.h
@@ -0,0 +1,299 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: audio.h,v 1.25.2.13 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __AUDIO_H__
+#define __AUDIO_H__
+
+#include "thread.h"
+#include "pos.h"
+#include "mpevent.h"
+#include "route.h"
+#include "event.h"
+
+class SndFile;
+class PluginI;
+class SynthI;
+class MidiDevice;
+class AudioDevice;
+class Track;
+class AudioTrack;
+class Part;
+class Event;
+class MidiPlayEvent;
+class Event;
+class MidiPort;
+class EventList;
+class MidiInstrument;
+class MidiTrack;
+
+//---------------------------------------------------------
+// AudioMsgId
+// this are the messages send from the GUI thread to
+// the midi thread
+//---------------------------------------------------------
+
+enum {
+ SEQM_ADD_TRACK, SEQM_REMOVE_TRACK, SEQM_CHANGE_TRACK, SEQM_MOVE_TRACK,
+ SEQM_ADD_PART, SEQM_REMOVE_PART, SEQM_CHANGE_PART,
+ SEQM_ADD_EVENT, SEQM_REMOVE_EVENT, SEQM_CHANGE_EVENT,
+ SEQM_ADD_TEMPO, SEQM_SET_TEMPO, SEQM_REMOVE_TEMPO, SEQM_ADD_SIG, SEQM_REMOVE_SIG,
+ SEQM_SET_GLOBAL_TEMPO,
+ SEQM_UNDO, SEQM_REDO,
+ SEQM_RESET_DEVICES, SEQM_INIT_DEVICES, SEQM_PANIC,
+ SEQM_MIDI_LOCAL_OFF,
+ SEQM_SET_MIDI_DEVICE,
+ SEQM_PLAY_MIDI_EVENT,
+ SEQM_SET_HW_CTRL_STATE,
+ SEQM_SET_HW_CTRL_STATES,
+ SEQM_SET_TRACK_OUT_PORT,
+ SEQM_SET_TRACK_OUT_CHAN,
+ SEQM_REMAP_PORT_DRUM_CTL_EVS,
+ SEQM_CHANGE_ALL_PORT_DRUM_CTL_EVS,
+ SEQM_SCAN_ALSA_MIDI_PORTS,
+ SEQM_SET_AUX,
+ SEQM_UPDATE_SOLO_STATES,
+ MIDI_SHOW_INSTR_GUI,
+ AUDIO_RECORD,
+ AUDIO_ROUTEADD, AUDIO_ROUTEREMOVE,
+ AUDIO_VOL, AUDIO_PAN,
+ AUDIO_ADDPLUGIN,
+ AUDIO_SET_SEG_SIZE,
+ AUDIO_SET_PREFADER, AUDIO_SET_CHANNELS,
+ AUDIO_SET_PLUGIN_CTRL_VAL,
+ AUDIO_SWAP_CONTROLLER_IDX,
+ AUDIO_CLEAR_CONTROLLER_EVENTS,
+ AUDIO_SEEK_PREV_AC_EVENT,
+ AUDIO_SEEK_NEXT_AC_EVENT,
+ AUDIO_ERASE_AC_EVENT,
+ AUDIO_ERASE_RANGE_AC_EVENTS,
+ AUDIO_ADD_AC_EVENT,
+ AUDIO_SET_SOLO, AUDIO_SET_SEND_METRONOME,
+ MS_PROCESS, MS_STOP, MS_SET_RTC, MS_UPDATE_POLL_FD,
+ SEQM_IDLE, SEQM_SEEK,
+ };
+
+extern const char* seqMsgList[]; // for debug
+
+//---------------------------------------------------------
+// Msg
+//---------------------------------------------------------
+
+struct AudioMsg : public ThreadMsg { // this should be an union
+ int serialNo;
+ SndFile* downmix;
+ AudioTrack* snode;
+ AudioTrack* dnode;
+ Route sroute, droute;
+ AudioDevice* device;
+ int ival;
+ int iival;
+ double dval;
+ PluginI* plugin;
+ SynthI* synth;
+ Part* spart;
+ Part* dpart;
+ Track* track;
+
+ const void *p1, *p2, *p3;
+ Event ev1, ev2;
+ char port, channel, ctrl;
+ int a, b, c;
+ Pos pos;
+ };
+
+class AudioOutput;
+
+//---------------------------------------------------------
+// Audio
+//---------------------------------------------------------
+
+class Audio {
+ public:
+ enum State {STOP, START_PLAY, PLAY, LOOP1, LOOP2, SYNC, PRECOUNT};
+
+ private:
+ bool _running; // audio is active
+ bool recording; // recording is active
+ bool idle; // do nothing in idle mode
+ bool _freewheel;
+ bool _bounce;
+ //bool loopPassed;
+ unsigned _loopFrame; // Startframe of loop if in LOOP mode. Not quite the same as left marker !
+ int _loopCount; // Number of times we have looped so far
+
+ Pos _pos; // current play position
+
+ unsigned curTickPos; // pos at start of frame during play/record
+ unsigned nextTickPos; // pos at start of next frame during play/record
+
+ //metronome values
+ unsigned midiClick;
+ int clickno; // precount values
+ int clicksMeasure;
+ int ticksBeat;
+
+ double syncTime; // wall clock at last sync point
+ unsigned syncFrame; // corresponding frame no. to syncTime
+ int frameOffset; // offset to free running hw frame counter
+
+ State state;
+
+ AudioMsg* msg;
+ int fromThreadFdw, fromThreadFdr; // message pipe
+
+ int sigFd; // pipe fd for messages to gui
+
+ // record values:
+ Pos startRecordPos;
+ Pos endRecordPos;
+
+ //
+ AudioOutput* _audioMaster;
+ AudioOutput* _audioMonitor;
+
+ void sendLocalOff();
+ bool filterEvent(const MidiPlayEvent* event, int type, bool thru);
+
+ void startRolling();
+ void stopRolling();
+
+ void panic();
+ void processMsg(AudioMsg* msg);
+ void process1(unsigned samplePos, unsigned offset, unsigned samples);
+
+ void collectEvents(MidiTrack*, unsigned int startTick, unsigned int endTick);
+
+ public:
+ Audio();
+ virtual ~Audio() {}
+
+ void process(unsigned frames);
+ bool sync(int state, unsigned frame);
+ void shutdown();
+ void writeTick();
+
+ // transport:
+ bool start();
+ void stop(bool);
+ void seek(const Pos& pos);
+
+ bool isPlaying() const { return state == PLAY || state == LOOP1 || state == LOOP2; }
+ bool isRecording() const { return state == PLAY && recording; }
+ void setRunning(bool val) { _running = val; }
+ bool isRunning() const { return _running; }
+
+ //-----------------------------------------
+ // message interface
+ //-----------------------------------------
+
+ void msgSeek(const Pos&);
+ void msgPlay(bool val);
+
+ void msgRemoveTrack(Track*, bool u = true);
+ void msgRemoveTracks();
+ void msgChangeTrack(Track* oldTrack, Track* newTrack, bool u = true);
+ void msgMoveTrack(int idx1, int dx2, bool u = true);
+ void msgAddPart(Part*, bool u = true);
+ void msgRemovePart(Part*, bool u = true);
+ //void msgChangePart(Part* oldPart, Part* newPart, bool u = true);
+ void msgChangePart(Part* oldPart, Part* newPart, bool u = true, bool doCtrls = true, bool doClones = false);
+ //void msgAddEvent(Event&, Part*, bool u = true);
+ void msgAddEvent(Event&, Part*, bool u = true, bool doCtrls = true, bool doClones = false);
+ //void msgDeleteEvent(Event&, Part*, bool u = true);
+ void msgDeleteEvent(Event&, Part*, bool u = true, bool doCtrls = true, bool doClones = false);
+ //void msgChangeEvent(Event&, Event&, Part*, bool u = true);
+ void msgChangeEvent(Event&, Event&, Part*, bool u = true, bool doCtrls = true, bool doClones = false);
+ void msgScanAlsaMidiPorts();
+ void msgAddTempo(int tick, int tempo, bool doUndoFlag = true);
+ void msgSetTempo(int tick, int tempo, bool doUndoFlag = true);
+ void msgUpdateSoloStates();
+ void msgSetAux(AudioTrack*, int, double);
+ void msgSetGlobalTempo(int val);
+ void msgDeleteTempo(int tick, int tempo, bool doUndoFlag = true);
+ void msgAddSig(int tick, int z, int n, bool doUndoFlag = true);
+ void msgRemoveSig(int tick, int z, int n, bool doUndoFlag = true);
+ void msgShowInstrumentGui(MidiInstrument*, bool);
+ void msgPanic();
+ void sendMsg(AudioMsg*);
+ bool sendMessage(AudioMsg* m, bool doUndo);
+ void msgRemoveRoute(Route, Route);
+ void msgRemoveRoute1(Route, Route);
+ void msgAddRoute(Route, Route);
+ void msgAddRoute1(Route, Route);
+ void msgAddPlugin(AudioTrack*, int idx, PluginI* plugin);
+ void msgSetMute(AudioTrack*, bool val);
+ void msgSetVolume(AudioTrack*, double val);
+ void msgSetPan(AudioTrack*, double val);
+ void msgAddSynthI(SynthI* synth);
+ void msgRemoveSynthI(SynthI* synth);
+ void msgSetSegSize(int, int);
+ void msgSetPrefader(AudioTrack*, int);
+ void msgSetChannels(AudioTrack*, int);
+ void msgSetOff(AudioTrack*, bool);
+ void msgSetRecord(AudioTrack*, bool);
+ void msgUndo();
+ void msgRedo();
+ void msgLocalOff();
+ void msgInitMidiDevices();
+ void msgResetMidiDevices();
+ void msgIdle(bool);
+ void msgBounce();
+ //void msgSetPluginCtrlVal(PluginI* /*plugin*/, int /*param*/, double /*val*/);
+ void msgSetPluginCtrlVal(AudioTrack*, int /*param*/, double /*val*/);
+ void msgSwapControllerIDX(AudioTrack*, int, int);
+ void msgClearControllerEvents(AudioTrack*, int);
+ void msgSeekPrevACEvent(AudioTrack*, int);
+ void msgSeekNextACEvent(AudioTrack*, int);
+ void msgEraseACEvent(AudioTrack*, int, int);
+ void msgEraseRangeACEvents(AudioTrack*, int, int, int);
+ void msgAddACEvent(AudioTrack*, int, int, double);
+ void msgSetSolo(Track*, bool);
+ void msgSetHwCtrlState(MidiPort*, int, int, int);
+ void msgSetHwCtrlStates(MidiPort*, int, int, int, int);
+ void msgSetTrackOutChannel(MidiTrack*, int);
+ void msgSetTrackOutPort(MidiTrack*, int);
+ void msgRemapPortDrumCtlEvents(int, int, int, int);
+ void msgChangeAllPortDrumCtrlEvents(bool, bool);
+ void msgSetSendMetronome(AudioTrack*, bool);
+
+ void msgPlayMidiEvent(const MidiPlayEvent* event);
+ void rescanAlsaPorts();
+
+ void midiPortsChanged();
+
+ const Pos& pos() const { return _pos; }
+ const Pos& getStartRecordPos() const { return startRecordPos; }
+ const Pos& getEndRecordPos() const { return endRecordPos; }
+ int loopCount() { return _loopCount; } // Number of times we have looped so far
+ unsigned loopFrame() { return _loopFrame; }
+
+ int tickPos() const { return curTickPos; }
+ int timestamp() const;
+ void processMidi();
+ unsigned curFrame() const;
+ void recordStop();
+ bool freewheel() const { return _freewheel; }
+ void setFreewheel(bool val);
+ int getFrameOffset() const { return frameOffset; }
+ void initDevices();
+
+ AudioOutput* audioMaster() const { return _audioMaster; }
+ AudioOutput* audioMonitor() const { return _audioMonitor; }
+ void setMaster(AudioOutput* track) { _audioMaster = track; }
+ void setMonitor(AudioOutput* track) { _audioMonitor = track; }
+ void sendMsgToGui(char c);
+ bool bounce() const { return _bounce; }
+ };
+
+extern int processAudio(unsigned long, void*);
+extern void processAudio1(void*, void*);
+
+extern Audio* audio;
+extern AudioDevice* audioDevice; // current audio device in use
+#endif
+
diff --git a/muse2/muse/audioconvert.cpp b/muse2/muse/audioconvert.cpp
new file mode 100644
index 00000000..878bc8e7
--- /dev/null
+++ b/muse2/muse/audioconvert.cpp
@@ -0,0 +1,886 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: audioconvert.cpp,v 1.1.1.1 2009/12/28 16:07:33 terminator356 Exp $
+//
+// (C) Copyright 1999-2009 Werner Schweer (ws@seh.de)
+//
+// Audio converter module created by Tim terminator356
+//=========================================================
+
+#include <math.h>
+
+#include "wave.h"
+#include "globals.h"
+#include "audioconvert.h"
+#include "eventbase.h"
+
+//#define AUDIOCONVERT_DEBUG
+//#define AUDIOCONVERT_DEBUG_PRC
+
+//---------------------------------------------------------
+// AudioConvertMap
+//---------------------------------------------------------
+
+void AudioConvertMap::remapEvents(const EventList* el)
+{
+
+}
+
+iAudioConvertMap AudioConvertMap::addEvent(EventBase* eb)
+{
+ iAudioConvertMap iacm = getConverter(eb);
+ if(iacm == end())
+ {
+ AudioConverter* cv = 0;
+ if(!eb->sndFile().isNull())
+ cv = new SRCAudioConverter(eb->sndFile().channels(), SRC_SINC_MEDIUM_QUALITY);
+
+ // Use insert with hint for speed.
+ return insert(iacm, std::pair<EventBase*, AudioConverter*> (eb, cv));
+ }
+ else
+ // Adopt a policy of returning an already existing item to enforce no-duplicates.
+ return iacm;
+}
+
+void AudioConvertMap::removeEvent(EventBase* eb)
+{
+ iAudioConvertMap iacm = find(eb);
+ if(iacm != end())
+ {
+ AudioConverter* cv = iacm->second;
+ if(cv)
+ delete cv;
+ erase(iacm);
+ }
+}
+
+iAudioConvertMap AudioConvertMap::getConverter(EventBase* eb)
+{
+ return find(eb);
+}
+
+//---------------------------------------------------------
+// AudioConverter
+//---------------------------------------------------------
+
+AudioConverter::AudioConverter()
+{
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("AudioConverter::AudioConverter this:%p\n", this);
+ #endif
+
+ _refCount = 1;
+ _sfCurFrame = 0;
+}
+
+AudioConverter::~AudioConverter()
+{
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("AudioConverter::~AudioConverter this:%p\n", this);
+ #endif
+}
+
+AudioConverter* AudioConverter::reference()
+{
+ _refCount += 1;
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("AudioConverter::reference this:%p current refcount:%d\n", this, _refCount);
+ #endif
+ return this;
+}
+
+AudioConverter* AudioConverter::release(AudioConverter* cv)
+{
+ if(!cv)
+ return 0;
+ //if(cv->incRefCount(-1) <= 0)
+ cv->_refCount -= 1;
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("AudioConverter::release converter:%p current refcount:%d\n", cv, cv->_refCount);
+ #endif
+ if(cv->_refCount <= 0)
+ {
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("AudioConverter::release deleting converter:%p\n", cv);
+ #endif
+ delete cv;
+ cv = 0;
+ }
+ return cv;
+}
+
+//off_t AudioConverter::readAudio(SndFileR& f, off_t sfCurFrame, unsigned offset, float** buffer, int channel, int n, bool doSeek, bool overwrite)
+off_t AudioConverter::readAudio(SndFileR& f, unsigned offset, float** buffer, int channel, int n, bool doSeek, bool overwrite)
+{
+ if(f.isNull())
+ return _sfCurFrame;
+
+ // Added by Tim. p3.3.17
+ //#ifdef AUDIOCONVERT_DEBUG_PRC
+ //printf("AudioConverter::process %s audConv:%p sfCurFrame:%ld offset:%u channel:%d fchan:%d n:%d\n",
+ // f.name().latin1(), this, sfCurFrame, offset, channel, f.channels(), n);
+ //#endif
+
+ off_t frame = offset; // _spos is added before the call.
+ unsigned fsrate = f.samplerate();
+ bool resample = isValid() && ((unsigned)sampleRate != fsrate);
+
+ // No resampling needed?
+ if(!resample)
+ {
+ // Sample rates are the same. Just a regular seek + read, no conversion.
+ _sfCurFrame = f.seek(frame, 0);
+ return _sfCurFrame + f.read(channel, buffer, n, overwrite);
+ }
+
+ // Is a 'transport' seek requested? (Not to be requested with every read! Should only be for 'first read' seeks, or positional 'transport' seeks.)
+ // Due to the support of sound file references in MusE, seek must ALWAYS be done before read, as before,
+ // except now we alter the seek position if sample rate conversion is being used and remember the seek positions.
+ if(doSeek)
+ {
+ // Sample rates are different. Seek to a calculated 'sample rate ratio factored' position.
+
+ double srcratio = (double)fsrate / (double)sampleRate;
+ //long inSize = long((double)frames * _src_ratio) + 1 // From MusE-2 file converter.
+ off_t newfr = (off_t)floor(((double)frame * srcratio)); // From simplesynth.
+
+ _sfCurFrame = f.seek(newfr, 0);
+
+ // Added by Tim. p3.3.17
+ //#ifdef AUDIOCONVERT_DEBUG_PRC
+ //printf("AudioConverter::process Seek frame:%ld converted to frame:%ld sfCurFrame:%ld\n", frame, newfr, sfCurFrame);
+ //#endif
+
+ // Reset the converter. Its current state is meaningless now.
+ reset();
+ }
+ else
+ {
+ // No seek requested.
+ // Added by Tim. p3.3.17
+ //#ifdef AUDIOCONVERT_DEBUG_PRC
+ //printf("AudioConverter::process No 'transport' seek, rates different. Seeking to sfCurFrame:%ld\n", sfCurFrame);
+ //#endif
+
+ // Sample rates are different. We can't just tell seek to go to an absolute calculated position,
+ // since the last position can vary - it might not be what the calculated position is.
+ // We must use the last position left by SRC conversion, ie. let the file position progress on its own.
+ _sfCurFrame = f.seek(_sfCurFrame, 0);
+ }
+
+ /*
+ int fchan = f.channels();
+ long outFrames = n;
+ long outSize = outFrames * fchan;
+ float outbuffer[outSize];
+ */
+
+ //sfCurFrame = process(f, sfCurFrame, offset, &outbuffer[0], channel, n);
+// sfCurFrame = process(f, sfCurFrame, outbuffer, channel, n);
+ //sfCurFrame = process(f, sfCurFrame, buffer, channel, n, overwrite);
+ _sfCurFrame = process(f, buffer, channel, n, overwrite);
+
+ /*
+ float* poutbuf = &outbuffer[0];
+ if(fchan == channel)
+ {
+ if(overwrite)
+ //for (size_t i = 0; i < rn; ++i)
+ for (int i = 0; i < n; ++i)
+ {
+ for(int ch = 0; ch < channel; ++ch)
+ *(buffer[ch] + i) = *poutbuf++;
+ }
+ else
+ //for(size_t i = 0; i < rn; ++i)
+ for(int i = 0; i < n; ++i)
+ {
+ for(int ch = 0; ch < channel; ++ch)
+ *(buffer[ch] + i) += *poutbuf++;
+ }
+ }
+ else if((fchan == 2) && (channel == 1))
+ {
+ // stereo to mono
+ if(overwrite)
+ //for(size_t i = 0; i < rn; ++i)
+ for(int i = 0; i < n; ++i)
+ *(buffer[0] + i) = poutbuf[i + i] + poutbuf[i + i + 1];
+ else
+ //for(size_t i = 0; i < rn; ++i)
+ for(int i = 0; i < n; ++i)
+ *(buffer[0] + i) += poutbuf[i + i] + poutbuf[i + i + 1];
+ }
+ else if((fchan == 1) && (channel == 2))
+ {
+ // mono to stereo
+ if(overwrite)
+ //for(size_t i = 0; i < rn; ++i)
+ for(int i = 0; i < n; ++i)
+ {
+ float data = *poutbuf++;
+ *(buffer[0]+i) = data;
+ *(buffer[1]+i) = data;
+ }
+ else
+ //for(size_t i = 0; i < rn; ++i)
+ for(int i = 0; i < n; ++i)
+ {
+ float data = *poutbuf++;
+ *(buffer[0]+i) += data;
+ *(buffer[1]+i) += data;
+ }
+ }
+ else
+ {
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("AudioConverter::readAudio Channel mismatch: source chans:%d -> dst chans:%d\n", fchan, channel);
+ #endif
+ }
+ */
+
+ return _sfCurFrame;
+}
+
+//---------------------------------------------------------
+// SRCAudioConverter
+//---------------------------------------------------------
+
+SRCAudioConverter::SRCAudioConverter(int channels, int type) : AudioConverter()
+{
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("SRCAudioConverter::SRCAudioConverter this:%p channels:%d type:%d\n", this, channels, type);
+ #endif
+
+ _type = type;
+ _src_state = 0;
+ _channels = channels;
+
+ int srcerr;
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("SRCAudioConverter::SRCaudioConverter Creating samplerate converter type:%d with %d channels\n", _type, _channels);
+ #endif
+ _src_state = src_new(_type, _channels, &srcerr);
+ if(!_src_state)
+ printf("SRCAudioConverter::SRCaudioConverter Creation of samplerate converter type:%d with %d channels failed:%s\n", _type, _channels, src_strerror(srcerr));
+}
+
+SRCAudioConverter::~SRCAudioConverter()
+{
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("SRCAudioConverter::~SRCAudioConverter this:%p\n", this);
+ #endif
+ if(_src_state)
+ src_delete(_src_state);
+}
+
+void SRCAudioConverter::setChannels(int ch)
+{
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("SRCAudioConverter::setChannels this:%p channels:%d\n", this, ch);
+ #endif
+ if(_src_state)
+ src_delete(_src_state);
+ _src_state = 0;
+
+ _channels = ch;
+ int srcerr;
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("SRCAudioConverter::setChannels Creating samplerate converter type:%d with %d channels\n", _type, ch);
+ #endif
+ _src_state = src_new(_type, ch, &srcerr);
+ if(!_src_state)
+ printf("SRCAudioConverter::setChannels of samplerate converter type:%d with %d channels failed:%s\n", _type, ch, src_strerror(srcerr));
+ return;
+}
+
+void SRCAudioConverter::reset()
+{
+ if(!_src_state)
+ return;
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("SRCAudioConverter::reset this:%p\n", this);
+ #endif
+ int srcerr = src_reset(_src_state);
+ if(srcerr != 0)
+ printf("SRCAudioConverter::reset Converter reset failed: %s\n", src_strerror(srcerr));
+ return;
+}
+
+//off_t SRCAudioConverter::process(SndFileR& f, off_t sfCurFrame, float** buffer, int channel, int n, bool overwrite)
+off_t SRCAudioConverter::process(SndFileR& f, float** buffer, int channel, int n, bool overwrite)
+{
+ //return src_process(_src_state, sd);
+
+ if(f.isNull())
+ //return;
+ return _sfCurFrame;
+
+ // Added by Tim. p3.3.17
+ //#ifdef AUDIOCONVERT_DEBUG_PRC
+ //printf("AudioConverter::process %s audConv:%p sfCurFrame:%ld offset:%u channel:%d fchan:%d n:%d\n",
+ // f.name().latin1(), this, sfCurFrame, offset, channel, f.channels(), n);
+ //#endif
+
+// off_t frame = offset; // _spos is added before the call.
+ unsigned fsrate = f.samplerate();
+ //bool resample = src_state && ((unsigned)sampleRate != fsrate);
+// bool resample = isValid() && ((unsigned)sampleRate != fsrate);
+
+ if((sampleRate == 0) || (fsrate == 0))
+ {
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("SRCAudioConverter::process Error: sampleRate or file samplerate is zero!\n");
+ #endif
+ return _sfCurFrame;
+ }
+
+ SRC_DATA srcdata;
+ int fchan = f.channels();
+ // Ratio is defined as output sample rate over input samplerate.
+ double srcratio = (double)sampleRate / (double)fsrate;
+ // Extra input compensation.
+ long inComp = 1;
+
+ long outFrames = n;
+ //long outSize = outFrames * channel;
+ long outSize = outFrames * fchan;
+
+ //long inSize = long(outSize * srcratio) + 1 // From MusE-2 file converter.
+ //long inSize = (long)floor(((double)outSize / srcratio)); // From simplesynth.
+ //long inFrames = (long)floor(((double)outFrames / srcratio)); // From simplesynth.
+ long inFrames = (long)ceil(((double)outFrames / srcratio)) + inComp; // From simplesynth.
+ //long inFrames = (long)floor(double(outFrames * sfinfo.samplerate) / double(sampleRate)); // From simplesynth.
+
+ long inSize = inFrames * fchan;
+ //long inSize = inFrames * channel;
+
+ // Start with buffers at expected sizes. We won't need anything larger than this, but add 4 for good luck.
+ float inbuffer[inSize + 4];
+ float outbuffer[outSize];
+
+ //size_t sfTotalRead = 0;
+ size_t rn = 0;
+ long totalOutFrames = 0;
+
+ srcdata.data_in = inbuffer;
+ srcdata.data_out = outbuffer;
+// srcdata.data_out = buffer;
+
+ // Set some kind of limit on the number of attempts to completely fill the output buffer,
+ // in case something is really screwed up - we don't want to get stuck in a loop here.
+ int attempts = 10;
+ for(int attempt = 0; attempt < attempts; ++attempt)
+ {
+ rn = f.readDirect(inbuffer, inFrames);
+ //sfTotalRead += rn;
+
+ // convert
+ //srcdata.data_in = inbuffer;
+ //srcdata.data_out = outbuffer;
+ //srcdata.data_out = poutbuf;
+ //srcdata.input_frames = inSize;
+ srcdata.input_frames = rn;
+ srcdata.output_frames = outFrames;
+ srcdata.end_of_input = ((long)rn != inFrames);
+ srcdata.src_ratio = srcratio;
+
+ //#ifdef AUDIOCONVERT_DEBUG_PRC
+ //printf("AudioConverter::process attempt:%d inFrames:%ld outFrames:%ld rn:%d data in:%p out:%p",
+ // attempt, inFrames, outFrames, rn, srcdata.data_in, srcdata.data_out);
+ //#endif
+
+ int srcerr = src_process(_src_state, &srcdata);
+ if(srcerr != 0)
+ {
+ printf("\nSRCAudioConverter::process SampleRate converter process failed: %s\n", src_strerror(srcerr));
+ return _sfCurFrame += rn;
+ }
+
+ totalOutFrames += srcdata.output_frames_gen;
+
+ //#ifdef AUDIOCONVERT_DEBUG_PRC
+ //printf(" frames used in:%ld out:%ld totalOutFrames:%ld data in:%p out:%p\n", srcdata.input_frames_used, srcdata.output_frames_gen, totalOutFrames, srcdata.data_in, srcdata.data_out);
+ //#endif
+
+ #ifdef AUDIOCONVERT_DEBUG
+ if(srcdata.output_frames_gen != outFrames)
+ printf("SRCAudioConverter::process %s output_frames_gen:%ld != outFrames:%ld inFrames:%ld srcdata.input_frames_used:%ld rn:%d\n",
+ f.name().latin1(), srcdata.output_frames_gen, outFrames, inFrames, srcdata.input_frames_used, rn);
+ #endif
+
+ // If the number of frames read by the soundfile equals the input frames, go back.
+ // Otherwise we have reached the end of the file, so going back is useless since
+ // there shouldn't be any further calls.
+ if((long)rn == inFrames)
+ {
+ // Go back by the amount of unused frames.
+ sf_count_t seekn = inFrames - srcdata.input_frames_used;
+ if(seekn != 0)
+ {
+ #ifdef AUDIOCONVERT_DEBUG_PRC
+ printf("SRCAudioConverter::process Seek-back by:%d\n", seekn);
+ #endif
+ _sfCurFrame = f.seek(-seekn, SEEK_CUR);
+ }
+ else
+ _sfCurFrame += rn;
+
+ if(totalOutFrames == n)
+ {
+ // We got our desired number of output frames. Stop attempting.
+ break;
+ }
+ else
+ {
+ // No point in continuing if on last attempt.
+ if(attempt == (attempts - 1))
+ break;
+
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("SRCAudioConverter::process %s attempt:%d totalOutFrames:%ld != n:%d try again\n", f.name().latin1(), attempt, totalOutFrames, n);
+ #endif
+
+ // SRC didn't give us the number of frames we requested.
+ // This can occasionally be radically different from the requested frames, or zero,
+ // even when ample excess input frames are supplied.
+ // Move the src output pointer to a new position.
+ srcdata.data_out += srcdata.output_frames_gen * channel;
+ // Set new number of maximum out frames.
+ outFrames -= srcdata.output_frames_gen;
+ // Calculate the new number of file input frames required.
+ inFrames = (long)ceil(((double)outFrames / srcratio)) + inComp;
+ // Keep trying.
+ continue;
+ }
+ }
+ else
+ {
+ _sfCurFrame += rn;
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("SRCAudioConverter::process %s rn:%zd != inFrames:%ld output_frames_gen:%ld outFrames:%ld srcdata.input_frames_used:%ld\n",
+ f.name().latin1(), rn, inFrames, srcdata.output_frames_gen, outFrames, srcdata.input_frames_used);
+ #endif
+
+ // We've reached the end of the file. Convert the number of frames read.
+ //rn = (double)rn * srcratio + 1;
+ //rn = (long)floor((double)rn * srcratio);
+ //if(rn > (size_t)outFrames)
+ // rn = outFrames;
+ // Stop attempting.
+ break;
+ }
+ }
+
+ // If we still didn't get the desired number of output frames.
+ if(totalOutFrames != n)
+ {
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("SRCAudioConverter::process %s totalOutFrames:%ld != n:%d\n", f.name().latin1(), totalOutFrames, n);
+ #endif
+
+ // Let's zero the rest of it.
+ long b = totalOutFrames * channel;
+ long e = n * channel;
+ for(long i = b; i < e; ++i)
+ outbuffer[i] = 0.0f;
+ //buffer[i] = 0.0f;
+ }
+
+ //float* poutbuf = &outbuffer[0];
+ float* poutbuf = outbuffer;
+ if(fchan == channel)
+ {
+ if(overwrite)
+ //for (size_t i = 0; i < rn; ++i)
+ for (int i = 0; i < n; ++i)
+ {
+ for(int ch = 0; ch < channel; ++ch)
+ *(buffer[ch] + i) = *poutbuf++;
+ }
+ else
+ //for(size_t i = 0; i < rn; ++i)
+ for(int i = 0; i < n; ++i)
+ {
+ for(int ch = 0; ch < channel; ++ch)
+ *(buffer[ch] + i) += *poutbuf++;
+ }
+ }
+ else if((fchan == 2) && (channel == 1))
+ {
+ // stereo to mono
+ if(overwrite)
+ //for(size_t i = 0; i < rn; ++i)
+ for(int i = 0; i < n; ++i)
+ *(buffer[0] + i) = poutbuf[i + i] + poutbuf[i + i + 1];
+ else
+ //for(size_t i = 0; i < rn; ++i)
+ for(int i = 0; i < n; ++i)
+ *(buffer[0] + i) += poutbuf[i + i] + poutbuf[i + i + 1];
+ }
+ else if((fchan == 1) && (channel == 2))
+ {
+ // mono to stereo
+ if(overwrite)
+ //for(size_t i = 0; i < rn; ++i)
+ for(int i = 0; i < n; ++i)
+ {
+ float data = *poutbuf++;
+ *(buffer[0]+i) = data;
+ *(buffer[1]+i) = data;
+ }
+ else
+ //for(size_t i = 0; i < rn; ++i)
+ for(int i = 0; i < n; ++i)
+ {
+ float data = *poutbuf++;
+ *(buffer[0]+i) += data;
+ *(buffer[1]+i) += data;
+ }
+ }
+ else
+ {
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("SRCAudioConverter::process Channel mismatch: source chans:%d -> dst chans:%d\n", fchan, channel);
+ #endif
+ }
+
+ return _sfCurFrame;
+}
+
+#ifdef RUBBERBAND_SUPPORT
+
+//---------------------------------------------------------
+// RubberBandAudioConverter
+//---------------------------------------------------------
+
+RubberBandAudioConverter::RubberBandAudioConverter(int channels, int options) : AudioConverter()
+{
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("RubberBandAudioConverter::RubberBandAudioConverter this:%p channels:%d options:%x\n", this, channels, options);
+ #endif
+
+ _options = options;
+ _rbs = 0;
+ _channels = channels;
+
+ _rbs = new RubberBandStretcher(sampleRate, _channels, _options); // , initialTimeRatio = 1.0, initialPitchScale = 1.0
+}
+
+RubberBandAudioConverter::~RubberBandAudioConverter()
+{
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("RubberBandAudioConverter::~RubberBandAudioConverter this:%p\n", this);
+ #endif
+ if(_rbs)
+ delete _rbs;
+}
+
+void RubberBandAudioConverter::setChannels(int ch)
+{
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("RubberBandAudioConverter::setChannels this:%p channels:%d\n", this, ch);
+ #endif
+ if(_rbs)
+ delete _rbs;
+ _rbs = 0;
+
+ _channels = ch;
+ _rbs = new RubberBandStretcher(sampleRate, _channels, _options); // , initialTimeRatio = 1.0, initialPitchScale = 1.0
+}
+
+void RubberBandAudioConverter::reset()
+{
+ if(!_rbs)
+ return;
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("RubberBandAudioConverter::reset this:%p\n", this);
+ #endif
+ _rbs->reset();
+ return;
+}
+
+/////////////////////////////////
+// TODO: Not finished yet..
+////////////////////////////////
+//off_t RubberBandAudioConverter::process(SndFileR& f, off_t sfCurFrame, float** buffer, int channel, int n, bool overwrite)
+off_t RubberBandAudioConverter::process(SndFileR& f, float** buffer, int channel, int n, bool overwrite)
+{
+ //return src_process(_src_state, sd);
+
+ if(f.isNull())
+ //return;
+ return _sfCurFrame;
+
+ // Added by Tim. p3.3.17
+ //#ifdef AUDIOCONVERT_DEBUG_PRC
+ //printf("AudioConverter::process %s audConv:%p sfCurFrame:%ld offset:%u channel:%d fchan:%d n:%d\n",
+ // f.name().latin1(), this, sfCurFrame, offset, channel, f.channels(), n);
+ //#endif
+
+// off_t frame = offset; // _spos is added before the call.
+ unsigned fsrate = f.samplerate();
+ //bool resample = src_state && ((unsigned)sampleRate != fsrate);
+// bool resample = isValid() && ((unsigned)sampleRate != fsrate);
+
+ if((sampleRate == 0) || (fsrate == 0))
+ {
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("RubberBandAudioConverter::process Error: sampleRate or file samplerate is zero!\n");
+ #endif
+ return _sfCurFrame;
+ }
+
+// SRC_DATA srcdata;
+ int fchan = f.channels();
+ // Ratio is defined as output sample rate over input samplerate.
+ double srcratio = (double)sampleRate / (double)fsrate;
+ // Extra input compensation.
+ long inComp = 1;
+
+ long outFrames = n;
+ //long outSize = outFrames * channel;
+ long outSize = outFrames * fchan;
+
+ //long inSize = long(outSize * srcratio) + 1 // From MusE-2 file converter.
+ //long inSize = (long)floor(((double)outSize / srcratio)); // From simplesynth.
+ //long inFrames = (long)floor(((double)outFrames / srcratio)); // From simplesynth.
+ long inFrames = (long)ceil(((double)outFrames / srcratio)) + inComp; // From simplesynth.
+ //long inFrames = (long)floor(double(outFrames * sfinfo.samplerate) / double(sampleRate)); // From simplesynth.
+
+ long inSize = inFrames * fchan;
+ //long inSize = inFrames * channel;
+
+ // Start with buffers at expected sizes. We won't need anything larger than this, but add 4 for good luck.
+ float inbuffer[inSize]; // +4
+// float outbuffer[outSize];
+
+ //float* rbinbuffer[fchan];
+ //float rbindata[inSize];
+ //for (int i = 0; i < fchan; ++i)
+ // rbinbuffer[i] = rbindata + i * inFrames;
+
+ float* rboutbuffer[fchan];
+ float rboutdata[outSize];
+ for (int i = 0; i < fchan; ++i)
+ rboutbuffer[i] = rboutdata + i * outFrames;
+
+ //size_t sfTotalRead = 0;
+ size_t rn = 0;
+ long totalOutFrames = 0;
+
+// srcdata.data_in = inbuffer;
+ //srcdata.data_out = outbuffer;
+// srcdata.data_out = buffer;
+ float** data_out = rboutbuffer;
+
+ // For just sample rate conversion, apply same ratio to both time and pitch.
+ _rbs->setTimeRatio(srcratio);
+ _rbs->setPitchScale(srcratio);
+
+ // Set some kind of limit on the number of attempts to completely fill the output buffer,
+ // in case something is really screwed up - we don't want to get stuck in a loop here.
+ int attempts = 10;
+ for(int attempt = 0; attempt < attempts; ++attempt)
+ {
+ size_t sreq = _rbs->getSamplesRequired();
+
+ size_t rbinSize = sreq * fchan;
+ float* rbinbuffer[fchan];
+ float rbindata[rbinSize];
+ for(int i = 0; i < fchan; ++i)
+ rbinbuffer[i] = rbindata + i * sreq;
+
+// rn = f.readDirect(inbuffer, inFrames);
+ rn = f.readDirect(inbuffer, sreq);
+ //sfTotalRead += rn;
+
+ // Must de-interleave soundfile data to feed to rubberband.
+ for(size_t i = 0; i < rn; ++i)
+ {
+ for(int ch = 0; ch < fchan; ++ch)
+ *(rbinbuffer[ch] + i) = *inbuffer++;
+ }
+
+ _rbs->process(rbinbuffer, rn, (long)rn != inFrames);
+
+ // "This function returns -1 if all data has been fully processed and all output read, and the stretch process is now finished."
+ int savail = _rbs->available();
+
+
+ // convert
+ //srcdata.data_in = inbuffer;
+ //srcdata.data_out = outbuffer;
+ //srcdata.data_out = poutbuf;
+ //srcdata.input_frames = inSize;
+ srcdata.input_frames = rn;
+ srcdata.output_frames = outFrames;
+ srcdata.end_of_input = ((long)rn != inFrames);
+ srcdata.src_ratio = srcratio;
+
+ //#ifdef AUDIOCONVERT_DEBUG_PRC
+ //printf("AudioConverter::process attempt:%d inFrames:%ld outFrames:%ld rn:%d data in:%p out:%p",
+ // attempt, inFrames, outFrames, rn, srcdata.data_in, srcdata.data_out);
+ //#endif
+
+ int srcerr = src_process(_src_state, &srcdata);
+ if(srcerr != 0)
+ {
+ printf("\RubberBandAudioConverter::process SampleRate converter process failed: %s\n", src_strerror(srcerr));
+ return _sfCurFrame += rn;
+ }
+
+ totalOutFrames += srcdata.output_frames_gen;
+
+ //#ifdef AUDIOCONVERT_DEBUG_PRC
+ //printf(" frames used in:%ld out:%ld totalOutFrames:%ld data in:%p out:%p\n", srcdata.input_frames_used, srcdata.output_frames_gen, totalOutFrames, srcdata.data_in, srcdata.data_out);
+ //#endif
+
+ #ifdef AUDIOCONVERT_DEBUG
+ if(srcdata.output_frames_gen != outFrames)
+ printf("RubberBandAudioConverter::process %s output_frames_gen:%ld != outFrames:%ld inFrames:%ld srcdata.input_frames_used:%ld rn:%d\n",
+ f.name().latin1(), srcdata.output_frames_gen, outFrames, inFrames, srcdata.input_frames_used, rn);
+ #endif
+
+ // If the number of frames read by the soundfile equals the input frames, go back.
+ // Otherwise we have reached the end of the file, so going back is useless since
+ // there shouldn't be any further calls.
+ if((long)rn == inFrames)
+ {
+ // Go back by the amount of unused frames.
+ sf_count_t seekn = inFrames - srcdata.input_frames_used;
+ if(seekn != 0)
+ {
+ #ifdef AUDIOCONVERT_DEBUG_PRC
+ printf("RubberBandAudioConverter::process Seek-back by:%d\n", seekn);
+ #endif
+ _sfCurFrame = f.seek(-seekn, SEEK_CUR);
+ }
+ else
+ _sfCurFrame += rn;
+
+ if(totalOutFrames == n)
+ {
+ // We got our desired number of output frames. Stop attempting.
+ break;
+ }
+ else
+ {
+ // No point in continuing if on last attempt.
+ if(attempt == (attempts - 1))
+ break;
+
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("RubberBandAudioConverter::process %s attempt:%d totalOutFrames:%ld != n:%d try again\n", f.name().latin1(), attempt, totalOutFrames, n);
+ #endif
+
+ // We didn't get the number of frames we requested.
+ // This can occasionally be radically different from the requested frames, or zero,
+ // even when ample excess input frames are supplied.
+ // Move the src output pointer to a new position.
+ srcdata.data_out += srcdata.output_frames_gen * channel;
+ // Set new number of maximum out frames.
+ outFrames -= srcdata.output_frames_gen;
+ // Calculate the new number of file input frames required.
+ inFrames = (long)ceil(((double)outFrames / srcratio)) + inComp;
+ // Keep trying.
+ continue;
+ }
+ }
+ else
+ {
+ _sfCurFrame += rn;
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("RubberBandAudioConverter::process %s rn:%zd != inFrames:%ld output_frames_gen:%ld outFrames:%ld srcdata.input_frames_used:%ld\n",
+ f.name().latin1(), rn, inFrames, srcdata.output_frames_gen, outFrames, srcdata.input_frames_used);
+ #endif
+
+ // We've reached the end of the file. Convert the number of frames read.
+ //rn = (double)rn * srcratio + 1;
+ //rn = (long)floor((double)rn * srcratio);
+ //if(rn > (size_t)outFrames)
+ // rn = outFrames;
+ // Stop attempting.
+ break;
+ }
+ }
+
+ // If we still didn't get the desired number of output frames.
+ if(totalOutFrames != n)
+ {
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("RubberBandAudioConverter::process %s totalOutFrames:%ld != n:%d\n", f.name().latin1(), totalOutFrames, n);
+ #endif
+
+ // Let's zero the rest of it.
+ long b = totalOutFrames * channel;
+ long e = n * channel;
+ for(long i = b; i < e; ++i)
+ //outbuffer[i] = 0.0f;
+ buffer[i] = 0.0f;
+ }
+
+ //float* poutbuf = &outbuffer[0];
+ float* poutbuf = outbuffer;
+ if(fchan == channel)
+ {
+ if(overwrite)
+ //for (size_t i = 0; i < rn; ++i)
+ for (int i = 0; i < n; ++i)
+ {
+ for(int ch = 0; ch < channel; ++ch)
+ *(buffer[ch] + i) = *poutbuf++;
+ }
+ else
+ //for(size_t i = 0; i < rn; ++i)
+ for(int i = 0; i < n; ++i)
+ {
+ for(int ch = 0; ch < channel; ++ch)
+ *(buffer[ch] + i) += *poutbuf++;
+ }
+ }
+ else if((fchan == 2) && (channel == 1))
+ {
+ // stereo to mono
+ if(overwrite)
+ //for(size_t i = 0; i < rn; ++i)
+ for(int i = 0; i < n; ++i)
+ *(buffer[0] + i) = poutbuf[i + i] + poutbuf[i + i + 1];
+ else
+ //for(size_t i = 0; i < rn; ++i)
+ for(int i = 0; i < n; ++i)
+ *(buffer[0] + i) += poutbuf[i + i] + poutbuf[i + i + 1];
+ }
+ else if((fchan == 1) && (channel == 2))
+ {
+ // mono to stereo
+ if(overwrite)
+ //for(size_t i = 0; i < rn; ++i)
+ for(int i = 0; i < n; ++i)
+ {
+ float data = *poutbuf++;
+ *(buffer[0]+i) = data;
+ *(buffer[1]+i) = data;
+ }
+ else
+ //for(size_t i = 0; i < rn; ++i)
+ for(int i = 0; i < n; ++i)
+ {
+ float data = *poutbuf++;
+ *(buffer[0]+i) += data;
+ *(buffer[1]+i) += data;
+ }
+ }
+ else
+ {
+ #ifdef AUDIOCONVERT_DEBUG
+ printf("RubberBandAudioConverter::process Channel mismatch: source chans:%d -> dst chans:%d\n", fchan, channel);
+ #endif
+ }
+
+ return _sfCurFrame;
+}
+
+#endif // RUBBERBAND_SUPPORT
diff --git a/muse2/muse/audioconvert.h b/muse2/muse/audioconvert.h
new file mode 100644
index 00000000..039af912
--- /dev/null
+++ b/muse2/muse/audioconvert.h
@@ -0,0 +1,129 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: audioconvert.h,v 1.1.1.1 2009/12/28 16:07:33 terminator356 Exp $
+//
+// (C) Copyright 1999-2009 Werner Schweer (ws@seh.de)
+//
+// Audio converter module created by Tim terminator356
+//=========================================================
+
+#ifndef __AUDIOCONVERT_H__
+#define __AUDIOCONVERT_H__
+
+#include <map>
+
+#ifdef RUBBERBAND_SUPPORT
+#include <RubberBandStretcher.h>
+#endif
+
+#include <samplerate.h>
+#include <sys/types.h>
+
+//#include "eventbase.h"
+class EventBase;
+class EventList;
+
+class SndFileR;
+
+//---------------------------------------------------------
+// AudioConverter
+//---------------------------------------------------------
+
+class AudioConverter
+{
+ protected:
+ int _refCount;
+ off_t _sfCurFrame;
+
+ public:
+ AudioConverter();
+ ~AudioConverter();
+
+ AudioConverter* reference();
+ static AudioConverter* release(AudioConverter* cv);
+
+ //off_t readAudio(SndFileR& /*sf*/, off_t /*sfCurFrame*/, unsigned /*offset*/, float** /*buffer*/,
+ // int /*channels*/, int /*frames*/, bool /*doSeek*/, bool /*overwrite*/);
+ off_t readAudio(SndFileR& /*sf*/, unsigned /*offset*/, float** /*buffer*/,
+ int /*channels*/, int /*frames*/, bool /*doSeek*/, bool /*overwrite*/);
+
+ virtual bool isValid() = 0;
+ virtual void reset() = 0;
+ virtual void setChannels(int ch) = 0;
+ //virtual off_t process(SndFileR& /*sf*/, off_t /*sfCurFrame*/, float** /*buffer*/,
+ // int /*channels*/, int /*frames*/, bool /*overwrite*/) = 0; // Interleaved buffer if stereo.
+ virtual off_t process(SndFileR& /*sf*/, float** /*buffer*/,
+ int /*channels*/, int /*frames*/, bool /*overwrite*/) = 0; // Interleaved buffer if stereo.
+};
+
+//---------------------------------------------------------
+// SRCAudioConverter
+//---------------------------------------------------------
+
+class SRCAudioConverter : public AudioConverter
+{
+ int _type;
+ int _channels;
+ SRC_STATE* _src_state;
+
+ public:
+ SRCAudioConverter(int channels, int type);
+ ~SRCAudioConverter();
+
+ virtual bool isValid() { return _src_state != 0; }
+ virtual void reset();
+ virtual void setChannels(int ch);
+ //virtual off_t process(SndFileR& /*sf*/, off_t /*sfCurFrame*/, float** /*buffer*/,
+ // int /*channels*/, int /*frames*/, bool /*overwrite*/); // Interleaved buffer if stereo.
+ virtual off_t process(SndFileR& /*sf*/, float** /*buffer*/,
+ int /*channels*/, int /*frames*/, bool /*overwrite*/); // Interleaved buffer if stereo.
+};
+
+#ifdef RUBBERBAND_SUPPORT
+
+//---------------------------------------------------------
+// RubberBandAudioConverter
+//---------------------------------------------------------
+
+class RubberBandAudioConverter : public AudioConverter
+{
+ int _options;
+ int _channels;
+ RubberBandStretcher* _rbs;
+
+ public:
+ RubberBandAudioConverter(int channels, int options);
+ ~RubberBandAudioConverter();
+
+ virtual bool isValid() { return _rbs != 0; }
+ virtual void reset();
+ virtual void setChannels(int ch);
+ //virtual off_t process(SndFileR& /*sf*/, off_t /*sfCurFrame*/, float** /*buffer*/,
+ // int /*channels*/, int /*frames*/, bool /*overwrite*/); // Interleaved buffer if stereo.
+ virtual off_t process(SndFileR& /*sf*/, float** /*buffer*/,
+ int /*channels*/, int /*frames*/, bool /*overwrite*/); // Interleaved buffer if stereo.
+};
+
+#endif // RUBBERBAND_SUPPORT
+
+//---------------------------------------------------------
+// AudioConvertMap
+//---------------------------------------------------------
+
+typedef std::map<EventBase*, AudioConverter*, std::less<EventBase*> >::iterator iAudioConvertMap;
+typedef std::map<EventBase*, AudioConverter*, std::less<EventBase*> >::const_iterator ciAudioConvertMap;
+
+//typedef std::map<EventBase*, AudioConverter*, std::less<EventBase*> > AudioConvertMap;
+class AudioConvertMap : public std::map<EventBase*, AudioConverter*, std::less<EventBase*> >
+{
+ public:
+ void remapEvents(const EventList*);
+ iAudioConvertMap addEvent(EventBase*);
+ void removeEvent(EventBase*);
+ //AudioConverter* getConverter(const EventBase*);
+ iAudioConvertMap getConverter(EventBase*);
+};
+
+#endif
+
diff --git a/muse2/muse/audioprefetch.cpp b/muse2/muse/audioprefetch.cpp
new file mode 100644
index 00000000..b2ddab8c
--- /dev/null
+++ b/muse2/muse/audioprefetch.cpp
@@ -0,0 +1,262 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: audioprefetch.cpp,v 1.14.2.7 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <poll.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <values.h>
+
+#include "audioprefetch.h"
+#include "globals.h"
+#include "track.h"
+#include "song.h"
+#include "audio.h"
+#include "sync.h"
+
+// Added by Tim. p3.3.20
+//#define AUDIOPREFETCH_DEBUG
+
+enum { PREFETCH_TICK, PREFETCH_SEEK
+ };
+
+//---------------------------------------------------------
+// PrefetchMsg
+//---------------------------------------------------------
+
+struct PrefetchMsg : public ThreadMsg {
+ int pos;
+ };
+
+AudioPrefetch* audioPrefetch;
+
+//---------------------------------------------------------
+// AudioPrefetch
+//---------------------------------------------------------
+
+//AudioPrefetch::AudioPrefetch(int prio, const char* name)
+// : Thread(prio,name)
+AudioPrefetch::AudioPrefetch(const char* name)
+ : Thread(name)
+ {
+ seekPos = ~0;
+ writePos = ~0;
+ //seekDone = true;
+ seekCount = 0;
+ }
+
+//---------------------------------------------------------
+// readMsg
+//---------------------------------------------------------
+
+static void readMsgP(void* p, void*)
+ {
+ AudioPrefetch* at = (AudioPrefetch*)p;
+ at->readMsg1(sizeof(PrefetchMsg));
+ }
+
+//---------------------------------------------------------
+// start
+//---------------------------------------------------------
+
+//void AudioPrefetch::start()
+void AudioPrefetch::start(int priority)
+ {
+ clearPollFd();
+ addPollFd(toThreadFdr, POLLIN, ::readMsgP, this, 0);
+ //Thread::start();
+ Thread::start(priority);
+ }
+
+//---------------------------------------------------------
+// ~AudioPrefetch
+//---------------------------------------------------------
+
+AudioPrefetch::~AudioPrefetch()
+ {
+ }
+
+//---------------------------------------------------------
+// processMsg
+//---------------------------------------------------------
+
+void AudioPrefetch::processMsg1(const void* m)
+ {
+ const PrefetchMsg* msg = (PrefetchMsg*)m;
+ switch(msg->id) {
+ case PREFETCH_TICK:
+ if (audio->isRecording()) {
+ //puts("writeTick");
+ audio->writeTick();
+ }
+ // Indicate do not seek file before each read.
+ // Changed by Tim. p3.3.17
+ //prefetch();
+ prefetch(false);
+
+ seekPos = ~0; // invalidate cached last seek position
+ break;
+ case PREFETCH_SEEK:
+ #ifdef AUDIOPREFETCH_DEBUG
+ printf("AudioPrefetch::processMsg1 PREFETCH_SEEK msg->pos:%d\n", msg->pos);
+ #endif
+
+ // process seek in background
+ seek(msg->pos);
+ break;
+ default:
+ printf("AudioPrefetch::processMsg1: unknown message\n");
+ }
+ }
+
+//---------------------------------------------------------
+// msgTick
+//---------------------------------------------------------
+
+void AudioPrefetch::msgTick()
+ {
+ PrefetchMsg msg;
+ msg.id = PREFETCH_TICK;
+ while (sendMsg1(&msg, sizeof(msg))) {
+ printf("AudioPrefetch::msgTick(): send failed!\n");
+ }
+ }
+
+//---------------------------------------------------------
+// msgSeek
+// called from audio RT context
+//---------------------------------------------------------
+
+void AudioPrefetch::msgSeek(unsigned samplePos, bool force)
+ {
+ if (samplePos == seekPos && !force) {
+ //seekDone = true;
+ return;
+ }
+
+ ++seekCount;
+ //seekDone = false;
+
+ #ifdef AUDIOPREFETCH_DEBUG
+ printf("AudioPrefetch::msgSeek samplePos:%u force:%d seekCount:%d\n", samplePos, force, seekCount);
+ #endif
+
+ PrefetchMsg msg;
+ msg.id = PREFETCH_SEEK;
+ msg.pos = samplePos;
+ while (sendMsg1(&msg, sizeof(msg))) {
+ printf("AudioPrefetch::msgSeek::sleep(1)\n");
+ sleep(1);
+ }
+ }
+
+//---------------------------------------------------------
+// prefetch
+//---------------------------------------------------------
+
+//void AudioPrefetch::prefetch()
+void AudioPrefetch::prefetch(bool doSeek)
+ {
+ if (writePos == ~0U) {
+ printf("AudioPrefetch::prefetch: invalid write position\n");
+ return;
+ }
+ if (song->loop() && !audio->bounce() && !extSyncFlag.value()) {
+ const Pos& loop = song->rPos();
+ unsigned n = loop.frame() - writePos;
+ if (n < segmentSize) {
+ unsigned lpos = song->lPos().frame();
+ // adjust loop start so we get exact loop len
+ if (n > lpos)
+ n = 0;
+// printf("prefetch seek %d\n", writePos);
+ writePos = lpos - n;
+ }
+ }
+ WaveTrackList* tl = song->waves();
+ for (iWaveTrack it = tl->begin(); it != tl->end(); ++it) {
+ WaveTrack* track = *it;
+ // p3.3.29
+ // Save time. Don't bother if track is off. Track On/Off not designed for rapid repeated response (but mute is).
+ if(track->off())
+ continue;
+
+ int ch = track->channels();
+ float* bp[ch];
+// printf("prefetch %d\n", writePos);
+ if (track->prefetchFifo()->getWriteBuffer(ch, segmentSize, bp, writePos)) {
+ // printf("AudioPrefetch::prefetch No write buffer!\n"); // p3.3.46 Was getting this...
+ continue;
+ }
+ //track->fetchData(writePos, segmentSize, bp);
+ track->fetchData(writePos, segmentSize, bp, doSeek);
+
+ // p3.3.41
+ //fprintf(stderr, "AudioPrefetch::prefetch data: segmentSize:%ld %e %e %e %e\n", segmentSize, bp[0][0], bp[0][1], bp[0][2], bp[0][3]);
+
+ }
+ writePos += segmentSize;
+ }
+
+//---------------------------------------------------------
+// seek
+//---------------------------------------------------------
+
+void AudioPrefetch::seek(unsigned seekTo)
+ {
+// printf("seek %d\n", seekTo);
+ #ifdef AUDIOPREFETCH_DEBUG
+ printf("AudioPrefetch::seek to:%u seekCount:%d\n", seekTo, seekCount);
+ #endif
+
+ // Speedup: More than one seek message pending?
+ // Eat up seek messages until we get to the very LATEST one,
+ // because all the rest which came before it are irrelevant now,
+ // and processing them all was taking extreme time, especially with
+ // resampling enabled.
+ // In particular, when the user 'slides' the play cursor back and forth
+ // there are MANY seek messages in the pipe, and with resampling enabled
+ // it was taking minutes to finish seeking. If the user hit play during that time,
+ // things were messed up (FIFO underruns, choppy intermittent sound etc).
+ // Added by Tim. p3.3.20
+ if(seekCount > 1)
+ {
+ --seekCount;
+ return;
+ }
+
+ writePos = seekTo;
+ WaveTrackList* tl = song->waves();
+ for (iWaveTrack it = tl->begin(); it != tl->end(); ++it) {
+ WaveTrack* track = *it;
+ track->clearPrefetchFifo();
+ }
+
+ bool isFirstPrefetch = true;
+ for (unsigned int i = 0; i < (fifoLength)-1; ++i)//prevent compiler warning: comparison of signed/unsigned
+ {
+ // Indicate do a seek command before read, but only on the first pass.
+ // Changed by Tim. p3.3.17
+ //prefetch();
+ prefetch(isFirstPrefetch);
+
+ isFirstPrefetch = false;
+
+ // To help speed things up even more, check the count again. Return if more seek messages are pending.
+ // Added by Tim. p3.3.20
+ if(seekCount > 1)
+ {
+ --seekCount;
+ return;
+ }
+ }
+
+ seekPos = seekTo;
+ //seekDone = true;
+ --seekCount;
+ }
+
diff --git a/muse2/muse/audioprefetch.h b/muse2/muse/audioprefetch.h
new file mode 100644
index 00000000..dda4d895
--- /dev/null
+++ b/muse2/muse/audioprefetch.h
@@ -0,0 +1,46 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: audioprefetch.h,v 1.3.2.2 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __AUDIOPREFETCH_H__
+#define __AUDIOPREFETCH_H__
+
+#include "thread.h"
+
+//---------------------------------------------------------
+// AudioPrefetch
+//---------------------------------------------------------
+
+class AudioPrefetch : public Thread {
+ unsigned writePos;
+ unsigned seekPos; // remember last seek to optimize seeks
+
+ virtual void processMsg1(const void*);
+ //void prefetch();
+ void prefetch(bool doSeek);
+ void seek(unsigned pos);
+
+ volatile int seekCount;
+
+ public:
+ //AudioPrefetch(int prio, const char* name);
+ AudioPrefetch(const char* name);
+
+ ~AudioPrefetch();
+ //virtual void start();
+ virtual void start(int);
+
+ void msgTick();
+ void msgSeek(unsigned samplePos, bool force=false);
+
+ //volatile bool seekDone;
+ bool seekDone() const { return seekCount == 0; }
+ };
+
+extern AudioPrefetch* audioPrefetch;
+
+#endif
diff --git a/muse2/muse/audiotrack.cpp b/muse2/muse/audiotrack.cpp
new file mode 100644
index 00000000..189e39d1
--- /dev/null
+++ b/muse2/muse/audiotrack.cpp
@@ -0,0 +1,1639 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: audiotrack.cpp,v 1.14.2.21 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <values.h>
+#include <stdlib.h>
+#include <qmessagebox.h>
+#include <map>
+#include "track.h"
+#include "event.h"
+#include "song.h"
+#include "audio.h"
+#include "wave.h"
+#include "xml.h"
+#include "plugin.h"
+#include "audiodev.h"
+
+// By T356. For caching jack in/out routing names BEFORE file save.
+// Jack often shuts down during file save, causing the routes to be lost in the file.
+// cacheJackRouteNames() is ONLY called from MusE::save() in app.cpp
+// Update: Not required any more because the real problem was Jack RT priority, which has been fixed.
+/*
+typedef std::multimap <const int, QString> jackRouteNameMap;
+std::map <const AudioTrack*, jackRouteNameMap > jackRouteNameCache;
+typedef std::multimap <const int, QString>::const_iterator ciJackRouteNameMap;
+typedef std::map <const AudioTrack*, jackRouteNameMap>::const_iterator ciJackRouteNameCache;
+void cacheJackRouteNames()
+{
+ jackRouteNameCache.clear();
+ const InputList* il = song->inputs();
+ for(ciAudioInput iai = il->begin(); iai != il->end(); ++iai)
+ {
+ const RouteList* rl = (*iai)->inRoutes();
+ if(!rl->empty())
+ {
+ jackRouteNameMap rm = jackRouteNameMap();
+ for(ciRoute r = rl->begin(); r != rl->end(); ++r)
+ rm.insert(std::pair<const int, QString>(r->channel, r->name()));
+ jackRouteNameCache.insert(std::pair<const AudioTrack*, jackRouteNameMap>(*iai, rm));
+ }
+ }
+ const OutputList* ol = song->outputs();
+ for(ciAudioOutput iao = ol->begin(); iao != ol->end(); ++iao)
+ {
+ const RouteList* rl = (*iao)->outRoutes();
+ if(!rl->empty())
+ {
+ jackRouteNameMap rm = jackRouteNameMap();
+ for(ciRoute r = rl->begin(); r != rl->end(); ++r)
+ rm.insert(std::pair<const int, QString>(r->channel, r->name()));
+ jackRouteNameCache.insert(std::pair<const AudioTrack*, jackRouteNameMap>(*iao, rm));
+ }
+ }
+}
+*/
+
+//---------------------------------------------------------
+// AudioTrack
+//---------------------------------------------------------
+
+AudioTrack::AudioTrack(TrackType t)
+//AudioTrack::AudioTrack(TrackType t, int num_out_bufs)
+ : Track(t)
+ {
+ //_totalOutChannels = num_out_bufs; // Is either parameter-default MAX_CHANNELS, or custom value passed (used by syntis).
+ _processed = false;
+ _haveData = false;
+ _sendMetronome = false;
+ _prefader = false;
+ _efxPipe = new Pipeline();
+ _recFile = 0;
+ _channels = 0;
+ _automationType = AUTO_OFF;
+ //setChannels(1);
+ setChannels(2);
+ addController(new CtrlList(AC_VOLUME,"Volume",0.0,1.0));
+ addController(new CtrlList(AC_PAN, "Pan", -1.0, 1.0));
+ addController(new CtrlList(AC_MUTE,"Mute",0.0,1.0));
+
+ // Changed by Tim. p3.3.15
+ //outBuffers = new float*[MAX_CHANNELS];
+ //for (int i = 0; i < MAX_CHANNELS; ++i)
+ // outBuffers[i] = new float[segmentSize];
+ //for (int i = 0; i < MAX_CHANNELS; ++i)
+ // posix_memalign((void**)(outBuffers + i), 16, sizeof(float) * segmentSize);
+
+ // Let's allocate it all in one block, and just point the remaining buffer pointers into the block
+ // which allows faster one-shot buffer copying.
+ // Nope. Nice but interferes with possibility we don't know if other buffers are contiguous (jack buffers, local stack buffers etc.).
+ //posix_memalign((void**)(outBuffers), 16, sizeof(float) * segmentSize * MAX_CHANNELS);
+ //for (int i = 0; i < MAX_CHANNELS; ++i)
+ // *(outBuffers + i) = sizeof(float) * segmentSize * i;
+
+ // p3.3.38
+ // Easy way, less desirable... Start out with enough for MAX_CHANNELS. Then multi-channel syntis can re-allocate,
+ // via a call to (a modified!) setChannels().
+ // Hard way, more desirable... Creating a synti instance passes the total channels to this constructor, overriding MAX_CHANNELS.
+ _totalOutChannels = MAX_CHANNELS;
+ outBuffers = new float*[_totalOutChannels];
+ for (int i = 0; i < _totalOutChannels; ++i)
+ posix_memalign((void**)&outBuffers[i], 16, sizeof(float) * segmentSize);
+
+ // This is only set by multi-channel syntis...
+ _totalInChannels = 0;
+
+ bufferPos = MAXINT;
+
+ setVolume(1.0);
+ }
+
+//AudioTrack::AudioTrack(const AudioTrack& t)
+// : Track(t)
+AudioTrack::AudioTrack(const AudioTrack& t, bool cloneParts)
+ : Track(t, cloneParts)
+ {
+ _totalOutChannels = t._totalOutChannels; // Is either MAX_CHANNELS, or custom value (used by syntis).
+ _processed = false;
+ _haveData = false;
+ _sendMetronome = t._sendMetronome;
+ _controller = t._controller;
+ _prefader = t._prefader;
+ _auxSend = t._auxSend;
+ _efxPipe = new Pipeline(*(t._efxPipe));
+ _automationType = t._automationType;
+ _inRoutes = t._inRoutes;
+ _outRoutes = t._outRoutes;
+ // Changed by Tim. p3.3.15
+ //outBuffers = new float*[MAX_CHANNELS];
+ //for (int i = 0; i < MAX_CHANNELS; ++i)
+ // outBuffers[i] = new float[segmentSize];
+ //for (int i = 0; i < MAX_CHANNELS; ++i)
+ // posix_memalign((void**)(outBuffers + i), 16, sizeof(float) * segmentSize);
+
+ // p3.3.38
+ int chans = _totalOutChannels;
+ // Number of allocated buffers is always MAX_CHANNELS or more, even if _totalOutChannels is less.
+ if(chans < MAX_CHANNELS)
+ chans = MAX_CHANNELS;
+ outBuffers = new float*[chans];
+ for (int i = 0; i < chans; ++i)
+ posix_memalign((void**)&outBuffers[i], 16, sizeof(float) * segmentSize);
+
+ bufferPos = MAXINT;
+ _recFile = t._recFile;
+ }
+
+AudioTrack::~AudioTrack()
+{
+ delete _efxPipe;
+ //for (int i = 0; i < MAX_CHANNELS; ++i)
+ // delete[] outBuffers[i];
+ //delete[] outBuffers;
+
+ // p3.3.15
+ //for(int i = 0; i < MAX_CHANNELS; ++i)
+ //{
+ // if(outBuffers[i])
+ // free(outBuffers[i]);
+ //}
+
+ // p3.3.38
+ int chans = _totalOutChannels;
+ // Number of allocated buffers is always MAX_CHANNELS or more, even if _totalOutChannels is less.
+ if(chans < MAX_CHANNELS)
+ chans = MAX_CHANNELS;
+ for(int i = 0; i < chans; ++i)
+ {
+ if(outBuffers[i])
+ free(outBuffers[i]);
+ }
+ delete[] outBuffers;
+
+}
+
+//---------------------------------------------------------
+// deleteAllEfxGuis
+//---------------------------------------------------------
+
+void AudioTrack::deleteAllEfxGuis()
+{
+ if(_efxPipe)
+ _efxPipe->deleteAllGuis();
+}
+
+//---------------------------------------------------------
+// clearEfxList
+//---------------------------------------------------------
+
+void AudioTrack::clearEfxList()
+{
+ if(_efxPipe)
+ for(int i = 0; i < PipelineDepth; i++)
+ (*_efxPipe)[i] = 0;
+}
+
+//---------------------------------------------------------
+// newPart
+//---------------------------------------------------------
+
+Part* AudioTrack::newPart(Part*, bool /*clone*/)
+ {
+ return 0;
+ }
+
+//---------------------------------------------------------
+// addPlugin
+//---------------------------------------------------------
+
+void AudioTrack::addPlugin(PluginI* plugin, int idx)
+{
+ if (plugin == 0)
+ {
+ PluginI* oldPlugin = (*_efxPipe)[idx];
+ if (oldPlugin)
+ {
+ oldPlugin->setID(-1);
+ oldPlugin->setTrack(0);
+
+ int controller = oldPlugin->parameters();
+ for (int i = 0; i < controller; ++i)
+ {
+ int id = genACnum(idx, i);
+ removeController(id);
+ }
+ }
+ }
+ efxPipe()->insert(plugin, idx);
+ if (plugin)
+ {
+ plugin->setID(idx);
+ plugin->setTrack(this);
+
+ int controller = plugin->parameters();
+ for (int i = 0; i < controller; ++i)
+ {
+ int id = genACnum(idx, i);
+ const char* name = plugin->paramName(i);
+ float min, max;
+ plugin->range(i, &min, &max);
+ CtrlValueType t = plugin->valueType();
+ CtrlList* cl = new CtrlList(id);
+ cl->setRange(min, max);
+ cl->setName(QString(name));
+ cl->setValueType(t);
+ LADSPA_PortRangeHint range = plugin->range(i);
+ if(LADSPA_IS_HINT_TOGGLED(range.HintDescriptor))
+ cl->setMode(CtrlList::DISCRETE);
+ else
+ cl->setMode(CtrlList::INTERPOLATE);
+ cl->setCurVal(plugin->param(i));
+ addController(cl);
+ }
+ }
+}
+
+//---------------------------------------------------------
+// addAuxSend
+//---------------------------------------------------------
+
+void AudioTrack::addAuxSend(int n)
+ {
+ int nn = _auxSend.size();
+ for (int i = nn; i < n; ++i) {
+ _auxSend.push_back(0.0);
+ _auxSend[i] = 0.0; //??
+ }
+ }
+
+//---------------------------------------------------------
+// addController
+//---------------------------------------------------------
+
+void AudioTrack::addController(CtrlList* list)
+ {
+ _controller.add(list);
+ }
+
+//---------------------------------------------------------
+// removeController
+//---------------------------------------------------------
+
+void AudioTrack::removeController(int id)
+ {
+ iCtrlList i = _controller.find(id);
+ if (i == _controller.end()) {
+ printf("AudioTrack::removeController id %d not found\n", id);
+ return;
+ }
+ _controller.erase(i);
+ }
+
+//---------------------------------------------------------
+// swapControllerIDX
+//---------------------------------------------------------
+
+void AudioTrack::swapControllerIDX(int idx1, int idx2)
+{
+ // FIXME This code is ugly.
+ // At best we would like to modify the keys (IDXs) in-place and
+ // do some kind of deferred re-sort, but it can't be done...
+
+ if(idx1 == idx2)
+ return;
+
+ if(idx1 < 0 || idx2 < 0 || idx1 >= PipelineDepth || idx2 >= PipelineDepth)
+ return;
+
+ CtrlList *cl;
+ CtrlList *newcl;
+ int id1 = (idx1 + 1) * AC_PLUGIN_CTL_BASE;
+ int id2 = (idx2 + 1) * AC_PLUGIN_CTL_BASE;
+ int i, j;
+
+ CtrlListList tmpcll;
+ CtrlVal cv(0, 0.0);
+
+ for(ciCtrlList icl = _controller.begin(); icl != _controller.end(); ++icl)
+ {
+ cl = icl->second;
+ i = cl->id() & AC_PLUGIN_CTL_ID_MASK;
+ j = cl->id() & ~((unsigned long)AC_PLUGIN_CTL_ID_MASK);
+ if(j == id1 || j == id2)
+ {
+ newcl = new CtrlList(i | (j == id1 ? id2 : id1));
+ newcl->setMode(cl->mode());
+ newcl->setValueType(cl->valueType());
+ newcl->setName(cl->name());
+ double min, max;
+ cl->range(&min, &max);
+ newcl->setRange(min, max);
+ newcl->setCurVal(cl->curVal());
+ newcl->setDefault(cl->getDefault());
+ for(iCtrl ic = cl->begin(); ic != cl->end(); ++ic)
+ {
+ cv = ic->second;
+ newcl->insert(std::pair<const int, CtrlVal>(cv.frame, cv));
+ }
+ tmpcll.insert(std::pair<const int, CtrlList*>(newcl->id(), newcl));
+ }
+ else
+ {
+ newcl = new CtrlList();
+ *newcl = *cl;
+ tmpcll.insert(std::pair<const int, CtrlList*>(newcl->id(), newcl));
+ }
+ }
+
+ for(iCtrlList ci = _controller.begin(); ci != _controller.end(); ++ci)
+ delete (*ci).second;
+
+ _controller.clear();
+
+ for(ciCtrlList icl = tmpcll.begin(); icl != tmpcll.end(); ++icl)
+ {
+ newcl = icl->second;
+ _controller.insert(std::pair<const int, CtrlList*>(newcl->id(), newcl));
+ }
+
+
+ /*
+ unsigned int idmask = ~AC_PLUGIN_CTL_ID_MASK;
+
+ CtrlList* cl;
+ CtrlList* ctl1 = 0;
+ CtrlList* ctl2 = 0;
+ CtrlList* newcl1 = 0;
+ CtrlList* newcl2 = 0;
+ CtrlVal cv(0, 0.0);
+ int id1 = (idx1 + 1) * AC_PLUGIN_CTL_BASE;
+ int id2 = (idx2 + 1) * AC_PLUGIN_CTL_BASE;
+ int i, j;
+ double min, max;
+
+ for(ciCtrlList icl = _controller.begin(); icl != _controller.end(); ++icl)
+ {
+ cl = icl->second;
+ i = cl->id() & AC_PLUGIN_CTL_ID_MASK;
+ j = cl->id() & idmask;
+
+ if(j == id1)
+ {
+ ctl1 = cl;
+ newcl1 = new CtrlList( i | id2 );
+ newcl1->setMode(cl->mode());
+ newcl1->setValueType(cl->valueType());
+ newcl1->setName(cl->name());
+ cl->range(&min, &max);
+ newcl1->setRange(min, max);
+ newcl1->setCurVal(cl->curVal());
+ newcl1->setDefault(cl->getDefault());
+ for(iCtrl ic = cl->begin(); ic != cl->end(); ++ic)
+ {
+ cv = ic->second;
+ newcl1->insert(std::pair<const int, CtrlVal>(cv.frame, cv));
+ }
+ }
+ //else
+ if(j == id2)
+ {
+ ctl2 = cl;
+ newcl2 = new CtrlList( i | id1 );
+ newcl2->setMode(cl->mode());
+ newcl2->setValueType(cl->valueType());
+ newcl2->setName(cl->name());
+ cl->range(&min, &max);
+ newcl2->setRange(min, max);
+ newcl2->setCurVal(cl->curVal());
+ newcl2->setDefault(cl->getDefault());
+ for(iCtrl ic = cl->begin(); ic != cl->end(); ++ic)
+ {
+ cv = ic->second;
+ newcl2->insert(std::pair<const int, CtrlVal>(cv.frame, cv));
+ }
+ }
+ }
+ if(ctl1)
+ _controller.erase(ctl1->id());
+ if(ctl2)
+ _controller.erase(ctl2->id());
+ if(newcl1)
+ //_controller.add(newcl1);
+ _controller.insert(std::pair<const int, CtrlList*>(newcl1->id(), newcl1));
+ if(newcl2)
+ _controller.insert(std::pair<const int, CtrlList*>(newcl2->id(), newcl2));
+ //_controller.add(newcl2);
+ */
+}
+
+//---------------------------------------------------------
+// setAutomationType
+//---------------------------------------------------------
+
+void AudioTrack::setAutomationType(AutomationType t)
+{
+ // Clear pressed and touched and rec event list.
+ clearRecAutomation(true);
+
+ // Now set the type.
+ _automationType = t;
+}
+
+//---------------------------------------------------------
+// processAutomationEvents
+//---------------------------------------------------------
+
+void AudioTrack::processAutomationEvents()
+{
+ if (_automationType != AUTO_TOUCH && _automationType != AUTO_WRITE)
+ return;
+
+ for (iCtrlList icl = _controller.begin(); icl != _controller.end(); ++icl)
+ {
+ CtrlList* cl = icl->second;
+ int id = cl->id();
+
+ // Remove old events from record region.
+ if (_automationType == AUTO_WRITE)
+ {
+ int start = audio->getStartRecordPos().frame();
+ int end = audio->getEndRecordPos().frame();
+ iCtrl s = cl->lower_bound(start);
+ iCtrl e = cl->lower_bound(end);
+
+ // Erase old events only if there were recorded events.
+ for(iCtrlRec icr = _recEvents.begin(); icr != _recEvents.end(); ++icr)
+ {
+ if(icr->id == id) // && icr->type == ARVT_VAL && icr->frame >= s->frame && icr->frame <= e->frame)
+ {
+ cl->erase(s, e);
+ break;
+ }
+ }
+ }
+ else
+ { // type AUTO_TOUCH
+ for (iCtrlRec icr = _recEvents.begin(); icr != _recEvents.end(); ++icr)
+ {
+ // Don't bother looking for start, it's OK, just take the first one.
+ // Needed for mousewheel and paging etc.
+ //if (icr->id == id && icr->type == ARVT_START)
+ if (icr->id == id)
+ {
+ int start = icr->frame;
+
+ if(icr == _recEvents.end())
+ {
+ int end = audio->getEndRecordPos().frame();
+ iCtrl s = cl->lower_bound(start);
+ iCtrl e = cl->lower_bound(end);
+ cl->erase(s, e);
+ break;
+ }
+
+ iCtrlRec icrlast = icr;
+ ++icr;
+ for(; ; ++icr)
+ {
+ if(icr == _recEvents.end())
+ {
+ int end = icrlast->frame;
+ iCtrl s = cl->lower_bound(start);
+ iCtrl e = cl->lower_bound(end);
+ cl->erase(s, e);
+ break;
+ }
+
+ if(icr->id == id && icr->type == ARVT_STOP)
+ {
+ int end = icr->frame;
+ // Erase everything up to, not including, this stop event's frame.
+ // Because an event was already stored directly when slider released.
+ if(end > start)
+ --end;
+
+ iCtrl s = cl->lower_bound(start);
+ iCtrl e = cl->lower_bound(end);
+
+ cl->erase(s, e);
+
+ break;
+ }
+
+ if(icr->id == id)
+ icrlast = icr;
+ }
+ if (icr == _recEvents.end())
+ break;
+ }
+ }
+ }
+
+ // Extract all recorded events for controller "id"
+ // from CtrlRecList and put into cl.
+ for (iCtrlRec icr = _recEvents.begin(); icr != _recEvents.end(); ++icr)
+ {
+ if (icr->id == id && (icr->type == ARVT_VAL || icr->type == ARVT_START))
+ cl->add(icr->frame, icr->val);
+ }
+ }
+
+ // Done with the recorded automation event list. Clear it.
+ _recEvents.clear();
+
+ // Try muse without this, so that the user can remain in automation write mode
+ // after a stop.
+ /*
+ if (automationType() == AUTO_WRITE)
+ {
+ setAutomationType(AUTO_READ);
+ song->update(SC_AUTOMATION);
+ }
+ */
+
+}
+
+//---------------------------------------------------------
+// setControllerMode
+//---------------------------------------------------------
+
+void AudioTrack::setControllerMode(int ctlID, CtrlList::Mode m)
+ {
+ ciCtrlList cl = _controller.find(ctlID);
+ if(cl == _controller.end())
+ return;
+
+ cl->second->setMode(m);
+ }
+
+//---------------------------------------------------------
+// clearControllerEvents
+//---------------------------------------------------------
+
+void AudioTrack::clearControllerEvents(int id)
+{
+ ciCtrlList icl = _controller.find(id);
+ if(icl == _controller.end())
+ return;
+
+ CtrlList* cl = icl->second;
+ cl->clear();
+ return;
+}
+
+//---------------------------------------------------------
+// seekPrevACEvent
+//---------------------------------------------------------
+
+void AudioTrack::seekPrevACEvent(int id)
+{
+ ciCtrlList icl = _controller.find(id);
+ if(icl == _controller.end())
+ return;
+
+ CtrlList* cl = icl->second;
+ if(cl->empty())
+ return;
+
+ iCtrl s = cl->lower_bound(song->cPos().frame());
+ if(s != cl->begin())
+ --s;
+ song->setPos(Song::CPOS, Pos(s->second.frame, false), true, false, true);
+ return;
+}
+
+//---------------------------------------------------------
+// seekNextACEvent
+//---------------------------------------------------------
+
+void AudioTrack::seekNextACEvent(int id)
+{
+ ciCtrlList icl = _controller.find(id);
+ if(icl == _controller.end())
+ return;
+
+ CtrlList* cl = icl->second;
+ if(cl->empty())
+ return;
+
+ iCtrl s = cl->upper_bound(song->cPos().frame());
+ if(s == cl->end())
+ {
+ --s;
+ }
+
+ song->setPos(Song::CPOS, Pos(s->second.frame, false), true, false, true);
+ return;
+}
+
+//---------------------------------------------------------
+// eraseACEvent
+//---------------------------------------------------------
+
+void AudioTrack::eraseACEvent(int id, int frame)
+{
+ ciCtrlList icl = _controller.find(id);
+ if(icl == _controller.end())
+ return;
+
+ CtrlList* cl = icl->second;
+ if(cl->empty())
+ return;
+
+ iCtrl s = cl->find(frame);
+ if(s != cl->end())
+ cl->erase(s);
+ return;
+}
+
+//---------------------------------------------------------
+// eraseRangeACEvents
+//---------------------------------------------------------
+
+void AudioTrack::eraseRangeACEvents(int id, int frame1, int frame2)
+{
+ ciCtrlList icl = _controller.find(id);
+ if(icl == _controller.end())
+ return;
+
+ CtrlList* cl = icl->second;
+ if(cl->empty())
+ return;
+
+ iCtrl s = cl->lower_bound(frame1);
+ iCtrl e = cl->lower_bound(frame2);
+ cl->erase(s, e);
+ return;
+}
+
+//---------------------------------------------------------
+// addACEvent
+//---------------------------------------------------------
+
+void AudioTrack::addACEvent(int id, int frame, double val)
+{
+ ciCtrlList icl = _controller.find(id);
+ if(icl == _controller.end())
+ return;
+
+ CtrlList* cl = icl->second;
+
+ // Add will replace if found.
+ cl->add(frame, val);
+ return;
+}
+
+//---------------------------------------------------------
+// volume
+//---------------------------------------------------------
+
+double AudioTrack::volume() const
+ {
+ ciCtrlList cl = _controller.find(AC_VOLUME);
+ if (cl == _controller.end())
+ return 0.0;
+
+ if (automation &&
+ automationType() != AUTO_OFF && _volumeEnCtrl && _volumeEn2Ctrl )
+ return cl->second->value(song->cPos().frame());
+ else
+ return cl->second->curVal();
+ }
+
+//---------------------------------------------------------
+// setVolume
+//---------------------------------------------------------
+
+void AudioTrack::setVolume(double val)
+ {
+ iCtrlList cl = _controller.find(AC_VOLUME);
+ if (cl == _controller.end()) {
+ printf("no volume controller %s %zd\n",
+ name().latin1(), _controller.size());
+ return;
+ }
+ cl->second->setCurVal(val);
+ }
+
+//---------------------------------------------------------
+// pan
+//---------------------------------------------------------
+
+double AudioTrack::pan() const
+ {
+ ciCtrlList cl = _controller.find(AC_PAN);
+ if (cl == _controller.end())
+ return 0.0;
+
+ if (automation &&
+ automationType() != AUTO_OFF && _panEnCtrl && _panEn2Ctrl )
+ return cl->second->value(song->cPos().frame());
+ else
+ return cl->second->curVal();
+ }
+
+//---------------------------------------------------------
+// setPan
+//---------------------------------------------------------
+
+void AudioTrack::setPan(double val)
+ {
+ iCtrlList cl = _controller.find(AC_PAN);
+ if (cl == _controller.end()) {
+ printf("no pan controller\n");
+ return;
+ }
+ cl->second->setCurVal(val);
+ }
+
+//---------------------------------------------------------
+// pluginCtrlVal
+//---------------------------------------------------------
+
+double AudioTrack::pluginCtrlVal(int ctlID) const
+ {
+ ciCtrlList cl = _controller.find(ctlID);
+ if (cl == _controller.end())
+ return 0.0;
+
+ if (automation && (automationType() != AUTO_OFF))
+ return cl->second->value(song->cPos().frame());
+ else
+ return cl->second->curVal();
+ }
+
+//---------------------------------------------------------
+// setPluginCtrlVal
+//---------------------------------------------------------
+
+void AudioTrack::setPluginCtrlVal(int param, double val)
+{
+ iCtrlList cl = _controller.find(param);
+ if (cl == _controller.end())
+ return;
+
+ cl->second->setCurVal(val);
+}
+
+void AudioTrack::recordAutomation(int n, double v)
+ {
+ if(!automation)
+ return;
+ if(audio->isPlaying())
+ _recEvents.push_back(CtrlRecVal(song->cPos().frame(), n, v));
+ else
+ {
+ if(automationType() == AUTO_WRITE)
+ _recEvents.push_back(CtrlRecVal(song->cPos().frame(), n, v));
+ else
+ if(automationType() == AUTO_TOUCH)
+ // In touch mode and not playing. Send directly to controller list.
+ {
+ iCtrlList cl = _controller.find(n);
+ if (cl == _controller.end())
+ return;
+ // Add will replace if found.
+ cl->second->add(song->cPos().frame(), v);
+ }
+ }
+ }
+
+void AudioTrack::startAutoRecord(int n, double v)
+ {
+ if(!automation)
+ return;
+ if(audio->isPlaying())
+ {
+ if(automationType() == AUTO_TOUCH)
+ _recEvents.push_back(CtrlRecVal(song->cPos().frame(), n, v, ARVT_START));
+ else
+ if(automationType() == AUTO_WRITE)
+ _recEvents.push_back(CtrlRecVal(song->cPos().frame(), n, v));
+ }
+ else
+ {
+ if(automationType() == AUTO_TOUCH)
+ // In touch mode and not playing. Send directly to controller list.
+ {
+ iCtrlList cl = _controller.find(n);
+ if (cl == _controller.end())
+ return;
+ // Add will replace if found.
+ cl->second->add(song->cPos().frame(), v);
+ }
+ else
+ if(automationType() == AUTO_WRITE)
+ _recEvents.push_back(CtrlRecVal(song->cPos().frame(), n, v));
+ }
+ }
+
+void AudioTrack::stopAutoRecord(int n, double v)
+ {
+ if(!automation)
+ return;
+ if(audio->isPlaying())
+ {
+ if(automationType() == AUTO_TOUCH)
+ {
+ audio->msgAddACEvent(this, n, song->cPos().frame(), v);
+ _recEvents.push_back(CtrlRecVal(song->cPos().frame(), n, v, ARVT_STOP));
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// AudioTrack::writeProperties
+//---------------------------------------------------------
+
+void AudioTrack::writeProperties(int level, Xml& xml) const
+ {
+ Track::writeProperties(level, xml);
+ xml.intTag(level, "prefader", prefader());
+ xml.intTag(level, "sendMetronome", sendMetronome());
+ xml.intTag(level, "automation", int(automationType()));
+ if (hasAuxSend()) {
+ int naux = song->auxs()->size();
+ for (int idx = 0; idx < naux; ++idx) {
+ QString s("<auxSend idx=%1>%2</auxSend>\n");
+ xml.nput(level, s.arg(idx).arg(_auxSend[idx]));
+ }
+ }
+ for (ciPluginI ip = _efxPipe->begin(); ip != _efxPipe->end(); ++ip) {
+ if (*ip)
+ (*ip)->writeConfiguration(level, xml);
+ }
+ for (ciCtrlList icl = _controller.begin(); icl != _controller.end(); ++icl) {
+ const CtrlList* cl = icl->second;
+ QString s("controller id=\"%1\" cur=\"%2\"");
+ xml.tag(level++, s.arg(cl->id()).arg(cl->curVal()));
+ int i = 0;
+ for (ciCtrl ic = cl->begin(); ic != cl->end(); ++ic) {
+ QString s("%1 %2, ");
+ xml.nput(level, s.arg(ic->second.frame).arg(ic->second.val));
+ ++i;
+ if (i >= 4) {
+ xml.put(level, "");
+ i = 0;
+ }
+ }
+ if (i)
+ xml.put(level, "");
+ xml.etag(level--, "controller");
+ }
+ }
+
+//---------------------------------------------------------
+// readAuxSend
+//---------------------------------------------------------
+
+void AudioTrack::readAuxSend(Xml& xml)
+ {
+ unsigned idx = 0;
+ double val;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::Attribut:
+ if (tag == "idx")
+ idx = xml.s2().toInt();
+ break;
+ case Xml::Text:
+ val = tag.toDouble();
+ break;
+ case Xml::TagEnd:
+ if (xml.s1() == "auxSend") {
+ if (_auxSend.size() < idx+1)
+ _auxSend.push_back(val);
+ else
+ _auxSend[idx] = val;
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// AudioTrack::readProperties
+//---------------------------------------------------------
+
+bool AudioTrack::readProperties(Xml& xml, const QString& tag)
+ {
+ if (tag == "plugin")
+ {
+ int rackpos;
+ for(rackpos = 0; rackpos < PipelineDepth; ++rackpos)
+ {
+ if(!(*_efxPipe)[rackpos])
+ break;
+ }
+ if(rackpos < PipelineDepth)
+ {
+ PluginI* pi = new PluginI();
+ pi->setTrack(this);
+ pi->setID(rackpos);
+ if(pi->readConfiguration(xml, false))
+ delete pi;
+ else
+ (*_efxPipe)[rackpos] = pi;
+ }
+ else
+ printf("can't load plugin - plugin rack is already full\n");
+ }
+ else if (tag == "auxSend")
+ readAuxSend(xml);
+ else if (tag == "prefader")
+ _prefader = xml.parseInt();
+ else if (tag == "sendMetronome")
+ _sendMetronome = xml.parseInt();
+ else if (tag == "automation")
+ setAutomationType(AutomationType(xml.parseInt()));
+ // Removed by T356
+ // "recfile" tag not saved anymore
+ //else if (tag == "recfile")
+ // readRecfile(xml);
+ else if (tag == "controller") {
+ CtrlList* l = new CtrlList();
+ l->read(xml);
+
+ // Since (until now) muse wrote a 'zero' for plugin controller current value
+ // in the XML file, we can't use that value, now that plugin automation is added.
+ // We must take the value from the plugin control value.
+ // Otherwise we break all existing .med files with plugins, because the gui
+ // controls would all be set to zero.
+ // But we will allow for the (unintended, useless) possibility of a controller
+ // with no matching plugin control.
+ PluginI* p = 0;
+ bool ctlfound = false;
+ int m = l->id() & AC_PLUGIN_CTL_ID_MASK;
+ int n = (l->id() >> AC_PLUGIN_CTL_BASE_POW) - 1;
+ if(n >= 0 && n < PipelineDepth)
+ {
+ p = (*_efxPipe)[n];
+ if(p && m < p->parameters())
+ ctlfound = true;
+ }
+
+ iCtrlList icl = _controller.find(l->id());
+ if (icl == _controller.end())
+ _controller.add(l);
+ else {
+ CtrlList* d = icl->second;
+ for (iCtrl i = l->begin(); i != l->end(); ++i)
+ d->insert(std::pair<const int, CtrlVal> (i->first, i->second));
+
+ if(!ctlfound)
+ d->setCurVal(l->curVal());
+
+ d->setDefault(l->getDefault());
+ delete l;
+ l = d;
+ }
+
+ if(ctlfound)
+ {
+ l->setCurVal(p->param(m));
+ LADSPA_PortRangeHint range = p->range(m);
+ if(LADSPA_IS_HINT_TOGGLED(range.HintDescriptor))
+ l->setMode(CtrlList::DISCRETE);
+ else
+ l->setMode(CtrlList::INTERPOLATE);
+ }
+ }
+ else
+ return Track::readProperties(xml, tag);
+ return false;
+ }
+
+//---------------------------------------------------------
+// showPendingPluginNativeGuis
+// This is needed because OSC needs all tracks with plugins to be already
+// added to their track lists so it can find them and show their native guis.
+//---------------------------------------------------------
+
+void AudioTrack::showPendingPluginNativeGuis()
+{
+ for(int idx = 0; idx < PipelineDepth; ++idx)
+ {
+ PluginI* p = (*_efxPipe)[idx];
+ if(!p)
+ continue;
+
+ if(p->isShowNativeGuiPending())
+ p->showNativeGui(true);
+ }
+}
+
+//---------------------------------------------------------
+// mapRackPluginsToControllers
+//---------------------------------------------------------
+
+void AudioTrack::mapRackPluginsToControllers()
+{
+ // Iterate all possible plugin controller indexes...
+ for(int idx = PipelineDepth - 1; idx >= 0; idx--)
+ {
+ iCtrlList icl = _controller.lower_bound((idx + 1) * AC_PLUGIN_CTL_BASE);
+ if(icl == _controller.end() || ((icl->second->id() >> AC_PLUGIN_CTL_BASE_POW) - 1) != idx)
+ continue;
+
+ // We found some controllers with that index. Now iterate the plugin rack...
+ for(int i = idx; i >= 0; i--)
+ {
+ PluginI* p = (*_efxPipe)[i];
+ if(!p)
+ continue;
+
+ // We found a plugin at a rack position. If the rack position is not the same as the controller index...
+ if(i != idx)
+ {
+ (*_efxPipe)[i] = 0;
+ (*_efxPipe)[idx] = p;
+ }
+ p->setID(idx);
+
+ // It is now safe to update the controllers.
+ p->updateControllers();
+
+ break;
+ }
+ }
+
+ // No matter of the outcome of the above - rack position is not too critical -
+ // making sure that each control has a controller is important. Otherwise they
+ // are stuck at zero can't be adjusted.
+ // Muse med files created before the automation patches (before 0.9pre1) may have broken
+ // controller sections, so this will allow more tolerance of them.
+ for(int idx = 0; idx < PipelineDepth; idx++)
+ {
+ PluginI* p = (*_efxPipe)[idx];
+ if(!p)
+ continue;
+
+ if(p->id() != idx)
+ p->setID(idx);
+
+ int j = p->parameters();
+
+ for(int i = 0; i < j; i++)
+ {
+ int id = genACnum(idx, i);
+ CtrlList* l = 0;
+
+ ciCtrlList icl = _controller.find(id);
+ if(icl == _controller.end())
+ {
+ l = new CtrlList(id);
+ addController(l);
+ }
+ else
+ l = icl->second;
+
+ // Force all of these now, even though they may have already been set. With a pre-
+ // 0.9pre1 med file with broken controller sections they may not be set correct.
+ float min, max;
+ p->range(i, &min, &max);
+ CtrlValueType t = p->valueType();
+ l->setRange(min, max);
+ l->setName(QString(p->paramName(i)));
+ l->setValueType(t);
+ LADSPA_PortRangeHint rh = p->range(i);
+ if(LADSPA_IS_HINT_TOGGLED(rh.HintDescriptor))
+ l->setMode(CtrlList::DISCRETE);
+ else
+ l->setMode(CtrlList::INTERPOLATE);
+ l->setCurVal(p->param(i));
+ //l->setDefault(p->defaultValue(i));
+ }
+ }
+
+ // The loop is a safe way to delete while iterating 'non-linear' lists.
+ bool loop;
+ do
+ {
+ loop = false;
+ for(ciCtrlList icl = _controller.begin(); icl != _controller.end(); ++icl)
+ {
+ CtrlList* l = icl->second;
+ int id = l->id();
+ // Ignore volume, pan, mute etc.
+ if(id < AC_PLUGIN_CTL_BASE)
+ continue;
+ int param = id & AC_PLUGIN_CTL_ID_MASK;
+ int idx = (id >> AC_PLUGIN_CTL_BASE_POW) - 1;
+ PluginI* p = (*_efxPipe)[idx];
+ // If there's no plugin at that rack position, or the param is out of range of
+ // the number of controls in the plugin, then it's a stray controller. Delete it.
+ // Future: Leave room for possible bypass controller at AC_PLUGIN_CTL_ID_MASK -1.
+ //if(!p || (param >= p->parameters() && (param != AC_PLUGIN_CTL_ID_MASK -1)))
+ if(!p || (param >= p->parameters()))
+ {
+ _controller.erase(id);
+
+ loop = true;
+ break;
+ }
+ }
+ }
+ while (loop);
+
+
+ // Although this tested OK, and is the 'official' way to erase while iterating,
+ // I don't trust it. I'm weary of this method. The technique didn't work
+ // in Audio::msgRemoveTracks(), see comments there.
+ /*
+
+ // Now delete any stray controllers which don't belong to anything.
+ for(iCtrlList icl = _controller.begin(); icl != _controller.end(); )
+ {
+ CtrlList* l = icl->second;
+ int id = l->id();
+ // Ignore volume, pan, mute etc.
+ if(id < AC_PLUGIN_CTL_BASE)
+ {
+ ++icl;
+ continue;
+ }
+ int param = id & AC_PLUGIN_CTL_ID_MASK;
+ int idx = (id >> AC_PLUGIN_CTL_BASE_POW) - 1;
+ PluginI* p = (*_efxPipe)[idx];
+ // If there's no plugin at that rack position, or the param is out of range of
+ // the number of controls in the plugin, then it's a stray controller. Delete it.
+ // Future: Leave room for possible bypass controller at AC_PLUGIN_CTL_ID_MASK -1.
+ //if(!p || (param >= p->parameters() && (param != AC_PLUGIN_CTL_ID_MASK -1)))
+ if(!p || (param >= p->parameters()))
+ _controller.erase(icl++);
+ else
+ ++icl;
+ }
+ */
+}
+
+/*
+//---------------------------------------------------------
+// writeRouting
+//---------------------------------------------------------
+
+void AudioTrack::writeRouting(int level, Xml& xml) const
+{
+ QString n;
+ if (type() == Track::AUDIO_INPUT) {
+ ciJackRouteNameCache circ = jackRouteNameCache.find(this);
+ if(circ != jackRouteNameCache.end())
+ {
+ jackRouteNameMap rm = circ->second;
+ for(ciJackRouteNameMap cirm = rm.begin(); cirm != rm.end(); ++cirm)
+ {
+ n = cirm->second;
+ if(!n.isEmpty())
+ {
+ Route dst(name(), true, cirm->first);
+ xml.tag(level++, "Route");
+ xml.strTag(level, "srcNode", n);
+ xml.strTag(level, "dstNode", dst.name());
+ xml.etag(level--, "Route");
+ }
+ }
+ }
+ }
+ if(type() == Track::AUDIO_OUTPUT)
+ {
+ ciJackRouteNameCache circ = jackRouteNameCache.find(this);
+ if(circ != jackRouteNameCache.end())
+ {
+ jackRouteNameMap rm = circ->second;
+ for(ciJackRouteNameMap cirm = rm.begin(); cirm != rm.end(); ++cirm)
+ {
+ n = cirm->second;
+ if(!n.isEmpty())
+ {
+ Route src(name(), false, cirm->first);
+ xml.tag(level++, "Route");
+ xml.strTag(level, "srcNode", src.name());
+ xml.strTag(level, "dstNode", n);
+ xml.etag(level--, "Route");
+ }
+ }
+ }
+ }
+ else
+ {
+ const RouteList* rl = &_outRoutes;
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r) {
+ if(!r->name().isEmpty())
+ {
+ xml.tag(level++, "Route");
+ xml.strTag(level, "srcNode", name());
+ xml.strTag(level, "dstNode", r->name());
+ xml.etag(level--, "Route");
+ }
+ }
+ }
+}
+*/
+
+//---------------------------------------------------------
+// AudioInput
+//---------------------------------------------------------
+
+AudioInput::AudioInput()
+ : AudioTrack(AUDIO_INPUT)
+ {
+ // set Default for Input Ports:
+ _mute = true;
+ //setVolume(1.0);
+ for (int i = 0; i < MAX_CHANNELS; ++i)
+ jackPorts[i] = 0;
+ //_channels = 0;
+ //setChannels(2);
+ }
+
+//AudioInput::AudioInput(const AudioInput& t)
+// : AudioTrack(t)
+AudioInput::AudioInput(const AudioInput& t, bool cloneParts)
+ : AudioTrack(t, cloneParts)
+ {
+ for (int i = 0; i < MAX_CHANNELS; ++i)
+ jackPorts[i] = t.jackPorts[i];
+ }
+
+//---------------------------------------------------------
+// ~AudioInput
+//---------------------------------------------------------
+
+AudioInput::~AudioInput()
+ {
+ if (!checkAudioDevice()) return;
+ for (int i = 0; i < _channels; ++i)
+ if(jackPorts[i])
+ audioDevice->unregisterPort(jackPorts[i]);
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void AudioInput::write(int level, Xml& xml) const
+ {
+ xml.tag(level++, "AudioInput");
+ AudioTrack::writeProperties(level, xml);
+ xml.etag(level, "AudioInput");
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void AudioInput::read(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (AudioTrack::readProperties(xml, tag))
+ xml.unknown("AudioInput");
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if (tag == "AudioInput") {
+ setName(name()); // allocate jack ports
+ mapRackPluginsToControllers();
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// AudioOutput
+//---------------------------------------------------------
+
+AudioOutput::AudioOutput()
+ : AudioTrack(AUDIO_OUTPUT)
+ {
+ for (int i = 0; i < MAX_CHANNELS; ++i)
+ jackPorts[i] = 0;
+ //_channels = 0;
+ //setChannels(2);
+ }
+
+//AudioOutput::AudioOutput(const AudioOutput& t)
+// : AudioTrack(t)
+AudioOutput::AudioOutput(const AudioOutput& t, bool cloneParts)
+ : AudioTrack(t, cloneParts)
+ {
+ for (int i = 0; i < MAX_CHANNELS; ++i)
+ jackPorts[i] = t.jackPorts[i];
+ _nframes = t._nframes;
+ }
+
+//---------------------------------------------------------
+// ~AudioOutput
+//---------------------------------------------------------
+
+AudioOutput::~AudioOutput()
+ {
+ if (!checkAudioDevice()) return;
+ for (int i = 0; i < _channels; ++i)
+ if(jackPorts[i])
+ audioDevice->unregisterPort(jackPorts[i]);
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void AudioOutput::write(int level, Xml& xml) const
+ {
+ xml.tag(level++, "AudioOutput");
+ AudioTrack::writeProperties(level, xml);
+ xml.etag(level, "AudioOutput");
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void AudioOutput::read(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (AudioTrack::readProperties(xml, tag))
+ xml.unknown("AudioOutput");
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if (tag == "AudioOutput") {
+ setName(name()); // allocate jack ports
+ mapRackPluginsToControllers();
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void AudioGroup::write(int level, Xml& xml) const
+ {
+ xml.tag(level++, "AudioGroup");
+ AudioTrack::writeProperties(level, xml);
+ xml.etag(level, "AudioGroup");
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void AudioGroup::read(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (AudioTrack::readProperties(xml, tag))
+ xml.unknown("AudioGroup");
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if (tag == "AudioGroup")
+ {
+ mapRackPluginsToControllers();
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void AudioAux::write(int level, Xml& xml) const
+ {
+ xml.tag(level++, "AudioAux");
+ AudioTrack::writeProperties(level, xml);
+ xml.etag(level, "AudioAux");
+ }
+
+//---------------------------------------------------------
+// AudioAux
+//---------------------------------------------------------
+
+AudioAux::AudioAux()
+ : AudioTrack(AUDIO_AUX)
+{
+ //_channels = 0;
+ //setChannels(2);
+ // Changed by Tim. p3.3.15
+ //for (int i = 0; i < MAX_CHANNELS; ++i)
+ // buffer[i] = (i < channels()) ? new float[segmentSize] : 0;
+ for(int i = 0; i < MAX_CHANNELS; ++i)
+ {
+ if(i < channels())
+ posix_memalign((void**)(buffer + i), 16, sizeof(float) * segmentSize);
+ else
+ buffer[i] = 0;
+ }
+}
+
+//---------------------------------------------------------
+// AudioAux
+//---------------------------------------------------------
+
+AudioAux::~AudioAux()
+ {
+ // Changed by Tim. p3.3.15
+ //for (int i = 0; i < channels(); ++i)
+ // delete[] buffer[i];
+ for (int i = 0; i < MAX_CHANNELS; ++i) {
+ if (buffer[i])
+ free(buffer[i]);
+ }
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void AudioAux::read(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (AudioTrack::readProperties(xml, tag))
+ xml.unknown("AudioAux");
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if (tag == "AudioAux")
+ {
+ mapRackPluginsToControllers();
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// getData
+//---------------------------------------------------------
+
+bool AudioAux::getData(unsigned /*pos*/, int ch, unsigned /*samples*/, float** data)
+ {
+ for (int i = 0; i < ch; ++i)
+ data[i] = buffer[i % channels()];
+ return true;
+ }
+
+//---------------------------------------------------------
+// setChannels
+//---------------------------------------------------------
+
+void AudioAux::setChannels(int n)
+{
+ if(n > channels())
+ {
+ // Changed by Tim. p3.3.15
+ //for (int i = channels(); i < n; ++i)
+ // buffer[i] = new float[segmentSize];
+ for(int i = channels(); i < n; ++i)
+ posix_memalign((void**)(buffer + i), 16, sizeof(float) * segmentSize);
+ }
+ else if(n < channels())
+ {
+ // Changed by Tim. p3.3.15
+ //for (int i = n; i < channels(); ++i)
+ // delete[] buffer[i];
+ for(int i = n; i < channels(); ++i)
+ {
+ if(buffer[i])
+ free(buffer[i]);
+ }
+ }
+ AudioTrack::setChannels(n);
+}
+
+//---------------------------------------------------------
+// setRecordFlag1
+// gui part (executed in gui thread)
+//---------------------------------------------------------
+
+bool AudioTrack::setRecordFlag1(bool f)
+ {
+ if (f == _recordFlag)
+ return true;
+ if (f) {
+ if (_recFile == 0) {
+ //
+ // create soundfile for recording
+ //
+ char buffer[128];
+ QFile fil;
+ for (;;++recFileNumber) {
+ sprintf(buffer, "%s/rec%d.wav",
+ museProject.latin1(),
+ recFileNumber);
+ fil.setName(QString(buffer));
+ if (!fil.exists())
+ break;
+ }
+ _recFile = new SndFile(QString(buffer));
+ _recFile->setFormat(
+ SF_FORMAT_WAV | SF_FORMAT_FLOAT,
+ _channels, sampleRate);
+ }
+ if(_recFile->openWrite())
+ {
+ QMessageBox::critical(NULL, "MusE write error.", "Error creating target wave file\n"
+ "Check your configuration.");
+ return false;
+
+ }
+ if (debugMsg)
+ printf("AudioNode::setRecordFlag1: create internal file %s\n",
+ _recFile->path().latin1());
+ }
+ else {
+ if (_recFile) {
+ // this file has not been processed and can be
+ // deleted
+ // We should only arrive here if going from a 'record-armed' state
+ // to a non record-armed state. Because otherwise after actually
+ // recording, the _recFile pointer is made into an event,
+ // then _recFile is made zero before this function is called.
+ QString s = _recFile->path();
+ // Added by Tim. p3.3.8
+ delete _recFile;
+ setRecFile(0);
+
+ remove(s.latin1());
+ if(debugMsg)
+ printf("AudioNode::setRecordFlag1: remove file %s\n", s.latin1());
+ //_recFile = 0;
+ }
+ }
+ return true;
+ }
+double AudioTrack::auxSend(int idx) const
+ {
+ if (unsigned(idx) >= _auxSend.size()) {
+ printf("%s auxSend: bad index: %d >= %zd\n",
+ name().latin1(), idx, _auxSend.size());
+ return 0.0;
+ }
+ return _auxSend[idx];
+ }
+
+void AudioTrack::setAuxSend(int idx, double v)
+ {
+ if (unsigned(idx) >= _auxSend.size()) {
+ printf("%s setAuxSend: bad index: %d >= %zd\n",
+ name().latin1(), idx, _auxSend.size());
+ return;
+ }
+ _auxSend[idx] = v;
+ }
+
diff --git a/muse2/muse/cliplist/Makefile.am b/muse2/muse/cliplist/Makefile.am
new file mode 100644
index 00000000..7e28b9ef
--- /dev/null
+++ b/muse2/muse/cliplist/Makefile.am
@@ -0,0 +1,14 @@
+include $(top_srcdir)/common.am
+
+if PCH
+AM_CXXFLAGS += -include $(top_srcdir)/all.h
+endif
+
+noinst_LIBRARIES = libcliplist.a
+
+dist_libcliplist_a_SOURCES = \
+ cliplist.cpp \
+ cliplist.h
+
+nodist_libcliplist_a_SOURCES = \
+ moc_cliplist.cpp
diff --git a/muse2/muse/cliplist/Makefile.in b/muse2/muse/cliplist/Makefile.in
new file mode 100644
index 00000000..e1cad35c
--- /dev/null
+++ b/muse2/muse/cliplist/Makefile.in
@@ -0,0 +1,596 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/common.am
+@PCH_TRUE@am__append_1 = -include $(top_srcdir)/all.h
+subdir = muse/cliplist
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
+ $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libcliplist_a_AR = $(AR) $(ARFLAGS)
+libcliplist_a_LIBADD =
+dist_libcliplist_a_OBJECTS = cliplist.$(OBJEXT)
+nodist_libcliplist_a_OBJECTS = moc_cliplist.$(OBJEXT)
+libcliplist_a_OBJECTS = $(dist_libcliplist_a_OBJECTS) \
+ $(nodist_libcliplist_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(dist_libcliplist_a_SOURCES) \
+ $(nodist_libcliplist_a_SOURCES)
+DIST_SOURCES = $(dist_libcliplist_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCBOOKSTYLE = @DOCBOOKSTYLE@
+DOCBOOKTARGETS = @DOCBOOKTARGETS@
+DOT = @DOT@
+DOTPATH = @DOTPATH@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@
+FST_CFLAGS = @FST_CFLAGS@
+FST_LIBS = @FST_LIBS@
+Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@
+Fluidsynth_LIBS = @Fluidsynth_LIBS@
+GIVERTCAP = @GIVERTCAP@
+GREP = @GREP@
+HAVEDOT = @HAVEDOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JADE = @JADE@
+LASH_CFLAGS = @LASH_CFLAGS@
+LASH_LIBS = @LASH_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LO_CFLAGS = @LO_CFLAGS@
+LO_LIBS = @LO_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUSECXXFLAGS = @MUSECXXFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSGMLS = @NSGMLS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCH = @PCH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIB = @PYTHON_LIB@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+QTDIR_BIN = @QTDIR_BIN@
+QTDIR_INC = @QTDIR_INC@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+SUIDBUILD = @SUIDBUILD@
+SUIDINSTALL = @SUIDINSTALL@
+USE_SSE = @USE_SSE@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+have_docbook = @have_docbook@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+synth_fluid = @synth_fluid@
+synth_fluidsynth = @synth_fluidsynth@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \
+ -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(am__append_1)
+AM_CPPFLAGS =
+MOC = $(QTDIR_BIN)/moc
+#UIC = $(QTDIR_BIN)/uic3
+UIC = /usr/bin/uic3
+UIFILES = $(wildcard *.ui)
+MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \
+ if grep -q Q_OBJECT $$h; then \
+ echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \
+ fi; \
+ done)
+
+BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+SUFFIXES = .ui .h.gch
+noinst_LIBRARIES = libcliplist.a
+dist_libcliplist_a_SOURCES = \
+ cliplist.cpp \
+ cliplist.h
+
+nodist_libcliplist_a_SOURCES = \
+ moc_cliplist.cpp
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .ui .h.gch .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/cliplist/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu muse/cliplist/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libcliplist.a: $(libcliplist_a_OBJECTS) $(libcliplist_a_DEPENDENCIES)
+ -rm -f libcliplist.a
+ $(libcliplist_a_AR) libcliplist.a $(libcliplist_a_OBJECTS) $(libcliplist_a_LIBADD)
+ $(RANLIB) libcliplist.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cliplist.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_cliplist.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+de:
+ @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done
+
+nde:
+ @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done
+
+.ui.o: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(CXXCOMPILE) -c $*.cpp -o $*.o
+ $(RM) $*.cpp moc_$*.cpp moc_$*.o
+
+.ui.lo: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(LTCXXCOMPILE) -c $*.cpp -o $*.lo
+ $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o
+
+moc_%.cpp: %.h
+ $(MOC) $< -o $@
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/muse2/muse/cliplist/cliplist.cpp b/muse2/muse/cliplist/cliplist.cpp
new file mode 100644
index 00000000..92002032
--- /dev/null
+++ b/muse2/muse/cliplist/cliplist.cpp
@@ -0,0 +1,260 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: cliplist.cpp,v 1.6.2.3 2008/08/18 00:15:24 terminator356 Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "cliplist.h"
+#include "song.h"
+#include "globals.h"
+#include "wave.h"
+#include "xml.h"
+#include "posedit.h"
+#include "cliplisteditorbase.h"
+
+#include <q3listview.h>
+#include <qlayout.h>
+#include <q3groupbox.h>
+#include <qlabel.h>
+#include <qstyle.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+
+extern int mtcType;
+enum { COL_NAME=0, COL_REFS, COL_POS, COL_LEN };
+
+//---------------------------------------------------------
+// ClipItem
+//---------------------------------------------------------
+
+class ClipItem : public Q3ListViewItem {
+ SndFileR _wf;
+
+ virtual QString text(int) const;
+
+ public:
+ ClipItem(Q3ListView*, const SndFileR&);
+ SndFileR* wf() { return &_wf; }
+ };
+
+ClipItem::ClipItem(Q3ListView* parent, const SndFileR& w)
+ : Q3ListViewItem(parent), _wf(w)
+ {
+ }
+
+//---------------------------------------------------------
+// samples2smpte
+//---------------------------------------------------------
+
+#if 0
+static QString samples2smpte(int samples)
+ {
+ double time = double(samples) / double(sampleRate);
+ int min = int(time) / 60;
+ int sec = int(time) % 60;
+ double rest = time - (min * 60 + sec);
+ switch(mtcType) {
+ case 0: // 24 frames sec
+ rest *= 24;
+ break;
+ case 1: // 25
+ rest *= 25;
+ break;
+ case 2: // 30 drop frame
+ rest *= 30;
+ break;
+ case 3: // 30 non drop frame
+ rest *= 30;
+ break;
+ }
+ int frame = int(rest);
+ int subframe = int((rest-frame)*100);
+ QString s;
+ s.sprintf("%03d:%02d:%02d:%02d", min, sec, frame, subframe);
+ return s;
+ }
+#endif
+
+//---------------------------------------------------------
+// text
+//---------------------------------------------------------
+
+QString ClipItem::text(int col) const
+ {
+ QString s("");
+ switch(col) {
+ case COL_NAME:
+ s = _wf.name();
+ break;
+ case COL_POS:
+ case COL_LEN:
+ break;
+ case COL_REFS:
+ s.setNum(_wf.getRefCount());
+ break;
+ }
+ return s;
+ }
+
+//---------------------------------------------------------
+// ClipListEdit
+//---------------------------------------------------------
+
+ClipListEdit::ClipListEdit()
+ : TopWin(0, "cliplist", Qt::WType_TopLevel /*|WDestructiveClose*/)
+ {
+ setCaption(tr("MusE: Clip List Editor"));
+
+ editor = new ClipListEditorBase(this, "edit");
+ setCentralWidget(editor);
+
+ editor->view->setColumnAlignment(COL_REFS, Qt::AlignRight);
+
+ QFontMetrics fm(editor->view->font());
+ int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth,0, this); // ddskrjo 0
+ int w = 2 + fm.width('9') * 9 + fm.width(':') * 3 + fw * 4;
+ editor->view->setColumnAlignment(COL_POS, Qt::AlignRight);
+ editor->view->setColumnWidth(COL_POS, w);
+ editor->view->setColumnAlignment(COL_LEN, Qt::AlignRight);
+ editor->view->setColumnWidth(COL_LEN, w);
+
+ connect(editor->view, SIGNAL(selectionChanged()), SLOT(clipSelectionChanged()));
+ connect(editor->view, SIGNAL(clicked(Q3ListViewItem*)), SLOT(clicked(Q3ListViewItem*)));
+
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ connect(editor->start, SIGNAL(valueChanged(const Pos&)), SLOT(startChanged(const Pos&)));
+ connect(editor->len, SIGNAL(valueChanged(const Pos&)), SLOT(lenChanged(const Pos&)));
+
+ updateList();
+ }
+
+//---------------------------------------------------------
+// updateList
+//---------------------------------------------------------
+
+void ClipListEdit::updateList()
+ {
+ editor->view->clear();
+ for (iSndFile f = SndFile::sndFiles.begin(); f != SndFile::sndFiles.end(); ++f) {
+ new ClipItem(editor->view, *f);
+ }
+ clipSelectionChanged();
+ }
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void ClipListEdit::closeEvent(QCloseEvent* e)
+ {
+ emit deleted((unsigned long)this);
+ e->accept();
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void ClipListEdit::songChanged(int type)
+ {
+ // Is it simply a midi controller value adjustment? Forget it.
+ if(type == SC_MIDI_CONTROLLER)
+ return;
+
+ updateList();
+ }
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void ClipListEdit::readStatus(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ switch (token) {
+ case Xml::TagStart:
+ if (tag == "topwin")
+ TopWin::readStatus(xml);
+ else
+ xml.unknown("CliplistEdit");
+ break;
+ case Xml::TagEnd:
+ if (tag == "cliplist")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void ClipListEdit::writeStatus(int level, Xml& xml) const
+ {
+ xml.tag(level++, "cliplist");
+ TopWin::writeStatus(level, xml);
+ xml.etag(level, "cliplist");
+ }
+
+//---------------------------------------------------------
+// startChanged
+//---------------------------------------------------------
+
+void ClipListEdit::startChanged(const Pos& /*pos*/)//prevent compiler warning: unsused parameter
+ {
+// editor->view->triggerUpdate();
+ }
+
+//---------------------------------------------------------
+// lenChanged
+//---------------------------------------------------------
+
+void ClipListEdit::lenChanged(const Pos& /*pos*/) //prevent compiler warning: unsused parameter
+ {
+// curClip.setLenFrame(pos.frame());
+// editor->view->triggerUpdate();
+ }
+
+//---------------------------------------------------------
+// clipSelectionChanged
+//---------------------------------------------------------
+
+void ClipListEdit::clipSelectionChanged()
+ {
+// ClipItem* item = (ClipItem*)(editor->view->selectedItem());
+
+// if (item == 0) {
+ editor->start->setEnabled(false);
+ editor->len->setEnabled(false);
+ return;
+#if 0
+ }
+ editor->start->setEnabled(true);
+ editor->len->setEnabled(true);
+ Pos pos, len;
+ pos.setType(Pos::FRAMES);
+ len.setType(Pos::FRAMES);
+ pos.setFrame(curClip.spos());
+ len.setFrame(curClip.lenFrame());
+ editor->start->setValue(pos);
+ editor->len->setValue(len);
+#endif
+ }
+
+//---------------------------------------------------------
+// clicked
+//---------------------------------------------------------
+
+void ClipListEdit::clicked(Q3ListViewItem*)
+ {
+// printf("clicked\n");
+ }
+
diff --git a/muse2/muse/cliplist/cliplist.h b/muse2/muse/cliplist/cliplist.h
new file mode 100644
index 00000000..3f13d586
--- /dev/null
+++ b/muse2/muse/cliplist/cliplist.h
@@ -0,0 +1,51 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: cliplist.h,v 1.3.2.1 2005/12/11 21:29:23 spamatica Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __CLIPLIST_H__
+#define __CLIPLIST_H__
+
+#include "../cobject.h"
+#include "event.h"
+//Added by qt3to4:
+#include <QCloseEvent>
+
+class Q3ListView;
+class Q3ListViewItem;
+class Xml;
+class Pos;
+class ClipListEditorBase;
+
+//---------------------------------------------------------
+// ClipListEdit
+//---------------------------------------------------------
+
+class ClipListEdit : public TopWin {
+ Q_OBJECT
+ ClipListEditorBase* editor;
+
+ virtual void closeEvent(QCloseEvent*);
+ void updateList();
+
+ private slots:
+ void songChanged(int);
+ void startChanged(const Pos&);
+ void lenChanged(const Pos&);
+ void clipSelectionChanged();
+ void clicked(Q3ListViewItem*);
+
+ signals:
+ void deleted(unsigned long);
+
+ public:
+ ClipListEdit();
+ virtual void readStatus(Xml&);
+ virtual void writeStatus(int, Xml&) const;
+ };
+
+#endif
+
diff --git a/muse2/muse/cobject.cpp b/muse2/muse/cobject.cpp
new file mode 100644
index 00000000..bf7d7e98
--- /dev/null
+++ b/muse2/muse/cobject.cpp
@@ -0,0 +1,62 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: cobject.cpp,v 1.4 2004/02/02 12:10:09 wschweer Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "cobject.h"
+#include "xml.h"
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void TopWin::readStatus(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ QString tag = xml.s1();
+ switch (token) {
+ case Xml::TagStart:
+ if (tag == "geometry") {
+ QRect r(readGeometry(xml, tag));
+ resize(r.size());
+ move(r.topLeft());
+ }
+ else
+ xml.unknown("TopWin");
+ break;
+ case Xml::TagEnd:
+ if (tag == "topwin")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void TopWin::writeStatus(int level, Xml& xml) const
+ {
+ xml.tag(level++, "topwin");
+ xml.tag(level++, "geometry x=\"%d\" y=\"%d\" w=\"%d\" h=\"%d\"",
+ geometry().x(),
+ geometry().y(),
+ geometry().width(),
+ geometry().height());
+ xml.tag(level--, "/geometry");
+ xml.tag(level, "/topwin");
+ }
+
+TopWin::TopWin(QWidget* parent, const char* name,
+ Qt::WFlags f) : Q3MainWindow(parent, name, f)
+ {
+ }
+
diff --git a/muse2/muse/cobject.h b/muse2/muse/cobject.h
new file mode 100644
index 00000000..15c687fc
--- /dev/null
+++ b/muse2/muse/cobject.h
@@ -0,0 +1,66 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: cobject.h,v 1.3.2.1 2005/12/11 21:29:24 spamatica Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __COBJECT_H__
+#define __COBJECT_H__
+
+#include "config.h"
+
+#include <q3mainwindow.h>
+#include <list>
+
+class Xml;
+
+//---------------------------------------------------------
+// TopWin
+//---------------------------------------------------------
+
+class TopWin : public Q3MainWindow
+ {
+ Q_OBJECT
+
+ public:
+ virtual void readStatus(Xml&);
+ virtual void writeStatus(int, Xml&) const;
+ TopWin(QWidget* parent=0, const char* name=0,
+ Qt::WFlags f = Qt::WType_TopLevel|Qt::WDestructiveClose);
+ };
+
+//---------------------------------------------------------
+// Toplevel
+//---------------------------------------------------------
+
+class Toplevel {
+ public:
+ enum ToplevelType { PIANO_ROLL, LISTE, DRUM, MASTER, WAVE,
+ LMASTER, CLIPLIST, MARKER
+#ifdef PATCHBAY
+ , M_PATCHBAY
+#endif /* PATCHBAY */
+ };
+ Toplevel(ToplevelType t, unsigned long obj, TopWin* cobj) {
+ _type = t;
+ _object = obj;
+ _cobject = cobj;
+ }
+ ToplevelType type() const { return _type; }
+ unsigned long object() const { return _object; }
+ TopWin* cobject() const { return _cobject; }
+
+ private:
+ ToplevelType _type;
+ unsigned long _object;
+ TopWin* _cobject;
+ };
+
+typedef std::list <Toplevel> ToplevelList;
+typedef ToplevelList::iterator iToplevel;
+typedef ToplevelList::const_iterator ciToplevel;
+
+#endif
+
diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp
new file mode 100644
index 00000000..c44665e1
--- /dev/null
+++ b/muse2/muse/conf.cpp
@@ -0,0 +1,1499 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: conf.cpp,v 1.33.2.18 2009/12/01 03:52:40 terminator356 Exp $
+//
+// (C) Copyright 1999-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <sndfile.h>
+#include <errno.h>
+#include <q3listview.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qlineedit.h>
+#include <qcombobox.h>
+#include <qlabel.h>
+#include <q3buttongroup.h>
+#include <stdio.h>
+#include <q3popupmenu.h>
+#include <q3groupbox.h>
+#include <qradiobutton.h>
+#include <qspinbox.h>
+#include <qcheckbox.h>
+#include <qsignalmapper.h>
+#include <qtooltip.h>
+#include <qstyle.h>
+
+#include "app.h"
+#include "icons.h"
+#include "globals.h"
+#include "drumedit.h"
+#include "pianoroll.h"
+#include "master/masteredit.h"
+#include "transport.h"
+#include "bigtime.h"
+#include "arranger.h"
+#include "conf.h"
+#include "gconfig.h"
+#include "pitchedit.h"
+#include "midiport.h"
+#include "mididev.h"
+#include "driver/audiodev.h"
+#include "driver/jackmidi.h"
+#include "xml.h"
+#include "waveedit.h"
+#include "midi.h"
+#include "midisyncimpl.h"
+#include "midifilterimpl.h"
+#include "midictrl.h"
+#include "ctrlcombo.h"
+#include "genset.h"
+#include "midiitransform.h"
+#include "synth.h"
+#include "audio.h"
+#include "sync.h"
+#include "wave.h"
+#include "midiseq.h"
+#include "amixer.h"
+
+extern void writeMidiTransforms(int level, Xml& xml);
+extern void readMidiTransform(Xml&);
+
+extern void writeMidiInputTransforms(int level, Xml& xml);
+extern void readMidiInputTransform(Xml&);
+
+//---------------------------------------------------------
+// readGeometry
+//---------------------------------------------------------
+
+QRect readGeometry(Xml& xml, const QString& name)
+ {
+ QRect r(0, 0, 50, 50);
+ int val;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ QString tag = xml.s1();
+ switch (token) {
+ case Xml::TagStart:
+ xml.parse1();
+ break;
+ case Xml::Attribut:
+ val = xml.s2().toInt();
+ if (tag == "x")
+ r.setX(val);
+ else if (tag == "y")
+ r.setY(val);
+ else if (tag == "w")
+ r.setWidth(val);
+ else if (tag == "h")
+ r.setHeight(val);
+ break;
+ case Xml::TagEnd:
+ if (tag == name)
+ return r;
+ default:
+ break;
+ }
+ }
+ return r;
+ }
+
+
+//---------------------------------------------------------
+// readColor
+//---------------------------------------------------------
+
+QColor readColor(Xml& xml)
+ {
+ int val, r=0, g=0, b=0;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ if (token != Xml::Attribut)
+ break;
+ QString tag = xml.s1();
+ switch (token) {
+ case Xml::Attribut:
+ val = xml.s2().toInt();
+ if (tag == "r")
+ r = val;
+ else if (tag == "g")
+ g = val;
+ else if (tag == "b")
+ b = val;
+ break;
+ default:
+ break;
+ }
+ }
+
+ return QColor(r, g, b);
+ }
+
+//---------------------------------------------------------
+// readController
+//---------------------------------------------------------
+
+static void readController(Xml& xml, int midiPort, int channel)
+ {
+ int id = 0;
+ int val = CTRL_VAL_UNKNOWN;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ QString tag = xml.s1();
+ switch (token) {
+ case Xml::TagStart:
+ if (tag == "val")
+ val = xml.parseInt();
+ else
+ xml.unknown("controller");
+ break;
+ case Xml::Attribut:
+ if (tag == "id")
+ id = xml.s2().toInt();
+ break;
+ case Xml::TagEnd:
+ if (tag == "controller") {
+ MidiPort* port = &midiPorts[midiPort];
+ //port->addManagedController(channel, id);
+ val = port->limitValToInstrCtlRange(id, val);
+ // The value here will actually be sent to the device LATER, in MidiPort::setMidiDevice()
+ port->setHwCtrlState(channel, id, val);
+ return;
+ }
+ default:
+ return;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// readPortChannel
+//---------------------------------------------------------
+
+static void readPortChannel(Xml& xml, int midiPort)
+ {
+ int idx = 0; //torbenh
+ for (;;) {
+ Xml::Token token = xml.parse();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ QString tag = xml.s1();
+ switch (token) {
+ case Xml::TagStart:
+ if (tag == "controller") {
+ readController(xml, midiPort, idx);
+ }
+ else
+ xml.unknown("MidiDevice");
+ break;
+ case Xml::Attribut:
+ if (tag == "idx")
+ idx = xml.s2().toInt();
+ break;
+ case Xml::TagEnd:
+ if (tag == "channel")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// readConfigMidiPort
+//---------------------------------------------------------
+
+static void readConfigMidiPort(Xml& xml)
+ {
+ int idx = 0;
+ QString device;
+ QString instrument;
+ int openFlags = 1;
+ bool thruFlag = false;
+ MidiSyncInfo tmpSi;
+ int type = MidiDevice::ALSA_MIDI;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ QString tag = xml.s1();
+ switch (token) {
+ case Xml::TagStart:
+ if (tag == "name")
+ device = xml.parse1();
+ else if (tag == "type")
+ type = xml.parseInt();
+ else if (tag == "record") { // old
+ bool f = xml.parseInt();
+ if (f)
+ openFlags |= 2;
+ }
+ else if (tag == "openFlags")
+ openFlags = xml.parseInt();
+ else if (tag == "midiSyncInfo")
+ tmpSi.read(xml);
+ else if (tag == "instrument") {
+ instrument = xml.parse1();
+ midiPorts[idx].setInstrument(
+ registerMidiInstrument(instrument)
+ );
+ }
+ else if (tag == "midithru")
+ thruFlag = xml.parseInt(); // obsolete
+ else if (tag == "channel") {
+ readPortChannel(xml, idx);
+ }
+ else
+ xml.unknown("MidiDevice");
+ break;
+ case Xml::Attribut:
+ if (tag == "idx") {
+ idx = xml.s2().toInt();
+ }
+ break;
+ case Xml::TagEnd:
+ if (tag == "midiport") {
+ //if (idx > MIDI_PORTS) {
+ if (idx < 0 || idx >= MIDI_PORTS) {
+ fprintf(stderr, "bad midi port %d (>%d)\n",
+ idx, MIDI_PORTS);
+ idx = 0;
+ }
+
+ MidiDevice* dev = midiDevices.find(device);
+
+ //if(debugMsg && !dev)
+ // fprintf(stderr, "readConfigMidiPort: device not found %s\n", device.latin1());
+
+ if(!dev && type == MidiDevice::JACK_MIDI)
+ {
+ if(debugMsg)
+ fprintf(stderr, "readConfigMidiPort: creating jack midi device %s\n", device.latin1());
+ dev = MidiJackDevice::createJackMidiDevice(device, openFlags);
+ }
+
+ if(debugMsg && !dev)
+ fprintf(stderr, "readConfigMidiPort: device not found %s\n", device.latin1());
+
+ MidiPort* mp = &midiPorts[idx];
+ mp->syncInfo().copyParams(tmpSi);
+ // p3.3.50 Indicate the port was found in the song file, even if no device is assigned to it.
+ mp->setFoundInSongFile(true);
+
+ if (dev) {
+ dev->setOpenFlags(openFlags);
+ midiSeq->msgSetMidiDevice(mp, dev);
+ }
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+/*
+//---------------------------------------------------------
+// readConfigMidiSyncInfo
+//---------------------------------------------------------
+
+static void readConfigMidiSyncInfo(Xml& xml)
+{
+ QString device;
+ int idOut = 127;
+ int idIn = 127;
+ bool sendMC = false;
+ bool sendMMC = false;
+ bool sendMTC = false;
+ bool recMC = false;
+ bool recMMC = false;
+ bool recMTC = false;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ QString tag = xml.s1();
+ switch (token) {
+ case Xml::TagStart:
+ if (tag == "device")
+ device = xml.parse1();
+ else if (tag == "idOut")
+ idOut = (xml.parseInt());
+ else if (tag == "idIn")
+ idIn = xml.parseInt();
+ else if (tag == "sendMC")
+ sendMC = xml.parseInt();
+ else if (tag == "sendMMC")
+ sendMMC = xml.parseInt();
+ else if (tag == "sendMTC")
+ sendMTC = xml.parseInt();
+ else if (tag == "recMC")
+ recMC = xml.parseInt();
+ else if (tag == "recMMC")
+ recMMC = xml.parseInt();
+ else if (tag == "recMTC")
+ recMTC = xml.parseInt();
+ else
+ xml.unknown("midiSyncInfo");
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if(tag == "midiSyncInfo")
+ {
+ MidiDevice* dev = midiDevices.find(device);
+ if(dev)
+ {
+ MidiSyncInfo& si = dev->syncInfo();
+ si.setIdIn(idIn);
+ si.setIdOut(idOut);
+
+ si.setMCIn(recMC);
+ si.setMMCIn(recMMC);
+ si.setMTCIn(recMTC);
+
+ si.setMCOut(sendMC);
+ si.setMMCOut(sendMMC);
+ si.setMTCOut(sendMTC);
+ }
+ else
+ fprintf(stderr, "Read configuration: Sync device: %s not found\n", device.latin1());
+
+ return;
+ }
+ default:
+ break;
+ }
+ }
+}
+*/
+
+//---------------------------------------------------------
+// loadConfigMetronom
+//---------------------------------------------------------
+
+static void loadConfigMetronom(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ QString tag = xml.s1();
+ switch (token) {
+ case Xml::TagStart:
+ if (tag == "premeasures")
+ preMeasures = xml.parseInt();
+ else if (tag == "measurepitch")
+ measureClickNote = xml.parseInt();
+ else if (tag == "measurevelo")
+ measureClickVelo = xml.parseInt();
+ else if (tag == "beatpitch")
+ beatClickNote = xml.parseInt();
+ else if (tag == "beatvelo")
+ beatClickVelo = xml.parseInt();
+ else if (tag == "channel")
+ clickChan = xml.parseInt();
+ else if (tag == "port")
+ clickPort = xml.parseInt();
+ else if (tag == "precountEnable")
+ precountEnableFlag = xml.parseInt();
+ else if (tag == "fromMastertrack")
+ precountFromMastertrackFlag = xml.parseInt();
+ else if (tag == "signatureZ")
+ precountSigZ = xml.parseInt();
+ else if (tag == "signatureN")
+ precountSigN = xml.parseInt();
+ else if (tag == "prerecord")
+ precountPrerecord = xml.parseInt();
+ else if (tag == "preroll")
+ precountPreroll = xml.parseInt();
+ else if (tag == "midiClickEnable")
+ midiClickFlag = xml.parseInt();
+ else if (tag == "audioClickEnable")
+ audioClickFlag = xml.parseInt();
+ else if (tag == "audioClickVolume")
+ audioClickVolume = xml.parseFloat();
+ else
+ xml.unknown("Metronome");
+ break;
+ case Xml::TagEnd:
+ if (tag == "metronom")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// readSeqConfiguration
+//---------------------------------------------------------
+
+static void readSeqConfiguration(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::TagStart:
+ if (tag == "metronom")
+ loadConfigMetronom(xml);
+ else if (tag == "midiport")
+ readConfigMidiPort(xml);
+ else if (tag == "rcStop")
+ rcStopNote = xml.parseInt();
+ else if (tag == "rcEnable")
+ rcEnable = xml.parseInt();
+ else if (tag == "rcRecord")
+ rcRecordNote = xml.parseInt();
+ else if (tag == "rcGotoLeft")
+ rcGotoLeftMarkNote = xml.parseInt();
+ else if (tag == "rcPlay")
+ rcPlayNote = xml.parseInt();
+ else
+ xml.unknown("Seq");
+ break;
+ case Xml::TagEnd:
+ if (tag == "sequencer") {
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// readConfiguration
+//---------------------------------------------------------
+
+void readConfiguration(Xml& xml, bool readOnlySequencer)
+ {
+ int mixers = 0;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ QString tag = xml.s1();
+ switch (token) {
+ case Xml::TagStart:
+ /* the reading of configuration is split in two; read
+ "sequencer" and read ALL. The reason is that it is
+ possible to load a song without configuration. In
+ this case the <configuration> chapter in the song
+ file should be skipped. However the sub part
+ <sequencer> contains elements that are necessary
+ to preserve composition consistency. Mainly
+ midiport configuration and VOLUME.
+ */
+ if (tag == "sequencer") {
+ readSeqConfiguration(xml);
+ break;
+ }
+ else if (readOnlySequencer) {
+ xml.skip(tag);
+ break;
+ }
+
+ if (tag == "theme")
+ config.style = xml.parse1();
+ else if (tag == "useOldStyleStopShortCut")
+ config.useOldStyleStopShortCut = xml.parseInt();
+ else if (tag == "moveArmedCheckBox")
+ config.moveArmedCheckBox = xml.parseInt();
+ else if (tag == "externalWavEditor")
+ config.externalWavEditor = xml.parse1();
+ else if (tag == "font0")
+ config.fonts[0].fromString(xml.parse1());
+ else if (tag == "font1")
+ config.fonts[1].fromString(xml.parse1());
+ else if (tag == "font2")
+ config.fonts[2].fromString(xml.parse1());
+ else if (tag == "font3")
+ config.fonts[3].fromString(xml.parse1());
+ else if (tag == "font4")
+ config.fonts[4].fromString(xml.parse1());
+ else if (tag == "font5")
+ config.fonts[5].fromString(xml.parse1());
+ else if (tag == "font6")
+ config.fonts[6].fromString(xml.parse1());
+ else if (tag == "palette0")
+ config.palette[0] = readColor(xml);
+ else if (tag == "palette1")
+ config.palette[1] = readColor(xml);
+ else if (tag == "palette2")
+ config.palette[2] = readColor(xml);
+ else if (tag == "palette3")
+ config.palette[3] = readColor(xml);
+ else if (tag == "palette4")
+ config.palette[4] = readColor(xml);
+ else if (tag == "palette5")
+ config.palette[5] = readColor(xml);
+ else if (tag == "palette6")
+ config.palette[6] = readColor(xml);
+ else if (tag == "palette7")
+ config.palette[7] = readColor(xml);
+ else if (tag == "palette8")
+ config.palette[8] = readColor(xml);
+ else if (tag == "palette9")
+ config.palette[9] = readColor(xml);
+ else if (tag == "palette10")
+ config.palette[10] = readColor(xml);
+ else if (tag == "palette11")
+ config.palette[11] = readColor(xml);
+ else if (tag == "palette12")
+ config.palette[12] = readColor(xml);
+ else if (tag == "palette13")
+ config.palette[13] = readColor(xml);
+ else if (tag == "palette14")
+ config.palette[14] = readColor(xml);
+ else if (tag == "palette15")
+ config.palette[15] = readColor(xml);
+ else if (tag == "palette16")
+ config.palette[16] = readColor(xml);
+ else if (tag == "trackBg")
+ config.trackBg = readColor(xml);
+ else if (tag == "selectTrackBg")
+ config.selectTrackBg = readColor(xml);
+ else if (tag == "selectTrackFg")
+ config.selectTrackFg = readColor(xml);
+ else if (tag == "midiTrackBg")
+ config.midiTrackBg = readColor(xml);
+ else if (tag == "ctrlGraphFg")
+ config.ctrlGraphFg = readColor(xml);
+ else if (tag == "drumTrackBg")
+ config.drumTrackBg = readColor(xml);
+ else if (tag == "waveTrackBg")
+ config.waveTrackBg = readColor(xml);
+ else if (tag == "outputTrackBg")
+ config.outputTrackBg = readColor(xml);
+ else if (tag == "inputTrackBg")
+ config.inputTrackBg = readColor(xml);
+ else if (tag == "groupTrackBg")
+ config.groupTrackBg = readColor(xml);
+ else if (tag == "auxTrackBg")
+ config.auxTrackBg = readColor(xml);
+ else if (tag == "synthTrackBg")
+ config.synthTrackBg = readColor(xml);
+ else if (tag == "extendedMidi")
+ config.extendedMidi = xml.parseInt();
+ else if (tag == "midiExportDivision")
+ config.midiDivision = xml.parseInt();
+ else if (tag == "copyright")
+ config.copyright = xml.parse1();
+ else if (tag == "smfFormat")
+ config.smfFormat = xml.parseInt();
+ else if (tag == "exp2ByteTimeSigs")
+ config.exp2ByteTimeSigs = xml.parseInt();
+ else if (tag == "expOptimNoteOffs")
+ config.expOptimNoteOffs = xml.parseInt();
+ else if (tag == "importMidiSplitParts")
+ config.importMidiSplitParts = xml.parseInt();
+ else if (tag == "midiInputDevice")
+ midiInputPorts = xml.parseInt();
+ else if (tag == "midiInputChannel")
+ midiInputChannel = xml.parseInt();
+ else if (tag == "midiRecordType")
+ midiRecordType = xml.parseInt();
+ else if (tag == "midiThruType")
+ midiThruType = xml.parseInt();
+ else if (tag == "midiFilterCtrl1")
+ midiFilterCtrl1 = xml.parseInt();
+ else if (tag == "midiFilterCtrl2")
+ midiFilterCtrl2 = xml.parseInt();
+ else if (tag == "midiFilterCtrl3")
+ midiFilterCtrl3 = xml.parseInt();
+ else if (tag == "midiFilterCtrl4")
+ midiFilterCtrl4 = xml.parseInt();
+ else if (tag == "bigtimeVisible")
+ config.bigTimeVisible = xml.parseInt();
+ else if (tag == "transportVisible")
+ config.transportVisible = xml.parseInt();
+ else if (tag == "markerVisible")
+ config.markerVisible = xml.parseInt();
+
+ else if (tag == "mixerVisible")
+ // config.mixerVisible = xml.parseInt(); // Obsolete
+ xml.skip(tag);
+ else if (tag == "mixer1Visible")
+ config.mixer1Visible = xml.parseInt();
+ else if (tag == "mixer2Visible")
+ config.mixer2Visible = xml.parseInt();
+
+ else if (tag == "showSplashScreen")
+ config.showSplashScreen = xml.parseInt();
+ else if (tag == "canvasShowPartType")
+ config.canvasShowPartType = xml.parseInt();
+ else if (tag == "canvasShowPartEvent")
+ config.canvasShowPartEvent = xml.parseInt();
+ else if (tag == "canvasShowGrid")
+ config.canvasShowGrid = xml.parseInt();
+ else if (tag == "canvasBgPixmap")
+ config.canvasBgPixmap = xml.parse1();
+ else if (tag == "geometryMain")
+ config.geometryMain = readGeometry(xml, tag);
+ else if (tag == "geometryTransport")
+ config.geometryTransport = readGeometry(xml, tag);
+ else if (tag == "geometryBigTime")
+ config.geometryBigTime = readGeometry(xml, tag);
+ else if (tag == "geometryPianoroll")
+ config.geometryPianoroll = readGeometry(xml, tag);
+ else if (tag == "geometryDrumedit")
+ config.geometryDrumedit = readGeometry(xml, tag);
+
+ else if (tag == "geometryMixer")
+ // config.geometryMixer = readGeometry(xml, tag); // Obsolete
+ xml.skip(tag);
+ //else if (tag == "mixer1")
+ // config.mixer1.read(xml);
+ //else if (tag == "mixer2")
+ // config.mixer2.read(xml);
+ else if (tag == "Mixer")
+ {
+ if(mixers == 0)
+ config.mixer1.read(xml);
+ else
+ config.mixer2.read(xml);
+ ++mixers;
+ }
+
+ else if (tag == "bigtimeForegroundcolor")
+ config.bigTimeForegroundColor = readColor(xml);
+ else if (tag == "bigtimeBackgroundcolor")
+ config.bigTimeBackgroundColor = readColor(xml);
+ else if (tag == "transportHandleColor")
+ config.transportHandleColor = readColor(xml);
+ else if (tag == "txDeviceId")
+ //txDeviceId = xml.parseInt();
+ xml.parseInt();
+ else if (tag == "rxDeviceId")
+ //rxDeviceId = xml.parseInt();
+ xml.parseInt();
+ else if (tag == "txSyncPort")
+ //txSyncPort= xml.parseInt();
+ xml.parseInt();
+ else if (tag == "rxSyncPort")
+ //rxSyncPort= xml.parseInt();
+ xml.parseInt();
+ else if (tag == "mtctype")
+ mtcType= xml.parseInt();
+ else if (tag == "sendClockDelay")
+ syncSendFirstClockDelay = xml.parseUInt();
+ else if (tag == "extSync")
+ extSyncFlag.setValue(xml.parseInt());
+ else if (tag == "useJackTransport")
+ {
+ useJackTransport.setValue(xml.parseInt());
+ }
+ else if (tag == "jackTransportMaster")
+ {
+ jackTransportMaster = xml.parseInt();
+ if(audioDevice)
+ audioDevice->setMaster(jackTransportMaster);
+ }
+ else if (tag == "syncgentype") {
+ // for compatibility
+ //int syncGenType= xml.parseInt();
+ //genMTCSync = syncGenType == 1;
+ //genMCSync = syncGenType == 2;
+ xml.parseInt();
+ }
+ else if (tag == "genMTCSync")
+ //genMTCSync = xml.parseInt();
+ xml.parseInt();
+ else if (tag == "genMCSync")
+ //genMCSync = xml.parseInt();
+ xml.parseInt();
+ else if (tag == "genMMC")
+ //genMMC = xml.parseInt();
+ xml.parseInt();
+ else if (tag == "acceptMTC")
+ //acceptMTC = xml.parseInt();
+ xml.parseInt();
+ else if (tag == "acceptMMC")
+ //acceptMMC = xml.parseInt();
+ xml.parseInt();
+ else if (tag == "acceptMC")
+ //acceptMC = xml.parseInt();
+ xml.parseInt();
+ else if (tag == "mtcoffset") {
+ QString qs(xml.parse1());
+ const char* str = qs.latin1();
+ int h, m, s, f, sf;
+ sscanf(str, "%d:%d:%d:%d:%d", &h, &m, &s, &f, &sf);
+ mtcOffset = MTC(h, m, s, f, sf);
+ }
+ //else if (tag == "midiSyncInfo")
+ // readConfigMidiSyncInfo(xml);
+ else if (tag == "arranger") {
+ if (muse && muse->arranger)
+ muse->arranger->readStatus(xml);
+ else
+ xml.skip(tag);
+ }
+ else if (tag == "drumedit")
+ DrumEdit::readConfiguration(xml);
+ else if (tag == "pianoroll")
+ PianoRoll::readConfiguration(xml);
+ else if (tag == "masteredit")
+ MasterEdit::readConfiguration(xml);
+ else if (tag == "waveedit")
+ WaveEdit::readConfiguration(xml);
+ else if (tag == "shortcuts")
+ readShortCuts(xml);
+ else if (tag == "division")
+ config.division = xml.parseInt();
+ else if (tag == "guiDivision")
+ config.guiDivision = xml.parseInt();
+ else if (tag == "samplerate")
+ xml.parseInt();
+ else if (tag == "segmentsize")
+ xml.parseInt();
+ else if (tag == "segmentcount")
+ xml.parseInt();
+ else if (tag == "rtcTicks")
+ config.rtcTicks = xml.parseInt();
+ else if (tag == "minMeter")
+ config.minMeter = xml.parseInt();
+ else if (tag == "minSlider")
+ config.minSlider = xml.parseDouble();
+ else if (tag == "freewheelMode")
+ config.freewheelMode = xml.parseInt();
+ else if (tag == "denormalProtection")
+ config.useDenormalBias = xml.parseInt();
+ else if (tag == "didYouKnow")
+ config.showDidYouKnow = xml.parseInt();
+ else if (tag == "outputLimiter")
+ config.useOutputLimiter = xml.parseInt();
+ else if (tag == "vstInPlace")
+ config.vstInPlace = xml.parseInt();
+ else if (tag == "dummyAudioSampleRate")
+ config.dummyAudioSampleRate = xml.parseInt();
+ else if (tag == "dummyAudioBufSize")
+ config.dummyAudioBufSize = xml.parseInt();
+ else if (tag == "guiRefresh")
+ config.guiRefresh = xml.parseInt();
+ else if (tag == "helpBrowser")
+ {
+ QString tmp = xml.parse1();
+ if (tmp.isNull()) {tmp = "";}
+ config.helpBrowser = tmp;
+ }
+ else if (tag == "midiTransform")
+ readMidiTransform(xml);
+ else if (tag == "midiInputTransform")
+ readMidiInputTransform(xml);
+ else if (tag == "startMode")
+ config.startMode = xml.parseInt();
+ else if (tag == "startSong")
+ config.startSong = xml.parse1();
+ else
+ xml.unknown("configuration");
+ break;
+ case Xml::Text:
+ printf("text <%s>\n", xml.s1().latin1());
+ break;
+ case Xml::Attribut:
+ if (readOnlySequencer)
+ break;
+ if (tag == "version") {
+ int major = xml.s2().section('.', 0, 0).toInt();
+ int minor = xml.s2().section('.', 1, 1).toInt();
+ xml.setVersion(major, minor);
+ }
+ break;
+ case Xml::TagEnd:
+ if (tag == "configuration") {
+ return;
+ }
+ break;
+ case Xml::Proc:
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// probeMachineSpecificConfiguration
+//---------------------------------------------------------
+
+static void probeMachineSpecificConfiguration()
+ {
+ // set a default help browser (crude way to find out)
+ if (!system("which konqueror > /dev/null"))
+ {
+ config.helpBrowser = QString("konqueror");
+ }
+ else if (!system("which opera > /dev/null"))
+ {
+ config.helpBrowser = QString("opera");
+ }
+ else if (!system("which mozilla-firefox > /dev/null"))
+ {
+ config.helpBrowser = QString("mozilla-firefox");
+ }
+ else if (!system("which firefox > /dev/null"))
+ {
+ config.helpBrowser = QString("firefox");
+ }
+ else if (!system("which mozilla > /dev/null"))
+ {
+ config.helpBrowser = QString("mozilla");
+ }
+ else
+ {
+ config.helpBrowser = QString("");
+ // was not able to find a browser
+ }
+ // More preconfiguration
+ }
+
+//---------------------------------------------------------
+// readConfiguration
+//---------------------------------------------------------
+
+bool readConfiguration()
+ {
+ FILE* f = fopen(configName.latin1(), "r");
+ if (f == 0) {
+ if (debugMsg || debugMode)
+ fprintf(stderr, "NO Config File <%s> found\n", configName.latin1());
+
+ // if the config file does not exist launch probeMachineSpecificConfiguration
+ probeMachineSpecificConfiguration();
+ return true;
+ }
+ Xml xml(f);
+ bool skipmode = true;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ fclose(f);
+ return true;
+ case Xml::TagStart:
+ if (skipmode && tag == "muse")
+ skipmode = false;
+ else if (skipmode)
+ break;
+ else if (tag == "configuration")
+ readConfiguration(xml,false);
+ else
+ xml.unknown("muse config");
+ break;
+ case Xml::Attribut:
+ if (tag == "version") {
+ int major = xml.s2().section('.', 0, 0).toInt();
+ int minor = xml.s2().section('.', 1, 1).toInt();
+ xml.setVersion(major, minor);
+ }
+ break;
+ case Xml::TagEnd:
+ if (!skipmode && tag == "muse") {
+ fclose(f);
+ return false;
+ }
+ default:
+ break;
+ }
+ }
+ fclose(f);
+ return true;
+ }
+
+//---------------------------------------------------------
+// writeSeqConfiguration
+//---------------------------------------------------------
+
+static void writeSeqConfiguration(int level, Xml& xml, bool writePortInfo)
+ {
+ xml.tag(level++, "sequencer");
+
+ xml.tag(level++, "metronom");
+ xml.intTag(level, "premeasures", preMeasures);
+ xml.intTag(level, "measurepitch", measureClickNote);
+ xml.intTag(level, "measurevelo", measureClickVelo);
+ xml.intTag(level, "beatpitch", beatClickNote);
+ xml.intTag(level, "beatvelo", beatClickVelo);
+ xml.intTag(level, "channel", clickChan);
+ xml.intTag(level, "port", clickPort);
+
+ xml.intTag(level, "precountEnable", precountEnableFlag);
+ xml.intTag(level, "fromMastertrack", precountFromMastertrackFlag);
+ xml.intTag(level, "signatureZ", precountSigZ);
+ xml.intTag(level, "signatureN", precountSigN);
+ xml.intTag(level, "prerecord", precountPrerecord);
+ xml.intTag(level, "preroll", precountPreroll);
+ xml.intTag(level, "midiClickEnable", midiClickFlag);
+ xml.intTag(level, "audioClickEnable", audioClickFlag);
+ xml.floatTag(level, "audioClickVolume", audioClickVolume);
+ xml.tag(level--, "/metronom");
+
+ xml.intTag(level, "rcEnable", rcEnable);
+ xml.intTag(level, "rcStop", rcStopNote);
+ xml.intTag(level, "rcRecord", rcRecordNote);
+ xml.intTag(level, "rcGotoLeft", rcGotoLeftMarkNote);
+ xml.intTag(level, "rcPlay", rcPlayNote);
+
+ if (writePortInfo) {
+ //
+ // write information about all midi ports, their assigned
+ // instruments and all managed midi controllers
+ //
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ bool used = false;
+ MidiTrackList* tl = song->midis();
+ for (iMidiTrack it = tl->begin(); it != tl->end(); ++it) {
+ MidiTrack* t = *it;
+ if (t->outPort() == i) {
+ used = true;
+ break;
+ }
+ }
+ MidiPort* mport = &midiPorts[i];
+ MidiDevice* dev = mport->device();
+ if (!used && !dev)
+ continue;
+ xml.tag(level++, "midiport idx=\"%d\"", i);
+ xml.strTag(level, "instrument", mport->instrument()->iname());
+ if (dev) {
+ xml.strTag(level, "name", dev->name());
+
+ // p3.3.38
+ //if(dynamic_cast<MidiJackDevice*>(dev))
+ if(dev->deviceType() != MidiDevice::ALSA_MIDI)
+ //xml.intTag(level, "type", MidiDevice::JACK_MIDI);
+ xml.intTag(level, "type", dev->deviceType());
+
+ // Changed by T356. "record" is old and by mistake written as rwFlags here.
+ // openFlags was read before, but never written here.
+ //xml.intTag(level, "record", dev->rwFlags() & 0x2 ? 1 : 0);
+ xml.intTag(level, "openFlags", dev->openFlags());
+ }
+ mport->syncInfo().write(level, xml);
+ // write out registered controller for all channels
+ MidiCtrlValListList* vll = mport->controller();
+ for (int k = 0; k < MIDI_CHANNELS; ++k) {
+ int min = k << 24;
+ int max = min + 0x100000;
+ xml.tag(level++, "channel idx=\"%d\"", k);
+ iMidiCtrlValList s = vll->lower_bound(min);
+ iMidiCtrlValList e = vll->lower_bound(max);
+ if (s != e) {
+ for (iMidiCtrlValList i = s; i != e; ++i) {
+ xml.tag(level++, "controller id=\"%d\"", i->second->num());
+ if (i->second->hwVal() != CTRL_VAL_UNKNOWN)
+ xml.intTag(level, "val", i->second->hwVal());
+ xml.etag(level--, "controller");
+ }
+ }
+ xml.etag(level--, "channel");
+ }
+ xml.etag(level--, "midiport");
+ }
+ }
+ xml.tag(level, "/sequencer");
+ }
+
+//---------------------------------------------------------
+// writeGlobalConfiguration
+//---------------------------------------------------------
+
+void MusE::writeGlobalConfiguration() const
+ {
+ FILE* f = fopen(configName.latin1(), "w");
+ if (f == 0) {
+ printf("save configuration to <%s> failed: %s\n",
+ configName.latin1(), strerror(errno));
+ return;
+ }
+ Xml xml(f);
+ xml.header();
+ xml.tag(0, "muse version=\"2.0\"");
+ writeGlobalConfiguration(1, xml);
+ xml.tag(1, "/muse");
+ fclose(f);
+ }
+
+void MusE::writeGlobalConfiguration(int level, Xml& xml) const
+ {
+ xml.tag(level++, "configuration");
+
+ xml.intTag(level, "division", config.division);
+ xml.intTag(level, "rtcTicks", config.rtcTicks);
+ xml.intTag(level, "minMeter", config.minMeter);
+ xml.doubleTag(level, "minSlider", config.minSlider);
+ xml.intTag(level, "freewheelMode", config.freewheelMode);
+ xml.intTag(level, "denormalProtection", config.useDenormalBias);
+ xml.intTag(level, "didYouKnow", config.showDidYouKnow);
+ xml.intTag(level, "outputLimiter", config.useOutputLimiter);
+ xml.intTag(level, "vstInPlace", config.vstInPlace);
+ xml.intTag(level, "dummyAudioBufSize", config.dummyAudioBufSize);
+ xml.intTag(level, "dummyAudioSampleRate", config.dummyAudioSampleRate);
+
+ xml.intTag(level, "guiRefresh", config.guiRefresh);
+ xml.strTag(level, "helpBrowser", config.helpBrowser);
+ xml.intTag(level, "extendedMidi", config.extendedMidi);
+ xml.intTag(level, "midiExportDivision", config.midiDivision);
+ xml.intTag(level, "guiDivision", config.guiDivision);
+ xml.strTag(level, "copyright", config.copyright);
+ xml.intTag(level, "smfFormat", config.smfFormat);
+ xml.intTag(level, "exp2ByteTimeSigs", config.exp2ByteTimeSigs);
+ xml.intTag(level, "expOptimNoteOffs", config.expOptimNoteOffs);
+ xml.intTag(level, "importMidiSplitParts", config.importMidiSplitParts);
+ xml.intTag(level, "startMode", config.startMode);
+ xml.strTag(level, "startSong", config.startSong);
+
+ xml.intTag(level, "midiInputDevice", midiInputPorts);
+ xml.intTag(level, "midiInputChannel", midiInputChannel);
+ xml.intTag(level, "midiRecordType", midiRecordType);
+ xml.intTag(level, "midiThruType", midiThruType);
+ xml.intTag(level, "midiFilterCtrl1", midiFilterCtrl1);
+ xml.intTag(level, "midiFilterCtrl2", midiFilterCtrl2);
+ xml.intTag(level, "midiFilterCtrl3", midiFilterCtrl3);
+ xml.intTag(level, "midiFilterCtrl4", midiFilterCtrl4);
+ // Removed by Tim. p3.3.6
+
+ //xml.intTag(level, "txDeviceId", txDeviceId);
+ //xml.intTag(level, "rxDeviceId", rxDeviceId);
+ xml.strTag(level, "theme", config.style);
+ xml.strTag(level, "externalWavEditor", config.externalWavEditor);
+ xml.intTag(level, "useOldStyleStopShortCut", config.useOldStyleStopShortCut);
+ xml.intTag(level, "moveArmedCheckBox", config.moveArmedCheckBox);
+
+ //for (int i = 0; i < 6; ++i) {
+ for (int i = 0; i < NUM_FONTS; ++i) {
+ char buffer[32];
+ sprintf(buffer, "font%d", i);
+ xml.strTag(level, buffer, config.fonts[i].toString());
+ }
+ for (int i = 0; i < 16; ++i) {
+ char buffer[32];
+ sprintf(buffer, "palette%d", i);
+ xml.colorTag(level, buffer, config.palette[i]);
+ }
+
+ xml.colorTag(level, "trackBg", config.trackBg);
+ xml.colorTag(level, "selectTrackBg", config.selectTrackBg);
+ xml.colorTag(level, "selectTrackFg", config.selectTrackFg);
+ xml.colorTag(level, "midiTrackBg", config.midiTrackBg);
+ xml.colorTag(level, "ctrlGraphFg", config.ctrlGraphFg);
+ xml.colorTag(level, "drumTrackBg", config.drumTrackBg);
+ xml.colorTag(level, "waveTrackBg", config.waveTrackBg);
+ xml.colorTag(level, "outputTrackBg", config.outputTrackBg);
+ xml.colorTag(level, "inputTrackBg", config.inputTrackBg);
+ xml.colorTag(level, "groupTrackBg", config.groupTrackBg);
+ xml.colorTag(level, "auxTrackBg", config.auxTrackBg);
+ xml.colorTag(level, "synthTrackBg", config.synthTrackBg);
+
+ // Changed by Tim. p3.3.6
+
+ //xml.intTag(level, "txSyncPort", txSyncPort);
+ /*
+ // To keep old muse versions happy...
+ bool mcsync = mmc = mtc = false;
+ for(int sp = 0; sp < MIDI_PORTS; ++sp)
+ {
+ MidiSyncTxPort* txPort = &midiSyncTxPorts[sp];
+ if(txPort->doMCSync() || txPort->doMMC() || txPort->doMTC())
+ {
+ if(txPort->doMCSync())
+ mcsync = true;
+ if(txPort->doMMC())
+ mmc = true;
+ if(txPort->doMTC())
+ mtc = true;
+ xml.intTag(level, "txSyncPort", sp);
+ break;
+ }
+ }
+ */
+
+ // Added by Tim. p3.3.6
+
+ //xml.tag(level++, "midiSyncInfo");
+ //for(iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id)
+ //{
+ // MidiDevice* md = *id;
+ // (*id)->syncInfo().write(level, xml, md);
+ //}
+ //xml.etag(level, "midiSyncInfo");
+
+ //xml.intTag(level, "rxSyncPort", rxSyncPort);
+ xml.intTag(level, "mtctype", mtcType);
+ xml.nput(level, "<mtcoffset>%02d:%02d:%02d:%02d:%02d</mtcoffset>\n",
+ mtcOffset.h(), mtcOffset.m(), mtcOffset.s(),
+ mtcOffset.f(), mtcOffset.sf());
+ //xml.uintTag(level, "sendClockDelay", syncSendFirstClockDelay);
+ //xml.intTag(level, "useJackTransport", useJackTransport);
+ //xml.intTag(level, "jackTransportMaster", jackTransportMaster);
+ extSyncFlag.save(level, xml);
+
+// xml.intTag(level, "genMTCSync", genMTCSync);
+// xml.intTag(level, "genMCSync", genMCSync);
+// xml.intTag(level, "genMMC", genMMC);
+// xml.intTag(level, "acceptMTC", acceptMTC);
+// xml.intTag(level, "acceptMMC", acceptMMC);
+// xml.intTag(level, "acceptMC", acceptMC);
+
+ xml.qrectTag(level, "geometryMain", config.geometryMain);
+ xml.qrectTag(level, "geometryTransport", config.geometryTransport);
+ xml.qrectTag(level, "geometryBigTime", config.geometryBigTime);
+ xml.qrectTag(level, "geometryPianoroll", config.geometryPianoroll);
+ xml.qrectTag(level, "geometryDrumedit", config.geometryDrumedit);
+ //xml.qrectTag(level, "geometryMixer", config.geometryMixer); // Obsolete
+
+ xml.intTag(level, "bigtimeVisible", config.bigTimeVisible);
+ xml.intTag(level, "transportVisible", config.transportVisible);
+
+ //xml.intTag(level, "mixerVisible", config.mixerVisible); // Obsolete
+ xml.intTag(level, "mixer1Visible", config.mixer1Visible);
+ xml.intTag(level, "mixer2Visible", config.mixer2Visible);
+ //config.mixer1.write(level, xml, "mixer1");
+ //config.mixer2.write(level, xml, "mixer2");
+ config.mixer1.write(level, xml);
+ config.mixer2.write(level, xml);
+
+ xml.intTag(level, "showSplashScreen", config.showSplashScreen);
+ xml.intTag(level, "canvasShowPartType", config.canvasShowPartType);
+ xml.intTag(level, "canvasShowPartEvent", config.canvasShowPartEvent);
+ xml.intTag(level, "canvasShowGrid", config.canvasShowGrid);
+ xml.strTag(level, "canvasBgPixmap", config.canvasBgPixmap);
+
+ xml.colorTag(level, "transportHandleColor", config.transportHandleColor);
+ xml.colorTag(level, "bigtimeForegroundcolor", config.bigTimeForegroundColor);
+ xml.colorTag(level, "bigtimeBackgroundcolor", config.bigTimeBackgroundColor);
+
+ writeSeqConfiguration(level, xml, false);
+
+ DrumEdit::writeConfiguration(level, xml);
+ PianoRoll::writeConfiguration(level, xml);
+ MasterEdit::writeConfiguration(level, xml);
+ WaveEdit::writeConfiguration(level, xml);
+
+ writeShortCuts(level, xml);
+ xml.etag(level, "configuration");
+ }
+
+//---------------------------------------------------------
+// writeConfiguration
+// write song specific configuration
+//---------------------------------------------------------
+
+void MusE::writeConfiguration(int level, Xml& xml) const
+ {
+ xml.tag(level++, "configuration");
+
+ xml.intTag(level, "midiInputDevice", midiInputPorts);
+ xml.intTag(level, "midiInputChannel", midiInputChannel);
+ xml.intTag(level, "midiRecordType", midiRecordType);
+ xml.intTag(level, "midiThruType", midiThruType);
+ xml.intTag(level, "midiFilterCtrl1", midiFilterCtrl1);
+ xml.intTag(level, "midiFilterCtrl2", midiFilterCtrl2);
+ xml.intTag(level, "midiFilterCtrl3", midiFilterCtrl3);
+ xml.intTag(level, "midiFilterCtrl4", midiFilterCtrl4);
+ // Removed by Tim. p3.3.6
+
+ //xml.intTag(level, "txDeviceId", txDeviceId);
+ //xml.intTag(level, "rxDeviceId", rxDeviceId);
+
+ // Changed by Tim. p3.3.6
+
+ //xml.intTag(level, "txSyncPort", txSyncPort);
+ /*
+ // To keep old muse versions happy...
+ bool mcsync = mmc = mtc = false;
+ for(int sp = 0; sp < MIDI_PORTS; ++sp)
+ {
+ MidiSyncTxPort* txPort = &midiSyncTxPorts[sp];
+ if(txPort->doMCSync() || txPort->doMMC() || txPort->doMTC())
+ {
+ if(txPort->doMCSync())
+ mcsync = true;
+ if(txPort->doMMC())
+ mmc = true;
+ if(txPort->doMTC())
+ mtc = true;
+ xml.intTag(level, "txSyncPort", sp);
+ break;
+ }
+ }
+ */
+
+ // Added by Tim. p3.3.6
+
+ //xml.tag(level++, "midiSyncInfo");
+ //for(iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id)
+ //{
+ // MidiDevice* md = *id;
+ // md->syncInfo().write(level, xml, md);
+ //}
+ //xml.etag(level, "midiSyncInfo");
+
+ //xml.intTag(level, "rxSyncPort", rxSyncPort);
+ xml.intTag(level, "mtctype", mtcType);
+ xml.nput(level, "<mtcoffset>%02d:%02d:%02d:%02d:%02d</mtcoffset>\n",
+ mtcOffset.h(), mtcOffset.m(), mtcOffset.s(),
+ mtcOffset.f(), mtcOffset.sf());
+ xml.uintTag(level, "sendClockDelay", syncSendFirstClockDelay);
+ xml.intTag(level, "useJackTransport", useJackTransport.value());
+ xml.intTag(level, "jackTransportMaster", jackTransportMaster);
+ extSyncFlag.save(level, xml);
+
+// xml.intTag(level, "genMTCSync", genMTCSync);
+// xml.intTag(level, "genMCSync", genMCSync);
+// xml.intTag(level, "genMMC", genMMC);
+// xml.intTag(level, "acceptMTC", acceptMTC);
+// xml.intTag(level, "acceptMMC", acceptMMC);
+// xml.intTag(level, "acceptMC", acceptMC);
+
+ xml.intTag(level, "bigtimeVisible", menuView->isItemChecked(bt_id));
+ xml.intTag(level, "transportVisible", menuView->isItemChecked(tr_id));
+ xml.intTag(level, "markerVisible", menuView->isItemChecked(mr_id));
+ //xml.intTag(level, "mixerVisible", menuView->isItemChecked(aid1)); // Obsolete
+
+ xml.geometryTag(level, "geometryMain", this);
+ if (transport)
+ xml.geometryTag(level, "geometryTransport", transport);
+ if (bigtime)
+ xml.geometryTag(level, "geometryBigTime", bigtime);
+
+ //if (audioMixer)
+ // xml.geometryTag(level, "geometryMixer", audioMixer); // Obsolete
+ xml.intTag(level, "mixer1Visible", menuView->isItemChecked(aid1a));
+ xml.intTag(level, "mixer2Visible", menuView->isItemChecked(aid1b));
+ if (mixer1)
+ //mixer1->write(level, xml, "mixer1");
+ mixer1->write(level, xml);
+ if (mixer2)
+ //mixer2->write(level, xml, "mixer2");
+ mixer2->write(level, xml);
+
+ arranger->writeStatus(level, xml);
+ writeSeqConfiguration(level, xml, true);
+
+ DrumEdit::writeConfiguration(level, xml);
+ PianoRoll::writeConfiguration(level, xml);
+ MasterEdit::writeConfiguration(level, xml);
+ WaveEdit::writeConfiguration(level, xml);
+
+ writeMidiTransforms(level, xml);
+ writeMidiInputTransforms(level, xml);
+ xml.etag(level, "configuration");
+ }
+
+//---------------------------------------------------------
+// configMidiSync
+//---------------------------------------------------------
+
+void MusE::configMidiSync()
+ {
+ if (!midiSyncConfig)
+ //midiSyncConfig = new MidiSyncConfig(this);
+ midiSyncConfig = new MidiSyncConfig(0, (char*) "midiSyncConfig");
+
+ if (midiSyncConfig->isVisible()) {
+ midiSyncConfig->raise();
+ midiSyncConfig->setActiveWindow();
+ }
+ else
+ midiSyncConfig->show();
+ }
+
+//---------------------------------------------------------
+// configMidiFile
+//---------------------------------------------------------
+
+void MusE::configMidiFile()
+ {
+ if (!midiFileConfig)
+ midiFileConfig = new MidiFileConfig();
+ midiFileConfig->updateValues();
+
+ if (midiFileConfig->isVisible()) {
+ midiFileConfig->raise();
+ midiFileConfig->setActiveWindow();
+ }
+ else
+ midiFileConfig->show();
+ }
+
+//---------------------------------------------------------
+// MidiFileConfig
+// config properties of exported midi files
+//---------------------------------------------------------
+
+MidiFileConfig::MidiFileConfig()
+ : ConfigMidiFileBase()
+ {
+ connect(buttonOk, SIGNAL(clicked()), SLOT(okClicked()));
+ connect(buttonCancel, SIGNAL(clicked()), SLOT(cancelClicked()));
+ }
+
+//---------------------------------------------------------
+// updateValues
+//---------------------------------------------------------
+
+void MidiFileConfig::updateValues()
+ {
+ int divisionIdx = 2;
+ switch(config.midiDivision) {
+ case 96: divisionIdx = 0; break;
+ case 192: divisionIdx = 1; break;
+ case 384: divisionIdx = 2; break;
+ }
+ divisionCombo->setCurrentItem(divisionIdx);
+ formatCombo->setCurrentItem(config.smfFormat);
+ extendedFormat->setChecked(config.extendedMidi);
+ copyrightEdit->setText(config.copyright);
+ optNoteOffs->setChecked(config.expOptimNoteOffs);
+ twoByteTimeSigs->setChecked(config.exp2ByteTimeSigs);
+ splitPartsCheckBox->setChecked(config.importMidiSplitParts);
+ }
+
+//---------------------------------------------------------
+// okClicked
+//---------------------------------------------------------
+
+void MidiFileConfig::okClicked()
+ {
+ int divisionIdx = divisionCombo->currentItem();
+
+ int divisions[3] = { 96, 192, 384 };
+ if (divisionIdx >= 0 && divisionIdx < 3)
+ config.midiDivision = divisions[divisionIdx];
+ config.extendedMidi = extendedFormat->isChecked();
+ config.smfFormat = formatCombo->currentItem();
+ config.copyright = copyrightEdit->text();
+ config.expOptimNoteOffs = optNoteOffs->isChecked();
+ config.exp2ByteTimeSigs = twoByteTimeSigs->isChecked();
+ config.importMidiSplitParts = splitPartsCheckBox->isChecked();
+
+ muse->changeConfig(true); // write config file
+ close();
+ }
+
+//---------------------------------------------------------
+// cancelClicked
+//---------------------------------------------------------
+
+void MidiFileConfig::cancelClicked()
+ {
+ close();
+ }
+
+//---------------------------------------------------------
+// configGlobalSettings
+//---------------------------------------------------------
+
+void MusE::configGlobalSettings()
+ {
+ if (!globalSettingsConfig)
+ globalSettingsConfig = new GlobalSettingsConfig();
+
+ if (globalSettingsConfig->isVisible()) {
+ globalSettingsConfig->raise();
+ globalSettingsConfig->setActiveWindow();
+ }
+ else
+ globalSettingsConfig->show();
+ }
+
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+//void MixerConfig::write(Xml& xml, const char* name)
+void MixerConfig::write(int level, Xml& xml)
+//void MixerConfig::write(int level, Xml& xml, const char* name)
+ {
+ //xml.stag(QString(name));
+ //xml.tag(level++, name.latin1());
+ xml.tag(level++, "Mixer");
+ //xml.tag(level++, name);
+
+ xml.strTag(level, "name", name);
+
+ //xml.tag("geometry", geometry);
+ xml.qrectTag(level, "geometry", geometry);
+
+ xml.intTag(level, "showMidiTracks", showMidiTracks);
+ xml.intTag(level, "showDrumTracks", showDrumTracks);
+ xml.intTag(level, "showInputTracks", showInputTracks);
+ xml.intTag(level, "showOutputTracks", showOutputTracks);
+ xml.intTag(level, "showWaveTracks", showWaveTracks);
+ xml.intTag(level, "showGroupTracks", showGroupTracks);
+ xml.intTag(level, "showAuxTracks", showAuxTracks);
+ xml.intTag(level, "showSyntiTracks", showSyntiTracks);
+
+ //xml.etag(name);
+ //xml.etag(level, name.latin1());
+ xml.etag(level, "Mixer");
+ //xml.etag(level, name);
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+//void MixerConfig::read(QDomNode node)
+void MixerConfig::read(Xml& xml)
+//void MixerConfig::read(Xml& xml, const QString& name)
+ {
+ for (;;) {
+ Xml::Token token(xml.parse());
+ const QString& tag(xml.s1());
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "name")
+ name = xml.parse1();
+ else if (tag == "geometry")
+ geometry = readGeometry(xml, tag);
+ else if (tag == "showMidiTracks")
+ showMidiTracks = xml.parseInt();
+ else if (tag == "showDrumTracks")
+ showDrumTracks = xml.parseInt();
+ else if (tag == "showInputTracks")
+ showInputTracks = xml.parseInt();
+ else if (tag == "showOutputTracks")
+ showOutputTracks = xml.parseInt();
+ else if (tag == "showWaveTracks")
+ showWaveTracks = xml.parseInt();
+ else if (tag == "showGroupTracks")
+ showGroupTracks = xml.parseInt();
+ else if (tag == "showAuxTracks")
+ showAuxTracks = xml.parseInt();
+ else if (tag == "showSyntiTracks")
+ showSyntiTracks = xml.parseInt();
+ else
+ //xml.unknown(name.latin1());
+ xml.unknown("Mixer");
+ break;
+ case Xml::TagEnd:
+ //if (tag == name)
+ if (tag == "Mixer")
+ return;
+ default:
+ break;
+ }
+ }
+
+ }
+
diff --git a/muse2/muse/conf.h b/muse2/muse/conf.h
new file mode 100644
index 00000000..285f5e98
--- /dev/null
+++ b/muse2/muse/conf.h
@@ -0,0 +1,38 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: conf.h,v 1.4.2.1 2006/09/28 19:22:25 spamatica Exp $
+//
+// (C) Copyright 1999-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __CONF_H__
+#define __CONF_H__
+
+#include <q3groupbox.h>
+#include "configmidifilebase.h"
+
+class QLineEdit;
+
+//---------------------------------------------------------
+// MidiFileConfig
+// config properties of exported midi files
+//---------------------------------------------------------
+
+class MidiFileConfig : public ConfigMidiFileBase {
+ Q_OBJECT
+
+ private slots:
+ void okClicked();
+ void cancelClicked();
+
+ public:
+ MidiFileConfig();
+ void updateValues();
+ };
+
+class Xml;
+extern bool readConfiguration();
+extern void readConfiguration(Xml&, bool readOnlySequencer);
+#endif
+
diff --git a/muse2/muse/confmport.cpp b/muse2/muse/confmport.cpp
new file mode 100644
index 00000000..bea2e714
--- /dev/null
+++ b/muse2/muse/confmport.cpp
@@ -0,0 +1,897 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: confmport.cpp,v 1.9.2.10 2009/12/15 03:39:58 terminator356 Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <list>
+#include <termios.h>
+#include <iostream>
+
+#include <q3listview.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qlineedit.h>
+#include <qcombobox.h>
+#include <qlabel.h>
+#include <q3buttongroup.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <stdio.h>
+#include <q3popupmenu.h>
+#include <q3groupbox.h>
+#include <qradiobutton.h>
+#include <qspinbox.h>
+#include <qcheckbox.h>
+#include <qsignalmapper.h>
+#include <qtooltip.h>
+#include <q3filedialog.h>
+#include <qtoolbutton.h>
+#include <qmessagebox.h>
+#include <qpoint.h>
+
+#include "confmport.h"
+#include "app.h"
+#include "icons.h"
+#include "globals.h"
+#include "transport.h"
+#include "arranger.h"
+#include "midiport.h"
+#include "mididev.h"
+#include "xml.h"
+#include "midisyncimpl.h"
+#include "midifilterimpl.h"
+#include "ctrlcombo.h"
+#include "minstrument.h"
+#include "synth.h"
+#include "audio.h"
+#include "midiseq.h"
+#include "driver/alsamidi.h"
+#include "driver/jackmidi.h"
+#include "audiodev.h"
+#include "menutitleitem.h"
+
+extern std::vector<Synth*> synthis;
+
+enum { DEVCOL_NO = 0, DEVCOL_GUI, DEVCOL_REC, DEVCOL_PLAY, DEVCOL_INSTR, DEVCOL_NAME,
+ //DEVCOL_STATE };
+ DEVCOL_ROUTES, DEVCOL_STATE };
+
+//---------------------------------------------------------
+// mdevViewItemRenamed
+//---------------------------------------------------------
+
+void MPConfig::mdevViewItemRenamed(Q3ListViewItem* item, int col, const QString& s)
+{
+ //printf("MPConfig::mdevViewItemRenamed col:%d txt:%s\n", col, s.latin1());
+ if(item == 0)
+ return;
+ switch(col)
+ {
+ case DEVCOL_NAME:
+ {
+ QString id = item->text(DEVCOL_NO);
+ int no = atoi(id.latin1()) - 1;
+ if(no < 0 || no >= MIDI_PORTS)
+ return;
+
+ MidiPort* port = &midiPorts[no];
+ MidiDevice* dev = port->device();
+ // Only Jack midi devices.
+ if(!dev || dev->deviceType() != MidiDevice::JACK_MIDI)
+ return;
+ if(dev->name() == s)
+ return;
+
+ if(midiDevices.find(s))
+ {
+ QMessageBox::critical(this,
+ tr("MusE: bad device name"),
+ tr("please choose a unique device name"),
+ QMessageBox::Ok,
+ Qt::NoButton,
+ Qt::NoButton);
+ songChanged(-1);
+ return;
+ }
+ dev->setName(s);
+ song->update();
+ }
+ break;
+ default:
+ printf("MPConfig::mdevViewItemRenamed unknown column clicked col:%d txt:%s\n", col, s.latin1());
+ break;
+ }
+}
+
+//---------------------------------------------------------
+// rbClicked
+//---------------------------------------------------------
+
+void MPConfig::rbClicked(Q3ListViewItem* item, const QPoint& cpt, int col)
+ {
+ if (item == 0)
+ return;
+ QString id = item->text(DEVCOL_NO);
+ int no = atoi(id.latin1()) - 1;
+ if (no < 0 || no >= MIDI_PORTS)
+ return;
+
+ int n;
+ MidiPort* port = &midiPorts[no];
+ MidiDevice* dev = port->device();
+ int rwFlags = dev ? dev->rwFlags() : 0;
+ int openFlags = dev ? dev->openFlags() : 0;
+ Q3ListView* listView = item->listView();
+ //printf("MPConfig::rbClicked cpt x:%d y:%d\n", cpt.x(), cpt.y());
+ //printf("MPConfig::rbClicked new cpt x:%d y:%d\n", cpt.x(), cpt.y());
+ //printf("MPConfig::rbClicked new mapped cpt x:%d y:%d\n", cpt.x(), cpt.y());
+ QPoint ppt = listView->itemRect(item).bottomLeft();
+ //printf("MPConfig::rbClicked ppt x:%d y:%d\n", ppt.x(), ppt.y());
+ ppt += QPoint(listView->header()->sectionPos(col), listView->header()->height());
+ //printf("MPConfig::rbClicked new ppt x:%d y:%d\n", ppt.x(), ppt.y());
+ ppt = listView->mapToGlobal(ppt);
+ //printf("MPConfig::rbClicked new mapped ppt x:%d y:%d\n", ppt.x(), ppt.y());
+
+ switch (col) {
+ case DEVCOL_GUI:
+ if (dev == 0)
+ //break;
+ return;
+ if (port->hasGui())
+ {
+ port->instrument()->showGui(!port->guiVisible());
+ item->setPixmap(DEVCOL_GUI, port->guiVisible() ? *dotIcon : *dothIcon);
+ }
+ //break;
+ return;
+
+ case DEVCOL_REC:
+ if (dev == 0 || !(rwFlags & 2))
+ //break;
+ return;
+ openFlags ^= 0x2;
+ dev->setOpenFlags(openFlags);
+ midiSeq->msgSetMidiDevice(port, dev); // reopen device
+ item->setPixmap(DEVCOL_REC, openFlags & 2 ? *dotIcon : *dothIcon);
+ //break;
+ return;
+
+ case DEVCOL_PLAY:
+ if (dev == 0 || !(rwFlags & 1))
+ //break;
+ return;
+ openFlags ^= 0x1;
+ dev->setOpenFlags(openFlags);
+ midiSeq->msgSetMidiDevice(port, dev); // reopen device
+ item->setPixmap(DEVCOL_PLAY, openFlags & 1 ? *dotIcon : *dothIcon);
+ //break;
+ return;
+
+ case DEVCOL_ROUTES:
+ {
+ if(!checkAudioDevice())
+ return;
+
+ if(audioDevice->deviceType() != AudioDevice::JACK_AUDIO) // p3.3.52 Only if Jack is running.
+ return;
+
+ if(!dev)
+ return;
+
+ // Only Jack midi devices.
+ //MidiJackDevice* mjd = dynamic_cast<MidiJackDevice*>(dev);
+ //if(!mjd)
+ if(dev->deviceType() != MidiDevice::JACK_MIDI)
+ return;
+
+ if(!dev->rwFlags() & 3)
+ return;
+
+ RouteList* rl = (dev->rwFlags() & 1) ? dev->outRoutes() : dev->inRoutes();
+
+ Q3PopupMenu* pup = 0;
+ int gid = 0;
+ std::list<QString> sl;
+
+ pup = new Q3PopupMenu(this);
+ pup->setCheckable(true);
+
+ _redisplay:
+ pup->clear();
+ gid = 0;
+
+ // Jack input ports if device is writable, and jack output ports if device is readable.
+ sl = (dev->rwFlags() & 1) ? audioDevice->inputPorts(true, _showAliases) : audioDevice->outputPorts(true, _showAliases);
+
+ //for (int i = 0; i < channel; ++i)
+ //{
+ //char buffer[128];
+ //snprintf(buffer, 128, "%s %d", tr("Channel").latin1(), i+1);
+ //MenuTitleItem* titel = new MenuTitleItem(QString(buffer));
+ //pup->insertItem(titel);
+
+ pup->insertItem(tr("Show first aliases"), gid);
+ pup->setItemChecked(gid, (_showAliases == 0));
+ ++gid;
+ pup->insertItem(tr("Show second aliases"), gid);
+ pup->setItemChecked(gid, (_showAliases == 1));
+ ++gid;
+ pup->insertSeparator();
+
+ for(std::list<QString>::iterator ip = sl.begin(); ip != sl.end(); ++ip)
+ {
+ //int id = pup->insertItem(*ip, gid);
+ pup->insertItem(*ip, gid);
+ //Route dst(*ip, true, i);
+ Route rt(*ip, (dev->rwFlags() & 1), -1, Route::JACK_ROUTE);
+ for(iRoute ir = rl->begin(); ir != rl->end(); ++ir)
+ {
+ if (*ir == rt)
+ {
+ //pup->setItemChecked(id, true);
+ pup->setItemChecked(gid, true);
+ break;
+ }
+ }
+ ++gid;
+ }
+ //if (i+1 != channel)
+ // pup->insertSeparator();
+ //}
+
+ n = pup->exec(ppt, 0);
+ if (n != -1)
+ {
+ if(n == 0) // Show first aliases
+ {
+ ///delete pup;
+ if(_showAliases == 0)
+ _showAliases = -1;
+ else
+ _showAliases = 0;
+ goto _redisplay; // Go back
+ }
+ else
+ if(n == 1) // Show second aliases
+ {
+ ///delete pup;
+ if(_showAliases == 1)
+ _showAliases = -1;
+ else
+ _showAliases = 1;
+ goto _redisplay; // Go back
+ }
+
+ QString s(pup->text(n));
+
+ if(dev->rwFlags() & 1) // Writable
+ {
+ Route srcRoute(dev, -1);
+ Route dstRoute(s, true, -1, Route::JACK_ROUTE);
+
+ iRoute iir = rl->begin();
+ for(; iir != rl->end(); ++iir)
+ {
+ if(*iir == dstRoute)
+ break;
+ }
+ if(iir != rl->end())
+ // disconnect
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ else
+ // connect
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ else
+ if(dev->rwFlags() & 2) // Readable
+ {
+ Route srcRoute(s, false, -1, Route::JACK_ROUTE);
+ Route dstRoute(dev, -1);
+
+ iRoute iir = rl->begin();
+ for(; iir != rl->end(); ++iir)
+ {
+ if(*iir == srcRoute)
+ break;
+ }
+ if(iir != rl->end())
+ // disconnect
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ else
+ // connect
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+
+ // p3.3.46
+ //delete pup;
+ // FIXME:
+ // Routes can't be re-read until the message sent from msgAddRoute1()
+ // has had time to be sent and actually affected the routes.
+ ///goto _redisplay; // Go back
+
+ }
+ delete pup;
+ //iR->setDown(false); // pup->exec() catches mouse release event
+
+ }
+ //break;
+ return;
+
+ case DEVCOL_NAME:
+ {
+ //printf("MPConfig::rbClicked DEVCOL_NAME\n");
+
+ // Did we click in the text area?
+ if((cpt.x() - ppt.x()) > buttondownIcon->width())
+ {
+ //printf("MPConfig::rbClicked starting item rename... enabled?:%d\n", item->renameEnabled(DEVCOL_NAME));
+ // Start the renaming of the cell...
+ if(item->renameEnabled(DEVCOL_NAME))
+ item->startRename(DEVCOL_NAME);
+
+ return;
+ }
+ else
+ // We clicked the 'down' button.
+ {
+ Q3PopupMenu* pup = new Q3PopupMenu(this);
+
+ pup->setCheckable(true);
+
+ pup->insertItem(tr("Create") + QT_TR_NOOP(" Jack") + tr(" input"), 0);
+ pup->insertItem(tr("Create") + QT_TR_NOOP(" Jack") + tr(" output"), 1);
+
+ typedef std::map<std::string, int > asmap;
+ typedef std::map<std::string, int >::iterator imap;
+
+ asmap mapALSA;
+ asmap mapJACK;
+ asmap mapSYNTH;
+
+ int aix = 2;
+ int jix = 0x10000000;
+ int six = 0x20000000;
+ for(iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i)
+ {
+ //devALSA = dynamic_cast<MidiAlsaDevice*>(*i);
+ //if(devALSA)
+ if((*i)->deviceType() == MidiDevice::ALSA_MIDI)
+ {
+ //mapALSA.insert( std::pair<std::string, int> (std::string(devALSA->name().lower().latin1()), ii) );
+ mapALSA.insert( std::pair<std::string, int> (std::string((*i)->name().latin1()), aix) );
+ ++aix;
+ }
+ else
+ if((*i)->deviceType() == MidiDevice::JACK_MIDI)
+ {
+ //devJACK = dynamic_cast<MidiJackDevice*>(*i);
+ //if(devJACK)
+ //mapJACK.insert( std::pair<std::string, int> (std::string(devJACK->name().lower().latin1()), ii) );
+ mapJACK.insert( std::pair<std::string, int> (std::string((*i)->name().latin1()), jix) );
+ ++jix;
+ }
+ else
+ if((*i)->deviceType() == MidiDevice::SYNTH_MIDI)
+ {
+ mapSYNTH.insert( std::pair<std::string, int> (std::string((*i)->name().latin1()), six) );
+ ++six;
+ }
+ else
+ printf("MPConfig::rbClicked unknown midi device: %s\n", (*i)->name().latin1());
+ }
+
+ //int sz = midiDevices.size();
+ if(!mapALSA.empty())
+ {
+ pup->insertSeparator();
+ // pup->insertItem(new MenuTitleItem(QT_TR_NOOP("ALSA:"))); ddskrjo
+
+ for(imap i = mapALSA.begin(); i != mapALSA.end(); ++i)
+ {
+ int idx = i->second;
+ //if(idx > sz) // Sanity check
+ // continue;
+ QString s(i->first.c_str());
+ MidiDevice* md = midiDevices.find(s, MidiDevice::ALSA_MIDI);
+ if(md)
+ {
+ //if(!dynamic_cast<MidiAlsaDevice*>(md))
+ if(md->deviceType() != MidiDevice::ALSA_MIDI)
+ continue;
+
+ //pup->insertItem(QT_TR_NOOP(md->name()), idx + 3);
+ pup->insertItem(QT_TR_NOOP(md->name()), idx);
+
+ //for(int k = 0; k < MIDI_PORTS; ++k)
+ //{
+ //MidiDevice* dev = midiPorts[k].device();
+ //if(dev && s == dev->name())
+ if(md == dev)
+ {
+ //pup->setItemEnabled(idx + 3, false);
+ //pup->setItemChecked(idx + 3, true);
+ pup->setItemChecked(idx, true);
+ //break;
+ }
+ //}
+ }
+ }
+ }
+
+ if(!mapJACK.empty())
+ {
+ pup->insertSeparator();
+ //pup->insertItem(new MenuTitleItem(QT_TR_NOOP("JACK:"))); ddskrjo
+
+ for(imap i = mapJACK.begin(); i != mapJACK.end(); ++i)
+ {
+ int idx = i->second;
+ //if(idx > sz)
+ // continue;
+ QString s(i->first.c_str());
+ MidiDevice* md = midiDevices.find(s, MidiDevice::JACK_MIDI);
+ if(md)
+ {
+ //if(!dynamic_cast<MidiJackDevice*>(md))
+ if(md->deviceType() != MidiDevice::JACK_MIDI)
+ continue;
+
+ //pup->insertItem(QT_TR_NOOP(md->name()), idx + 3);
+ pup->insertItem(QT_TR_NOOP(md->name()), idx);
+
+ //for(int k = 0; k < MIDI_PORTS; ++k)
+ //{
+ //MidiDevice* dev = midiPorts[k].device();
+ //if(dev && s == dev->name())
+ if(md == dev)
+ {
+ //pup->setItemEnabled(idx + 3, false);
+ //pup->setItemChecked(idx + 3, true);
+ pup->setItemChecked(idx, true);
+ //break;
+ }
+ //}
+ }
+ }
+ }
+
+ if(!mapSYNTH.empty())
+ {
+ pup->insertSeparator();
+ //pup->insertItem(new MenuTitleItem(QT_TR_NOOP("SYNTH:"))); ddskrjo
+
+ for(imap i = mapSYNTH.begin(); i != mapSYNTH.end(); ++i)
+ {
+ int idx = i->second;
+ //if(idx > sz)
+ // continue;
+ QString s(i->first.c_str());
+ MidiDevice* md = midiDevices.find(s, MidiDevice::SYNTH_MIDI);
+ if(md)
+ {
+ //if(!dynamic_cast<MidiJackDevice*>(md))
+ if(md->deviceType() != MidiDevice::SYNTH_MIDI)
+ continue;
+
+ //pup->insertItem(QT_TR_NOOP(md->name()), idx + 3);
+ pup->insertItem(QT_TR_NOOP(md->name()), idx);
+
+ //for(int k = 0; k < MIDI_PORTS; ++k)
+ //{
+ //MidiDevice* dev = midiPorts[k].device();
+ //if(dev && s == dev->name())
+ if(md == dev)
+ {
+ //pup->setItemEnabled(idx + 3, false);
+ //pup->setItemChecked(idx + 3, true);
+ pup->setItemChecked(idx, true);
+ //break;
+ }
+ //}
+ }
+ }
+ }
+
+ n = pup->exec(ppt, 0);
+ if(n == -1)
+ {
+ delete pup;
+ //break;
+ return;
+ }
+
+ //printf("MPConfig::rbClicked n:%d\n", n);
+
+ MidiDevice* sdev = 0;
+ if(n < 2)
+ {
+ delete pup;
+ if(n == 0)
+ sdev = MidiJackDevice::createJackMidiDevice(QString(), 2); // 2: Readable.
+ else
+ if(n == 1)
+ sdev = MidiJackDevice::createJackMidiDevice(QString(), 1); // 1:Writable.
+ }
+ else
+ {
+ int typ = MidiDevice::ALSA_MIDI;
+ if(n >= 0x10000000)
+ typ = MidiDevice::JACK_MIDI;
+ if(n >= 0x20000000)
+ typ = MidiDevice::SYNTH_MIDI;
+
+ sdev = midiDevices.find(pup->text(n), typ);
+ delete pup;
+ // Is it the current device? Reset it to <none>.
+ if(sdev == dev)
+ sdev = 0;
+ }
+
+ midiSeq->msgSetMidiDevice(port, sdev);
+ muse->changeConfig(true); // save configuration file
+ song->update();
+ }
+ }
+ //break;
+ return;
+
+ case DEVCOL_INSTR:
+ {
+ if (dev && dev->isSynti())
+ //break;
+ return;
+ if (instrPopup == 0)
+ instrPopup = new Q3PopupMenu(this);
+ instrPopup->clear();
+ for (iMidiInstrument i = midiInstruments.begin(); i
+ != midiInstruments.end(); ++i)
+ {
+ // By T356.
+ // Do not list synths. Although it is possible to assign a synth
+ // as an instrument to a non-synth device, we should not allow this.
+ // (One reason is that the 'show gui' column is then enabled, which
+ // makes no sense for a non-synth device).
+ SynthI* si = dynamic_cast<SynthI*>(*i);
+ if(!si)
+ instrPopup->insertItem((*i)->iname());
+ }
+ n = instrPopup->exec(ppt, 0);
+ if (n == -1)
+ //break;
+ return;
+ QString s = instrPopup->text(n);
+ item->setText(DEVCOL_INSTR, s);
+ for (iMidiInstrument i = midiInstruments.begin(); i
+ != midiInstruments.end(); ++i) {
+ if ((*i)->iname() == s) {
+ port->setInstrument(*i);
+ break;
+ }
+ }
+ song->update();
+ }
+ //break;
+ return;
+ }
+ //songChanged(-1);
+ }
+
+//---------------------------------------------------------
+// MPHeaderTip::maybeTip
+//---------------------------------------------------------
+
+void MPHeaderTip::maybeTip(const QPoint &pos)
+ {
+#if 0 // ddskrjo
+ Q3Header* w = (Q3Header*)parentWidget();
+ int section = w->sectionAt(pos.x());
+ if (section == -1)
+ return;
+ QRect r(w->sectionPos(section), 0, w->sectionSize(section),
+ w->height());
+ QString p;
+ switch (section) {
+ case DEVCOL_NO: p = Q3Header::tr("Port Number"); break;
+ case DEVCOL_GUI: p = Q3Header::tr("Enable gui"); break;
+ case DEVCOL_REC: p = Q3Header::tr("Enable reading"); break;
+ case DEVCOL_PLAY: p = Q3Header::tr("Enable writing"); break;
+ case DEVCOL_INSTR: p = Q3Header::tr("Port instrument"); break;
+ case DEVCOL_NAME: p = Q3Header::tr("Midi device name. Click to edit (Jack)"); break;
+ case DEVCOL_ROUTES: p = Q3Header::tr("Jack midi ports"); break;
+ case DEVCOL_STATE: p = Q3Header::tr("Device state"); break;
+ default: return;
+ }
+ tip(r, p);
+#endif
+ }
+
+//---------------------------------------------------------
+// MPWhatsThis::text
+//---------------------------------------------------------
+
+QString MPWhatsThis::text(const QPoint& pos)
+ {
+ int n = header->cellAt(pos.x());
+ if (n == -1)
+ return QString::null;
+ switch (header->mapToLogical(n)) {
+ case DEVCOL_NO:
+ return Q3Header::tr("Port Number");
+ case DEVCOL_GUI:
+ return Q3Header::tr("Enable gui for device");
+ case DEVCOL_REC:
+ return Q3Header::tr("Enable reading from device");
+ case DEVCOL_PLAY:
+ return Q3Header::tr("Enable writing to device");
+ case DEVCOL_NAME:
+ return Q3Header::tr("Name of the midi device associated with"
+ " this port number. Click to edit Jack midi name.");
+ case DEVCOL_INSTR:
+ return Q3Header::tr("Instrument connected to port");
+ case DEVCOL_ROUTES:
+ return Q3Header::tr("Jack midi ports");
+ case DEVCOL_STATE:
+ return Q3Header::tr("State: result of opening the device");
+ default:
+ break;
+ }
+ return QString::null;
+ }
+
+//---------------------------------------------------------
+// MPConfig
+// Midi Port Config
+//---------------------------------------------------------
+
+MPConfig::MPConfig(QWidget* parent, char* name)
+ : SynthConfigBase(parent, name)
+ {
+ _mptooltip = 0;
+ popup = 0;
+ instrPopup = 0;
+ _showAliases = -1; // 0: Show first aliases, if available. Nah, stick with -1: none at first.
+
+ mdevView->setSorting(-1);
+ mdevView->setAllColumnsShowFocus(true);
+ mdevView->addColumn(tr("Port"));
+ mdevView->addColumn(tr("GUI"));
+ mdevView->addColumn(tr("I"));
+ mdevView->addColumn(tr("O"));
+ mdevView->addColumn(tr("Instrument"), 120);
+ mdevView->addColumn(tr("Device Name"), 120);
+ mdevView->addColumn(tr("Routing"), 80);
+ mdevView->addColumn(tr("State"));
+ mdevView->setFocusPolicy(Qt::NoFocus);
+
+ mdevView->setColumnAlignment(DEVCOL_NO, Qt::AlignHCenter);
+ mdevView->setColumnAlignment(DEVCOL_GUI, Qt::AlignCenter);
+ mdevView->setColumnAlignment(DEVCOL_REC, Qt::AlignCenter);
+ mdevView->setColumnAlignment(DEVCOL_PLAY, Qt::AlignCenter);
+ mdevView->header()->setResizeEnabled(false, DEVCOL_NO);
+ mdevView->header()->setResizeEnabled(false, DEVCOL_REC);
+ mdevView->header()->setResizeEnabled(false, DEVCOL_GUI);
+ mdevView->setResizeMode(Q3ListView::LastColumn);
+
+ instanceList->setColumnAlignment(1, Qt::AlignHCenter);
+
+ new MPWhatsThis(mdevView, mdevView->header());
+ _mptooltip = new MPHeaderTip(mdevView->header());
+
+ connect(mdevView, SIGNAL(pressed(Q3ListViewItem*,const QPoint&,int)),
+ this, SLOT(rbClicked(Q3ListViewItem*,const QPoint&,int)));
+ connect(mdevView, SIGNAL(itemRenamed(Q3ListViewItem*,int,const QString&)),
+ this, SLOT(mdevViewItemRenamed(Q3ListViewItem*,int,const QString&)));
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+
+ connect(synthList, SIGNAL(selectionChanged()), SLOT(selectionChanged()));
+ connect(instanceList, SIGNAL(selectionChanged()), SLOT(selectionChanged()));
+
+ connect(addInstance, SIGNAL(clicked()), SLOT(addInstanceClicked()));
+ connect(removeInstance, SIGNAL(clicked()), SLOT(removeInstanceClicked()));
+ songChanged(0);
+ }
+
+
+MPConfig::~MPConfig()
+{
+ delete _mptooltip;
+}
+
+//---------------------------------------------------------
+// selectionChanged
+//---------------------------------------------------------
+
+void MPConfig::selectionChanged()
+ {
+ addInstance->setEnabled(synthList->selectedItem());
+ removeInstance->setEnabled(instanceList->selectedItem());
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void MPConfig::songChanged(int flags)
+ {
+ // Is it simply a midi controller value adjustment? Forget it.
+ if(flags == SC_MIDI_CONTROLLER)
+ return;
+
+ // Get currently selected index...
+ int no = -1;
+ Q3ListViewItem* sitem = mdevView->selectedItem();
+ if(sitem)
+ {
+ QString id = sitem->text(DEVCOL_NO);
+ no = atoi(id.latin1()) - 1;
+ if(no < 0 || no >= MIDI_PORTS)
+ no = -1;
+ }
+
+ sitem = 0;
+ mdevView->clear();
+ for (int i = MIDI_PORTS-1; i >= 0; --i)
+ {
+ MidiPort* port = &midiPorts[i];
+ MidiDevice* dev = port->device();
+ QString s;
+ s.setNum(i+1);
+ Q3ListViewItem* item = new Q3ListViewItem(mdevView);
+ item->setText(DEVCOL_NO, s);
+ item->setText(DEVCOL_STATE, port->state());
+ if (port->instrument())
+ item->setText(DEVCOL_INSTR, port->instrument()->iname() );
+ else
+ item->setText(DEVCOL_INSTR, tr("<unknown>"));
+ if (dev) {
+ item->setText(DEVCOL_NAME, dev->name());
+ // Is it a Jack midi device? Allow renaming.
+ //if(dynamic_cast<MidiJackDevice*>(dev))
+ if(dev->deviceType() == MidiDevice::JACK_MIDI)
+ item->setRenameEnabled(DEVCOL_NAME, true);
+
+ if (dev->rwFlags() & 0x2)
+ item->setPixmap(DEVCOL_REC, dev->openFlags() & 2 ? *dotIcon : *dothIcon);
+ else
+ item->setPixmap(DEVCOL_REC, QPixmap());
+ if (dev->rwFlags() & 0x1)
+ item->setPixmap(DEVCOL_PLAY, dev->openFlags() & 1 ? *dotIcon : *dothIcon);
+ else
+ item->setPixmap(DEVCOL_PLAY, QPixmap());
+ }
+ else {
+ item->setText(DEVCOL_NAME, tr("<none>"));
+ item->setPixmap(DEVCOL_GUI, *dothIcon);
+ item->setPixmap(DEVCOL_REC, QPixmap());
+ item->setPixmap(DEVCOL_PLAY, QPixmap());
+ }
+ if (port->hasGui()) {
+ item->setPixmap(DEVCOL_GUI, port->guiVisible() ? *dotIcon : *dothIcon);
+ }
+ else {
+ item->setPixmap(DEVCOL_GUI, QPixmap());
+ }
+ if (!(dev && dev->isSynti()))
+ item->setPixmap(DEVCOL_INSTR, *buttondownIcon);
+ item->setPixmap(DEVCOL_NAME, *buttondownIcon);
+
+ //if(dev && dynamic_cast<MidiJackDevice*>(dev))
+ if(dev && dev->deviceType() == MidiDevice::JACK_MIDI)
+ {
+ item->setPixmap(DEVCOL_ROUTES, *buttondownIcon);
+ item->setText(DEVCOL_ROUTES, tr("routes"));
+ }
+
+ mdevView->insertItem(item);
+ if(i == no)
+ sitem = item;
+ }
+ if(sitem)
+ {
+ mdevView->setSelected(sitem, true);
+ mdevView->ensureItemVisible(sitem);
+ }
+
+ QString s;
+ synthList->clear();
+ for (std::vector<Synth*>::iterator i = synthis.begin();
+ i != synthis.end(); ++i) {
+ //s = (*i)->baseName();
+ //s = (*i)->name();
+
+ Q3ListViewItem* item = new Q3ListViewItem(synthList);
+ //item->setText(0, s);
+ item->setText(0, QString((*i)->baseName()));
+ s.setNum((*i)->instances());
+ item->setText(1, s);
+ //item->setText(2, QString((*i)->baseName()));
+ item->setText(2, QString((*i)->name()));
+
+ item->setText(3, QString((*i)->version()));
+ item->setText(4, QString((*i)->description()));
+ }
+ instanceList->clear();
+ SynthIList* sl = song->syntis();
+ for (iSynthI si = sl->begin(); si != sl->end(); ++si) {
+ Q3ListViewItem* iitem = new Q3ListViewItem(instanceList);
+ iitem->setText(0, (*si)->name());
+ if ((*si)->midiPort() == -1)
+ s = tr("<none>");
+ else
+ s.setNum((*si)->midiPort() + 1);
+ iitem->setText(1, s);
+ }
+ selectionChanged();
+ }
+
+//---------------------------------------------------------
+// addInstanceClicked
+//---------------------------------------------------------
+
+void MPConfig::addInstanceClicked()
+ {
+ Q3ListViewItem* item = synthList->selectedItem();
+ if (item == 0)
+ return;
+ //SynthI *si = song->createSynthI(item->text(2));
+ SynthI *si = song->createSynthI(item->text(0), item->text(2));
+ if(!si)
+ return;
+
+ // add instance last in midi device list
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ MidiPort* port = &midiPorts[i];
+ MidiDevice* dev = port->device();
+ if (dev==0) {
+ midiSeq->msgSetMidiDevice(port, si);
+ muse->changeConfig(true); // save configuration file
+ song->update();
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// removeInstanceClicked
+//---------------------------------------------------------
+
+void MPConfig::removeInstanceClicked()
+ {
+ Q3ListViewItem* item = instanceList->selectedItem();
+ if (item == 0)
+ return;
+ SynthIList* sl = song->syntis();
+ iSynthI ii;
+ for (ii = sl->begin(); ii != sl->end(); ++ii) {
+ if ((*ii)->iname() == item->text(0))
+ break;
+ }
+ if (ii == sl->end()) {
+ printf("synthesizerConfig::removeInstanceClicked(): synthi not found\n");
+ return;
+ }
+ audio->msgRemoveTrack(*ii);
+ }
+
+//---------------------------------------------------------
+// configMidiPorts
+//---------------------------------------------------------
+
+void MusE::configMidiPorts()
+ {
+ if (!midiPortConfig)
+ midiPortConfig = new MPConfig(0, (char*) "midiPortConfig");
+ if (midiPortConfig->isVisible()) {
+ midiPortConfig->raise();
+ midiPortConfig->setActiveWindow();
+ }
+ else
+ midiPortConfig->show();
+ }
+
diff --git a/muse2/muse/confmport.h b/muse2/muse/confmport.h
new file mode 100644
index 00000000..77683a3c
--- /dev/null
+++ b/muse2/muse/confmport.h
@@ -0,0 +1,83 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: confmport.h,v 1.3 2004/01/25 11:20:31 wschweer Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __CONFMPORT_H__
+#define __CONFMPORT_H__
+
+#include <qwidget.h>
+#include <q3whatsthis.h>
+#include <qtooltip.h>
+//Added by qt3to4:
+#include <Q3PopupMenu>
+
+#include "synthconfigbase.h"
+
+class Q3ListView;
+class Q3ListViewItem;
+class QPoint;
+class Q3PopupMenu;
+class Q3Header;
+class Xml;
+
+//----------------------------------------------------------
+// MPHeaderTip
+//----------------------------------------------------------
+
+class MPHeaderTip { // : public QToolTip { ddskrjo
+
+ public:
+ MPHeaderTip(QWidget * parent) {} // : QToolTip(parent) {} ddskrjo
+ virtual ~MPHeaderTip() {}
+ protected:
+ void maybeTip(const QPoint &);
+ };
+
+//---------------------------------------------------------
+// MPWhatsThis
+//---------------------------------------------------------
+
+class MPWhatsThis : public Q3WhatsThis {
+ Q3Header* header;
+
+ protected:
+ QString text(const QPoint&);
+
+ public:
+ MPWhatsThis(QWidget* parent, Q3Header* h) : Q3WhatsThis(parent) {
+ header = h;
+ }
+ };
+
+//---------------------------------------------------------
+// MPConfig
+// Midi Port Config
+//---------------------------------------------------------
+
+class MPConfig : public SynthConfigBase {
+ MPHeaderTip* _mptooltip;
+ Q3PopupMenu* popup;
+ Q3PopupMenu* instrPopup;
+
+ int _showAliases; // -1: None. 0: First aliases. 1: Second aliases etc.
+
+ Q_OBJECT
+
+ private slots:
+ void rbClicked(Q3ListViewItem*, const QPoint&,int);
+ void mdevViewItemRenamed(Q3ListViewItem*, int, const QString&);
+ void songChanged(int);
+ void selectionChanged();
+ void addInstanceClicked();
+ void removeInstanceClicked();
+
+ public:
+ MPConfig(QWidget* parent, char* name);
+ ~MPConfig();
+ };
+
+#endif
diff --git a/muse2/muse/ctrl.cpp b/muse2/muse/ctrl.cpp
new file mode 100644
index 00000000..fa7e5bd7
--- /dev/null
+++ b/muse2/muse/ctrl.cpp
@@ -0,0 +1,297 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ctrl.cpp,v 1.1.2.4 2009/06/10 00:34:59 terminator356 Exp $
+//
+// controller handling for mixer automation
+//
+// (C) Copyright 2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+
+#include <qlocale.h>
+//#include <stdlib.h>
+#include "globals.h"
+#include "ctrl.h"
+#include "xml.h"
+// #include "audio.h"
+
+//---------------------------------------------------------
+// CtrlList
+//---------------------------------------------------------
+
+CtrlList::CtrlList(int id)
+ {
+ _id = id;
+ _default = 0.0;
+ _curVal = 0.0;
+ _mode = INTERPOLATE;
+ }
+//---------------------------------------------------------
+// CtrlList
+//---------------------------------------------------------
+CtrlList::CtrlList(int id, QString name, double min, double max)
+{
+ _id = id;
+ _default = 0.0;
+ _curVal = 0.0;
+ _mode = INTERPOLATE;
+ _name = name;
+ _min = min;
+ _max = max;
+}
+//---------------------------------------------------------
+// CtrlList
+//---------------------------------------------------------
+
+CtrlList::CtrlList()
+ {
+ _id = 0;
+ _default = 0.0;
+ _curVal = 0.0;
+ _mode = INTERPOLATE;
+ }
+
+//---------------------------------------------------------
+// value
+//---------------------------------------------------------
+
+double CtrlList::value(int frame)
+ {
+ if (!automation || empty()) {
+ return _curVal;
+ }
+ ciCtrl i = upper_bound(frame);
+ if (i == end()) {
+ ciCtrl i = end();
+ --i;
+ const CtrlVal& val = i->second;
+ _curVal = val.val;
+ }
+ else
+ if(_mode == DISCRETE)
+ {
+ if(i == begin())
+ _curVal = _default;
+ else
+ {
+ --i;
+ const CtrlVal& val = i->second;
+ _curVal = val.val;
+ }
+ }
+ else {
+ int frame2 = i->second.frame;
+ double val2 = i->second.val;
+ int frame1;
+ double val1;
+ if (i == begin()) {
+ frame1 = 0;
+ val1 = _default;
+ }
+ else {
+ --i;
+ frame1 = i->second.frame;
+ val1 = i->second.val;
+ }
+ frame -= frame1;
+ val2 -= val1;
+ frame2 -= frame1;
+ val1 += (frame * val2)/frame2;
+ _curVal = val1;
+ }
+// printf("autoVal %d %f\n", frame, _curVal);
+ return _curVal;
+ }
+
+
+//---------------------------------------------------------
+// setCurVal
+//---------------------------------------------------------
+void CtrlList::setCurVal(double val)
+{
+ _curVal = val;
+ if (size() < 2) {
+ add(0,val);
+ }
+}
+
+//---------------------------------------------------------
+// add
+//---------------------------------------------------------
+
+void CtrlList::add(int frame, double val)
+ {
+// printf("add %d %f\n", frame, val);
+ iCtrl e = find(frame);
+ if (e != end())
+ e->second.val = val;
+ else
+ insert(std::pair<const int, CtrlVal> (frame, CtrlVal(frame, val)));
+ }
+
+//---------------------------------------------------------
+// del
+//---------------------------------------------------------
+
+void CtrlList::del(int /* frame*/)
+ {
+ /*
+ iCtrl e = find(frame);
+ if (e == end()) {
+ printf("CtrlList::del(%d): not found\n", frame);
+ return;
+ }
+ erase(e);
+ */
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void CtrlList::read(Xml& xml)
+ {
+ QLocale loc = QLocale::c();
+ bool ok;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::Attribut:
+ if (tag == "id")
+ {
+ //_id = xml.s2().toInt();
+ _id = loc.toInt(xml.s2(), &ok);
+ if(!ok)
+ printf("CtrlList::read failed reading _id string: %s\n", xml.s2().latin1());
+ }
+ else if (tag == "cur")
+ {
+ //_curVal = xml.s2().toDouble();
+ _curVal = loc.toDouble(xml.s2(), &ok);
+ if(!ok)
+ printf("CtrlList::read failed reading _curVal string: %s\n", xml.s2().latin1());
+ }
+ else
+ printf("unknown tag %s\n", tag.latin1());
+ break;
+ case Xml::Text:
+ {
+ // Changed by Tim. Users in some locales reported corrupt reading,
+ // because of the way floating point is represented (2,3456 not 2.3456).
+ /*
+ const char* s = tag.latin1();
+ int frame;
+ double val;
+
+ for (;;) {
+ char* endp;
+ while (*s == ' ' || *s == '\n')
+ ++s;
+ if (*s == 0)
+ break;
+ frame = strtol(s, &endp, 10);
+ s = endp;
+ while (*s == ' ' || *s == '\n')
+ ++s;
+ val = strtod(s, &endp);
+ add(frame, val);
+ s = endp;
+ ++s;
+ }
+ */
+
+ // Added by Tim. p3.3.6
+ //printf("CtrlList::read tag:%s\n", tag.latin1());
+
+ int len = tag.length();
+ int frame;
+ double val;
+
+ int i = 0;
+ for(;;)
+ {
+ while(i < len && (tag[i] == ',' || tag[i] == ' ' || tag[i] == '\n'))
+ ++i;
+ if(i == len)
+ break;
+
+ QString fs;
+ while(i < len && tag[i] != ' ')
+ {
+ fs.append(tag[i]);
+ ++i;
+ }
+ if(i == len)
+ break;
+
+ // Works OK, but only because if current locale fails it falls back on 'C' locale.
+ // So, let's skip the fallback and force use of 'C' locale.
+ //frame = fs.toInt(&ok);
+ frame = loc.toInt(fs, &ok);
+ if(!ok)
+ {
+ printf("CtrlList::read failed reading frame string: %s\n", fs.latin1());
+ break;
+ }
+
+ while(i < len && (tag[i] == ' ' || tag[i] == '\n'))
+ ++i;
+ if(i == len)
+ break;
+
+ QString vs;
+ while(i < len && tag[i] != ' ' && tag[i] != ',')
+ {
+ vs.append(tag[i]);
+ ++i;
+ }
+
+ // Works OK, but only because if current locale fails it falls back on 'C' locale.
+ // So, let's skip the fallback and force use of 'C' locale.
+ //val = vs.toDouble(&ok);
+ val = loc.toDouble(vs, &ok);
+ if(!ok)
+ {
+ printf("CtrlList::read failed reading value string: %s\n", vs.latin1());
+ break;
+ }
+
+ // Added by Tim. p3.3.6
+ //printf("CtrlList::read i:%d len:%d fs:%s frame %d: vs:%s val %f \n", i, len, fs.latin1(), frame, vs.latin1(), val);
+
+ add(frame, val);
+
+ if(i == len)
+ break;
+ }
+ }
+ break;
+ case Xml::TagEnd:
+ if (xml.s1() == "controller")
+ {
+ // Added by Tim. p3.3.6
+ //printf("CtrlList::read _id:%d _curVal:%f\n", _id, _curVal);
+
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// add
+//---------------------------------------------------------
+
+void CtrlListList::add(CtrlList* vl)
+ {
+// printf("CtrlListList(%p)::add(id=%d) size %d\n", this, vl->id(), size());
+ insert(std::pair<const int, CtrlList*>(vl->id(), vl));
+ }
+
diff --git a/muse2/muse/ctrl.h b/muse2/muse/ctrl.h
new file mode 100644
index 00000000..99767b55
--- /dev/null
+++ b/muse2/muse/ctrl.h
@@ -0,0 +1,144 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ctrl.h,v 1.4.2.2 2006/10/29 07:54:51 terminator356 Exp $
+//
+// controller for mixer automation
+//
+// (C) Copyright 2003-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __CTRL_H__
+#define __CTRL_H__
+
+#include <map>
+#include <list>
+
+const int AC_VOLUME = 0;
+const int AC_PAN = 1;
+const int AC_MUTE = 2;
+
+#define AC_PLUGIN_CTL_BASE 0x1000
+#define AC_PLUGIN_CTL_BASE_POW 12
+#define AC_PLUGIN_CTL_ID_MASK 0xFFF
+
+inline int genACnum(int plugin, int ctrl) { return (plugin + 1) * AC_PLUGIN_CTL_BASE + ctrl; }
+
+class Xml;
+
+enum CtrlValueType { VAL_LOG, VAL_LINEAR, VAL_INT, VAL_BOOL };
+enum CtrlRecValueType { ARVT_VAL, ARVT_START, ARVT_STOP };
+
+//---------------------------------------------------------
+// CtrlVal
+// controller "event"
+//---------------------------------------------------------
+
+struct CtrlVal {
+ int frame;
+ double val;
+ CtrlVal(int f, double v) {
+ frame = f;
+ val = v;
+ }
+ };
+
+//---------------------------------------------------------
+// CtrlRecVal
+// recorded controller event, mixer automation
+//---------------------------------------------------------
+
+struct CtrlRecVal : public CtrlVal {
+ int id;
+ CtrlRecValueType type; // 0 - ctrlVal, 1 - start, 2 - end
+ CtrlRecVal(int f, int n, double v) : CtrlVal(f, v), id(n), type(ARVT_VAL) {}
+ CtrlRecVal(int f, int n, double v, CtrlRecValueType t) : CtrlVal(f, v), id(n), type(t) {}
+ };
+
+//---------------------------------------------------------
+// CtrlRecList
+//---------------------------------------------------------
+
+class CtrlRecList : public std::list<CtrlRecVal> {
+ public:
+ };
+
+typedef CtrlRecList::iterator iCtrlRec;
+
+//---------------------------------------------------------
+// CtrlList
+// arrange controller events of a specific type in a
+// list for easy retrieval
+//---------------------------------------------------------
+
+typedef std::map<int, CtrlVal, std::less<int> >::iterator iCtrl;
+typedef std::map<int, CtrlVal, std::less<int> >::const_iterator ciCtrl;
+
+class CtrlList : public std::map<int, CtrlVal, std::less<int> > {
+ public:
+ enum Mode { INTERPOLATE, DISCRETE};
+
+ private:
+ Mode _mode;
+ int _id;
+ double _default;
+ double _curVal;
+ void del(CtrlVal);
+ QString _name;
+ double _min, _max;
+ CtrlValueType _valueType;
+
+ public:
+ CtrlList();
+ CtrlList(int id);
+ CtrlList(int id, QString name, double min, double max);
+
+ Mode mode() const { return _mode; }
+ void setMode(Mode m) { _mode = m; }
+ double getDefault() const { return _default; }
+ void setDefault(double val) { _default = val; }
+ double curVal() const { return _curVal; }
+ void setCurVal(double val); // { _curVal = val; }
+ int id() const { return _id; }
+ QString name() const { return _name; }
+ void setName(const QString& s) { _name = s; }
+ void setRange(double min, double max) {
+ _min = min;
+ _max = max;
+ }
+ void range(double* min, double* max) const {
+ *min = _min;
+ *max = _max;
+ }
+ CtrlValueType valueType() const { return _valueType; }
+ void setValueType(CtrlValueType t) { _valueType = t; }
+
+ double value(int frame);
+ void add(int tick, double value);
+ void del(int tick);
+ void read(Xml& xml);
+ };
+
+//---------------------------------------------------------
+// CtrlListList
+// List of controller value lists.
+// This list represents the controller state of a
+// mixer strip
+//---------------------------------------------------------
+
+typedef std::map<int, CtrlList*, std::less<int> >::iterator iCtrlList;
+typedef std::map<int, CtrlList*, std::less<int> >::const_iterator ciCtrlList;
+
+class CtrlListList : public std::map<int, CtrlList*, std::less<int> > {
+ public:
+ void add(CtrlList* vl);
+ iCtrlList find(int id) {
+ return std::map<int, CtrlList*, std::less<int> >::find(id);
+ }
+ ciCtrlList find(int id) const {
+ return std::map<int, CtrlList*, std::less<int> >::find(id);
+ }
+ };
+
+#endif
+
diff --git a/muse2/muse/ctrl/Makefile.am b/muse2/muse/ctrl/Makefile.am
new file mode 100644
index 00000000..3aac8577
--- /dev/null
+++ b/muse2/muse/ctrl/Makefile.am
@@ -0,0 +1,17 @@
+include $(top_srcdir)/common.am
+
+if PCH
+AM_CXXFLAGS += -include $(top_srcdir)/all.h
+endif
+
+noinst_LIBRARIES = libctrl.a
+
+dist_libctrl_a_SOURCES = \
+ ctrledit.cpp ctrledit.h \
+ ctrlcanvas.cpp ctrlcanvas.h \
+ ctrlpanel.cpp ctrlpanel.h
+
+nodist_libctrl_a_SOURCES = \
+ moc_ctrledit.cpp \
+ moc_ctrlcanvas.cpp \
+ moc_ctrlpanel.cpp
diff --git a/muse2/muse/ctrl/Makefile.in b/muse2/muse/ctrl/Makefile.in
new file mode 100644
index 00000000..09912657
--- /dev/null
+++ b/muse2/muse/ctrl/Makefile.in
@@ -0,0 +1,604 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/common.am
+@PCH_TRUE@am__append_1 = -include $(top_srcdir)/all.h
+subdir = muse/ctrl
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
+ $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libctrl_a_AR = $(AR) $(ARFLAGS)
+libctrl_a_LIBADD =
+dist_libctrl_a_OBJECTS = ctrledit.$(OBJEXT) ctrlcanvas.$(OBJEXT) \
+ ctrlpanel.$(OBJEXT)
+nodist_libctrl_a_OBJECTS = moc_ctrledit.$(OBJEXT) \
+ moc_ctrlcanvas.$(OBJEXT) moc_ctrlpanel.$(OBJEXT)
+libctrl_a_OBJECTS = $(dist_libctrl_a_OBJECTS) \
+ $(nodist_libctrl_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(dist_libctrl_a_SOURCES) $(nodist_libctrl_a_SOURCES)
+DIST_SOURCES = $(dist_libctrl_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCBOOKSTYLE = @DOCBOOKSTYLE@
+DOCBOOKTARGETS = @DOCBOOKTARGETS@
+DOT = @DOT@
+DOTPATH = @DOTPATH@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@
+FST_CFLAGS = @FST_CFLAGS@
+FST_LIBS = @FST_LIBS@
+Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@
+Fluidsynth_LIBS = @Fluidsynth_LIBS@
+GIVERTCAP = @GIVERTCAP@
+GREP = @GREP@
+HAVEDOT = @HAVEDOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JADE = @JADE@
+LASH_CFLAGS = @LASH_CFLAGS@
+LASH_LIBS = @LASH_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LO_CFLAGS = @LO_CFLAGS@
+LO_LIBS = @LO_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUSECXXFLAGS = @MUSECXXFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSGMLS = @NSGMLS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCH = @PCH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIB = @PYTHON_LIB@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+QTDIR_BIN = @QTDIR_BIN@
+QTDIR_INC = @QTDIR_INC@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+SUIDBUILD = @SUIDBUILD@
+SUIDINSTALL = @SUIDINSTALL@
+USE_SSE = @USE_SSE@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+have_docbook = @have_docbook@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+synth_fluid = @synth_fluid@
+synth_fluidsynth = @synth_fluidsynth@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \
+ -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(am__append_1)
+AM_CPPFLAGS =
+MOC = $(QTDIR_BIN)/moc
+#UIC = $(QTDIR_BIN)/uic3
+UIC = /usr/bin/uic3
+UIFILES = $(wildcard *.ui)
+MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \
+ if grep -q Q_OBJECT $$h; then \
+ echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \
+ fi; \
+ done)
+
+BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+SUFFIXES = .ui .h.gch
+noinst_LIBRARIES = libctrl.a
+dist_libctrl_a_SOURCES = \
+ ctrledit.cpp ctrledit.h \
+ ctrlcanvas.cpp ctrlcanvas.h \
+ ctrlpanel.cpp ctrlpanel.h
+
+nodist_libctrl_a_SOURCES = \
+ moc_ctrledit.cpp \
+ moc_ctrlcanvas.cpp \
+ moc_ctrlpanel.cpp
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .ui .h.gch .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/ctrl/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu muse/ctrl/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libctrl.a: $(libctrl_a_OBJECTS) $(libctrl_a_DEPENDENCIES)
+ -rm -f libctrl.a
+ $(libctrl_a_AR) libctrl.a $(libctrl_a_OBJECTS) $(libctrl_a_LIBADD)
+ $(RANLIB) libctrl.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctrlcanvas.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctrledit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctrlpanel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_ctrlcanvas.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_ctrledit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_ctrlpanel.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+de:
+ @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done
+
+nde:
+ @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done
+
+.ui.o: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(CXXCOMPILE) -c $*.cpp -o $*.o
+ $(RM) $*.cpp moc_$*.cpp moc_$*.o
+
+.ui.lo: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(LTCXXCOMPILE) -c $*.cpp -o $*.lo
+ $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o
+
+moc_%.cpp: %.h
+ $(MOC) $< -o $@
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/muse2/muse/ctrl/ctrlcanvas.cpp b/muse2/muse/ctrl/ctrlcanvas.cpp
new file mode 100644
index 00000000..6a7e0720
--- /dev/null
+++ b/muse2/muse/ctrl/ctrlcanvas.cpp
@@ -0,0 +1,1533 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ctrlcanvas.cpp,v 1.15.2.10 2009/11/14 03:37:48 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <values.h>
+
+#include <qlayout.h>
+#include <qpainter.h>
+#include <qtoolbutton.h>
+#include <q3popupmenu.h>
+#include <qlabel.h>
+#include <qcursor.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QEvent>
+
+#include "globals.h"
+#include "ctrledit.h"
+#include "midieditor.h"
+#include "icons.h"
+#include "midiport.h"
+#include "song.h"
+#include "midictrl.h"
+#include "audio.h"
+#include "gconfig.h"
+#include "ctrlpanel.h"
+#include "midiedit/drummap.h"
+
+extern void drawTickRaster(QPainter& p, int x, int y,
+ int w, int h, int quant);
+
+static MidiCtrlValList veloList(CTRL_VELOCITY); // dummy
+
+//---------------------------------------------------------
+// computeVal
+//---------------------------------------------------------
+
+static int computeVal(MidiController* mc, int y, int height)
+ {
+ int min; int max;
+ if(mc->num() == CTRL_PROGRAM)
+ {
+ min = 1;
+ max = 128;
+ }
+ else
+ {
+ min = mc->minVal();
+ max = mc->maxVal();
+ }
+ int val = max - (y * (max-min) / height);
+ if (val < min)
+ val = min;
+ if (val > max)
+ val = max;
+ if(mc->num() != CTRL_PROGRAM)
+ val += mc->bias();
+ return val;
+ }
+
+//---------------------------------------------------------
+// CEvent
+//---------------------------------------------------------
+
+CEvent::CEvent(Event e, MidiPart* pt, int v)
+ {
+ _event = e;
+ _part = pt;
+ _val = v;
+ ex = !e.empty() ? e.tick() : 0;
+ }
+
+//---------------------------------------------------------
+// contains
+//---------------------------------------------------------
+
+bool CEvent::contains(int x1, int x2) const
+ {
+ int tick1 = !_event.empty() ? _event.tick() + _part->tick() : 0;
+ if(ex == -1)
+ return (tick1 < x2);
+
+ int tick2 = ex + _part->tick();
+ return ((tick1 >= x1 && tick1 < x2)
+ //|| (tick2 >= x1 && tick2 < x2)
+ || (tick2 > x1 && tick2 < x2)
+ || (tick1 < x1 && tick2 >= x2));
+ }
+
+//---------------------------------------------------------
+// clearDelete
+//---------------------------------------------------------
+
+void CEventList::clearDelete()
+{
+ for(ciCEvent i = begin(); i != end(); ++i)
+ {
+ CEvent* ce = *i;
+ if(ce)
+ delete ce;
+ }
+ clear();
+}
+
+//---------------------------------------------------------
+// CtrlCanvas
+//---------------------------------------------------------
+
+CtrlCanvas::CtrlCanvas(MidiEditor* e, QWidget* parent, int xmag,
+ const char* name, CtrlPanel* pnl) : View(parent, xmag, 1, name)
+ {
+ setBg(Qt::white);
+ editor = e;
+ drag = DRAG_OFF;
+ tool = PointerTool;
+ pos[0] = 0;
+ pos[1] = 0;
+ pos[2] = 0;
+ noEvents=false;
+
+ ctrl = &veloList;
+ _controller = &veloCtrl;
+ _panel = pnl;
+ _cnum = CTRL_VELOCITY;
+ _dnum = CTRL_VELOCITY;
+ _didx = CTRL_VELOCITY;
+ connect(song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool)));
+
+ setMouseTracking(true);
+ if (editor->parts()->empty()) {
+ curPart = 0;
+ curTrack = 0;
+ }
+ else {
+ setCurTrackAndPart();
+ }
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+
+ curDrumInstrument = editor->curDrumInstrument();
+ //printf("CtrlCanvas::CtrlCanvas curDrumInstrument:%d\n", curDrumInstrument);
+
+ connect(editor, SIGNAL(curDrumInstrumentChanged(int)), SLOT(setCurDrumInstrument(int)));
+ updateItems();
+ }
+
+//---------------------------------------------------------
+// setPos
+// set one of three markers
+// idx - 0-cpos 1-lpos 2-rpos
+// flag - emit followEvent()
+//---------------------------------------------------------
+
+void CtrlCanvas::setPos(int idx, unsigned val, bool adjustScrollbar)
+ {
+ if (pos[idx] == val)
+ return;
+
+ int opos = mapx(pos[idx]);
+ int npos = mapx(val);
+
+ if (adjustScrollbar && idx == 0) {
+ switch (song->follow()) {
+ case Song::NO:
+ break;
+ case Song::JUMP:
+ if (npos >= width()) {
+ int ppos = val - rmapxDev(width()/4);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ else if (npos < 0) {
+ int ppos = val - rmapxDev(width()*3/4);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ break;
+ case Song::CONTINUOUS:
+ if (npos > (width()*5)/8) {
+ int ppos = pos[idx] - rmapxDev(width()*5/8);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ else if (npos < (width()*3)/8) {
+ int ppos = pos[idx] - rmapxDev(width()*3/8);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ break;
+ }
+ }
+
+ int x;
+ int w = 1;
+ if (opos > npos) {
+ w += opos - npos;
+ x = npos;
+ }
+ else {
+ w += npos - opos;
+ x = opos;
+ }
+ pos[idx] = val;
+ redraw(QRect(x, 0, w, height()));
+ }
+
+//---------------------------------------------------------
+// setMidiController
+//---------------------------------------------------------
+
+void CtrlCanvas::setMidiController(int num)
+ {
+ _cnum = num;
+ partControllers(curPart, _cnum, &_dnum, &_didx, &_controller, &ctrl);
+ if(_panel)
+ {
+ if(_cnum == CTRL_VELOCITY)
+ _panel->setHWController(curTrack, &veloCtrl);
+ else
+ _panel->setHWController(curTrack, _controller);
+ }
+ }
+
+//---------------------------------------------------------
+// leaveEvent
+//---------------------------------------------------------
+
+void CtrlCanvas::leaveEvent(QEvent*)
+ {
+ emit xposChanged(MAXINT);
+ emit yposChanged(-1);
+ }
+
+//---------------------------------------------------------
+// raster
+//---------------------------------------------------------
+
+QPoint CtrlCanvas::raster(const QPoint& p) const
+ {
+ return p;
+ }
+
+//---------------------------------------------------------
+// deselectAll
+//---------------------------------------------------------
+
+void CtrlCanvas::deselectAll()
+ {
+// for (iCEvent i = selection.begin(); i != selection.end(); ++i)
+// (*i)->setState(CEvent::Normal);
+// selection.clear();
+// update();
+ }
+
+//---------------------------------------------------------
+// selectItem
+//---------------------------------------------------------
+
+void CtrlCanvas::selectItem(CEvent*)
+ {
+// e->setState(CEvent::Selected);
+// selection.push_back(e);
+// update();
+ }
+
+//---------------------------------------------------------
+// deselectItem
+//---------------------------------------------------------
+
+void CtrlCanvas::deselectItem(CEvent*)
+ {
+/* e->setState(CEvent::Normal);
+ for (iCEvent i = selection.begin(); i != selection.end(); ++i) {
+ if (*i == e) {
+ selection.erase(i);
+ break;
+ }
+ }
+ update();
+ */
+ }
+
+//---------------------------------------------------------
+// setController
+//---------------------------------------------------------
+
+void CtrlCanvas::setController(int num)
+{
+ setMidiController(num);
+ updateItems();
+}
+
+
+//---------------------------------------------------------
+// setCurTrackAndPart
+//---------------------------------------------------------
+
+bool CtrlCanvas::setCurTrackAndPart()
+{
+ bool changed = false;
+ MidiPart* part = 0;
+ MidiTrack* track = 0;
+
+ if(!editor->parts()->empty())
+ {
+ Part* pt = editor->curCanvasPart();
+ if(pt && pt->track())
+ {
+ if(pt->track()->isMidiTrack())
+ {
+ part = (MidiPart*)pt;
+ track = part->track();
+ }
+ }
+ }
+
+ if(part != curPart)
+ {
+ curPart = part;
+ changed = true;
+ }
+
+ if(track != curTrack)
+ {
+ curTrack = track;
+ changed = true;
+ }
+
+ return changed;
+}
+
+//---------------------------------------------------------
+// songChanged
+// all marked parts are added to the internal event list
+//---------------------------------------------------------
+
+void CtrlCanvas::songChanged(int type)
+{
+ // Is it simply a midi controller value adjustment? Forget it.
+ if(type == SC_MIDI_CONTROLLER)
+ return;
+
+ bool changed = false;
+ if(type & (SC_CONFIG | SC_PART_MODIFIED | SC_SELECTION))
+ changed = setCurTrackAndPart();
+
+ // Although changing the instrument/device in the
+ // config window generates a type of -1, we can eliminate
+ // some other useless calls using SC_CONFIG, which was not used
+ // anywhere else in muse before now, except song header.
+ if((type & (SC_CONFIG | SC_DRUMMAP)) || ((type & (SC_PART_MODIFIED | SC_SELECTION)) && changed))
+ {
+ setMidiController(_cnum);
+ //return;
+ }
+
+ updateItems();
+
+}
+
+//---------------------------------------------------------
+// partControllers
+//---------------------------------------------------------
+
+void CtrlCanvas::partControllers(const MidiPart* part, int num, int* dnum, int* didx, MidiController** mc, MidiCtrlValList** mcvl)
+{
+ if(num == CTRL_VELOCITY) // special case
+ {
+ if(mcvl)
+ *mcvl = &veloList;
+ if(mc)
+ *mc = &veloCtrl;
+ if(dnum)
+ *dnum = num;
+ if(didx)
+ *didx = num;
+ }
+ else
+ {
+ MidiTrack* mt = part->track();
+ MidiPort* mp;
+ int di;
+ int n;
+
+ if((mt->type() != Track::DRUM) && curDrumInstrument != -1)
+ printf("keyfilter != -1 in non drum track?\n");
+
+ if((mt->type() == Track::DRUM) && (curDrumInstrument != -1) && ((num & 0xff) == 0xff))
+ {
+ di = (num & ~0xff) | curDrumInstrument;
+ n = (num & ~0xff) | drumMap[curDrumInstrument].anote; // construct real controller number
+ //num = (num & ~0xff) | curDrumInstrument); // construct real controller number
+ mp = &midiPorts[drumMap[curDrumInstrument].port];
+ }
+ else
+ {
+ di = num;
+ n = num;
+ mp = &midiPorts[mt->outPort()];
+ }
+
+ if(dnum)
+ *dnum = n;
+
+ if(didx)
+ *didx = di;
+
+ if(mc)
+ *mc = mp->midiController(n);
+
+ if(mcvl)
+ {
+ MidiCtrlValList* tmcvl = 0;
+ MidiCtrlValListList* cvll = mp->controller();
+ for(iMidiCtrlValList i = cvll->begin(); i != cvll->end(); ++i)
+ {
+ if(i->second->num() == n)
+ {
+ tmcvl = i->second;
+ break;
+ }
+ }
+ *mcvl = tmcvl;
+
+ // Removed by T356.
+ // MidiCtrlValList not found is now an acceptable state (for multiple part editing).
+ //if (i == cvll->end()) {
+ // printf("CtrlCanvas::setController(0x%x): not found\n", num);
+ // for (i = cvll->begin(); i != cvll->end(); ++i)
+ // printf(" 0x%x\n", i->second->num());
+ // return;
+ // }
+ }
+ }
+}
+
+//---------------------------------------------------------
+// updateItems
+//---------------------------------------------------------
+
+void CtrlCanvas::updateItems()
+ {
+ items.clearDelete();
+
+ /*
+ if(ctrl)
+ {
+ for(ciMidiCtrlVal imcv = ctrl->begin(); imcv != ctrl->end(); ++imcv)
+ {
+ MidiPart* part = (MidiPart*)imcv->part;
+ int val = imcv->val;
+
+ bool edpart = false;
+ if(editor->parts()->index(part) != -1)
+ edpart = true;
+
+ MidiController* mc;
+ MidiCtrlValList* mcvl;
+ partControllers(part, _cnum, 0, 0, &mc, &mcvl);
+
+ Event e(Controller);
+
+ if(_cnum == CTRL_VELOCITY && e.type() == Note)
+ {
+ items.add(new CEvent(e, part, e.velo()));
+
+ }
+
+ }
+ }
+ */
+
+ /*
+ MidiTrackList* mtl = song->midis();
+ for(ciMidiTrack imt = mtl->begin(); imt != mtl->end(); ++imt)
+ {
+ //MidiTrack* mt = *imt;
+ PartList* pl = (*imt)->parts();
+ for(ciPart p = pl->begin(); p != pl->end(); ++p)
+ {
+ MidiPart* part = (MidiPart*)(p->second);
+
+ bool edpart = false;
+ if(editor->parts()->index(part) != -1)
+ edpart = true;
+
+ EventList* el = part->events();
+ MidiController* mc;
+ MidiCtrlValList* mcvl;
+ partControllers(part, _cnum, 0, 0, &mc, &mcvl);
+
+ for(iEvent i = el->begin(); i != el->end(); ++i)
+ {
+ Event e = i->second;
+ if(_cnum == CTRL_VELOCITY && e.type() == Note)
+ {
+ if(curDrumInstrument == -1)
+ {
+ items.add(new CEvent(e, part, e.velo()));
+ }
+ else if (e.dataA() == curDrumInstrument) //same note
+ items.add(new CEvent(e, part, e.velo()));
+ }
+ else if (e.type() == Controller && e.dataA() == _didx)
+ {
+ if(mcvl && last.empty())
+ {
+ Event le(Controller);
+ //le.setType(Controller);
+ le.setA(_didx);
+ //le.setB(e.dataB());
+ le.setB(CTRL_VAL_UNKNOWN);
+ //lastce = new CEvent(Event(), part, mcvl->value(part->tick(), part));
+ //lastce = new CEvent(le, part, mcvl->value(part->tick(), part));
+ lastce = new CEvent(le, part, mcvl->value(part->tick()));
+ items.add(lastce);
+ }
+ if (lastce)
+ lastce->setEX(e.tick());
+ lastce = new CEvent(e, part, e.dataB());
+ items.add(lastce);
+ last = e;
+ }
+ }
+ }
+ }
+ */
+
+
+
+
+
+ if(!editor->parts()->empty())
+ {
+ //Event last;
+ //CEvent* lastce = 0;
+
+ for (iPart p = editor->parts()->begin(); p != editor->parts()->end(); ++p)
+ {
+ Event last;
+ CEvent* lastce = 0;
+
+ MidiPart* part = (MidiPart*)(p->second);
+ EventList* el = part->events();
+ MidiController* mc;
+ MidiCtrlValList* mcvl;
+ partControllers(part, _cnum, 0, 0, &mc, &mcvl);
+ unsigned len = part->lenTick();
+
+ for (iEvent i = el->begin(); i != el->end(); ++i)
+ {
+ Event e = i->second;
+ // Added by T356. Do not add events which are past the end of the part.
+ if(e.tick() >= len)
+ break;
+
+ if(_cnum == CTRL_VELOCITY && e.type() == Note)
+ {
+ //printf("CtrlCanvas::updateItems CTRL_VELOCITY curDrumInstrument:%d\n", curDrumInstrument);
+ if(curDrumInstrument == -1)
+ {
+ // This is interesting - it would allow ALL drum note velocities to be shown.
+ // But currently the drum list ALWAYS has a selected item so this is not supposed to happen.
+ items.add(new CEvent(e, part, e.velo()));
+ }
+ else if (e.dataA() == curDrumInstrument) //same note
+ items.add(new CEvent(e, part, e.velo()));
+ }
+ else if (e.type() == Controller && e.dataA() == _didx)
+ {
+ if(mcvl && last.empty())
+ {
+ lastce = new CEvent(Event(), part, mcvl->value(part->tick()));
+ items.add(lastce);
+ }
+ if (lastce)
+ lastce->setEX(e.tick());
+ lastce = new CEvent(e, part, e.dataB());
+ lastce->setEX(-1);
+ items.add(lastce);
+ last = e;
+ }
+ }
+ }
+ }
+
+
+ redraw();
+ }
+
+//---------------------------------------------------------
+// viewMousePressEvent
+//---------------------------------------------------------
+
+void CtrlCanvas::viewMousePressEvent(QMouseEvent* event)
+ {
+ start = event->pos();
+ Tool activeTool = tool;
+ bool shift = event->state() & Qt::ShiftButton;
+
+ int xpos = start.x();
+ int ypos = start.y();
+
+ MidiController::ControllerType type = midiControllerType(_controller->num());
+
+ switch (activeTool) {
+ case PointerTool:
+ drag = DRAG_LASSO_START;
+ break;
+
+ case PencilTool:
+ if (shift) {
+ if (type != MidiController::Velo) {
+ drag = DRAG_NEW;
+ song->startUndo();
+ newVal(xpos, xpos, ypos);
+ }
+ }
+ else {
+ drag = DRAG_RESIZE;
+ song->startUndo();
+ changeVal(xpos, xpos, ypos);
+ }
+ break;
+
+ case RubberTool:
+ if (type != MidiController::Velo) {
+ drag = DRAG_DELETE;
+ song->startUndo();
+ deleteVal(xpos, xpos, ypos);
+ }
+ break;
+
+ case DrawTool:
+ if (drawLineMode) {
+ line2x = xpos;
+ line2y = ypos;
+ if (shift)
+ newValRamp(line1x, line1y, line2x, line2y);
+ else
+ changeValRamp(line1x, line1y, line2x, line2y);
+ drawLineMode = false;
+ }
+ else {
+ line2x = line1x = xpos;
+ line2y = line1y = ypos;
+ drawLineMode = true;
+ }
+ redraw();
+ break;
+
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// newValRamp
+//---------------------------------------------------------
+
+void CtrlCanvas::newValRamp(int x1, int y1, int x2, int y2)
+ {
+ int xx1 = editor->rasterVal1(x1);
+ int xx2 = editor->rasterVal2(x2);
+ int type = _controller->num();
+
+ int raster = editor->raster();
+ if (raster == 1) // set reasonable raster
+ raster = config.division/4;
+
+ song->startUndo();
+
+ // delete existing events
+
+ int lastpv = CTRL_VAL_UNKNOWN;
+ for (ciCEvent i = items.begin(); i != items.end(); ++i) {
+ CEvent* ev = *i;
+ if(ev->part() != curPart)
+ continue;
+ Event event = ev->event();
+ if (event.empty())
+ continue;
+ int x = event.tick() + curPart->tick();
+ // Added by Tim. p3.3.6
+ //printf("CtrlCanvas::newValRamp x:%d xx1:%d xx2:%d len:%d\n", x, xx1, xx2, curPart->lenTick());
+
+ if (x < xx1)
+ {
+ // if(event.dataB() != CTRL_VAL_UNKNOWN)
+ // lastpv = event.dataB();
+ continue;
+ }
+ //if (x <= xx1)
+ //{
+ // if(type == CTRL_PROGRAM && event.dataB() != CTRL_VAL_UNKNOWN && ((event.dataB() & 0xffffff) != 0xffffff))
+ // lastpv = event.dataB();
+ // if (x < xx1)
+ // continue;
+ //}
+ if (x >= xx2)
+ break;
+
+ // Indicate no undo, and do port controller values and clone parts.
+ //audio->msgDeleteEvent(event, ev->part(), false);
+ audio->msgDeleteEvent(event, curPart, false, true, true);
+ }
+
+ //if(type == CTRL_PROGRAM && lastpv == CTRL_VAL_UNKNOWN)
+ if(ctrl)
+ lastpv = ctrl->hwVal();
+
+ // insert new events
+ for (int x = xx1; x < xx2; x += raster) {
+ int y = (x2==x1) ? y1 : (((y2-y1)*(x-x1))/(x2-x1))+y1;
+ int nval = computeVal(_controller, y, height());
+ int tick = x - curPart->tick();
+ // Do not add events which are past the end of the part.
+ if((unsigned)tick >= curPart->lenTick())
+ break;
+ Event event(Controller);
+ event.setTick(tick);
+ event.setA(_didx);
+ if(type == CTRL_PROGRAM)
+ {
+ if(lastpv == CTRL_VAL_UNKNOWN)
+ {
+ if(song->mtype() == MT_GM)
+ event.setB(0xffff00 | (nval - 1));
+ else
+ event.setB(nval - 1);
+ }
+ else
+ event.setB((lastpv & 0xffff00) | (nval - 1));
+ }
+ else
+ event.setB(nval);
+
+ // Indicate no undo, and do port controller values and clone parts.
+ //audio->msgAddEvent(event, curPart, false);
+ audio->msgAddEvent(event, curPart, false, true, true);
+ }
+
+ song->update(0);
+ redraw();
+ song->endUndo(SC_EVENT_MODIFIED | SC_EVENT_INSERTED | SC_EVENT_REMOVED);
+ }
+
+//---------------------------------------------------------
+// changeValRamp
+//---------------------------------------------------------
+
+void CtrlCanvas::changeValRamp(int x1, int y1, int x2, int y2)
+ {
+ int h = height();
+ bool changed = false;
+ int type = _controller->num();
+ //int xx1 = editor->rasterVal1(x1);
+
+ song->startUndo();
+ for (ciCEvent i = items.begin(); i != items.end(); ++i) {
+ if ((*i)->contains(x1, x2)) {
+ //if ((*i)->contains(xx1, x2)) {
+ CEvent* ev = *i;
+ if(ev->part() != curPart)
+ continue;
+ Event event = ev->event();
+ if (event.empty())
+ continue;
+
+ //MidiPart* part = ev->part();
+ //int x = event.tick() + ev->part()->tick();
+ int x = event.tick() + curPart->tick();
+ int y = (x2==x1) ? y1 : (((y2-y1)*(x-x1))/(x2-x1))+y1;
+ int nval = computeVal(_controller, y, h);
+ if(type == CTRL_PROGRAM)
+ {
+ if(event.dataB() == CTRL_VAL_UNKNOWN)
+ {
+ --nval;
+ if(song->mtype() == MT_GM)
+ nval |= 0xffff00;
+ }
+ else
+ nval = (event.dataB() & 0xffff00) | (nval - 1);
+ }
+
+ ev->setVal(nval);
+
+ //MidiController::ControllerType type = midiControllerType(_controller->num());
+ //if (type == MidiController::Velo) {
+ if (type == CTRL_VELOCITY) {
+ if ((event.velo() != nval)) {
+ Event newEvent = event.clone();
+ newEvent.setVelo(nval);
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, part, false);
+ audio->msgChangeEvent(event, newEvent, curPart, false, false, false);
+ ev->setEvent(newEvent);
+ changed = true;
+ }
+ }
+ else {
+ if (!event.empty()) {
+ if ((event.dataB() != nval)) {
+ Event newEvent = event.clone();
+ newEvent.setB(nval);
+ // Indicate no undo, and do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, part, false);
+ audio->msgChangeEvent(event, newEvent, curPart, false, true, true);
+ ev->setEvent(newEvent);
+ changed = true;
+ }
+ }
+ else {
+ //if(!ctrl)
+ //{
+ // ctrl =
+ //}
+
+ // Removed by T356. Never gets here? A good thing, don't wan't auto-create values.
+ //int oval = ctrl->value(0);
+ //if (oval != nval) {
+ // Changed by T356.
+ //ctrl->add(0, nval);
+ // ctrl->add(0, nval, part);
+ // changed = true;
+ // }
+
+ }
+ }
+ }
+ }
+ if (changed)
+ redraw();
+ song->endUndo(SC_EVENT_MODIFIED);
+ }
+
+//---------------------------------------------------------
+// viewMouseMoveEvent
+//---------------------------------------------------------
+
+void CtrlCanvas::viewMouseMoveEvent(QMouseEvent* event)
+ {
+ QPoint pos = event->pos();
+ QPoint dist = pos - start;
+ bool moving = dist.y() >= 3 || dist.y() <= 3 || dist.x() >= 3 || dist.x() <= 3;
+ switch (drag) {
+ case DRAG_LASSO_START:
+ if (!moving)
+ break;
+ drag = DRAG_LASSO;
+ // weiter mit DRAG_LASSO:
+ case DRAG_LASSO:
+ lasso.setRect(start.x(), start.y(), dist.x(), dist.y());
+ redraw();
+ break;
+ case DRAG_RESIZE:
+ changeVal(start.x(), pos.x(), pos.y());
+ start = pos;
+ break;
+
+ case DRAG_NEW:
+ newVal(start.x(), pos.x(), pos.y());
+ start = pos;
+ break;
+
+ case DRAG_DELETE:
+ deleteVal(start.x(), pos.x(), pos.y());
+ start = pos;
+ break;
+
+ default:
+ break;
+ }
+ if (tool == DrawTool && drawLineMode) {
+ line2x = pos.x();
+ line2y = pos.y();
+ redraw();
+ }
+ emit xposChanged(pos.x());
+
+
+ int val = computeVal(_controller, pos.y(), height());
+ emit yposChanged(val);
+ }
+
+//---------------------------------------------------------
+// viewMouseReleaseEvent
+//---------------------------------------------------------
+
+void CtrlCanvas::viewMouseReleaseEvent(QMouseEvent* event)
+ {
+ bool shift = event->state() & Qt::ShiftButton;
+
+ switch (drag) {
+ case DRAG_RESIZE:
+ case DRAG_NEW:
+ case DRAG_DELETE:
+ song->endUndo(SC_EVENT_MODIFIED | SC_EVENT_INSERTED);
+ break;
+
+ case DRAG_LASSO_START:
+ lasso.setRect(-1, -1, -1, -1);
+
+ case DRAG_LASSO:
+ if (!shift)
+ deselectAll();
+ lasso = lasso.normalize();
+ for (iCEvent i = items.begin(); i != items.end(); ++i) {
+#if 0
+ if ((*i)->intersects(lasso)) {
+ if (shift && (*i)->isSelected())
+ deselectItem(*i);
+ else
+ selectItem(*i);
+ }
+#endif
+ }
+ drag = DRAG_OFF;
+ redraw();
+ break;
+
+ default:
+ break;
+ }
+ drag = DRAG_OFF;
+ }
+
+//---------------------------------------------------------
+// changeVal
+//---------------------------------------------------------
+
+void CtrlCanvas::changeVal(int x1, int x2, int y)
+ {
+ bool changed = false;
+ int newval = computeVal(_controller, y, height());
+ int type = _controller->num();
+ //int xx1 = editor->rasterVal1(x1);
+
+ for (ciCEvent i = items.begin(); i != items.end(); ++i) {
+ if (!(*i)->contains(x1, x2))
+ //if (!(*i)->contains(xx1, x2))
+ continue;
+ CEvent* ev = *i;
+ if(ev->part() != curPart)
+ continue;
+ Event event = ev->event();
+ //if(event.tick() >= curPart->lenTick())
+ // break;
+
+ //MidiPart* part = ev->part();
+ //int nval = newval;
+ //if(type == CTRL_PROGRAM)
+ //{
+ // if(event.dataB() == CTRL_VAL_UNKNOWN)
+ // {
+ // --nval;
+ // if(song->mtype() == MT_GM)
+ // nval |= 0xffff00;
+ // }
+ // else
+ // nval = (event.dataB() & 0xffff00) | (nval - 1);
+ //}
+ //ev->setVal(nval);
+
+ //MidiController::ControllerType type = midiControllerType(_controller->num());
+ //if (type == MidiController::Velo) {
+ if (type == CTRL_VELOCITY) {
+ if ((event.velo() != newval)) {
+ ev->setVal(newval);
+ Event newEvent = event.clone();
+ newEvent.setVelo(newval);
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, part, false);
+ audio->msgChangeEvent(event, newEvent, curPart, false, false, false);
+ ev->setEvent(newEvent);
+ changed = true;
+ }
+ }
+ else {
+ if (!event.empty()) {
+ int nval = newval;
+ if(type == CTRL_PROGRAM)
+ {
+ if(event.dataB() == CTRL_VAL_UNKNOWN)
+ {
+ --nval;
+ if(song->mtype() == MT_GM)
+ nval |= 0xffff00;
+ }
+ else
+ nval = (event.dataB() & 0xffff00) | (nval - 1);
+ }
+ ev->setVal(nval);
+
+ if ((event.dataB() != nval)) {
+ Event newEvent = event.clone();
+ newEvent.setB(nval);
+ // Indicate no undo, and do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, part, false);
+ audio->msgChangeEvent(event, newEvent, curPart, false, true, true);
+ ev->setEvent(newEvent);
+ changed = true;
+ }
+ }
+ else {
+ //if(!ctrl)
+ //{
+ // ctrl =
+ //}
+
+ // Removed by T356. Never gets here? A good thing, don't wan't auto-create values.
+ //int oval = ctrl->value(0);
+ //if (oval != nval) {
+ // Changed by T356.
+ //ctrl->add(0, nval);
+ // ctrl->add(0, nval, part);
+ // changed = true;
+ // }
+ }
+ }
+ }
+ if (changed)
+ redraw();
+ }
+
+//---------------------------------------------------------
+// newVal
+//---------------------------------------------------------
+
+void CtrlCanvas::newVal(int x1, int x2, int y)
+ {
+ int xx1 = editor->rasterVal1(x1);
+ int xx2 = editor->rasterVal2(x2);
+ int newval = computeVal(_controller, y, height());
+ int type = _controller->num();
+
+ bool found = false;
+ bool song_changed = false;
+
+ int lastpv = CTRL_VAL_UNKNOWN;
+ if(ctrl)
+ lastpv = ctrl->hwVal();
+
+ for (ciCEvent i = items.begin(); i != items.end(); ++i) {
+ CEvent* ev = *i;
+ if(ev->part() != curPart)
+ continue;
+ //int partTick = ev->part()->tick();
+ int partTick = curPart->tick();
+ Event event = ev->event();
+ if (event.empty())
+ continue;
+ int ax = event.tick() + partTick;
+ // Added by Tim. p3.3.6
+ //printf("CtrlCanvas::newVal ax:%d xx1:%d xx2:%d len:%d\n", ax, xx1, xx2, curPart->lenTick());
+
+ if (ax < xx1)
+ continue;
+ //if(ax <= xx1)
+ //{
+ // if(type == CTRL_PROGRAM && event.dataB() != CTRL_VAL_UNKNOWN && ((event.dataB() & 0xffffff) != 0xffffff))
+ // lastpv = event.dataB();
+ // if(ax < xx1)
+ // continue;
+ //}
+ if (ax >= xx2)
+ break;
+
+ // Added by T356. Do not add events which are past the end of the part.
+ //if(event.tick() >= curPart->lenTick())
+ // break;
+
+ int nval = newval;
+ if(type == CTRL_PROGRAM)
+ {
+ if(event.dataB() == CTRL_VAL_UNKNOWN)
+ {
+ //if(lastpv == CTRL_VAL_UNKNOWN)
+ // lastpv = ctrl->hwVal();
+
+ if(lastpv == CTRL_VAL_UNKNOWN)
+ {
+ --nval;
+ if(song->mtype() == MT_GM)
+ nval |= 0xffff00;
+ }
+ else
+ nval = (lastpv & 0xffff00) | (nval - 1);
+ }
+ else
+ nval = (event.dataB() & 0xffff00) | (nval - 1);
+ }
+
+ if (ax == xx1) {
+ // change event
+ found = true;
+ ev->setVal(nval);
+ if ((event.dataB() != nval)) {
+ Event newEvent = event.clone();
+ newEvent.setB(nval);
+ // Added by Tim. p3.3.6
+ //printf("CtrlCanvas::newVal change xx1:%d xx2:%d len:%d\n", xx1, xx2, curPart->lenTick());
+
+ // Indicate no undo, and do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, ev->part(), false);
+ audio->msgChangeEvent(event, newEvent, curPart, false, true, true);
+
+ ev->setEvent(newEvent);
+ song_changed = true;
+ }
+ }
+ else if (ax < xx2) {
+ // delete event
+ // Added by Tim. p3.3.6
+ //printf("CtrlCanvas::newVal delete xx1:%d xx2:%d len:%d\n", xx1, xx2, curPart->lenTick());
+
+ // Indicate no undo, and do port controller values and clone parts.
+ //audio->msgDeleteEvent(event, ev->part(), false);
+ audio->msgDeleteEvent(event, curPart, false, true, true);
+
+ song_changed = true;
+ }
+ }
+ if (!found) {
+ // new event
+ int tick = xx1 - curPart->tick();
+ // Do not add events which are past the end of the part.
+ if((unsigned)tick < curPart->lenTick())
+ {
+ Event event(Controller);
+ event.setTick(tick);
+ event.setA(_didx);
+ if(type == CTRL_PROGRAM)
+ {
+ if(lastpv == CTRL_VAL_UNKNOWN)
+ {
+ if(song->mtype() == MT_GM)
+ event.setB(0xffff00 | (newval - 1));
+ else
+ event.setB(newval - 1);
+ }
+ else
+ event.setB((lastpv & 0xffff00) | (newval - 1));
+ }
+ else
+ event.setB(newval);
+
+ // Indicate no undo, and do port controller values and clone parts.
+ //audio->msgAddEvent(event, curPart, false);
+ audio->msgAddEvent(event, curPart, false, true, true);
+
+ song_changed = true;
+ }
+ }
+ if (song_changed) {
+ songChanged(0);
+ return;
+ }
+ redraw();
+ }
+
+//---------------------------------------------------------
+// deleteVal
+//---------------------------------------------------------
+
+void CtrlCanvas::deleteVal(int x1, int x2, int)
+ {
+ int xx1 = editor->rasterVal1(x1);
+ int xx2 = editor->rasterVal2(x2);
+
+ int partTick = curPart->tick();
+ xx1 -= partTick;
+ xx2 -= partTick;
+
+ bool song_changed = false;
+ for (ciCEvent i = items.begin(); i != items.end(); ++i) {
+ CEvent* ev = *i;
+ if(ev->part() != curPart)
+ continue;
+ Event event = ev->event();
+ if (event.empty())
+ continue;
+ int x = event.tick();
+ if (x < xx1)
+ continue;
+ if (x >= xx2)
+ break;
+ if (!event.empty()) {
+ // Indicate no undo, and do port controller values and clone parts.
+ //audio->msgDeleteEvent(event, ev->part(), false);
+ audio->msgDeleteEvent(event, curPart, false, true, true);
+ song_changed = true;
+ }
+ }
+ if (song_changed) {
+ songChanged(0);
+ return;
+ }
+ }
+
+//---------------------------------------------------------
+// setTool
+//---------------------------------------------------------
+
+void CtrlCanvas::setTool(int t)
+ {
+ if (tool == Tool(t))
+ return;
+ tool = Tool(t);
+ switch(tool) {
+ case PencilTool:
+ setCursor(QCursor(*pencilIcon, 4, 15));
+ break;
+ case DrawTool:
+ drawLineMode = false;
+ break;
+ default:
+ setCursor(QCursor(Qt::arrowCursor));
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// pdrawItems
+//---------------------------------------------------------
+
+void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part, bool velo, bool fg)
+{
+ int x = rect.x() - 1; // compensate for 3 pixel line width
+ int w = rect.width() + 2;
+ int wh = height();
+
+ if(velo)
+ {
+ for(iCEvent i = items.begin(); i != items.end(); ++i)
+ {
+ CEvent* e = *i;
+ // Draw selected part velocity events on top of unselected part events.
+ //if((fg && e->part() != part) || (!fg && e->part() == part))
+ if(e->part() != part)
+ continue;
+ int tick = mapx(e->event().tick() + e->part()->tick());
+ if (tick <= x)
+ continue;
+ if (tick > x+w)
+ break;
+ int y1 = wh - (e->val() * wh / 128);
+ // fg means 'draw selected parts'.
+ if(fg)
+ p.setPen(QPen(config.ctrlGraphFg, 3));
+ else
+ p.setPen(QPen(Qt::darkGray, 3));
+ p.drawLine(tick, wh, tick, y1);
+ }
+ }
+ else
+ {
+ MidiTrack* mt = part->track();
+ MidiPort* mp;
+
+ if((mt->type() == Track::DRUM) && (curDrumInstrument != -1) && ((_cnum & 0xff) == 0xff))
+ mp = &midiPorts[drumMap[curDrumInstrument].port];
+ else
+ mp = &midiPorts[mt->outPort()];
+
+ MidiController* mc = mp->midiController(_cnum);
+
+ int min;
+ int max;
+ int bias;
+ if(_cnum == CTRL_PROGRAM)
+ {
+ min = 1;
+ max = 128;
+ bias = 0;
+ }
+ else
+ {
+ min = mc->minVal();
+ max = mc->maxVal();
+ bias = mc->bias();
+ }
+ int x1 = rect.x();
+ int lval = CTRL_VAL_UNKNOWN;
+ noEvents=false;
+ for (iCEvent i = items.begin(); i != items.end(); ++i)
+ {
+ CEvent* e = *i;
+ // Draw unselected part controller events (lines) on top of selected part events (bars).
+ //if((fg && (e->part() == part)) || (!fg && (e->part() != part)))
+ if(e->part() != part)
+ {
+ continue;
+ }
+ Event ev = e->event();
+ int tick = mapx(!ev.empty() ? ev.tick() + e->part()->tick() : 0);
+ int val = e->val();
+ int pval = val;
+ if(_cnum == CTRL_PROGRAM)
+ {
+ if((val & 0xff) == 0xff)
+ // What to do here? prog = 0xff should not be allowed, but may still be encountered.
+ pval = 1;
+ else
+ pval = (val & 0x7f) + 1;
+ }
+ if (tick <= x) {
+ if (val == CTRL_VAL_UNKNOWN)
+ lval = CTRL_VAL_UNKNOWN;
+ else
+ {
+ if(_cnum == CTRL_PROGRAM)
+ lval = wh - ((pval - min - bias) * wh / (max - min));
+ else
+ lval = wh - ((val - min - bias) * wh / (max - min));
+ }
+ continue;
+ }
+ if (tick > x+w)
+ break;
+ if (lval == CTRL_VAL_UNKNOWN)
+ {
+ // fg means 'draw unselected parts'.
+ if(!fg)
+ p.fillRect(x1, 0, tick - x1, wh, Qt::darkGray);
+ }
+ else
+ {
+ if(fg)
+ {
+ p.setPen(Qt::gray);
+ p.drawLine(x1, lval, tick, lval);
+ }
+ else
+ p.fillRect(x1, lval, tick - x1, wh - lval, config.ctrlGraphFg);
+ }
+
+
+ x1 = tick;
+ if (val == CTRL_VAL_UNKNOWN)
+ lval = CTRL_VAL_UNKNOWN;
+ else
+ {
+ if(_cnum == CTRL_PROGRAM)
+ lval = wh - ((pval - min - bias) * wh / (max - min));
+ else
+ lval = wh - ((val - min - bias) * wh / (max - min));
+ }
+ }
+ if (lval == CTRL_VAL_UNKNOWN)
+ {
+ if(!fg) {
+ p.fillRect(x1, 0, (x+w) - x1, wh, Qt::darkGray);
+ noEvents=true;
+ }
+ }
+ else
+ {
+ if(fg)
+ {
+ p.setPen(Qt::gray);
+ p.drawLine(x1, lval, x + w, lval);
+ }
+ else
+ p.fillRect(x1, lval, (x+w) - x1, wh - lval, config.ctrlGraphFg);
+ }
+ }
+}
+
+//---------------------------------------------------------
+// pdraw
+//---------------------------------------------------------
+
+void CtrlCanvas::pdraw(QPainter& p, const QRect& rect)
+ {
+
+ int x = rect.x() - 1; // compensate for 3 pixel line width
+ int y = rect.y();
+ int w = rect.width() + 2;
+ int h = rect.height();
+
+
+ //---------------------------------------------------
+ // draw Canvas Items
+ //---------------------------------------------------
+
+ bool velo = (midiControllerType(_controller->num()) == MidiController::Velo);
+ if(!velo)
+ {
+ pdrawItems(p, rect, curPart, false, false);
+ }
+ for(iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip)
+ {
+ MidiPart* part = (MidiPart*)(ip->second);
+ //if((velo && part == curPart) || (!velo && part != curPart))
+ if(part == curPart)
+ continue;
+ pdrawItems(p, rect, part, velo, !velo);
+ }
+ if(velo)
+ {
+ pdrawItems(p, rect, curPart, true, true);
+ }
+
+ p.save();
+ View::pdraw(p, rect);
+ p.restore();
+
+ //---------------------------------------------------
+ // draw marker
+ //---------------------------------------------------
+
+ int xp = mapx(pos[0]);
+ if (xp >= x && xp < x+w) {
+ p.setPen(Qt::red);
+ p.drawLine(xp, y, xp, y+h);
+ }
+ xp = mapx(pos[1]);
+ if (xp >= x && xp < x+w) {
+ p.setPen(Qt::blue);
+ p.drawLine(xp, y, xp, y+h);
+ }
+ xp = mapx(pos[2]);
+ if (xp >= x && xp < x+w) {
+ p.setPen(Qt::blue);
+ p.drawLine(xp, y, xp, y+h);
+ }
+
+ //---------------------------------------------------
+ // draw lasso
+ //---------------------------------------------------
+
+ if (drag == DRAG_LASSO) {
+ setPainter(p);
+ p.setPen(Qt::blue);
+ p.setBrush(Qt::NoBrush);
+ p.drawRect(lasso);
+ }
+ }
+
+//---------------------------------------------------------
+// drawOverlay
+//---------------------------------------------------------
+
+void CtrlCanvas::drawOverlay(QPainter& p)
+ {
+ QString s(_controller->name());
+ p.setFont(config.fonts[3]);
+ p.setPen(Qt::black);
+ QFontMetrics fm(config.fonts[3]);
+ int y = fm.lineSpacing() + 2;
+ p.drawText(2, y, s);
+ if (noEvents) {
+ p.setFont(config.fonts[3]);
+ p.setPen(Qt::black);
+ p.drawText(width()/2-100,height()/2-10, "Use shift + pencil or line tool to draw new events");
+ //p.drawText(2 , y * 2, "Use shift + pencil or line tool to draw new events");
+ }
+ }
+
+//---------------------------------------------------------
+// overlayRect
+// returns geometry of overlay rectangle
+//---------------------------------------------------------
+
+QRect CtrlCanvas::overlayRect() const
+ {
+ QFontMetrics fm(config.fonts[3]);
+ QRect r(fm.boundingRect(_controller ? _controller->name() : QString("")));
+ r.moveBy(2, 2); // top/left margin
+ return r;
+ }
+
+//---------------------------------------------------------
+// draw
+//---------------------------------------------------------
+
+void CtrlCanvas::draw(QPainter& p, const QRect& rect)
+ {
+ drawTickRaster(p, rect.x(), rect.y(),
+ //rect.width(), rect.height(), editor->quant());
+ rect.width(), rect.height(), editor->raster());
+
+ //---------------------------------------------------
+ // draw line tool
+ //---------------------------------------------------
+
+ if (drawLineMode && (tool == DrawTool)) {
+ p.setPen(Qt::black);
+ p.drawLine(line1x, line1y, line2x, line2y);
+ }
+ }
+
+//---------------------------------------------------------
+// setCurDrumInstrument
+//---------------------------------------------------------
+
+void CtrlCanvas::setCurDrumInstrument(int di)
+ {
+ curDrumInstrument = di;
+ //printf("CtrlCanvas::setCurDrumInstrument curDrumInstrument:%d\n", curDrumInstrument);
+
+ //
+ // check if current controller is only valid for
+ // a specific drum instrument
+ //
+ // Removed by T356.
+ //if(curTrack && (curTrack->type() == Track::DRUM) && ((_controller->num() & 0xff) == 0xff)) {
+ //if(curTrack && (curTrack->type() == Track::DRUM) && ((_cnum & 0xff) == 0xff)) {
+ // reset to default
+ // TODO: check, if new drum instrument has a similar controller
+ // configured
+ // _cnum = CTRL_VELOCITY;
+ // }
+ // Removed by T356
+ //songChanged(-1);
+ }
diff --git a/muse2/muse/ctrl/ctrlcanvas.h b/muse2/muse/ctrl/ctrlcanvas.h
new file mode 100644
index 00000000..bb17fafb
--- /dev/null
+++ b/muse2/muse/ctrl/ctrlcanvas.h
@@ -0,0 +1,165 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ctrlcanvas.h,v 1.7.2.4 2009/06/01 20:15:53 spamatica Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __CTRLCANVAS_H__
+#define __CTRLCANVAS_H__
+
+#include <list>
+
+
+#include "view.h"
+#include "tools.h"
+#include "midictrl.h"
+#include "event.h"
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QEvent>
+
+class Event;
+class MidiPart;
+class PartList;
+class MidiTrack;
+class MidiEditor;
+class QWidget;
+class CtrlPanel;
+
+//---------------------------------------------------------
+// CEvent
+// ''visual'' Controller Event
+//---------------------------------------------------------
+
+class CEvent {
+ Event _event;
+ int _val;
+ MidiPart* _part;
+ int ex;
+
+ public:
+ CEvent(Event e, MidiPart* part, int v);
+ Event event() const { return _event; }
+ void setEvent(Event& ev) { _event = ev; }
+ int val() const { return _val; }
+ void setVal(int v) { _val = v; }
+ void setEX(int v) { ex = v; }
+ MidiPart* part() const { return _part; }
+ bool contains(int x1, int x2) const;
+ int x() { return ex; }
+ };
+
+typedef std::list<CEvent*>::iterator iCEvent;
+typedef std::list<CEvent*>::const_iterator ciCEvent;
+
+//---------------------------------------------------------
+// CEventList
+// Controller Item List
+//---------------------------------------------------------
+
+class CEventList: public std::list<CEvent*> {
+ public:
+ void add(CEvent* item) { push_back(item); }
+
+ void clearDelete();
+ };
+
+//---------------------------------------------------------
+// CtrlCanvas
+//---------------------------------------------------------
+
+class CtrlCanvas : public View {
+ MidiEditor* editor;
+ MidiTrack* curTrack;
+ MidiPart* curPart;
+ MidiCtrlValList* ctrl;
+ MidiController* _controller;
+ CtrlPanel* _panel;
+ int _cnum;
+ // Current real drum controller number (anote).
+ int _dnum;
+ // Current real drum controller index.
+ int _didx;
+ int line1x;
+ int line1y;
+ int line2x;
+ int line2y;
+ bool drawLineMode;
+ bool noEvents;
+
+ void viewMousePressEvent(QMouseEvent* event);
+ void viewMouseMoveEvent(QMouseEvent*);
+ void viewMouseReleaseEvent(QMouseEvent*);
+
+ virtual void draw(QPainter&, const QRect&);
+ virtual void pdraw(QPainter&, const QRect&);
+ virtual void drawOverlay(QPainter& p);
+ virtual QRect overlayRect() const;
+
+ void changeValRamp(int x1, int x2, int y1, int y2);
+ void newValRamp(int x1, int y1, int x2, int y2);
+ void changeVal(int x1, int x2, int y);
+ void newVal(int x1, int x2, int y);
+ void deleteVal(int x1, int x2, int y);
+
+ bool setCurTrackAndPart();
+ void pdrawItems(QPainter&, const QRect&, const MidiPart*, bool, bool);
+ void partControllers(const MidiPart*, int, int*, int*, MidiController**, MidiCtrlValList**);
+
+ Q_OBJECT
+
+ protected:
+ enum DragMode { DRAG_OFF, DRAG_NEW, DRAG_MOVE_START, DRAG_MOVE,
+ DRAG_DELETE, DRAG_COPY_START, DRAG_COPY,
+ DRAG_RESIZE, DRAG_LASSO_START, DRAG_LASSO
+ };
+
+ CEventList items;
+ CEventList selection;
+ CEventList moving;
+ CEvent* curItem;
+
+ DragMode drag;
+ QRect lasso;
+ QPoint start;
+ Tool tool;
+ unsigned pos[3];
+ int curDrumInstrument; //Used by the drum-editor to view velocity of only one key (one drum)
+
+ void leaveEvent(QEvent*e);
+ QPoint raster(const QPoint&) const;
+
+ // selection
+ bool isSingleSelection() { return selection.size() == 1; }
+ void deselectAll();
+ void selectItem(CEvent* e);
+ void deselectItem(CEvent* e);
+
+ void setMidiController(int);
+ void updateItems();
+
+ private slots:
+ void songChanged(int type);
+ void setCurDrumInstrument(int);
+
+ public slots:
+ void setTool(int t);
+ void setPos(int, unsigned, bool adjustScrollbar);
+ void setController(int ctrl);
+
+ signals:
+ void followEvent(int);
+ void xposChanged(unsigned);
+ void yposChanged(int);
+
+ public:
+ CtrlCanvas(MidiEditor*, QWidget* parent, int,
+ const char* name = 0, CtrlPanel* pnl = 0);
+ void setPanel(CtrlPanel* pnl) { _panel = pnl; }
+ MidiCtrlValList* ctrlValList() { return ctrl; }
+ MidiController* controller() { return _controller; }
+ MidiTrack* track() const { return curTrack; }
+ };
+#endif
+
diff --git a/muse2/muse/ctrl/ctrledit.cpp b/muse2/muse/ctrl/ctrledit.cpp
new file mode 100644
index 00000000..bca9d550
--- /dev/null
+++ b/muse2/muse/ctrl/ctrledit.cpp
@@ -0,0 +1,134 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ctrledit.cpp,v 1.4.2.2 2009/02/02 21:38:00 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include "ctrledit.h"
+#include "ctrlcanvas.h"
+#include "midieditor.h"
+#include "xml.h"
+#include "vscale.h"
+#include "ctrlpanel.h"
+#include "globals.h"
+#include "midiport.h"
+#include "instruments/minstrument.h"
+#include "gconfig.h"
+
+#include <qlayout.h>
+#include <qpainter.h>
+#include <qtoolbutton.h>
+#include <q3popupmenu.h>
+#include <qlabel.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+
+//---------------------------------------------------------
+// setTool
+//---------------------------------------------------------
+
+void CtrlEdit::setTool(int t)
+ {
+ canvas->setTool(t);
+ }
+
+//---------------------------------------------------------
+// CtrlEdit
+//---------------------------------------------------------
+
+CtrlEdit::CtrlEdit(QWidget* parent, MidiEditor* e, int xmag,
+ bool expand, const char* name) : QWidget(parent, name)
+ {
+ Q3HBoxLayout* hbox = new Q3HBoxLayout(this);
+ panel = new CtrlPanel(this, e, "panel");
+ canvas = new CtrlCanvas(e, this, xmag, "ctrlcanvas", panel);
+ QWidget* vscale = new VScale(this);
+
+ canvas->setOrigin(-(config.division/4), 0);
+
+ canvas->setMinimumHeight(50);
+
+ panel->setFixedWidth(CTRL_PANEL_FIXED_WIDTH);
+ hbox->addWidget(panel, expand ? 100 : 0, Qt::AlignRight);
+ hbox->addWidget(canvas, 100);
+ hbox->addWidget(vscale, 0);
+
+ connect(panel, SIGNAL(destroyPanel()), SLOT(destroy()));
+ connect(panel, SIGNAL(controllerChanged(int)), canvas, SLOT(setController(int)));
+ connect(canvas, SIGNAL(xposChanged(unsigned)), SIGNAL(timeChanged(unsigned)));
+ connect(canvas, SIGNAL(yposChanged(int)), SIGNAL(yposChanged(int)));
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void CtrlEdit::writeStatus(int level, Xml& xml)
+ {
+ if (canvas->controller()) {
+ xml.tag(level++, "ctrledit");
+ xml.strTag(level, "ctrl", canvas->controller()->name());
+ xml.tag(level, "/ctrledit");
+ }
+ }
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void CtrlEdit::readStatus(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "ctrl") {
+ QString name = xml.parse1();
+ int portno = canvas->track()->outPort();
+ MidiPort* port = &midiPorts[portno];
+ MidiInstrument* instr = port->instrument();
+ MidiControllerList* mcl = instr->controller();
+
+ for (iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) {
+ if (ci->second->name() == name) {
+ canvas->setController(ci->second->num());
+ break;
+ }
+ }
+ }
+ else
+ xml.unknown("CtrlEdit");
+ break;
+ case Xml::TagEnd:
+ if (tag == "ctrledit")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// destroy
+//---------------------------------------------------------
+
+void CtrlEdit::destroy()
+ {
+ emit destroyedCtrl(this);
+ close(true); // close and destroy widget
+ }
+
+//---------------------------------------------------------
+// setCanvasWidth
+//---------------------------------------------------------
+
+void CtrlEdit::setCanvasWidth(int w)
+{
+ canvas->setFixedWidth(w);
+}
diff --git a/muse2/muse/ctrl/ctrledit.h b/muse2/muse/ctrl/ctrledit.h
new file mode 100644
index 00000000..2af7c528
--- /dev/null
+++ b/muse2/muse/ctrl/ctrledit.h
@@ -0,0 +1,56 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ctrledit.h,v 1.4.2.1 2008/05/21 00:28:53 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __CTRL_EDIT_H__
+#define __CTRL_EDIT_H__
+
+#include <qwidget.h>
+//Added by qt3to4:
+#include <QLabel>
+#include "ctrlcanvas.h"
+#include "song.h"
+
+class MidiEditor;
+class QLabel;
+class QToolButton;
+class CtrlView;
+class CtrlPanel;
+class Xml;
+
+#define CTRL_PANEL_FIXED_WIDTH 40
+//---------------------------------------------------------
+// CtrlEdit
+//---------------------------------------------------------
+
+class CtrlEdit : public QWidget {
+ CtrlCanvas* canvas;
+ CtrlPanel* panel;
+ Q_OBJECT
+
+ private slots:
+ void destroy();
+
+ public slots:
+ void setTool(int tool);
+ void setXPos(int val) { canvas->setXPos(val); }
+ void setXMag(int val) { canvas->setXMag(val); }
+ void setCanvasWidth(int w);
+ signals:
+ void timeChanged(unsigned);
+ void destroyedCtrl(CtrlEdit*);
+ void enterCanvas();
+ void yposChanged(int);
+
+ public:
+ CtrlEdit(QWidget*, MidiEditor* e, int xmag,
+ bool expand = false, const char* name = 0);
+ void readStatus(Xml&);
+ void writeStatus(int, Xml&);
+ };
+
+#endif
+
diff --git a/muse2/muse/ctrl/ctrlpanel.cpp b/muse2/muse/ctrl/ctrlpanel.cpp
new file mode 100644
index 00000000..820e6428
--- /dev/null
+++ b/muse2/muse/ctrl/ctrlpanel.cpp
@@ -0,0 +1,694 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ctrlpanel.cpp,v 1.10.2.9 2009/06/14 05:24:45 terminator356 Exp $
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <list>
+
+#include "ctrlpanel.h"
+#include "ctrlcanvas.h"
+
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <q3popupmenu.h>
+#include <qlabel.h>
+#include <qtooltip.h>
+#include <qsizepolicy.h>
+#include <qtimer.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
+#include <math.h>
+
+#include "globals.h"
+#include "midictrl.h"
+#include "instruments/minstrument.h"
+#include "midiport.h"
+#include "xml.h"
+#include "icons.h"
+#include "event.h"
+#include "midieditor.h"
+#include "track.h"
+#include "part.h"
+#include "midiedit/drummap.h"
+#include "gconfig.h"
+#include "song.h"
+#include "knob.h"
+#include "doublelabel.h"
+#include "midi.h"
+#include "audio.h"
+
+//---------------------------------------------------------
+// CtrlPanel
+//---------------------------------------------------------
+
+CtrlPanel::CtrlPanel(QWidget* parent, MidiEditor* e, const char* name)
+ : QWidget(parent, name)
+ {
+ inHeartBeat = true;
+ editor = e;
+ setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
+ Q3VBoxLayout* vbox = new Q3VBoxLayout(this);
+ Q3HBoxLayout* bbox = new Q3HBoxLayout(vbox);
+ vbox->addStretch();
+ Q3HBoxLayout* kbox = new Q3HBoxLayout(vbox);
+ Q3HBoxLayout* dbox = new Q3HBoxLayout(vbox);
+ vbox->addStretch();
+ selCtrl = new QPushButton(tr("S"), this, "selCtrl");
+ selCtrl->setFont(config.fonts[3]);
+ selCtrl->setFixedHeight(20);
+ selCtrl->setSizePolicy(
+ QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+ QToolTip::add(selCtrl, tr("select controller"));
+ pop = new Q3PopupMenu(selCtrl);
+
+ // destroy button
+ QPushButton* destroy = new QPushButton(tr("X"), this, "destroy");
+ destroy->setFont(config.fonts[3]);
+ destroy->setFixedHeight(20);
+ destroy->setSizePolicy(
+ QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+ QToolTip::add(destroy, tr("remove panel"));
+ // Cursor Position
+ connect(selCtrl, SIGNAL(clicked()), SLOT(ctrlPopup()));
+ connect(destroy, SIGNAL(clicked()), SIGNAL(destroyPanel()));
+
+ _track = 0;
+ _ctrl = 0;
+ _val = CTRL_VAL_UNKNOWN;
+ _dnum = -1;
+
+ _knob = new Knob(this);
+ _knob->setFixedWidth(25);
+ _knob->setFixedHeight(25);
+ QToolTip::add(_knob, tr("manual adjust"));
+ _knob->setRange(0.0, 127.0, 1.0);
+ _knob->setValue(0.0);
+ _knob->setEnabled(false);
+ _knob->hide();
+ _knob->setAltFaceColor(Qt::red);
+
+ _dl = new DoubleLabel(-1.0, 0.0, +127.0, this);
+ _dl->setPrecision(0);
+ QToolTip::add(_dl, tr("double click on/off"));
+ _dl->setSpecialText(tr("off"));
+ _dl->setFont(config.fonts[1]);
+ _dl->setBackgroundMode(Qt::PaletteMid);
+ _dl->setFrame(true);
+ _dl->setFixedWidth(36);
+ _dl->setFixedHeight(15);
+ _dl->setEnabled(false);
+ _dl->hide();
+
+ connect(_knob, SIGNAL(sliderMoved(double,int)), SLOT(ctrlChanged(double)));
+ connect(_knob, SIGNAL(sliderRightClicked(const QPoint&, int)), SLOT(ctrlRightClicked(const QPoint&, int)));
+ //connect(_knob, SIGNAL(sliderReleased(int)), SLOT(ctrlReleased(int)));
+ connect(_dl, SIGNAL(valueChanged(double,int)), SLOT(ctrlChanged(double)));
+ connect(_dl, SIGNAL(doubleClicked(int)), SLOT(labelDoubleClicked()));
+
+ bbox->addStretch();
+ bbox->addWidget(selCtrl);
+ bbox->addWidget(destroy);
+ bbox->addStretch();
+ kbox->addStretch();
+ kbox->addWidget(_knob);
+ kbox->addStretch();
+ dbox->addStretch();
+ dbox->addWidget(_dl);
+ dbox->addStretch();
+ connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat()));
+ inHeartBeat = false;
+ }
+//---------------------------------------------------------
+// heartBeat
+//---------------------------------------------------------
+
+void CtrlPanel::heartBeat()
+{
+ inHeartBeat = true;
+
+ if(_track && _ctrl && _dnum != -1)
+ {
+ //if(_dnum != CTRL_VELOCITY && _dnum != CTRL_PROGRAM)
+ if(_dnum != CTRL_VELOCITY)
+ {
+ int outport;
+ int chan;
+ int cdi = editor->curDrumInstrument();
+ if(_track->type() == Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdi != -1)
+ {
+ outport = drumMap[cdi].port;
+ chan = drumMap[cdi].channel;
+ }
+ else
+ {
+ outport = _track->outPort();
+ chan = _track->outChannel();
+ }
+ MidiPort* mp = &midiPorts[outport];
+
+ int v = mp->hwCtrlState(chan, _dnum);
+ if(v == CTRL_VAL_UNKNOWN)
+ {
+ // DoubleLabel ignores the value if already set...
+ _dl->setValue(_dl->off() - 1.0);
+ _val = CTRL_VAL_UNKNOWN;
+ v = mp->lastValidHWCtrlState(chan, _dnum);
+ if(v != CTRL_VAL_UNKNOWN && ((_dnum != CTRL_PROGRAM) || ((v & 0xff) != 0xff) ))
+ {
+ if(_dnum == CTRL_PROGRAM)
+ v = (v & 0x7f) + 1;
+ else
+ // Auto bias...
+ v -= _ctrl->bias();
+ if(double(v) != _knob->value())
+ {
+ // Added by Tim. p3.3.6
+ //printf("CtrlPanel::heartBeat setting knob\n");
+
+ _knob->setValue(double(v));
+ }
+ }
+ }
+ else
+ if(v != _val)
+ {
+ _val = v;
+ if(v == CTRL_VAL_UNKNOWN || ((_dnum == CTRL_PROGRAM) && ((v & 0xff) == 0xff) ))
+ {
+ // DoubleLabel ignores the value if already set...
+ //_dl->setValue(double(_ctrl->minVal() - 1));
+ _dl->setValue(_dl->off() - 1.0);
+ }
+ else
+ {
+ if(_dnum == CTRL_PROGRAM)
+ v = (v & 0x7f) + 1;
+ else
+ // Auto bias...
+ v -= _ctrl->bias();
+
+ // Added by Tim. p3.3.6
+ //printf("CtrlPanel::heartBeat setting knob and label\n");
+
+ _knob->setValue(double(v));
+ _dl->setValue(double(v));
+ }
+ }
+ }
+ }
+
+ inHeartBeat = false;
+}
+
+//---------------------------------------------------------
+// labelDoubleClicked
+//---------------------------------------------------------
+
+void CtrlPanel::labelDoubleClicked()
+{
+ if(!_track || !_ctrl || _dnum == -1)
+ return;
+
+ int outport;
+ int chan;
+ int cdi = editor->curDrumInstrument();
+ if(_track->type() == Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdi != -1)
+ {
+ outport = drumMap[cdi].port;
+ chan = drumMap[cdi].channel;
+ }
+ else
+ {
+ outport = _track->outPort();
+ chan = _track->outChannel();
+ }
+ MidiPort* mp = &midiPorts[outport];
+ int lastv = mp->lastValidHWCtrlState(chan, _dnum);
+
+ int curv = mp->hwCtrlState(chan, _dnum);
+
+ if(_dnum == CTRL_PROGRAM)
+ {
+ if(curv == CTRL_VAL_UNKNOWN || ((curv & 0xffffff) == 0xffffff))
+ {
+ // If no value has ever been set yet, use the current knob value
+ // (or the controller's initial value?) to 'turn on' the controller.
+ if(lastv == CTRL_VAL_UNKNOWN || ((lastv & 0xffffff) == 0xffffff))
+ {
+ //int kiv = _ctrl->initVal());
+ int kiv = lrint(_knob->value());
+ --kiv;
+ kiv &= 0x7f;
+ kiv |= 0xffff00;
+ //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, _dnum, kiv);
+ MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, _dnum, kiv);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ else
+ {
+ //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, _dnum, lastv);
+ MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, _dnum, lastv);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ }
+ else
+ {
+ //if((curv & 0xffff00) == 0xffff00)
+ //{
+ ////if(mp->hwCtrlState(chan, _dnum) != CTRL_VAL_UNKNOWN)
+ audio->msgSetHwCtrlState(mp, chan, _dnum, CTRL_VAL_UNKNOWN);
+ //}
+ //else
+ //{
+ // MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, _dnum, (curv & 0xffff00) | 0xff);
+ // audio->msgPlayMidiEvent(&ev);
+ //}
+ }
+ }
+ else
+ {
+ if(curv == CTRL_VAL_UNKNOWN)
+ {
+ // If no value has ever been set yet, use the current knob value
+ // (or the controller's initial value?) to 'turn on' the controller.
+ if(lastv == CTRL_VAL_UNKNOWN)
+ {
+ //int kiv = _ctrl->initVal());
+ int kiv = lrint(_knob->value());
+ if(kiv < _ctrl->minVal())
+ kiv = _ctrl->minVal();
+ if(kiv > _ctrl->maxVal())
+ kiv = _ctrl->maxVal();
+ kiv += _ctrl->bias();
+ //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, _dnum, kiv);
+ MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, _dnum, kiv);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ else
+ {
+ //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, _dnum, lastv);
+ MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, _dnum, lastv);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ }
+ else
+ {
+ //if(mp->hwCtrlState(chan, _dnum) != CTRL_VAL_UNKNOWN)
+ audio->msgSetHwCtrlState(mp, chan, _dnum, CTRL_VAL_UNKNOWN);
+ }
+ }
+ song->update(SC_MIDI_CONTROLLER);
+}
+
+//---------------------------------------------------------
+// ctrlChanged
+//---------------------------------------------------------
+
+void CtrlPanel::ctrlChanged(double val)
+ {
+ if (inHeartBeat)
+ return;
+ if(!_track || !_ctrl || _dnum == -1)
+ return;
+
+ int ival = lrint(val);
+
+ int outport;
+ int chan;
+ int cdi = editor->curDrumInstrument();
+ if(_track->type() == Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdi != -1)
+ {
+ outport = drumMap[cdi].port;
+ chan = drumMap[cdi].channel;
+ }
+ else
+ {
+ outport = _track->outPort();
+ chan = _track->outChannel();
+ }
+ MidiPort* mp = &midiPorts[outport];
+ int curval = mp->hwCtrlState(chan, _dnum);
+
+ if(_dnum == CTRL_PROGRAM)
+ {
+ --ival;
+ ival &= 0x7f;
+
+ if(curval == CTRL_VAL_UNKNOWN)
+ ival |= 0xffff00;
+ else
+ ival |= (curval & 0xffff00);
+ //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, _dnum, ival);
+ MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, _dnum, ival);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ else
+ // Shouldn't happen, but...
+ if((ival < _ctrl->minVal()) || (ival > _ctrl->maxVal()))
+ {
+ //if(mp->hwCtrlState(chan, _dnum) != CTRL_VAL_UNKNOWN)
+ if(curval != CTRL_VAL_UNKNOWN)
+ audio->msgSetHwCtrlState(mp, chan, _dnum, CTRL_VAL_UNKNOWN);
+ }
+ else
+ {
+ // Auto bias...
+ ival += _ctrl->bias();
+
+ //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, _dnum, ival);
+ MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, _dnum, ival);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ song->update(SC_MIDI_CONTROLLER);
+ }
+
+//---------------------------------------------------------
+// setHWController
+//---------------------------------------------------------
+
+void CtrlPanel::setHWController(MidiTrack* t, MidiController* ctrl)
+{
+ inHeartBeat = true;
+
+ _track = t; _ctrl = ctrl;
+
+ if(!_track || !_ctrl)
+ {
+ _knob->setEnabled(false);
+ _dl->setEnabled(false);
+ _knob->hide();
+ _dl->hide();
+ inHeartBeat = false;
+ return;
+ }
+
+ MidiPort* mp;
+ int ch;
+ int cdi = editor->curDrumInstrument();
+ _dnum = _ctrl->num();
+ if(_track->type() == Track::DRUM && ((_dnum & 0xff) == 0xff) && cdi != -1)
+ {
+ _dnum = (_dnum & ~0xff) | drumMap[cdi].anote;
+ mp = &midiPorts[drumMap[cdi].port];
+ ch = drumMap[cdi].channel;
+ }
+ else
+ {
+ mp = &midiPorts[_track->outPort()];
+ ch = _track->outChannel();
+ }
+
+ //if(_dnum == CTRL_VELOCITY || _dnum == CTRL_PROGRAM)
+ if(_dnum == CTRL_VELOCITY)
+ {
+ _knob->setEnabled(false);
+ _dl->setEnabled(false);
+ _knob->hide();
+ _dl->hide();
+ }
+ else
+ {
+ _knob->setEnabled(true);
+ _dl->setEnabled(true);
+ double dlv;
+ int mn; int mx; int v;
+ if(_dnum == CTRL_PROGRAM)
+ {
+ mn = 1;
+ mx = 128;
+ v = mp->hwCtrlState(ch, _dnum);
+ _val = v;
+ _knob->setRange(double(mn), double(mx), 1.0);
+ _dl->setRange(double(mn), double(mx));
+ //_dl->setOff(double(mn - 1));
+ if(v == CTRL_VAL_UNKNOWN || ((v & 0xffffff) == 0xffffff))
+ {
+ int lastv = mp->lastValidHWCtrlState(ch, _dnum);
+ if(lastv == CTRL_VAL_UNKNOWN || ((lastv & 0xffffff) == 0xffffff))
+ {
+ int initv = _ctrl->initVal();
+ if(initv == CTRL_VAL_UNKNOWN || ((initv & 0xffffff) == 0xffffff))
+ v = 1;
+ else
+ v = (initv + 1) & 0xff;
+ }
+ else
+ v = (lastv + 1) & 0xff;
+
+ if(v > 128)
+ v = 128;
+ //dlv = mn - 1;
+ dlv = _dl->off() - 1.0;
+ }
+ else
+ {
+ v = (v + 1) & 0xff;
+ if(v > 128)
+ v = 128;
+ dlv = double(v);
+ }
+ }
+ else
+ {
+ mn = _ctrl->minVal();
+ mx = _ctrl->maxVal();
+ v = mp->hwCtrlState(ch, _dnum);
+ _val = v;
+ _knob->setRange(double(mn), double(mx), 1.0);
+ _dl->setRange(double(mn), double(mx));
+ //_dl->setOff(double(mn - 1));
+ if(v == CTRL_VAL_UNKNOWN)
+ {
+ int lastv = mp->lastValidHWCtrlState(ch, _dnum);
+ if(lastv == CTRL_VAL_UNKNOWN)
+ {
+ if(_ctrl->initVal() == CTRL_VAL_UNKNOWN)
+ v = 0;
+ else
+ v = _ctrl->initVal();
+ }
+ else
+ v = lastv - _ctrl->bias();
+ //dlv = mn - 1;
+ dlv = _dl->off() - 1.0;
+ }
+ else
+ {
+ // Auto bias...
+ v -= _ctrl->bias();
+ dlv = double(v);
+ }
+ }
+ _knob->setValue(double(v));
+ _dl->setValue(dlv);
+
+ _knob->show();
+ _dl->show();
+ // Incomplete drawing sometimes. Update fixes it.
+ _knob->update();
+ _dl->update();
+ }
+
+ inHeartBeat = false;
+}
+
+//---------------------------------------------------------
+// setHeight
+//---------------------------------------------------------
+
+void CtrlPanel::setHeight(int h)
+ {
+ setFixedHeight(h);
+ }
+
+struct CI {
+ QString s;
+ bool used;
+ CI(const QString& ss, bool u) : s(ss), used(u) {}
+ };
+
+//---------------------------------------------------------
+// ctrlPopup
+//---------------------------------------------------------
+
+void CtrlPanel::ctrlPopup()
+ {
+ //---------------------------------------------------
+ // build list of midi controllers for current
+ // MidiPort/channel
+ //---------------------------------------------------
+
+ PartList* parts = editor->parts();
+ Part* part = editor->curCanvasPart();
+ MidiTrack* track = (MidiTrack*)(part->track());
+ int channel = track->outChannel();
+ MidiPort* port = &midiPorts[track->outPort()];
+ int curDrumInstrument = editor->curDrumInstrument();
+ bool isDrum = track->type() == Track::DRUM;
+
+ pop->clear();
+ pop->insertItem(tr("Velocity"), 1);
+
+ MidiCtrlValListList* cll = port->controller();
+ int min = channel << 24;
+ int max = min + 0x1000000;
+
+ std::list<CI> sList;
+ typedef std::list<CI>::iterator isList;
+
+ for (iMidiCtrlValList i = cll->lower_bound(min); i != cll->lower_bound(max); ++i) {
+ MidiCtrlValList* cl = i->second;
+ MidiController* c = port->midiController(cl->num());
+ // dont show drum specific controller if not a drum track
+ if ((c->num() & 0xff) == 0xff) {
+ if (!isDrum)
+ continue;
+ // only show controller for curDrumInstrument:
+ if ((cl->num() & 0xff) != drumMap[curDrumInstrument].anote) {
+ continue;
+ }
+ }
+ isList i = sList.begin();
+ for (; i != sList.end(); ++i) {
+ if (i->s == c->name())
+ break;
+ }
+ if (i == sList.end()) {
+ bool used = false;
+ for (iPart ip = parts->begin(); ip != parts->end(); ++ip) {
+ EventList* el = ip->second->events();
+ for (iEvent ie = el->begin(); ie != el->end(); ++ie) {
+ Event e = ie->second;
+ if ((e.type() == Controller) && (e.dataA() == cl->num())) {
+ used = true;
+ break;
+ }
+ }
+ if (used)
+ break;
+ }
+ sList.push_back(CI(c->name(), used));
+ }
+ }
+ for (isList i = sList.begin(); i != sList.end(); ++i) {
+ if (i->used)
+ pop->insertItem(QIcon(*greendotIcon), i->s);
+ else
+ pop->insertItem(i->s);
+ }
+
+ pop->insertItem(QIcon(*configureIcon), tr("add new ..."), 2);
+ int rv = pop->exec(selCtrl->mapToGlobal(QPoint(0,0)));
+ selCtrl->setDown(false);
+
+ if (rv == -1)
+ return;
+
+ QString s = pop->text(rv);
+ if (rv == 1) { // special case velocity
+ emit controllerChanged(CTRL_VELOCITY);
+ }
+ else if (rv == 2) {
+ //
+ // add new controller
+ //
+ Q3PopupMenu* pop1 = new Q3PopupMenu(this);
+ pop1->setCheckable(false);
+ //
+ // populate popup with all controllers available for
+ // current instrument
+ //
+ MidiInstrument* instr = port->instrument();
+ MidiControllerList* mcl = instr->controller();
+ for (iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci)
+ {
+ int num = ci->second->num();
+ if (isDrum && ((num & 0xff) == 0xff))
+ num = (num & ~0xff) + drumMap[curDrumInstrument].anote;
+
+ if(cll->find(channel, num) == cll->end())
+ pop1->insertItem(ci->second->name());
+ }
+ int rv = pop1->exec(selCtrl->mapToGlobal(QPoint(0,0)));
+ if (rv != -1) {
+ QString s = pop1->text(rv);
+ MidiController* c;
+ for (iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) {
+ c = ci->second;
+ if (c->name() == s) {
+ int num = c->num();
+ if (isDrum && ((num & 0xff) == 0xff))
+ num = (num & ~0xff) + drumMap[curDrumInstrument].anote;
+
+ if(cll->find(channel, num) == cll->end())
+ {
+ MidiCtrlValList* vl = new MidiCtrlValList(num);
+
+ cll->add(channel, vl);
+ emit controllerChanged(c->num());
+ //song->update(SC_MIDI_CONTROLLER_ADD);
+ }
+ else
+ emit controllerChanged(c->num());
+ break;
+ }
+ }
+ }
+ }
+ else if (rv == -1)
+ return;
+ else {
+ QString s = pop->text(rv);
+ iMidiCtrlValList i = cll->begin();
+ for (; i != cll->end(); ++i) {
+ MidiCtrlValList* cl = i->second;
+ MidiController* c = port->midiController(cl->num());
+ if (c->name() == s) {
+ emit controllerChanged(c->num());
+ break;
+ }
+ }
+ if (i == cll->end()) {
+ printf("CtrlPanel: controller %s not found!", s.latin1());
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// ctrlRightClicked
+//---------------------------------------------------------
+
+void CtrlPanel::ctrlRightClicked(const QPoint& p, int /*id*/)
+{
+ //if(!_knob->selectedFaceColor())
+ // _knob->selectFaceColor(true);
+ //if(_dnum == -1)
+ // return;
+ if(!editor->curCanvasPart())
+ return;
+
+ int cdi = editor->curDrumInstrument();
+ int ctlnum = _ctrl->num();
+ if(_track->type() == Track::DRUM && ((ctlnum & 0xff) == 0xff) && cdi != -1)
+ //ctlnum = (ctlnum & ~0xff) | drumMap[cdi].enote;
+ ctlnum = (ctlnum & ~0xff) | cdi;
+
+ MidiPart* part = dynamic_cast<MidiPart*>(editor->curCanvasPart());
+ song->execMidiAutomationCtlPopup(0, part, p, ctlnum);
+}
+
+/*
+//---------------------------------------------------------
+// ctrlReleased
+//---------------------------------------------------------
+
+void CtrlPanel::ctrlReleased(int id)
+{
+ //if(_knob->selectedFaceColor())
+ // _knob->selectFaceColor(false);
+}
+*/
diff --git a/muse2/muse/ctrl/ctrlpanel.h b/muse2/muse/ctrl/ctrlpanel.h
new file mode 100644
index 00000000..8d3379c0
--- /dev/null
+++ b/muse2/muse/ctrl/ctrlpanel.h
@@ -0,0 +1,66 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ctrlpanel.h,v 1.2.2.5 2009/06/10 00:34:59 terminator356 Exp $
+// (C) Copyright 1999-2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __CTRL_PANEL_H__
+#define __CTRL_PANEL_H__
+
+#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3PopupMenu>
+#include <QLabel>
+
+class MidiController;
+class QLabel;
+class Q3PopupMenu;
+class QPushButton;
+class MidiEditor;
+class Knob;
+class DoubleLabel;
+class MidiPort;
+class MidiTrack;
+
+//---------------------------------------------------------
+// CtrlPanel
+//---------------------------------------------------------
+
+class CtrlPanel: public QWidget {
+ Q3PopupMenu* pop;
+ QPushButton* selCtrl;
+ MidiEditor* editor;
+
+ MidiTrack* _track;
+ MidiController* _ctrl;
+ int _dnum;
+ bool inHeartBeat;
+ Knob* _knob;
+ DoubleLabel* _dl;
+ int _val;
+
+ Q_OBJECT
+
+ signals:
+ void destroyPanel();
+ void controllerChanged(int);
+
+ private slots:
+ void ctrlChanged(double val);
+ void labelDoubleClicked();
+ void ctrlRightClicked(const QPoint& p, int id);
+ //void ctrlReleased(int id);
+
+ protected slots:
+ virtual void heartBeat();
+
+ public slots:
+ void setHeight(int);
+ void ctrlPopup();
+
+ public:
+ CtrlPanel(QWidget*, MidiEditor*, const char* name = 0);
+ void setHWController(MidiTrack* t, MidiController* ctrl);
+ };
+#endif
diff --git a/muse2/muse/debug.h b/muse2/muse/debug.h
new file mode 100644
index 00000000..7339a613
--- /dev/null
+++ b/muse2/muse/debug.h
@@ -0,0 +1,31 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: debug.h,v 1.1.1.1 2003/10/27 18:51:20 wschweer Exp $
+//=========================================================
+
+#ifndef __MUSE_DEBUG_H__
+#define __MUSE_DEBUG_H__
+
+#include <stdio.h>
+#include "globals.h"
+
+#ifdef DEBUG_1
+#define M_REPORT(string) printf("%s:%d:%s: " string "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
+#define M_REPORTARG(format, args...) printf("%s:%d:%s: " format "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ##args);
+#define M_DEBUG(string) if (debugMsg) fprintf(stderr, "%s:%d:%s: " string "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
+#define M_DEBUGARG(format, args...) if (debugMsg) fprintf(stderr, "%s:%d:%s: " format "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ##args);
+#define M_ERROR(string) fprintf(stderr, "%s:%d:%s: " string "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
+#define M_ERRORARG(format, args...) fprintf(stderr, "%s:%d:%s: " format "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ##args);
+#else
+#define M_REPORT(string)
+#define M_REPORTARG(format, args...)
+#define M_DEBUG(string)
+#define M_DEBUGARG(format, args...)
+#define M_ERROR(string)
+#define M_ERRORARG(format, args...)
+#endif
+
+#define DEBUG_ARGS __FILE__ << ":" << __LINE__ << ":" << __PRETTY_FUNCTION__ << ": "
+
+#endif /* __MUSE_DEBUG_H__ */
diff --git a/muse2/muse/default_click.h b/muse2/muse/default_click.h
new file mode 100644
index 00000000..7f074350
--- /dev/null
+++ b/muse2/muse/default_click.h
@@ -0,0 +1,1213 @@
+/*
+ Copyright (C) 20002 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ $Id: default_click.h,v 1.1.2.1 2004/11/15 23:25:51 spamatica Exp $
+*/
+
+static const float defaultClick[] = {
+ -0.0019836426, 0.0097045898, 0.019165039, 0.028594971, 0.036102295,
+ 0.040679932, 0.040649414, 0.036560059, 0.029693604, 0.016967773,
+ 0.0057067871, -0.008026123, -0.021453857, -0.026153564,
+ -0.031921387, -0.036834717, -0.04397583, -0.046844482,
+ -0.045349121, -0.041748047, -0.032623291, -0.026611328,
+ -0.026702881, -0.025482178, -0.013092041, 0.0055847168,
+ 0.023040771, 0.027435303, 0.043426514, 0.07925415, 0.1086731,
+ 0.09463501, 0.039154053, -0.027832031, -0.081542969, -0.099090576,
+ -0.089385986, -0.051055908, -0.0023803711, 0.031951904,
+ 0.044128418, 0.029998779, 0.0086669922, 0.0022888184, 0.0082092285,
+ 0.0085144043, -0.0057983398, -0.027496338, -0.036834717,
+ -0.021759033, -0.020721436, -0.024078369, -0.025360107,
+ -0.090698242, -0.16491699, -0.16052246, -0.090454102, 0.0031433105,
+ 0.013031006, 0.034790039, 0.30599976, 0.58151245, 0.5078125,
+ 0.32858276, 0.21975708, -0.050018311, -0.34790039, -0.46588135,
+ -0.26513672, 0.12893677, 0.19259644, 0.11685181, 0.095825195,
+ -0.039154053, -0.041473389, 0.0069274902, -0.14685059, -0.32232666,
+ -0.21795654, 0.051086426, 0.18112183, 0.30905151, 0.47305298,
+ 0.60980225, 0.59518433, 0.46920776, 0.51705933, 0.47116089,
+ 0.31832886, 0.20901489, 0.059539795, -0.10055542, -0.23834229,
+ -0.26708984, -0.27468872, -0.29516602, -0.22879028, -0.12854004,
+ -0.064300537, -0.0068664551, 0.060211182, 0.10339355, 0.12594604,
+ 0.12954712, 0.063568115, -0.041046143, -0.1184082, -0.19332886,
+ -0.27337646, -0.34906006, -0.40966797, -0.46533203, -0.45361328,
+ -0.39672852, -0.32958984, -0.15246582, 0.086853027, 0.23678589,
+ 0.24838257, 0.13034058, -0.15222168, -0.5199585, -0.80224609,
+ -0.9397583, -0.89654541, -0.71923828, -0.47998047, -0.14666748,
+ 0.26187134, 0.54995728, 0.69186401, 0.84616089, 0.79928589,
+ 0.53170776, 0.39968872, 0.32455444, 0.2137146, 0.19454956,
+ 0.24069214, 0.22750854, 0.14596558, 0.047058105, -0.04876709,
+ -0.13095093, -0.19775391, -0.16293335, -0.059265137, 0.027526855,
+ 0.13961792, 0.26803589, 0.35470581, 0.37600708, 0.34085083,
+ 0.2572937, 0.13265991, -0.008026123, -0.12841797, -0.22216797,
+ -0.30899048, -0.37841797, -0.4251709, -0.45947266, -0.48376465,
+ -0.50341797, -0.52294922, -0.54516602, -0.58447266, -0.62121582,
+ -0.63989258, -0.64990234, -0.63037109, -0.568573, -0.46630859,
+ -0.36468506, -0.27618408, -0.18487549, -0.11065674, -0.070404053,
+ -0.066101074, -0.049835205, -0.026611328, -0.013061523,
+ 0.011444092, 0.034576416, 0.046112061, 0.052215576, 0.045501709,
+ 0.030059814, 0.011657715, 0.026489258, 0.056121826, 0.10122681,
+ 0.20016479, 0.33053589, 0.45944214, 0.54830933, 0.57751465, 0.5625,
+ 0.55612183, 0.55319214, 0.5697937, 0.64987183, 0.73553467,
+ 0.78170776, 0.84420776, 0.89987183, 0.90475464, 0.85861206,
+ 0.75338745, 0.57077026, 0.3354187, 0.067779541, -0.1741333,
+ -0.36557007, -0.47802734, -0.51281738, -0.47766113, -0.36865234,
+ -0.22381592, -0.065765381, 0.066680908, 0.12365723, 0.098114014,
+ 0.020965576, -0.10775757, -0.27294922, -0.41845703, -0.50146484,
+ -0.52563477, -0.48291016, -0.38186646, -0.27264404, -0.16925049,
+ -0.07043457, 0.003326416, 0.025085449, -0.028320312, -0.11358643,
+ -0.18164062, -0.21984863, -0.21286011, -0.16635132, -0.12728882,
+ -0.088104248, 0.016693115, 0.18893433, 0.40280151, 0.59127808,
+ 0.67233276, 0.64682007, 0.54733276, 0.4213562, 0.30703735,
+ 0.19845581, 0.12661743, 0.095611572, 0.10531616, 0.17950439,
+ 0.29904175, 0.41726685, 0.47506714, 0.48678589, 0.48873901,
+ 0.46694946, 0.42233276, 0.38088989, 0.34689331, 0.30709839,
+ 0.26022339, 0.18258667, 0.064544678, -0.09085083, -0.25634766,
+ -0.41540527, -0.54693604, -0.62731934, -0.6809082, -0.70849609,
+ -0.71044922, -0.68469238, -0.64886475, -0.62115479, -0.6104126,
+ -0.62451172, -0.65185547, -0.67504883, -0.68969727, -0.70257568,
+ -0.71337891, -0.68994141, -0.61865234, -0.49755859, -0.32177734,
+ -0.10437012, 0.11209106, 0.30691528, 0.46789551, 0.51602173,
+ 0.44674683, 0.32055664, 0.1769104, 0.06072998, 0.0075378418,
+ -0.013641357, -0.0038146973, 0.082244873, 0.22116089, 0.35787964,
+ 0.47689819, 0.60266113, 0.71801758, 0.81747437, 0.91799927,
+ 0.97079468, 0.97677612, 0.93850708, 0.83322144, 0.65866089,
+ 0.42324829, 0.14834595, -0.10574341, -0.31484985, -0.46813965,
+ -0.54833984, -0.55517578, -0.51220703, -0.43115234, -0.34613037,
+ -0.29052734, -0.2699585, -0.29443359, -0.33349609, -0.38720703,
+ -0.45751953, -0.51318359, -0.54800415, -0.55706787, -0.5402832,
+ -0.48666382, -0.41162109, -0.32958984, -0.24560547, -0.19873047,
+ -0.18457031, -0.19171143, -0.21240234, -0.23876953, -0.25823975,
+ -0.26184082, -0.24902344, -0.21612549, -0.16552734, -0.11083984,
+ -0.058349609, -0.0034179688, 0.053283691, 0.12722778, 0.23052979,
+ 0.35769653, 0.51147461, 0.68243408, 0.85015869, 0.96902466,
+ 0.99908447, 0.99899292, 0.99453735, 0.87936401, 0.72964478,
+ 0.59124756, 0.45162964, 0.29949951, 0.18435669, 0.087219238,
+ 0.0085754395, -0.031677246, -0.057434082, -0.06338501,
+ -0.050262451, -0.021179199, 0.010986328, 0.035095215, 0.041900635,
+ 0.026275635, -0.008972168, -0.067260742, -0.14938354, -0.24298096,
+ -0.33901978, -0.44342041, -0.53179932, -0.59924316, -0.64294434,
+ -0.66220093, -0.65362549, -0.61437988, -0.56277466, -0.48764038,
+ -0.41287231, -0.3420105, -0.25909424, -0.17782593, -0.10604858,
+ -0.033355713, 0.037872314, 0.097198486, 0.15203857, 0.19644165,
+ 0.23324585, 0.2668457, 0.29403687, 0.31442261, 0.33148193,
+ 0.33639526, 0.32794189, 0.31109619, 0.30651855, 0.30456543,
+ 0.31005859, 0.32266235, 0.34017944, 0.36062622, 0.37988281,
+ 0.39459229, 0.40344238, 0.41464233, 0.41500854, 0.41091919,
+ 0.40512085, 0.39819336, 0.3843689, 0.36633301, 0.33621216,
+ 0.28076172, 0.19436646, 0.083892822, -0.056732178, -0.21832275,
+ -0.38809204, -0.55502319, -0.70330811, -0.82672119, -0.909729,
+ -0.93505859, -0.9085083, -0.84347534, -0.74786377, -0.63342285,
+ -0.52468872, -0.42883301, -0.35321045, -0.29504395, -0.26339722,
+ -0.23782349, -0.21252441, -0.19006348, -0.16159058, -0.12472534,
+ -0.075958252, -0.012115479, 0.056091309, 0.11953735, 0.17373657,
+ 0.22116089, 0.25097656, 0.25982666, 0.2539978, 0.24578857,
+ 0.24325562, 0.25292969, 0.28744507, 0.34677124, 0.42510986,
+ 0.51596069, 0.60205078, 0.67550659, 0.71774292, 0.728302,
+ 0.70874023, 0.6612854, 0.59188843, 0.49536133, 0.37322998,
+ 0.23904419, 0.10256958, -0.030303955, -0.15093994, -0.24526978,
+ -0.31253052, -0.3414917, -0.33178711, -0.29302979, -0.23806763,
+ -0.17816162, -0.13470459, -0.12387085, -0.15142822, -0.20706177,
+ -0.28427124, -0.37112427, -0.44927979, -0.50619507, -0.53219604,
+ -0.53118896, -0.49990845, -0.45379639, -0.39599609, -0.31643677,
+ -0.22329712, -0.15414429, -0.1050415, -0.075592041, -0.0753479,
+ -0.088775635, -0.099090576, -0.086639404, -0.035797119,
+ 0.052154541, 0.1661377, 0.28082275, 0.39169312, 0.50491333,
+ 0.59762573, 0.67288208, 0.71621704, 0.73251343, 0.71405029,
+ 0.66171265, 0.60040283, 0.53762817, 0.46520996, 0.3727417,
+ 0.26971436, 0.17245483, 0.092346191, 0.034851074, 0.0072937012,
+ 0.007232666, 0.017547607, 0.01852417, 0.020172119, 0.023345947,
+ 0.014434814, -0.013946533, -0.054168701, -0.094726562, -0.14425659,
+ -0.20623779, -0.27316284, -0.34069824, -0.40481567, -0.4647522,
+ -0.51278687, -0.55215454, -0.57962036, -0.58953857, -0.59140015,
+ -0.57885742, -0.55456543, -0.51055908, -0.45095825, -0.37948608,
+ -0.29974365, -0.22027588, -0.13543701, -0.047271729, 0.033721924,
+ 0.1005249, 0.14877319, 0.18429565, 0.20465088, 0.21621704,
+ 0.2272644, 0.23416138, 0.24511719, 0.26138306, 0.2805481,
+ 0.3006897, 0.32943726, 0.36660767, 0.40802002, 0.44424438,
+ 0.47698975, 0.50256348, 0.52005005, 0.5267334, 0.52258301,
+ 0.50723267, 0.47485352, 0.42205811, 0.34805298, 0.26202393,
+ 0.16522217, 0.067749023, -0.024169922, -0.1060791, -0.18280029,
+ -0.25424194, -0.31921387, -0.37774658, -0.43612671, -0.50094604,
+ -0.56121826, -0.61495972, -0.66091919, -0.69436646, -0.70004272,
+ -0.67868042, -0.63104248, -0.56182861, -0.48074341, -0.39840698,
+ -0.31900024, -0.24609375, -0.18695068, -0.1461792, -0.11993408,
+ -0.11032104, -0.10159302, -0.091918945, -0.076904297, -0.069580078,
+ -0.058898926, -0.038146973, -0.012542725, 0.014831543, 0.043304443,
+ 0.082824707, 0.13180542, 0.1895752, 0.25256348, 0.32229614,
+ 0.38531494, 0.43493652, 0.4697876, 0.48736572, 0.48733521,
+ 0.46533203, 0.42901611, 0.38223267, 0.33636475, 0.2819519,
+ 0.22467041, 0.16455078, 0.10604858, 0.047485352, -0.010040283,
+ -0.057098389, -0.093933105, -0.12252808, -0.14291382, -0.15545654,
+ -0.16064453, -0.16348267, -0.16918945, -0.17095947, -0.17773438,
+ -0.19436646, -0.21868896, -0.25158691, -0.2890625, -0.33297729,
+ -0.37677002, -0.41171265, -0.43563843, -0.44619751, -0.44320679,
+ -0.42520142, -0.39151001, -0.34609985, -0.29324341, -0.23846436,
+ -0.18026733, -0.12319946, -0.068023682, -0.017944336, 0.033691406,
+ 0.08416748, 0.13388062, 0.18310547, 0.23513794, 0.28579712,
+ 0.3314209, 0.37133789, 0.40841675, 0.44143677, 0.46252441,
+ 0.47073364, 0.46435547, 0.44342041, 0.40725708, 0.35971069,
+ 0.30911255, 0.26272583, 0.22372437, 0.19876099, 0.18948364,
+ 0.18948364, 0.19799805, 0.21658325, 0.23733521, 0.25439453,
+ 0.26513672, 0.26702881, 0.25582886, 0.2338562, 0.19677734,
+ 0.15100098, 0.097106934, 0.036804199, -0.02456665, -0.087005615,
+ -0.14819336, -0.20632935, -0.26040649, -0.30117798, -0.33422852,
+ -0.35610962, -0.36178589, -0.3522644, -0.3237915, -0.28857422,
+ -0.24789429, -0.20108032, -0.14822388, -0.097442627, -0.055877686,
+ -0.019500732, 0.0064086914, 0.024627686, 0.033721924, 0.042114258,
+ 0.052032471, 0.069763184, 0.094207764, 0.12030029, 0.14993286,
+ 0.18215942, 0.22003174, 0.26171875, 0.30029297, 0.33355713,
+ 0.35992432, 0.3833313, 0.40148926, 0.41094971, 0.40899658,
+ 0.39849854, 0.37387085, 0.34091187, 0.30215454, 0.26016235,
+ 0.2170105, 0.17681885, 0.13604736, 0.093658447, 0.049316406,
+ 0.0074462891, -0.037322998, -0.086120605, -0.13262939, -0.18286133,
+ -0.22872925, -0.26879883, -0.3026123, -0.33206177, -0.35943604,
+ -0.37924194, -0.39431763, -0.40466309, -0.40936279, -0.40270996,
+ -0.38815308, -0.36676025, -0.3421936, -0.31149292, -0.27597046,
+ -0.24679565, -0.22177124, -0.20294189, -0.19259644, -0.18527222,
+ -0.18157959, -0.17645264, -0.16998291, -0.1524353, -0.12554932,
+ -0.086669922, -0.03894043, 0.016204834, 0.075744629, 0.13665771,
+ 0.18896484, 0.23040771, 0.26107788, 0.28408813, 0.29443359,
+ 0.29440308, 0.28460693, 0.27456665, 0.26107788, 0.24020386,
+ 0.21322632, 0.18551636, 0.15698242, 0.12554932, 0.095855713,
+ 0.069152832, 0.045501709, 0.020141602, -0.0030517578, -0.026702881,
+ -0.0496521, -0.071960449, -0.098327637, -0.12268066, -0.14907837,
+ -0.17523193, -0.20068359, -0.22494507, -0.2482605, -0.27352905,
+ -0.29666138, -0.31420898, -0.32751465, -0.33670044, -0.33874512,
+ -0.32943726, -0.31417847, -0.29504395, -0.26898193, -0.23904419,
+ -0.20245361, -0.16390991, -0.1210022, -0.078308105, -0.039337158,
+ -0.0037231445, 0.029174805, 0.05847168, 0.084106445, 0.1078186,
+ 0.13174438, 0.15719604, 0.17941284, 0.20126343, 0.22348022,
+ 0.2432251, 0.2578125, 0.2640686, 0.26593018, 0.25933838,
+ 0.24685669, 0.2288208, 0.21047974, 0.19494629, 0.18075562,
+ 0.17199707, 0.17199707, 0.17175293, 0.1729126, 0.17126465,
+ 0.16873169, 0.16256714, 0.15036011, 0.1355896, 0.11254883,
+ 0.083465576, 0.050079346, 0.01159668, -0.030029297, -0.074707031,
+ -0.11532593, -0.15432739, -0.18942261, -0.21673584, -0.23681641,
+ -0.24554443, -0.24703979, -0.24472046, -0.23815918, -0.22784424,
+ -0.21243286, -0.19384766, -0.17596436, -0.15844727, -0.14089966,
+ -0.12030029, -0.099395752, -0.076538086, -0.058746338,
+ -0.034484863, -0.0097351074, 0.015625, 0.037445068, 0.063079834,
+ 0.087738037, 0.11401367, 0.13973999, 0.16848755, 0.19680786,
+ 0.2244873, 0.25567627, 0.28305054, 0.30465698, 0.31854248,
+ 0.32287598, 0.31808472, 0.30102539, 0.27633667, 0.24591064,
+ 0.20962524, 0.17144775, 0.13021851, 0.09487915, 0.057861328,
+ 0.023651123, -0.014129639, -0.051239014, -0.086639404, -0.12316895,
+ -0.15304565, -0.18545532, -0.21154785, -0.23434448, -0.25100708,
+ -0.26113892, -0.26712036, -0.26678467, -0.26687622, -0.262146,
+ -0.25656128, -0.24734497, -0.23501587, -0.22433472, -0.20773315,
+ -0.19207764, -0.17459106, -0.15997314, -0.14196777, -0.12670898,
+ -0.1166687, -0.10726929, -0.099243164, -0.090179443, -0.078521729,
+ -0.062225342, -0.038360596, -0.0068054199, 0.031402588,
+ 0.072143555, 0.11181641, 0.15362549, 0.19085693, 0.22195435,
+ 0.24661255, 0.26379395, 0.27166748, 0.27072144, 0.26507568,
+ 0.25247192, 0.2348938, 0.21447754, 0.18756104, 0.15771484,
+ 0.13241577, 0.10873413, 0.087036133, 0.065460205, 0.046875,
+ 0.029754639, 0.013153076, -0.0065917969, -0.024993896,
+ -0.046051025, -0.067810059, -0.092285156, -0.11779785, -0.14529419,
+ -0.17376709, -0.19503784, -0.21487427, -0.23205566, -0.24533081,
+ -0.25128174, -0.2522583, -0.24685669, -0.23486328, -0.21954346,
+ -0.19946289, -0.1786499, -0.15280151, -0.12744141, -0.098022461,
+ -0.069091797, -0.038146973, -0.0079040527, 0.024719238,
+ 0.054351807, 0.082275391, 0.11019897, 0.13510132, 0.15545654,
+ 0.17276001, 0.1854248, 0.19042969, 0.19281006, 0.1930542,
+ 0.19232178, 0.18795776, 0.17938232, 0.17156982, 0.16223145,
+ 0.15603638, 0.15182495, 0.15118408, 0.14651489, 0.14263916,
+ 0.13916016, 0.1343689, 0.12649536, 0.11480713, 0.10400391,
+ 0.091766357, 0.079589844, 0.063781738, 0.04776001, 0.029510498,
+ 0.013061523, -0.0087890625, -0.034454346, -0.06362915,
+ -0.097381592, -0.12896729, -0.15893555, -0.18429565, -0.20910645,
+ -0.22930908, -0.2411499, -0.25009155, -0.2505188, -0.24719238,
+ -0.23956299, -0.22445679, -0.20892334, -0.18774414, -0.16699219,
+ -0.14205933, -0.12145996, -0.10317993, -0.085449219, -0.066101074,
+ -0.050048828, -0.03326416, -0.014404297, 0.0099182129, 0.041809082,
+ 0.077087402, 0.11599731, 0.14718628, 0.18060303, 0.20654297,
+ 0.23117065, 0.25247192, 0.27026367, 0.28042603, 0.27871704,
+ 0.27175903, 0.25527954, 0.2315979, 0.20584106, 0.17654419,
+ 0.1446228, 0.1086731, 0.073699951, 0.040588379, 0.011627197,
+ -0.016143799, -0.044189453, -0.071838379, -0.098449707,
+ -0.12316895, -0.14602661, -0.16595459, -0.17871094, -0.18606567,
+ -0.19488525, -0.20278931, -0.209198, -0.21121216, -0.21276855,
+ -0.21395874, -0.21328735, -0.21072388, -0.20718384, -0.20404053,
+ -0.19812012, -0.19073486, -0.17901611, -0.16781616, -0.15267944,
+ -0.13824463, -0.12042236, -0.098999023, -0.077453613, -0.053497314,
+ -0.029022217, -0.001373291, 0.022583008, 0.050720215, 0.077026367,
+ 0.10748291, 0.13626099, 0.16424561, 0.18908691, 0.21191406,
+ 0.2300415, 0.2428894, 0.25292969, 0.25643921, 0.25924683,
+ 0.25518799, 0.24127197, 0.22161865, 0.19989014, 0.17800903,
+ 0.14935303, 0.12268066, 0.094787598, 0.068878174, 0.041046143,
+ 0.018585205, 0.0020141602, -0.0094604492, -0.01651001, -0.02243042,
+ -0.031860352, -0.049102783, -0.072113037, -0.098083496,
+ -0.12472534, -0.14935303, -0.17062378, -0.18566895, -0.19500732,
+ -0.19784546, -0.19299316, -0.18365479, -0.17153931, -0.1555481,
+ -0.13491821, -0.11233521, -0.090209961, -0.063781738, -0.038879395,
+ -0.017089844, 0.0027770996, 0.021697998, 0.041046143, 0.059844971,
+ 0.078674316, 0.093536377, 0.10656738, 0.11816406, 0.12698364,
+ 0.13323975, 0.13742065, 0.14559937, 0.1522522, 0.15563965,
+ 0.15548706, 0.1583252, 0.15756226, 0.15576172, 0.15216064,
+ 0.1479187, 0.14260864, 0.13577271, 0.1272583, 0.11904907,
+ 0.10968018, 0.10412598, 0.096618652, 0.087615967, 0.07522583,
+ 0.059265137, 0.039978027, 0.017852783, -0.0061950684, -0.029510498,
+ -0.05065918, -0.075500488, -0.099395752, -0.12225342, -0.1418457,
+ -0.16101074, -0.17797852, -0.1932373, -0.20556641, -0.20901489,
+ -0.21026611, -0.20684814, -0.20016479, -0.18768311, -0.17312622,
+ -0.15994263, -0.14834595, -0.13482666, -0.11865234, -0.10229492,
+ -0.083404541, -0.063079834, -0.039276123, -0.014129639,
+ 0.011199951, 0.035583496, 0.059417725, 0.079925537, 0.098571777,
+ 0.11416626, 0.1270752, 0.14013672, 0.15286255, 0.16619873,
+ 0.17810059, 0.18783569, 0.19454956, 0.19598389, 0.19143677,
+ 0.18264771, 0.16867065, 0.15258789, 0.13143921, 0.10482788,
+ 0.075073242, 0.045928955, 0.018371582, -0.0075683594, -0.032928467,
+ -0.054992676, -0.072662354, -0.089813232, -0.10479736, -0.12127686,
+ -0.13748169, -0.15161133, -0.16473389, -0.17370605, -0.18240356,
+ -0.18569946, -0.18682861, -0.18756104, -0.18310547, -0.18099976,
+ -0.17584229, -0.17102051, -0.16162109, -0.15145874, -0.1421814,
+ -0.12973022, -0.11398315, -0.096557617, -0.078460693, -0.061035156,
+ -0.042541504, -0.023590088, -0.0029296875, 0.020996094,
+ 0.044403076, 0.068237305, 0.092926025, 0.11682129, 0.13772583,
+ 0.15460205, 0.17050171, 0.18438721, 0.19360352, 0.19952393,
+ 0.20303345, 0.2048645, 0.20132446, 0.1930542, 0.18280029,
+ 0.16989136, 0.1546936, 0.13711548, 0.12115479, 0.10336304,
+ 0.087890625, 0.068023682, 0.049804688, 0.028320312, 0.0081787109,
+ -0.012664795, -0.030334473, -0.046783447, -0.061584473,
+ -0.073883057, -0.084655762, -0.093719482, -0.10314941, -0.11251831,
+ -0.12094116, -0.1300354, -0.13421631, -0.13647461, -0.13491821,
+ -0.13186646, -0.12530518, -0.11520386, -0.10275269, -0.088775635,
+ -0.074310303, -0.061462402, -0.046875, -0.032409668, -0.014892578,
+ 0.00057983398, 0.016967773, 0.031738281, 0.0440979, 0.054656982,
+ 0.063659668, 0.073791504, 0.081176758, 0.088562012, 0.095916748,
+ 0.10043335, 0.10443115, 0.10519409, 0.1076355, 0.1071167,
+ 0.10748291, 0.10601807, 0.1026001, 0.10031128, 0.095123291,
+ 0.08972168, 0.082763672, 0.075164795, 0.06729126, 0.057922363,
+ 0.049865723, 0.042144775, 0.035125732, 0.026367188, 0.016571045,
+ 0.0040893555, -0.0084228516, -0.025054932, -0.042053223,
+ -0.060974121, -0.077178955, -0.093902588, -0.10845947, -0.1229248,
+ -0.13531494, -0.14489746, -0.15274048, -0.15701294, -0.15966797,
+ -0.15670776, -0.15130615, -0.140625, -0.12561035, -0.10900879,
+ -0.091644287, -0.077362061, -0.063690186, -0.051879883,
+ -0.04083252, -0.028869629, -0.017059326, -0.0053710938,
+ 0.0051574707, 0.020172119, 0.034484863, 0.051361084, 0.067810059,
+ 0.085540771, 0.10223389, 0.11761475, 0.13146973, 0.14044189,
+ 0.1468811, 0.14923096, 0.14846802, 0.14407349, 0.13641357,
+ 0.12796021, 0.11773682, 0.1076355, 0.09463501, 0.081207275,
+ 0.065124512, 0.050323486, 0.035552979, 0.020965576, 0.0063476562,
+ -0.0094299316, -0.024810791, -0.040008545, -0.054534912,
+ -0.0703125, -0.084228516, -0.096862793, -0.10809326, -0.1171875,
+ -0.12515259, -0.13067627, -0.13568115, -0.13632202, -0.13449097,
+ -0.131073, -0.12503052, -0.11868286, -0.11099243, -0.10317993,
+ -0.095306396, -0.087158203, -0.077667236, -0.068115234,
+ -0.059082031, -0.047241211, -0.033966064, -0.019805908,
+ -0.0041503906, 0.012573242, 0.030029297, 0.047637939, 0.063751221,
+ 0.079162598, 0.092987061, 0.1055603, 0.11737061, 0.12628174,
+ 0.13504028, 0.14266968, 0.14840698, 0.1519165, 0.15158081,
+ 0.14685059, 0.14041138, 0.13082886, 0.11962891, 0.10525513,
+ 0.089599609, 0.072784424, 0.057556152, 0.044464111, 0.032470703,
+ 0.02053833, 0.0086364746, -0.0019226074, -0.013336182,
+ -0.026184082, -0.039398193, -0.052368164, -0.064605713,
+ -0.076293945, -0.086303711, -0.09475708, -0.10128784, -0.10568237,
+ -0.10748291, -0.10894775, -0.10787964, -0.10577393, -0.10229492,
+ -0.097198486, -0.090087891, -0.081695557, -0.07244873,
+ -0.062927246, -0.051940918, -0.041748047, -0.028839111,
+ -0.015960693, -0.0022277832, 0.011779785, 0.024932861, 0.038482666,
+ 0.048614502, 0.059326172, 0.066925049, 0.072021484, 0.077026367,
+ 0.079681396, 0.082733154, 0.082855225, 0.081481934, 0.08001709,
+ 0.079833984, 0.079345703, 0.079162598, 0.078582764, 0.078521729,
+ 0.078582764, 0.077575684, 0.073059082, 0.065612793, 0.055480957,
+ 0.044189453, 0.031768799, 0.019744873, 0.008972168, -0.00094604492,
+ -0.0081176758, -0.013885498, -0.018463135, -0.025634766,
+ -0.032623291, -0.041442871, -0.05279541, -0.0652771, -0.078399658,
+ -0.088256836, -0.098297119, -0.10681152, -0.112854, -0.11355591,
+ -0.11132812, -0.10617065, -0.098449707, -0.087738037, -0.077606201,
+ -0.068054199, -0.059051514, -0.051330566, -0.041503906,
+ -0.031066895, -0.019470215, -0.0077514648, 0.0030517578,
+ 0.014892578, 0.026062012, 0.038879395, 0.050079346, 0.060028076,
+ 0.069793701, 0.076568604, 0.082611084, 0.088989258, 0.094360352,
+ 0.098754883, 0.10293579, 0.10635376, 0.10720825, 0.10586548,
+ 0.10314941, 0.0987854, 0.093475342, 0.087432861, 0.079406738,
+ 0.070159912, 0.059204102, 0.048095703, 0.036529541, 0.023071289,
+ 0.010406494, -0.0024719238, -0.01361084, -0.026184082,
+ -0.036682129, -0.047180176, -0.056213379, -0.065765381,
+ -0.07510376, -0.082702637, -0.091064453, -0.09677124, -0.10232544,
+ -0.10546875, -0.1072998, -0.10693359, -0.10385132, -0.10055542,
+ -0.093078613, -0.085235596, -0.075439453, -0.065643311,
+ -0.054138184, -0.042449951, -0.029785156, -0.017822266,
+ -0.0068359375, 0.0038452148, 0.01373291, 0.023773193, 0.033081055,
+ 0.042053223, 0.049560547, 0.057952881, 0.066223145, 0.075775146,
+ 0.083190918, 0.08984375, 0.096191406, 0.10202026, 0.10595703,
+ 0.10742188, 0.10778809, 0.10528564, 0.1020813, 0.096069336,
+ 0.08883667, 0.07925415, 0.069458008, 0.057952881, 0.047454834,
+ 0.036804199, 0.026397705, 0.015777588, 0.004119873, -0.0077819824,
+ -0.019927979, -0.030822754, -0.040405273, -0.048980713,
+ -0.056610107, -0.062805176, -0.069366455, -0.074035645,
+ -0.077026367, -0.079406738, -0.079986572, -0.080322266,
+ -0.078338623, -0.07598877, -0.072479248, -0.067230225,
+ -0.061218262, -0.055847168, -0.050048828, -0.043823242,
+ -0.037536621, -0.030792236, -0.02230835, -0.012634277,
+ -0.0030822754, 0.0069580078, 0.016204834, 0.023040771, 0.03024292,
+ 0.036865234, 0.043518066, 0.051025391, 0.056396484, 0.061645508,
+ 0.063720703, 0.065185547, 0.065032959, 0.0652771, 0.06439209,
+ 0.06451416, 0.063598633, 0.062011719, 0.058654785, 0.055297852,
+ 0.053131104, 0.051208496, 0.048950195, 0.046905518, 0.042175293,
+ 0.035675049, 0.028411865, 0.019622803, 0.0091247559, -0.0016174316,
+ -0.012207031, -0.022521973, -0.031616211, -0.040618896,
+ -0.047302246, -0.052734375, -0.057098389, -0.060455322,
+ -0.064849854, -0.068664551, -0.07321167, -0.074829102, -0.07623291,
+ -0.075378418, -0.072814941, -0.069152832, -0.064819336,
+ -0.059417725, -0.052368164, -0.044769287, -0.036712646,
+ -0.027679443, -0.018005371, -0.0093383789, 0.0010375977,
+ 0.011474609, 0.022399902, 0.03125, 0.03793335, 0.042449951,
+ 0.045379639, 0.048065186, 0.050567627, 0.054260254, 0.058166504,
+ 0.062316895, 0.066436768, 0.068786621, 0.072113037, 0.074707031,
+ 0.077453613, 0.076507568, 0.074523926, 0.071838379, 0.06729126,
+ 0.061126709, 0.053771973, 0.045410156, 0.037078857, 0.027862549,
+ 0.019134521, 0.0096435547, 0.00079345703, -0.0076293945,
+ -0.016296387, -0.024810791, -0.034454346, -0.043334961,
+ -0.052703857, -0.06048584, -0.066101074, -0.070739746, -0.07220459,
+ -0.073394775, -0.072967529, -0.072509766, -0.072296143,
+ -0.070404053, -0.06842041, -0.064819336, -0.062072754,
+ -0.058624268, -0.05380249, -0.048400879, -0.039764404,
+ -0.031280518, -0.021881104, -0.012786865, -0.0053100586,
+ 0.0022888184, 0.0081176758, 0.014038086, 0.020568848, 0.026885986,
+ 0.032867432, 0.037628174, 0.042999268, 0.046722412, 0.052276611,
+ 0.056884766, 0.061584473, 0.065124512, 0.066955566, 0.068054199,
+ 0.067565918, 0.066589355, 0.06362915, 0.058410645, 0.052764893,
+ 0.045349121, 0.036987305, 0.029144287, 0.021606445, 0.015197754,
+ 0.0087280273, 0.0020446777, -0.004699707, -0.012115479,
+ -0.018920898, -0.02633667, -0.032897949, -0.037841797,
+ -0.042205811, -0.046783447, -0.050567627, -0.055114746,
+ -0.05847168, -0.061004639, -0.061401367, -0.059173584,
+ -0.056915283, -0.053955078, -0.049255371, -0.043121338,
+ -0.037384033, -0.032501221, -0.027709961, -0.023468018,
+ -0.018951416, -0.01385498, -0.0096740723, -0.005279541,
+ -0.0010986328, 0.0033874512, 0.0088806152, 0.01348877, 0.01953125,
+ 0.025024414, 0.031097412, 0.036895752, 0.0418396, 0.045837402,
+ 0.048492432, 0.050231934, 0.051208496, 0.052490234, 0.052856445,
+ 0.053344727, 0.052581787, 0.051452637, 0.049224854, 0.046356201,
+ 0.042938232, 0.038543701, 0.034362793, 0.029602051, 0.025726318,
+ 0.021606445, 0.017272949, 0.013641357, 0.009185791, 0.0037841797,
+ -0.0022888184, -0.0105896, -0.019439697, -0.027709961,
+ -0.034454346, -0.039642334, -0.044464111, -0.046569824,
+ -0.048400879, -0.047546387, -0.046142578, -0.043395996,
+ -0.040405273, -0.037994385, -0.035217285, -0.03414917,
+ -0.031890869, -0.029205322, -0.026306152, -0.021820068,
+ -0.018035889, -0.01361084, -0.0084228516, -0.001373291,
+ 0.0057067871, 0.011962891, 0.018157959, 0.022766113, 0.02722168,
+ 0.030090332, 0.032928467, 0.03503418, 0.036895752, 0.039001465,
+ 0.04107666, 0.042816162, 0.04397583, 0.045074463, 0.045562744,
+ 0.045654297, 0.045532227, 0.045135498, 0.043518066, 0.040618896,
+ 0.036437988, 0.032012939, 0.027099609, 0.021911621, 0.016296387,
+ 0.010955811, 0.006072998, 0.00048828125, -0.0053100586,
+ -0.011535645, -0.017303467, -0.023529053, -0.028717041,
+ -0.03427124, -0.038604736, -0.042572021, -0.045074463,
+ -0.046661377, -0.047851562, -0.04776001, -0.047668457,
+ -0.046691895, -0.045379639, -0.04385376, -0.042297363,
+ -0.040435791, -0.037322998, -0.033691406, -0.029205322,
+ -0.024749756, -0.019775391, -0.014556885, -0.0090942383,
+ -0.0034790039, 0.0011901855, 0.0063171387, 0.0095214844,
+ 0.013519287, 0.016174316, 0.019622803, 0.022094727, 0.024627686,
+ 0.027435303, 0.029876709, 0.032958984, 0.035858154, 0.038208008,
+ 0.039398193, 0.040374756, 0.040222168, 0.039978027, 0.039154053,
+ 0.037811279, 0.034820557, 0.030822754, 0.025695801, 0.020721436,
+ 0.015991211, 0.010864258, 0.006439209, 0.0018005371, -0.002166748,
+ -0.0062561035, -0.0096740723, -0.013244629, -0.01663208,
+ -0.019927979, -0.023742676, -0.026611328, -0.029907227,
+ -0.032684326, -0.035064697, -0.037261963, -0.037811279,
+ -0.037902832, -0.036437988, -0.033233643, -0.029876709,
+ -0.026031494, -0.021759033, -0.017456055, -0.014251709,
+ -0.011566162, -0.0094909668, -0.0071105957, -0.0048217773,
+ -0.0027770996, 0.00036621094, 0.0036010742, 0.0076904297,
+ 0.01159668, 0.015350342, 0.019226074, 0.021697998, 0.024749756,
+ 0.026947021, 0.029266357, 0.030853271, 0.032104492, 0.032470703,
+ 0.032165527, 0.03225708, 0.031860352, 0.03213501, 0.032104492,
+ 0.03213501, 0.031860352, 0.031005859, 0.029205322, 0.026550293,
+ 0.023406982, 0.01940918, 0.015258789, 0.010437012, 0.005859375,
+ 0.0013122559, -0.003112793, -0.0067443848, -0.010040283,
+ -0.01361084, -0.016662598, -0.020324707, -0.023193359,
+ -0.026062012, -0.028503418, -0.029663086, -0.030487061,
+ -0.030059814, -0.029418945, -0.027374268, -0.025024414,
+ -0.022857666, -0.0206604, -0.018585205, -0.016113281, -0.013397217,
+ -0.010192871, -0.0072021484, -0.0043029785, -0.002166748, 0,
+ 0.0024414062, 0.005065918, 0.0079345703, 0.01071167, 0.012878418,
+ 0.015380859, 0.017669678, 0.019958496, 0.021575928, 0.023284912,
+ 0.024078369, 0.024719238, 0.025024414, 0.02557373, 0.02633667,
+ 0.026275635, 0.02520752, 0.024017334, 0.022369385, 0.021057129,
+ 0.019622803, 0.017578125, 0.015258789, 0.012054443, 0.0086975098,
+ 0.0051269531, 0.0020141602, -0.00082397461, -0.00390625,
+ -0.0068054199, -0.010406494, -0.014129639, -0.017425537,
+ -0.020385742, -0.02230835, -0.025054932, -0.026916504,
+ -0.028961182, -0.029724121, -0.029937744, -0.029907227,
+ -0.02911377, -0.027770996, -0.025238037, -0.023010254,
+ -0.019714355, -0.016540527, -0.013641357, -0.011077881,
+ -0.008605957, -0.0062866211, -0.0043945312, -0.0021972656,
+ -0.00067138672, 0.0012512207, 0.0020751953, 0.0036315918,
+ 0.0053405762, 0.0081481934, 0.011352539, 0.014709473, 0.017944336,
+ 0.020202637, 0.022003174, 0.023742676, 0.02520752, 0.026031494,
+ 0.026062012, 0.025421143, 0.024261475, 0.022766113, 0.020904541,
+ 0.019287109, 0.017852783, 0.017333984, 0.017181396, 0.016357422,
+ 0.014770508, 0.012298584, 0.0095825195, 0.0057373047, 0.0017089844,
+ -0.0032043457, -0.0075073242, -0.011260986, -0.014068604,
+ -0.016021729, -0.017608643, -0.0184021, -0.019104004, -0.019775391,
+ -0.020507812, -0.020721436, -0.020355225, -0.019348145,
+ -0.017974854, -0.016235352, -0.014648438, -0.013183594,
+ -0.011657715, -0.010498047, -0.0097961426, -0.0091552734,
+ -0.0082702637, -0.0070800781, -0.0055236816, -0.003112793,
+ -0.00054931641, 0.0024719238, 0.0049743652, 0.0075073242,
+ 0.0095825195, 0.011352539, 0.012512207, 0.013580322, 0.014251709,
+ 0.015045166, 0.016113281, 0.017089844, 0.018096924, 0.018890381,
+ 0.019897461, 0.020629883, 0.020965576, 0.020782471, 0.019744873,
+ 0.018371582, 0.016113281, 0.014068604, 0.011260986, 0.0094604492,
+ 0.0072631836, 0.0054016113, 0.0033874512, 0.0014343262,
+ -0.0007019043, -0.0032958984, -0.0055847168, -0.0082397461,
+ -0.010650635, -0.013275146, -0.015167236, -0.016662598,
+ -0.017852783, -0.018218994, -0.018157959, -0.017486572,
+ -0.017181396, -0.01675415, -0.01651001, -0.015808105, -0.015014648,
+ -0.01385498, -0.012390137, -0.01083374, -0.0090332031,
+ -0.0072937012, -0.0054626465, -0.0038757324, -0.0022888184,
+ -0.00051879883, 0.0011901855, 0.0027770996, 0.0043334961,
+ 0.0057067871, 0.0071716309, 0.0084533691, 0.010101318, 0.011047363,
+ 0.011993408, 0.012969971, 0.013092041, 0.013427734, 0.013641357,
+ 0.013946533, 0.014221191, 0.014099121, 0.01385498, 0.012756348,
+ 0.012054443, 0.011322021, 0.010162354, 0.0087280273, 0.0073547363,
+ 0.0061950684, 0.0046386719, 0.0029602051, 0.0014953613,
+ -0.00033569336, -0.0021362305, -0.0043640137, -0.0064086914,
+ -0.0086975098, -0.010498047, -0.012023926, -0.013092041,
+ -0.013366699, -0.01348877, -0.013793945, -0.013763428,
+ -0.013977051, -0.013824463, -0.013519287, -0.013305664,
+ -0.012878418, -0.012390137, -0.011352539, -0.010131836,
+ -0.0085144043, -0.0065307617, -0.0048217773, -0.0028076172,
+ -0.00094604492, 0.00082397461, 0.0019836426, 0.0028991699,
+ 0.0037841797, 0.0042114258, 0.0050048828, 0.0057067871,
+ 0.0067443848, 0.0078735352, 0.0088195801, 0.0099182129,
+ 0.010986328, 0.011657715, 0.012145996, 0.012573242, 0.012969971,
+ 0.013000488, 0.0128479, 0.012481689, 0.011993408, 0.011352539,
+ 0.010498047, 0.0093688965, 0.0081176758, 0.0067749023,
+ 0.0054931641, 0.0044250488, 0.0032958984, 0.001953125,
+ 0.00054931641, -0.00085449219, -0.0026855469, -0.0042114258,
+ -0.0060119629, -0.0071716309, -0.0086364746, -0.0095825195,
+ -0.010284424, -0.010528564, -0.010498047, -0.010284424,
+ -0.0096740723, -0.0094299316, -0.0088195801, -0.0082092285,
+ -0.0076599121, -0.007232666, -0.0068359375, -0.0063171387,
+ -0.0056152344, -0.0047607422, -0.0038146973, -0.0027770996,
+ -0.0015563965, -0.00061035156, 0.00057983398, 0.0016174316,
+ 0.002532959, 0.0032348633, 0.0037536621, 0.0041503906,
+ 0.0043945312, 0.0048217773, 0.0053405762, 0.0060119629,
+ 0.0067443848, 0.0075073242, 0.0080566406, 0.0084228516,
+ 0.008392334, 0.0083618164, 0.0080566406, 0.0076293945,
+ 0.0071411133, 0.0067749023, 0.0062255859, 0.0054626465,
+ 0.0046081543, 0.0036315918, 0.0026550293, 0.0014648438,
+ 0.0002746582, -0.00076293945, -0.0018615723, -0.0027160645,
+ -0.0035400391, -0.0041809082, -0.0048522949, -0.0054626465,
+ -0.0061035156, -0.0067138672, -0.0072021484, -0.0072937012,
+ -0.0072937012, -0.0069885254, -0.0065002441, -0.0059204102,
+ -0.0051269531, -0.0045471191, -0.0039672852, -0.0036010742,
+ -0.0031738281, -0.0027770996, -0.0023803711, -0.0018310547,
+ -0.0012817383, -0.00064086914, -3.0517578e-05, 0.00064086914,
+ 0.0011901855, 0.0017700195, 0.0021972656, 0.002532959,
+ 0.0028381348, 0.003112793, 0.0034484863, 0.0038146973,
+ 0.0040893555, 0.0043334961, 0.0044250488, 0.0044555664,
+ 0.0045776367, 0.0046691895, 0.0047302246, 0.0046691895,
+ 0.0045471191, 0.0042724609, 0.00390625, 0.0035095215, 0.0029296875,
+ 0.0024414062, 0.001953125, 0.0014343262, 0.00085449219,
+ 0.00021362305, -0.00018310547, -0.00073242188, -0.0012207031,
+ -0.001739502, -0.002166748, 0
+ };
+
+static const unsigned defaultClickLength = sizeof(defaultClick) / sizeof(*defaultClick);
+
+static const float defaultClickEmphasis[] = {
+ 0.002166748, 0.0023193359, 0.001739502, 0.002166748, 0.0021362305,
+ 0.0018615723, 0.0020446777, 0.002166748, 0.0019836426, 0.0022277832,
+ 0.0018310547, 0.0023803711, 0.0022277832, 0.001953125, 0.0022888184,
+ 0.0018005371, 0.0025024414, 0.0018310547, 0.0019836426, 0.001953125,
+ 0.0020446777, 0.0017700195, 0.0021057129, 0.0020751953,
+ 0.0019836426, 0.0014343262, 0.0024414062, 0.0015869141,
+ 0.0022888184, 0.0016784668, 0.0025024414, 0.0017089844,
+ 0.0024719238, 0.0020141602, 0.0026855469, 0.0013427734,
+ 0.0028381348, 0.0015563965, 0.0020446777, 0.0018615723, 0.002532959,
+ 0.0015258789, 0.0021972656, 0.0016784668, 0.002166748, 0.0016479492,
+ 0.0021362305, 0.0018920898, 0.0021362305, 0.0017700195,
+ 0.0020141602, 0.0022277832, 0.001739502, 0.0022583008, 0.001953125,
+ 0.0021362305, 0.0018920898, 0.0020446777, 0.001953125, 0.0026550293,
+ 0.0014953613, 0.0023803711, 0.001953125, 0.0021972656, 0.0015869141,
+ 0.0017700195, 0.0020141602, 0.0022277832, 0.0015258789,
+ 0.0015869141, -0.0045471191, -0.011230469, -0.009185791,
+ -0.0038757324, -0.020690918, -0.030731201, -0.0088806152,
+ 0.0032958984, -0.0068664551, -0.0024719238, 0.024688721,
+ 0.035400391, 0.014892578, 0.0047607422, 0.011779785, 0.0035095215,
+ -0.012573242, -0.0059814453, 0.0065612793, 0.0039672852,
+ 0.0014343262, 0.010406494, 0.027374268, 0.021942139, 0.0065612793,
+ 0.010681152, 0.024688721, 0.024291992, 0.012451172, 0.023590088,
+ 0.033203125, 0.024139404, 0.010375977, 0.016662598, 0.026885986,
+ 0.039215088, 0.038330078, 0.039703369, 0.048309326, 0.046447754,
+ 0.029937744, 0.031311035, 0.066497803, 0.052856445, -0.0074768066,
+ -0.016998291, 0.016784668, 0.039428711, 0.021759033, 0.0040893555,
+ -0.0016174316, 0.012451172, 0.052215576, 0.047485352, 0.017150879,
+ 0.015075684, 0.013397217, 0.024475098, 0.035247803, 0.039978027,
+ 0.06137085, 0.080108643, 0.078521729, 0.054779053, 0.0625,
+ 0.1076355, 0.10934448, 0.079803467, 0.056945801, 0.056182861,
+ 0.047851562, 0.028503418, 0.022979736, 0.010803223, -0.015686035,
+ -0.050811768, -0.072509766, -0.057891846, -0.032073975,
+ -0.051300049, -0.078887939, -0.069366455, -0.038146973,
+ -0.0099182129, 0.010528564, 0.048492432, 0.082305908, 0.084838867,
+ 0.059753418, 0.0043029785, -0.087158203, -0.18395996, -0.2911377,
+ -0.37133789, -0.33422852, -0.28649902, -0.31976318, -0.33630371,
+ -0.22824097, 0.020385742, 0.24456787, 0.31582642, 0.37380981,
+ 0.40820312, 0.40539551, 0.41415405, 0.34210205, 0.20877075,
+ 0.010498047, -0.17623901, -0.22705078, -0.15548706, -0.039855957,
+ 0.0067443848, -0.0022277832, -0.050048828, -0.10186768, -0.11407471,
+ -0.1050415, -0.067352295, 0.0018615723, 0.079742432, 0.11517334,
+ 0.12005615, 0.14709473, 0.19543457, 0.2015686, 0.150177,
+ 0.052703857, -0.029602051, -0.084838867, -0.14590454, -0.18951416,
+ -0.18814087, -0.15014648, -0.11505127, -0.094360352, -0.076721191,
+ -0.037872314, 0.011749268, 0.034851074, 0.060791016, 0.11419678,
+ 0.14096069, 0.13140869, 0.1277771, 0.12313843, 0.10934448,
+ 0.055541992, -0.026397705, -0.07144165, -0.050262451, -0.0097961426,
+ -0.02822876, -0.15008545, -0.28927612, -0.32809448, -0.2772522,
+ -0.15994263, 0.016448975, 0.13085938, 0.12866211, 0.1072998,
+ 0.094177246, 0.036346436, -0.026245117, -0.040496826, -0.01348877,
+ 0.0085144043, 0.0070800781, -0.0086669922, -0.0038452148,
+ 0.040252686, 0.077026367, 0.071960449, 0.032470703, 0.002166748,
+ 0.0065612793, 0.0053100586, -0.025115967, -0.058532715,
+ -0.060699463, -0.015563965, 0.048278809, 0.086273193, 0.078582764,
+ 0.031524658, -0.026580811, -0.077911377, -0.11288452, -0.13244629,
+ -0.15325928, -0.14471436, -0.095672607, -0.048858643, -0.012115479,
+ 0.023132324, 0.051544189, 0.046691895, 0.01373291, -0.0097961426,
+ -0.016143799, -0.022460938, -0.025726318, 0.0075378418, 0.091522217,
+ 0.19741821, 0.23269653, 0.16726685, 0.12173462, 0.12973022,
+ 0.064300537, -0.12158203, -0.29794312, -0.33813477, -0.27990723,
+ -0.19500732, -0.063903809, 0.10449219, 0.23712158, 0.34381104,
+ 0.41766357, 0.37658691, 0.22747803, 0.056365967, -0.088317871,
+ -0.19509888, -0.21295166, -0.15499878, -0.1114502, -0.093597412,
+ -0.071289062, -0.034606934, 0.009552002, 0.068084717, 0.12075806,
+ 0.13098145, 0.11383057, 0.08291626, 0.037322998, -0.017211914,
+ -0.05456543, -0.074829102, -0.087768555, -0.076202393, -0.022735596,
+ 0.032653809, 0.045623779, 0.045806885, 0.040496826, 0.016845703,
+ -0.023712158, -0.057769775, -0.07232666, -0.055145264,
+ -0.00091552734, 0.063201904, 0.11480713, 0.13497925, 0.11572266,
+ 0.030731201, -0.11346436, -0.23406982, -0.27478027, -0.23690796,
+ -0.13735962, -0.016479492, 0.076904297, 0.09487915, 0.070220947,
+ 0.058074951, 0.05355835, 0.017181396, -0.096893311, -0.21951294,
+ -0.26168823, -0.20983887, -0.093109131, 0.051879883, 0.15631104,
+ 0.18319702, 0.15551758, 0.078826904, -0.012084961, -0.083007812,
+ -0.10766602, -0.085479736, -0.059906006, -0.040039062, -0.031646729,
+ -0.046142578, -0.065551758, -0.03414917, 0.025482178, 0.046325684,
+ 0.054473877, 0.073303223, 0.073791504, 0.068786621, 0.082366943,
+ 0.080596924, 0.052215576, 0.015594482, -0.0053405762, 0.0040588379,
+ 0.032501221, 0.065551758, 0.093322754, 0.1199646, 0.13677979,
+ 0.14523315, 0.1401062, 0.12902832, 0.11553955, 0.09664917,
+ 0.091278076, 0.13305664, 0.24594116, 0.38180542, 0.45907593,
+ 0.45343018, 0.4213562, 0.36801147, 0.31027222, 0.30541992,
+ 0.33691406, 0.35479736, 0.3321228, 0.27334595, 0.25701904,
+ 0.23641968, 0.18139648, 0.16793823, 0.17538452, 0.17803955,
+ 0.19009399, 0.25280762, 0.38833618, 0.54940796, 0.70336914,
+ 0.74789429, 0.64334106, 0.49359131, 0.30703735, 0.071624756,
+ -0.075897217, -0.096191406, -0.076568604, 0.023406982, 0.15078735,
+ 0.21612549, 0.30493164, 0.39697266, 0.41009521, 0.32348633,
+ 0.24707031, 0.20645142, 0.11102295, 0.0075073242, -0.046325684,
+ -0.038085938, 0.014251709, 0.096618652, 0.1842041, 0.21417236,
+ 0.15905762, 0.0016174316, -0.25387573, -0.57302856, -0.85641479,
+ -0.99038696, -0.99038696, -0.99038696, -0.99038696, -0.99038696,
+ -0.90664673, -0.64364624, -0.42892456, -0.32131958, -0.23550415,
+ -0.25338745, -0.32595825, -0.44995117, -0.57858276, -0.68716431,
+ -0.80804443, -0.90670776, -0.9654541, -0.97409058, -0.95211792,
+ -0.90264893, -0.85357666, -0.80429077, -0.7482605, -0.69125366,
+ -0.60876465, -0.46228027, -0.23776245, -0.049041748, 0.019989014,
+ 0.048950195, 0.033172607, -0.02142334, -0.084259033, -0.15020752,
+ -0.16220093, -0.14608765, -0.14526367, -0.16497803, -0.1781311,
+ -0.19717407, -0.24871826, -0.26089478, -0.21688843, -0.19818115,
+ -0.23718262, -0.2824707, -0.32797241, -0.36758423, -0.3258667,
+ -0.18960571, -0.082885742, -0.056365967, -0.054534912, -0.10766602,
+ -0.26501465, -0.44006348, -0.58209229, -0.71032715, -0.77719116,
+ -0.76467896, -0.68914795, -0.51403809, -0.27841187, -0.092163086,
+ 0.056030273, 0.16799927, 0.19827271, 0.18478394, 0.17562866,
+ 0.15100098, 0.066619873, -0.040313721, -0.15875244, -0.27044678,
+ -0.35754395, -0.39682007, -0.34078979, -0.22293091, -0.13269043,
+ -0.048034668, 0.0730896, 0.19732666, 0.30789185, 0.39804077,
+ 0.44244385, 0.41928101, 0.35534668, 0.29177856, 0.22891235,
+ 0.18084717, 0.15231323, 0.13360596, 0.13049316, 0.13156128,
+ 0.1293335, 0.11477661, 0.12258911, 0.1824646, 0.26675415,
+ 0.35171509, 0.43341064, 0.49163818, 0.51086426, 0.50985718,
+ 0.49337769, 0.45962524, 0.43182373, 0.42025757, 0.4161377,
+ 0.40631104, 0.40435791, 0.42172241, 0.44003296, 0.45986938,
+ 0.47451782, 0.47540283, 0.48825073, 0.51907349, 0.5612793,
+ 0.62319946, 0.7109375, 0.79650879, 0.86904907, 0.92111206,
+ 0.96124268, 0.96994019, 0.92593384, 0.83483887, 0.70803833,
+ 0.57583618, 0.45834351, 0.3828125, 0.35479736, 0.35110474,
+ 0.38894653, 0.45022583, 0.49264526, 0.48919678, 0.45336914,
+ 0.40823364, 0.35009766, 0.28097534, 0.22503662, 0.18313599,
+ 0.14697266, 0.11010742, 0.07019043, 0.023956299, -0.024658203,
+ -0.087219238, -0.14846802, -0.19796753, -0.23556519, -0.25576782,
+ -0.25366211, -0.2333374, -0.19955444, -0.13546753, -0.052581787,
+ 0.018371582, 0.079620361, 0.14343262, 0.20013428, 0.2388916,
+ 0.25930786, 0.26889038, 0.26208496, 0.24691772, 0.22842407,
+ 0.19110107, 0.14624023, 0.093017578, 0.034301758, -0.044189453,
+ -0.1378479, -0.22967529, -0.29983521, -0.32650757, -0.31271362,
+ -0.26196289, -0.19345093, -0.11380005, -0.032806396, 0.038330078,
+ 0.087677002, 0.10690308, 0.092254639, 0.035766602, -0.057952881,
+ -0.17190552, -0.28945923, -0.40023804, -0.49761963, -0.5635376,
+ -0.59222412, -0.60348511, -0.61352539, -0.60958862, -0.57702637,
+ -0.53674316, -0.49453735, -0.45465088, -0.42507935, -0.40863037,
+ -0.4095459, -0.42730713, -0.45852661, -0.49362183, -0.53048706,
+ -0.55499268, -0.5526123, -0.52798462, -0.49053955, -0.44320679,
+ -0.38500977, -0.30548096, -0.2182312, -0.14306641, -0.073547363,
+ -0.0094299316, 0.045196533, 0.083312988, 0.11129761, 0.14489746,
+ 0.19921875, 0.24578857, 0.25418091, 0.23397827, 0.20111084,
+ 0.14822388, 0.078582764, 0.020812988, -0.012390137, -0.02520752,
+ -0.010559082, 0.026947021, 0.081542969, 0.13687134, 0.18441772,
+ 0.21426392, 0.22711182, 0.21377563, 0.17559814, 0.12246704,
+ 0.060882568, -0.0017089844, -0.067504883, -0.12475586, -0.16159058,
+ -0.16809082, -0.15145874, -0.12081909, -0.077362061, -0.03012085,
+ 0.011444092, 0.044189453, 0.075256348, 0.1050415, 0.13238525,
+ 0.15667725, 0.17337036, 0.17050171, 0.14389038, 0.10055542,
+ 0.057220459, 0.016204834, -0.012664795, -0.025024414, -0.014221191,
+ 0.012939453, 0.063781738, 0.12664795, 0.19824219, 0.26501465,
+ 0.32858276, 0.3782959, 0.40698242, 0.42160034, 0.42788696,
+ 0.43948364, 0.46075439, 0.48413086, 0.49819946, 0.50167847,
+ 0.49963379, 0.48529053, 0.45324707, 0.40890503, 0.36273193,
+ 0.31619263, 0.27200317, 0.23919678, 0.21868896, 0.2046814,
+ 0.18276978, 0.15286255, 0.11727905, 0.071807861, 0.015777588,
+ -0.054199219, -0.12478638, -0.19580078, -0.25622559, -0.30892944,
+ -0.34820557, -0.37606812, -0.39535522, -0.40704346, -0.42147827,
+ -0.43313599, -0.4447937, -0.44998169, -0.44503784, -0.431427,
+ -0.40750122, -0.37838745, -0.34109497, -0.29644775, -0.24822998,
+ -0.1991272, -0.15881348, -0.12728882, -0.10827637, -0.09979248,
+ -0.094055176, -0.091125488, -0.089508057, -0.087646484, -0.0809021,
+ -0.072387695, -0.055328369, -0.035583496, -0.0079956055,
+ 0.018188477, 0.04309082, 0.060577393, 0.073272705, 0.080413818,
+ 0.084503174, 0.083343506, 0.07522583, 0.071136475, 0.076141357,
+ 0.088348389, 0.10449219, 0.12374878, 0.14376831, 0.1534729,
+ 0.14807129, 0.1255188, 0.092559814, 0.047485352, -0.0028076172,
+ -0.062286377, -0.12301636, -0.17855835, -0.22631836, -0.26260376,
+ -0.28588867, -0.29559326, -0.29629517, -0.287323, -0.27877808,
+ -0.26751709, -0.25668335, -0.24749756, -0.24139404, -0.24041748,
+ -0.23944092, -0.23544312, -0.22592163, -0.20898438, -0.184021,
+ -0.15014648, -0.11633301, -0.082702637, -0.0496521, -0.017944336,
+ 0.017486572, 0.052581787, 0.092041016, 0.13427734, 0.18481445,
+ 0.24057007, 0.29467773, 0.33944702, 0.37042236, 0.38433838,
+ 0.38241577, 0.36376953, 0.33966064, 0.31497192, 0.29443359,
+ 0.27792358, 0.2600708, 0.24700928, 0.23727417, 0.23452759,
+ 0.23358154, 0.23257446, 0.23406982, 0.23239136, 0.23312378,
+ 0.22958374, 0.22579956, 0.21710205, 0.20043945, 0.17419434,
+ 0.13870239, 0.096466064, 0.051971436, 0.010437012, -0.024963379,
+ -0.052490234, -0.066467285, -0.068969727, -0.058563232,
+ -0.044616699, -0.030029297, -0.017486572, -0.0077209473,
+ -0.0032043457, -0.0048217773, -0.012481689, -0.027801514,
+ -0.042724609, -0.060211182, -0.072937012, -0.081756592,
+ -0.082977295, -0.07800293, -0.064605713, -0.043792725, -0.013031006,
+ 0.028625488, 0.077667236, 0.13046265, 0.18130493, 0.22851562,
+ 0.26617432, 0.29119873, 0.3039856, 0.30383301, 0.2925415,
+ 0.27261353, 0.24078369, 0.20632935, 0.16989136, 0.13552856,
+ 0.1038208, 0.074462891, 0.045898438, 0.013061523, -0.021087646,
+ -0.06072998, -0.099700928, -0.14016724, -0.17874146, -0.21130371,
+ -0.23596191, -0.25204468, -0.26132202, -0.26803589, -0.27981567,
+ -0.29934692, -0.32730103, -0.36425781, -0.40698242, -0.45092773,
+ -0.48971558, -0.51776123, -0.53198242, -0.5333252, -0.52218628,
+ -0.50076294, -0.47000122, -0.43017578, -0.38583374, -0.33612061,
+ -0.28347778, -0.23306274, -0.18682861, -0.14859009, -0.11853027,
+ -0.099853516, -0.09072876, -0.088562012, -0.091369629, -0.098022461,
+ -0.10787964, -0.11395264, -0.11013794, -0.093841553, -0.069274902,
+ -0.035369873, 0.0026245117, 0.046783447, 0.090698242, 0.1315918,
+ 0.16296387, 0.18664551, 0.2038269, 0.2154541, 0.22036743,
+ 0.21444702, 0.20489502, 0.18753052, 0.16650391, 0.13882446,
+ 0.10861206, 0.078735352, 0.049346924, 0.024078369, 0.0013427734,
+ -0.017974854, -0.032165527, -0.043243408, -0.050262451, -0.05670166,
+ -0.061157227, -0.068695068, -0.078918457, -0.085601807,
+ -0.090698242, -0.093658447, -0.095581055, -0.092529297, -0.08404541,
+ -0.068939209, -0.053649902, -0.037017822, -0.016448975,
+ 0.0096740723, 0.041687012, 0.074798584, 0.10549927, 0.13494873,
+ 0.16445923, 0.1937561, 0.2208252, 0.24539185, 0.26721191,
+ 0.28359985, 0.29733276, 0.30651855, 0.31622314, 0.32266235,
+ 0.31842041, 0.31008911, 0.29681396, 0.2819519, 0.26678467,
+ 0.25457764, 0.24642944, 0.24273682, 0.23709106, 0.22891235,
+ 0.2197876, 0.21051025, 0.20257568, 0.19024658, 0.17764282,
+ 0.1607666, 0.14309692, 0.12210083, 0.096893311, 0.073150635,
+ 0.049530029, 0.028045654, 0.0048522949, -0.017669678, -0.036224365,
+ -0.050506592, -0.059112549, -0.066345215, -0.068939209,
+ -0.070495605, -0.073059082, -0.073028564, -0.076812744,
+ -0.080963135, -0.092010498, -0.10275269, -0.11016846, -0.11907959,
+ -0.12677002, -0.13555908, -0.13842773, -0.13674927, -0.13088989,
+ -0.11846924, -0.099334717, -0.072784424, -0.042541504,
+ -0.0082702637, 0.031524658, 0.072387695, 0.10968018, 0.13861084,
+ 0.15847778, 0.16812134, 0.16650391, 0.15774536, 0.14169312,
+ 0.12005615, 0.092895508, 0.061737061, 0.02923584, -0.0022277832,
+ -0.032836914, -0.05670166, -0.075439453, -0.093322754, -0.1121521,
+ -0.13204956, -0.15255737, -0.17541504, -0.19900513, -0.21817017,
+ -0.23519897, -0.25091553, -0.27148438, -0.29296875, -0.31069946,
+ -0.3243103, -0.33599854, -0.34689331, -0.35461426, -0.3598938,
+ -0.36212158, -0.36105347, -0.35699463, -0.34725952, -0.33319092,
+ -0.31484985, -0.29327393, -0.26959229, -0.24423218, -0.21859741,
+ -0.18777466, -0.15194702, -0.11468506, -0.079498291, -0.0496521,
+ -0.023529053, 0.001159668, 0.025848389, 0.044494629, 0.054168701,
+ 0.058135986, 0.059844971, 0.066894531, 0.075195312, 0.087585449,
+ 0.10009766, 0.11755371, 0.13864136, 0.16278076, 0.18545532,
+ 0.20370483, 0.22076416, 0.23773193, 0.25531006, 0.26928711,
+ 0.27508545, 0.27371216, 0.26660156, 0.25100708, 0.2260437,
+ 0.1942749, 0.16079712, 0.12878418, 0.10110474, 0.07244873,
+ 0.046051025, 0.024993896, 0.010284424, -0.0010070801, -0.0082397461,
+ -0.011383057, -0.0072937012, -0.0034179688, 0.0040893555,
+ 0.013519287, 0.022583008, 0.031219482, 0.032714844, 0.034851074,
+ 0.033508301, 0.033935547, 0.030975342, 0.031982422, 0.039794922,
+ 0.05569458, 0.077392578, 0.10113525, 0.1277771, 0.15429688,
+ 0.18026733, 0.20275879, 0.21591187, 0.22341919, 0.224823,
+ 0.22775269, 0.22766113, 0.22491455, 0.2170105, 0.20431519,
+ 0.19171143, 0.17459106, 0.15859985, 0.14315796, 0.12554932,
+ 0.10998535, 0.09463501, 0.083435059, 0.070465088, 0.057983398,
+ 0.048278809, 0.041351318, 0.036224365, 0.030639648, 0.021850586,
+ 0.012176514, -0.0034484863, -0.022735596, -0.045166016,
+ -0.068908691, -0.094421387, -0.11810303, -0.13882446, -0.15774536,
+ -0.17269897, -0.18533325, -0.19125366, -0.19116211, -0.18655396,
+ -0.18423462, -0.18267822, -0.17877197, -0.17248535, -0.16625977,
+ -0.16271973, -0.16104126, -0.16125488, -0.16192627, -0.16333008,
+ -0.16461182, -0.16616821, -0.16235352, -0.15325928, -0.13644409,
+ -0.11523438, -0.090240479, -0.058013916, -0.024383545, 0.0089111328,
+ 0.039093018, 0.067749023, 0.096221924, 0.11837769, 0.13458252,
+ 0.13946533, 0.13269043, 0.12045288, 0.099212646, 0.073608398,
+ 0.042266846, 0.011627197, -0.019042969, -0.04876709, -0.07409668,
+ -0.096038818, -0.11062622, -0.1239624, -0.1340332, -0.14199829,
+ -0.14428711, -0.14074707, -0.13641357, -0.13253784, -0.13400269,
+ -0.13830566, -0.1505127, -0.16162109, -0.17391968, -0.1847229,
+ -0.19418335, -0.2019043, -0.20770264, -0.21234131, -0.21121216,
+ -0.20510864, -0.19058228, -0.16986084, -0.14498901, -0.11407471,
+ -0.082061768, -0.048492432, -0.015533447, 0.018341064, 0.052185059,
+ 0.078826904, 0.10336304, 0.12106323, 0.1315918, 0.13513184,
+ 0.13653564, 0.13986206, 0.14501953, 0.14926147, 0.15634155,
+ 0.16189575, 0.16915894, 0.17584229, 0.18264771, 0.19329834,
+ 0.20681763, 0.22433472, 0.24029541, 0.25708008, 0.27435303,
+ 0.28552246, 0.28768921, 0.2796936, 0.26013184, 0.23287964,
+ 0.20193481, 0.17483521, 0.14996338, 0.12689209, 0.10336304,
+ 0.081939697, 0.063842773, 0.047302246, 0.031677246, 0.01953125,
+ 0.010559082, 0.0013427734, -0.0082397461, -0.016357422,
+ -0.019348145, -0.023223877, -0.023406982, -0.023895264,
+ -0.022155762, -0.020477295, -0.017089844, -0.013031006,
+ -0.0098571777, -0.0046691895, 6.1035156e-05, 0.0072937012,
+ 0.0128479, 0.025878906, 0.040618896, 0.055908203, 0.066558838,
+ 0.072021484, 0.076965332, 0.080383301, 0.081237793, 0.077575684,
+ 0.072113037, 0.067443848, 0.064880371, 0.063720703, 0.058959961,
+ 0.054534912, 0.047576904, 0.039276123, 0.025390625, 0.010986328,
+ -0.0061645508, -0.018859863, -0.028900146, -0.036376953,
+ -0.041473389, -0.047241211, -0.054260254, -0.063049316, -0.0730896,
+ -0.081085205, -0.090118408, -0.10089111, -0.11264038, -0.12442017,
+ -0.1350708, -0.14535522, -0.15383911, -0.16052246, -0.16329956,
+ -0.1668396, -0.17166138, -0.17819214, -0.18157959, -0.18133545,
+ -0.17935181, -0.1758728, -0.17181396, -0.16687012, -0.16067505,
+ -0.15344238, -0.14562988, -0.13626099, -0.12780762, -0.11743164,
+ -0.10961914, -0.098510742, -0.085601807, -0.071716309, -0.05758667,
+ -0.041412354, -0.024078369, -0.0043640137, 0.015960693, 0.037567139,
+ 0.060455322, 0.082855225, 0.10211182, 0.11419678, 0.12088013,
+ 0.12197876, 0.12145996, 0.11743164, 0.11026001, 0.096984863,
+ 0.077789307, 0.054504395, 0.031890869, 0.010986328, -0.0061340332,
+ -0.020507812, -0.032836914, -0.042541504, -0.050476074,
+ -0.056762695, -0.06137085, -0.065032959, -0.064727783, -0.064147949,
+ -0.060119629, -0.05770874, -0.056549072, -0.057098389, -0.059692383,
+ -0.063140869, -0.067321777, -0.072021484, -0.075439453,
+ -0.078033447, -0.077575684, -0.073059082, -0.063995361,
+ -0.049560547, -0.030212402, -0.008605957, 0.015930176, 0.039794922,
+ 0.065917969, 0.090820312, 0.11099243, 0.12619019, 0.13739014,
+ 0.1472168, 0.15374756, 0.15893555, 0.16152954, 0.16671753,
+ 0.17425537, 0.17889404, 0.18060303, 0.17886353, 0.17861938,
+ 0.17984009, 0.18179321, 0.18499756, 0.18548584, 0.18609619,
+ 0.18521118, 0.18234253, 0.17956543, 0.17547607, 0.1690979,
+ 0.16101074, 0.15505981, 0.14837646, 0.13739014, 0.12255859,
+ 0.10522461, 0.082397461, 0.05770874, 0.030609131, 0.0046691895,
+ -0.018676758, -0.037872314, -0.054779053, -0.069458008,
+ -0.078826904, -0.084136963, -0.085479736, -0.083404541,
+ -0.076324463, -0.066314697, -0.056060791, -0.049926758,
+ -0.043182373, -0.040252686, -0.037811279, -0.038543701,
+ -0.039276123, -0.040771484, -0.041687012, -0.042053223,
+ -0.043548584, -0.040161133, -0.034637451, -0.024841309,
+ -0.015197754, -0.0059509277, 0.001159668, 0.0042114258,
+ 0.0062866211, 0.0049438477, 0.0047302246, 0.0028686523,
+ -0.00082397461, -0.0034790039, -0.0077514648, -0.01260376,
+ -0.019500732, -0.02645874, -0.032409668, -0.041351318, -0.049163818,
+ -0.058532715, -0.068603516, -0.078948975, -0.088897705,
+ -0.094543457, -0.097167969, -0.095581055, -0.094726562,
+ -0.095001221, -0.095336914, -0.094726562, -0.096160889, -0.09866333,
+ -0.10427856, -0.1104126, -0.11727905, -0.12301636, -0.13006592,
+ -0.13479614, -0.13574219, -0.13119507, -0.12451172, -0.11630249,
+ -0.10476685, -0.094543457, -0.08416748, -0.074066162, -0.061767578,
+ -0.050415039, -0.040557861, -0.031402588, -0.023834229, -0.01361084,
+ -0.0036010742, 0.0055236816, 0.013122559, 0.02142334, 0.029418945,
+ 0.041717529, 0.056518555, 0.075714111, 0.095062256, 0.11523438,
+ 0.13363647, 0.146698, 0.15646362, 0.16061401, 0.16043091,
+ 0.15634155, 0.14889526, 0.13769531, 0.12127686, 0.10272217,
+ 0.085418701, 0.070739746, 0.055541992, 0.040405273, 0.024200439,
+ 0.010803223, -0.00048828125, -0.0087890625, -0.012481689,
+ -0.014404297, -0.014068604, -0.011230469, -0.0081787109,
+ -0.0049438477, -0.0041809082, -0.0060119629, -0.012237549,
+ -0.020355225, -0.027832031, -0.034759521, -0.042053223, -0.04675293,
+ -0.045349121, -0.042297363, -0.03604126, -0.027862549, -0.015777588,
+ -0.0011291504, 0.013397217, 0.030212402, 0.04598999, 0.061401367,
+ 0.074615479, 0.086242676, 0.094238281, 0.09979248, 0.10458374,
+ 0.10662842, 0.10894775, 0.11077881, 0.11056519, 0.11022949,
+ 0.10903931, 0.1072998, 0.10266113, 0.098999023, 0.095977783,
+ 0.095916748, 0.095611572, 0.094909668, 0.093963623, 0.092895508,
+ 0.092559814, 0.090423584, 0.084014893, 0.073852539, 0.059020996,
+ 0.044830322, 0.02822876, 0.012023926, -0.0049743652, -0.020050049,
+ -0.036193848, -0.052398682, -0.066253662, -0.078796387,
+ -0.089019775, -0.098083496, -0.10592651, -0.11224365, -0.11618042,
+ -0.11715698, -0.11807251, -0.11676025, -0.11459351, -0.11108398,
+ -0.10748291, -0.10400391, -0.10064697, -0.096923828, -0.092163086,
+ -0.086639404, -0.08114624, -0.075531006, -0.071838379, -0.06854248,
+ -0.064971924, -0.061035156, -0.054382324, -0.047393799,
+ -0.043518066, -0.04095459, -0.041351318, -0.041259766, -0.041931152,
+ -0.04095459, -0.037841797, -0.034210205, -0.029541016, -0.026550293,
+ -0.02444458, -0.024139404, -0.026397705, -0.03036499, -0.035675049,
+ -0.041046143, -0.04675293, -0.054168701, -0.061218262, -0.065704346,
+ -0.066650391, -0.066650391, -0.063537598, -0.06048584, -0.055664062,
+ -0.053375244, -0.052642822, -0.052764893, -0.054718018,
+ -0.053955078, -0.05355835, -0.052764893, -0.053405762, -0.056213379,
+ -0.06036377, -0.062744141, -0.063110352, -0.06072998, -0.054504395,
+ -0.044647217, -0.034057617, -0.022949219, -0.011810303, 0.002532959,
+ 0.015594482, 0.024383545, 0.032165527, 0.03894043, 0.047302246,
+ 0.055236816, 0.064605713, 0.072387695, 0.081115723, 0.088348389,
+ 0.094940186, 0.10223389, 0.11135864, 0.12249756, 0.13082886,
+ 0.13803101, 0.14520264, 0.14993286, 0.15118408, 0.14987183,
+ 0.14846802, 0.14581299, 0.13851929, 0.12878418, 0.11639404,
+ 0.10375977, 0.09173584, 0.078796387, 0.063842773, 0.048980713,
+ 0.034576416, 0.022338867, 0.011932373, 0.0039672852, 0.0011291504,
+ -0.00094604492, -0.0015563965, -0.0034484863, -0.0050354004,
+ -0.0083312988, -0.012390137, -0.01651001, -0.019683838,
+ -0.022003174, -0.024414062, -0.027557373, -0.03137207, -0.03314209,
+ -0.030700684, -0.028045654, -0.025482178, -0.022247314,
+ -0.018737793, -0.013275146, -0.0074157715, 0.0010070801,
+ 0.0093078613, 0.01763916, 0.027404785, 0.035583496, 0.043151855,
+ 0.047485352, 0.051239014, 0.053649902, 0.054626465, 0.054382324,
+ 0.053039551, 0.050323486, 0.046691895, 0.044158936, 0.041534424,
+ 0.039794922, 0.035797119, 0.031494141, 0.026580811, 0.021575928,
+ 0.017944336, 0.014038086, 0.0093688965, 0.0051574707,
+ -0.00067138672, -0.0070495605, -0.014984131, -0.021728516,
+ -0.030151367, -0.037719727, -0.049804688, -0.062255859,
+ -0.073791504, -0.08416748, -0.089599609, -0.096496582, -0.10055542,
+ -0.10531616, -0.10870361, -0.11083984, -0.11102295, -0.10925293,
+ -0.10610962, -0.10125732, -0.094848633, -0.086700439, -0.07925415,
+ -0.074005127, -0.070770264, -0.068511963, -0.065643311,
+ -0.060577393, -0.054595947, -0.049407959, -0.043914795,
+ -0.039794922, -0.033813477, -0.027923584, -0.022674561,
+ -0.017791748, -0.01260376, -0.008972168, -0.0076293945,
+ -0.0053100586, -0.0030517578, -0.0024719238, -0.0032043457,
+ -0.0035705566, -0.002746582, -0.0013427734, -0.0011901855,
+ -0.0012817383, -0.0016479492, -0.0030212402, -0.0040588379,
+ -0.0071411133, -0.0085449219, -0.010375977, -0.01171875,
+ -0.011230469, -0.012512207, -0.013305664, -0.014190674,
+ -0.014099121, -0.015625, -0.01763916, -0.020202637, -0.020172119,
+ -0.017730713, -0.014068604, -0.0097351074, -0.0065917969,
+ -0.0020751953, 0.0018310547, 0.0045471191, 0.0046691895,
+ 0.003326416, 0.0018615723, -0.00021362305, 0.0010986328,
+ 0.0056152344, 0.011962891, 0.019866943, 0.029846191, 0.040130615,
+ 0.050811768, 0.058746338, 0.068267822, 0.076721191, 0.083862305,
+ 0.091491699, 0.096008301, 0.10150146, 0.1036377, 0.10562134,
+ 0.10449219, 0.1026001, 0.10076904, 0.099822998, 0.098297119,
+ 0.095245361, 0.094207764, 0.091949463, 0.092773438, 0.093048096,
+ 0.093658447, 0.090881348, 0.084747314, 0.078186035, 0.068328857,
+ 0.058197021, 0.044403076, 0.031768799, 0.019866943, 0.010345459,
+ 0.0029602051, -0.0044555664, -0.011932373, -0.018920898,
+ -0.024993896, -0.029205322, -0.031768799, -0.034790039,
+ -0.036773682, -0.037841797, -0.04019165, -0.042785645, -0.045928955,
+ -0.045776367, -0.044006348, -0.040649414, -0.037902832,
+ -0.036834717, -0.035308838, -0.033569336, -0.030090332,
+ -0.025543213, -0.020263672, -0.014678955, -0.0094604492,
+ -0.0042114258, -0.00067138672, 0.0016784668, 0.0021362305,
+ 0.0038452148, 0.007598877, 0.0099487305, 0.013793945, 0.015838623,
+ 0.01852417, 0.019958496, 0.021087646, 0.021270752, 0.021911621,
+ 0.021789551, 0.020965576, 0.01776123, 0.013275146, 0.0070495605,
+ 0.00076293945, -0.004119873, -0.007232666, -0.009552002,
+ -0.012695312, -0.016052246, -0.019226074, -0.02331543, -0.028625488,
+ -0.032348633, -0.035736084, -0.038909912, -0.044372559,
+ -0.050354004, -0.056610107, -0.061309814, -0.065704346,
+ -0.065948486, -0.067230225, -0.06652832, -0.0652771, -0.061981201,
+ -0.057128906, -0.052185059, -0.046112061, -0.041595459,
+ -0.035461426, -0.031097412, -0.025970459, -0.022979736,
+ -0.019836426, -0.015899658, -0.01260376, -0.0087585449,
+ -0.0061950684, -0.0028991699, -0.0014953613, 0.0018615723,
+ 0.0055847168, 0.008605957, 0.011871338, 0.015594482, 0.020629883,
+ 0.025970459, 0.030212402, 0.034973145, 0.037322998, 0.037597656,
+ 0.036254883, 0.034698486, 0.032440186, 0.029937744, 0.026062012,
+ 0.021972656, 0.018432617, 0.013397217, 0.010528564, 0.0077514648,
+ 0.0076904297, 0.0078430176, 0.0095825195, 0.012512207, 0.01550293,
+ 0.017486572, 0.017150879, 0.015563965, 0.013031006, 0.010070801,
+ 0.0068969727, 0.0039367676, 0.0021057129, 0.0018920898,
+ 0.0032653809, 0.0064697266, 0.0092163086, 0.010437012, 0.0097961426,
+ 0.0078125, 0.0053405762, 0.0048828125, 0.0055236816, 0.0086669922,
+ 0.013061523, 0.019897461, 0.027252197, 0.035675049, 0.043518066,
+ 0.050018311, 0.056427002, 0.06072998, 0.062011719, 0.061859131,
+ 0.060546875, 0.060577393, 0.059173584, 0.056945801, 0.054138184,
+ 0.053283691, 0.053131104, 0.052764893, 0.050811768, 0.04864502,
+ 0.046295166, 0.044921875, 0.043182373, 0.040161133, 0.036529541,
+ 0.032287598, 0.028411865, 0.022247314, 0.015960693, 0.0095825195,
+ 0.0032958984, -0.0028991699, -0.01159668, -0.018249512, -0.02532959,
+ -0.03137207, -0.035919189, -0.040710449, -0.044006348, -0.049163818,
+ -0.052246094, -0.055969238, -0.056396484, -0.055511475,
+ -0.052825928, -0.049194336, -0.046844482, -0.04598999, -0.045227051,
+ -0.044586182, -0.042388916, -0.039611816, -0.037719727,
+ -0.035766602, -0.032806396, -0.030700684, -0.027313232, -0.02444458,
+ -0.020019531, -0.015533447, -0.012145996, -0.0091552734,
+ -0.0064697266, -0.0040893555, -0.00048828125, 0.001953125,
+ 0.0048522949, 0.0061950684, 0.007019043, 0.0083007812, 0.0091247559,
+ 0.0094909668, 0.0098876953, 0.010894775, 0.011566162, 0.0105896,
+ 0.0083007812, 0.0047607422, 0.0010986328, -0.0036621094,
+ -0.0073242188, -0.010223389, -0.011505127, -0.011993408,
+ -0.012786865, -0.015350342, -0.017669678, -0.019500732,
+ -0.022613525, -0.025115967, -0.027862549, -0.027832031,
+ -0.028320312, -0.029602051, -0.030761719, -0.033111572,
+ -0.033630371, -0.032592773, -0.030914307, -0.027008057, -0.02355957,
+ -0.020507812, -0.017211914, -0.014709473, -0.0097351074,
+ -0.0033874512, 0.0032958984, 0.010284424, 0.014007568, 0.017272949,
+ 0.017791748, 0.018371582, 0.018096924, 0.017272949, 0.016326904,
+ 0.016021729, 0.017028809, 0.020507812, 0.025238037, 0.031280518,
+ 0.036834717, 0.040283203, 0.04284668, 0.045410156, 0.048339844,
+ 0.050109863, 0.04800415, 0.044311523, 0.040557861, 0.036010742,
+ 0.031982422, 0.026977539, 0.022766113, 0.018829346, 0.015411377,
+ 0.012359619, 0.010925293, 0.0095214844, 0.010498047, 0.012054443,
+ 0.014221191, 0.016326904, 0.017150879, 0.016784668, 0.01473999,
+ 0.012481689, 0.0090026855, 0.0057678223, 0.002746582,
+ -0.00024414062, -6.1035156e-05, -0.00042724609, -0.00039672852,
+ -0.0024414062, -0.0037841797, -0.0043334961, -0.0034790039,
+ -0.0015563965, 0.0011901855, 0.0047302246, 0.0079345703,
+ 0.011108398, 0.013885498, 0.017150879, 0.020874023, 0.024139404,
+ 0.028411865, 0.031860352, 0.036010742, 0.038330078, 0.038574219,
+ 0.03805542, 0.035980225, 0.033905029, 0.03112793, 0.027496338,
+ 0.024414062, 0.020690918, 0.017791748, 0.013549805, 0.0098876953,
+ 0.0071105957, 0.0046081543, 0.0029296875, 0.0013122559,
+ 0.0002746582, -0.0014343262, -0.0029907227, -0.0065307617,
+ -0.009979248, -0.014831543, -0.02041626, -0.027008057, -0.036132812,
+ -0.043670654, -0.049591064, -0.053894043, -0.057312012,
+ -0.059570312, -0.059051514, -0.057617188, -0.05581665, -0.054962158,
+ -0.053283691, -0.051300049, -0.049591064, -0.049407959,
+ -0.049560547, -0.0496521, -0.04788208, -0.044830322, -0.040771484,
+ -0.03616333, -0.031066895, -0.024902344, -0.019226074, -0.014312744,
+ -0.010925293, -0.0085754395, -0.0065612793, -0.0048217773,
+ -0.0020141602, -0.00039672852, 0.0014648438, 0.003326416,
+ 0.0067749023, 0.009979248, 0.014068604, 0.016052246, 0.017486572,
+ 0.017700195, 0.018127441, 0.018066406, 0.017608643, 0.016845703,
+ 0.015838623, 0.014404297, 0.013214111, 0.011901855, 0.010650635,
+ 0.0085754395, 0.0069885254, 0.0051269531, 0.0030212402,
+ 0.00015258789, -0.0031738281, -0.0065307617, -0.0090637207,
+ -0.010498047, -0.011505127, -0.012023926, -0.01260376, -0.012115479,
+ -0.010406494, -0.0086975098, -0.0063781738, -0.005859375,
+ -0.0042114258, -0.0034179688, -0.0012207031, 0.00057983398,
+ 0.0030822754, 0.0048828125, 0.0070800781, 0.010040283, 0.013793945,
+ 0.01763916, 0.020935059, 0.024047852, 0.026245117, 0.02822876,
+ 0.028381348, 0.028015137, 0.027618408, 0.027496338, 0.0284729,
+ 0.029174805, 0.029815674, 0.030670166, 0.033081055, 0.035797119,
+ 0.037445068, 0.039154053, 0.039825439, 0.040283203, 0.03918457,
+ 0.036987305, 0.033874512, 0.02935791, 0.025177002, 0.020507812,
+ 0.016479492, 0.013031006, 0.010070801, 0.0077209473, 0.0056152344,
+ 0.003326416, 0.00048828125, -0.0017089844, -0.0030517578,
+ -0.0029602051, -0.003112793, -0.0025024414, -0.0024414062,
+ -0.0021362305, -0.0023498535, -0.0029907227, -0.0043029785,
+ -0.0059814453, -0.0078735352, -0.01083374, -0.013397217,
+ -0.016448975, -0.018890381, -0.020568848, -0.020080566, -0.01852417,
+ -0.016845703, -0.014007568, -0.0105896, -0.0066833496,
+ -0.0030517578, 0.0014953613, 0.0065002441, 0.0098571777,
+ 0.013122559, 0.014404297, 0.015472412, 0.016571045, 0.018035889,
+ 0.018585205, 0.018371582, 0.016540527, 0.014099121, 0.011413574,
+ 0.009185791, 0.0065917969, 0.0032653809, 0.00054931641,
+ -0.0018005371, -0.0024719238, -0.0046081543, -0.0062255859,
+ -0.0078430176, -0.009979248, -0.011627197, -0.015289307,
+ -0.017456055, -0.019897461, -0.022918701, -0.025543213,
+ -0.028747559, -0.031524658, -0.036865234, -0.041534424,
+ -0.045410156, -0.046875, -0.048126221, -0.049499512, -0.049163818,
+ -0.048828125, -0.047790527, -0.04574585, -0.043579102, -0.040924072,
+ -0.040222168, -0.038360596, -0.036895752, -0.034210205,
+ -0.031616211, -0.028289795, -0.024200439, -0.020294189,
+ -0.015838623, -0.011993408, -0.007598877, -0.0036010742,
+ 0.00054931641, 0.004486084, 0.0074157715, 0.0098571777, 0.012054443,
+ 0.01473999, 0.017700195, 0.019744873, 0.022399902, 0.02432251,
+ 0.025817871, 0.027130127, 0.027709961, 0.0284729, 0.027893066,
+ 0.027496338, 0.026580811, 0.025634766, 0.023681641, 0.021972656,
+ 0.019775391, 0.017730713, 0.016052246, 0.014556885, 0.014434814,
+ 0.013763428, 0.012268066, 0.0105896, 0.0091247559, 0.0077819824,
+ 0.0054626465, 0.0030822754, 0.00067138672, -0.0012207031,
+ -0.0028686523, -0.0048217773, -0.0047912598, -0.004486084,
+ -0.002746582, -0.00067138672, 0.0012512207, 0.0037231445,
+ 0.0054321289, 0.0074157715, 0.010192871, 0.013214111, 0.016448975,
+ 0.018005371, 0.019134521, 0.018463135, 0.017944336, 0.016723633,
+ 0.016448975, 0.01651001, 0.01651001, 0.017669678, 0.019622803,
+ 0.022064209, 0.024017334, 0.025909424, 0.026977539, 0.027008057,
+ 0.026733398, 0.025634766, 0.024261475, 0.022247314, 0.020202637,
+ 0.017730713, 0.01663208, 0.015319824, 0.014404297, 0.013092041,
+ 0.0098266602, 0.0065307617, 0.0032653809, 0.00061035156,
+ -0.0028076172, -0.0061340332, -0.0094909668, -0.012115479,
+ -0.013244629, -0.014251709, -0.015075684, -0.015808105,
+ -0.015991211, -0.016418457, -0.016601562, -0.01663208, -0.01675415,
+ -0.017333984, -0.018615723, -0.019775391, -0.02053833, -0.020721436,
+ -0.021820068, -0.022918701, -0.023651123, -0.023895264,
+ -0.023590088, -0.02331543, -0.022338867, -0.020141602, -0.017669678,
+ -0.014068604, -0.010528564, -0.0055236816, 0, 0.0051574707,
+ 0.008972168, 0.011291504, 0.012207031, 0.012420654, 0.01159668,
+ 0.0105896, 0.009185791, 0.0078735352, 0.0067749023, 0.0052490234,
+ 0.0040588379, 0.0025024414, 0.0013427734, 0.0014038086,
+ 0.0009765625, 0.00076293945, -0.00079345703, -0.0029907227,
+ -0.0054626465, -0.0073547363, -0.0095825195, -0.011383057,
+ -0.012237549, -0.013000488, -0.014373779, -0.016448975,
+ -0.018341064, -0.020446777, -0.02331543, -0.025909424, -0.02835083,
+ -0.028869629, -0.028839111, -0.028686523, -0.028106689,
+ -0.027740479, -0.027435303, -0.027313232, -0.026672363,
+ -0.025604248, -0.02355957, -0.020263672, -0.016204834, -0.011383057,
+ -0.0068359375, -0.0024719238, 0.00021362305, 0.0022583008,
+ 0.0036621094, 0.0053710938, 0.0079040527, 0.010162354, 0.013214111,
+ 0.016052246, 0.019042969, 0.022064209, 0.024871826, 0.027618408,
+ 0.029205322, 0.030761719, 0.031921387, 0.032012939, 0.032562256,
+ 0.032714844, 0.032958984, 0.032318115, 0.031860352, 0.030822754,
+ 0.03024292, 0.029510498, 0.028167725, 0.027099609, 0.024810791,
+ 0.022674561, 0.019958496, 0.018218994, 0.016143799, 0.014373779,
+ 0.012145996, 0.010101318, 0.0079345703, 0.0063476562, 0.0045471191,
+ 0.003112793, 0.00085449219, -0.00088500977, -0.002532959,
+ -0.0035095215, -0.0039672852, -0.0041503906, -0.0031433105,
+ -0.0017700195, -3.0517578e-05, 0.0010681152, 0.0033874512,
+ 0.0053405762, 0.0074768066, 0.0082397461, 0.0075683594, 0.007019043,
+ 0.005279541, 0.004486084, 0.0035400391, 0.0035400391, 0.0047607422,
+ 0.0061645508, 0.0079345703, 0.0090332031, 0.010314941, 0.010681152,
+ 0.010467529, 0.010467529, 0.009979248, 0.009765625, 0.0090637207,
+ 0.0083007812, 0.0075683594, 0.0065917969, 0.0066223145,
+ 0.0054626465, 0.0040893555, 0.0021362305, -3.0517578e-05,
+ -0.0024719238, -0.0052490234, -0.008026123, -0.010375977,
+ -0.012573242, -0.01461792, -0.01651001, -0.017822266, -0.018981934,
+ -0.019622803, -0.019592285, -0.020172119, -0.020751953,
+ -0.021728516, -0.022186279, -0.02230835, -0.02230835, -0.022155762,
+ -0.022583008, -0.022338867, -0.023193359, -0.023284912,
+ -0.023406982, -0.022766113, -0.022216797, -0.022094727,
+ -0.021484375, -0.021026611, -0.019836426, -0.018005371,
+ -0.015533447, -0.012512207, -0.0092773438, -0.0061340332,
+ -0.0029907227, 0.00076293945, 0.00390625, 0.0065002441,
+ 0.0084228516, 0.010070801, 0.011566162, 0.012054443, 0.012573242,
+ 0.011779785, 0.011077881, 0.010131836, 0.0088500977, 0.0075073242,
+ 0.0054321289, 0.0044555664, 0.003692627, 0.0032348633, 0.0028991699,
+ 0.0022583008, 0.0026245117, 0.0021972656, 0.001953125,
+ 0.00079345703, -0.001159668, -0.0028381348, -0.0046386719,
+ -0.0059814453, -0.0075378418, -0.0087890625, -0.010192871,
+ -0.01083374, -0.011993408, -0.012695312, -0.012756348, -0.012908936,
+ -0.012695312, -0.013061523, -0.012756348, -0.012145996,
+ -0.011352539, -0.010253906, -0.0094909668, -0.0081787109,
+ -0.0067138672, -0.0047912598, -0.0016784668, 0.00085449219,
+ 0.0041809082, 0.0070495605, 0.0098571777, 0.013061523, 0.016052246,
+ 0.019012451, 0.020965576, 0.022613525, 0.023590088, 0.024169922,
+ 0.02432251, 0.024078369, 0.024261475, 0.023681641, 0.024291992,
+ 0.024475098, 0.025390625, 0.026306152, 0.026641846, 0.027008057,
+ 0.026672363, 0.026641846, 0.026153564, 0.025482178, 0.024108887,
+ 0.022155762, 0.020050049, 0.017578125, 0.01461792, 0.011932373,
+ 0.0090332031, 0.0069580078, 0.0048828125, 0.0032653809, 0.001953125,
+ 0.0007019043, -0.00036621094, -0.0019226074, -0.0037536621,
+ -0.0056152344, -0.0076904297, -0.0087280273, -0.0090942383,
+ -0.0088195801, -0.0081481934, -0.0072937012, -0.006439209,
+ -0.005279541, -0.0043640137, -0.0034179688, -0.003112793,
+ -0.0025024414, -0.0022888184, -0.0019226074, -0.0015869141,
+ -0.0015869141, -0.0015258789, -0.0016784668, -0.0017700195,
+ -0.0016784668, -0.0013427734, -0.0011291504, -0.00061035156, 0,
+ 0.00079345703, 0.0012207031, 0.0015869141, 0.0016479492,
+ 0.0015258789, 0.0012817383, 0.00094604492, 0.00045776367,
+ -0.0002746582, -0.00088500977, -0.0016479492, -0.0024108887,
+ -0.0036621094, -0.0050354004, -0.0063476562, -0.0079956055,
+ -0.0096435547, -0.011535645, -0.013458252, -0.014953613,
+ -0.016296387, -0.017364502, -0.01776123, -0.018280029, -0.018371582,
+ -0.018035889, -0.017456055, -0.016479492, -0.015838623,
+ -0.015167236, -0.015228271, -0.015380859, -0.015625, -0.015716553,
+ -0.015411377, -0.015197754, -0.015106201, -0.01473999, -0.014221191,
+ -0.013092041, -0.012054443, -0.010742188, -0.008605957,
+ -0.006439209, -0.0038757324, -0.0016479492, 0.00079345703,
+ 0.0026550293, 0.0045471191, 0.0065612793, 0.009185791, 0.011566162,
+ 0.013427734, 0.014404297, 0.015075684, 0.015411377, 0.015319824,
+ 0.014801025, 0.013977051, 0.013305664, 0.012634277, 0.011932373,
+ 0.010864258, 0.0099182129, 0.0098571777, 0.0093994141, 0.0091247559,
+ 0.0080566406, 0.0068359375, 0.0056762695, 0.0043640137,
+ 0.0037841797, 0.0027770996, 0.0023803711, 0.0017700195,
+ 0.0010375977, 0, -0.0011901855, -0.0020446777, -0.0028991699,
+ -0.0037841797, -0.0050964355, -0.0057983398, -0.0063476562,
+ -0.0065917969, -0.0063781738, -0.0061950684, -0.0056152344,
+ -0.0050354004, -0.0045471191, -0.0035705566, -0.0025939941,
+ -0.00091552734, 0.00082397461, 0.0028076172, 0.0045471191,
+ 0.0061950684, 0.0078430176, 0.0096435547, 0.010742188, 0.011474609,
+ 0.012176514, 0.01260376, 0.013153076, 0.013458252, 0.014129639,
+ 0.014801025, 0.015228271, 0.015991211, 0.016204834, 0.01663208,
+ 0.016601562, 0.016357422, 0.015808105, 0.014770508, 0.014007568,
+ 0.012939453, 0.012268066, 0.011444092, 0.01071167, 0.010070801,
+ 0.0086975098, 0.0075683594, 0.0058288574, 0.0040588379,
+ 0.0018615723, 6.1035156e-05, -0.0015258789, -0.0029602051,
+ -0.0040283203, -0.0055236816, -0.0065307617, -0.0078735352,
+ -0.0090942383, -0.010131836, -0.010925293, -0.011260986,
+ -0.011322021, -0.011199951, -0.010955811, -0.010925293, -0.0105896,
+ -0.010375977, -0.0097351074, -0.0092163086, -0.0085754395,
+ -0.0077819824, -0.007232666, -0.0067443848, -0.0063171387,
+ -0.0060119629, -0.0053405762, -0.0050048828, -0.0045166016,
+ -0.0040588379, -0.0035400391, -0.0030517578, -0.0029907227,
+ -0.0027160645, -0.0028076172, -0.0025024414, -0.0021972656,
+ -0.001953125, -0.0013122559, -0.00091552734, -0.00033569336,
+ -0.00012207031, -0.00024414062, -0.00054931641, -0.0010375977,
+ -0.0018615723, -0.0028686523, -0.0036010742, -0.0042724609,
+ -0.0046691895, -0.0052490234, -0.0056152344, -0.0061035156,
+ -0.0066833496, -0.0074768066, -0.0083007812, -0.0089111328,
+ -0.0093688965, -0.0096435547, -0.0096740723, -0.0093994141,
+ -0.0086669922, -0.0079040527, -0.0073242188, -0.007019043,
+ -0.0067749023, -0.0067138672, -0.0064697266, -0.0060424805,
+ -0.0054931641, -0.0048828125, -0.0044250488, -0.0039367676,
+ -0.0031738281, -0.0024414062, -0.0014953613, -0.00039672852,
+ 0.0007019043, 0.001739502, 0.0028991699, 0.0042724609, 0.005645752,
+ 0.0072021484, 0.0087585449, 0.010192871, 0.011627197, 0.012542725,
+ 0.013244629, 0.01361084, 0.013671875, 0.013580322, 0.013122559,
+ 0.012512207, 0.012145996, 0.011993408, 0.011932373, 0.011779785,
+ 0.011352539, 0.010742188, 0.0099487305, 0.0090942383, 0.0079956055,
+ 0.0068054199, 0.0057373047, 0.0047912598, 0.004119873, 0.003326416,
+ 0.0027770996, 0.0021057129, 0.0015869141, 0.0010375977,
+ 0.00024414062, -0.00030517578, -0.00085449219, -0.0012512207,
+ -0.0015869141, -0.002166748, -0.0025939941, -0.0032043457,
+ -0.0038757324, -0.0043640137, -0.0044250488, -0.004486084,
+ -0.004119873, -0.0036621094, -0.0028381348, -0.0020751953,
+ -0.0012817383, -0.00064086914, -0.00012207031, 0.00051879883,
+ 0.0012512207, 0.002166748, 0.0032653809, 0.0042419434, 0.0049743652,
+ 0.0056152344, 0.0059509277, 0.0061645508, 0.0062866211,
+ 0.0061035156, 0.0059204102, 0.005645752, 0.005645752, 0.0054016113,
+ 0.0051879883, 0.0050354004, 0.0049133301, 0.0049133301, 0.004699707,
+ 0.0045776367, 0.0043640137, 0.0040283203, 0.0033569336,
+ 0.0025024414, 0.0013122559, 6.1035156e-05, -0.0009765625,
+ -0.0021972656, -0.0028076172, -0.0036010742, -0.0038452148,
+ -0.0042419434, -0.004699707, -0.0052185059, -0.0058898926,
+ -0.0064697266, -0.0073242188, -0.0082397461, -0.0091552734,
+ -0.0096740723, -0.0099182129, -0.0096435547, -0.0091552734,
+ -0.0085449219, -0.0079040527, -0.0074768066, -0.0068969727,
+ -0.0066223145, -0.0062561035, -0.005859375, -0.0055236816,
+ -0.0049438477, -0.0045471191, -0.0039672852, -0.0035095215,
+ -0.0030822754, -0.002746582, -0.0026245117, -0.0025939941,
+ -0.002532959, -0.0024414062, -0.0020141602, -0.0015869141,
+ -0.001159668, -0.00067138672, -0.0002746582, 0.00021362305,
+ 0.00033569336, 0.00045776367, 0.00051879883, 0.00064086914,
+ 0.00079345703, 0.00088500977, 0.00094604492, 0.00082397461,
+ 0.00064086914, 0.00030517578, 0.00015258789, -0.00024414062,
+ -0.00061035156, -0.0011901855, -0.0016174316, -0.0020446777,
+ -0.0022888184, -0.0023803711, -0.0023803711, -0.0023803711,
+ -0.0023498535, -0.0022888184, -0.0020446777, -0.0018005371,
+ -0.0014343262, -0.0011901855, -0.00088500977, -0.00064086914,
+ -0.00045776367, -0.00039672852, -0.00033569336, -0.00015258789, 0,
+ 0.00030517578, 0.00054931641, 0.0010375977, 0.001373291,
+ 0.0016784668, 0.001953125, 0.0023193359, 0.0028381348, 0.0035095215,
+ 0.0043334961, 0.0049133301, 0.0056152344, 0.006072998, 0.0065917969,
+ 0.0068664551, 0.0072021484, 0.0073547363, 0.0074768066,
+ 0.0075378418, 0.0073547363, 0.0070800781, 0.0066223145,
+ 0.0062866211, 0.005859375, 0.0054321289, 0.0050048828, 0.0045776367,
+ 0.0043334961, 0.0039978027, 0.003692627, 0.0032958984, 0.0029602051,
+ 0.0024108887, 0.0019226074, 0.0014343262, 0.00088500977,
+ 0.00054931641, 0.00012207031, -0.00015258789, -0.00045776367,
+ -0.00067138672, -0.0009765625, -0.0012512207, -0.0015869141,
+ -0.001953125, -0.0022888184, -3.0517578e-05, -3.0517578e-05,
+ -3.0517578e-05, -3.0517578e-05, -3.0517578e-05, -3.0517578e-05,
+ -3.0517578e-05, -3.0517578e-05, -3.0517578e-05, -6.1035156e-05,
+ -3.0517578e-05, -6.1035156e-05, -3.0517578e-05, -6.1035156e-05,
+ -6.1035156e-05, -3.0517578e-05, -3.0517578e-05, -3.0517578e-05,
+ -3.0517578e-05, -3.0517578e-05, -3.0517578e-05, -3.0517578e-05,
+ -3.0517578e-05, -3.0517578e-05, -3.0517578e-05, -3.0517578e-05,
+ -3.0517578e-05, -3.0517578e-05, 0,
+ };
+
+static const unsigned defaultClickEmphasisLength = sizeof(defaultClickEmphasis) / sizeof(*defaultClickEmphasis);
+
diff --git a/muse2/muse/device.h b/muse2/muse/device.h
new file mode 100644
index 00000000..f039fc11
--- /dev/null
+++ b/muse2/muse/device.h
@@ -0,0 +1,46 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: device.h,v 1.1.1.1 2003/10/27 18:51:58 wschweer Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __DEVICE_H__
+#define __DEVICE_H__
+
+#include <qstring.h>
+
+//---------------------------------------------------------
+// Device
+//---------------------------------------------------------
+
+class Device {
+
+ public:
+ enum DeviceType { MidiDevice, WaveDevice };
+
+ protected:
+ QString _name;
+ DeviceType _type;
+ int _port;
+
+ public:
+ Device() {}
+ virtual ~Device() {}
+ Device(const QString& name, DeviceType t = MidiDevice)
+ : _name(name), _type(t) {}
+
+ virtual QString open(int) = 0;
+ virtual void close() = 0;
+
+ const QString& name() const { return _name; }
+ void setName(const QString& s) { _name = s; }
+ const DeviceType type() const { return _type; }
+ void setDeviceType(DeviceType t) { _type = t; }
+ int port() const { return _port; }
+ void setPort(int p) { _port = p; }
+ };
+
+#endif
+
diff --git a/muse2/muse/driver/Makefile.am b/muse2/muse/driver/Makefile.am
new file mode 100644
index 00000000..da3eba07
--- /dev/null
+++ b/muse2/muse/driver/Makefile.am
@@ -0,0 +1,10 @@
+include $(top_srcdir)/common.am
+
+noinst_LIBRARIES = libdriver.a
+
+AM_CXXFLAGS += $(JACK_CFLAGS)
+
+libdriver_a_SOURCES = audiodev.h alsamidi.cpp alsamidi.h jack.cpp jackaudio.h \
+ dummyaudio.cpp alsatimer.cpp alsatimer.h timerdev.h rtctimer.cpp rtctimer.h \
+ jackmidi.cpp jackmidi.h
+
diff --git a/muse2/muse/driver/Makefile.in b/muse2/muse/driver/Makefile.in
new file mode 100644
index 00000000..8c773db5
--- /dev/null
+++ b/muse2/muse/driver/Makefile.in
@@ -0,0 +1,595 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/common.am
+subdir = muse/driver
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
+ $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libdriver_a_AR = $(AR) $(ARFLAGS)
+libdriver_a_LIBADD =
+am_libdriver_a_OBJECTS = alsamidi.$(OBJEXT) jack.$(OBJEXT) \
+ dummyaudio.$(OBJEXT) alsatimer.$(OBJEXT) rtctimer.$(OBJEXT) \
+ jackmidi.$(OBJEXT)
+libdriver_a_OBJECTS = $(am_libdriver_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libdriver_a_SOURCES)
+DIST_SOURCES = $(libdriver_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCBOOKSTYLE = @DOCBOOKSTYLE@
+DOCBOOKTARGETS = @DOCBOOKTARGETS@
+DOT = @DOT@
+DOTPATH = @DOTPATH@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@
+FST_CFLAGS = @FST_CFLAGS@
+FST_LIBS = @FST_LIBS@
+Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@
+Fluidsynth_LIBS = @Fluidsynth_LIBS@
+GIVERTCAP = @GIVERTCAP@
+GREP = @GREP@
+HAVEDOT = @HAVEDOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JADE = @JADE@
+LASH_CFLAGS = @LASH_CFLAGS@
+LASH_LIBS = @LASH_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LO_CFLAGS = @LO_CFLAGS@
+LO_LIBS = @LO_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUSECXXFLAGS = @MUSECXXFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSGMLS = @NSGMLS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCH = @PCH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIB = @PYTHON_LIB@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+QTDIR_BIN = @QTDIR_BIN@
+QTDIR_INC = @QTDIR_INC@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+SUIDBUILD = @SUIDBUILD@
+SUIDINSTALL = @SUIDINSTALL@
+USE_SSE = @USE_SSE@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+have_docbook = @have_docbook@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+synth_fluid = @synth_fluid@
+synth_fluidsynth = @synth_fluidsynth@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \
+ -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(JACK_CFLAGS)
+AM_CPPFLAGS =
+MOC = $(QTDIR_BIN)/moc
+#UIC = $(QTDIR_BIN)/uic3
+UIC = /usr/bin/uic3
+UIFILES = $(wildcard *.ui)
+MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \
+ if grep -q Q_OBJECT $$h; then \
+ echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \
+ fi; \
+ done)
+
+BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+SUFFIXES = .ui .h.gch
+noinst_LIBRARIES = libdriver.a
+libdriver_a_SOURCES = audiodev.h alsamidi.cpp alsamidi.h jack.cpp jackaudio.h \
+ dummyaudio.cpp alsatimer.cpp alsatimer.h timerdev.h rtctimer.cpp rtctimer.h \
+ jackmidi.cpp jackmidi.h
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .ui .h.gch .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/driver/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu muse/driver/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libdriver.a: $(libdriver_a_OBJECTS) $(libdriver_a_DEPENDENCIES)
+ -rm -f libdriver.a
+ $(libdriver_a_AR) libdriver.a $(libdriver_a_OBJECTS) $(libdriver_a_LIBADD)
+ $(RANLIB) libdriver.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamidi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsatimer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummyaudio.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jack.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jackmidi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtctimer.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+de:
+ @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done
+
+nde:
+ @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done
+
+.ui.o: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(CXXCOMPILE) -c $*.cpp -o $*.o
+ $(RM) $*.cpp moc_$*.cpp moc_$*.o
+
+.ui.lo: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(LTCXXCOMPILE) -c $*.cpp -o $*.lo
+ $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o
+
+moc_%.cpp: %.h
+ $(MOC) $< -o $@
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/muse2/muse/driver/alsamidi.cpp b/muse2/muse/driver/alsamidi.cpp
new file mode 100644
index 00000000..3b15fc6f
--- /dev/null
+++ b/muse2/muse/driver/alsamidi.cpp
@@ -0,0 +1,917 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: alsamidi.cpp,v 1.8.2.7 2009/11/19 04:20:33 terminator356 Exp $
+// (C) Copyright 2000-2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+
+#include "alsamidi.h"
+#include "globals.h"
+#include "midi.h"
+#include "mididev.h"
+#include "../midiport.h"
+#include "../midiseq.h"
+#include "../midictrl.h"
+#include "../audio.h"
+#include "mpevent.h"
+//#include "sync.h"
+#include "utils.h"
+#include "audiodev.h"
+#include "xml.h"
+
+static int alsaSeqFdi = -1;
+static int alsaSeqFdo = -1;
+
+snd_seq_t* alsaSeq;
+static snd_seq_addr_t musePort;
+
+//---------------------------------------------------------
+// MidiAlsaDevice
+//---------------------------------------------------------
+
+MidiAlsaDevice::MidiAlsaDevice(const snd_seq_addr_t& a, const QString& n)
+ : MidiDevice(n)
+ {
+ adr = a;
+ init();
+ }
+
+//---------------------------------------------------------
+// selectWfd
+//---------------------------------------------------------
+
+int MidiAlsaDevice::selectWfd()
+ {
+ return alsaSeqFdo;
+ }
+
+//---------------------------------------------------------
+// open
+//---------------------------------------------------------
+
+QString MidiAlsaDevice::open()
+{
+ _openFlags &= _rwFlags; // restrict to available bits
+ snd_seq_port_subscribe_t* subs;
+ // Allocated on stack, no need to call snd_seq_port_subscribe_free() later.
+ snd_seq_port_subscribe_alloca(&subs);
+
+ QString estr;
+ int wer = 0;
+ int rer = 0;
+
+ // subscribe for writing
+ if (_openFlags & 1)
+ {
+ snd_seq_port_subscribe_set_sender(subs, &musePort);
+ snd_seq_port_subscribe_set_dest(subs, &adr);
+ // Not already subscribed (or error)? Then try subscribing.
+ if(snd_seq_get_port_subscription(alsaSeq, subs) < 0)
+ {
+ //int error = snd_seq_subscribe_port(alsaSeq, subs);
+ wer = snd_seq_subscribe_port(alsaSeq, subs);
+ //if (error < 0)
+ if(wer < 0)
+ //return QString("Play: ")+QString(snd_strerror(error));
+ estr += (QString("Play: ") + QString(snd_strerror(wer)) + QString(" "));
+ }
+ if(!wer)
+ _writeEnable = true;
+ }
+
+ // subscribe for reading
+ if (_openFlags & 2)
+ {
+ snd_seq_port_subscribe_set_dest(subs, &musePort);
+ snd_seq_port_subscribe_set_sender(subs, &adr);
+ // Not already subscribed (or error)? Then try subscribing.
+ if(snd_seq_get_port_subscription(alsaSeq, subs) < 0)
+ {
+ //int error = snd_seq_subscribe_port(alsaSeq, subs);
+ rer = snd_seq_subscribe_port(alsaSeq, subs);
+ //if (error < 0)
+ if(rer < 0)
+ //return QString("Rec: ") + QString(snd_strerror(error));
+ estr += (QString("Rec: ") + QString(snd_strerror(rer)));
+ }
+ if(!rer)
+ _readEnable = true;
+ }
+
+
+ if(wer < 0 || rer < 0)
+ return estr;
+
+ return QString("OK");
+}
+
+//---------------------------------------------------------
+// close
+//---------------------------------------------------------
+
+void MidiAlsaDevice::close()
+{
+ snd_seq_port_subscribe_t* subs;
+ // Allocated on stack, no need to call snd_seq_port_subscribe_free() later.
+ snd_seq_port_subscribe_alloca(&subs);
+
+ // Changed by T356. This function appears to be called only by MidiPort::setMidiDevice(),
+ // which closes then opens the device.
+ // Because the open flags are set BEFORE setMidiDevice() is called, we must ignore the flags.
+ //
+ // NOTE: Tested: The read unsubscribe works ok but not the write.
+ // As viewed in say, qjackctl, the connection is clearly lost,
+ // but strangely the events are still accepted, ie, playback notes
+ // are still heard etc. Tried an alsa midi device AND external fluidsynth inst.
+ //
+ // Also, jack running and with jack midi disabled, we get messages like
+ // MidiAlsaDevice::0x84512c0 putEvent(): midi write error: No such device
+ // dst 16:0
+ // only sometimes (not when playing notes), but with jack midi turned on,
+ // we don't get the messages. With jack stopped we get the messages
+ // no matter if jack midi is turned on or not.
+
+ //if (_openFlags & 1) {
+ //if (!(_openFlags & 1))
+ {
+ snd_seq_port_subscribe_set_sender(subs, &musePort);
+ snd_seq_port_subscribe_set_dest(subs, &adr);
+
+ // Already subscribed? Then unsubscribe.
+ if(!snd_seq_get_port_subscription(alsaSeq, subs))
+ {
+ if(!snd_seq_unsubscribe_port(alsaSeq, subs))
+ _writeEnable = false;
+ else
+ printf("MidiAlsaDevice::close Error unsubscribing alsa midi port for writing\n");
+ }
+ else
+ _writeEnable = false;
+ }
+
+ //if (_openFlags & 2) {
+ //if (!(_openFlags & 2))
+ {
+ snd_seq_port_subscribe_set_dest(subs, &musePort);
+ snd_seq_port_subscribe_set_sender(subs, &adr);
+
+ // Already subscribed? Then unsubscribe.
+ if(!snd_seq_get_port_subscription(alsaSeq, subs))
+ {
+ if(!snd_seq_unsubscribe_port(alsaSeq, subs))
+ _readEnable = false;
+ else
+ printf("MidiAlsaDevice::close Error unsubscribing alsa midi port for reading\n");
+ }
+ else
+ _readEnable = false;
+ }
+}
+
+//---------------------------------------------------------
+// writeRouting
+//---------------------------------------------------------
+
+void MidiAlsaDevice::writeRouting(int level, Xml& xml) const
+{
+ // p3.3.45
+ // If this device is not actually in use by the song, do not write any routes.
+ // This prevents bogus routes from being saved and propagated in the med file.
+ if(midiPort() == -1)
+ return;
+
+ QString s;
+ /*
+ //if(rwFlags() & 2) // Readable
+ {
+ //RouteList* rl = _inRoutes;
+ //for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ for (ciRoute r = _inRoutes.begin(); r != _inRoutes.end(); ++r)
+ {
+ // Since an ALSA midi device supports read + write, this is the only way we can tell if this route is using the device as input.
+ if(r->type == Route::TRACK_ROUTE)
+ continue;
+
+ if(!r->name().isEmpty())
+ {
+ xml.tag(level++, "Route");
+
+ //xml.strTag(level, "srcNode", r->name());
+ xml.tag(level, "source type=\"%d\" name=\"%s\"/", r->type, r->name().latin1());
+
+ //xml.strTag(level, "dstNode", name());
+ xml.tag(level, "dest type=\"%d\" name=\"%s\"/", Route::ALSA_MIDI_ROUTE, name().latin1());
+
+ xml.etag(level--, "Route");
+ }
+ }
+ }
+ */
+
+ for (ciRoute r = _outRoutes.begin(); r != _outRoutes.end(); ++r)
+ {
+ //if(r->type != Route::TRACK_ROUTE)
+ //{
+ // printf("MidiAlsaDevice::writeRouting Warning out route is not TRACK_ROUTE type\n");
+ // continue;
+ //}
+
+ if(!r->name().isEmpty())
+ {
+ //xml.tag(level++, "Route");
+
+ s = QT_TR_NOOP("Route");
+ if(r->channel != -1)
+ s += QString(QT_TR_NOOP(" channel=\"%1\"")).arg(r->channel);
+ xml.tag(level++, s);
+
+ /*
+ //xml.strTag(level, "srcNode", name());
+ if(r->channel != -1)
+ //xml.tag(level, "source type=\"%d\" channel=\"%d\" name=\"%s\"/", Route::ALSA_MIDI_ROUTE, r->channel, name().latin1());
+ //xml.tag(level, "source type=\"%d\" channel=\"%d\" name=\"%s\"/", Route::MIDI_DEVICE_ROUTE, r->channel, name().latin1());
+ xml.tag(level, "source devtype=\"%d\" channel=\"%d\" name=\"%s\"/", MidiDevice::ALSA_MIDI, r->channel, name().latin1());
+ else
+ //xml.tag(level, "source type=\"%d\" name=\"%s\"/", Route::ALSA_MIDI_ROUTE, name().latin1());
+ //xml.tag(level, "source type=\"%d\" name=\"%s\"/", Route::MIDI_DEVICE_ROUTE, name().latin1());
+ */
+ //xml.tag(level, "source devtype=\"%d\" name=\"%s\"/", MidiDevice::ALSA_MIDI, name().latin1());
+ xml.tag(level, "source devtype=\"%d\" name=\"%s\"/", MidiDevice::ALSA_MIDI, Xml::xmlString(name()).latin1());
+
+ /*
+ //xml.strTag(level, "dstNode", r->name());
+ if(r->channel != -1)
+ {
+ if(r->type == Route::MIDI_DEVICE_ROUTE)
+ xml.tag(level, "dest devtype=\"%d\" channel=\"%d\" name=\"%s\"/", r->device->deviceType(), r->channel, r->name().latin1());
+ else
+ xml.tag(level, "dest type=\"%d\" channel=\"%d\" name=\"%s\"/", r->type, r->channel, r->name().latin1());
+ }
+ else
+ {
+ if(r->type == Route::MIDI_DEVICE_ROUTE)
+ xml.tag(level, "dest devtype=\"%d\" name=\"%s\"/", r->device->deviceType(), r->name().latin1());
+ else
+ xml.tag(level, "dest type=\"%d\" name=\"%s\"/", r->type, r->name().latin1());
+ }
+ */
+
+ s = QT_TR_NOOP("dest");
+ if(r->type == Route::MIDI_DEVICE_ROUTE)
+ s += QString(QT_TR_NOOP(" devtype=\"%1\"")).arg(r->device->deviceType());
+ else
+ if(r->type != Route::TRACK_ROUTE)
+ s += QString(QT_TR_NOOP(" type=\"%1\"")).arg(r->type);
+ //s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(r->name());
+ s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(Xml::xmlString(r->name()));
+ xml.tag(level, s);
+
+ xml.etag(level--, "Route");
+ }
+ }
+}
+
+//---------------------------------------------------------
+// putEvent
+//---------------------------------------------------------
+
+bool MidiAlsaDevice::putMidiEvent(const MidiPlayEvent& e)
+ {
+ if (midiOutputTrace) {
+ printf("MidiOut: midiAlsa: ");
+ e.dump();
+ }
+ int chn = e.channel();
+ int a = e.dataA();
+ int b = e.dataB();
+
+ snd_seq_event_t event;
+ memset(&event, 0, sizeof(event));
+ event.queue = SND_SEQ_QUEUE_DIRECT;
+ event.source = musePort;
+ event.dest = adr;
+
+ switch(e.type()) {
+ case ME_NOTEON:
+ snd_seq_ev_set_noteon(&event, chn, a, b);
+ break;
+ case ME_NOTEOFF:
+ snd_seq_ev_set_noteoff(&event, chn, a, 0);
+ break;
+ case ME_PROGRAM:
+ snd_seq_ev_set_pgmchange(&event, chn, a);
+ break;
+ case ME_CONTROLLER:
+#if 1
+ snd_seq_ev_set_controller(&event, chn, a, b);
+#else
+ {
+ int a = e.dataA();
+ int b = e.dataB();
+ int chn = e.channel();
+ // p3.3.37
+ //if (a < 0x1000) { // 7 Bit Controller
+ if (a < CTRL_14_OFFSET) { // 7 Bit Controller
+ snd_seq_ev_set_controller(&event, chn, a, b);
+ }
+ //else if (a < 0x20000) { // 14 bit high resolution controller
+ else if (a < CTRL_RPN_OFFSET) { // 14 bit high resolution controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ a = (ctrlH << 7) + ctrlL;
+ snd_seq_ev_set_controller(&event, chn, a, b);
+ event.type = SND_SEQ_EVENT_CONTROL14;
+ }
+ //else if (a < 0x30000) { // RPN 7-Bit Controller
+ else if (a < CTRL_NRPN_OFFSET) { // RPN 7-Bit Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ a = (ctrlH << 7) + ctrlL;
+ b <<= 7;
+ snd_seq_ev_set_controller(&event, chn, a, b);
+ event.type = SND_SEQ_EVENT_REGPARAM;
+ }
+ //else if (a < 0x40000) { // NRPN 7-Bit Controller
+ else if (a < CTRL_INTERNAL_OFFSET) { // NRPN 7-Bit Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ a = (ctrlH << 7) + ctrlL;
+ b <<= 7;
+ snd_seq_ev_set_controller(&event, chn, a, b);
+ event.type = SND_SEQ_EVENT_NONREGPARAM;
+ }
+ //else if (a < 0x60000) { // RPN14 Controller
+ else if (a < CTRL_NRPN14_OFFSET) { // RPN14 Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ a = (ctrlH << 7) + ctrlL;
+ snd_seq_ev_set_controller(&event, chn, a, b);
+ event.type = SND_SEQ_EVENT_REGPARAM;
+ }
+ //else if (a < 0x70000) { // NRPN14 Controller
+ else if (a < CTRL_NONE_OFFSET) { // NRPN14 Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ a = (ctrlH << 7) + ctrlL;
+ snd_seq_ev_set_controller(&event, chn, a, b);
+ event.type = SND_SEQ_EVENT_NONREGPARAM;
+ }
+ else {
+ printf("putEvent: unknown controller type 0x%x\n", a);
+ }
+ }
+#endif
+ break;
+ case ME_PITCHBEND:
+ snd_seq_ev_set_pitchbend(&event, chn, a);
+ break;
+ case ME_POLYAFTER:
+ // chnEvent2(chn, 0xa0, a, b);
+ break;
+ case ME_AFTERTOUCH:
+ snd_seq_ev_set_chanpress(&event, chn, a);
+ break;
+ case ME_SYSEX:
+ {
+ const unsigned char* p = e.data();
+ int n = e.len();
+ int len = n + sizeof(event) + 2;
+ char buf[len];
+ event.type = SND_SEQ_EVENT_SYSEX;
+ event.flags = SND_SEQ_EVENT_LENGTH_VARIABLE;
+ event.data.ext.len = n + 2;
+ event.data.ext.ptr = (void*)(buf + sizeof(event));
+ memcpy(buf, &event, sizeof(event));
+ char* pp = buf + sizeof(event);
+ *pp++ = 0xf0;
+ memcpy(pp, p, n);
+ pp += n;
+ *pp = 0xf7;
+ return putEvent(&event);
+ }
+ case ME_SONGPOS:
+ event.data.control.value = a;
+ event.type = SND_SEQ_EVENT_SONGPOS;
+ break;
+ case ME_CLOCK:
+ event.type = SND_SEQ_EVENT_CLOCK;
+ break;
+ case ME_START:
+ event.type = SND_SEQ_EVENT_START;
+ break;
+ case ME_CONTINUE:
+ event.type = SND_SEQ_EVENT_CONTINUE;
+ break;
+ case ME_STOP:
+ event.type = SND_SEQ_EVENT_STOP;
+ break;
+ default:
+ printf("MidiAlsaDevice::putEvent(): event type %d not implemented\n",
+ e.type());
+ return true;
+ }
+ return putEvent(&event);
+ }
+
+//---------------------------------------------------------
+// putEvent
+// return false if event is delivered
+//---------------------------------------------------------
+
+bool MidiAlsaDevice::putEvent(snd_seq_event_t* event)
+ {
+ int error;
+
+ do {
+ error = snd_seq_event_output_direct(alsaSeq, event);
+ int len = snd_seq_event_length(event);
+ if (error == len) {
+// printf(".");fflush(stdout);
+ return false;
+ }
+ if (error < 0) {
+ if (error == -12) {
+// printf("?");fflush(stdout);
+ return true;
+ }
+ else {
+ fprintf(stderr, "MidiAlsaDevice::%p putEvent(): midi write error: %s\n",
+ this, snd_strerror(error));
+ fprintf(stderr, " dst %d:%d\n", adr.client, adr.port);
+ //exit(-1);
+ }
+ }
+ else
+ fprintf(stderr, "MidiAlsaDevice::putEvent(): midi write returns %d, expected %d: %s\n",
+ error, len, snd_strerror(error));
+ } while (error == -12);
+ return true;
+ }
+
+//---------------------------------------------------------
+// initMidiAlsa
+// return true on error
+//---------------------------------------------------------
+
+bool initMidiAlsa()
+ {
+ if (debugMsg)
+ printf("initMidiAlsa\n");
+ int error = snd_seq_open(&alsaSeq, "hw", SND_SEQ_OPEN_DUPLEX, SND_SEQ_NONBLOCK);
+ if (error < 0) {
+ fprintf(stderr, "Could not open ALSA sequencer: %s\n",
+ snd_strerror(error));
+ return true;
+ }
+ const int inCap = SND_SEQ_PORT_CAP_SUBS_READ;
+ const int outCap = SND_SEQ_PORT_CAP_SUBS_WRITE;
+
+ snd_seq_client_info_t *cinfo;
+ snd_seq_client_info_alloca(&cinfo);
+ snd_seq_client_info_set_client(cinfo, -1);
+
+ while (snd_seq_query_next_client(alsaSeq, cinfo) >= 0) {
+ snd_seq_port_info_t *pinfo;
+ snd_seq_port_info_alloca(&pinfo);
+ snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo));
+ snd_seq_port_info_set_port(pinfo, -1);
+
+ while (snd_seq_query_next_port(alsaSeq, pinfo) >= 0) {
+ unsigned int capability = snd_seq_port_info_get_capability(pinfo);
+ if ((capability & outCap) == 0) {
+ const char *name = snd_seq_port_info_get_name(pinfo);
+ if (strcmp("Timer", name) == 0 ||
+ strcmp("Announce", name) == 0 ||
+ strcmp("Receiver", name) == 0)
+ continue;
+ }
+ snd_seq_addr_t adr = *snd_seq_port_info_get_addr(pinfo);
+ MidiAlsaDevice* dev = new MidiAlsaDevice(adr, QString(snd_seq_port_info_get_name(pinfo)));
+ int flags = 0;
+ if (capability & outCap)
+ flags |= 1;
+ if (capability & inCap)
+ flags |= 2;
+ dev->setrwFlags(flags);
+ if (debugMsg)
+ printf("ALSA port add: <%s>, %d:%d flags %d 0x%0x\n",
+ snd_seq_port_info_get_name(pinfo),
+ adr.client, adr.port,
+ flags, capability);
+ midiDevices.add(dev);
+
+ /*
+ // Experimental... Need to list 'sensible' devices first and ignore unwanted ones...
+ // Add instance last in midi device list.
+ for(int i = 0; i < MIDI_PORTS; ++i)
+ {
+ MidiPort* mp = &midiPorts[i];
+ if(mp->device() == 0)
+ {
+ // midiSeq might not be initialzed yet!
+ //midiSeq->msgSetMidiDevice(mp, dev);
+ mp->setMidiDevice(dev);
+
+ //muse->changeConfig(true); // save configuration file
+ //update();
+ break;
+ }
+ }
+ */
+
+ }
+ }
+
+ // p3.3.38
+ //snd_seq_set_client_name(alsaSeq, "MusE Sequencer");
+ snd_seq_set_client_name(alsaSeq, audioDevice->clientName());
+
+ int ci = snd_seq_poll_descriptors_count(alsaSeq, POLLIN);
+ int co = snd_seq_poll_descriptors_count(alsaSeq, POLLOUT);
+
+ if (ci > 1 || co > 1) {
+ printf("ALSA midi: cannot handle more than one poll fd\n");
+ abort();
+ }
+
+ struct pollfd pfdi[ci];
+ struct pollfd pfdo[co];
+ snd_seq_poll_descriptors(alsaSeq, pfdi, ci, POLLIN);
+ snd_seq_poll_descriptors(alsaSeq, pfdo, co, POLLOUT);
+ alsaSeqFdo = pfdo[0].fd;
+ alsaSeqFdi = pfdi[0].fd;
+
+ int port = snd_seq_create_simple_port(alsaSeq, "MusE Port 0",
+ inCap | outCap | SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_WRITE,
+ SND_SEQ_PORT_TYPE_APPLICATION);
+ if (port < 0) {
+ perror("create port");
+ exit(1);
+ }
+ musePort.port = port;
+ musePort.client = snd_seq_client_id(alsaSeq);
+
+ //-----------------------------------------
+ // subscribe to "Announce"
+ // this enables callbacks for any
+ // alsa port changes
+ //-----------------------------------------
+
+ snd_seq_addr_t aadr;
+ aadr.client = SND_SEQ_CLIENT_SYSTEM;
+ aadr.port = SND_SEQ_PORT_SYSTEM_ANNOUNCE;
+
+ snd_seq_port_subscribe_t* subs;
+ snd_seq_port_subscribe_alloca(&subs);
+ snd_seq_port_subscribe_set_dest(subs, &musePort);
+ snd_seq_port_subscribe_set_sender(subs, &aadr);
+ error = snd_seq_subscribe_port(alsaSeq, subs);
+ if (error < 0) {
+ printf("Alsa: Subscribe System failed: %s", snd_strerror(error));
+ return true;
+ }
+ return false;
+ }
+
+struct AlsaPort {
+ snd_seq_addr_t adr;
+ char* name;
+ int flags;
+ AlsaPort(snd_seq_addr_t a, const char* s, int f) {
+ adr = a;
+ name = strdup(s);
+ flags = f;
+ }
+ };
+
+static std::list<AlsaPort> portList;
+
+//---------------------------------------------------------
+// alsaScanMidiPorts
+//---------------------------------------------------------
+
+void alsaScanMidiPorts()
+ {
+// printf("alsa scan midi ports\n");
+ const int inCap = SND_SEQ_PORT_CAP_SUBS_READ;
+ const int outCap = SND_SEQ_PORT_CAP_SUBS_WRITE;
+
+ portList.clear();
+
+ snd_seq_client_info_t* cinfo;
+ snd_seq_client_info_alloca(&cinfo);
+ snd_seq_client_info_set_client(cinfo, 0);
+
+ while (snd_seq_query_next_client(alsaSeq, cinfo) >= 0) {
+ snd_seq_port_info_t *pinfo;
+ snd_seq_port_info_alloca(&pinfo);
+ snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo));
+ snd_seq_port_info_set_port(pinfo, -1);
+ while (snd_seq_query_next_port(alsaSeq, pinfo) >= 0) {
+ unsigned int capability = snd_seq_port_info_get_capability(pinfo);
+ if (((capability & outCap) == 0)
+ && ((capability & inCap) == 0))
+ continue;
+ snd_seq_addr_t adr;
+ const char* name;
+ adr = *snd_seq_port_info_get_addr(pinfo);
+ name = snd_seq_port_info_get_name(pinfo);
+ if (adr.client == musePort.client && adr.port == musePort.port)
+ continue;
+ int flags = 0;
+ if (capability & outCap)
+ flags |= 1;
+ if (capability & inCap)
+ flags |= 2;
+// printf("ALSA port add: <%s>, flags %d\n", name, flags);
+ portList.push_back(AlsaPort(adr, name, flags));
+ }
+ }
+ //
+ // check for devices to delete
+ //
+ for (iMidiDevice i = midiDevices.begin(); i != midiDevices.end();) {
+ MidiAlsaDevice* d = dynamic_cast<MidiAlsaDevice*>(*i);
+ if (d == 0) {
+ ++i;
+ continue;
+ }
+ std::list<AlsaPort>::iterator k = portList.begin();
+ for (; k != portList.end(); ++k) {
+ if (k->adr.client == d->adr.client
+ && k->adr.port == d->adr.port) {
+ break;
+ }
+ }
+ if (k == portList.end()) {
+ if (d->midiPort() != -1)
+ midiPorts[d->midiPort()].setMidiDevice(0);
+ iMidiDevice k = i;
+// printf("erase device\n");
+ ++i;
+ midiDevices.erase(k);
+ }
+ else {
+ ++i;
+ }
+ }
+ //
+ // check for devices to add
+ //
+ for (std::list<AlsaPort>::iterator k = portList.begin(); k != portList.end(); ++k) {
+ iMidiDevice i = midiDevices.begin();
+// printf("ALSA port: <%s>\n", k->name);
+ for (;i != midiDevices.end(); ++i) {
+ MidiAlsaDevice* d = dynamic_cast<MidiAlsaDevice*>(*i);
+ if (d == 0)
+ continue;
+ if ((k->adr.client == d->adr.client) && (k->adr.port == d->adr.port)) {
+ break;
+ }
+ }
+ if (i == midiDevices.end()) {
+ // add device
+ MidiAlsaDevice* dev = new MidiAlsaDevice(k->adr,
+ QString(k->name));
+ dev->setrwFlags(k->flags);
+ midiDevices.add(dev);
+// printf("add device\n");
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// alsaSelectRfd
+//---------------------------------------------------------
+
+int alsaSelectRfd()
+ {
+ return alsaSeqFdi;
+ }
+
+//---------------------------------------------------------
+// alsaSelectWfd
+//---------------------------------------------------------
+
+int alsaSelectWfd()
+ {
+ return alsaSeqFdo;
+ }
+
+//---------------------------------------------------------
+// processInput
+//---------------------------------------------------------
+
+void alsaProcessMidiInput()
+{
+ MidiRecordEvent event;
+ snd_seq_event_t* ev;
+
+ for (;;)
+ {
+ int rv = snd_seq_event_input(alsaSeq, &ev);
+// printf("AlsaInput %d\n", rv);
+ if (rv < 0) {
+// printf("AlsaMidi: read error %s\n", snd_strerror(rv));
+ return;
+ }
+ switch(ev->type) {
+ case SND_SEQ_EVENT_PORT_SUBSCRIBED:
+ case SND_SEQ_EVENT_PORT_UNSUBSCRIBED:
+ return;
+ case SND_SEQ_EVENT_CLIENT_START:
+ case SND_SEQ_EVENT_CLIENT_EXIT:
+ // return;
+ // on first start of a software synthesizer we only
+ // get CLIENT_START event and no PORT_START, why?
+
+ case SND_SEQ_EVENT_PORT_START:
+ case SND_SEQ_EVENT_PORT_EXIT:
+ alsaScanMidiPorts();
+ audio->midiPortsChanged(); // signal gui
+ snd_seq_free_event(ev);
+ return;
+ }
+
+ int curPort = -1;
+ MidiAlsaDevice* mdev = 0;
+ //
+ // find real source device
+ //
+ for (iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i) {
+ MidiAlsaDevice* d = dynamic_cast<MidiAlsaDevice*>(*i);
+ if (d && d->adr.client == ev->source.client
+ && d->adr.port == ev->source.port) {
+ curPort = d->midiPort();
+ mdev = d;
+ }
+ }
+
+ if (mdev == 0 || curPort == -1) {
+ if (debugMsg) {
+ fprintf(stderr, "no port %d:%d found for received alsa event\n",
+ ev->source.client, ev->source.port);
+ }
+ snd_seq_free_event(ev);
+ return;
+ }
+
+ /*
+ if(curPort == -1)
+ {
+ if(mdev == 0)
+ {
+ if (debugMsg)
+ {
+ fprintf(stderr, "no port %d:%d found for received alsa event\n",
+ ev->source.client, ev->source.port);
+ }
+ }
+ else
+ {
+ // Allow the sync detect mechanisms to work, even if device is not assigned to a port.
+ if(ev->type == SND_SEQ_EVENT_CLOCK)
+ mdev->syncInfo().trigMCSyncDetect();
+ else
+ if(ev->type == SND_SEQ_EVENT_TICK)
+ mdev->syncInfo().trigTickDetect();
+ }
+ snd_seq_free_event(ev);
+ return;
+ }
+ */
+
+ event.setType(0); // mark as unused
+ event.setPort(curPort);
+ event.setB(0);
+
+ switch(ev->type)
+ {
+ case SND_SEQ_EVENT_NOTEON:
+ case SND_SEQ_EVENT_KEYPRESS:
+ event.setChannel(ev->data.note.channel);
+ event.setType(ME_NOTEON);
+ event.setA(ev->data.note.note);
+ event.setB(ev->data.note.velocity);
+ break;
+
+ case SND_SEQ_EVENT_NOTEOFF:
+ event.setChannel(ev->data.note.channel);
+ event.setType(ME_NOTEOFF);
+ event.setA(ev->data.note.note);
+ event.setB(ev->data.note.velocity);
+ break;
+
+ case SND_SEQ_EVENT_CHANPRESS:
+ event.setChannel(ev->data.control.channel);
+ event.setType(ME_AFTERTOUCH);
+ event.setA(ev->data.control.value);
+ break;
+
+ case SND_SEQ_EVENT_PGMCHANGE:
+ event.setChannel(ev->data.control.channel);
+ event.setType(ME_PROGRAM);
+ event.setA(ev->data.control.value);
+ break;
+
+ case SND_SEQ_EVENT_PITCHBEND:
+ event.setChannel(ev->data.control.channel);
+ event.setType(ME_PITCHBEND);
+ event.setA(ev->data.control.value);
+ break;
+
+ case SND_SEQ_EVENT_CONTROLLER:
+ event.setChannel(ev->data.control.channel);
+ event.setType(ME_CONTROLLER);
+ event.setA(ev->data.control.param);
+ event.setB(ev->data.control.value);
+ break;
+
+ case SND_SEQ_EVENT_CLOCK:
+ midiSeq->realtimeSystemInput(curPort, ME_CLOCK);
+ //mdev->syncInfo().trigMCSyncDetect();
+ break;
+
+ case SND_SEQ_EVENT_START:
+ midiSeq->realtimeSystemInput(curPort, ME_START);
+ break;
+
+ case SND_SEQ_EVENT_CONTINUE:
+ midiSeq->realtimeSystemInput(curPort, ME_CONTINUE);
+ break;
+
+ case SND_SEQ_EVENT_STOP:
+ midiSeq->realtimeSystemInput(curPort, ME_STOP);
+ break;
+
+ case SND_SEQ_EVENT_TICK:
+ midiSeq->realtimeSystemInput(curPort, ME_TICK);
+ //mdev->syncInfo().trigTickDetect();
+ break;
+
+ case SND_SEQ_EVENT_SYSEX:
+
+ // TODO: Deal with large sysex, which are broken up into chunks!
+ // For now, do not accept if the first byte is not SYSEX or the last byte is not EOX,
+ // meaning it's a chunk, possibly with more chunks to follow.
+ if((*((unsigned char*)ev->data.ext.ptr) != ME_SYSEX) ||
+ (*(((unsigned char*)ev->data.ext.ptr) + ev->data.ext.len - 1) != ME_SYSEX_END))
+ {
+ printf("MusE: alsaProcessMidiInput sysex chunks not supported!\n");
+ break;
+ }
+
+ event.setTime(0); // mark as used
+ event.setType(ME_SYSEX);
+ event.setData((unsigned char*)(ev->data.ext.ptr)+1,
+ ev->data.ext.len-2);
+ break;
+ case SND_SEQ_EVENT_PORT_SUBSCRIBED:
+ case SND_SEQ_EVENT_PORT_UNSUBSCRIBED: // write port is released
+ break;
+ case SND_SEQ_EVENT_SONGPOS:
+ midiSeq->setSongPosition(curPort, ev->data.control.value);
+ break;
+ case SND_SEQ_EVENT_SENSING:
+ break;
+ case SND_SEQ_EVENT_QFRAME:
+ midiSeq->mtcInputQuarter(curPort, ev->data.control.value);
+ break;
+ // case SND_SEQ_EVENT_CLIENT_START:
+ // case SND_SEQ_EVENT_CLIENT_EXIT:
+ // case SND_SEQ_EVENT_CLIENT_CHANGE:
+ // case SND_SEQ_EVENT_PORT_CHANGE:
+ // case SND_SEQ_EVENT_SONGSEL:
+ // case SND_SEQ_EVENT_TIMESIGN:
+ // case SND_SEQ_EVENT_KEYSIGN:
+ // case SND_SEQ_EVENT_SETPOS_TICK:
+ // case SND_SEQ_EVENT_SETPOS_TIME:
+ // case SND_SEQ_EVENT_TEMPO:
+ // case SND_SEQ_EVENT_TUNE_REQUEST:
+ // case SND_SEQ_EVENT_RESET:
+
+ // case SND_SEQ_EVENT_NOTE:
+ // case SND_SEQ_EVENT_CONTROL14:
+ // case SND_SEQ_EVENT_NONREGPARAM:
+ // case SND_SEQ_EVENT_REGPARAM:
+ default:
+ printf("ALSA Midi input: type %d not handled\n", ev->type);
+ break;
+ }
+ if(event.type())
+ {
+ mdev->recordEvent(event);
+ // p3.3.26 1/23/10 Moved to MidiDevice now. Anticipating Jack midi support, so don't make it ALSA specific. Tim.
+ //if(ev->type != SND_SEQ_EVENT_SYSEX)
+ // Trigger general activity indicator detector. Sysex has no channel, don't trigger.
+ // midiPorts[curPort].syncInfo().trigActDetect(event.channel());
+ }
+
+ snd_seq_free_event(ev);
+ if (rv == 0)
+ break;
+ }
+}
+
diff --git a/muse2/muse/driver/alsamidi.h b/muse2/muse/driver/alsamidi.h
new file mode 100644
index 00000000..6c19ff0d
--- /dev/null
+++ b/muse2/muse/driver/alsamidi.h
@@ -0,0 +1,53 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: alsamidi.h,v 1.2 2004/01/14 09:06:43 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __ALSAMIDI_H__
+#define __ALSAMIDI_H__
+
+#include <config.h>
+#include <alsa/asoundlib.h>
+
+#include "mididev.h"
+
+class Xml;
+
+//---------------------------------------------------------
+// MidiAlsaDevice
+//---------------------------------------------------------
+
+class MidiAlsaDevice : public MidiDevice {
+ public:
+ snd_seq_addr_t adr;
+
+ private:
+ virtual QString open();
+ virtual void close();
+ virtual void processInput() {}
+ virtual int selectRfd() { return -1; }
+ virtual int selectWfd();
+
+ bool putEvent(snd_seq_event_t*);
+ virtual bool putMidiEvent(const MidiPlayEvent&);
+
+ public:
+ MidiAlsaDevice() {}
+ MidiAlsaDevice(const snd_seq_addr_t&, const QString& name);
+ virtual ~MidiAlsaDevice() {}
+ virtual void* clientPort() { return (void*)&adr; }
+ virtual void writeRouting(int, Xml&) const;
+ virtual inline int deviceType() { return ALSA_MIDI; }
+ };
+
+extern bool initMidiAlsa();
+extern int alsaSelectRfd();
+extern int alsaSelectWfd();
+extern void alsaProcessMidiInput();
+extern void alsaScanMidiPorts();
+
+#endif
+
+
diff --git a/muse2/muse/driver/alsatimer.cpp b/muse2/muse/driver/alsatimer.cpp
new file mode 100644
index 00000000..d851410d
--- /dev/null
+++ b/muse2/muse/driver/alsatimer.cpp
@@ -0,0 +1,225 @@
+ //=========================================================
+ // MusE
+ // Linux Music Editor
+ // $Id: alsatimer.cpp,v 1.1.2.9 2009/03/28 01:46:10 terminator356 Exp $
+ //
+ // Plenty of code borrowed from timer.c example in
+ // alsalib 1.0.7
+ //
+ // (C) Copyright 2004 Robert Jonsson (rj@spamatica.se)
+ //=========================================================
+
+ #include "alsatimer.h"
+ #include <climits>
+
+#define TIMER_DEBUG 0
+
+ AlsaTimer::AlsaTimer()
+ {
+ if(TIMER_DEBUG)
+ fprintf(stderr,"AlsaTimer::AlsaTimer(this=%p) called\n",this);
+ handle = NULL;
+ id = NULL;
+ info = NULL;
+ params = NULL;
+ findBest = true;
+ }
+
+ AlsaTimer::~AlsaTimer()
+ {
+ if(TIMER_DEBUG)
+ fprintf(stderr,"AlsaTimer::~AlsaTimer(this=%p) called\n",this);
+ if (handle)
+ snd_timer_close(handle);
+ if (id) snd_timer_id_free(id);
+ if (info) snd_timer_info_free(info);
+ if (params) snd_timer_params_free(params);
+ }
+
+ signed int AlsaTimer::initTimer()
+ {
+ if(TIMER_DEBUG)
+ printf("AlsaTimer::initTimer(this=%p)\n",this);
+
+ int err;
+ int devclass = SND_TIMER_CLASS_GLOBAL;
+ int sclass = SND_TIMER_CLASS_NONE;
+ int card = 0;
+ int device = SND_TIMER_GLOBAL_SYSTEM;
+ int subdevice = 0;
+ int test_ids[] = { SND_TIMER_GLOBAL_SYSTEM
+ , SND_TIMER_GLOBAL_RTC
+#ifdef SND_TIMER_GLOBAL_HPET
+ , SND_TIMER_GLOBAL_HPET
+#endif
+ };
+ int max_ids = sizeof(test_ids) / sizeof(int);
+ long best_res = LONG_MAX;
+ //int best_dev = -1; // SND_TIMER_GLOBAL_SYSTEM;
+ int best_dev = SND_TIMER_GLOBAL_SYSTEM; // p3.3.51
+ int i;
+
+ if (id || info || params) {
+ fprintf(stderr,"AlsaTimer::initTimer(): called on initialised timer!\n");
+ return fds->fd;
+ }
+ snd_timer_id_malloc(&id);
+ snd_timer_info_malloc(&info);
+ snd_timer_params_malloc(&params);
+
+ if (findBest) {
+ for (i = 0; i < max_ids; ++i) {
+ device = test_ids[i];
+ sprintf(timername, "hw:CLASS=%i,SCLASS=%i,CARD=%i,DEV=%i,SUBDEV=%i", devclass, sclass, card, device, subdevice);
+ if ((err = snd_timer_open(&handle, timername, SND_TIMER_OPEN_NONBLOCK)) < 0) {
+ continue;
+ }
+ if ((err = snd_timer_info(handle, info)) < 0) {
+ snd_timer_close(handle);
+ continue;
+ }
+ // select a non slave timer with the lowest resolution value
+ int is_slave = snd_timer_info_is_slave(info);
+ long res = snd_timer_info_get_resolution(info);
+ if ((is_slave == 0) && (best_res > res)) {
+ best_res = res;
+ best_dev = device;
+ }
+ snd_timer_close(handle);
+ }
+ device = best_dev;
+ }
+
+ // p3.3.51 Removed.
+ //if(best_dev==-1)
+ // return -1; // no working timer found
+
+ sprintf(timername, "hw:CLASS=%i,SCLASS=%i,CARD=%i,DEV=%i,SUBDEV=%i", devclass, sclass, card, device, subdevice);
+ if ((err = snd_timer_open(&handle, timername, SND_TIMER_OPEN_NONBLOCK))<0) {
+ fprintf(stderr, "AlsaTimer::initTimer(): timer open %i (%s)\n", err, snd_strerror(err));
+ return -1; // p3.3.51
+ }
+
+ if ((err = snd_timer_info(handle, info)) < 0) {
+ fprintf(stderr, "AlsaTimer::initTimer(): timer info %i (%s)\n", err, snd_strerror(err));
+ return -1;
+ }
+
+ //if(debugMsg)
+ fprintf(stderr, "AlsaTimer::initTimer(): best available ALSA timer: %s\n", snd_timer_info_get_name(info));
+
+ snd_timer_params_set_auto_start(params, 1);
+ snd_timer_params_set_ticks(params, 1);
+
+ if ((err = snd_timer_params(handle, params)) < 0) {
+ fprintf(stderr, "AlsaTimer::initTimer(): timer params %i (%s)\n", err, snd_strerror(err));
+ return -1;
+ }
+
+ count = snd_timer_poll_descriptors_count(handle);
+ fds = (pollfd *)calloc(count, sizeof(pollfd));
+ if (fds == NULL) {
+ fprintf(stderr, "AlsaTimer::initTimer(): malloc error\n");
+ return -1;
+ }
+ if ((err = snd_timer_poll_descriptors(handle, fds, count)) < 0) {
+ fprintf(stderr, "AlsaTimer::initTimer(): snd_timer_poll_descriptors error: %s\n", snd_strerror(err));
+ return -1;
+ }
+ return fds->fd;
+ }
+
+ unsigned int AlsaTimer::setTimerResolution(unsigned int resolution)
+ {
+ if(TIMER_DEBUG)
+ printf("AlsaTimer::setTimerResolution(%d)\n",resolution);
+ /* Resolution of an AlsaTimer is fixed - it cannot be set */
+ return 0;
+ }
+
+ unsigned int AlsaTimer::setTimerFreq(unsigned int freq)
+ {
+ signed int err;
+ unsigned int setTick, actFreq;
+
+ if(TIMER_DEBUG)
+ printf("AlsaTimer::setTimerFreq(this=%p)\n",this);
+
+ setTick = (1000000000 / snd_timer_info_get_resolution(info)) / freq;
+
+ if (setTick == 0) {
+ // return, print error if freq is below 500 (timing will suffer)
+ if (((1000000000.0 / snd_timer_info_get_resolution(info)) / snd_timer_params_get_ticks(params)) < 500) {
+ fprintf(stderr,"AlsaTimer::setTimerTicks(): requested freq %u Hz too high for timer (max is %g)\n",
+ freq, 1000000000.0 / snd_timer_info_get_resolution(info));
+ fprintf(stderr," freq stays at %ld Hz\n",
+ (long int)((1000000000.0 / snd_timer_info_get_resolution(info)) / snd_timer_params_get_ticks(params)));
+ }
+
+ return 0;
+ }
+ actFreq = (1000000000 / snd_timer_info_get_resolution(info)) / setTick;
+ if (actFreq != freq) {
+ fprintf(stderr,"AlsaTimer::setTimerTicks(): warning: requested %u Hz, actual freq is %u Hz\n",
+ freq, actFreq);
+ }
+ if(TIMER_DEBUG)
+ printf("AlsaTimer::setTimerFreq(): Setting ticks (period) to %d ticks\n", setTick);
+ snd_timer_params_set_auto_start(params, 1);
+ snd_timer_params_set_ticks(params, setTick);
+ if ((err = snd_timer_params(handle, params)) < 0) {
+ fprintf(stderr, "AlsaTimer::setTimerFreq(): timer params %i (%s)\n", err, snd_strerror(err));
+ return 0;
+ }
+
+ return actFreq;
+ }
+
+ unsigned int AlsaTimer::getTimerResolution()
+ {
+ return snd_timer_info_get_resolution(info);
+ }
+
+ unsigned int AlsaTimer::getTimerFreq()
+ {
+ return (1000000000 / snd_timer_info_get_resolution(info)) / snd_timer_params_get_ticks(params);
+ }
+
+ bool AlsaTimer::startTimer()
+ {
+ if(TIMER_DEBUG)
+ printf("AlsaTimer::startTimer(this=%p): handle=%p\n",this,handle);
+ int err;
+ if ((err = snd_timer_start(handle)) < 0) {
+ fprintf(stderr, "AlsaTimer::startTimer(): timer start %i (%s)\n", err, snd_strerror(err));
+ return false;
+ }
+ return true;
+ }
+
+ bool AlsaTimer::stopTimer()
+ {
+ int err;
+ if(TIMER_DEBUG)
+ printf("AlsaTimer::stopTimer(this=%p): handle=%p\n",this,handle);
+ if ((err = snd_timer_stop(handle)) < 0) {
+ fprintf(stderr, "AlsaTimer::stopTimer(): timer stop %i (%s)\n", err, snd_strerror(err));
+ return false;
+ }
+ return true;
+ }
+
+ unsigned int AlsaTimer::getTimerTicks(bool printTicks)
+ {
+ //if(TIMER_DEBUG)
+ // printf("AlsaTimer::getTimerTicks\n");
+ snd_timer_read_t tr;
+ tr.ticks = 0;
+ while (snd_timer_read(handle, &tr, sizeof(tr)) == sizeof(tr)) {
+ if (printTicks) {
+ printf("TIMER: resolution = %uns, ticks = %u\n",
+ tr.resolution, tr.ticks);
+ }
+ }
+ return tr.ticks;
+ }
diff --git a/muse2/muse/driver/alsatimer.h b/muse2/muse/driver/alsatimer.h
new file mode 100644
index 00000000..211ba5ec
--- /dev/null
+++ b/muse2/muse/driver/alsatimer.h
@@ -0,0 +1,52 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: alsatimer.h,v 1.1.2.4 2009/03/09 02:05:18 terminator356 Exp $
+//
+// Plenty of code borrowed from timer.c example in
+// alsalib 1.0.7
+//
+// (C) Copyright 2004 Robert Jonsson (rj@spamatica.se)
+//=========================================================
+
+#ifndef __ALSATIMER_H__
+#define __ALSATIMER_H__
+
+#include "alsa/asoundlib.h"
+#include "timerdev.h"
+
+
+//---------------------------------------------------------
+// AlsaTimer
+//---------------------------------------------------------
+
+class AlsaTimer : public Timer{
+
+ snd_timer_t *handle;
+ snd_timer_id_t *id;
+ snd_timer_info_t *info;
+ snd_timer_params_t *params;
+ struct pollfd *fds;
+ char timername[64];
+ signed int count;
+ unsigned int ticks;
+ bool findBest;
+
+ public:
+ AlsaTimer();
+ virtual ~AlsaTimer();
+
+ virtual signed int initTimer();
+ virtual unsigned int setTimerResolution(unsigned int resolution);
+ virtual unsigned int getTimerResolution();
+ virtual unsigned int setTimerFreq(unsigned int freq);
+ virtual unsigned int getTimerFreq();
+
+ virtual bool startTimer();
+ virtual bool stopTimer();
+ virtual unsigned int getTimerTicks(bool printTicks=false);
+
+ void setFindBestTimer(bool b) { findBest = b; }
+};
+
+#endif //__ALSATIMER_H__
diff --git a/muse2/muse/driver/audiodev.h b/muse2/muse/driver/audiodev.h
new file mode 100644
index 00000000..39ff822e
--- /dev/null
+++ b/muse2/muse/driver/audiodev.h
@@ -0,0 +1,74 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: audiodev.h,v 1.5.2.2 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __AUDIODEV_H__
+#define __AUDIODEV_H__
+
+#include <qstring.h>
+#include <list>
+
+class MidiPlayEvent;
+
+//---------------------------------------------------------
+// AudioDevice
+//---------------------------------------------------------
+
+class AudioDevice {
+
+ public:
+ enum { DUMMY_AUDIO=0, JACK_AUDIO=1 }; // p3.3.52
+
+ AudioDevice() {}
+ virtual ~AudioDevice() {}
+
+ virtual int deviceType() = 0; // p3.3.52
+
+ //virtual void start() = 0;
+ virtual void start(int priority) = 0;
+
+ virtual void stop () = 0;
+ virtual int framePos() const = 0;
+ virtual unsigned frameTime() const = 0;
+
+ virtual float* getBuffer(void* port, unsigned long nframes) = 0;
+
+ virtual std::list<QString> outputPorts(bool midi = false, int aliases = -1) = 0;
+ virtual std::list<QString> inputPorts(bool midi = false, int aliases = -1) = 0;
+
+ virtual void registerClient() = 0;
+
+ virtual const char* clientName() = 0;
+
+ //virtual void* registerOutPort(const char* name) = 0;
+ //virtual void* registerInPort(const char* name) = 0;
+ virtual void* registerOutPort(const char* /*name*/, bool /*midi*/) = 0;
+ virtual void* registerInPort(const char* /*name*/, bool /*midi*/) = 0;
+
+ virtual void unregisterPort(void*) = 0;
+ virtual void connect(void*, void*) = 0;
+ virtual void disconnect(void*, void*) = 0;
+ virtual int connections(void* /*clientPort*/) = 0;
+ virtual void setPortName(void* p, const char* n) = 0;
+ virtual void* findPort(const char* name) = 0;
+ virtual QString portName(void* port) = 0;
+ virtual int getState() = 0;
+ virtual unsigned getCurFrame() = 0;
+ virtual bool isRealtime() = 0;
+ virtual int realtimePriority() const = 0; // return zero if not realtime
+ virtual void startTransport() = 0;
+ virtual void stopTransport() = 0;
+ virtual void seekTransport(unsigned frame) = 0;
+ virtual void seekTransport(const Pos &p) = 0;
+ virtual void setFreewheel(bool f) = 0;
+ virtual void graphChanged() {}
+ virtual void registrationChanged() {}
+ virtual int setMaster(bool f) = 0;
+ };
+
+#endif
+
diff --git a/muse2/muse/driver/dummyaudio.cpp b/muse2/muse/driver/dummyaudio.cpp
new file mode 100644
index 00000000..a17a99e7
--- /dev/null
+++ b/muse2/muse/driver/dummyaudio.cpp
@@ -0,0 +1,454 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: dummyaudio.cpp,v 1.3.2.16 2009/12/20 05:00:35 terminator356 Exp $
+// (C) Copyright 2002-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <pthread.h>
+#include <sys/poll.h>
+#include <qmessagebox.h>
+
+#include "config.h"
+#include "audio.h"
+#include "audiodev.h"
+#include "globals.h"
+#include "song.h"
+#include "driver/alsatimer.h"
+#include "pos.h"
+#include "gconfig.h"
+#include "utils.h"
+
+class MidiPlayEvent;
+
+#define DEBUG_DUMMY 0
+//---------------------------------------------------------
+// DummyAudioDevice
+//---------------------------------------------------------
+
+//static const unsigned dummyFrames = 1024;
+
+enum Cmd {
+trSeek,
+trStart,
+trStop
+};
+
+struct Msg {
+ enum Cmd cmd;
+ int arg;
+};
+
+
+class DummyAudioDevice : public AudioDevice {
+ pthread_t dummyThread;
+ // Changed by Tim. p3.3.15
+ //float buffer[1024];
+ float* buffer;
+ int _realTimePriority;
+
+ public:
+ std::list<Msg> cmdQueue;
+ Audio::State state;
+ int _framePos;
+ int playPos;
+ bool realtimeFlag;
+
+ DummyAudioDevice();
+ virtual ~DummyAudioDevice()
+ {
+ // Added by Tim. p3.3.15
+ free(buffer);
+ }
+
+ virtual inline int deviceType() { return DUMMY_AUDIO; } // p3.3.52
+
+ //virtual void start();
+ virtual void start(int);
+
+ virtual void stop ();
+ virtual int framePos() const {
+ if(DEBUG_DUMMY)
+ printf("DummyAudioDevice::framePos %d\n", _framePos);
+ return _framePos;
+ }
+
+ virtual float* getBuffer(void* /*port*/, unsigned long nframes)
+ {
+ // p3.3.30
+ //if (nframes > dummyFrames) {
+ //printf("error: segment size > 1024\n");
+ if (nframes > segmentSize) {
+ printf("DummyAudioDevice::getBuffer nframes > segment size\n");
+
+ exit(-1);
+ }
+ return buffer;
+ }
+
+ virtual std::list<QString> outputPorts(bool midi = false, int aliases = -1);
+ virtual std::list<QString> inputPorts(bool midi = false, int aliases = -1);
+
+ virtual void registerClient() {}
+
+ virtual const char* clientName() { return "MusE"; }
+
+ //virtual void* registerOutPort(const char*) {
+ virtual void* registerOutPort(const char*, bool) {
+ return (void*)1;
+ }
+ //virtual void* registerInPort(const char*) {
+ virtual void* registerInPort(const char*, bool) {
+ return (void*)2;
+ }
+ virtual void unregisterPort(void*) {}
+ virtual void connect(void*, void*) {}
+ virtual void disconnect(void*, void*) {}
+ virtual int connections(void* /*clientPort*/) { return 0; }
+ virtual void setPortName(void*, const char*) {}
+ virtual void* findPort(const char*) { return 0;}
+ virtual QString portName(void*) {
+ return QString("mops");
+ }
+ virtual int getState() {
+// if(DEBUG_DUMMY)
+// printf("DummyAudioDevice::getState %d\n", state);
+
+ return state; }
+ virtual unsigned getCurFrame() {
+ if(DEBUG_DUMMY)
+ printf("DummyAudioDevice::getCurFrame %d\n", _framePos);
+
+ return _framePos; }
+ virtual unsigned frameTime() const {
+ return lrint(curTime() * sampleRate);
+ }
+ virtual bool isRealtime() { return realtimeFlag; }
+ //virtual int realtimePriority() const { return 40; }
+ virtual int realtimePriority() const { return _realTimePriority; }
+ virtual void startTransport() {
+ if(DEBUG_DUMMY)
+ printf("DummyAudioDevice::startTransport playPos=%d\n", playPos);
+ Msg trcmd;
+ trcmd.cmd = trStart;
+ trcmd.arg = playPos;
+ cmdQueue.push_front(trcmd);
+/* state = Audio::START_PLAY;
+ audio->sync(state, playPos);
+ state = Audio::PLAY;*/
+ }
+ virtual void stopTransport() {
+ if(DEBUG_DUMMY)
+ printf("DummyAudioDevice::stopTransport, playPos=%d\n", playPos);
+ state = Audio::STOP;
+ }
+ virtual int setMaster(bool) { return 1; }
+
+ virtual void seekTransport(const Pos &p)
+ {
+ if(DEBUG_DUMMY)
+ printf("DummyAudioDevice::seekTransport frame=%d topos=%d\n",playPos, p.frame());
+ Msg trcmd;
+ trcmd.cmd = trSeek;
+ trcmd.arg = p.frame();
+ cmdQueue.push_front(trcmd);
+ playPos = p.frame();
+ }
+ virtual void seekTransport(unsigned pos) {
+ if(DEBUG_DUMMY)
+ printf("DummyAudioDevice::seekTransport frame=%d topos=%d\n",playPos,pos);
+ Msg trcmd;
+ trcmd.cmd = trSeek;
+ trcmd.arg = pos;
+ cmdQueue.push_front(trcmd);
+ playPos = pos;
+/*
+ Audio::State tempState = state;
+ state = Audio::START_PLAY;
+ audio->sync(state, playPos);
+ state = tempState;*/
+ }
+ virtual void setFreewheel(bool) {}
+ void setRealTime() { realtimeFlag = true; }
+ };
+
+DummyAudioDevice* dummyAudio = 0;
+
+DummyAudioDevice::DummyAudioDevice()
+ {
+ // Added by Tim. p3.3.15
+ // p3.3.30
+ //posix_memalign((void**)&buffer, 16, sizeof(float) * dummyFrames);
+ posix_memalign((void**)&buffer, 16, sizeof(float) * config.dummyAudioBufSize);
+
+ realtimeFlag = false;
+ state = Audio::STOP;
+ _framePos = 0;
+ playPos = 0;
+ cmdQueue.clear();
+ }
+
+//---------------------------------------------------------
+// exitDummyAudio
+//---------------------------------------------------------
+
+void exitDummyAudio()
+{
+ if(dummyAudio)
+ delete dummyAudio;
+ dummyAudio = NULL;
+ audioDevice = NULL;
+}
+
+//---------------------------------------------------------
+// initDummyAudio
+//---------------------------------------------------------
+
+bool initDummyAudio()
+ {
+ dummyAudio = new DummyAudioDevice();
+ audioDevice = dummyAudio;
+ return false;
+ }
+
+//---------------------------------------------------------
+// outputPorts
+//---------------------------------------------------------
+
+std::list<QString> DummyAudioDevice::outputPorts(bool midi, int /*aliases*/)
+ {
+ std::list<QString> clientList;
+ if(!midi)
+ {
+ clientList.push_back(QString("output1"));
+ clientList.push_back(QString("output2"));
+ }
+ return clientList;
+ }
+
+//---------------------------------------------------------
+// inputPorts
+//---------------------------------------------------------
+
+std::list<QString> DummyAudioDevice::inputPorts(bool midi, int /*aliases*/)
+ {
+ std::list<QString> clientList;
+ if(!midi)
+ {
+ clientList.push_back(QString("input1"));
+ clientList.push_back(QString("input2"));
+ }
+ return clientList;
+ }
+
+//---------------------------------------------------------
+// dummyLoop
+//---------------------------------------------------------
+
+static void* dummyLoop(void* ptr)
+ {
+ //unsigned int tickRate = 25;
+
+ // p3.3.30
+ //sampleRate = 25600;
+ sampleRate = config.dummyAudioSampleRate;
+ //segmentSize = dummyFrames;
+ segmentSize = config.dummyAudioBufSize;
+ //unsigned int tickRate = sampleRate / dummyFrames;
+ unsigned int tickRate = sampleRate / segmentSize;
+
+ AlsaTimer timer;
+ fprintf(stderr, "Get alsa timer for dummy driver:\n");
+ timer.setFindBestTimer(false);
+ int fd = timer.initTimer();
+ if (fd==-1) {
+ // QMessageBox::critical( 0, /*tr*/(QString("Failed to start timer for dummy audio driver!")),
+ // /*tr*/(QString("No functional timer was available.\n"
+ // "Alsa timer not available, check if module snd_timer is available and /dev/snd/timer is available")));
+ fprintf(stderr, "Failed to start timer for dummy audio driver! No functional timer was available.\n"
+ "Alsa timer not available, check if module snd_timer is available and /dev/snd/timer is available\n");
+ pthread_exit(0);
+ }
+
+ /* Depending on nature of the timer, the requested tickRate might not
+ * be available. The return value is the nearest available frequency,
+ * so use this to reset our dummpy sampleRate to keep everything
+ * consistent.
+ */
+ tickRate = timer.setTimerFreq( /*250*/ tickRate );
+
+ // p3.3.31
+ // If it didn't work, get the actual rate.
+ if(tickRate == 0)
+ tickRate = timer.getTimerFreq();
+
+ sampleRate = tickRate * segmentSize;
+ timer.startTimer();
+
+ DummyAudioDevice *drvPtr = (DummyAudioDevice *)ptr;
+
+ pollfd myPollFd;
+
+ myPollFd.fd = fd;
+ myPollFd.events = POLLIN;
+
+ /*
+ doSetuid();
+ struct sched_param rt_param;
+ int rv;
+ memset(&rt_param, 0, sizeof(sched_param));
+ int type;
+ rv = pthread_getschedparam(pthread_self(), &type, &rt_param);
+ if (rv != 0)
+ perror("get scheduler parameter");
+ if (type != SCHED_FIFO) {
+ fprintf(stderr, "Driver thread not running SCHED_FIFO, trying to set...\n");
+
+ memset(&rt_param, 0, sizeof(sched_param));
+ //rt_param.sched_priority = 1;
+ rt_param.sched_priority = realtimePriority();
+ rv = pthread_setschedparam(pthread_self(), SCHED_FIFO, &rt_param);
+ if (rv != 0)
+ perror("set realtime scheduler");
+ memset(&rt_param, 0, sizeof(sched_param));
+ rv = pthread_getschedparam(pthread_self(), &type, &rt_param);
+ if (rv != 0)
+ perror("get scheduler parameter");
+ if (type == SCHED_FIFO) {
+ drvPtr->setRealTime();
+ fprintf(stderr, "Thread succesfully set to SCHED_FIFO\n");
+ }
+ else {
+ fprintf(stderr, "Unable to set thread to SCHED_FIFO\n");
+ }
+ }
+ undoSetuid();
+ */
+
+#ifndef __APPLE__
+ doSetuid();
+ //if (realTimePriority) {
+ if (realTimeScheduling) {
+ //
+ // check if we really got realtime priviledges
+ //
+ int policy;
+ if ((policy = sched_getscheduler (0)) < 0) {
+ printf("cannot get current client scheduler for audio dummy thread: %s!\n", strerror(errno));
+ }
+ else
+ {
+ if (policy != SCHED_FIFO)
+ printf("audio dummy thread _NOT_ running SCHED_FIFO\n");
+ else if (debugMsg) {
+ struct sched_param rt_param;
+ memset(&rt_param, 0, sizeof(sched_param));
+ int type;
+ int rv = pthread_getschedparam(pthread_self(), &type, &rt_param);
+ if (rv == -1)
+ perror("get scheduler parameter");
+ printf("audio dummy thread running SCHED_FIFO priority %d\n",
+ rt_param.sched_priority);
+ }
+ }
+ }
+ undoSetuid();
+#endif
+
+ /* unsigned long tick = 0;*/ // prevent compiler warning: unused variable
+ for (;;) {
+ int _pollWait = 10; // ms
+ unsigned long count = 0;
+ while (count < 1 /*250/tickRate*/) // will loop until the next tick occurs
+ {
+ /*int n = */ poll(&myPollFd, 1 /* npfd */, _pollWait);
+ count += timer.getTimerTicks();
+ while (drvPtr->cmdQueue.size())
+ {
+ Msg &msg = drvPtr->cmdQueue.back();
+ drvPtr->cmdQueue.pop_back();
+ switch(msg.cmd) {
+ case trSeek:
+ {
+ //printf("trSeek\n");
+ drvPtr->playPos = msg.arg;
+ Audio::State tempState = drvPtr->state;
+ drvPtr->state = Audio::START_PLAY;
+ audio->sync(drvPtr->state, msg.arg);
+ drvPtr->state = tempState;
+ }
+ break;
+ case trStart:
+ {
+ //printf("trStart\n");
+ drvPtr->state = Audio::START_PLAY;
+ audio->sync(drvPtr->state, msg.arg);
+ drvPtr->state = Audio::PLAY;
+ }
+ break;
+ case trStop:
+ break;
+ default:
+ printf("dummyLoop: Unknown command!\n");
+ }
+ }
+ }
+ audio->process(segmentSize);
+ int increment = segmentSize; // 1 //tickRate / sampleRate * segmentSize;
+ drvPtr->_framePos+=increment;
+ if (drvPtr->state == Audio::PLAY)
+ {
+ drvPtr->playPos+=increment;
+ }
+ }
+ timer.stopTimer();
+ pthread_exit(0);
+ }
+
+//void DummyAudioDevice::start()
+void DummyAudioDevice::start(int priority)
+ {
+ //realTimePriority = priority;
+ _realTimePriority = priority;
+ pthread_attr_t* attributes = 0;
+
+ //if (priority) {
+ if (realTimeScheduling && priority > 0) {
+ attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t));
+ pthread_attr_init(attributes);
+
+ if (pthread_attr_setschedpolicy(attributes, SCHED_FIFO)) {
+ printf("cannot set FIFO scheduling class for RT thread\n");
+ }
+ if (pthread_attr_setscope (attributes, PTHREAD_SCOPE_SYSTEM)) {
+ printf("Cannot set scheduling scope for RT thread\n");
+ }
+ struct sched_param rt_param;
+ memset(&rt_param, 0, sizeof(rt_param));
+ rt_param.sched_priority = priority;
+ if (pthread_attr_setschedparam (attributes, &rt_param)) {
+ printf("Cannot set scheduling priority %d for RT thread (%s)\n",
+ priority, strerror(errno));
+ }
+ }
+
+ //pthread_attr_t* attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t));
+ //pthread_attr_init(attributes);
+ if (pthread_create(&dummyThread, attributes, ::dummyLoop, this))
+ perror("creating thread failed:");
+ if (priority)
+ pthread_attr_destroy(attributes);
+ }
+
+void DummyAudioDevice::stop ()
+ {
+ pthread_cancel(dummyThread);
+ pthread_join(dummyThread, 0);
+ dummyThread = 0;
+ }
+
diff --git a/muse2/muse/driver/jack.cpp b/muse2/muse/driver/jack.cpp
new file mode 100644
index 00000000..2c5081fc
--- /dev/null
+++ b/muse2/muse/driver/jack.cpp
@@ -0,0 +1,2173 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: jack.cpp,v 1.30.2.17 2009/12/20 05:00:35 terminator356 Exp $
+// (C) Copyright 2002 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "config.h"
+#include <string>
+#include <set>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <stdarg.h>
+//#include <time.h>
+#include <unistd.h>
+#include <jack/midiport.h>
+#include <string.h>
+
+#include "audio.h"
+#include "globals.h"
+#include "song.h"
+#include "jackaudio.h"
+#include "track.h"
+#include "pos.h"
+#include "tempo.h"
+#include "sync.h"
+#include "utils.h"
+
+#include "midi.h"
+#include "mididev.h"
+#include "mpevent.h"
+
+#include "jackmidi.h"
+
+
+#define JACK_DEBUG 0
+
+//#include "errorhandler.h"
+
+#ifndef RTCAP
+extern void doSetuid();
+extern void undoSetuid();
+#endif
+
+#ifdef VST_SUPPORT
+#include <fst.h>
+#endif
+
+//extern int jackmidi_pi[2];
+//extern int jackmidi_po[2];
+
+//jack_port_t *midi_port_in[JACK_MIDI_CHANNELS];
+//jack_port_t *midi_port_out[JACK_MIDI_CHANNELS];
+
+//muse_jack_midi_buffer jack_midi_out_data[JACK_MIDI_CHANNELS];
+//muse_jack_midi_buffer jack_midi_in_data[JACK_MIDI_CHANNELS];
+
+JackAudioDevice* jackAudio;
+
+//---------------------------------------------------------
+// checkJackClient - make sure client is valid
+//---------------------------------------------------------
+inline bool checkJackClient(jack_client_t* _client)
+ {
+ if (_client == NULL) {
+ printf("Panic! no _client!\n");
+ return false;
+ }
+ return true;
+ }
+//---------------------------------------------------------
+// checkAudioDevice - make sure audioDevice exists
+//---------------------------------------------------------
+bool checkAudioDevice()
+ {
+ if (audioDevice == NULL) {
+ printf("Muse:checkAudioDevice: no audioDevice\n");
+ return false;
+ }
+ return true;
+ }
+
+
+//---------------------------------------------------------
+// jack_thread_init
+//---------------------------------------------------------
+
+static void jack_thread_init (void* ) // data
+ {
+ doSetuid();
+ /*
+ if (jackAudio->isRealtime()) {
+ struct sched_param rt_param;
+ int rv;
+ memset(&rt_param, 0, sizeof(sched_param));
+ int type;
+ rv = pthread_getschedparam(pthread_self(), &type, &rt_param);
+ if (rv != 0)
+ perror("get scheduler parameter");
+ if (type != SCHED_FIFO) {
+ fprintf(stderr, "JACK thread not running SCHED_FIFO, try to set...\n");
+
+ memset(&rt_param, 0, sizeof(sched_param));
+ rt_param.sched_priority = 1;
+ rv = pthread_setschedparam(pthread_self(), SCHED_FIFO, &rt_param);
+ if (rv != 0)
+ perror("set realtime scheduler");
+ memset(&rt_param, 0, sizeof(sched_param));
+ rv = pthread_getschedparam(pthread_self(), &type, &rt_param);
+ if (rv != 0)
+ perror("get scheduler parameter");
+ if (type != SCHED_FIFO)
+ fprintf(stderr, "JACK still not running FIFO !?!\n"
+ "======reliable RT operation not possible!!======\n");
+ else
+ fprintf(stderr, "JACK thread succesfully set to SCHED_FIFO\n");
+ }
+ }
+ */
+#ifdef VST_SUPPORT
+ if (loadVST)
+ fst_adopt_thread();
+#endif
+ undoSetuid();
+ }
+
+/*
+//---------------------------------------------------------
+// processAudio + Midi
+// JACK callback
+//---------------------------------------------------------
+void
+print_triplet(unsigned char *data)
+{
+ int a,b,c;
+ a = b = c = 0;
+ memcpy(&a, data, 1);
+ memcpy(&b, data+1, 1);
+ memcpy(&c, data+2, 1);
+ fprintf(stderr, "%x,%x,%x", a, b, c);
+}
+*/
+
+/*
+void handle_jack_midi_in_events(jack_nframes_t frames)
+{
+ char buf = 0;
+ int i,j;
+ jack_midi_event_t midi_event;
+ unsigned char t,n,v;
+
+ for(j = 0; j < JACK_MIDI_CHANNELS; j++){
+ void *midi_buffer_in = jack_port_get_buffer(midi_port_in[j], frames);
+ int event_count = jack_midi_get_event_count(midi_buffer_in);
+
+ for(i = 0; i < event_count; i++){
+ jack_midi_event_get(&midi_event, midi_buffer_in, i);
+ t = midi_event.buffer[0];
+ n = midi_event.buffer[1];
+ v = midi_event.buffer[2];
+ if(((*(midi_event.buffer) & 0xf0)) == 0x90){
+ fprintf(stderr, "jack-midi-in-event: ON_ time=%d %u ", midi_event.time,
+ midi_event.size);
+ print_triplet(midi_event.buffer);
+ fprintf(stderr, "\n");
+ }else if(((*(midi_event.buffer)) & 0xf0) == 0x80){
+ fprintf(stderr, "jack-midi-in-event: OFF time=%d %u ", midi_event.time,
+ midi_event.size);
+ print_triplet(midi_event.buffer);
+ fprintf(stderr, "\n");
+ }else{
+ fprintf(stderr, "jack-midi-in-event: ??? time=%d %u ", midi_event.time,
+ midi_event.size);
+ print_triplet(midi_event.buffer);
+ fprintf(stderr, "\n");
+ }
+ jack_midi_in_data[j].buffer[0] = t;
+ jack_midi_in_data[j].buffer[1] = n;
+ jack_midi_in_data[j].buffer[2] = v;
+ jack_midi_in_data[j].buffer[3] = 1;
+ fprintf(stderr, "handle_jack_midi_in_events() w\n");
+ write(jackmidi_pi[1], &buf, 1);
+ fprintf(stderr, "handle_jack_midi_in_events() wd\n");
+ }
+ }
+}
+
+void handle_jack_midi_out_events(jack_nframes_t frames)
+{
+ unsigned char *data;
+ void *port_buf;
+ int i,j,n,x;
+
+ //for(i = 0; i < JACK_MIDI_CHANNELS; i++){
+ for(i = 0; i < JACK_MIDI_CHANNELS; ++i){
+ // jack-midi-clear any old events
+ while(jack_midi_out_data[i].buffer[jack_midi_out_data[i].take*4+3] == 2){
+ port_buf = jack_port_get_buffer(midi_port_out[i], frames);
+ jack_midi_clear_buffer(port_buf);
+ jack_midi_out_data[i].buffer[jack_midi_out_data[i].take*4+3] = 0;
+ // point the take to the next slot
+ jack_midi_out_data[i].take++;
+ if(jack_midi_out_data[i].take >= JACK_MIDI_BUFFER_SIZE){
+ jack_midi_out_data[i].take = 0;
+ }
+ }
+ // check if any incoming midi-events from muse
+ if(jack_midi_out_data[i].give != jack_midi_out_data[i].take){
+
+ if(jack_midi_out_data[i].give > jack_midi_out_data[i].take){
+ n = jack_midi_out_data[i].give - jack_midi_out_data[i].take;
+ }else{
+ n = jack_midi_out_data[i].give +
+ (JACK_MIDI_BUFFER_SIZE - jack_midi_out_data[i].take);
+ }
+ port_buf = jack_port_get_buffer(midi_port_out[i], frames);
+ jack_midi_clear_buffer(port_buf);
+ // FIX: midi events has different sizes, compare note-on to
+ // program-change. We should first walk over the events
+ // counting the size.
+ //data = jack_midi_event_reserve(port_buf, 0, n*3);
+ //x = jack_midi_out_data[i].take;
+ //for(j = 0; j < n; j++){
+ // data[j*3+0] = jack_midi_out_data[i].buffer[x*4+0];
+ // data[j*3+1] = jack_midi_out_data[i].buffer[x*4+1];
+ // data[j*3+2] = jack_midi_out_data[i].buffer[x*4+2];
+ // after having copied the buffer over to the jack-buffer,
+ // mark the muses midi-out buffer as 'need-cleaning'
+ // jack_midi_out_data[i].buffer[x*4+3] = 2;
+ // x++;
+ // if(x >= JACK_MIDI_BUFFER_SIZE){
+ // x = 0;
+ // }
+ //}
+
+ x = jack_midi_out_data[i].take;
+ for(j = 0; j < n; ++j)
+ {
+ data = jack_midi_event_reserve(port_buf, 0, 3);
+ if(data == 0)
+ {
+ fprintf(stderr, "handle_jack_midi_out_events: buffer overflow, event lost\n");
+ // Can do no more processing. Just return.
+ return;
+ }
+ data[0] = jack_midi_out_data[i].buffer[x*4+0];
+ data[1] = jack_midi_out_data[i].buffer[x*4+1];
+ data[2] = jack_midi_out_data[i].buffer[x*4+2];
+ // after having copied the buffer over to the jack-buffer,
+ // mark the muses midi-out buffer as 'need-cleaning'
+ jack_midi_out_data[i].buffer[x*4+3] = 2;
+ x++;
+ if(x >= JACK_MIDI_BUFFER_SIZE){
+ x = 0;
+ }
+ }
+
+ }
+ }
+}
+*/
+
+//static int processAudio(jack_nframes_t frames, void*)
+int JackAudioDevice::processAudio(jack_nframes_t frames, void*)
+{
+ jackAudio->_frameCounter += frames;
+
+/// handle_jack_midi_in_events(frames);
+/// handle_jack_midi_out_events(frames);
+
+// if (JACK_DEBUG)
+// printf("processAudio - >>>>\n");
+ segmentSize = frames;
+ if (audio->isRunning())
+ audio->process((unsigned long)frames);
+ else {
+ if (debugMsg)
+ puts("jack calling when audio is disconnected!\n");
+ }
+// if (JACK_DEBUG)
+// printf("processAudio - <<<<\n");
+ return 0;
+}
+
+//---------------------------------------------------------
+// processSync
+// return TRUE (non-zero) when ready to roll.
+//---------------------------------------------------------
+
+static int processSync(jack_transport_state_t state, jack_position_t* pos, void*)
+ {
+ if (JACK_DEBUG)
+ printf("processSync()\n");
+
+ if(!useJackTransport.value())
+ return 1;
+
+ int audioState = Audio::STOP;
+ switch (state) {
+ case JackTransportStopped:
+ audioState = Audio::STOP;
+ break;
+ case JackTransportLooping:
+ case JackTransportRolling:
+ audioState = Audio::PLAY;
+ break;
+ case JackTransportStarting:
+ //printf("processSync JackTransportStarting\n");
+
+ audioState = Audio::START_PLAY;
+ break;
+ //case JackTransportNetStarting:
+ // FIXME: Quick and dirty hack to support both Jack-1 and Jack-2
+ // Really need a config check of version...
+ case 4:
+ //printf("processSync JackTransportNetStarting\n");
+
+ audioState = Audio::START_PLAY;
+ break;
+ }
+
+ unsigned frame = pos->frame;
+ //printf("processSync valid:%d frame:%d\n", pos->valid, frame);
+
+ // p3.3.23
+ //printf("Jack processSync() before audio->sync frame:%d\n", frame);
+ //return audio->sync(audioState, frame);
+ int rv = audio->sync(audioState, frame);
+ //printf("Jack processSync() after audio->sync frame:%d\n", frame);
+ return rv;
+ }
+
+//---------------------------------------------------------
+// timebase_callback
+//---------------------------------------------------------
+
+static void timebase_callback(jack_transport_state_t /* state */,
+ jack_nframes_t /* nframes */,
+ jack_position_t* pos,
+ int /* new_pos */,
+ void*)
+ {
+ //printf("Jack timebase_callback pos->frame:%u audio->tickPos:%d song->cpos:%d\n", pos->frame, audio->tickPos(), song->cpos());
+
+ // p3.3.27
+ //Pos p(pos->frame, false);
+ Pos p(extSyncFlag.value() ? audio->tickPos() : pos->frame, extSyncFlag.value() ? true : false);
+ // Can't use song pos - it is only updated every (slow) GUI heartbeat !
+ //Pos p(extSyncFlag.value() ? song->cpos() : pos->frame, extSyncFlag.value() ? true : false);
+
+ pos->valid = JackPositionBBT;
+ p.mbt(&pos->bar, &pos->beat, &pos->tick);
+ pos->bar++;
+ pos->beat++;
+ pos->bar_start_tick = Pos(pos->bar, 0, 0).tick();
+
+ //
+ // dummy:
+ //
+
+ // p3.3.26
+ //pos->beats_per_bar = 4;
+ //pos->beat_type = 4;
+ //pos->ticks_per_beat = 384;
+ //
+ /* // From example client transport.c :
+ float time_beats_per_bar = 4.0;
+ float time_beat_type = 0.25; // Huh? Inverted? From docs: "Time signature 'denominator'"
+ double time_ticks_per_beat = 1920.0; // Huh? Ticks per beat should be 24 etc. not 384 or 1920 etc. Otherwise it would be called 'frames_per_beat'.
+ double time_beats_per_minute = 120.0;
+ */
+ //
+ int z, n;
+ sigmap.timesig(p.tick(), z, n);
+ pos->beats_per_bar = z;
+ pos->beat_type = n;
+ //pos->ticks_per_beat = config.division;
+ pos->ticks_per_beat = 24;
+
+ int tempo = tempomap.tempo(p.tick());
+ pos->beats_per_minute = (60000000.0 / tempo) * tempomap.globalTempo()/100.0;
+ }
+
+//---------------------------------------------------------
+// processShutdown
+//---------------------------------------------------------
+
+static void processShutdown(void*)
+ {
+ if (JACK_DEBUG)
+ printf("processShutdown()\n");
+ //printf("processShutdown\n");
+ jackAudio->nullify_client();
+ audio->shutdown();
+
+ int c=0;
+ while(midiSeqRunning == true) {
+ if(c++ >10) {
+ fprintf(stderr, "sequencer still running, something is very wrong.\n");
+ break;
+ }
+ sleep(1);
+ }
+ delete jackAudio;
+ jackAudio=0;
+ audioDevice=0;
+ }
+
+//---------------------------------------------------------
+// jackError
+//---------------------------------------------------------
+
+static void jackError(const char *s)
+ {
+ //error->logError( "JACK ERROR: %s\n", s);
+ fprintf(stderr,"JACK ERROR: %s\n", s);
+ }
+
+//---------------------------------------------------------
+// noJackError
+//---------------------------------------------------------
+
+static void noJackError(const char* /* s */)
+ {
+ }
+
+//---------------------------------------------------------
+// JackAudioDevice
+//---------------------------------------------------------
+
+JackAudioDevice::JackAudioDevice(jack_client_t* cl, char* name)
+ : AudioDevice()
+ {
+ _frameCounter = 0;
+ //JackAudioDevice::jackStarted=false;
+ strcpy(jackRegisteredName, name);
+ _client = cl;
+ dummyState = Audio::STOP;
+ dummyPos = 0;
+ }
+
+//---------------------------------------------------------
+// ~JackAudioDevice
+//---------------------------------------------------------
+
+JackAudioDevice::~JackAudioDevice()
+ {
+ if (JACK_DEBUG)
+ printf("~JackAudioDevice()\n");
+ if (_client) {
+
+ /*
+ // p3.3.35
+ for(int i = 0; i < JACK_MIDI_CHANNELS; i++)
+ {
+ if(midi_port_in[i])
+ jack_port_unregister(_client, midi_port_in[i]);
+ if(midi_port_out[i])
+ jack_port_unregister(_client, midi_port_out[i]);
+ }
+ */
+
+ if (jack_client_close(_client)) {
+ //error->logError("jack_client_close() failed: %s\n", strerror(errno));
+ fprintf(stderr,"jack_client_close() failed: %s\n", strerror(errno));
+ }
+ }
+ if (JACK_DEBUG)
+ printf("~JackAudioDevice() after jack_client_close()\n");
+ }
+
+//---------------------------------------------------------
+// realtimePriority
+// return zero if not running realtime
+// can only be called if JACK client thread is already
+// running
+//---------------------------------------------------------
+
+int JackAudioDevice::realtimePriority() const
+ {
+ pthread_t t = jack_client_thread_id(_client);
+ int policy;
+ struct sched_param param;
+ memset(&param, 0, sizeof(param));
+ int rv = pthread_getschedparam(t, &policy, &param);
+ if (rv) {
+ perror("MusE: JackAudioDevice::realtimePriority: Error: Get jack schedule parameter");
+ return 0;
+ }
+ if (policy != SCHED_FIFO) {
+ printf("MusE: JackAudioDevice::realtimePriority: JACK is not running realtime\n");
+ return 0;
+ }
+ return param.sched_priority;
+ }
+
+/*
+//---------------------------------------------------------
+// getJackName()
+//---------------------------------------------------------
+
+char* JackAudioDevice::getJackName()
+ {
+ return jackRegisteredName;
+ }
+*/
+
+/*
+//---------------------------------------------------------
+// clientName()
+//---------------------------------------------------------
+
+const char* JackAudioDevice::clientName()
+{
+ //if(_client)
+ // return jack_get_client_name(_client);
+ //else
+ // return "MusE";
+ return jackRegisteredName;
+}
+*/
+
+//---------------------------------------------------------
+// initJackAudio
+// return true if JACK not found
+//---------------------------------------------------------
+
+bool initJackAudio()
+ {
+ /*
+ // p3.3.35
+ for(int i = 0; i < JACK_MIDI_CHANNELS; i++)
+ {
+ midi_port_in[i] = 0;
+ midi_port_out[i] = 0;
+ }
+ */
+
+ if (JACK_DEBUG)
+ printf("initJackAudio()\n");
+ if (debugMsg) {
+ fprintf(stderr,"initJackAudio()\n");
+ jack_set_error_function(jackError);
+ }
+ else
+ jack_set_error_function(noJackError);
+ doSetuid();
+
+ //jack_client_t* client = 0;
+ //int i = 0;
+ //char jackIdString[8];
+ //for (i = 0; i < 5; ++i) {
+ // sprintf(jackIdString, "MusE-%d", i+1);
+ //client = jack_client_new(jackIdString);
+ // client = jack_client_open(jackIdString, JackNoStartServer, 0);
+ // if (client)
+ // break;
+ // }
+ //if (i == 5)
+ // return true;
+ jack_status_t status;
+ jack_client_t* client = jack_client_open("MusE", JackNoStartServer, &status);
+ if (!client) {
+ if (status & JackServerStarted)
+ printf("jack server started...\n");
+ if (status & JackServerFailed)
+ printf("cannot connect to jack server\n");
+ if (status & JackServerError)
+ printf("communication with jack server failed\n");
+ if (status & JackShmFailure)
+ printf("jack cannot access shared memory\n");
+ if (status & JackVersionError)
+ printf("jack server has wrong version\n");
+ printf("cannot create jack client\n");
+ undoSetuid(); // p3.3.51
+ return true;
+ }
+
+ if (debugMsg)
+ fprintf(stderr, "initJackAudio(): client %s opened.\n", jack_get_client_name(client));
+ if (client) {
+ jack_set_error_function(jackError);
+ //jackAudio = new JackAudioDevice(client, jackIdString);
+ jackAudio = new JackAudioDevice(client, jack_get_client_name(client));
+ if (debugMsg)
+ fprintf(stderr, "initJackAudio(): registering client...\n");
+ jackAudio->registerClient();
+ sampleRate = jack_get_sample_rate(client);
+ segmentSize = jack_get_buffer_size(client);
+ jack_set_thread_init_callback(client, (JackThreadInitCallback) jack_thread_init, 0);
+ //jack_set_timebase_callback(client, 0, (JackTimebaseCallback) timebase_callback, 0);
+ }
+ undoSetuid();
+
+ /*
+ // setup midi input/output
+ //memset(jack_midi_out_data, 0, JACK_MIDI_CHANNELS * sizeof(muse_jack_midi_buffer));
+ //memset(jack_midi_in_data, 0, JACK_MIDI_CHANNELS * sizeof(muse_jack_midi_buffer));
+ if(client){
+ for(i = 0; i < JACK_MIDI_CHANNELS; i++)
+ {
+ char buf[80];
+ snprintf(buf, 80, "muse-jack-midi-in-%d", i+1);
+ midi_port_in[i] = jack_port_register(client, buf,
+ JACK_DEFAULT_MIDI_TYPE,
+ JackPortIsInput, 0);
+ if(midi_port_in[i] == NULL){
+ fprintf(stderr, "failed to register jack-midi-in\n");
+ exit(-1);
+ }
+ snprintf(buf, 80, "muse-jack-midi-out-%d", i+1);
+ midi_port_out[i] = jack_port_register(client, buf,
+ JACK_DEFAULT_MIDI_TYPE,
+ JackPortIsOutput, 0);
+ if(midi_port_out == NULL)
+ {
+ fprintf(stderr, "failed to register jack-midi-out\n");
+ exit(-1);
+ }
+ }
+ }
+ else
+ {
+ fprintf(stderr, "WARNING NO muse-jack midi connection\n");
+ }
+ */
+
+ if (client) {
+ audioDevice = jackAudio;
+ jackAudio->scanMidiPorts();
+ return false;
+ }
+ return true;
+ }
+
+static int bufsize_callback(jack_nframes_t n, void*)
+ {
+ printf("JACK: buffersize changed %d\n", n);
+ return 0;
+ }
+
+//---------------------------------------------------------
+// freewheel_callback
+//---------------------------------------------------------
+
+static void freewheel_callback(int starting, void*)
+ {
+ if (debugMsg || JACK_DEBUG)
+ printf("JACK: freewheel_callback: starting%d\n", starting);
+ audio->setFreewheel(starting);
+ }
+
+static int srate_callback(jack_nframes_t n, void*)
+ {
+ if (debugMsg || JACK_DEBUG)
+ printf("JACK: sample rate changed: %d\n", n);
+ return 0;
+ }
+
+//---------------------------------------------------------
+// registration_callback
+//---------------------------------------------------------
+
+static void registration_callback(jack_port_id_t, int, void*)
+{
+ if(debugMsg || JACK_DEBUG)
+ printf("JACK: registration changed\n");
+
+ audio->sendMsgToGui('R');
+}
+
+//---------------------------------------------------------
+// JackAudioDevice::registrationChanged
+// this is called from song in gui context triggered
+// by registration_callback()
+//---------------------------------------------------------
+
+void JackAudioDevice::registrationChanged()
+{
+ if(JACK_DEBUG)
+ printf("JackAudioDevice::registrationChanged()\n");
+
+ // Rescan.
+ scanMidiPorts();
+ // Connect the Jack midi client ports to the device ports.
+ //connectJackMidiPorts();
+}
+
+//---------------------------------------------------------
+// JackAudioDevice::connectJackMidiPorts
+//---------------------------------------------------------
+
+void JackAudioDevice::connectJackMidiPorts()
+{
+ if(JACK_DEBUG)
+ printf("JackAudioDevice::connectJackMidiPorts()\n");
+
+ for (iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i)
+ {
+ //MidiJackDevice* mjd = dynamic_cast<MidiJackDevice*>(*i);
+ //if(!mjd)
+ MidiDevice* md = *i;
+ if(md->deviceType() != MidiDevice::JACK_MIDI)
+ continue;
+
+ void* port = md->clientPort();
+ if(md->rwFlags() & 1)
+ {
+ RouteList* rl = md->outRoutes();
+ for (iRoute r = rl->begin(); r != rl->end(); ++r)
+ connect(port, r->jackPort);
+ }
+ else
+ if(md->rwFlags() & 2)
+ {
+ RouteList* rl = md->inRoutes();
+ for (iRoute r = rl->begin(); r != rl->end(); ++r)
+ connect(r->jackPort, port);
+ }
+ }
+
+
+ /*
+ const char* type = JACK_DEFAULT_MIDI_TYPE;
+ const char** ports = jack_get_ports(_client, 0, type, 0);
+ for (const char** p = ports; p && *p; ++p)
+ {
+ jack_port_t* port = jack_port_by_name(_client, *p);
+ if(!port)
+ continue;
+ // Ignore our own client ports.
+ if(jack_port_is_mine(_client, port))
+ {
+ if(debugMsg)
+ printf(" ignoring own port: %s\n", *p);
+ continue;
+ }
+ int nsz = jack_port_name_size();
+ char buffer[nsz];
+ strncpy(buffer, *p, nsz);
+ // Ignore the MusE Jack port.
+ //if(strncmp(buffer, "MusE", 4) == 0)
+ // continue;
+
+ if(debugMsg)
+ printf(" found port: %s ", buffer);
+
+ // If there are aliases for this port, use the first one - much better for identifying.
+ //char a1[nsz];
+ char a2[nsz];
+ char* aliases[2];
+ //aliases[0] = a1;
+ aliases[0] = buffer;
+ aliases[1] = a2;
+ // To disable aliases, just rem this line.
+ jack_port_get_aliases(port, aliases);
+ //int na = jack_port_get_aliases(port, aliases);
+ //char* namep = (na >= 1) ? aliases[0] : buffer;
+ char* namep = aliases[0];
+
+ if(debugMsg)
+ printf("alias: %s\n", aliases[0]);
+
+ //int flags = 0;
+ int pf = jack_port_flags(port);
+ // If Jack port can send data to us...
+ //if(pf & JackPortIsOutput)
+ // Mark as input capable.
+ // flags |= 2;
+ // If Jack port can receive data from us...
+ //if(pf & JackPortIsInput)
+ // Mark as output capable.
+ // flags |= 1;
+
+ //JackPort jp(0, QString(buffer), flags);
+ //portList.append(jp);
+
+ QString name(namep);
+
+ if(JACK_DEBUG)
+ printf("JackAudioDevice::graphChanged %s\n", name.latin1());
+
+ for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd)
+ {
+ // Is it a Jack midi device?
+ MidiJackDevice* mjd = dynamic_cast<MidiJackDevice*>(*imd);
+ if(!mjd)
+ continue;
+
+ //if(dev->name() != name)
+ // continue;
+
+ // Is this port the one created for the Jack midi device?
+ if(!mjd->clientJackPort() || (mjd->clientJackPort() != port))
+ continue;
+
+ jack_port_t* devport = jack_port_by_name(_client, mjd->name().latin1());
+ if(!devport)
+ continue;
+
+ int ofl = mjd->openFlags();
+
+ if(JACK_DEBUG)
+ printf("JackAudioDevice::graphChanged found MidiJackDevice:%s\n", mjd->name().latin1());
+
+ // Note docs say it can't be both input and output. src, dest
+ // If Jack port can receive data from us and we actually want to...
+ if((pf & JackPortIsOutput) && (ofl & 1))
+ {
+ if(JACK_DEBUG)
+ printf("JackAudioDevice::graphChanged connecting MusE output\n");
+ audioDevice->connect(port, devport);
+ }
+ else
+ // If Jack port can send data to us and we actually want it...
+ if((pf & JackPortIsInput) && (ofl & 2))
+ {
+ if(JACK_DEBUG)
+ printf("JackAudioDevice::graphChanged connecting MusE input\n");
+ audioDevice->connect(devport, port);
+ }
+
+ break;
+ }
+ }
+
+ if(ports)
+ free(ports);
+
+ */
+}
+//---------------------------------------------------------
+// client_registration_callback
+//---------------------------------------------------------
+
+static void client_registration_callback(const char *name, int isRegister, void*)
+ {
+ if (debugMsg || JACK_DEBUG)
+ printf("JACK: client registration changed:%s register:%d\n", name, isRegister);
+ }
+
+//---------------------------------------------------------
+// port_connect_callback
+//---------------------------------------------------------
+
+static void port_connect_callback(jack_port_id_t a, jack_port_id_t b, int isConnect, void*)
+ {
+ if (debugMsg || JACK_DEBUG)
+ {
+ //jack_port_t* ap = jack_port_by_id(_client, a);
+ //jack_port_t* bp = jack_port_by_id(_client, b);
+ //printf("JACK: port connections changed: A:%d:%s B:%d:%s isConnect:%d\n", a, jack_port_name(ap), b, jack_port_name(bp), isConnect);
+ printf("JACK: port connections changed: A:%d B:%d isConnect:%d\n", a, b, isConnect);
+ }
+ }
+
+//---------------------------------------------------------
+// graph_callback
+// this is called from jack when the connections
+// changed
+//---------------------------------------------------------
+
+static int graph_callback(void*)
+ {
+ if (JACK_DEBUG)
+ printf("graph_callback()\n");
+ // we cannot call JackAudioDevice::graphChanged() from this
+ // context, so we send a message to the gui thread which in turn
+ // calls graphChanged()
+ audio->sendMsgToGui('C');
+ if (debugMsg)
+ printf("JACK: graph changed\n");
+ return 0;
+ }
+
+//---------------------------------------------------------
+// JackAudioDevice::graphChanged
+// this is called from song in gui context triggered
+// by graph_callback()
+//---------------------------------------------------------
+
+void JackAudioDevice::graphChanged()
+{
+ if (JACK_DEBUG)
+ printf("graphChanged()\n");
+ if(!checkJackClient(_client)) return;
+ InputList* il = song->inputs();
+ for (iAudioInput ii = il->begin(); ii != il->end(); ++ii) {
+ AudioInput* it = *ii;
+ int channels = it->channels();
+ for (int channel = 0; channel < channels; ++channel) {
+ jack_port_t* port = (jack_port_t*)(it->jackPort(channel));
+ if (port == 0)
+ continue;
+ const char** ports = jack_port_get_all_connections(_client, port);
+ RouteList* rl = it->inRoutes();
+
+ //---------------------------------------
+ // check for disconnects
+ //---------------------------------------
+
+ bool erased;
+ // limit set to 20 iterations for disconnects, don't know how to make it go
+ // the "right" amount
+ for (int i = 0;i < 20;i++) {
+ erased = false;
+ for (iRoute irl = rl->begin(); irl != rl->end(); ++irl) {
+ if (irl->channel != channel)
+ continue;
+ QString name = irl->name();
+ const char* portName = name.latin1();
+ //printf("portname=%s\n", portName);
+ bool found = false;
+ const char** pn = ports;
+ while (pn && *pn) {
+ if (strcmp(*pn, portName) == 0) {
+ found = true;
+ break;
+ }
+ ++pn;
+ }
+ if (!found) {
+ audio->msgRemoveRoute1(
+ //Route(portName, false, channel),
+ Route(portName, false, channel, Route::JACK_ROUTE),
+ Route(it, channel)
+ );
+ erased = true;
+ break;
+ }
+ }
+ if (!erased)
+ break;
+ }
+
+ //---------------------------------------
+ // check for connects
+ //---------------------------------------
+
+ if (ports) {
+ const char** pn = ports;
+ while (*pn) {
+ bool found = false;
+ for (iRoute irl = rl->begin(); irl != rl->end(); ++irl) {
+ if (irl->channel != channel)
+ continue;
+ QString name = irl->name();
+ const char* portName = name.latin1();
+ if (strcmp(*pn, portName) == 0) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ audio->msgAddRoute1(
+ //Route(*pn, false, channel),
+ Route(*pn, false, channel, Route::JACK_ROUTE),
+ Route(it, channel)
+ );
+ }
+ ++pn;
+ }
+
+ // p3.3.37
+ //delete ports;
+ free(ports);
+
+ ports = NULL;
+ }
+ }
+ }
+ OutputList* ol = song->outputs();
+ for (iAudioOutput ii = ol->begin(); ii != ol->end(); ++ii) {
+ AudioOutput* it = *ii;
+ int channels = it->channels();
+ for (int channel = 0; channel < channels; ++channel) {
+ jack_port_t* port = (jack_port_t*)(it->jackPort(channel));
+ if (port == 0)
+ continue;
+ const char** ports = jack_port_get_all_connections(_client, port);
+ RouteList* rl = it->outRoutes();
+
+ //---------------------------------------
+ // check for disconnects
+ //---------------------------------------
+
+ bool erased;
+ // limit set to 20 iterations for disconnects, don't know how to make it go
+ // the "right" amount
+ for (int i = 0; i < 20 ; i++) {
+ erased = false;
+ for (iRoute irl = rl->begin(); irl != rl->end(); ++irl) {
+ if (irl->channel != channel)
+ continue;
+ QString name = irl->name();
+ const char* portName = name.latin1();
+ bool found = false;
+ const char** pn = ports;
+ while (pn && *pn) {
+ if (strcmp(*pn, portName) == 0) {
+ found = true;
+ break;
+ }
+ ++pn;
+ }
+ if (!found) {
+ audio->msgRemoveRoute1(
+ Route(it, channel),
+ //Route(portName, false, channel)
+ Route(portName, false, channel, Route::JACK_ROUTE)
+ );
+ erased = true;
+ break;
+ }
+ }
+ if (!erased)
+ break;
+ }
+
+ //---------------------------------------
+ // check for connects
+ //---------------------------------------
+
+ if (ports) {
+ const char** pn = ports;
+ while (*pn) {
+ bool found = false;
+ for (iRoute irl = rl->begin(); irl != rl->end(); ++irl) {
+ if (irl->channel != channel)
+ continue;
+ QString name = irl->name();
+ const char* portName = name.latin1();
+ if (strcmp(*pn, portName) == 0) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ audio->msgAddRoute1(
+ Route(it, channel),
+ //Route(*pn, false, channel)
+ Route(*pn, false, channel, Route::JACK_ROUTE)
+ );
+ }
+ ++pn;
+ }
+
+ // p3.3.37
+ //delete ports;
+ free(ports);
+
+ ports = NULL;
+ }
+ }
+ }
+
+ for (iMidiDevice ii = midiDevices.begin(); ii != midiDevices.end(); ++ii)
+ {
+ MidiDevice* md = *ii;
+ if(md->deviceType() != MidiDevice::JACK_MIDI)
+ continue;
+
+ //MidiJackDevice* mjd = dynamic_cast<MidiJackDevice*>(*ii);
+ //if(!mjd)
+ // continue;
+ //for (int channel = 0; channel < channels; ++channel)
+ //{
+ jack_port_t* port = (jack_port_t*)md->clientPort();
+ if (port == 0)
+ continue;
+ const char** ports = jack_port_get_all_connections(_client, port);
+
+ //---------------------------------------
+ // outputs
+ //---------------------------------------
+
+ if(md->rwFlags() & 1) // Writable
+ {
+ RouteList* rl = md->outRoutes();
+
+ //---------------------------------------
+ // check for disconnects
+ //---------------------------------------
+
+ bool erased;
+ // limit set to 20 iterations for disconnects, don't know how to make it go
+ // the "right" amount
+ for (int i = 0; i < 20 ; i++)
+ {
+ erased = false;
+ for (iRoute irl = rl->begin(); irl != rl->end(); ++irl) {
+ //if (irl->channel != channel)
+ // continue;
+ QString name = irl->name();
+ const char* portName = name.latin1();
+ bool found = false;
+ const char** pn = ports;
+ while (pn && *pn) {
+ if (strcmp(*pn, portName) == 0) {
+ found = true;
+ break;
+ }
+ ++pn;
+ }
+ if (!found) {
+ audio->msgRemoveRoute1(
+ //Route(it, channel),
+ //Route(mjd),
+ Route(md, -1),
+ //Route(portName, false, channel)
+ //Route(portName, false, -1)
+ Route(portName, false, -1, Route::JACK_ROUTE)
+ );
+ erased = true;
+ break;
+ }
+ }
+ if (!erased)
+ break;
+ }
+
+ //---------------------------------------
+ // check for connects
+ //---------------------------------------
+
+ if (ports)
+ {
+ const char** pn = ports;
+ while (*pn) {
+ bool found = false;
+ for (iRoute irl = rl->begin(); irl != rl->end(); ++irl) {
+ //if (irl->channel != channel)
+ // continue;
+ QString name = irl->name();
+ const char* portName = name.latin1();
+ if (strcmp(*pn, portName) == 0) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ audio->msgAddRoute1(
+ //Route(it, channel),
+ //Route(mjd),
+ Route(md, -1),
+ //Route(*pn, false, channel)
+ //Route(*pn, false, -1)
+ Route(*pn, false, -1, Route::JACK_ROUTE)
+ );
+ }
+ ++pn;
+ }
+
+ // p3.3.37
+ //delete ports;
+ //free(ports);
+
+ //ports = NULL;
+ }
+ }
+
+
+ //------------------------
+ // Inputs
+ //------------------------
+
+ if(md->rwFlags() & 2) // Readable
+ {
+ RouteList* rl = md->inRoutes();
+
+ //---------------------------------------
+ // check for disconnects
+ //---------------------------------------
+
+ bool erased;
+ // limit set to 20 iterations for disconnects, don't know how to make it go
+ // the "right" amount
+ for (int i = 0; i < 20 ; i++)
+ {
+ erased = false;
+ for (iRoute irl = rl->begin(); irl != rl->end(); ++irl) {
+ //if (irl->channel != channel)
+ // continue;
+ QString name = irl->name();
+ const char* portName = name.latin1();
+ bool found = false;
+ const char** pn = ports;
+ while (pn && *pn) {
+ if (strcmp(*pn, portName) == 0) {
+ found = true;
+ break;
+ }
+ ++pn;
+ }
+ if (!found) {
+ audio->msgRemoveRoute1(
+ //Route(portName, false, channel),
+ //Route(portName, false, -1),
+ Route(portName, false, -1, Route::JACK_ROUTE),
+ //Route(it, channel)
+ //Route(mjd)
+ Route(md, -1)
+ );
+ erased = true;
+ break;
+ }
+ }
+ if (!erased)
+ break;
+ }
+
+ //---------------------------------------
+ // check for connects
+ //---------------------------------------
+
+ if (ports)
+ {
+ const char** pn = ports;
+ while (*pn) {
+ bool found = false;
+ for (iRoute irl = rl->begin(); irl != rl->end(); ++irl) {
+ //if (irl->channel != channel)
+ // continue;
+ QString name = irl->name();
+ const char* portName = name.latin1();
+ if (strcmp(*pn, portName) == 0) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ audio->msgAddRoute1(
+ //Route(*pn, false, channel),
+ //Route(*pn, false, -1),
+ Route(*pn, false, -1, Route::JACK_ROUTE),
+ //Route(it, channel)
+ //Route(mjd)
+ Route(md, -1)
+ );
+ }
+ ++pn;
+ }
+ }
+ }
+ if(ports)
+ // Done with ports. Free them.
+ //delete ports;
+ free(ports);
+
+ ports = NULL;
+ }
+}
+
+//static int xrun_callback(void*)
+// {
+// printf("JACK: xrun\n");
+// return 0;
+// }
+
+//---------------------------------------------------------
+// register
+//---------------------------------------------------------
+
+void JackAudioDevice::registerClient()
+ {
+ if (JACK_DEBUG)
+ printf("registerClient()\n");
+ if(!checkJackClient(_client)) return;
+ jack_set_process_callback(_client, processAudio, 0);
+ jack_set_sync_callback(_client, processSync, 0);
+ // FIXME: FIXME:
+ // Added by Tim. p3.3.20
+ // Did not help. Seek during play: Jack keeps switching to STOP state after about 1-2 seconds timeout if sync is holding it up.
+ // Nothing in MusE seems to be telling it to stop.
+ jack_set_sync_timeout(_client, 5000000); // Change default 2 to 5 second sync timeout because prefetch may be very slow esp. with resampling !
+
+ jack_on_shutdown(_client, processShutdown, 0);
+ jack_set_buffer_size_callback(_client, bufsize_callback, 0);
+ jack_set_sample_rate_callback(_client, srate_callback, 0);
+ jack_set_port_registration_callback(_client, registration_callback, 0);
+ // p3.3.37
+ jack_set_client_registration_callback(_client, client_registration_callback, 0);
+ jack_set_port_connect_callback(_client, port_connect_callback, 0);
+
+ jack_set_graph_order_callback(_client, graph_callback, 0);
+// jack_set_xrun_callback(client, xrun_callback, 0);
+ jack_set_freewheel_callback (_client, freewheel_callback, 0);
+ }
+
+//---------------------------------------------------------
+// registerInPort
+//---------------------------------------------------------
+
+//void* JackAudioDevice::registerInPort(const char* name)
+void* JackAudioDevice::registerInPort(const char* name, bool midi)
+ {
+ if (JACK_DEBUG)
+ printf("registerInPort()\n");
+ if(!checkJackClient(_client)) return NULL;
+ const char* type = midi ? JACK_DEFAULT_MIDI_TYPE : JACK_DEFAULT_AUDIO_TYPE;
+ //void* p = jack_port_register(_client, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
+ void* p = jack_port_register(_client, name, type, JackPortIsInput, 0);
+// printf("JACK: registerInPort: <%s> %p\n", name, p);
+ return p;
+ }
+
+//---------------------------------------------------------
+// registerOutPort
+//---------------------------------------------------------
+
+//void* JackAudioDevice::registerOutPort(const char* name)
+void* JackAudioDevice::registerOutPort(const char* name, bool midi)
+ {
+ if (JACK_DEBUG)
+ printf("registerOutPort()\n");
+ if(!checkJackClient(_client)) return NULL;
+ const char* type = midi ? JACK_DEFAULT_MIDI_TYPE : JACK_DEFAULT_AUDIO_TYPE;
+ //void* p = jack_port_register(_client, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+ void* p = jack_port_register(_client, name, type, JackPortIsOutput, 0);
+// printf("JACK: registerOutPort: <%s> %p\n", name, p);
+ return p;
+ }
+
+//---------------------------------------------------------
+// exitJackAudio
+//---------------------------------------------------------
+
+void exitJackAudio()
+ {
+ if (JACK_DEBUG)
+ printf("exitJackAudio()\n");
+ if (jackAudio)
+ delete jackAudio;
+
+ if (JACK_DEBUG)
+ printf("exitJackAudio() after delete jackAudio\n");
+
+ // Added by Tim. p3.3.14
+ audioDevice = NULL;
+
+ }
+
+//---------------------------------------------------------
+// connect
+//---------------------------------------------------------
+
+void JackAudioDevice::connect(void* src, void* dst)
+{
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::connect()\n");
+ if(!checkJackClient(_client)) return;
+ const char* sn = jack_port_name((jack_port_t*) src);
+ const char* dn = jack_port_name((jack_port_t*) dst);
+ if (sn == 0 || dn == 0) {
+ fprintf(stderr, "JackAudio::connect: unknown jack ports\n");
+ return;
+ }
+ int err = jack_connect(_client, sn, dn);
+ //if (jack_connect(_client, sn, dn)) {
+ if (err) {
+ fprintf(stderr, "jack connect <%s>%p - <%s>%p failed with err:%d\n",
+ sn, src, dn, dst, err);
+ }
+ else
+ if (JACK_DEBUG)
+ {
+ fprintf(stderr, "jack connect <%s>%p - <%s>%p succeeded\n",
+ sn, src, dn, dst);
+ }
+}
+
+//---------------------------------------------------------
+// disconnect
+//---------------------------------------------------------
+
+void JackAudioDevice::disconnect(void* src, void* dst)
+{
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::disconnect()\n");
+ if(!checkJackClient(_client)) return;
+ const char* sn = jack_port_name((jack_port_t*) src);
+ const char* dn = jack_port_name((jack_port_t*) dst);
+ if (sn == 0 || dn == 0) {
+ fprintf(stderr, "JackAudio::disconnect: unknown jack ports\n");
+ return;
+ }
+ int err = jack_disconnect(_client, sn, dn);
+ //if (jack_disconnect(_client, sn, dn)) {
+ if (err) {
+ fprintf(stderr, "jack disconnect <%s> - <%s> failed with err:%d\n",
+ sn, dn, err);
+ }
+ else
+ if (JACK_DEBUG)
+ {
+ fprintf(stderr, "jack disconnect <%s> - <%s> succeeded\n",
+ sn, dn);
+ }
+}
+
+//---------------------------------------------------------
+// start
+//---------------------------------------------------------
+
+//void JackAudioDevice::start()
+void JackAudioDevice::start(int /*priority*/)
+ {
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::start()\n");
+ if(!checkJackClient(_client)) return;
+
+ doSetuid();
+
+ if (jack_activate(_client)) {
+ undoSetuid(); // p3.3.51
+ fprintf (stderr, "JACK: cannot activate client\n");
+ exit(-1);
+ }
+ /* connect the ports. Note: you can't do this before
+ the client is activated, because we can't allow
+ connections to be made to clients that aren't
+ running.
+ */
+
+ InputList* il = song->inputs();
+ for (iAudioInput i = il->begin(); i != il->end(); ++i) {
+ AudioInput* ai = *i;
+ int channel = ai->channels();
+ for (int ch = 0; ch < channel; ++ch) {
+ RouteList* rl = ai->inRoutes();
+ void* port = ai->jackPort(ch);
+ for (iRoute ir = rl->begin(); ir != rl->end(); ++ir) {
+ if (ir->channel == ch)
+ connect(ir->jackPort, port);
+ }
+ }
+ }
+ OutputList* ol = song->outputs();
+ for (iAudioOutput i = ol->begin(); i != ol->end(); ++i) {
+ AudioOutput* ai = *i;
+ int channel = ai->channels();
+ for (int ch = 0; ch < channel; ++ch) {
+ RouteList* rl = ai->outRoutes();
+ void* port = ai->jackPort(ch);
+ for (iRoute r = rl->begin(); r != rl->end(); ++r) {
+ if (r->channel == ch) {
+ connect(port, r->jackPort);
+ }
+ }
+ }
+ }
+
+ // p3.3.37
+ // Connect the Jack midi client ports to device ports.
+ connectJackMidiPorts();
+
+ undoSetuid();
+
+ //MUSE_DEBUG("JackAudioDevice::start()\n");
+ fflush(stdin);
+ //JackAudioDevice::jackStarted=true;
+ }
+
+//---------------------------------------------------------
+// stop
+//---------------------------------------------------------
+
+void JackAudioDevice::stop()
+ {
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::stop()\n");
+ if(!checkJackClient(_client)) return;
+ if (jack_deactivate(_client)) {
+ fprintf (stderr, "cannot deactivate client\n");
+ }
+ //JackAudioDevice::jackStarted=false;
+ }
+
+//---------------------------------------------------------
+// transportQuery
+//---------------------------------------------------------
+
+jack_transport_state_t JackAudioDevice::transportQuery(jack_position_t* pos)
+{
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::transportQuery pos:%d\n", (unsigned int)pos->frame);
+
+ // TODO: Compose and return a state if MusE is disengaged from Jack transport.
+
+ return jack_transport_query(_client, pos);
+}
+
+//---------------------------------------------------------
+// getCurFrame
+//---------------------------------------------------------
+
+unsigned int JackAudioDevice::getCurFrame()
+{
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::getCurFrame pos.frame:%d\n", pos.frame);
+
+ if(!useJackTransport.value())
+ return (unsigned int)dummyPos;
+
+ return pos.frame;
+}
+
+//---------------------------------------------------------
+// framePos
+//---------------------------------------------------------
+
+int JackAudioDevice::framePos() const
+ {
+ //if(!useJackTransport.value())
+ //{
+ // if (JACK_DEBUG)
+ // printf("JackAudioDevice::framePos dummyPos:%d\n", dummyPos);
+ // return dummyPos;
+ //}
+
+ if(!checkJackClient(_client)) return 0;
+ jack_nframes_t n = jack_frame_time(_client);
+
+ //if (JACK_DEBUG)
+ // printf("JackAudioDevice::framePos jack frame:%d\n", (int)n);
+
+ return (int)n;
+ }
+
+#if 0
+//---------------------------------------------------------
+// framesSinceCycleStart
+//---------------------------------------------------------
+
+int JackAudioDevice::framesSinceCycleStart() const
+ {
+ jack_nframes_t n = jack_frames_since_cycle_start(client);
+ return (int)n;
+ }
+
+//---------------------------------------------------------
+// framesDelay
+// TODO
+//---------------------------------------------------------
+
+int JackAudioDevice::frameDelay() const
+ {
+ jack_nframes_t n = (segmentSize * (segmentCount-1)) - jack_frames_since_cycle_start(client);
+ return (int)n;
+ }
+#endif
+
+//---------------------------------------------------------
+// outputPorts
+//---------------------------------------------------------
+
+std::list<QString> JackAudioDevice::outputPorts(bool midi, int aliases)
+ {
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::outputPorts()\n");
+ std::list<QString> clientList;
+ if(!checkJackClient(_client)) return clientList;
+ QString qname;
+ const char* type = midi ? JACK_DEFAULT_MIDI_TYPE : JACK_DEFAULT_AUDIO_TYPE;
+ const char** ports = jack_get_ports(_client, 0, type, JackPortIsOutput);
+ for (const char** p = ports; p && *p; ++p) {
+ jack_port_t* port = jack_port_by_name(_client, *p);
+ //int flags = jack_port_flags(port);
+ //if (!(flags & JackPortIsOutput))
+ // continue;
+ //char buffer[128];
+
+ int nsz = jack_port_name_size();
+ char buffer[nsz];
+
+ strncpy(buffer, *p, nsz);
+ //if (strncmp(buffer, "MusE", 4) == 0)
+ //{
+ // if(debugMsg)
+ // printf("JackAudioDevice::outputPorts ignoring own MusE port: %s\n", *p);
+ // continue;
+ //}
+
+ // Ignore our own client ports.
+ if(jack_port_is_mine(_client, port))
+ {
+ if(debugMsg)
+ printf("JackAudioDevice::outputPorts ignoring own port: %s\n", *p);
+ continue;
+ }
+
+ // p3.3.38
+ if((aliases == 0) || (aliases == 1))
+ {
+ //char a1[nsz];
+ char a2[nsz];
+ char* al[2];
+ //aliases[0] = a1;
+ al[0] = buffer;
+ al[1] = a2;
+ int na = jack_port_get_aliases(port, al);
+ int a = aliases;
+ if(a >= na)
+ {
+ a = na;
+ if(a > 0)
+ a--;
+ }
+ qname = QString(al[a]);
+ }
+ else
+ qname = QString(buffer);
+
+ //clientList.push_back(QString(buffer));
+ clientList.push_back(qname);
+ }
+
+ // p3.3.37
+ if(ports)
+ free(ports);
+
+ return clientList;
+ }
+
+//---------------------------------------------------------
+// inputPorts
+//---------------------------------------------------------
+
+std::list<QString> JackAudioDevice::inputPorts(bool midi, int aliases)
+ {
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::inputPorts()\n");
+ std::list<QString> clientList;
+ if(!checkJackClient(_client)) return clientList;
+ QString qname;
+ const char* type = midi ? JACK_DEFAULT_MIDI_TYPE : JACK_DEFAULT_AUDIO_TYPE;
+ const char** ports = jack_get_ports(_client, 0, type, JackPortIsInput);
+ for (const char** p = ports; p && *p; ++p) {
+ jack_port_t* port = jack_port_by_name(_client, *p);
+ //int flags = jack_port_flags(port);
+ //if (!(flags & JackPortIsInput))
+ // continue;
+ //char buffer[128];
+
+ int nsz = jack_port_name_size();
+ char buffer[nsz];
+
+ strncpy(buffer, *p, nsz);
+ //if (strncmp(buffer, "MusE", 4) == 0)
+ //{
+ // if(debugMsg)
+ // printf("JackAudioDevice::inputPorts ignoring own MusE port: %s\n", *p);
+ // continue;
+ //}
+
+ // Ignore our own client ports.
+ if(jack_port_is_mine(_client, port))
+ {
+ if(debugMsg)
+ printf("JackAudioDevice::inputPorts ignoring own port: %s\n", *p);
+ continue;
+ }
+
+ // p3.3.38
+ if((aliases == 0) || (aliases == 1))
+ {
+ //char a1[nsz];
+ char a2[nsz];
+ char* al[2];
+ //aliases[0] = a1;
+ al[0] = buffer;
+ al[1] = a2;
+ int na = jack_port_get_aliases(port, al);
+ int a = aliases;
+ if(a >= na)
+ {
+ a = na;
+ if(a > 0)
+ a--;
+ }
+ qname = QString(al[a]);
+ }
+ else
+ qname = QString(buffer);
+
+ //clientList.push_back(QString(buffer));
+ clientList.push_back(qname);
+ }
+
+ // p3.3.37
+ if(ports)
+ free(ports);
+
+ return clientList;
+ }
+
+//---------------------------------------------------------
+// portName
+//---------------------------------------------------------
+
+QString JackAudioDevice::portName(void* port)
+ {
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::portName(\n");
+ if(!checkJackClient(_client)) return "";
+ if (!port)
+ return "";
+
+ QString s(jack_port_name((jack_port_t*)port));
+ //printf("Jack::portName %p %s\n", port, s.latin1());
+ return s;
+ }
+
+//---------------------------------------------------------
+// unregisterPort
+//---------------------------------------------------------
+
+void JackAudioDevice::unregisterPort(void* p)
+ {
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::unregisterPort(\n");
+ if(!checkJackClient(_client)) return;
+// printf("JACK: unregister Port\n");
+ jack_port_unregister(_client, (jack_port_t*)p);
+ }
+
+//---------------------------------------------------------
+// getState
+//---------------------------------------------------------
+
+int JackAudioDevice::getState()
+ {
+ // If we're not using Jack's transport, just return current state.
+ if(!useJackTransport.value())
+ {
+ //pos.valid = jack_position_bits_t(0);
+ //pos.frame = audio->pos().frame();
+ //return audio->getState();
+ //if (JACK_DEBUG)
+ // printf("JackAudioDevice::getState dummyState:%d\n", dummyState);
+ return dummyState;
+ }
+
+ //if (JACK_DEBUG)
+ // printf("JackAudioDevice::getState ()\n");
+ if(!checkJackClient(_client)) return 0;
+ transportState = jack_transport_query(_client, &pos);
+ //if (JACK_DEBUG)
+ // printf("JackAudioDevice::getState transportState:%d\n", transportState);
+
+ switch (transportState) {
+ case JackTransportStopped:
+ return Audio::STOP;
+ case JackTransportLooping:
+ case JackTransportRolling:
+ return Audio::PLAY;
+ case JackTransportStarting:
+ //printf("JackAudioDevice::getState JackTransportStarting\n");
+
+ return Audio::START_PLAY;
+ //case JackTransportNetStarting:
+ // FIXME: Quick and dirty hack to support both Jack-1 and Jack-2
+ // Really need a config check of version...
+ case 4:
+ //printf("JackAudioDevice::getState JackTransportNetStarting\n");
+
+ return Audio::START_PLAY;
+ break;
+ default:
+ return Audio::STOP;
+ }
+ }
+
+//---------------------------------------------------------
+// setFreewheel
+//---------------------------------------------------------
+
+void JackAudioDevice::setFreewheel(bool f)
+ {
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::setFreewheel(\n");
+ if(!checkJackClient(_client)) return;
+// printf("JACK: setFreewheel %d\n", f);
+ jack_set_freewheel(_client, f);
+ }
+
+//---------------------------------------------------------
+// dummySync
+//---------------------------------------------------------
+
+bool JackAudioDevice::dummySync(int state)
+{
+ // Roughly segment time length.
+ //timespec ts = { 0, (1000000000 * segmentSize) / sampleRate }; // In nanoseconds.
+ unsigned int sl = (1000000 * segmentSize) / sampleRate; // In microseconds.
+
+ double ct = curTime();
+ // Wait for a default maximum of 5 seconds.
+ // Similar to how Jack is supposed to wait a default of 2 seconds for slow clients.
+ // TODO: Make this timeout a 'settings' option so it can be applied both to Jack and here.
+ while((curTime() - ct) < 5.0)
+ {
+ // Is MusE audio ready to roll?
+ if(audio->sync(state, dummyPos))
+ return true;
+
+ // Not ready. Wait a 'segment', try again...
+ //nanosleep(&ts, NULL);
+ usleep(sl); // usleep is supposed to be obsolete!
+ }
+
+ //if(JACK_DEBUG)
+ printf("JackAudioDevice::dummySync Sync timeout - audio not ready!\n");
+
+ return false;
+}
+
+//---------------------------------------------------------
+// startTransport
+//---------------------------------------------------------
+
+void JackAudioDevice::startTransport()
+ {
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::startTransport()\n");
+
+ // If we're not using Jack's transport, just pass PLAY and current frame along
+ // as if processSync was called.
+ if(!useJackTransport.value())
+ {
+ //dummyState = Audio::START_PLAY;
+
+ // Is MusE audio ready to roll?
+ //if(dummySync(dummyState))
+ if(dummySync(Audio::START_PLAY))
+ {
+ // MusE audio is ready to roll. Let's play.
+ dummyState = Audio::PLAY;
+ return;
+ }
+
+ // Ready or not, we gotta roll. Similar to how Jack is supposed to roll anyway.
+ dummyState = Audio::PLAY;
+ return;
+ }
+
+ if(!checkJackClient(_client)) return;
+// printf("JACK: startTransport\n");
+ jack_transport_start(_client);
+ }
+
+//---------------------------------------------------------
+// stopTransport
+//---------------------------------------------------------
+
+void JackAudioDevice::stopTransport()
+ {
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::stopTransport()\n");
+
+ dummyState = Audio::STOP;
+
+ if(!useJackTransport.value())
+ {
+ //dummyState = Audio::STOP;
+ return;
+ }
+
+ if(!checkJackClient(_client)) return;
+ if (transportState != JackTransportStopped) {
+ // printf("JACK: stopTransport\n");
+ jack_transport_stop(_client);
+ transportState=JackTransportStopped;
+ }
+ }
+
+//---------------------------------------------------------
+// seekTransport
+//---------------------------------------------------------
+
+void JackAudioDevice::seekTransport(unsigned frame)
+ {
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::seekTransport() frame:%d\n", frame);
+
+ dummyPos = frame;
+ if(!useJackTransport.value())
+ {
+ // If we're not using Jack's transport, just pass the current state and new frame along
+ // as if processSync was called.
+ //dummyPos = frame;
+ int tempState = dummyState;
+ //dummyState = Audio::START_PLAY;
+
+ // Is MusE audio ready yet?
+ //audio->sync(dummyState, dummyPos);
+ //if(dummySync(dummyState))
+ if(dummySync(Audio::START_PLAY))
+ {
+ dummyState = tempState;
+ return;
+ }
+
+ // Not ready, resume previous state anyway.
+ // FIXME: Observed: Seek during play: Jack transport STOPs on timeout.
+ // Docs say when starting play, transport will roll anyway, ready or not (observed),
+ // but don't mention what should happen on seek during play.
+ // And setting the slow-sync timeout doesn't seem to do anything!
+ //dummyState = tempState;
+ dummyState = Audio::STOP;
+ return;
+ }
+
+ if(!checkJackClient(_client)) return;
+// printf("JACK: seekTransport %d\n", frame);
+ jack_transport_locate(_client, frame);
+ }
+
+//---------------------------------------------------------
+// seekTransport
+//---------------------------------------------------------
+
+void JackAudioDevice::seekTransport(const Pos &p)
+ {
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::seekTransport() frame:%d\n", p.frame());
+
+ dummyPos = p.frame();
+ if(!useJackTransport.value())
+ {
+ // If we're not using Jack's transport, just pass the current state and new frame along
+ // as if processSync was called.
+ //dummyPos = p.frame();
+ int tempState = dummyState;
+ //dummyState = Audio::START_PLAY;
+
+ // Is MusE audio ready yet?
+ //audio->sync(dummyState, dummyPos);
+ //if(dummySync(dummyState))
+ if(dummySync(Audio::START_PLAY))
+ {
+ dummyState = tempState;
+ return;
+ }
+
+ // Not ready, resume previous state anyway.
+ // FIXME: See fixme in other seekTransport...
+ //dummyState = tempState;
+ dummyState = Audio::STOP;
+ return;
+ }
+
+ if(!checkJackClient(_client)) return;
+
+ /*
+ jack_position_t jp;
+ jp.valid = JackPositionBBT;
+ p.mbt(&jp.bar, &jp.beat, &jp.tick);
+ jp.bar++;
+ jp.beat++;
+ jp.bar_start_tick = Pos(jp.bar, 0, 0).tick();
+ //
+ // dummy:
+ //
+ jp.beats_per_bar = 4;
+ jp.beat_type = 4;
+ jp.ticks_per_beat = 384;
+ int tempo = tempomap.tempo(p.tick());
+ jp.beats_per_minute = (60000000.0 / tempo) * tempomap.globalTempo()/100.0;
+
+ jack_transport_reposition(_client, &jp);
+ */
+ jack_transport_locate(_client, p.frame());
+ }
+
+//---------------------------------------------------------
+// findPort
+//---------------------------------------------------------
+
+void* JackAudioDevice::findPort(const char* name)
+ {
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::findPort(\n");
+ if(!checkJackClient(_client)) return NULL;
+ void* p = jack_port_by_name(_client, name);
+// printf("Jack::findPort <%s>, %p\n", name, p);
+ return p;
+ }
+
+//---------------------------------------------------------
+// setMaster
+//---------------------------------------------------------
+
+int JackAudioDevice::setMaster(bool f)
+{
+ if (JACK_DEBUG)
+ printf("JackAudioDevice::setMaster val:%d\n", f);
+ if(!checkJackClient(_client))
+ return 0;
+
+ int r = 0;
+ if(f)
+ {
+ if(useJackTransport.value())
+ {
+ // Make Muse the Jack timebase master. Do it unconditionally (second param = 0).
+ r = jack_set_timebase_callback(_client, 0, (JackTimebaseCallback) timebase_callback, 0);
+ if(debugMsg || JACK_DEBUG)
+ {
+ if(r)
+ printf("JackAudioDevice::setMaster jack_set_timebase_callback failed: result:%d\n", r);
+ }
+ }
+ else
+ {
+ r = 1;
+ printf("JackAudioDevice::setMaster cannot set master because useJackTransport is false\n");
+ }
+ }
+ else
+ {
+ r = jack_release_timebase(_client);
+ if(debugMsg || JACK_DEBUG)
+ {
+ if(r)
+ printf("JackAudioDevice::setMaster jack_release_timebase failed: result:%d\n", r);
+ }
+ }
+ return r;
+}
+
+//---------------------------------------------------------
+// scanMidiPorts
+//---------------------------------------------------------
+
+void JackAudioDevice::scanMidiPorts()
+{
+ if(debugMsg)
+ printf("JackAudioDevice::scanMidiPorts:\n");
+
+/*
+ const char* type = JACK_DEFAULT_MIDI_TYPE;
+ const char** ports = jack_get_ports(_client, 0, type, 0);
+
+ std::set<std::string> names;
+ for (const char** p = ports; p && *p; ++p)
+ {
+ jack_port_t* port = jack_port_by_name(_client, *p);
+ if(!port)
+ continue;
+ // Ignore our own client ports.
+ if(jack_port_is_mine(_client, port))
+ {
+ if(debugMsg)
+ printf(" ignoring own port: %s\n", *p);
+ continue;
+ }
+
+ int nsz = jack_port_name_size();
+ char buffer[nsz];
+ strncpy(buffer, *p, nsz);
+ // Ignore the MusE Jack port.
+ //if(strncmp(buffer, "MusE", 4) == 0)
+ // continue;
+
+ if(debugMsg)
+ printf(" found port: %s ", buffer);
+
+ // If there are aliases for this port, use the first one - much better for identifying.
+ //char a1[nsz];
+ char a2[nsz];
+ char* aliases[2];
+ //aliases[0] = a1;
+ aliases[0] = buffer;
+ aliases[1] = a2;
+ // To disable aliases, just rem this line.
+ jack_port_get_aliases(port, aliases);
+ //int na = jack_port_get_aliases(port, aliases);
+ //char* namep = (na >= 1) ? aliases[0] : buffer;
+ //char* namep = aliases[0];
+ //names.insert(std::string(*p));
+ if(debugMsg)
+ printf("alias: %s\n", aliases[0]);
+
+ names.insert(std::string(aliases[0]));
+ }
+ if(ports)
+ free(ports);
+
+ std::list<MidiDevice*> to_del;
+ for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd)
+ {
+ // Only Jack midi devices.
+ if(dynamic_cast<MidiJackDevice*>(*imd) == 0)
+ continue;
+ if(names.find(std::string((*imd)->name().latin1())) == names.end())
+ to_del.push_back(*imd);
+ }
+
+ for(std::list<MidiDevice*>::iterator imd = to_del.begin(); imd != to_del.end(); ++imd)
+ {
+ if(debugMsg)
+ printf(" removing port device:%s\n", (*imd)->name().latin1());
+ midiDevices.remove(*imd);
+ // This will close (and unregister) the client port.
+ delete (*imd);
+ }
+
+ //for (const char** p = ports; p && *p; ++p)
+ for(std::set<std::string>::iterator is = names.begin(); is != names.end(); ++is)
+ {
+ //jack_port_t* port = jack_port_by_name(_client, *p);
+ jack_port_t* port = jack_port_by_name(_client, is->c_str());
+ if(!port)
+ continue;
+*/
+
+ /*
+ int nsz = jack_port_name_size();
+ char buffer[nsz];
+ //strncpy(buffer, *p, nsz);
+ strncpy(buffer, is->c_str(), nsz);
+ // Ignore the MusE Jack port.
+ //if(strncmp(buffer, "MusE", 4) == 0)
+ // continue;
+
+ // If there are aliases for this port, use the first one - much better for identifying.
+ //char a1[nsz];
+ char a2[nsz];
+ char* aliases[2];
+ //aliases[0] = a1;
+ aliases[0] = buffer;
+ aliases[1] = a2;
+ // To disable aliases, just rem this line.
+ jack_port_get_aliases(port, aliases);
+ //int na = jack_port_get_aliases(port, aliases);
+ //char* namep = (na >= 1) ? aliases[0] : buffer;
+ char* namep = aliases[0];
+ QString qname(namep);
+ */
+
+/*
+ QString qname(is->c_str());
+
+ // Port already exists?
+ if(midiDevices.find(qname))
+ continue;
+
+ int flags = 0;
+ int pf = jack_port_flags(port);
+ // If Jack port can send data to us...
+ if(pf & JackPortIsOutput)
+ // Mark as input capable.
+ flags |= 2;
+ // If Jack port can receive data from us...
+ if(pf & JackPortIsInput)
+ // Mark as output capable.
+ flags |= 1;
+
+ //JackPort jp(0, QString(buffer), flags);
+ //portList.append(jp);
+
+ if(debugMsg)
+ printf(" adding port device:%s\n", qname.latin1());
+
+ MidiJackDevice* dev = new MidiJackDevice(0, qname);
+ dev->setrwFlags(flags);
+ midiDevices.add(dev);
+ }
+*/
+}
+
diff --git a/muse2/muse/driver/jackaudio.h b/muse2/muse/driver/jackaudio.h
new file mode 100644
index 00000000..d3132efe
--- /dev/null
+++ b/muse2/muse/driver/jackaudio.h
@@ -0,0 +1,97 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: jackaudio.h,v 1.20.2.4 2009/12/20 05:00:35 terminator356 Exp $
+// (C) Copyright 2002 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __JACKAUDIO_H__
+#define __JACKAUDIO_H__
+
+#include <jack/jack.h>
+#include "audiodev.h"
+
+class MidiPlayEvent;
+
+//---------------------------------------------------------
+// JackAudioDevice
+//---------------------------------------------------------
+bool checkAudioDevice();
+
+class JackAudioDevice : public AudioDevice {
+
+ jack_client_t* _client;
+ double sampleTime;
+ int samplePos;
+ jack_transport_state_t transportState;
+ jack_position_t pos;
+ char jackRegisteredName[16];
+ int dummyState;
+ int dummyPos;
+ // Free-running frame counter incremented always in process.
+ jack_nframes_t _frameCounter;
+
+ static int processAudio(jack_nframes_t frames, void*);
+
+ public:
+ JackAudioDevice(jack_client_t* cl, char * jack_id_string);
+ virtual ~JackAudioDevice();
+ virtual void nullify_client() { _client = 0; }
+
+ virtual inline int deviceType() { return JACK_AUDIO; } // p3.3.52
+
+ void scanMidiPorts();
+
+ //virtual void start();
+ virtual void start(int);
+ virtual void stop ();
+ virtual bool dummySync(int state); // Artificial sync when not using Jack transport.
+
+ virtual int framePos() const;
+ virtual unsigned frameTime() const { return _frameCounter; }
+
+ virtual float* getBuffer(void* port, unsigned long nframes) {
+ return (float*)jack_port_get_buffer((jack_port_t*)port, nframes);
+ }
+
+ virtual std::list<QString> outputPorts(bool midi = false, int aliases = -1);
+ virtual std::list<QString> inputPorts(bool midi = false, int aliases = -1);
+
+ virtual void registerClient();
+ virtual const char* clientName() { return jackRegisteredName; }
+
+ //virtual void* registerOutPort(const char* name);
+ //virtual void* registerInPort(const char* name);
+ virtual void* registerOutPort(const char* /*name*/, bool /*midi*/);
+ virtual void* registerInPort(const char* /*name*/, bool /*midi*/);
+
+ //virtual char* getJackName();
+
+ virtual void unregisterPort(void*);
+ virtual void connect(void*, void*);
+ virtual void disconnect(void*, void*);
+ virtual int connections(void* clientPort) { return jack_port_connected((jack_port_t*)clientPort); }
+ virtual void setPortName(void* p, const char* n) { jack_port_set_name((jack_port_t*)p, n); }
+ virtual void* findPort(const char* name);
+ virtual QString portName(void* port);
+ virtual int getState();
+ virtual unsigned int getCurFrame();
+ virtual bool isRealtime() { return jack_is_realtime(_client); }
+ virtual int realtimePriority() const;
+ virtual void startTransport();
+ virtual void stopTransport();
+ virtual void seekTransport(unsigned frame);
+ virtual void seekTransport(const Pos &p);
+ virtual void setFreewheel(bool f);
+ jack_transport_state_t transportQuery(jack_position_t* pos);
+ void graphChanged();
+ void registrationChanged();
+ void connectJackMidiPorts();
+
+ virtual int setMaster(bool f);
+
+ //static bool jackStarted;
+ };
+
+#endif
+
diff --git a/muse2/muse/driver/jackmidi.cpp b/muse2/muse/driver/jackmidi.cpp
new file mode 100644
index 00000000..4e871a2f
--- /dev/null
+++ b/muse2/muse/driver/jackmidi.cpp
@@ -0,0 +1,1563 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: jackmidi.cpp,v 1.1.1.1 2010/01/27 09:06:43 terminator356 Exp $
+// (C) Copyright 1999-2010 Werner Schweer (ws@seh.de)
+//=========================================================
+
+//#include <qt.h>
+#include <qstring.h>
+#include <stdio.h>
+
+#include <jack/jack.h>
+//#include <jack/midiport.h>
+
+#include "jackmidi.h"
+#include "song.h"
+#include "globals.h"
+#include "midi.h"
+#include "mididev.h"
+#include "../midiport.h"
+#include "../midiseq.h"
+#include "../midictrl.h"
+#include "../audio.h"
+#include "mpevent.h"
+//#include "sync.h"
+#include "audiodev.h"
+#include "../mplugins/midiitransform.h"
+#include "../mplugins/mitplugin.h"
+#include "xml.h"
+
+// Turn on debug messages.
+//#define JACK_MIDI_DEBUG
+
+extern unsigned int volatile lastExtMidiSyncTick;
+
+///int jackmidi_pi[2];
+///int jackmidi_po[2];
+
+//extern muse_jack_midi_buffer jack_midi_out_data[JACK_MIDI_CHANNELS];
+//extern muse_jack_midi_buffer jack_midi_in_data[JACK_MIDI_CHANNELS];
+///extern jack_port_t *midi_port_in[JACK_MIDI_CHANNELS];
+///extern jack_port_t *midi_port_out[JACK_MIDI_CHANNELS];
+
+///MidiJackDevice* gmdev = NULL;
+
+///int* jackSeq;
+//static snd_seq_addr_t musePort;
+
+//int MidiJackDevice::_nextOutIdNum = 0;
+//int MidiJackDevice::_nextInIdNum = 0;
+
+//int JackMidiPortList::_nextOutIdNum = 0;
+//int JackMidiPortList::_nextInIdNum = 0;
+
+//JackMidiPortList jackMidiClientPorts;
+
+
+/*
+//---------------------------------------------------------
+// JackMidiPortList
+//---------------------------------------------------------
+
+JackMidiPortList::JackMidiPortList()
+{
+
+}
+
+JackMidiPortList::~JackMidiPortList()
+{
+
+}
+
+iJackMidiPort JackMidiPortList::createClientPort(int flags) // 1 = writable, 2 = readable - do not mix
+{
+ if(flags & 1)
+ {
+ char buf[80];
+ snprintf(buf, 80, "muse-jack-midi-out-%d", _nextOutIdNum);
+ jack_port_t* _client_jackport = (jack_port_t*)audioDevice->registerOutPort(buf, true);
+ if(_client_jackport == NULL)
+ {
+ fprintf(stderr, "JackMidiPortList::createClientPort failed to register jack-midi-out\n");
+ //return QString("Could not register jack-midi-out client port");
+ return end();
+ }
+ else
+ {
+ JackMidiPort jmp(_client_jackport, QString(buf), flags);
+ _nextOutIdNum++;
+ return insert(begin(), std::pair<jack_port_t*, JackMidiPort>(_client_jackport, jmp));
+ }
+ }
+ else
+ if(flags & 2)
+ {
+ char buf[80];
+ snprintf(buf, 80, "muse-jack-midi-in-%d", _nextInIdNum);
+ jack_port_t* _client_jackport = (jack_port_t*)audioDevice->registerInPort(buf, true);
+ if(_client_jackport == NULL)
+ {
+ fprintf(stderr, "JackMidiPortList::createClientPort failed to register jack-midi-in\n");
+ return end();
+ }
+ else
+ {
+ JackMidiPort jmp(_client_jackport, QString(buf), flags);
+ _nextInIdNum++;
+ return insert(begin(), std::pair<jack_port_t*, JackMidiPort>(_client_jackport, jmp));
+ }
+ }
+ return end();
+}
+
+// Return true if removed.
+bool JackMidiPortList::removeClientPort(jack_port_t* port)
+{
+ iJackMidiPort ijp = find(port);
+ if(ijp == end())
+ return false;
+
+ // Is output?
+ if(ijp->second._flags & 1)
+ _nextOutIdNum--;
+ // Is input?
+ if(ijp->second._flags & 2)
+ _nextInIdNum--;
+
+ erase(ijp);
+
+ audioDevice->unregisterPort(port);
+
+ return true;
+}
+*/
+
+//---------------------------------------------------------
+// MidiJackDevice
+//---------------------------------------------------------
+
+//MidiJackDevice::MidiJackDevice(const int& a, const QString& n)
+MidiJackDevice::MidiJackDevice(jack_port_t* jack_port, const QString& n)
+ : MidiDevice(n)
+{
+ //_client_jackport = 0;
+ _client_jackport = jack_port;
+ //adr = a;
+ init();
+}
+
+MidiJackDevice::~MidiJackDevice()
+{
+ #ifdef JACK_MIDI_DEBUG
+ printf("MidiJackDevice::~MidiJackDevice()\n");
+ #endif
+ if(_client_jackport)
+ audioDevice->unregisterPort(_client_jackport);
+ //close();
+}
+
+/*
+//---------------------------------------------------------
+// select[RW]fd
+//---------------------------------------------------------
+
+int MidiJackDevice::selectRfd()
+{
+ return jackmidi_pi[0];
+}
+
+int MidiJackDevice::selectWfd()
+{
+ return jackmidi_po[0];
+}
+*/
+
+//---------------------------------------------------------
+// createJackMidiDevice
+// If name parameter is blank, creates a new (locally) unique one.
+//---------------------------------------------------------
+
+//QString MidiJackDevice::createJackMidiDevice(int rwflags) // 1:Writable 2: Readable. Do not mix.
+MidiDevice* MidiJackDevice::createJackMidiDevice(QString name, int rwflags) // 1:Writable 2: Readable. Do not mix.
+{
+/// _openFlags &= _rwFlags; // restrict to available bits
+
+/// #ifdef JACK_MIDI_DEBUG
+/// printf("MidiJackDevice::open %s\n", name.latin1());
+/// #endif
+
+ //jack_port_t* jp = jack_port_by_name(_client, name().latin1());
+/// jack_port_t* jp = (jack_port_t*)audioDevice->findPort(name().latin1());
+
+/// if(!jp)
+/// {
+/// printf("MidiJackDevice::open: Jack midi port %s not found!\n", name().latin1());
+/// _writeEnable = false;
+/// _readEnable = false;
+/// return QString("Jack midi port not found");
+/// }
+
+/// int pf = jack_port_flags(jp);
+
+ //if(!name.isEmpty())
+ //{
+ // Does not work.
+ // if(audioDevice->findPort(name.latin1()))
+ // {
+ // fprintf(stderr, "MidiJackDevice::createJackMidiDevice failed! Given port name %s already exists!\n", name.latin1());
+ // return 0;
+ // }
+ //}
+
+ jack_port_t* client_jackport = NULL;
+ //char buf[80];
+
+
+ // If Jack port can receive data from us and we actually want to...
+ //if((pf & JackPortIsInput) && (_openFlags & 1))
+ if(rwflags & 1)
+ {
+ if(name.isEmpty())
+ {
+ //snprintf(buf, 80, "muse-jack-midi-out-%d", _nextOutIdNum);
+ for(int i = 0; ; ++i)
+ {
+ //snprintf(buf, 80, "midi-out-%d", i);
+ name.sprintf("midi-out-%d", i);
+
+ if(!midiDevices.find(name))
+ {
+ // Does not work.
+ //if(!audioDevice->findPort(buf))
+ // break;
+ //client_jackport = (jack_port_t*)audioDevice->registerOutPort(buf, true);
+ if(audioDevice->deviceType() == AudioDevice::JACK_AUDIO) // p3.3.52
+ {
+ client_jackport = (jack_port_t*)audioDevice->registerOutPort(name.latin1(), true);
+ if(client_jackport)
+ break;
+ }
+ else
+ break;
+ }
+
+ if(i == 65535)
+ {
+ fprintf(stderr, "MidiJackDevice::createJackMidiDevice failed! Can't find unused output port name!\n");
+ return 0;
+ }
+ }
+ //name = QString(buf);
+ }
+ else
+ {
+ if(audioDevice->deviceType() == AudioDevice::JACK_AUDIO) // p3.3.52
+ {
+ client_jackport = (jack_port_t*)audioDevice->registerOutPort(name.latin1(), true);
+ if(!client_jackport)
+ {
+ fprintf(stderr, "MidiJackDevice::createJackMidiDevice failed creating output port name %s\n", name.latin1());
+ return 0;
+ }
+ }
+ }
+ /*
+ else
+ {
+ client_jackport = (jack_port_t*)audioDevice->registerOutPort(name.latin1(), true);
+ if(!client_jackport)
+ {
+ for(int i = 0; ; ++i)
+ {
+ snprintf(buf, 80, "midi-out-%d", i);
+ // Does not work!
+ //if(!audioDevice->findPort(buf))
+ // break;
+ client_jackport = (jack_port_t*)audioDevice->registerOutPort(buf, true);
+ if(client_jackport)
+ break;
+
+ if(i == 65535)
+ {
+ fprintf(stderr, "MidiJackDevice::createJackMidiDevice failed! Can't find unused output port name!\n");
+ return 0;
+ }
+ }
+ name = QString(buf);
+ }
+ }
+ */
+
+ //client_jackport = (jack_port_t*)audioDevice->registerOutPort(name.latin1(), true);
+ //if(client_jackport == NULL)
+ //{
+ // fprintf(stderr, "MidiJackDevice::createJackMidiDevice failed to register jack midi client output port %s\n", name.latin1());
+ // return 0;
+ //}
+ //else
+ // _nextOutIdNum++;
+
+ }
+ else // Note docs say it can't be both input and output.
+ // If Jack port can send data to us and we actually want it...
+ //if((pf & JackPortIsOutput) && (_openFlags & 2))
+ if(rwflags & 2)
+ {
+ if(name.isEmpty())
+ {
+ //snprintf(buf, 80, "muse-jack-midi-in-%d", _nextInIdNum);
+ for(int i = 0; ; ++i)
+ {
+ //snprintf(buf, 80, "midi-in-%d", i);
+ name.sprintf("midi-in-%d", i);
+
+ if(!midiDevices.find(name))
+ {
+ // Does not work.
+ //if(!audioDevice->findPort(buf))
+ // break;
+ //client_jackport = (jack_port_t*)audioDevice->registerInPort(buf, true);
+ if(audioDevice->deviceType() == AudioDevice::JACK_AUDIO) // p3.3.52
+ {
+ client_jackport = (jack_port_t*)audioDevice->registerInPort(name.latin1(), true);
+ if(client_jackport)
+ break;
+ }
+ else
+ break;
+ }
+
+ if(i == 65535)
+ {
+ fprintf(stderr, "MidiJackDevice::createJackMidiDevice failed! Can't find unused input port name!\n");
+ return 0;
+ }
+ }
+ //name = QString(buf);
+ }
+ else
+ {
+ if(audioDevice->deviceType() == AudioDevice::JACK_AUDIO) // p3.3.52
+ {
+ client_jackport = (jack_port_t*)audioDevice->registerInPort(name.latin1(), true);
+ if(!client_jackport)
+ {
+ fprintf(stderr, "MidiJackDevice::createJackMidiDevice failed creating input port name %s\n", name.latin1());
+ return 0;
+ }
+ }
+ }
+
+ //client_jackport = (jack_port_t*)audioDevice->registerInPort(name.latin1(), true);
+
+ //if(client_jackport == NULL)
+ //{
+ // fprintf(stderr, "MidiJackDevice::createJackMidiDevice failed to register jack midi client input port %s\n", name.latin1());
+ //_readEnable = false;
+ //return QString("Could not register jack-midi-in client port");
+ // return 0;
+ //}
+ //else
+ // _nextInIdNum++;
+
+ }
+
+ //if(client_jackport == NULL) // p3.3.52 Removed. Allow the device to be created even if Jack isn't running.
+ // return 0;
+
+ MidiJackDevice* dev = new MidiJackDevice(client_jackport, name);
+ dev->setrwFlags(rwflags);
+ midiDevices.add(dev);
+ return dev;
+}
+
+//---------------------------------------------------------
+// setName
+//---------------------------------------------------------
+
+void MidiJackDevice::setName(const QString& s)
+{
+ #ifdef JACK_MIDI_DEBUG
+ printf("MidiJackDevice::setName %s new name:%s\n", name().latin1(), s.latin1());
+ #endif
+ _name = s;
+ if(clientPort()) // p3.3.52 Added check.
+ audioDevice->setPortName(clientPort(), s.latin1());
+}
+
+//---------------------------------------------------------
+// open
+//---------------------------------------------------------
+
+QString MidiJackDevice::open()
+{
+ _openFlags &= _rwFlags; // restrict to available bits
+
+ #ifdef JACK_MIDI_DEBUG
+ printf("MidiJackDevice::open %s\n", name().latin1());
+ #endif
+
+ /*
+ //jack_port_t* jp = jack_port_by_name(_client, name().latin1());
+ jack_port_t* jp = (jack_port_t*)audioDevice->findPort(name().latin1());
+
+ if(!jp)
+ {
+ printf("MidiJackDevice::open: Jack midi port %s not found!\n", name().latin1());
+ _writeEnable = false;
+ _readEnable = false;
+ return QString("Jack midi port not found");
+ }
+
+ int pf = jack_port_flags(jp);
+
+ // If Jack port can receive data from us and we actually want to...
+ if((pf & JackPortIsInput) && (_openFlags & 1))
+ {
+ char buf[80];
+ snprintf(buf, 80, "muse-jack-midi-out-%d", _nextOutIdNum);
+ _client_jackport = (jack_port_t*)audioDevice->registerOutPort(buf, true);
+ if(_client_jackport == NULL)
+ {
+ fprintf(stderr, "MidiJackDevice::open failed to register jack-midi-out\n");
+ _writeEnable = false;
+ return QString("Could not register jack-midi-out client port");
+ }
+ else
+ {
+ _nextOutIdNum++;
+ // src, dest
+ ///audioDevice->connect(_client_jackport, jp);
+ _writeEnable = true;
+ }
+ }
+ else // Note docs say it can't be both input and output.
+ // If Jack port can send data to us and we actually want it...
+ if((pf & JackPortIsOutput) && (_openFlags & 2))
+ {
+ char buf[80];
+ snprintf(buf, 80, "muse-jack-midi-in-%d", _nextInIdNum);
+ _client_jackport = (jack_port_t*)audioDevice->registerInPort(buf, true);
+ if(_client_jackport == NULL)
+ {
+ fprintf(stderr, "MidiJackDevice::open failed to register jack-midi-in\n");
+ _readEnable = false;
+ return QString("Could not register jack-midi-in client port");
+ }
+ else
+ {
+ _nextInIdNum++;
+ ///audioDevice->connect(jp, _client_jackport);
+ _readEnable = true;
+ }
+ }
+ */
+
+ _writeEnable = bool(_openFlags & 1);
+ _readEnable = bool(_openFlags & 2);
+
+ return QString("OK");
+}
+
+//---------------------------------------------------------
+// close
+//---------------------------------------------------------
+
+void MidiJackDevice::close()
+{
+ #ifdef JACK_MIDI_DEBUG
+ printf("MidiJackDevice::close %s\n", name().latin1());
+ #endif
+
+ /*
+ if(_client_jackport)
+ {
+ int pf = jack_port_flags(_client_jackport);
+
+ if(pf & JackPortIsOutput)
+ _nextOutIdNum--;
+ else
+ if(pf & JackPortIsInput)
+ _nextInIdNum--;
+ audioDevice->unregisterPort(_client_jackport);
+ _client_jackport = 0;
+ _writeEnable = false;
+ _readEnable = false;
+ return;
+ }
+ */
+
+ _writeEnable = false;
+ _readEnable = false;
+
+ /*
+ //jack_port_t* jp = jack_port_by_name(_client, name().latin1());
+ jack_port_t* jp = (jack_port_t*)audioDevice->findPort(name().latin1());
+
+ if(!jp)
+ {
+ printf("MidiJackDevice::close: Jack midi port %s not found!\n", name().latin1());
+ _writeEnable = false;
+ _readEnable = false;
+ return;
+ }
+
+ //int pf = jack_port_flags(jp);
+
+ // If Jack port can receive data from us and we actually want to...
+ //if((pf & JackPortIsInput) && (_openFlags & 1))
+ if(jack_port_connected_to(midi_port_out[0], name().latin1()))
+ {
+ // src, dest
+/// audioDevice->disconnect(midi_port_out[0], jp);
+ _writeEnable = false;
+ }
+ else // Note docs say it can't be both input and output.
+ // If Jack port can send data to us and we actually want it...
+ //if((pf & JackPortIsOutput) && (_openFlags & 2))
+ if(jack_port_connected_to(midi_port_in[0], name().latin1()))
+ {
+/// audioDevice->disconnect(jp, midi_port_in[0]);
+ _readEnable = false;
+ }
+ */
+}
+
+//---------------------------------------------------------
+// writeRouting
+//---------------------------------------------------------
+
+void MidiJackDevice::writeRouting(int level, Xml& xml) const
+{
+ // p3.3.45
+ // If this device is not actually in use by the song, do not write any routes.
+ // This prevents bogus routes from being saved and propagated in the med file.
+ if(midiPort() == -1)
+ return;
+
+ QString s;
+ if(rwFlags() & 2) // Readable
+ {
+ //RouteList* rl = _inRoutes;
+ //for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ for (ciRoute r = _inRoutes.begin(); r != _inRoutes.end(); ++r)
+ {
+ if(!r->name().isEmpty())
+ {
+ xml.tag(level++, "Route");
+
+ //xml.strTag(level, "srcNode", r->name());
+ //xml.tag(level, "source type=\"%d\" name=\"%s\"/", r->type, r->name().latin1());
+ s = QT_TR_NOOP("source");
+ if(r->type != Route::TRACK_ROUTE)
+ s += QString(QT_TR_NOOP(" type=\"%1\"")).arg(r->type);
+
+ //s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(r->name());
+ s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(Xml::xmlString(r->name()));
+ xml.tag(level, s);
+
+ //xml.strTag(level, "dstNode", name());
+ //xml.tag(level, "dest type=\"%d\" name=\"%s\"/", Route::JACK_MIDI_ROUTE, name().latin1());
+ //xml.tag(level, "dest type=\"%d\" name=\"%s\"/", Route::MIDI_DEVICE_ROUTE, name().latin1());
+ //xml.tag(level, "dest devtype=\"%d\" name=\"%s\"/", MidiDevice::JACK_MIDI, name().latin1());
+ xml.tag(level, "dest devtype=\"%d\" name=\"%s\"/", MidiDevice::JACK_MIDI, Xml::xmlString(name()).latin1());
+
+ xml.etag(level--, "Route");
+ }
+ }
+ }
+
+ for (ciRoute r = _outRoutes.begin(); r != _outRoutes.end(); ++r)
+ {
+ if(!r->name().isEmpty())
+ {
+ s = QT_TR_NOOP("Route");
+ if(r->channel != -1)
+ s += QString(QT_TR_NOOP(" channel=\"%1\"")).arg(r->channel);
+
+ //xml.tag(level++, "Route");
+ xml.tag(level++, s);
+
+ /*
+ //xml.strTag(level, "srcNode", name());
+ if(r->channel != -1)
+ //xml.tag(level, "source type=\"%d\" channel=\"%d\" name=\"%s\"/", Route::JACK_MIDI_ROUTE, r->channel, name().latin1());
+ //xml.tag(level, "source type=\"%d\" channel=\"%d\" name=\"%s\"/", Route::MIDI_DEVICE_ROUTE, r->channel, name().latin1());
+ xml.tag(level, "source devtype=\"%d\" channel=\"%d\" name=\"%s\"/", MidiDevice::JACK_MIDI, r->channel, name().latin1());
+ else
+ //xml.tag(level, "source type=\"%d\" name=\"%s\"/", Route::JACK_MIDI_ROUTE, name().latin1());
+ //xml.tag(level, "source type=\"%d\" name=\"%s\"/", Route::MIDI_DEVICE_ROUTE, name().latin1());
+ */
+ //xml.tag(level, "source devtype=\"%d\" name=\"%s\"/", MidiDevice::JACK_MIDI, name().latin1());
+ xml.tag(level, "source devtype=\"%d\" name=\"%s\"/", MidiDevice::JACK_MIDI, Xml::xmlString(name()).latin1());
+
+ /*
+ //xml.strTag(level, "dstNode", r->name());
+ if(r->channel != -1)
+ {
+ if(r->type == Route::MIDI_DEVICE_ROUTE)
+ xml.tag(level, "dest devtype=\"%d\" channel=\"%d\" name=\"%s\"/", r->device->deviceType(), r->channel, r->name().latin1());
+ else
+ xml.tag(level, "dest type=\"%d\" channel=\"%d\" name=\"%s\"/", r->type, r->channel, r->name().latin1());
+ }
+ else
+ {
+ if(r->type == Route::MIDI_DEVICE_ROUTE)
+ xml.tag(level, "dest devtype=\"%d\" name=\"%s\"/", r->device->deviceType(), r->name().latin1());
+ else
+ xml.tag(level, "dest type=\"%d\" name=\"%s\"/", r->type, r->name().latin1());
+ }
+ */
+
+ s = QT_TR_NOOP("dest");
+ if(r->type == Route::MIDI_DEVICE_ROUTE)
+ s += QString(QT_TR_NOOP(" devtype=\"%1\"")).arg(r->device->deviceType());
+ else
+ if(r->type != Route::TRACK_ROUTE)
+ s += QString(QT_TR_NOOP(" type=\"%1\"")).arg(r->type);
+
+ //s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(r->name());
+ s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(Xml::xmlString(r->name()));
+ xml.tag(level, s);
+
+
+ xml.etag(level--, "Route");
+ }
+ }
+
+ /*
+ else
+ if(rwFlags() & 1) // Writable
+ {
+ //RouteList* rl = _outRoutes;
+ //for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ for (ciRoute r = _outRoutes.begin(); r != _outRoutes.end(); ++r)
+ {
+ if(!r->name().isEmpty())
+ {
+ xml.tag(level++, "Route");
+
+ //xml.strTag(level, "srcNode", name());
+ //if(r->channel != -1)
+ // xml.tag(level, "srcNode type=\"%d\" channel=\"%d\" name=\"%s\"", Route::JACK_MIDI_ROUTE, r->channel, name().latin1());
+ //else
+ xml.tag(level, "source type=\"%d\" name=\"%s\"/", Route::JACK_MIDI_ROUTE, name().latin1());
+
+ //xml.strTag(level, "dstNode", r->name());
+ xml.tag(level, "dest type=\"%d\" name=\"%s\"/", r->type, r->name().latin1());
+
+ xml.etag(level--, "Route");
+ }
+ }
+ }
+ */
+}
+
+//---------------------------------------------------------
+// putEvent
+//---------------------------------------------------------
+
+/* FIX: if we fail to transmit the event,
+ * we return false (indicating OK). Otherwise
+ * it seems muse will retry forever
+ */
+bool MidiJackDevice::putMidiEvent(const MidiPlayEvent& /*event*/)
+{
+ /*
+ int give, channel = event.channel();
+ int x;
+
+ if(channel >= JACK_MIDI_CHANNELS) return false;
+
+ // buffer up events, because jack eats them in chunks, if
+ // the buffer is full, there isn't so much to do, than
+ // drop the event
+
+ give = jack_midi_out_data[channel].give;
+ if(jack_midi_out_data[channel].buffer[give*4+3]){
+ fprintf(stderr, "WARNING: muse-to-jack midi-buffer is full, channel=%u\n", channel);
+ return false;
+ }
+ // copy event(note-on etc..), pitch and volume
+ // see http://www.midi.org/techspecs/midimessages.php
+ switch(event.type()){
+ case ME_NOTEOFF:
+ jack_midi_out_data[channel].buffer[give*4+0] = 0x80;
+ jack_midi_out_data[channel].buffer[give*4+1] = event.dataA() & 0x7f;
+ jack_midi_out_data[channel].buffer[give*4+2] = event.dataB() & 0x7f;
+ break;
+ case ME_NOTEON:
+ jack_midi_out_data[channel].buffer[give*4+0] = 0x90;
+ jack_midi_out_data[channel].buffer[give*4+1] = event.dataA() & 0x7f;
+ jack_midi_out_data[channel].buffer[give*4+2] = event.dataB() & 0x7f;
+ break;
+ case ME_CONTROLLER:
+ jack_midi_out_data[channel].buffer[give*4+0] = 0xb0;
+ jack_midi_out_data[channel].buffer[give*4+1] = event.dataA() & 0x7f;
+ jack_midi_out_data[channel].buffer[give*4+2] = event.dataB() & 0x7f;
+ break;
+ case ME_PROGRAM:
+ jack_midi_out_data[channel].buffer[give*4+0] = 0xc0;
+ jack_midi_out_data[channel].buffer[give*4+1] = event.dataA() & 0x7f;
+ jack_midi_out_data[channel].buffer[give*4+2] = 0;
+ break;
+ case ME_PITCHBEND:
+ jack_midi_out_data[channel].buffer[give*4+0] = 0xE0;
+ // convert muse pitch-bend to midi standard
+ x = 0x2000 + event.dataA();
+ jack_midi_out_data[channel].buffer[give*4+1] = x & 0x7f;
+ jack_midi_out_data[channel].buffer[give*4+2] = (x >> 8) & 0x7f;
+ break;
+ default:
+ fprintf(stderr, "jack-midi-out %u WARNING: unknown event %x\n", channel, event.type());
+ return false;
+ }
+ jack_midi_out_data[channel].buffer[give*4+3] = 1; // mark state of this slot
+ // finally increase give position
+ give++;
+ if(give >= JACK_MIDI_BUFFER_SIZE){
+ give = 0;
+ }
+ jack_midi_out_data[channel].give = give;
+ return false;
+ */
+
+ return false;
+}
+
+/*
+//---------------------------------------------------------
+// putEvent
+// return false if event is delivered
+//---------------------------------------------------------
+
+bool MidiJackDevice::putEvent(int* event)
+{
+ int *y; y = event;
+ return false;
+}
+*/
+
+//---------------------------------------------------------
+// recordEvent
+//---------------------------------------------------------
+
+void MidiJackDevice::recordEvent(MidiRecordEvent& event)
+ {
+ // Set the loop number which the event came in at.
+ //if(audio->isRecording())
+ if(audio->isPlaying())
+ event.setLoopNum(audio->loopCount());
+
+ if (midiInputTrace) {
+ printf("Jack MidiInput: ");
+ event.dump();
+ }
+
+ int typ = event.type();
+
+ if(_port != -1)
+ {
+ int idin = midiPorts[_port].syncInfo().idIn();
+
+ //---------------------------------------------------
+ // filter some SYSEX events
+ //---------------------------------------------------
+
+ if (typ == ME_SYSEX) {
+ const unsigned char* p = event.data();
+ int n = event.len();
+ if (n >= 4) {
+ if ((p[0] == 0x7f)
+ //&& ((p[1] == 0x7f) || (p[1] == rxDeviceId))) {
+ && ((p[1] == 0x7f) || (idin == 0x7f) || (p[1] == idin))) {
+ if (p[2] == 0x06) {
+ //mmcInput(p, n);
+ midiSeq->mmcInput(_port, p, n);
+ return;
+ }
+ if (p[2] == 0x01) {
+ //mtcInputFull(p, n);
+ midiSeq->mtcInputFull(_port, p, n);
+ return;
+ }
+ }
+ else if (p[0] == 0x7e) {
+ //nonRealtimeSystemSysex(p, n);
+ midiSeq->nonRealtimeSystemSysex(_port, p, n);
+ return;
+ }
+ }
+ }
+ else
+ // Trigger general activity indicator detector. Sysex has no channel, don't trigger.
+ midiPorts[_port].syncInfo().trigActDetect(event.channel());
+ }
+
+ //
+ // process midi event input filtering and
+ // transformation
+ //
+
+ processMidiInputTransformPlugins(event);
+
+ if (filterEvent(event, midiRecordType, false))
+ return;
+
+ if (!applyMidiInputTransformation(event)) {
+ if (midiInputTrace)
+ printf(" midi input transformation: event filtered\n");
+ return;
+ }
+
+ //
+ // transfer noteOn events to gui for step recording and keyboard
+ // remote control
+ //
+ if (typ == ME_NOTEON) {
+ int pv = ((event.dataA() & 0xff)<<8) + (event.dataB() & 0xff);
+ song->putEvent(pv);
+ }
+
+ //if(_recordFifo.put(MidiPlayEvent(event)))
+ // printf("MidiJackDevice::recordEvent: fifo overflow\n");
+
+ // p3.3.38
+ // Do not bother recording if it is NOT actually being used by a port.
+ // Because from this point on, process handles things, by selected port.
+ if(_port == -1)
+ return;
+
+ // Split the events up into channel fifos. Special 'channel' number 17 for sysex events.
+ unsigned int ch = (typ == ME_SYSEX)? MIDI_CHANNELS : event.channel();
+ if(_recordFifo[ch].put(MidiPlayEvent(event)))
+ printf("MidiJackDevice::recordEvent: fifo channel %d overflow\n", ch);
+ }
+
+//---------------------------------------------------------
+// midiReceived
+//---------------------------------------------------------
+
+void MidiJackDevice::eventReceived(jack_midi_event_t* ev)
+ {
+ MidiRecordEvent event;
+ event.setB(0);
+
+ // NOTE: From MusE-2. Not done here in Muse-1 (yet).
+ // move all events 2*segmentSize into the future to get
+ // jitterfree playback
+ //
+ // cycle n-1 n n+1
+ // -+----------+----------+----------+-
+ // ^ ^ ^
+ // catch process play
+ //
+// const SeqTime* st = audio->seqTime();
+
+ //unsigned curFrame = st->startFrame() + segmentSize;
+// unsigned curFrame = st->lastFrameTime;
+ //int frameOffset = audio->getFrameOffset();
+ unsigned pos = audio->pos().frame();
+
+ //event.setTime(pos + ev->time);
+ event.setTime(extSyncFlag.value() ? lastExtMidiSyncTick : (pos + ev->time));
+
+ event.setChannel(*(ev->buffer) & 0xf);
+ int type = *(ev->buffer) & 0xf0;
+ int a = *(ev->buffer + 1) & 0x7f;
+ int b = *(ev->buffer + 2) & 0x7f;
+ event.setType(type);
+ switch(type) {
+ case ME_NOTEON:
+ case ME_NOTEOFF:
+ case ME_CONTROLLER:
+ event.setA(*(ev->buffer + 1));
+ event.setB(*(ev->buffer + 2));
+ break;
+ case ME_PROGRAM:
+ case ME_AFTERTOUCH:
+ event.setA(*(ev->buffer + 1));
+ break;
+
+ case ME_PITCHBEND:
+ event.setA(((b << 7) + a) - 8192);
+ break;
+
+ case ME_SYSEX:
+ {
+ int type = *(ev->buffer) & 0xff;
+ switch(type)
+ {
+ case ME_SYSEX:
+
+ // TODO: Deal with large sysex, which are broken up into chunks!
+ // For now, do not accept if the last byte is not EOX, meaning it's a chunk with more chunks to follow.
+ if(*(((unsigned char*)ev->buffer) + ev->size - 1) != ME_SYSEX_END)
+ {
+ printf("MidiJackDevice::eventReceived sysex chunks not supported!\n");
+ return;
+ }
+
+ //event.setTime(0); // mark as used
+ event.setType(ME_SYSEX);
+ event.setData((unsigned char*)(ev->buffer + 1), ev->size - 2);
+ break;
+ case ME_MTC_QUARTER:
+ if(_port != -1)
+ midiSeq->mtcInputQuarter(_port, *(ev->buffer + 1));
+ return;
+ case ME_SONGPOS:
+ if(_port != -1)
+ midiSeq->setSongPosition(_port, *(ev->buffer + 1) | (*(ev->buffer + 2) >> 2 )); // LSB then MSB
+ return;
+ //case ME_SONGSEL:
+ //case ME_TUNE_REQ:
+ //case ME_SENSE:
+ case ME_CLOCK:
+ case ME_TICK:
+ case ME_START:
+ case ME_CONTINUE:
+ case ME_STOP:
+ if(_port != -1)
+ midiSeq->realtimeSystemInput(_port, type);
+ return;
+ //case ME_SYSEX_END:
+ //break;
+ // return;
+ default:
+ printf("MidiJackDevice::eventReceived unsupported system event 0x%02x\n", type);
+ return;
+ }
+ }
+ //return;
+ break;
+ default:
+ printf("MidiJackDevice::eventReceived unknown event 0x%02x\n", type);
+ //printf("MidiJackDevice::eventReceived unknown event 0x%02x size:%d buf:0x%02x 0x%02x 0x%02x ...0x%02x\n", type, ev->size, *(ev->buffer), *(ev->buffer + 1), *(ev->buffer + 2), *(ev->buffer + (ev->size - 1)));
+ return;
+ }
+
+ if (midiInputTrace) {
+ printf("MidiInput<%s>: ", name().latin1());
+ event.dump();
+ }
+
+ #ifdef JACK_MIDI_DEBUG
+ printf("MidiJackDevice::eventReceived time:%d type:%d ch:%d A:%d B:%d\n", event.time(), event.type(), event.channel(), event.dataA(), event.dataB());
+ #endif
+
+ // Let recordEvent handle it from here, with timestamps, filtering, gui triggering etc.
+ recordEvent(event);
+ }
+
+//---------------------------------------------------------
+// collectMidiEvents
+//---------------------------------------------------------
+
+void MidiJackDevice::collectMidiEvents()
+{
+ if(!_readEnable)
+ return;
+
+ if(!_client_jackport)
+ return;
+ void* port_buf = jack_port_get_buffer(_client_jackport, segmentSize);
+
+ jack_midi_event_t event;
+ jack_nframes_t eventCount = jack_midi_get_event_count(port_buf);
+ for (jack_nframes_t i = 0; i < eventCount; ++i)
+ {
+ jack_midi_event_get(&event, port_buf, i);
+
+ #ifdef JACK_MIDI_DEBUG
+ printf("MidiJackDevice::collectMidiEvents number:%d time:%d\n", i, event.time);
+ #endif
+
+ eventReceived(&event);
+ }
+}
+
+//---------------------------------------------------------
+// putEvent
+// return true if event cannot be delivered
+//---------------------------------------------------------
+
+bool MidiJackDevice::putEvent(const MidiPlayEvent& ev)
+{
+ if(!_writeEnable)
+ //return true;
+ return false;
+
+ #ifdef JACK_MIDI_DEBUG
+ printf("MidiJackDevice::putEvent time:%d type:%d ch:%d A:%d B:%d\n", ev.time(), ev.type(), ev.channel(), ev.dataA(), ev.dataB());
+ #endif
+
+ bool rv = eventFifo.put(ev);
+ if(rv)
+ printf("MidiJackDevice::putEvent: port overflow\n");
+
+ return rv;
+}
+
+//---------------------------------------------------------
+// queueEvent
+// return true if successful
+//---------------------------------------------------------
+
+//void JackAudioDevice::putEvent(Port port, const MidiEvent& e)
+bool MidiJackDevice::queueEvent(const MidiPlayEvent& e)
+//bool MidiJackDevice::queueEvent(const MidiPlayEvent& e)
+{
+ // Perhaps we can find use for this value later, together with the Jack midi MusE port(s).
+ // No big deal if not. Not used for now.
+ //int port = e.port();
+
+ //if(port >= JACK_MIDI_CHANNELS)
+ // return false;
+
+ //if (midiOutputTrace) {
+ // printf("MidiOut<%s>: jackMidi: ", portName(port).toLatin1().data());
+ // e.dump();
+ // }
+
+ //if(debugMsg)
+ // printf("MidiJackDevice::queueEvent\n");
+
+ if(!_client_jackport)
+ return false;
+ void* pb = jack_port_get_buffer(_client_jackport, segmentSize);
+
+ //unsigned frameCounter = ->frameTime();
+ int frameOffset = audio->getFrameOffset();
+ unsigned pos = audio->pos().frame();
+ int ft = e.time() - frameOffset - pos;
+
+ if (ft < 0)
+ ft = 0;
+ if (ft >= (int)segmentSize) {
+ printf("MidiJackDevice::queueEvent: Event time:%d out of range. offset:%d ft:%d (seg=%d)\n", e.time(), frameOffset, ft, segmentSize);
+ if (ft > (int)segmentSize)
+ ft = segmentSize - 1;
+ }
+
+ #ifdef JACK_MIDI_DEBUG
+ printf("MidiJackDevice::queueEvent time:%d type:%d ch:%d A:%d B:%d\n", e.time(), e.type(), e.channel(), e.dataA(), e.dataB());
+ #endif
+
+ switch(e.type()) {
+ case ME_NOTEON:
+ case ME_NOTEOFF:
+ case ME_POLYAFTER:
+ case ME_CONTROLLER:
+ case ME_PITCHBEND:
+ {
+ #ifdef JACK_MIDI_DEBUG
+ printf("MidiJackDevice::queueEvent note on/off polyafter controller or pitch\n");
+ #endif
+
+ unsigned char* p = jack_midi_event_reserve(pb, ft, 3);
+ if (p == 0) {
+ fprintf(stderr, "MidiJackDevice::queueEvent #1: buffer overflow, event lost\n");
+ return false;
+ }
+ p[0] = e.type() | e.channel();
+ p[1] = e.dataA();
+ p[2] = e.dataB();
+ }
+ break;
+
+ case ME_PROGRAM:
+ case ME_AFTERTOUCH:
+ {
+ #ifdef JACK_MIDI_DEBUG
+ printf("MidiJackDevice::queueEvent program or aftertouch\n");
+ #endif
+
+ unsigned char* p = jack_midi_event_reserve(pb, ft, 2);
+ if (p == 0) {
+ fprintf(stderr, "MidiJackDevice::queueEvent #2: buffer overflow, event lost\n");
+ return false;
+ }
+ p[0] = e.type() | e.channel();
+ p[1] = e.dataA();
+ }
+ break;
+ case ME_SYSEX:
+ {
+ #ifdef JACK_MIDI_DEBUG
+ printf("MidiJackDevice::queueEvent sysex\n");
+ #endif
+
+ const unsigned char* data = e.data();
+ int len = e.len();
+ unsigned char* p = jack_midi_event_reserve(pb, ft, len+2);
+ if (p == 0) {
+ fprintf(stderr, "MidiJackDevice::queueEvent #3: buffer overflow, event lost\n");
+ return false;
+ }
+ p[0] = 0xf0;
+ p[len+1] = 0xf7;
+ memcpy(p+1, data, len);
+ }
+ break;
+ case ME_SONGPOS:
+ case ME_CLOCK:
+ case ME_START:
+ case ME_CONTINUE:
+ case ME_STOP:
+ printf("MidiJackDevice::queueEvent: event type %x not supported\n", e.type());
+ return false;
+ break;
+ }
+
+ return true;
+}
+
+//---------------------------------------------------------
+// processEvent
+//---------------------------------------------------------
+
+void MidiJackDevice::processEvent(const MidiPlayEvent& event)
+{
+ //int frameOffset = audio->getFrameOffset();
+ //unsigned pos = audio->pos().frame();
+
+ int chn = event.channel();
+ unsigned t = event.time();
+ int a = event.dataA();
+ int b = event.dataB();
+ // Perhaps we can find use for this value later, together with the Jack midi MusE port(s).
+ // No big deal if not. Not used for now.
+ int port = event.port();
+
+ // TODO: No sub-tick playback resolution yet, with external sync.
+ // Just do this 'standard midi 64T timing thing' for now until we figure out more precise external timings.
+ // Does require relatively short audio buffers, in order to catch the resolution, but buffer <= 256 should be OK...
+ // Tested OK so far with 128.
+ if(extSyncFlag.value())
+ t = audio->getFrameOffset() + audio->pos().frame();
+ //t = frameOffset + pos;
+
+ #ifdef JACK_MIDI_DEBUG
+ printf("MidiJackDevice::processEvent time:%d type:%d ch:%d A:%d B:%d\n", event.time(), event.type(), event.channel(), event.dataA(), event.dataB());
+ #endif
+
+ if(event.type() == ME_PROGRAM)
+ {
+ // don't output program changes for GM drum channel
+ //if (!(song->mtype() == MT_GM && chn == 9)) {
+ int hb = (a >> 16) & 0xff;
+ int lb = (a >> 8) & 0xff;
+ int pr = a & 0x7f;
+
+ // p3.3.44
+ //printf("MidiJackDevice::processEvent ME_PROGRAM time:%d type:%d ch:%d A:%d B:%d hb:%d lb:%d pr:%d\n",
+ // event.time(), event.type(), event.channel(), event.dataA(), event.dataB(), hb, lb, pr);
+
+ if (hb != 0xff)
+ queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_HBANK, hb));
+ if (lb != 0xff)
+ queueEvent(MidiPlayEvent(t+1, port, chn, ME_CONTROLLER, CTRL_LBANK, lb));
+ queueEvent(MidiPlayEvent(t+2, port, chn, ME_PROGRAM, pr, 0));
+ // }
+ }
+ else
+ if(event.type() == ME_PITCHBEND)
+ {
+ int v = a + 8192;
+ // p3.3.44
+ //printf("MidiJackDevice::processEvent ME_PITCHBEND v:%d time:%d type:%d ch:%d A:%d B:%d\n", v, event.time(), event.type(), event.channel(), event.dataA(), event.dataB());
+
+ queueEvent(MidiPlayEvent(t, port, chn, ME_PITCHBEND, v & 0x7f, (v >> 7) & 0x7f));
+ }
+ else
+ if(event.type() == ME_CONTROLLER)
+ {
+ //int a = event.dataA();
+ //int b = event.dataB();
+ // Perhaps we can find use for this value later, together with the Jack midi MusE port(s).
+ // No big deal if not. Not used for now.
+ //int port = event.port();
+
+ int nvh = 0xff;
+ int nvl = 0xff;
+ if(_port != -1)
+ {
+ int nv = midiPorts[_port].nullSendValue();
+ if(nv != -1)
+ {
+ nvh = (nv >> 8) & 0xff;
+ nvl = nv & 0xff;
+ }
+ }
+
+ if(a == CTRL_PITCH)
+ {
+ int v = b + 8192;
+ // p3.3.44
+ //printf("MidiJackDevice::processEvent CTRL_PITCH v:%d time:%d type:%d ch:%d A:%d B:%d\n", v, event.time(), event.type(), event.channel(), event.dataA(), event.dataB());
+
+ queueEvent(MidiPlayEvent(t, port, chn, ME_PITCHBEND, v & 0x7f, (v >> 7) & 0x7f));
+ }
+ else if (a == CTRL_PROGRAM)
+ {
+ // don't output program changes for GM drum channel
+ //if (!(song->mtype() == MT_GM && chn == 9)) {
+ int hb = (b >> 16) & 0xff;
+ int lb = (b >> 8) & 0xff;
+ int pr = b & 0x7f;
+
+ // p3.3.44
+ //printf("MidiJackDevice::processEvent CTRL_PROGRAM time:%d type:%d ch:%d A:%d B:%d hb:%d lb:%d pr:%d\n",
+ // event.time(), event.type(), event.channel(), event.dataA(), event.dataB(), hb, lb, pr);
+
+ if (hb != 0xff)
+ queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_HBANK, hb));
+ if (lb != 0xff)
+ queueEvent(MidiPlayEvent(t+1, port, chn, ME_CONTROLLER, CTRL_LBANK, lb));
+ queueEvent(MidiPlayEvent(t+2, port, chn, ME_PROGRAM, pr, 0));
+ // }
+ }
+ /*
+ else if (a == CTRL_MASTER_VOLUME)
+ {
+ unsigned char sysex[] = {
+ 0x7f, 0x7f, 0x04, 0x01, 0x00, 0x00
+ };
+ sysex[1] = deviceId();
+ sysex[4] = b & 0x7f;
+ sysex[5] = (b >> 7) & 0x7f;
+ queueEvent(MidiPlayEvent(t, port, ME_SYSEX, sysex, 6));
+ }
+ */
+ else if (a < CTRL_14_OFFSET)
+ { // 7 Bit Controller
+ queueEvent(event);
+ //queueEvent(museport, MidiPlayEvent(t, port, chn, event));
+ }
+ else if (a < CTRL_RPN_OFFSET)
+ { // 14 bit high resolution controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ int dataH = (b >> 7) & 0x7f;
+ int dataL = b & 0x7f;
+ queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, ctrlH, dataH));
+ queueEvent(MidiPlayEvent(t+1, port, chn, ME_CONTROLLER, ctrlL, dataL));
+ }
+ else if (a < CTRL_NRPN_OFFSET)
+ { // RPN 7-Bit Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_HRPN, ctrlH));
+ queueEvent(MidiPlayEvent(t+1, port, chn, ME_CONTROLLER, CTRL_LRPN, ctrlL));
+ queueEvent(MidiPlayEvent(t+2, port, chn, ME_CONTROLLER, CTRL_HDATA, b));
+
+ t += 3;
+ // Select null parameters so that subsequent data controller events do not upset the last *RPN controller.
+ //sendNullRPNParams(chn, false);
+ if(nvh != 0xff)
+ {
+ queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_HRPN, nvh & 0x7f));
+ t += 1;
+ }
+ if(nvl != 0xff)
+ queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_LRPN, nvl & 0x7f));
+ }
+ //else if (a < CTRL_RPN14_OFFSET)
+ else if (a < CTRL_INTERNAL_OFFSET)
+ { // NRPN 7-Bit Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_HNRPN, ctrlH));
+ queueEvent(MidiPlayEvent(t+1, port, chn, ME_CONTROLLER, CTRL_LNRPN, ctrlL));
+ queueEvent(MidiPlayEvent(t+2, port, chn, ME_CONTROLLER, CTRL_HDATA, b));
+
+ t += 3;
+ //sendNullRPNParams(chn, true);
+ if(nvh != 0xff)
+ {
+ queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_HNRPN, nvh & 0x7f));
+ t += 1;
+ }
+ if(nvl != 0xff)
+ queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_LNRPN, nvl & 0x7f));
+ }
+ else if (a < CTRL_NRPN14_OFFSET)
+ { // RPN14 Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ int dataH = (b >> 7) & 0x7f;
+ int dataL = b & 0x7f;
+ queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_HRPN, ctrlH));
+ queueEvent(MidiPlayEvent(t+1, port, chn, ME_CONTROLLER, CTRL_LRPN, ctrlL));
+ queueEvent(MidiPlayEvent(t+2, port, chn, ME_CONTROLLER, CTRL_HDATA, dataH));
+ queueEvent(MidiPlayEvent(t+3, port, chn, ME_CONTROLLER, CTRL_LDATA, dataL));
+
+ t += 4;
+ //sendNullRPNParams(chn, false);
+ if(nvh != 0xff)
+ {
+ queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_HRPN, nvh & 0x7f));
+ t += 1;
+ }
+ if(nvl != 0xff)
+ queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_LRPN, nvl & 0x7f));
+ }
+ else if (a < CTRL_NONE_OFFSET)
+ { // NRPN14 Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ int dataH = (b >> 7) & 0x7f;
+ int dataL = b & 0x7f;
+ queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_HNRPN, ctrlH));
+ queueEvent(MidiPlayEvent(t+1, port, chn, ME_CONTROLLER, CTRL_LNRPN, ctrlL));
+ queueEvent(MidiPlayEvent(t+2, port, chn, ME_CONTROLLER, CTRL_HDATA, dataH));
+ queueEvent(MidiPlayEvent(t+3, port, chn, ME_CONTROLLER, CTRL_LDATA, dataL));
+
+ t += 4;
+ //sendNullRPNParams(chn, true);
+ if(nvh != 0xff)
+ {
+ queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_HNRPN, nvh & 0x7f));
+ t += 1;
+ }
+ if(nvl != 0xff)
+ queueEvent(MidiPlayEvent(t, port, chn, ME_CONTROLLER, CTRL_LNRPN, nvl & 0x7f));
+ }
+ else
+ {
+ printf("MidiJackDevice::processEvent: unknown controller type 0x%x\n", a);
+ }
+ }
+ else
+ {
+ queueEvent(event);
+ //queueEvent(MidiPlayEvent(t, port, chn, event));
+ }
+}
+
+//---------------------------------------------------------
+// processMidi called from audio process only.
+//---------------------------------------------------------
+
+void MidiJackDevice::processMidi()
+{
+ if(!_client_jackport)
+ return;
+ void* port_buf = jack_port_get_buffer(_client_jackport, segmentSize);
+ jack_midi_clear_buffer(port_buf);
+
+ while(!eventFifo.isEmpty())
+ {
+ MidiPlayEvent e(eventFifo.get());
+ int evTime = e.time();
+ // Is event marked to be played immediately?
+ if(evTime == 0)
+ {
+ // Nothing to do but stamp the event to be queued for frame 0+.
+ //e.setTime(frameOffset + pos);
+ e.setTime(audio->getFrameOffset() + audio->pos().frame());
+ }
+
+ #ifdef JACK_MIDI_DEBUG
+ printf("MidiJackDevice::processMidi eventFifo time:%d type:%d ch:%d A:%d B:%d\n", e.time(), e.type(), e.channel(), e.dataA(), e.dataB());
+ #endif
+
+ //el->insert(eventFifo.get());
+ //el->insert(e);
+ processEvent(e);
+ }
+
+ MPEventList* el = playEvents();
+ if(el->empty())
+ return;
+
+ iMPEvent i = nextPlayEvent();
+ for(; i != el->end(); ++i)
+ {
+ // p3.3.39 Update hardware state so knobs and boxes are updated. Optimize to avoid re-setting existing values.
+ // Same code as in MidiPort::sendEvent()
+ if(_port != -1)
+ {
+ MidiPort* mp = &midiPorts[_port];
+ if(i->type() == ME_CONTROLLER)
+ {
+ int da = i->dataA();
+ int db = i->dataB();
+ db = mp->limitValToInstrCtlRange(da, db);
+ if(!mp->setHwCtrlState(i->channel(), da, db))
+ continue;
+ //mp->setHwCtrlState(i->channel(), da, db);
+ }
+ else
+ if(i->type() == ME_PITCHBEND)
+ {
+ // p3.3.44
+ //printf("MidiJackDevice::processMidi playEvents ME_PITCHBEND time:%d type:%d ch:%d A:%d B:%d\n", (*i).time(), (*i).type(), (*i).channel(), (*i).dataA(), (*i).dataB());
+
+ int da = mp->limitValToInstrCtlRange(CTRL_PITCH, i->dataA());
+ if(!mp->setHwCtrlState(i->channel(), CTRL_PITCH, da))
+ continue;
+ //mp->setHwCtrlState(i->channel(), CTRL_PITCH, da);
+
+ //(MidiPlayEvent(t, port, chn, ME_PITCHBEND, v & 0x7f, (v >> 7) & 0x7f));
+ }
+ else
+ if(i->type() == ME_PROGRAM)
+ {
+ if(!mp->setHwCtrlState(i->channel(), CTRL_PROGRAM, i->dataA()))
+ continue;
+ //mp->setHwCtrlState(i->channel(), CTRL_PROGRAM, i->dataA());
+ }
+ }
+
+ processEvent(*i);
+ }
+
+ setNextPlayEvent(i);
+}
+
+//---------------------------------------------------------
+// initMidiJack
+// return true on error
+//---------------------------------------------------------
+
+bool initMidiJack()
+{
+ /*
+ int adr = 0;
+
+ memset(jack_midi_out_data, 0, JACK_MIDI_CHANNELS * sizeof(muse_jack_midi_buffer));
+ memset(jack_midi_in_data, 0, JACK_MIDI_CHANNELS * sizeof(muse_jack_midi_buffer));
+
+ MidiJackDevice* dev = new MidiJackDevice(adr, QString("jack-midi"));
+ dev->setrwFlags(3); // set read and write flags
+
+ if(pipe(jackmidi_pi) < 0){
+ fprintf(stderr, "cant create midi-jack input pipe\n");
+ }
+ if(pipe(jackmidi_po) < 0){
+ fprintf(stderr, "cant create midi-jack output pipe\n");
+ }
+
+ midiDevices.add(dev);
+
+ gmdev = dev; // proclaim the global jack-midi instance
+
+ //jackScanMidiPorts();
+ */
+
+ return false;
+}
+
+/*
+struct JackPort {
+ int adr;
+ //char* name;
+ QString name;
+ int flags;
+ //JackPort(int a, const char* s, int f) {
+ JackPort(int a, const QString& s, int f) {
+ adr = a;
+ //name = strdup(s);
+ name = QString(s);
+ flags = f;
+ }
+ };
+
+
+static std::list<JackPort> portList;
+
+//---------------------------------------------------------
+// jackScanMidiPorts
+//---------------------------------------------------------
+
+void jackScanMidiPorts()
+{
+ int adr;
+ const char* name;
+
+ portList.clear();
+ adr = 0;
+ name = strdup("namex");
+ portList.push_back(JackPort(adr, name, 0));
+ //
+ // check for devices to add
+ //
+ for (std::list<JackPort>::iterator k = portList.begin(); k != portList.end(); ++k) {
+ iMidiDevice i = midiDevices.begin();
+ for (;i != midiDevices.end(); ++i) {
+ //MidiJackDevice* d = dynamic_cast<MidiJackDevice*>(*i);
+ break;
+ //if (d == 0) continue;
+ //if ((k->adr.client == d->adr.client) && (k->adr.port == d->adr.port)) {
+ // break;
+ //}
+ }
+ if (i == midiDevices.end()) {
+ // add device
+ MidiJackDevice* dev = new MidiJackDevice(k->adr, QString(k->name));
+ dev->setrwFlags(k->flags);
+ midiDevices.add(dev);
+ }
+ }
+}
+*/
+
+/*
+//---------------------------------------------------------
+// processInput
+//---------------------------------------------------------
+static void handle_jack_midi_in(int channel)
+{
+ MidiRecordEvent event;
+ int t,n,v;
+ t = jack_midi_in_data[channel].buffer[0];
+ n = jack_midi_in_data[channel].buffer[1];
+ v = jack_midi_in_data[channel].buffer[2];
+
+ event.setType(0); // mark as unused
+ event.setPort(gmdev->midiPort());
+ event.setB(0);
+
+ if(t == 0x90){ // note on
+ fprintf(stderr, "jackProcessMidiInput note-on\n");
+ event.setChannel(channel);
+ event.setType(ME_NOTEON);
+ event.setA(n);
+ event.setB(v);
+ }else if (t == 0x80){ // note off
+ fprintf(stderr, "jackProcessMidiInput note-off\n");
+ event.setChannel(channel);
+ event.setType(ME_NOTEOFF);
+ event.setA(n);
+ event.setB(v);
+ }else{
+ fprintf(stderr, "WARNING: unknown midi-in on channel %d: %x,%x,%x\n",
+ channel, t, n, v);
+ return;
+ }
+ if(event.type()){
+ gmdev->recordEvent(event);
+ midiPorts[gmdev->midiPort()].syncInfo().trigActDetect(event.channel());
+ }
+}
+
+void MidiJackDevice::processInput()
+{
+ char buf;
+ int i,s;
+ read(gmdev->selectRfd(), &buf, 1);
+
+ s = 1;
+ for(i = 0; i < JACK_MIDI_CHANNELS; i++){
+ if(jack_midi_in_data[i].buffer[3]){
+ s = 0;
+ handle_jack_midi_in(i);
+ jack_midi_in_data[i].buffer[3] = 0;
+ }
+ }
+}
+
+*/
diff --git a/muse2/muse/driver/jackmidi.h b/muse2/muse/driver/jackmidi.h
new file mode 100644
index 00000000..12b967a9
--- /dev/null
+++ b/muse2/muse/driver/jackmidi.h
@@ -0,0 +1,156 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: jackmidi.h,v 1.1.1.1 2010/01/27 09:06:43 terminator356 Exp $
+// (C) Copyright 1999-2010 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __JACKMIDI_H__
+#define __JACKMIDI_H__
+
+//#include <config.h>
+
+#include <map>
+
+#include <jack/jack.h>
+#include <jack/midiport.h>
+
+#include "mididev.h"
+#include "route.h"
+
+class QString;
+class MidiFifo;
+class MidiRecordEvent;
+class MidiPlayEvent;
+//class RouteList;
+class Xml;
+
+// Turn on to show multiple devices, work in progress,
+// not working fully yet, can't seem to connect...
+#define JACK_MIDI_SHOW_MULTIPLE_DEVICES
+
+// It appears one client port per remote port will be necessary.
+// Jack doesn't seem to like manipulation of non-local ports buffers.
+#define JACK_MIDI_USE_MULTIPLE_CLIENT_PORTS
+
+/* jack-midi channels */
+//#define JACK_MIDI_CHANNELS 32
+
+/* jack-midi buffer size */
+//#define JACK_MIDI_BUFFER_SIZE 32
+
+/*
+typedef struct {
+ int give;
+ int take;
+ // 32 parallel midi events, where each event contains three
+ // midi-bytes and one busy-byte
+ char buffer[4 * JACK_MIDI_BUFFER_SIZE];
+} muse_jack_midi_buffer;
+*/
+
+/*
+struct JackMidiPort
+{
+ jack_port_t* _jackPort;
+ QString _name;
+ int _flags; // 1 = writable, 2 = readable - do not mix
+ JackMidiPort(jack_port_t* jp, const QString& s, int f)
+ {
+ _jackPort = jp;
+ _name = QString(s);
+ _flags = f;
+ }
+};
+
+typedef std::map<jack_port_t*, JackMidiPort, std::less<jack_port_t*> >::iterator iJackMidiPort;
+typedef std::map<jack_port_t*, JackMidiPort, std::less<jack_port_t*> >::const_iterator ciJackMidiPort;
+
+class JackMidiPortList : public std::map<jack_port_t*, JackMidiPort, std::less<jack_port_t*> >
+{
+ private:
+ static int _nextOutIdNum;
+ static int _nextInIdNum;
+
+ public:
+ JackMidiPortList();
+ ~JackMidiPortList();
+ iJackMidiPort createClientPort(int flags);
+ bool removeClientPort(jack_port_t* port);
+};
+
+extern JackMidiPortList jackMidiClientPorts;
+*/
+
+//---------------------------------------------------------
+// MidiJackDevice
+//---------------------------------------------------------
+
+class MidiJackDevice : public MidiDevice {
+ public:
+ //int adr;
+
+ private:
+ // fifo for midi events sent from gui
+ // direct to midi port:
+ MidiFifo eventFifo;
+
+ //static int _nextOutIdNum;
+ //static int _nextInIdNum;
+
+ jack_port_t* _client_jackport;
+ //RouteList _routes;
+
+ virtual QString open();
+ virtual void close();
+ //bool putEvent(int*);
+
+ void processEvent(const MidiPlayEvent&);
+ // Port is not midi port, it is the port(s) created for MusE.
+ bool queueEvent(const MidiPlayEvent&);
+
+ virtual bool putMidiEvent(const MidiPlayEvent&);
+ //bool sendEvent(const MidiPlayEvent&);
+
+ void eventReceived(jack_midi_event_t*);
+
+ public:
+ MidiJackDevice() {}
+ //MidiJackDevice(const int&, const QString& name);
+ MidiJackDevice(jack_port_t* jack_port, const QString& name);
+
+ static MidiDevice* createJackMidiDevice(QString /*name*/, int /*rwflags*/); // 1:Writable 2: Readable. Do not mix.
+
+ virtual inline int deviceType() { return JACK_MIDI; }
+
+ virtual void setName(const QString&);
+
+ virtual void processMidi();
+ virtual ~MidiJackDevice();
+ //virtual int selectRfd();
+ //virtual int selectWfd();
+ //virtual void processInput();
+
+ virtual void recordEvent(MidiRecordEvent&);
+
+ virtual bool putEvent(const MidiPlayEvent&);
+ virtual void collectMidiEvents();
+
+ //virtual jack_port_t* jackPort() { return _jackport; }
+ //virtual jack_port_t* clientJackPort() { return _client_jackport; }
+ virtual void* clientPort() { return (void*)_client_jackport; }
+
+ //RouteList* routes() { return &_routes; }
+ //bool noRoute() const { return _routes.empty(); }
+ virtual void writeRouting(int, Xml&) const;
+ };
+
+extern bool initMidiJack();
+//extern int jackSelectRfd();
+//extern int jackSelectWfd();
+//extern void jackProcessMidiInput();
+//extern void jackScanMidiPorts();
+
+#endif
+
+
diff --git a/muse2/muse/driver/rtctimer.cpp b/muse2/muse/driver/rtctimer.cpp
new file mode 100644
index 00000000..1a3cefa6
--- /dev/null
+++ b/muse2/muse/driver/rtctimer.cpp
@@ -0,0 +1,155 @@
+ //=========================================================
+ // MusE
+ // Linux Music Editor
+ // $Id: rtctimer.cpp,v 1.1.2.11 2009/03/09 02:05:18 terminator356 Exp $
+ //
+ // Most code moved from midiseq.cpp by Werner Schweer.
+ //
+ // (C) Copyright 2004 Robert Jonsson (rj@spamatica.se)
+ // (C) Copyright -2004 Werner Schweer (werner@seh.de)
+ //=========================================================
+
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
+#include <linux/spinlock.h>
+#include <linux/mc146818rtc.h>
+#else
+#include <linux/rtc.h>
+#endif
+#include <stdio.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <poll.h>
+
+
+#include "rtctimer.h"
+#include "globals.h"
+#include "gconfig.h"
+
+
+RtcTimer::RtcTimer()
+ {
+ timerFd = -1;
+ }
+
+RtcTimer::~RtcTimer()
+ {
+ if (timerFd != -1)
+ close(timerFd);
+ }
+
+signed int RtcTimer::initTimer()
+ {
+ if(TIMER_DEBUG)
+ printf("RtcTimer::initTimer()\n");
+ if (timerFd != -1) {
+ fprintf(stderr,"RtcTimer::initTimer(): called on initialised timer!\n");
+ return -1;
+ }
+ doSetuid();
+
+ timerFd = ::open("/dev/rtc", O_RDONLY);
+ if (timerFd == -1) {
+ fprintf(stderr, "fatal error: open /dev/rtc failed: %s\n", strerror(errno));
+ fprintf(stderr, "hint: check if 'rtc' kernel module is loaded, or used by something else\n");
+ undoSetuid();
+ return timerFd;
+ }
+ if (!setTimerFreq(config.rtcTicks)) {
+ // unable to set timer frequency
+ return -1;
+ }
+ // check if timer really works, start and stop it once.
+ if (!startTimer()) {
+ return -1;
+ }
+ if (!stopTimer()) {
+ return -1;
+ }
+ return timerFd;
+ }
+
+unsigned int RtcTimer::setTimerResolution(unsigned int resolution)
+ {
+ if(TIMER_DEBUG)
+ printf("RtcTimer::setTimerResolution(%d)\n",resolution);
+ /* The RTC can take power-of-two frequencies from 2 to 8196 Hz.
+ * It doesn't really have a resolution as such.
+ */
+ return 0;
+ }
+
+unsigned int RtcTimer::setTimerFreq(unsigned int freq)
+ {
+ int rc = ioctl(timerFd, RTC_IRQP_SET, freq);
+ if (rc == -1) {
+ fprintf(stderr, "RtcTimer::setTimerFreq(): cannot set tick on /dev/rtc: %s\n",
+ strerror(errno));
+ fprintf(stderr, " precise timer not available\n");
+ return 0;
+ }
+ return freq;
+ }
+
+unsigned int RtcTimer::getTimerResolution()
+ {
+ /* The RTC doesn't really work with a set resolution as such.
+ * Not sure how this fits into things yet.
+ */
+ return 0;
+ }
+
+unsigned int RtcTimer::getTimerFreq()
+ {
+ unsigned int freq;
+ int rv = ioctl(timerFd, RTC_IRQP_READ, &freq);
+ if (rv < 1)
+ return 0;
+ return freq;
+ }
+
+bool RtcTimer::startTimer()
+ {
+ if(TIMER_DEBUG)
+ printf("RtcTimer::startTimer()\n");
+ if (timerFd == -1) {
+ fprintf(stderr, "RtcTimer::startTimer(): no timer open to start!\n");
+ return false;
+ }
+ if (ioctl(timerFd, RTC_PIE_ON, 0) == -1) {
+ perror("MidiThread: start: RTC_PIE_ON failed");
+ undoSetuid();
+ return false;
+ }
+ return true;
+ }
+
+bool RtcTimer::stopTimer()
+ {
+ if(TIMER_DEBUG)
+ printf("RtcTimer::stopTimer\n");
+ if (timerFd != -1) {
+ ioctl(timerFd, RTC_PIE_OFF, 0);
+ }
+ else {
+ fprintf(stderr,"RtcTimer::stopTimer(): no RTC to stop!\n");
+ return false;
+ }
+ return true;
+ }
+
+unsigned int RtcTimer::getTimerTicks(bool /*printTicks*/)// prevent compiler warning: unused parameter
+ {
+ if(TIMER_DEBUG)
+ printf("getTimerTicks()\n");
+ unsigned long int nn;
+ if (timerFd==-1) {
+ fprintf(stderr,"RtcTimer::getTimerTicks(): no RTC open to read!\n");
+ return 0;
+ }
+ if (read(timerFd, &nn, sizeof(unsigned long)) != sizeof(unsigned long)) {
+ fprintf(stderr,"RtcTimer::getTimerTicks(): error reading RTC\n");
+ return 0;
+ }
+ return nn;
+ }
diff --git a/muse2/muse/driver/rtctimer.h b/muse2/muse/driver/rtctimer.h
new file mode 100644
index 00000000..fa58b032
--- /dev/null
+++ b/muse2/muse/driver/rtctimer.h
@@ -0,0 +1,44 @@
+ //=========================================================
+ // MusE
+ // Linux Music Editor
+ // $Id: rtctimer.h,v 1.1.2.3 2005/08/21 18:11:28 spamatica Exp $
+ //
+ // Most code moved from midiseq.cpp
+ //
+ // (C) Copyright 2004 Robert Jonsson (rj@spamatica.se)
+ // (C) Copyright -2004 Werner Schweer (werner@seh.de)
+ //=========================================================
+
+#ifndef __RTCTIMER_H__
+#define __RTCTIMER_H__
+
+#include "timerdev.h"
+
+
+//---------------------------------------------------------
+// AlsaTimer
+//---------------------------------------------------------
+
+class RtcTimer : public Timer{
+
+
+ public:
+ RtcTimer();
+ virtual ~RtcTimer();
+
+ virtual signed int initTimer();
+ virtual unsigned int setTimerResolution(unsigned int resolution);
+ virtual unsigned int getTimerResolution();
+ virtual unsigned int setTimerFreq(unsigned int tick);
+ virtual unsigned int getTimerFreq();
+
+ virtual bool startTimer();
+ virtual bool stopTimer();
+ virtual unsigned int getTimerTicks(bool printTicks=false);
+
+ private:
+ int timerFd;
+
+};
+
+#endif //__ALSATIMER_H__
diff --git a/muse2/muse/driver/timerdev.h b/muse2/muse/driver/timerdev.h
new file mode 100644
index 00000000..944bc213
--- /dev/null
+++ b/muse2/muse/driver/timerdev.h
@@ -0,0 +1,41 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: timerdev.h,v 1.1.2.3 2005/08/21 18:11:28 spamatica Exp $
+//
+// Plenty of code borrowed from timer.c example in
+// alsalib 1.0.7
+//
+// (C) Copyright 2004 Robert Jonsson (rj@spamatica.se)
+//=========================================================
+
+#ifndef __TIMERDEV_H__
+#define __TIMERDEV_H__
+
+#include "alsa/asoundlib.h"
+
+#define TIMER_DEBUG 0
+
+//---------------------------------------------------------
+// AlsaTimer
+//---------------------------------------------------------
+
+class Timer {
+
+ public:
+ Timer() {};
+ virtual ~Timer() {};
+
+ virtual signed int initTimer() = 0;
+ virtual unsigned int setTimerResolution(unsigned int resolution) = 0;
+ virtual unsigned int getTimerResolution() = 0;
+ virtual unsigned int setTimerFreq(unsigned int freq) = 0;
+ virtual unsigned int getTimerFreq() = 0;
+
+ virtual bool startTimer() = 0;
+ virtual bool stopTimer() = 0;
+ virtual unsigned int getTimerTicks(bool printTicks = false) = 0;
+
+};
+
+#endif //__ALSATIMER_H__
diff --git a/muse2/muse/dssihost.cpp b/muse2/muse/dssihost.cpp
new file mode 100644
index 00000000..2c13d223
--- /dev/null
+++ b/muse2/muse/dssihost.cpp
@@ -0,0 +1,3055 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// $Id: dssihost.cpp,v 1.15.2.16 2009/12/15 03:39:58 terminator356 Exp $
+//
+// Copyright (C) 2002-2006 by Werner Schweer and others
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//=============================================================================
+
+#include "config.h"
+#ifdef DSSI_SUPPORT
+
+// Turn on debugging messages
+//#define DSSI_DEBUG
+
+// Support vst state saving/loading with vst chunks. Requires patches to DSSI and DSSI-vst!
+//#define DSSI_VST_CHUNK_SUPPORT
+
+#include <string.h>
+#include <signal.h>
+#include <dlfcn.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+//#include <dssi.h>
+//#include <alsa/asoundlib.h>
+#include <qdir.h>
+//#include <qstringlist.h>
+#include <QFileInfo>
+#include <q3popupmenu.h>
+//#include <qprocess.h>
+
+#include "dssihost.h"
+#include "synth.h"
+#include "audio.h"
+#include "jackaudio.h"
+#include "midi.h"
+#include "midiport.h"
+#include "stringparam.h"
+#include "plugin.h"
+//#include "al/al.h"
+//#include "al/xml.h"
+#include "xml.h"
+#include "song.h"
+//#include "midictrl.h"
+//#include "ladspaplugin.h"
+
+#include "app.h"
+#include "globals.h"
+#include "globaldefs.h"
+//#include "al/dsp.h"
+#include "gconfig.h"
+
+/*
+static lo_server_thread serverThread;
+static char osc_path_tmp[1024];
+static char* url;
+
+//---------------------------------------------------------
+// oscError
+//---------------------------------------------------------
+
+static void oscError(int num, const char *msg, const char *path)
+ {
+ fprintf(stderr, "MusE: liblo server error %d in path %s: %s\n",
+ num, path, msg);
+ }
+
+//---------------------------------------------------------
+// oscDebugHandler
+//---------------------------------------------------------
+
+static int oscDebugHandler(const char* path, const char* types, lo_arg** argv,
+ int argc, void*, void*)
+ {
+ printf("MusE: got unhandled OSC message:\n path: <%s>\n", path);
+ for (int i = 0; i < argc; i++) {
+ printf(" arg %d '%c' ", i, types[i]);
+ lo_arg_pp(lo_type(types[i]), argv[i]);
+ printf("\n");
+ }
+ return 1;
+ }
+
+//---------------------------------------------------------
+// oscUpdate
+//---------------------------------------------------------
+
+int DssiSynthIF::oscUpdate(lo_arg **argv)
+ {
+ const char *url = (char *)&argv[0]->s;
+
+ if (uiTarget)
+ lo_address_free(uiTarget);
+ char* host = lo_url_get_hostname(url);
+ char* port = lo_url_get_port(url);
+ uiTarget = lo_address_new(host, port);
+ free(host);
+ free(port);
+
+ if (uiOscPath)
+ free(uiOscPath);
+ uiOscPath = lo_url_get_path(url);
+ int pl = strlen(uiOscPath);
+
+ if (uiOscControlPath)
+ free(uiOscControlPath);
+ uiOscControlPath = (char *)malloc(pl + 10);
+ sprintf(uiOscControlPath, "%s/control", uiOscPath);
+
+ if (uiOscConfigurePath)
+ free(uiOscConfigurePath);
+ uiOscConfigurePath = (char *)malloc(pl + 12);
+ sprintf(uiOscConfigurePath, "%s/configure", uiOscPath);
+
+ if (uiOscProgramPath)
+ free(uiOscProgramPath);
+ uiOscProgramPath = (char *)malloc(pl + 10);
+ sprintf(uiOscProgramPath, "%s/program", uiOscPath);
+
+ if (uiOscShowPath)
+ free(uiOscShowPath);
+ uiOscShowPath = (char *)malloc(pl + 10);
+ sprintf(uiOscShowPath, "%s/show", uiOscPath);
+
+ // At this point a more substantial host might also call
+ // configure() on the UI to set any state that it had remembered
+ // for the plugin instance. But we don't remember state for
+ // plugin instances (see our own configure() implementation in
+ // osc_configure_handler), and so we have nothing to send except
+ // the optional project directory.
+
+
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::oscUpdate synth name:%s url:%s uiTarget:%p uiOscPath:%s uiOscConfigurePath:%s museProject:%s\n", synti->name().ascii(), url, uiTarget, uiOscPath, uiOscConfigurePath, museProject.ascii());
+ #endif
+
+ //lo_send(uiTarget, uiOscConfigurePath, "ss",
+ //DSSI_PROJECT_DIRECTORY_KEY, song->projectPath().toAscii().data());
+ lo_send(uiTarget, uiOscConfigurePath, "ss",
+ DSSI_PROJECT_DIRECTORY_KEY, museProject.ascii());
+
+#if 0
+ // Send current bank/program (-FIX- another race...)
+ if (instance->pendingProgramChange < 0) {
+ unsigned long bank = instance->currentBank;
+ unsigned long program = instance->currentProgram;
+ instance->uiNeedsProgramUpdate = 0;
+ if (instance->uiTarget) {
+ lo_send(instance->uiTarget, instance->ui_osc_program_path, "ii", bank, program);
+ }
+ }
+
+ // Send control ports
+ for (i = 0; i < instance->plugin->controlIns; i++) {
+ int in = i + instance->firstControlIn;
+ int port = pluginControlInPortNumbers[in];
+ lo_send(instance->uiTarget, instance->ui_osc_control_path, "if", port,
+ pluginControlIns[in]);
+ // Avoid overloading the GUI if there are lots and lots of ports
+ if ((i+1) % 50 == 0)
+ usleep(300000);
+ }
+#endif
+ return 0;
+ }
+
+//---------------------------------------------------------
+// oscMessageHandler
+//---------------------------------------------------------
+
+int oscMessageHandler(const char* path, const char* types, lo_arg** argv,
+ int argc, void* data, void* user_data)
+ {
+ const char* p = path;
+
+ #ifdef DSSI_DEBUG
+ if(argc)
+ {
+ printf("oscMessageHandler: path:%s argc:%d\n", path, argc);
+ for(int i = 0; i < argc; ++i)
+ {
+ printf(" ");
+ lo_arg_pp((lo_type)types[i], argv[i]);
+ }
+ printf("\n");
+ }
+ else
+ {
+ printf("%s\n", path);
+ printf("oscMessageHandler: no args, path:%s\n", path);
+ }
+ #endif
+
+ if (strncmp(p, "/dssi/", 6))
+ return oscDebugHandler(path, types, argv, argc, data, user_data);
+
+ p += 6;
+ //p = strrchr(p, "/");
+
+ SynthIList* sl = song->syntis();
+ DssiSynthIF* instance = 0;
+ SynthI* synti = 0;
+
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "oscMessageHandler: song->syntis() size:%d\n", sl->size());
+ #endif
+
+ for(int retry = 0; retry < 5; ++retry)
+ {
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "oscMessageHandler: search retry number:%d ...\n", retry);
+ #endif
+
+ //if(uiOscPath)
+ // break;
+
+ for(iSynthI si = sl->begin(); si != sl->end(); ++si)
+ {
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "oscMessageHandler: searching for synth p:%s: checking instances:%s\n", p, (*si)->name().ascii());
+ #endif
+
+ //int l = strlen((*si)->name().toAscii().data());
+ //if (!strncmp(p, (*si)->name().toAscii().data(), l)) {
+ //int l = strlen((*si)->name().ascii());
+ const char* sub = strstr(p, (*si)->name().ascii());
+
+ //if(!strncmp(p, (*si)->name().ascii(), l))
+ if(sub != NULL)
+ {
+ synti = *si;
+ instance = (DssiSynthIF*)(synti->sif());
+
+ //p += l;
+ p = sub + strlen((*si)->name().ascii());
+
+ break;
+ }
+ }
+ if(instance)
+ break;
+
+ sleep(1);
+ }
+
+ if(!instance)
+ {
+ fprintf(stderr, "oscMessageHandler: error: no instance\n");
+ return oscDebugHandler(path, types, argv, argc, data, user_data);
+ }
+
+ if (*p != '/' || *(p + 1) == 0)
+ {
+ fprintf(stderr, "oscMessageHandler: error: end or no /\n");
+ return oscDebugHandler(path, types, argv, argc, data, user_data);
+ }
+
+ ++p;
+
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "oscMessageHandler: method:%s\n", p);
+ #endif
+
+ if (!strcmp(p, "configure") && argc == 2 && !strcmp(types, "ss"))
+ return instance->oscConfigure(argv);
+ else if (!strcmp(p, "control") && argc == 2 && !strcmp(types, "if"))
+ return instance->oscControl(argv);
+ else if (!strcmp(p, "midi") && argc == 1 && !strcmp(types, "m"))
+ return instance->oscMidi(argv);
+ else if (!strcmp(p, "program") && argc == 2 && !strcmp(types, "ii"))
+ return instance->oscProgram(argv);
+ else if (!strcmp(p, "update") && argc == 1 && !strcmp(types, "s"))
+ return instance->oscUpdate(argv);
+ else if (!strcmp(p, "exiting") && argc == 0)
+ return instance->oscExiting(argv);
+ return oscDebugHandler(path, types, argv, argc, data, user_data);
+ }
+*/
+
+//---------------------------------------------------------
+// scanDSSILib
+//---------------------------------------------------------
+
+static void scanDSSILib(QFileInfo& fi) // ddskrjo removed const for argument
+ {
+ //void* handle = dlopen(fi.filePath().toAscii().data(), RTLD_NOW);
+ void* handle = dlopen(fi.filePath().latin1(), RTLD_NOW);
+ //void* handle = dlopen(fi.absFilePath().latin1(), RTLD_NOW);
+
+ if (handle == 0) {
+ fprintf(stderr, "scanDSSILib: dlopen(%s) failed: %s\n",
+ //fi.filePath().toAscii().data(), dlerror());
+ fi.filePath().latin1(), dlerror());
+ //fi.absFilePath().latin1(), dlerror());
+
+ return;
+ }
+ DSSI_Descriptor_Function dssi = (DSSI_Descriptor_Function)dlsym(handle, "dssi_descriptor");
+
+ if (!dssi)
+ {
+ /*
+ const char *txt = dlerror();
+ if (txt)
+ {
+ fprintf(stderr,
+ "Unable to find dssi_descriptor() function in plugin "
+ "library file \"%s\": %s.\n"
+ "Are you sure this is a DSSI plugin file?\n",
+ //fi.filePath().toAscii().data(),
+ fi.filePath().ascii(),
+ //fi.absFilePath().latin1(),
+
+ txt);
+ dlclose(handle);
+ exit(1);
+ }
+ */
+ dlclose(handle);
+ return;
+ }
+ else
+ {
+ const DSSI_Descriptor* descr;
+ for (int i = 0;; ++i)
+ {
+ descr = dssi(i);
+ if (descr == 0)
+ break;
+
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "scanDSSILib: name:%s inPlaceBroken:%d\n", descr->LADSPA_Plugin->Name, LADSPA_IS_INPLACE_BROKEN(descr->LADSPA_Plugin->Properties));
+ #endif
+
+ // Listing synths only while excluding effect plugins:
+ // Do the exact opposite of what dssi-vst.cpp does for listing ladspa plugins.
+ // That way we cover all bases - effect plugins and synths.
+ // Non-synths will show up in the ladspa effect dialog, while synths will show up here...
+ // There should be nothing left out...
+ if(descr->run_synth ||
+ descr->run_synth_adding ||
+ descr->run_multiple_synths ||
+ descr->run_multiple_synths_adding)
+
+ {
+ const QString label(descr->LADSPA_Plugin->Label);
+
+ // Make sure it doesn't already exist.
+ std::vector<Synth*>::iterator is;
+ for(is = synthis.begin(); is != synthis.end(); ++is)
+ {
+ Synth* s = *is;
+ //#ifdef DSSI_DEBUG
+ // fprintf(stderr, "scanDSSILib: name:%s listname:%s lib:%s listlib:%s\n",
+ // label.latin1(), s->name().latin1(), fi.baseName(true).latin1(), s->baseName().latin1());
+ //#endif
+
+ if(s->name() == label && s->baseName() == fi.baseName(true))
+ break;
+ }
+ if(is != synthis.end())
+ continue;
+
+ DssiSynth* s = new DssiSynth(fi, descr);
+
+ if(debugMsg)
+ {
+ fprintf(stderr, "scanDSSILib: name:%s listname:%s lib:%s listlib:%s\n",
+ label.latin1(), s->name().latin1(), fi.baseName(true).latin1(), s->baseName().latin1());
+ int ai = 0, ao = 0, ci = 0, co = 0;
+ for(unsigned long pt = 0; pt < descr->LADSPA_Plugin->PortCount; ++pt)
+ {
+ LADSPA_PortDescriptor pd = descr->LADSPA_Plugin->PortDescriptors[pt];
+ if(LADSPA_IS_PORT_INPUT(pd) && LADSPA_IS_PORT_AUDIO(pd))
+ ai++;
+ else
+ if(LADSPA_IS_PORT_OUTPUT(pd) && LADSPA_IS_PORT_AUDIO(pd))
+ ao++;
+ else
+ if(LADSPA_IS_PORT_INPUT(pd) && LADSPA_IS_PORT_CONTROL(pd))
+ ci++;
+ else
+ if(LADSPA_IS_PORT_OUTPUT(pd) && LADSPA_IS_PORT_CONTROL(pd))
+ co++;
+ }
+ fprintf(stderr, "audio ins:%d outs:%d control ins:%d outs:%d\n", ai, ao, ci, co);
+ }
+
+ synthis.push_back(s);
+ }
+ else
+ {
+ // NOTE: Just a test
+ //QFileInfo ffi(fi);
+ //plugins.add(&ffi, LADSPA_Descriptor_Function(NULL), descr->LADSPA_Plugin, false);
+ //plugins.add(&ffi, descr, false);
+ }
+ }
+ }
+ dlclose(handle);
+ }
+
+//---------------------------------------------------------
+// scanVstDir
+//---------------------------------------------------------
+
+static void scanDSSIDir(QString& s) // ddskrjo removed const for argument
+{
+ if(debugMsg)
+ //printf("scan DSSI plugin dir <%s>\n", s.toAscii().data());
+ printf("scanDSSIDir: scan DSSI plugin dir <%s>\n", s.latin1());
+
+#ifdef __APPLE__
+ QDir pluginDir(s, QString("*.dylib"), QDir::Unsorted, QDir::Files);
+#else
+ QDir pluginDir(s, QString("*.so"), QDir::Unsorted, QDir::Files);
+#endif
+ if(!pluginDir.exists())
+ return;
+
+ //const QFileInfoList list = pluginDir.entryInfoList();
+ //for (int i = 0; i < list.size(); ++i) {
+ //QFileInfo fi = list.at(i);
+ //scanDSSILib(fi);
+ //}
+
+ QStringList list = pluginDir.entryList();
+ for(unsigned int i = 0; i < list.count(); ++i)
+ {
+ if(debugMsg)
+ printf("scanDSSIDir: found %s\n", (s + QString("/") + list[i]).latin1());
+
+ QFileInfo fi(s + QString("/") + list[i]);
+ scanDSSILib(fi);
+ }
+}
+
+//---------------------------------------------------------
+// initDSSI
+//---------------------------------------------------------
+
+void initDSSI()
+ {
+ const char* dssiPath = getenv("DSSI_PATH");
+ if (dssiPath == 0)
+ dssiPath = "/usr/local/lib64/dssi:/usr/lib64/dssi:/usr/local/lib/dssi:/usr/lib/dssi";
+
+ //const char* ladspaPath = getenv("LADSPA_PATH");
+ //if (ladspaPath == 0)
+ // ladspaPath = "/usr/local/lib64/ladspa:/usr/lib64/ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa";
+
+ const char* p = dssiPath;
+ //QString pth = QString(dssiPath) + QString(":") + QString(ladspaPath);
+ //const char* p = pth.latin1();
+ while (*p != '\0') {
+ const char* pe = p;
+ while (*pe != ':' && *pe != '\0')
+ pe++;
+
+ int n = pe - p;
+ if (n) {
+ char* buffer = new char[n + 1];
+ strncpy(buffer, p, n);
+ buffer[n] = '\0';
+ QString tmpStr(buffer);
+ scanDSSIDir(tmpStr);
+ delete[] buffer;
+ }
+ p = pe;
+ if (*p == ':')
+ p++;
+ }
+
+ // Create OSC thread
+ //serverThread = lo_server_thread_new(0, oscError);
+ //snprintf(osc_path_tmp, 31, "/dssi");
+ //char* tmp = lo_server_thread_get_url(serverThread);
+ //url = (char *)malloc(strlen(tmp) + strlen(osc_path_tmp));
+ //sprintf(url, "%s%s", tmp, osc_path_tmp + 1);
+ //free(tmp);
+ //lo_server_thread_add_method(serverThread, 0, 0, oscMessageHandler, 0);
+ //lo_server_thread_start(serverThread);
+ }
+
+//---------------------------------------------------------
+// DssiSynth
+// Synth.label = plug.Label
+// Synth.descr = plug.Name
+// Synth.maker = plug.maker
+// Synth.version = nil (no such field in ladspa, maybe try copyright instead)
+//---------------------------------------------------------
+
+DssiSynth::DssiSynth(QFileInfo& fi, const DSSI_Descriptor* d) : // ddskrjo removed const from QFileInfo
+ //Synth(fi, label, descr, maker, ver)
+ Synth(fi, QString(d->LADSPA_Plugin->Label), QString(d->LADSPA_Plugin->Name), QString(d->LADSPA_Plugin->Maker), QString())
+{
+ df = 0;
+ handle = 0;
+ dssi = 0;
+ _hasGui = false;
+
+ const LADSPA_Descriptor* descr = d->LADSPA_Plugin;
+
+ _portCount = descr->PortCount;
+ //_portDescriptors = 0;
+ //if(_portCount)
+ // _portDescriptors = new LADSPA_PortDescriptor[_portCount];
+
+ _inports = 0;
+ _outports = 0;
+ _controlInPorts = 0;
+ _controlOutPorts = 0;
+ for(unsigned long k = 0; k < _portCount; ++k)
+ {
+ LADSPA_PortDescriptor pd = descr->PortDescriptors[k];
+ //_portDescriptors[k] = pd;
+ if(pd & LADSPA_PORT_AUDIO)
+ {
+ if(pd & LADSPA_PORT_INPUT)
+ ++_inports;
+ else
+ if(pd & LADSPA_PORT_OUTPUT)
+ ++_outports;
+ }
+ else
+ if(pd & LADSPA_PORT_CONTROL)
+ {
+ if(pd & LADSPA_PORT_INPUT)
+ ++_controlInPorts;
+ else
+ if(pd & LADSPA_PORT_OUTPUT)
+ ++_controlOutPorts;
+ }
+ }
+
+ _inPlaceCapable = !LADSPA_IS_INPLACE_BROKEN(descr->Properties);
+
+ // Blacklist vst plugins in-place configurable for now.
+ if ((_inports != _outports) || (fi.baseName(true) == QString("dssi-vst") && !config.vstInPlace))
+ _inPlaceCapable = false;
+}
+
+DssiSynth::~DssiSynth()
+{
+
+}
+
+//---------------------------------------------------------
+// createSIF
+//---------------------------------------------------------
+
+SynthIF* DssiSynth::createSIF(SynthI* synti)
+{
+ if (_instances == 0)
+ {
+ //handle = dlopen(info.filePath().toAscii().data(), RTLD_NOW);
+ handle = dlopen(info.filePath().latin1(), RTLD_NOW);
+ //handle = dlopen(info.absFilePath().latin1(), RTLD_NOW);
+
+ if (handle == 0)
+ {
+ fprintf(stderr, "DssiSynth::createSIF dlopen(%s) failed: %s\n",
+ //info.filePath().toAscii().data(), dlerror());
+ info.filePath().latin1(), dlerror());
+ //info.absFilePath().latin1(), dlerror());
+
+ return 0;
+ }
+ df = (DSSI_Descriptor_Function)dlsym(handle, "dssi_descriptor");
+
+ if (!df) {
+ const char *txt = dlerror();
+ fprintf(stderr,
+ "Unable to find dssi_descriptor() function in plugin "
+ "library file \"%s\": %s.\n"
+ "Are you sure this is a DSSI plugin file?\n",
+ //info.filePath().toAscii().data(),
+ info.filePath().latin1(),
+ //info.absFilePath().latin1(),
+
+ txt ? txt : "?");
+ dlclose(handle);
+ handle = 0;
+ return 0;
+ }
+ for (int i = 0;; ++i) {
+ dssi = df(i);
+ if (dssi == 0)
+ break;
+ QString label(dssi->LADSPA_Plugin->Label);
+ if (label == _name)
+ break;
+ }
+
+ if(dssi != 0)
+ {
+ _inports = 0;
+ _outports = 0;
+ _controlInPorts = 0;
+ _controlOutPorts = 0;
+
+ pIdx.clear();
+ opIdx.clear();
+ iIdx.clear();
+ oIdx.clear();
+ rpIdx.clear();
+ iUsedIdx.clear();
+ midiCtl2PortMap.clear();
+ port2MidiCtlMap.clear();
+ //synti->_guiUpdateControls.clear();
+
+ const LADSPA_Descriptor* descr = dssi->LADSPA_Plugin;
+ //#ifdef DSSI_DEBUG
+ // printf("DssiSynth::createSIF ladspa plugin PortCount:%lu\n", d->PortCount);
+ //#endif
+
+ _portCount = descr->PortCount;
+
+ for (unsigned long k = 0; k < _portCount; ++k)
+ {
+ LADSPA_PortDescriptor pd = descr->PortDescriptors[k];
+
+ #ifdef DSSI_DEBUG
+ printf("DssiSynth::createSIF ladspa plugin Port:%ld Name:%s descriptor:%x\n", k, descr->PortNames[k], pd);
+ #endif
+
+ if (LADSPA_IS_PORT_AUDIO(pd))
+ {
+ if (LADSPA_IS_PORT_INPUT(pd))
+ {
+ ++_inports;
+ iIdx.push_back(k);
+ iUsedIdx.push_back(false); // Start out with all false.
+ }
+ else if (LADSPA_IS_PORT_OUTPUT(pd))
+ {
+ ++_outports;
+ oIdx.push_back(k);
+ }
+
+ rpIdx.push_back((unsigned long)-1);
+ }
+ else if (LADSPA_IS_PORT_CONTROL(pd))
+ {
+ if (LADSPA_IS_PORT_INPUT(pd))
+ {
+ rpIdx.push_back(_controlInPorts);
+ ++_controlInPorts;
+ pIdx.push_back(k);
+ // Set to false at first.
+ //synti->_guiUpdateControls.push_back(false);
+ }
+ else if (LADSPA_IS_PORT_OUTPUT(pd))
+ {
+ rpIdx.push_back((unsigned long)-1);
+ ++_controlOutPorts;
+ opIdx.push_back(k);
+ }
+ }
+ }
+
+ _inPlaceCapable = !LADSPA_IS_INPLACE_BROKEN(descr->Properties);
+ // Blacklist vst plugins in-place configurable for now.
+ if((_inports != _outports) || (info.baseName(true) == QString("dssi-vst") && !config.vstInPlace))
+ _inPlaceCapable = false;
+ }
+ }
+
+ if (dssi == 0)
+ {
+ //fprintf(stderr, "cannot found DSSI synti %s\n", _name.toAscii().data());
+ fprintf(stderr, "cannot find DSSI synti %s\n", _name.latin1());
+ dlclose(handle);
+ handle = 0;
+ df = 0;
+ return 0;
+ }
+
+ DssiSynthIF* sif = new DssiSynthIF(synti);
+ ++_instances;
+ sif->init(this);
+
+ //_plugin->incInstances(1);
+
+
+
+// static char oscUrl[1024];
+ //snprintf(oscUrl, 1024, "%s/%s", url, synti->name().toAscii().data());
+ //snprintf(oscUrl, 1024, "%s/%s", url, synti->name().latin1());
+// snprintf(oscUrl, 1024, "%s/%s/%s", url, info.baseName().latin1(), synti->name().latin1());
+ //QString guiPath(info.path() + "/" + info.baseName());
+ QString guiPath(info.dirPath() + "/" + info.baseName());
+ QDir guiDir(guiPath, "*", QDir::Unsorted, QDir::Files);
+ _hasGui = guiDir.exists();
+
+ //sif->initGui();
+
+ return sif;
+}
+
+//---------------------------------------------------------
+// guiVisible
+//---------------------------------------------------------
+
+bool DssiSynthIF::guiVisible() const
+ {
+ //return _guiVisible;
+ #ifdef OSC_SUPPORT
+ return _oscif.oscGuiVisible();
+ #endif
+ return false;
+ }
+
+//---------------------------------------------------------
+// showGui
+//---------------------------------------------------------
+
+void DssiSynthIF::showGui(bool v)
+ {
+ #ifdef OSC_SUPPORT
+
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::showGui(): v:%d visible:%d\n", v, guiVisible());
+ #endif
+
+ _oscif.oscShowGui(v);
+
+ #endif // OSC_SUPPORT
+
+ /*
+ if (v == guiVisible())
+ return;
+
+ //if(guiPid == -1)
+ if((guiQProc == 0) || (!guiQProc->isRunning()))
+ {
+ // We need an indicator that update was called - update must have been called to get new path etc...
+ // If the process is not running this path is invalid, right?
+ if(uiOscPath)
+ free(uiOscPath);
+ uiOscPath = 0;
+
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::showGui(): No QProcess or process not running. Starting gui...\n");
+ #endif
+
+ initGui();
+ }
+
+ //for (int i = 0; i < 5; ++i) {
+ for (int i = 0; i < 10; ++i) { // Give it a wee bit more time?
+ if (uiOscPath)
+ break;
+ sleep(1);
+ }
+ if (uiOscPath == 0) {
+ printf("DssiSynthIF::showGui(): no uiOscPath. Error: Timeout - synth gui did not start within 10 seconds.\n");
+ return;
+ }
+
+ char uiOscGuiPath[strlen(uiOscPath)+6];
+ sprintf(uiOscGuiPath, "%s/%s", uiOscPath, v ? "show" : "hide");
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::showGui(): Sending show/hide uiOscGuiPath:%s\n", uiOscGuiPath);
+ #endif
+
+ lo_send(uiTarget, uiOscGuiPath, "");
+ _guiVisible = v;
+ */
+ }
+
+//---------------------------------------------------------
+// receiveEvent
+//---------------------------------------------------------
+
+//MidiEvent DssiSynthIF::receiveEvent()
+// {
+// return MidiEvent();
+// }
+MidiPlayEvent DssiSynthIF::receiveEvent()
+ {
+ return MidiPlayEvent();
+ }
+
+//---------------------------------------------------------
+// init
+//---------------------------------------------------------
+
+bool DssiSynthIF::init(DssiSynth* s)
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::init\n");
+ #endif
+
+ synth = s;
+ const DSSI_Descriptor* dssi = synth->dssi;
+ const LADSPA_Descriptor* ld = dssi->LADSPA_Plugin;
+ handle = ld->instantiate(ld, sampleRate);
+
+ #ifdef OSC_SUPPORT
+ _oscif.oscSetSynthIF(this);
+ #endif
+
+ queryPrograms();
+
+ int inports = synth->_inports;
+ if(inports != 0)
+ {
+ audioInBuffers = new float*[inports];
+ for(int k = 0; k < inports; ++k)
+ {
+ //audioInBuffers[k] = new LADSPA_Data[segmentSize];
+ //posix_memalign((void**)(audioInBuffers + k), 16, sizeof(float) * segmentSize);
+ posix_memalign((void**)&audioInBuffers[k], 16, sizeof(float) * segmentSize);
+ memset(audioInBuffers[k], 0, sizeof(float) * segmentSize);
+ ld->connect_port(handle, synth->iIdx[k], audioInBuffers[k]);
+ }
+ }
+
+ int outports = synth->_outports;
+ if(outports != 0)
+ {
+ audioOutBuffers = new float*[outports];
+ for(int k = 0; k < outports; ++k)
+ {
+ //audioOutBuffers[k] = new LADSPA_Data[segmentSize];
+ //posix_memalign((void**)(audioOutBuffers + k), 16, sizeof(float) * segmentSize);
+ posix_memalign((void**)&audioOutBuffers[k], 16, sizeof(float) * segmentSize);
+ memset(audioOutBuffers[k], 0, sizeof(float) * segmentSize);
+ ld->connect_port(handle, synth->oIdx[k], audioOutBuffers[k]);
+ //printf("DssiSynthIF::init output port name: %s\n", ld->PortNames[synth->oIdx[k]]); // out1, out2, out3 etc
+ }
+ }
+
+ int controlPorts = synth->_controlInPorts;
+ int controlOutPorts = synth->_controlOutPorts;
+
+ if(controlPorts != 0)
+ controls = new Port[controlPorts];
+ else
+ controls = 0;
+
+ if(controlOutPorts != 0)
+ controlsOut = new Port[controlOutPorts];
+ else
+ controlsOut = 0;
+
+ synth->midiCtl2PortMap.clear();
+ synth->port2MidiCtlMap.clear();
+ synti->_guiUpdateControls.clear();
+ synti->_guiUpdateProgram = false;
+
+ for (int k = 0; k < controlPorts; ++k) {
+ int i = synth->pIdx[k];
+ //controls[k].val = ladspaDefaultValue(ld, i);
+ ladspaDefaultValue(ld, i, &controls[k].val);
+
+ // Set to false at first.
+ synti->_guiUpdateControls.push_back(false);
+
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::init control port:%d port idx:%d name:%s\n", k, i, ld->PortNames[i]);
+ #endif
+
+ // This code is duplicated in ::getControllerInfo()
+ //
+
+ int ctlnum = DSSI_NONE;
+ if(dssi->get_midi_controller_for_port)
+ ctlnum = dssi->get_midi_controller_for_port(handle, i);
+
+ // No controller number? Try to give it a unique one...
+ if(ctlnum == DSSI_NONE)
+ {
+ // FIXME: Be more careful. Must make sure to pick numbers not already chosen or which WILL BE chosen.
+ // Simple but flawed solution: Start them at 0x60000 + 0x2000 = 0x62000. Max NRPN number is 0x3fff.
+ // TODO: Update: Actually we want to try to use CC Controller7 controllers if possible (or a choice) because what if
+ // the user's controller hardware doesn't support RPN?
+ // If CC Controller7 is chosen we must make sure to use only non-common numbers. An already limited range
+ // of 127 now becomes narrower. See the cool document midi-controllers.txt in the DSSI source for a
+ // nice roundup of numbers and how to choose them and how they relate to synths and DSSI synths etc. !
+ ctlnum = CTRL_NRPN14_OFFSET + 0x2000 + k;
+ }
+ else
+ {
+ int c = ctlnum;
+ // Can be both CC and NRPN! Prefer CC over NRPN.
+ if(DSSI_IS_CC(ctlnum))
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::init is CC control\n");
+ #endif
+
+ ctlnum = DSSI_CC_NUMBER(c);
+ #ifdef DSSI_DEBUG
+ if(DSSI_IS_NRPN(ctlnum))
+ printf("DssiSynthIF::init is also NRPN control. Using CC.\n");
+ #endif
+ }
+ else
+ if(DSSI_IS_NRPN(ctlnum))
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::init is NRPN control\n");
+ #endif
+
+ ctlnum = DSSI_NRPN_NUMBER(c) + CTRL_NRPN14_OFFSET;
+ }
+
+ }
+
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::init inserting to midiCtl2PortMap: ctlnum:%d k:%d\n", ctlnum, k);
+ #endif
+
+ // We have a controller number! Insert it and the DSSI port number into both maps.
+ synth->midiCtl2PortMap.insert(std::pair<int, int>(ctlnum, k));
+ synth->port2MidiCtlMap.insert(std::pair<int, int>(k, ctlnum));
+ ld->connect_port(handle, i, &controls[k].val);
+ }
+
+ for (int k = 0; k < controlOutPorts; ++k) {
+ int i = synth->opIdx[k];
+
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::init control output port:%d port idx:%d name:%s\n", k, i, ld->PortNames[i]);
+ #endif
+
+ // p3.3.39 Removed.
+ /*
+
+ //controls[k].val = ladspaDefaultValue(ld, i);
+ ladspaDefaultValue(ld, i, &controlsOut[k].val);
+
+ // This code is duplicated in ::getControllerInfo()
+ //
+
+ int ctlnum = DSSI_NONE;
+ if(dssi->get_midi_controller_for_port)
+ ctlnum = dssi->get_midi_controller_for_port(handle, i);
+
+ // No controller number? Try to give it a unique one...
+ if(ctlnum == DSSI_NONE)
+ {
+ // FIXME: Be more careful. Must make sure to pick numbers not already chosen or which WILL BE chosen.
+ // Simple but flawed solution: Start them at 0x60000 + 0x3000 = 0x63000. Max NRPN number is 0x3fff.
+ // TODO: CC etc. etc.
+ ctlnum = CTRL_NRPN14_OFFSET + 0x3000 + k;
+ }
+ else
+ {
+ int c = ctlnum;
+ // Can be both CC and NRPN! Prefer CC over NRPN.
+ if(DSSI_IS_CC(ctlnum))
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::init is CC control\n");
+ #endif
+
+ ctlnum = DSSI_CC_NUMBER(c);
+
+ #ifdef DSSI_DEBUG
+ if(DSSI_IS_NRPN(ctlnum))
+ printf("DssiSynthIF::init is also NRPN control. Using CC.\n");
+ #endif
+ }
+ else
+ if(DSSI_IS_NRPN(ctlnum))
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::init is NRPN control\n");
+ #endif
+
+ ctlnum = DSSI_NRPN_NUMBER(c) + CTRL_NRPN14_OFFSET;
+ }
+
+ }
+
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::init inserting to midiCtl2PortMap: ctlnum:%d k:%d\n", ctlnum, k);
+ #endif
+
+ // We have a controller number! Insert it and the DSSI port number into the map.
+ // p3.3.39 Removed. Doesn't say whether it's in or out! Don't need this for now.
+ //synth->midiCtl2PortMap.insert(std::pair<int, int>(ctlnum, k));
+
+ */
+
+ // - Control outs are not handled but still must be connected to something.
+ ld->connect_port(handle, i, &controlsOut[k].val);
+ }
+
+ // Set the latency to zero.
+ //controls[controlPorts].val = 0.0;
+ // Insert a controller for latency and the DSSI port number into the map.
+ //synth->midiCtl2PortMap.insert(std::pair<int, int>(CTRL_NRPN14_OFFSET + 0x2000, controlPorts));
+ // Connect the port.
+ //ld->connect_port(handle, controlPorts, &controls[controlPorts].val);
+
+ // Just a test. It works! We can instantiate a ladspa plugin for the synth. But it needs more work...
+ //plugins.add(&synth->info, LADSPA_Descriptor_Function(NULL), ld, false);
+
+ if (ld->activate)
+ ld->activate(handle);
+
+ // Set current configuration values.
+ if(dssi->configure)
+ {
+ char *rv = dssi->configure(handle, DSSI_PROJECT_DIRECTORY_KEY,
+ museProject.latin1()); //song->projectPath()
+
+ if(rv)
+ {
+ fprintf(stderr, "MusE: Warning: plugin doesn't like project directory: \"%s\"\n", rv);
+ free(rv);
+ }
+
+ for(ciStringParamMap r = synti->_stringParamMap.begin(); r != synti->_stringParamMap.end(); ++r)
+ {
+ rv = 0;
+ rv = dssi->configure(handle, r->first.c_str(), r->second.c_str());
+ if(rv)
+ {
+ fprintf(stderr, "MusE: Warning: plugin config key: %s value: %s \"%s\"\n", r->first.c_str(), r->second.c_str(), rv);
+ free(rv);
+ }
+ }
+ }
+
+ // Set current program.
+ if(dssi->select_program)
+ dssi->select_program(handle, synti->_curBankL, synti->_curProgram);
+
+ //
+ // For stored initial control values, let SynthI::initInstance() take care of that via ::setParameter().
+ //
+
+ return true;
+ }
+
+//---------------------------------------------------------
+// DssiSynthIF
+//---------------------------------------------------------
+
+DssiSynthIF::DssiSynthIF(SynthI* s)
+ : SynthIF(s)
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::DssiSynthIF\n");
+ #endif
+
+ synth = 0;
+ handle = NULL;
+ controls = 0;
+ controlsOut = 0;
+
+ //_curBank = 0;
+ //_curProgram = 0;
+
+ //#ifdef OSC_SUPPORT
+ //_oscif.setSynthIF(this);
+ //#endif
+
+ //_guiVisible = false;
+ //uiTarget = 0;
+ //uiOscShowPath = 0;
+ //uiOscControlPath = 0;
+ //uiOscConfigurePath = 0;
+ //uiOscProgramPath = 0;
+ //uiOscPath = 0;
+ //guiPid = -1;
+ //guiQProc = 0;
+
+ audioInBuffers = 0;
+ audioOutBuffers = 0;
+ }
+
+//---------------------------------------------------------
+// ~DssiSynthIF
+//---------------------------------------------------------
+
+DssiSynthIF::~DssiSynthIF()
+{
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::~DssiSynthIF\n");
+ #endif
+
+ if(synth)
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::~DssiSynthIF synth:%p\n", synth);
+ #endif
+
+ if(synth->dssi)
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::~DssiSynthIF synth->dssi:%p\n", synth->dssi);
+ #endif
+
+ if(synth->dssi->LADSPA_Plugin)
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::~DssiSynthIFsynth->dssi->LADSPA_Plugin:%p\n", synth->dssi->LADSPA_Plugin);
+ #endif
+ }
+ }
+ }
+
+ if(synth && synth->dssi && synth->dssi->LADSPA_Plugin)
+ {
+ const DSSI_Descriptor* dssi = synth->dssi;
+ const LADSPA_Descriptor* descr = dssi->LADSPA_Plugin;
+
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::~DssiSynthIF checking cleanup function exists\n");
+ #endif
+
+ if(descr->cleanup)
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::~DssiSynthIF calling cleanup function\n");
+ #endif
+
+ descr->cleanup(handle);
+ }
+ }
+
+ /*
+ //if (guiPid != -1)
+ // kill(guiPid, SIGHUP);
+ if(guiQProc)
+ {
+ if(guiQProc->isRunning())
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::~DssiSynthIF killing guiQProc\n");
+ #endif
+
+ guiQProc->kill();
+ }
+
+ //delete guiQProc;
+ }
+
+ if(uiOscShowPath)
+ free(uiOscShowPath);
+ if(uiOscControlPath)
+ free(uiOscControlPath);
+ if(uiOscConfigurePath)
+ free(uiOscConfigurePath);
+ if(uiOscProgramPath)
+ free(uiOscProgramPath);
+ if(uiOscPath)
+ free(uiOscPath);
+ if(uiTarget)
+ lo_address_free(uiTarget);
+ */
+
+ if(audioInBuffers)
+ {
+ //for(int i = 0; i < synth->_inports; ++i)
+ //{
+ // if(audioInBuffers[i])
+ // delete[] audioInBuffers[i];
+ //}
+ for(unsigned long i = 0; i < synth->_inports; ++i)
+ {
+ if(audioInBuffers[i])
+ free(audioInBuffers[i]);
+ }
+ delete[] audioInBuffers;
+ }
+
+ if(audioOutBuffers)
+ {
+ //for(int i = 0; i < synth->_outports; ++i)
+ //{
+ // if(audioOutBuffers[i])
+ // delete[] audioOutBuffers[i];
+ //}
+ for(unsigned long i = 0; i < synth->_outports; ++i)
+ {
+ if(audioOutBuffers[i])
+ free(audioOutBuffers[i]);
+ }
+ delete[] audioOutBuffers;
+ }
+
+ if(controls)
+ delete[] controls;
+
+ if(controlsOut)
+ delete[] controlsOut;
+}
+
+//---------------------------------------------------------
+// getParameter
+//---------------------------------------------------------
+
+float DssiSynthIF::getParameter(unsigned long n) const
+{
+ if(n >= synth->_controlInPorts)
+ {
+ printf("DssiSynthIF::getParameter param number %ld out of range of ports:%ld\n", n, synth->_controlInPorts);
+ return 0.0;
+ }
+
+ if(!controls)
+ return 0.0;
+
+ return controls[n].val;
+}
+
+//---------------------------------------------------------
+// setParameter
+//---------------------------------------------------------
+
+void DssiSynthIF::setParameter(unsigned long n, float v)
+{
+ if(n >= synth->_controlInPorts)
+ {
+ printf("DssiSynthIF::setParameter param number %ld out of range of ports:%ld\n", n, synth->_controlInPorts);
+ return;
+ }
+
+ if(!controls)
+ return;
+
+ controls[n].val = v;
+
+ // Notify that changes are to be sent upon heartbeat.
+ // TODO: No, at least not for now. So far, setParameter is only called during loading of stored params,
+ // and we don't want this interfering with oscUpdate which also sends the values.
+ //synti->_guiUpdateControls[n] = true;
+}
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+//void DssiSynthIF::write(Xml&) const
+void DssiSynthIF::write(int level, Xml& xml) const
+{
+ //bool vstsaved = false;
+
+#ifdef DSSI_VST_CHUNK_SUPPORT
+ //---------------------------------------------
+ // dump current state of synth
+ //---------------------------------------------
+ printf("dumping DSSI custom data! %d\n", synth->dssi->getCustomData);
+
+ // this is only needed and supported if
+ // we are talking to a VST plugin at the other end.
+ std::string name = synth->dssi->LADSPA_Plugin->Name;
+ if ((name.length()> 4) && name.substr(name.length() - 4) == " VST")
+ {
+ printf("is vst plugin, commencing data dump, apiversion=%d!\n", synth->dssi->DSSI_API_Version);
+ unsigned long len = 0;
+ void* p = 0;
+ synth->dssi->getCustomData(handle,&p, &len);
+ if (len) {
+ xml.tag(level++, "midistate");
+ xml.nput(level++, "<event type=\"%d\"", Sysex);
+ xml.nput(" datalen=\"%d\">\n", len+7 /*VSTSAVE*/);
+ xml.nput(level, "");
+ xml.nput("56 53 54 53 41 56 45 "); // embed a save marker "string 'VSTSAVE'
+ for (long unsigned int i = 0; i < len; ++i) {
+ if (i && (((i+7) % 16) == 0)) {
+ xml.nput("\n");
+ xml.nput(level, "");
+ }
+ xml.nput("%02x ", ((char*)(p))[i] & 0xff);
+ }
+ xml.nput("\n");
+ xml.tag(level--, "/event");
+ xml.etag(level--, "midistate");
+ //vstsaved = true;
+ }
+ }
+#else
+ printf("support for vst chunks not compiled in!\n");
+#endif
+
+ /*
+ // p3.3.39 Store the state of current program and bank and all input control values, but only if VSTSAVE above didn't do it already!
+ // TODO: Not quite good enough, we would want to store all controls for EACH program, not just the current one.
+ // Need to modify controls array to be inside a program array and act as a cache when the user changes a control on a particular program.
+ if(!vstsaved)
+ {
+ if(synth->_controlInPorts)
+ {
+ // TODO: Hmm, what if these sizes change (platform etc.)? Hard code? Not good - need to store complete value.
+ const int fs = sizeof(float);
+ const int uls = sizeof(unsigned long);
+
+ // Data length: Version major and minor bytes, bank + program, and controllers.
+ const unsigned long len = 2 + 2 * uls + synth->_controlInPorts * fs;
+
+ unsigned long prog = _curBank;
+ unsigned long bnk = _curProgram;
+
+ xml.tag(level++, "midistate");
+ xml.nput(level++, "<event type=\"%d\"", Sysex);
+ xml.nput(" datalen=\"%d\">\n", len+9); // "PARAMSAVE" length + data length.
+ xml.nput(level, "");
+ xml.nput("50 41 52 41 4d 53 41 56 45 "); // Embed a save marker string "PARAMSAVE".
+
+ unsigned long i = 9;
+
+ // Store PARAMSAVE version major...
+ char uc = DSSI_PARAMSAVE_VERSION_MAJOR;
+ if(i && ((i % 16) == 0))
+ {
+ xml.nput("\n");
+ xml.nput(level, "");
+ }
+ xml.nput("%02x ", uc & 0xff);
+ ++i;
+
+ // Store PARAMSAVE version minor...
+ uc = DSSI_PARAMSAVE_VERSION_MINOR;
+ if(i && ((i % 16) == 0))
+ {
+ xml.nput("\n");
+ xml.nput(level, "");
+ }
+ xml.nput("%02x ", uc & 0xff);
+ ++i;
+
+ // Store bank...
+ void* p = &bnk;
+ for(int j = 0; j < uls; ++j)
+ {
+ if(i && ((i % 16) == 0))
+ {
+ xml.nput("\n");
+ xml.nput(level, "");
+ }
+ xml.nput("%02x ", ((char*)(p))[j] & 0xff);
+ ++i;
+ }
+
+ // Store program...
+ p = &prog;
+ for(int j = 0; j < uls; ++j)
+ {
+ if(i && ((i % 16) == 0))
+ {
+ xml.nput("\n");
+ xml.nput(level, "");
+ }
+ xml.nput("%02x ", ((char*)(p))[j] & 0xff);
+ ++i;
+ }
+
+ // Store controls...
+ for(unsigned long c = 0; c < synth->_controlInPorts; ++c)
+ {
+ float v = controls[c].val;
+ p = &v;
+ for(int j = 0; j < fs; ++j)
+ {
+ if(i && ((i % 16) == 0))
+ {
+ xml.nput("\n");
+ xml.nput(level, "");
+ }
+ xml.nput("%02x ", ((char*)(p))[j] & 0xff);
+ ++i;
+ }
+ }
+ xml.nput("\n");
+ xml.tag(level--, "/event");
+ xml.etag(level--, "midistate");
+ }
+ }
+ */
+
+ // Store controls as parameters...
+ for(unsigned long c = 0; c < synth->_controlInPorts; ++c)
+ {
+ float f = controls[c].val;
+ xml.floatTag(level, "param", f);
+ //xml.tag(level, "param name=\"%s\" val=\"%s\"/", name, r->first.c_str(), r->second.c_str());
+ }
+}
+
+//---------------------------------------------------------
+// preProcessAlways
+//---------------------------------------------------------
+
+void DssiSynthIF::preProcessAlways()
+{
+
+}
+
+//---------------------------------------------------------
+// processEvent
+// Return true if event pointer filled.
+//--------------------------------------------------------
+
+bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event)
+{
+ const DSSI_Descriptor* dssi = synth->dssi;
+
+ int chn = e.channel();
+ int a = e.dataA();
+ int b = e.dataB();
+ //for sysex
+ //QByteArray ba = QByteArray((const char*)e.data(), e.len());
+ //we must had 0xF0 at the beginning and 0xF7 at the end of e.data()
+ //ba.push_front(0xF0);
+ //ba.push_back(0xF7);
+
+ //QByteArray ba();
+ ////ba.assign((const char*)e.data(), e.len());
+ ////ba.duplicate((const char*)e.data(), e.len());
+ ////ba.setRawData((const char*)e.data(), e.len());
+ //int len = e.len() + 2;
+
+ int len = e.len();
+ char ca[len + 2];
+
+ ca[0] = 0xF0;
+ memcpy(ca + 1, (const char*)e.data(), len);
+ ca[len + 1] = 0xF7;
+
+ len += 2;
+
+ //snd_seq_event_t* event = &events[nevents];
+ event->queue = SND_SEQ_QUEUE_DIRECT;
+
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::processEvent midi event type:%d chn:%d a:%d b:%d\n", e.type(), chn, a, b);
+ #endif
+
+ switch(e.type())
+ {
+ case ME_NOTEON:
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::processEvent midi event is ME_NOTEON\n");
+ #endif
+
+ if(b)
+ snd_seq_ev_set_noteon(event, chn, a, b);
+ else
+ snd_seq_ev_set_noteoff(event, chn, a, 0);
+ break;
+ case ME_NOTEOFF:
+ snd_seq_ev_set_noteoff(event, chn, a, 0);
+ break;
+ case ME_PROGRAM:
+ {
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::processEvent midi event is ME_PROGRAM\n");
+ #endif
+
+ int bank = (a >> 8) & 0xff;
+ int prog = a & 0xff;
+ //_curBank = bank;
+ //_curProgram = prog;
+ synti->_curBankH = 0;
+ synti->_curBankL = bank;
+ synti->_curProgram = prog;
+
+ if(dssi->select_program)
+ {
+ dssi->select_program(handle, bank, prog);
+ // Notify that changes are to be sent upon heartbeat.
+ synti->_guiUpdateProgram = true;
+ }
+ // Event pointer not filled. Return false.
+ return false;
+ }
+ break;
+ case ME_CONTROLLER:
+ {
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::processEvent midi event is ME_CONTROLLER\n");
+ #endif
+
+ if((a == 0) || (a == 32))
+ return false;
+
+ if(a == CTRL_PROGRAM)
+ {
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::processEvent midi event is ME_CONTROLLER, dataA is CTRL_PROGRAM\n");
+ #endif
+
+ int bank = (b >> 8) & 0xff;
+ int prog = b & 0xff;
+
+ //_curBank = bank;
+ //_curProgram = prog;
+ synti->_curBankH = 0;
+ synti->_curBankL = bank;
+ synti->_curProgram = prog;
+
+ if(dssi->select_program)
+ {
+ dssi->select_program(handle, bank, prog);
+ // Notify that changes are to be sent upon heartbeat.
+ synti->_guiUpdateProgram = true;
+ }
+ // Event pointer not filled. Return false.
+ return false;
+ }
+
+ if(a == CTRL_PITCH)
+ {
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::processEvent midi event is ME_CONTROLLER, dataA is CTRL_PITCH\n");
+ #endif
+
+ b &= 0x3fff;
+ snd_seq_ev_set_pitchbend(event, chn, b);
+ // Event pointer filled. Return true.
+ return true;
+ }
+
+ const LADSPA_Descriptor* ld = dssi->LADSPA_Plugin;
+
+ ciMidiCtl2LadspaPort ip = synth->midiCtl2PortMap.find(a);
+ // Is it just a regular midi controller, not mapped to a LADSPA port (either by the plugin or by us)?
+ // NOTE: There's no way to tell which of these controllers is supported by the plugin.
+ // For example sustain footpedal or pitch bend may be supported, but not mapped to any LADSPA port.
+ if(ip == synth->midiCtl2PortMap.end())
+ {
+ // p3.3.39 Changed to return false because of crashes with unknown controllers when switching a midi track
+ // among different dssi synths and regular synths etc. For example high RPN offset numbers (set by another
+ // device selected into the midi port before selecting this synth) were passing through here when in fact
+ // the particular synth had no such midi controllers.
+ // ========================== No, that leaves out regular controllers like footpedal
+ //#ifdef DSSI_DEBUG
+ //fprintf(stderr, "DssiSynthIF::processEvent dataA:%d not found in map (not a ladspa controller). Ignoring.\n", a);
+ //#endif
+ //return false;
+
+ //#ifdef DSSI_DEBUG
+ //fprintf(stderr, "DssiSynthIF::processEvent dataA:%d not found in map (not a ladspa controller). Filling event as regular controller.\n", a);
+ //#endif
+ //snd_seq_ev_set_controller(event, chn, a, b);
+ //return true;
+
+ int ctlnum = a;
+ //switch(midiControllerType(a))
+ if(midiControllerType(a) != MidiController::Controller7)
+ return false;
+ else
+ {
+ /*
+ case MidiController::NRPN14:
+ case MidiController::Controller14:
+ case MidiController::Pitch:
+ case MidiController::Program:
+ case MidiController::RPN:
+ case MidiController::RPN14:
+ case MidiController::NRPN:
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::processEvent non-ladspa midi event controller unsupported. DataA:%d\n", a);
+ #endif
+ return false;
+ */
+
+ //case MidiController::Controller7:
+ #ifdef DSSI_DEBUG
+ //fprintf(stderr, "DssiSynthIF::processEvent midi event is Controller7. Changing to DSSI_CC type. Current dataA:%d\n", a);
+ fprintf(stderr, "DssiSynthIF::processEvent non-ladspa midi event is Controller7. Current dataA:%d\n", a);
+ #endif
+ //a = DSSI_CC(a);
+ a &= 0x7f;
+ ctlnum = DSSI_CC_NUMBER(ctlnum);
+ // break;
+
+ /*
+ case MidiController::NRPN14:
+ #ifdef DSSI_DEBUG
+ // fprintf(stderr, "DssiSynthIF::processEvent midi event is NRPN. Changing to DSSI_NRPN type. Current dataA:%d\n", a);
+ fprintf(stderr, "DssiSynthIF::processEvent non-ladspa midi event is NRPN. Current dataA:%d\n", a);
+ #endif
+ //a = DSSI_NRPN(a - CTRL_NRPN14_OFFSET);
+ a &= 0x3fff;
+ ctlnum = DSSI_NRPN_NUMBER(ctlnum);
+ break;
+ case MidiController::Controller14:
+ a &= 0x7f;
+ break;
+ case MidiController::Pitch:
+ // Should be caught above!
+ #ifdef DSSI_DEBUG
+ //fprintf(stderr, "DssiSynthIF::processEvent non-ladspa midi event is Pitch. DataA:%d\n", a);
+ fprintf(stderr, "DssiSynthIF::processEvent Error! non-ladspa midi event is Pitch. Should have been caught already! DataA:%d\n", a);
+ #endif
+ //a &= 0x3fff;
+ //snd_seq_ev_set_pitchbend(event, chn, b);
+ // Event pointer filled. Return true.
+ //return true;
+ // Event pointer not filled. Return false.
+ return false;
+ case MidiController::Program:
+ // Should be caught above!
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::processEvent Error! non-ladspa midi event is Program. Should have been caught already! DataA:%d\n", a);
+ #endif
+ return false;
+ case MidiController::RPN:
+ case MidiController::RPN14:
+ case MidiController::NRPN:
+ default:
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::processEvent non-ladspa midi event is RPN, RPN14, or NRPN type. DataA:%d\n", a);
+ #endif
+ break;
+ */
+ }
+
+ // Verify it's the same number.
+ //if(ctlnum != a)
+ //{
+ // #ifdef DSSI_DEBUG
+ // printf("DssiSynthIF::processEvent Error! non-ladspa midi ctlnum:%d != event dataA:%d\n", ctlnum, a);
+ // #endif
+ // Event not filled. Return false.
+
+ // TEMP: TODO: Turn on later
+ //return false;
+ //}
+
+ // Fill the event.
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::processEvent non-ladspa filling midi event chn:%d dataA:%d dataB:%d\n", chn, a, b);
+ #endif
+ snd_seq_ev_set_controller(event, chn, a, b);
+ return true;
+ }
+
+ //int num = ip->first;
+ unsigned long k = ip->second;
+
+ unsigned long i = synth->pIdx[k];
+
+ int ctlnum = DSSI_NONE;
+ if(dssi->get_midi_controller_for_port)
+ ctlnum = dssi->get_midi_controller_for_port(handle, i);
+
+ // No midi controller for the ladspa port? Send to ladspa control.
+ if(ctlnum == DSSI_NONE)
+ {
+ // Sanity check.
+ if(k > synth->_controlInPorts)
+ return false;
+
+ // TODO: If necessary... choose non-existing numbers...
+ //for(int k = 0; k < controlPorts; ++k)
+ //{
+ // int i = synth->pIdx[k];
+ //}
+
+ // Simple but flawed solution: Start them at 0x60000 + 0x2000 = 0x62000. Max NRPN number is 0x3fff.
+ ctlnum = k + (CTRL_NRPN14_OFFSET + 0x2000);
+ }
+ // p3.3.39
+ else
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::processEvent plugin requests DSSI-style ctlnum:%x(h) %d(d) be mapped to control port:%ld...\n", ctlnum, ctlnum, i);
+ #endif
+
+ int c = ctlnum;
+ // Can be both CC and NRPN! Prefer CC over NRPN.
+ if(DSSI_IS_CC(ctlnum))
+ {
+ ctlnum = DSSI_CC_NUMBER(c);
+
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::processEvent is CC ctlnum:%d\n", ctlnum);
+ #endif
+
+ #ifdef DSSI_DEBUG
+ if(DSSI_IS_NRPN(ctlnum))
+ printf("DssiSynthIF::processEvent is also NRPN control. Using CC.\n");
+ #endif
+ }
+ else
+ if(DSSI_IS_NRPN(ctlnum))
+ {
+ ctlnum = DSSI_NRPN_NUMBER(c) + CTRL_NRPN14_OFFSET;
+
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::processEvent is NRPN ctlnum:%x(h) %d(d)\n", ctlnum, ctlnum);
+ #endif
+ }
+
+ }
+
+ //{
+ float val = midi2LadspaValue(ld, i, ctlnum, b);
+
+ #ifdef DSSI_DEBUG
+ //fprintf(stderr, "DssiSynthIF::processEvent No midi controller for control port:%d port:%d dataA:%d Converting val from:%d to ladspa:%f\n", i, k, a, b, val);
+ fprintf(stderr, "DssiSynthIF::processEvent control port:%ld port:%ld dataA:%d Converting val from:%d to ladspa:%f\n", i, k, a, b, val);
+ #endif
+
+ // Set the ladspa port value.
+ controls[k].val = val;
+ // FIXME: Testing - Works but is this safe in a RT process callback? Try hooking into gui heartbeat timer instead...
+ //lo_send(uiTarget, uiOscControlPath, "if", i, val);
+ // Notify that changes are to be sent upon heartbeat.
+ synti->_guiUpdateControls[k] = true;
+
+ // Since we absorbed the message as a ladspa control change, return false - the event is not filled.
+ return false;
+ //}
+
+ // p3.3.39 Removed.
+ // "Hosts should not deliver through run_synth any MIDI controller events that have already
+ // been mapped to control port values."
+ // D'oh! My mistake, did not understand that the mapping is only a *request* that the app map MIDI
+ // controller events to a LADSPA port, and must do the conversion, not to actually *send* them via MIDI...
+ /*
+ else
+ {
+ switch(midiControllerType(a))
+ {
+ case MidiController::Controller7:
+ #ifdef DSSI_DEBUG
+ //fprintf(stderr, "DssiSynthIF::processEvent midi event is Controller7. Changing to DSSI_CC type. Current dataA:%d\n", a);
+ fprintf(stderr, "DssiSynthIF::processEvent midi event is Controller7. Current dataA:%d\n", a);
+ #endif
+ //a = DSSI_CC(a);
+ a &= 0x7f;
+ ctlnum = DSSI_CC_NUMBER(ctlnum);
+ break;
+ case MidiController::NRPN14:
+ #ifdef DSSI_DEBUG
+ // fprintf(stderr, "DssiSynthIF::processEvent midi event is NRPN. Changing to DSSI_NRPN type. Current dataA:%d\n", a);
+ fprintf(stderr, "DssiSynthIF::processEvent midi event is NRPN. Current dataA:%d\n", a);
+ #endif
+ //a = DSSI_NRPN(a - CTRL_NRPN14_OFFSET);
+ a &= 0x3fff;
+ ctlnum = DSSI_NRPN_NUMBER(ctlnum);
+ break;
+ case MidiController::Controller14:
+ a &= 0x7f;
+ break;
+ case MidiController::Pitch:
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::processEvent midi event is Pitch. DataA:%d\n", a);
+ #endif
+ a &= 0x3fff;
+ break;
+ case MidiController::Program:
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::processEvent midi event is Program. DataA:%d\n", a);
+ #endif
+ a &= 0x3fff;
+ break;
+ case MidiController::RPN:
+ case MidiController::RPN14:
+ case MidiController::NRPN:
+ default:
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::processEvent midi event is RPN, RPN14, or NRPN type. DataA:%d\n", a);
+ #endif
+ break;
+ }
+
+ // Verify it's the same number.
+ if(ctlnum != a)
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::processEvent Error! ctlnum:%d != event dataA:%d\n", ctlnum, a);
+ #endif
+ // Event not filled. Return false.
+
+ // TEMP: TODO: Turn on later
+ //return false;
+ }
+
+ // Fill the event.
+ // FIXME: Darn! We get to this point, but no change in sound (later). Nothing happens, at least with LTS -
+ // which is the only one I found so far with midi controllers.
+ // Tried with/without converting to DSSI_CC and DSSI_NRPN. What could be wrong here?
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::processEvent filling event chn:%d dataA:%d dataB:%d\n", chn, a, b);
+ #endif
+ snd_seq_ev_set_controller(event, chn, a, b);
+ }
+ */
+
+ }
+ break;
+ case ME_PITCHBEND:
+ snd_seq_ev_set_pitchbend(event, chn, a);
+ break;
+ case ME_AFTERTOUCH:
+ snd_seq_ev_set_chanpress(event, chn, a);
+ break;
+ case ME_SYSEX:
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::processEvent midi event is ME_SYSEX\n");
+ #endif
+
+ if (QString((const char*)e.data()).startsWith("VSTSAVE")) {
+#ifdef DSSI_VST_CHUNK_SUPPORT
+ printf("loading chunk from sysex %s!\n", e.data()+7);
+ dssi->setCustomData(handle, e.data()+7 /* len of str*/,e.len()-7);
+#else
+ printf("support for vst chunks not compiled in!\n");
+#endif
+ // Event not filled.
+ return false;
+ }
+ /*
+ // p3.3.39 Read the state of current bank and program and all input control values.
+ // TODO: Needs to be better. See write().
+ else
+ if (QString((const char*)e.data()).startsWith("PARAMSAVE"))
+ {
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::processEvent midi event is ME_SYSEX PARAMSAVE\n");
+ #endif
+
+ unsigned long dlen = e.len() - 9; // Minus "PARAMSAVE"
+ if(dlen > 0)
+ {
+ //if(dlen < 2 * sizeof(unsigned long))
+ if(dlen < (2 + 2 * sizeof(unsigned long))) // Version major and minor bytes, bank and program.
+ printf("DssiSynthIF::processEvent Error: PARAMSAVE data length does not include at least version major and minor, bank and program!\n");
+ else
+ {
+ // Not required, yet.
+ //char vmaj = *((char*)(e.data() + 9)); // After "PARAMSAVE"
+ //char vmin = *((char*)(e.data() + 10));
+
+ unsigned long* const ulp = (unsigned long*)(e.data() + 11); // After "PARAMSAVE" + version major and minor.
+ // TODO: TODO: Set plugin bank and program.
+ _curBank = ulp[0];
+ _curProgram = ulp[1];
+
+ dlen -= (2 + 2 * sizeof(unsigned long)); // After the version major and minor, bank and program.
+
+ if(dlen > 0)
+ {
+ if((dlen % sizeof(float)) != 0)
+ printf("DssiSynthIF::processEvent Error: PARAMSAVE float data length not integral multiple of float size!\n");
+ else
+ {
+ const unsigned long n = dlen / sizeof(float);
+ if(n != synth->_controlInPorts)
+ printf("DssiSynthIF::processEvent Warning: PARAMSAVE number of floats:%ld != number of controls:%ld\n", n, synth->_controlInPorts);
+
+ // Point to location after "PARAMSAVE", version major and minor, bank and progam.
+ float* const fp = (float*)(e.data() + 9 + 2 + 2 * sizeof(unsigned long));
+
+ for(unsigned long i = 0; i < synth->_controlInPorts && i < n; ++i)
+ {
+ const float v = fp[i];
+ controls[i].val = v;
+ }
+ }
+ }
+ }
+ }
+ // Event not filled.
+ return false;
+ }
+ */
+ else
+ {
+ // NOTE: There is a limit on the size of a sysex. Got this:
+ // "DssiSynthIF::processEvent midi event is ME_SYSEX"
+ // "WARNING: MIDI event of type ? decoded to 367 bytes, discarding"
+ // That might be ALSA doing that.
+ snd_seq_ev_set_sysex(event, len,
+ //(unsigned char*)ba.data());
+ (unsigned char*)ca);
+ }
+ break;
+ default:
+ if(debugMsg)
+ fprintf(stderr, "DssiSynthIF::processEvent midi event unknown type:%d\n", e.type());
+ // Event not filled.
+ return false;
+ break;
+ }
+
+ return true;
+}
+
+//---------------------------------------------------------
+// getData
+//---------------------------------------------------------
+
+//void DssiSynthIF::getData(MidiEventList* el, unsigned pos, int ch, unsigned samples, float** data)
+iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent /*i*/, unsigned pos, int ports, unsigned n, float** buffer)
+{
+ //#ifdef DSSI_DEBUG
+ // fprintf(stderr, "DssiSynthIF::getData elsize:%d pos:%d ports:%d samples:%d processed already?:%d\n", el->size(), pos, ports, n, synti->processed());
+ //#endif
+
+ //BEGIN: Process midi events
+
+ // FIXME: Add 10(?) for good luck in case volatile size changes (increments) while we're processing.
+ //unsigned long nevents = el->size();
+ unsigned long nevents = el->size() + synti->putFifo.getSize() + 10;
+
+ /*
+ while (!synti->putFifo.isEmpty()) {
+ MidiEvent event = synti->putFifo.get();
+ printf("Dssi: FIFO\n");
+ }
+ */
+
+ snd_seq_event_t events[nevents];
+ memset(events, 0, sizeof(events));
+ nevents = 0;
+
+ //int curPos = pos;
+ //unsigned endPos = pos + samples;
+ unsigned endPos = pos + n;
+ //int off = pos;
+ int frameOffset = audio->getFrameOffset();
+
+ //iMidiEvent i = el->begin();
+ iMPEvent i = el->begin();
+
+ // Process event list events...
+ for(; i != el->end(); ++i)
+ {
+ //if(i->time() >= endPos) // Doesn't work, at least here in muse-1. The event times are all
+ // just slightly after the endPos, EVEN IF transport is stopped.
+ // So it misses all the notes.
+ if(i->time() >= (endPos + frameOffset)) // NOTE: frameOffset? Tested, examined printouts of times: Seems OK for playback.
+ break;
+
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::getData eventlist event time:%d\n", i->time());
+ #endif
+
+ // p3.3.39 Update hardware state so knobs and boxes are updated. Optimize to avoid re-setting existing values.
+ // Same code as in MidiPort::sendEvent()
+ if(synti->midiPort() != -1)
+ {
+ MidiPort* mp = &midiPorts[synti->midiPort()];
+ if(i->type() == ME_CONTROLLER)
+ {
+ int da = i->dataA();
+ int db = i->dataB();
+ db = mp->limitValToInstrCtlRange(da, db);
+ if(!mp->setHwCtrlState(i->channel(), da, db))
+ continue;
+ //mp->setHwCtrlState(i->channel(), da, db);
+ }
+ else
+ if(i->type() == ME_PITCHBEND)
+ {
+ int da = mp->limitValToInstrCtlRange(CTRL_PITCH, i->dataA());
+ if(!mp->setHwCtrlState(i->channel(), CTRL_PITCH, da))
+ continue;
+ //mp->setHwCtrlState(i->channel(), CTRL_PITCH, da);
+ }
+ else
+ if(i->type() == ME_PROGRAM)
+ {
+ if(!mp->setHwCtrlState(i->channel(), CTRL_PROGRAM, i->dataA()))
+ continue;
+ //mp->setHwCtrlState(i->channel(), CTRL_PROGRAM, i->dataA());
+ }
+ }
+
+ if(processEvent(*i, &events[nevents]))
+ ++nevents;
+ }
+
+ // Now process putEvent events...
+ while(!synti->putFifo.isEmpty())
+ {
+ MidiPlayEvent e = synti->putFifo.get();
+
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::getData putFifo event time:%d\n", e.time());
+ #endif
+
+ // Set to the current time.
+ // FIXME: FIXME: Wrong - we should be setting some kind of linear realtime wallclock here, not song pos.
+ e.setTime(pos);
+ if(processEvent(e, &events[nevents]))
+ ++nevents;
+ }
+
+ // Now process OSC gui input control fifo events.
+ // It is probably more important that these are processed last so that they take precedence over all other
+ // events because OSC + DSSI/DSSI-VST are fussy about receiving feedback via these control ports, from GUI changes.
+ #ifdef OSC_SUPPORT
+ unsigned long ctls = synth->_controlInPorts;
+ for(unsigned long k = 0; k < ctls; ++k)
+ {
+ OscControlFifo* cfifo = _oscif.oscFifo(k);
+ if(!cfifo)
+ continue;
+
+ // If there are 'events' in the fifo, get exactly one 'event' per control per process cycle...
+ if(!cfifo->isEmpty())
+ {
+ OscControlValue v = cfifo->get();
+
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::getData OscControlFifo event input control number:%ld value:%f\n", k, v.value);
+ #endif
+
+ // Set the ladspa control port value.
+ controls[k].val = v.value;
+
+ // TODO: (From plugin module, adapt for synth if/when our own plugin gui is added to synths).
+ // Need to update the automation value, otherwise the block above overwrites with the last automation value.
+ ///if(_track)
+ ///{
+ // Since we are now in the audio thread context, there's no need to send a message,
+ // just modify directly.
+ //audio->msgSetPluginCtrlVal(this, genACnum(_id, i), controls[i].val);
+ /// _track->setPluginCtrlVal(k, v.value)
+ ///}
+ }
+ }
+ #endif
+
+/* // This is from MESS... Tried this here, didn't work, need to re-adapt, try again.
+ int evTime = i->time();
+ if(evTime == 0)
+ {
+ printf("DssiSynthIF::getData - time is 0!\n");
+ //continue;
+ evTime=frameOffset; // will cause frame to be zero, problem?
+ }
+
+ int frame = evTime - frameOffset;
+
+ if(frame >= endPos)
+ {
+ printf("DssiSynthIF::getData frame > endPos!! frame = %d >= endPos %d, i->time() %d, frameOffset %d curPos=%d\n", frame, endPos, i->time(), frameOffset,curPos);
+ continue;
+ }
+
+ if(frame > curPos)
+ {
+ if(frame < pos)
+ printf("DssiSynthIF::getData should not happen: missed event %d\n", pos -frame);
+ else
+ {
+*/
+
+/*
+ }
+ curPos = frame;
+ }
+*/
+// }
+
+ el->erase(el->begin(), i);
+ //END: Process midi events
+
+ //BEGIN: Run the synth
+ // All ports must be connected to something!
+
+ // First, copy the given input buffers to our local input buffers.
+ unsigned long np, k;
+ //np = portsin > synth->_inports ? synth->_inports : portsin;
+ //for(k = 0; k < np; ++k)
+ // memcpy(audioInBuffers[k], inbuffer[k], sizeof(float) * n);
+ //for(; k < portsin; ++k)
+ // memset(audioInBuffers[k], 0, sizeof(float) * n);
+
+ // Watch our limits.
+ np = ports > synth->_outports ? synth->_outports : ports;
+
+ const DSSI_Descriptor* dssi = synth->dssi;
+ const LADSPA_Descriptor* descr = dssi->LADSPA_Plugin;
+ k = 0;
+ // Connect the given buffers directly to the ports, up to a max of synth ports.
+ for(; k < np; ++k)
+ descr->connect_port(handle, synth->oIdx[k], buffer[k]);
+ // Connect the remaining ports to some local buffers (not used yet).
+ for(; k < synth->_outports; ++k)
+ descr->connect_port(handle, synth->oIdx[k], audioOutBuffers[k]);
+
+ /*
+ //
+ // p3.3.39 Handle inputs...
+ //
+ //if((song->bounceTrack != this) && !noInRoute())
+ if(!((AudioTrack*)synti)->noInRoute())
+ {
+ RouteList* irl = ((AudioTrack*)synti)->inRoutes();
+ iRoute i = irl->begin();
+ if(!i->track->isMidiTrack())
+ {
+ //if(debugMsg)
+ printf("DssiSynthIF::getData: Error: First route is a midi track route!\n");
+ }
+ else
+ {
+ int ch = i->channel == -1 ? 0 : i->channel;
+ int remch = i->remoteChannel == -1 ? 0 : i->remoteChannel;
+ int chs = i->channels == -1 ? 0 : i->channels;
+
+ // TODO:
+ //if(ch >= synth->_inports)
+ //iUsedIdx[ch] = true;
+ //if(chs == 2)
+ // iUsedIdx[ch + 1] = true;
+
+ //((AudioTrack*)i->track)->copyData(framePos, channels, nframe, bp);
+ ((AudioTrack*)i->track)->copyData(pos, ports,
+ //(i->track->type() == Track::AUDIO_SOFTSYNTH && i->channel != -1) ? i->channel : 0,
+ i->channel,
+ i->channels,
+ n, bp);
+ }
+
+ //unsigned pos, int ports, unsigned n, float** buffer
+
+ ++i;
+ for(; i != irl->end(); ++i)
+ {
+ if(i->track->isMidiTrack())
+ {
+ //if(debugMsg)
+ printf("DssiSynthIF::getData: Error: Route is a midi track route!\n");
+ continue;
+ }
+ //((AudioTrack*)i->track)->addData(framePos, channels, nframe, bp);
+ ((AudioTrack*)i->track)->addData(framePos, channels,
+ //(i->track->type() == Track::AUDIO_SOFTSYNTH && i->channel != -1) ? i->channel : 0,
+ i->channel,
+ i->channels,
+ nframe, bp);
+ }
+ }
+ */
+
+ //#ifdef DSSI_DEBUG
+ //if(nevents)
+ // fprintf(stderr, "DssiSynthIF::getData run nevents:%d\n", nevents);
+ //#endif
+
+ // Run the synth for one segment. This processes events and gets/fills our local buffers...
+ if(synth->dssi->run_synth)
+ {
+ synth->dssi->run_synth(handle, n, events, nevents);
+
+ // NOTE: Just a test
+ //for(int m = 0; m < n; ++m)
+ //{
+ // synth->dssi->run_synth(handle, 1, events, nevents);
+ //}
+
+ }
+ else if (synth->dssi->run_multiple_synths)
+ {
+ snd_seq_event_t* ev = events;
+ synth->dssi->run_multiple_synths(1, &handle, n, &ev, &nevents);
+ }
+ //END: Run the synth
+
+ return i;
+}
+
+//---------------------------------------------------------
+// putEvent
+//---------------------------------------------------------
+
+//bool DssiSynthIF::putEvent(const MidiEvent& ev)
+bool DssiSynthIF::putEvent(const MidiPlayEvent& ev)
+ {
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::putEvent midi event time:%d chn:%d a:%d b:%d\n", ev.time(), ev.channel(), ev.dataA(), ev.dataB());
+ #endif
+
+ if (midiOutputTrace)
+ ev.dump();
+
+ return synti->putFifo.put(ev);
+
+ //return false;
+ }
+
+
+//---------------------------------------------------------
+// incInstances
+//---------------------------------------------------------
+
+void DssiSynth::incInstances(int val)
+{
+ _instances += val;
+ if (_instances == 0)
+ {
+ if (handle)
+ {
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynth::incInstances no more instances, closing library\n");
+ #endif
+
+ dlclose(handle);
+ }
+ handle = 0;
+ dssi = NULL;
+ df = NULL;
+ pIdx.clear();
+ opIdx.clear();
+ iIdx.clear();
+ oIdx.clear();
+ rpIdx.clear();
+ iUsedIdx.clear();
+ midiCtl2PortMap.clear();
+ port2MidiCtlMap.clear();
+ //synti->_guiUpdateControls.clear();
+ }
+}
+
+//---------------------------------------------------------
+// initGui
+//---------------------------------------------------------
+bool DssiSynthIF::initGui()
+{
+ #ifdef OSC_SUPPORT
+ return _oscif.oscInitGui();
+ #endif
+
+ return true;
+
+ /*
+ // Are we already running? We don't want to allow another process do we...
+ if((guiQProc != 0) && (guiQProc->isRunning()))
+ return true;
+
+ //
+ // start gui
+ //
+ static char oscUrl[1024];
+ //snprintf(oscUrl, 1024, "%s/%s", url, synti->name().toAscii().data());
+ //snprintf(oscUrl, 1024, "%s/%s", url, synti->name().latin1());
+ snprintf(oscUrl, 1024, "%s/%s/%s", url, synth->info.baseName().latin1(), synti->name().latin1());
+
+ //QString guiPath(info.path() + "/" + info.baseName());
+ QString guiPath(synth->info.dirPath() + "/" + synth->info.baseName());
+
+ QDir guiDir(guiPath, "*", QDir::Unsorted, QDir::Files);
+ if (guiDir.exists())
+ {
+ //const QFileInfoList list = guiDir.entryInfoList();
+ QStringList list = guiDir.entryList();
+
+ //for (int i = 0; i < list.size(); ++i) {
+ for (unsigned int i = 0; i < list.count(); ++i)
+ {
+
+ //QFileInfo fi = list.at(i);
+ QFileInfo fi(guiPath + QString("/") + list[i]);
+
+ QString gui(fi.filePath());
+ if (gui.contains('_') == 0)
+ continue;
+ struct stat buf;
+
+ //if (stat(gui.toAscii().data(), &buf)) {
+ if (stat(gui.latin1(), &buf)) {
+
+ perror("stat failed");
+ continue;
+ }
+
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::initGui %s %s %s %s\n",
+ //fi.filePath().toAscii().data(),
+ //fi.fileName().toAscii().data(),
+ fi.filePath().latin1(),
+ //fi.fileName().latin1(),
+
+ oscUrl,
+
+ synth->info.filePath().latin1(),
+
+ //name().toAscii().data(),
+ synth->name().latin1());
+ #endif
+
+ if ((S_ISREG(buf.st_mode) || S_ISLNK(buf.st_mode)) &&
+ (buf.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+ {
+ // Changed by T356.
+ // fork + execlp were causing the processes to remain after closing gui, requiring manual kill.
+ // Changed to QProcess, works OK now.
+ //if((guiPid = fork()) == 0)
+ {
+ // No QProcess created yet? Do it now. Only once per SynthIF instance. Exists until parent destroyed.
+ if(guiQProc == 0)
+ guiQProc = new QProcess(muse);
+
+ // Don't forget this, he he...
+ guiQProc->clearArguments();
+
+ guiQProc->addArgument(fi.filePath());
+ //guiQProc->addArgument(fi.fileName()); // No conventional 'Arg0' here.
+ guiQProc->addArgument(QString(oscUrl));
+ guiQProc->addArgument(synth->info.filePath());
+ guiQProc->addArgument(synth->name());
+ guiQProc->addArgument(QString("channel 1"));
+
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::initGui starting QProcess\n");
+ #endif
+
+ if(guiQProc->start() == TRUE)
+ {
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::initGui started QProcess\n");
+ #endif
+
+ //guiPid = guiQProc->processIdentifier();
+ }
+ else
+ {
+
+ // execlp(
+ // fi.filePath().toAscii().data(),
+ // fi.fileName().toAscii().data(),
+ // fi.filePath().latin1(),
+ // fi.fileName().latin1(),
+
+ // oscUrl,
+
+ // info.filePath().toAscii().data(),
+ // name().toAscii().data(),
+ // synth->info.filePath().latin1(),
+ // synth->name().latin1(),
+
+ // "channel 1", (void*)0);
+
+ fprintf(stderr, "exec %s %s %s %s failed: %s\n",
+ // fi.filePath().toAscii().data(),
+ // fi.fileName().toAscii().data(),
+ fi.filePath().latin1(),
+ fi.fileName().latin1(),
+ oscUrl,
+ // name().toAscii().data(),
+ synth->name().latin1(),
+ strerror(errno));
+
+ // It's Ok, Keep going. So nothing happens. So what. The timeout in showGui will just leave.
+ // Maybe it's a 'busy' issue somewhere - allow to try again later + save work now.
+ // exit(1);
+
+ }
+
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::initGui after QProcess\n");
+ #endif
+ }
+ }
+ }
+ //synth->_hasGui = true;
+ }
+ else {
+ printf("%s: no dir for dssi gui found: %s\n",
+ //name().toAscii().data(), guiPath.toAscii().data());
+ synth->name().latin1(), guiPath.latin1());
+
+ //synth->_hasGui = false;
+ }
+
+ return true;
+ */
+}
+
+//---------------------------------------------------------
+// guiHeartBeat
+//---------------------------------------------------------
+
+void DssiSynthIF::guiHeartBeat()
+{
+ #ifdef OSC_SUPPORT
+ // Update the gui's program if needed.
+ if(synti->_guiUpdateProgram)
+ {
+ _oscif.oscSendProgram(synti->_curProgram, synti->_curBankL);
+ synti->_guiUpdateProgram = false;
+ }
+
+ // Update the gui's controls if needed.
+ unsigned long ports = synth->_controlInPorts;
+ if(ports > synti->_guiUpdateControls.size())
+ return;
+ for(unsigned long i = 0; i < ports; ++i)
+ {
+ if(synti->_guiUpdateControls[i])
+ {
+ unsigned long k = synth->pIdx[i];
+ _oscif.oscSendControl(k, controls[i].val);
+
+ // Reset.
+ synti->_guiUpdateControls[i] = false;
+ }
+ }
+ #endif
+}
+
+#ifdef OSC_SUPPORT
+//---------------------------------------------------------
+// oscUpdate
+//---------------------------------------------------------
+
+int DssiSynthIF::oscUpdate()
+{
+ // Send project directory.
+ _oscif.oscSendConfigure(DSSI_PROJECT_DIRECTORY_KEY, museProject.latin1()); // song->projectPath()
+
+ // Send current string configuration parameters.
+ //StringParamMap& map = synti->_stringParamMap;
+ int i = 0;
+ for(ciStringParamMap r = synti->_stringParamMap.begin(); r != synti->_stringParamMap.end(); ++r)
+ {
+ _oscif.oscSendConfigure(r->first.c_str(), r->second.c_str());
+ // Avoid overloading the GUI if there are lots and lots of params.
+ if((i+1) % 50 == 0)
+ usleep(300000);
+ ++i;
+ }
+
+ // Send current bank and program.
+ //unsigned long bank, prog;
+ //synti->currentProg(&prog, &bank, 0);
+ //_oscif.oscSendProgram(prog, bank);
+ _oscif.oscSendProgram(synti->_curProgram, synti->_curBankL);
+
+ // Send current control values.
+ unsigned long ports = synth->_controlInPorts;
+ for(unsigned long i = 0; i < ports; ++i)
+ {
+ unsigned long k = synth->pIdx[i];
+ _oscif.oscSendControl(k, controls[i].val);
+ // Avoid overloading the GUI if there are lots and lots of ports.
+ if((i+1) % 50 == 0)
+ usleep(300000);
+ }
+
+
+#if 0
+ /* Send current bank/program (-FIX- another race...) */
+ if (instance->pendingProgramChange < 0) {
+ unsigned long bank = instance->currentBank;
+ unsigned long program = instance->currentProgram;
+ instance->uiNeedsProgramUpdate = 0;
+ if (instance->uiTarget) {
+ lo_send(instance->uiTarget, instance->ui_osc_program_path, "ii", bank, program);
+ }
+ }
+
+ /* Send control ports */
+ for (i = 0; i < instance->plugin->controlIns; i++) {
+ int in = i + instance->firstControlIn;
+ int port = pluginControlInPortNumbers[in];
+ lo_send(instance->uiTarget, instance->ui_osc_control_path, "if", port,
+ pluginControlIns[in]);
+ /* Avoid overloading the GUI if there are lots and lots of ports */
+ if ((i+1) % 50 == 0)
+ usleep(300000);
+ }
+#endif
+ return 0;
+}
+
+//---------------------------------------------------------
+// oscProgram
+//---------------------------------------------------------
+
+int DssiSynthIF::oscProgram(unsigned long program, unsigned long bank)
+ {
+ //int bank = argv[0]->i;
+ //int program = argv[1]->i;
+
+ int ch = 0; // TODO: ??
+
+ int port = synti->midiPort();
+
+ //_curBank = bank;
+ //_curProgram = program;
+ synti->_curBankH = 0;
+ synti->_curBankL = bank;
+ synti->_curProgram = program;
+
+ bank &= 0xff;
+ program &= 0xff;
+
+ //MidiEvent event(0, ch, ME_CONTROLLER, CTRL_PROGRAM, (bank << 8) + program);
+
+ if(port != -1)
+ {
+ //MidiPlayEvent event(0, port, ch, ME_CONTROLLER, CTRL_PROGRAM, (bank << 8) + program);
+ MidiPlayEvent event(0, port, ch, ME_PROGRAM, (bank << 8) + program, 0);
+
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::oscProgram midi event chn:%d a:%d b:%d\n", event.channel(), event.dataA(), event.dataB());
+ #endif
+
+ midiPorts[port].sendEvent(event);
+ }
+
+
+
+ //synti->playMidiEvent(&event); // TODO
+ //
+ //MidiDevice* md = dynamic_cast<MidiDevice*>(synti);
+ //if(md)
+ // md->putEvent(event);
+ //
+ //synti->putEvent(event);
+
+ return 0;
+ }
+
+//---------------------------------------------------------
+// oscControl
+//---------------------------------------------------------
+
+int DssiSynthIF::oscControl(unsigned long port, float value)
+ {
+ //int port = argv[0]->i;
+ //LADSPA_Data value = argv[1]->f;
+
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::oscControl received oscControl port:%ld val:%f\n", port, value);
+ #endif
+
+ //int controlPorts = synth->_controlInPorts;
+
+ //if(port >= controlPorts)
+ //if(port < 0 || port >= synth->rpIdx.size())
+ if(port >= synth->rpIdx.size())
+ {
+ //fprintf(stderr, "DssiSynthIF::oscControl: port number:%d is out of range of number of ports:%d\n", port, controlPorts);
+ fprintf(stderr, "DssiSynthIF::oscControl: port number:%ld is out of range of index list size:%d\n", port, synth->rpIdx.size());
+ return 0;
+ }
+
+ // Convert from DSSI port number to control input port index.
+ unsigned long cport = synth->rpIdx[port];
+
+ if((int)cport == -1)
+ {
+ fprintf(stderr, "DssiSynthIF::oscControl: port number:%ld is not a control input\n", port);
+ return 0;
+ }
+
+ // p3.3.39 Set the DSSI control input port's value.
+ // Observations: With a native DSSI synth like LessTrivialSynth, the native GUI's controls do not change the sound at all
+ // ie. they don't update the DSSI control port values themselves.
+ // Hence in response to the call to this oscControl, sent by the native GUI, it is required to that here.
+/// controls[cport].val = value;
+ // DSSI-VST synths however, unlike DSSI synths, DO change their OWN sound in response to their gui controls.
+ // AND this function is called.
+ // Despite the descrepency we are STILL required to update the DSSI control port values here
+ // because dssi-vst is WAITING FOR A RESPONSE. (A CHANGE in the control port value).
+ // It will output something like "...4 events expected..." and count that number down as 4 actual control port value CHANGES
+ // are done here in response. Normally it says "...0 events expected..." when MusE is the one doing the DSSI control changes.
+ // TODO: (Done) May need FIFOs on each control(!) so that the control changes get sent one per process cycle.
+ // Observed countdown not actually going to zero upon string of changes.
+ //
+ // NOTE: NOTE: This line in RemoteVSTServer::setParameter(int p, float v) in dssi-vst-server.cpp :
+ //
+ // " if (tv.tv_sec > m_lastGuiComms.tv_sec + 10) "
+ //
+ // explains an observation that after ten seconds, the server automatically clears the expected number to 0.
+ // TODO: Now MusE should forget about all the VST fifo events past ten+ (?) seconds. Add event timestamps...
+ // You can't send any 'new' values until either you a): send all the expected events or b): wait ten seconds.
+ // (Because the server simply ignores the 'expected' messages.)
+ //
+ // Well, at least here are the fifos. Try this ...
+ OscControlFifo* cfifo = _oscif.oscFifo(cport);
+ if(cfifo)
+ {
+ OscControlValue cv;
+ //cv.idx = cport;
+ cv.value = value;
+ if(cfifo->put(cv))
+ {
+ fprintf(stderr, "DssiSynthIF::oscControl: fifo overflow: in control number:%ld\n", cport);
+ }
+ }
+
+ //const DSSI_Descriptor* dssi = synth->dssi;
+ //const LADSPA_Descriptor* ld = dssi->LADSPA_Plugin;
+
+ ciMidiCtl2LadspaPort ip = synth->port2MidiCtlMap.find(cport);
+ if(ip != synth->port2MidiCtlMap.end())
+ {
+ // TODO: TODO: Update midi MusE's midi controller knobs, sliders, boxes etc with a call to the midi port's setHwCtrlState() etc.
+ // But first we need a ladspa2MidiValue() function! ...
+ //
+ //
+ //float val = ladspa2MidiValue(ld, i, ?, ?);
+
+ }
+
+#if 0
+ int port = argv[0]->i;
+ LADSPA_Data value = argv[1]->f;
+
+ if (port < 0 || port > instance->plugin->descriptor->LADSPA_Plugin->PortCount) {
+ fprintf(stderr, "MusE: OSC: %s port number (%d) is out of range\n",
+ instance->friendly_name, port);
+ return 0;
+ }
+ if (instance->pluginPortControlInNumbers[port] == -1) {
+ fprintf(stderr, "MusE: OSC: %s port %d is not a control in\n",
+ instance->friendly_name, port);
+ return 0;
+ }
+ pluginControlIns[instance->pluginPortControlInNumbers[port]] = value;
+ if (verbose) {
+ printf("MusE: OSC: %s port %d = %f\n",
+ instance->friendly_name, port, value);
+ }
+#endif
+ return 0;
+ }
+
+/*
+//---------------------------------------------------------
+// oscExiting
+//---------------------------------------------------------
+
+int DssiSynthIF::oscExiting(lo_arg**)
+ {
+ //printf("not impl.: oscExiting\n");
+
+ // The gui is gone now, right?
+ _guiVisible = false;
+
+ //const DSSI_Descriptor* dssi = synth->dssi;
+ //const LADSPA_Descriptor* ld = dssi->LADSPA_Plugin;
+ //if(ld->deactivate)
+ // ld->deactivate(handle);
+
+ if (uiOscPath == 0) {
+ printf("DssiSynthIF::oscExiting(): no uiOscPath\n");
+ return 1;
+ }
+ char uiOscGuiPath[strlen(uiOscPath)+6];
+
+ sprintf(uiOscGuiPath, "%s/%s", uiOscPath, "quit");
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::oscExiting(): sending quit to uiOscGuiPath:%s\n", uiOscGuiPath);
+ #endif
+
+ lo_send(uiTarget, uiOscGuiPath, "");
+
+#if 0
+ int i;
+
+ if (verbose) {
+ printf("MusE: OSC: got exiting notification for instance %d\n",
+ instance->number);
+ }
+
+ if (instance->plugin) {
+
+ // !!! No, this isn't safe -- plugins deactivated in this way
+ // would still be included in a run_multiple_synths call unless
+ // we re-jigged the instance array at the same time -- leave it
+ // for now
+ //if (instance->plugin->descriptor->LADSPA_Plugin->deactivate) {
+ // instance->plugin->descriptor->LADSPA_Plugin->deactivate
+ // (instanceHandles[instance->number]);
+ // }
+ // Leave this flag though, as we need it to determine when to exit
+ instance->inactive = 1;
+ }
+
+ // Do we have any plugins left running?
+
+ for (i = 0; i < instance_count; ++i) {
+ if (!instances[i].inactive)
+ return 0;
+ }
+
+ if (verbose) {
+ printf("MusE: That was the last remaining plugin, exiting...\n");
+ }
+ exiting = 1;
+#endif
+ return 0;
+ }
+*/
+
+//---------------------------------------------------------
+// oscMidi
+//---------------------------------------------------------
+
+int DssiSynthIF::oscMidi(int a, int b, int c)
+ {
+ //int a = argv[0]->m[1];
+ //int b = argv[0]->m[2];
+ //int c = argv[0]->m[3];
+
+ if (a == ME_NOTEOFF) {
+ a = ME_NOTEON;
+ c = 0;
+ }
+ int channel = 0; // TODO: ??
+
+ int port = synti->midiPort();
+
+ //MidiEvent event(0, channel, a, b, c);
+
+ if(port != -1)
+ {
+ MidiPlayEvent event(0, port, channel, a, b, c);
+
+ #ifdef DSSI_DEBUG
+ fprintf(stderr, "DssiSynthIF::oscMidi midi event chn:%d a:%d b:%d\n", event.channel(), event.dataA(), event.dataB());
+ #endif
+
+ midiPorts[port].sendEvent(event);
+ }
+
+ //synti->playMidiEvent(&event); // TODO
+ //
+ //MidiDevice* md = dynamic_cast<MidiDevice*>(synti);
+ //if(md)
+ // md->putEvent(event);
+ //
+ //synti->putEvent(event);
+ //
+
+ return 0;
+ }
+
+//---------------------------------------------------------
+// oscConfigure
+//---------------------------------------------------------
+
+int DssiSynthIF::oscConfigure(const char *key, const char *value)
+ {
+ //const char *key = (const char *)&argv[0]->s;
+ //const char *value = (const char *)&argv[1]->s;
+
+ // This is pretty much the simplest legal implementation of
+ // configure in a DSSI host.
+
+ // The host has the option to remember the set of (key,value)
+ // pairs associated with a particular instance, so that if it
+ // wants to restore the "same" instance on another occasion it can
+ // just call configure() on it for each of those pairs and so
+ // restore state without any input from a GUI. Any real-world GUI
+ // host will probably want to do that. This host doesn't have any
+ // concept of restoring an instance from one run to the next, so
+ // we don't bother remembering these at all.
+
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::oscConfigure synth name:%s key:%s value:%s\n", synti->name().latin1(), key, value);
+ #endif
+
+ // Add or modify the configuration map item.
+ synti->_stringParamMap.set(key, value);
+
+ if (!strncmp(key, DSSI_RESERVED_CONFIGURE_PREFIX,
+ strlen(DSSI_RESERVED_CONFIGURE_PREFIX))) {
+ fprintf(stderr, "MusE: OSC: UI for plugin '%s' attempted to use reserved configure key \"%s\", ignoring\n",
+ //synti->name().toAscii().data(), key);
+ synti->name().latin1(), key);
+
+ return 0;
+ }
+
+ if (!synth->dssi->configure)
+ return 0;
+
+ char* message = synth->dssi->configure(handle, key, value);
+ if (message) {
+ printf("MusE: on configure '%s' '%s', plugin '%s' returned error '%s'\n",
+ //key, value, synti->name().toAscii().data(), message);
+ key, value, synti->name().latin1(), message);
+
+ free(message);
+ }
+
+ // also call back on UIs for plugins other than the one
+ // that requested this:
+ // if (n != instance->number && instances[n].uiTarget) {
+ // lo_send(instances[n].uiTarget,
+ // instances[n].ui_osc_configure_path, "ss", key, value);
+ // }
+
+ // configure invalidates bank and program information, so
+ // we should do this again now:
+ queryPrograms();
+ return 0;
+ }
+#endif // OSC_SUPPORT
+
+//---------------------------------------------------------
+// queryPrograms
+//---------------------------------------------------------
+
+void DssiSynthIF::queryPrograms()
+ {
+ for (std::vector<DSSI_Program_Descriptor>::const_iterator i = programs.begin();
+ i != programs.end(); ++i) {
+ free((void*)(i->Name));
+ }
+ programs.clear();
+
+ //if (!(synth->dssi->get_program && synth->dssi->select_program))
+ if (!synth->dssi->get_program)
+ return;
+
+ for (int i = 0;; ++i) {
+ const DSSI_Program_Descriptor* pd = synth->dssi->get_program(handle, i);
+ if (pd == 0)
+ break;
+ DSSI_Program_Descriptor d;
+ d.Name = strdup(pd->Name);
+ d.Program = pd->Program;
+ d.Bank = pd->Bank;
+ programs.push_back(d);
+ }
+ }
+
+//---------------------------------------------------------
+// getPatchName
+//---------------------------------------------------------
+
+//QString DssiSynthIF::getPatchName(int, int prog)
+const char* DssiSynthIF::getPatchName(int /*chan*/, int prog, MType /*type*/, bool /*drum*/)
+ {
+ unsigned program = prog & 0x7f;
+ int lbank = (prog >> 8) & 0xff;
+ int hbank = (prog >> 16) & 0xff;
+
+ if (lbank == 0xff)
+ lbank = 0;
+ if (hbank == 0xff)
+ hbank = 0;
+ unsigned bank = (hbank << 8) + lbank;
+
+ for (std::vector<DSSI_Program_Descriptor>::const_iterator i = programs.begin();
+ i != programs.end(); ++i) {
+ if (i->Bank == bank && i->Program ==program)
+ return i->Name;
+ }
+ return "?";
+ }
+
+//---------------------------------------------------------
+// populatePatchPopup
+//---------------------------------------------------------
+
+//void DssiSynthIF::populatePatchPopup(QMenu* menu, int)
+void DssiSynthIF::populatePatchPopup(Q3PopupMenu* menu, int /*ch*/, MType /*type*/, bool /*drum*/)
+ {
+ // The plugin can change the programs, patches etc.
+ // So make sure we're up to date by calling queryPrograms.
+ queryPrograms();
+
+ menu->clear();
+
+ for (std::vector<DSSI_Program_Descriptor>::const_iterator i = programs.begin();
+ i != programs.end(); ++i) {
+ int bank = i->Bank;
+ int prog = i->Program;
+ int id = (bank << 16) + prog;
+
+ //QAction* a = menu->addAction(QString(i->Name));
+ //a->setData(id);
+ menu->insertItem(QString(i->Name), id);
+ }
+ }
+
+int DssiSynthIF::getControllerInfo(int id, const char** name, int* ctrl, int* min, int* max, int* initval)
+{
+ int controlPorts = synth->_controlInPorts;
+ if(id >= controlPorts)
+ //if(id >= midiCtl2PortMap.size())
+ return 0;
+
+ const DSSI_Descriptor* dssi = synth->dssi;
+ const LADSPA_Descriptor* ld = dssi->LADSPA_Plugin;
+
+ // Hmm, <map> has a weird [] operator. Would it work?
+ // For now just use duplicate code found in ::init()
+ //iMidiCtl2LadspaPort ip = midiCtl2PortMap[id];
+ //int ctlnum = ip->first;
+ //int k = ip->second;
+
+ int i = synth->pIdx[id];
+ //int i = synth->pIdx[k];
+
+ //ladspaDefaultValue(ld, i, &controls[id].val);
+
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::getControllerInfo control port:%d port idx:%d name:%s\n", id, i, ld->PortNames[i]);
+ #endif
+
+ int ctlnum = DSSI_NONE;
+ if(dssi->get_midi_controller_for_port)
+ ctlnum = dssi->get_midi_controller_for_port(handle, i);
+
+
+ // No controller number? Give it one.
+ if(ctlnum == DSSI_NONE)
+ {
+ // TODO: If neccesary... choose non-existing numbers...
+ //for(int k = 0; k < controlPorts; ++k)
+ //{
+ // int i = synth->pIdx[k];
+ //}
+
+ // Simple but flawed solution: Start them at 0x60000 + 0x2000 = 0x62000. Max NRPN number is 0x3fff.
+ ctlnum = CTRL_NRPN14_OFFSET + 0x2000 + id;
+ }
+ else
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::getControllerInfo ctlnum:%d\n", ctlnum);
+ #endif
+
+ int c = ctlnum;
+ // Can be both CC and NRPN! Prefer CC over NRPN.
+ if(DSSI_IS_CC(ctlnum))
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::getControllerInfo is CC control\n");
+ #endif
+
+ ctlnum = DSSI_CC_NUMBER(c);
+
+ #ifdef DSSI_DEBUG
+ if(DSSI_IS_NRPN(ctlnum))
+ printf("DssiSynthIF::getControllerInfo is also NRPN control. Using CC.\n");
+ #endif
+ }
+ else
+ if(DSSI_IS_NRPN(ctlnum))
+ {
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::getControllerInfo is NRPN control\n");
+ #endif
+
+ ctlnum = DSSI_NRPN_NUMBER(c) + CTRL_NRPN14_OFFSET;
+ }
+ }
+
+ int def = CTRL_VAL_UNKNOWN;
+ if(ladspa2MidiControlValues(ld, i, ctlnum, min, max, &def))
+ *initval = def;
+ else
+ *initval = CTRL_VAL_UNKNOWN;
+
+ #ifdef DSSI_DEBUG
+ printf("DssiSynthIF::getControllerInfo passed ctlnum:%d min:%d max:%d initval:%d\n", ctlnum, *min, *max, *initval);
+ #endif
+
+ *ctrl = ctlnum;
+ *name = ld->PortNames[i];
+ return ++id;
+
+ /*
+ // ...now create midi controllers for ports which did not define them ...
+ for(int k = 0; k < controlPorts; ++k)
+ {
+ int i = synth->pIdx[k];
+ //controls[k].val = ladspaDefaultValue(ld, i);
+ ladspaDefaultValue(ld, i, &controls[k].val);
+
+ printf("DssiSynthIF::getControllerInfo #2 control port:%d port idx:%d name:%s\n", k, i, ld->PortNames[i]);
+
+ if(!dssi->get_midi_controller_for_port || (dssi->get_midi_controller_for_port(handle, i) == DSSI_NONE))
+ {
+ int ctlnum;
+ //printf("DssiSynthIF::getControllerInfo #2 midi controller number:%d\n", ctlnum);
+ printf("DssiSynthIF::getControllerInfo #2 creating MidiController number:%d\n", ctlnum);
+ MidiController* mc = ladspa2MidiController(ld, i, ctlnum);
+ // Add to MidiInstrument controller list.
+ if(mc)
+ {
+ printf("DssiSynthIF::getControllerInfo #2 adding MidiController to instrument\n");
+ ((MidiInstrument*)synti)->controller()->add(mc);
+ }
+ }
+ else
+ {
+
+ }
+ }
+ */
+
+}
+
+int DssiSynthIF::channels() const
+{
+ return synth->_outports > MAX_CHANNELS ? MAX_CHANNELS : synth->_outports;
+}
+
+int DssiSynthIF::totalOutChannels() const
+{
+ return synth->_outports;
+}
+
+int DssiSynthIF::totalInChannels() const
+{
+ return synth->_inports;
+}
+
+//--------------------------------
+// Methods for PluginIBase:
+//--------------------------------
+
+bool DssiSynthIF::on() const { return true; } // Synth is not part of a rack plugin chain. Always on.
+void DssiSynthIF::setOn(bool /*val*/) { }
+int DssiSynthIF::pluginID() { return (synth && synth->dssi) ? synth->dssi->LADSPA_Plugin->UniqueID : 0; }
+int DssiSynthIF::id() { return 0; } // Synth is not part of a rack plugin chain. Always 0.
+QString DssiSynthIF::pluginLabel() const { return (synth && synth->dssi) ? QString(synth->dssi->LADSPA_Plugin->Label) : QString(); }
+QString DssiSynthIF::name() const { return synti->name(); }
+AudioTrack* DssiSynthIF::track() { return (AudioTrack*)synti; }
+void DssiSynthIF::enableController(int i, bool v) { controls[i].enCtrl = v; }
+bool DssiSynthIF::controllerEnabled(int i) const { return controls[i].enCtrl; }
+bool DssiSynthIF::controllerEnabled2(int i) const { return controls[i].en2Ctrl; }
+void DssiSynthIF::updateControllers() { }
+void DssiSynthIF::writeConfiguration(int /*level*/, Xml& /*xml*/) { }
+bool DssiSynthIF::readConfiguration(Xml& /*xml*/, bool /*readPreset*/) { return false; }
+int DssiSynthIF::parameters() const { return synth ? synth->_controlInPorts : 0; }
+void DssiSynthIF::setParam(int i, double val) { setParameter(i, val); }
+double DssiSynthIF::param(int i) const { return getParameter(i); }
+const char* DssiSynthIF::paramName(int i) { return (synth && synth->dssi) ? synth->dssi->LADSPA_Plugin->PortNames[i] : 0; }
+//LADSPA_PortRangeHint DssiSynthIF::range(int i) { return (synth && synth->dssi) ? synth->dssi->LADSPA_Plugin->PortRangeHints[i] : 0; }
+LADSPA_PortRangeHint DssiSynthIF::range(int i) { return synth->dssi->LADSPA_Plugin->PortRangeHints[i]; }
+
+
+#else //DSSI_SUPPORT
+void initDSSI() {}
+#endif
+
diff --git a/muse2/muse/dssihost.h b/muse2/muse/dssihost.h
new file mode 100644
index 00000000..046343f5
--- /dev/null
+++ b/muse2/muse/dssihost.h
@@ -0,0 +1,256 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// $Id: dssihost.h,v 1.10.2.7 2009/12/06 10:05:00 terminator356 Exp $
+//
+// Copyright (C) 2002-2006 by Werner Schweer and others
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//=============================================================================
+
+#ifndef __DSSIHOST_H__
+#define __DSSIHOST_H__
+
+#include "config.h"
+
+#include <vector>
+#include <map>
+#include <string>
+
+#ifdef OSC_SUPPORT
+#include <lo/lo.h>
+#include "osc.h"
+#endif
+
+#include "ladspa.h"
+#include <dssi.h>
+#include <alsa/asoundlib.h>
+
+#include "midictrl.h"
+#include "synth.h"
+#include "stringparam.h"
+
+#include "plugin.h"
+//Added by qt3to4:
+#include <Q3PopupMenu>
+
+#define DSSI_PARAMSAVE_VERSION_MAJOR 0
+#define DSSI_PARAMSAVE_VERSION_MINOR 1
+
+struct _DSSI;
+class DssiPluginIF;
+
+//class LadspaPort;
+class Port;
+class Q3Process;
+
+//---------------------------------------------------------
+// DssiSynth
+//---------------------------------------------------------
+
+class DssiSynth : public Synth {
+ protected:
+ //char* label;
+ void* handle;
+ const DSSI_Descriptor* dssi;
+ DSSI_Descriptor_Function df;
+ unsigned long _portCount, _inports, _outports, _controlInPorts, _controlOutPorts;
+ std::vector<unsigned long> pIdx; // Control input index to port number.
+ std::vector<unsigned long> opIdx; // Control output index to port number. This is sometimes a latency port and...?
+ std::vector<unsigned long> iIdx; // Audio input index to port number.
+ std::vector<unsigned long> oIdx; // Audio output index to port number.
+ std::vector<bool> iUsedIdx; // During process, tells whether an audio input port was used by any input routes.
+ std::vector<unsigned long> rpIdx; // Port number to control input index. Item is -1 if it's not a control input.
+ //unsigned long* rpIdx;
+ MidiCtl2LadspaPortMap midiCtl2PortMap; // Maps midi controller numbers to DSSI port numbers.
+ MidiCtl2LadspaPortMap port2MidiCtlMap; // Maps DSSI port numbers to midi controller numbers.
+ bool _hasGui;
+ bool _inPlaceCapable;
+
+ public:
+ //DssiSynth(const QFileInfo* fi, QString l) : Synth(fi, l) {
+ //DssiSynth(const QFileInfo& fi, QString l) : Synth(fi, l) {
+ //DssiSynth(const QFileInfo& fi, QString label, QString descr, QString maker, QString ver) :
+ // Synth(fi, label, descr, maker, ver) {
+ // rpIdx = 0;
+ // df = 0;
+ // handle = 0;
+ // dssi = 0;
+ // _hasGui = false;
+ // }
+ //DssiSynth(const QFileInfo& fi, QString label, QString descr, QString maker, QString ver);
+ DssiSynth(QFileInfo&, const DSSI_Descriptor*); // removed const for QFileInfo
+ virtual ~DssiSynth();
+ virtual void incInstances(int);
+
+ //virtual void* instantiate();
+
+ virtual SynthIF* createSIF(SynthI*);
+ //virtual SynthIF* createSIF();
+
+ friend class DssiSynthIF;
+ //float defaultValue(int); // Not required
+ unsigned long inPorts() const { return _inports; }
+ unsigned long outPorts() const { return _outports; }
+ unsigned long inControls() const { return _controlInPorts; }
+ unsigned long outControls() const { return _controlOutPorts; }
+
+ unsigned long inControlPortIdx(unsigned long i) { return pIdx[i]; }
+ };
+
+//---------------------------------------------------------
+// DssiSynthIF
+// VSTi synthesizer instance
+//---------------------------------------------------------
+
+//class DssiSynthIF : public SynthIF
+class DssiSynthIF : public SynthIF, public PluginIBase
+ {
+ //bool _guiVisible;
+ DssiSynth* synth;
+ LADSPA_Handle handle;
+
+ //LadspaPort* controls;
+ Port* controls;
+ Port* controlsOut;
+
+ //unsigned long _curBank;
+ //unsigned long _curProgram;
+
+ #ifdef OSC_SUPPORT
+ OscDssiIF _oscif;
+ #endif
+
+ //void* uiTarget;
+ //char* uiOscShowPath;
+ //char* uiOscControlPath;
+ //char* uiOscConfigurePath;
+ //char* uiOscProgramPath;
+ //char* uiOscPath;
+
+ std::vector<DSSI_Program_Descriptor> programs;
+ void queryPrograms();
+ bool processEvent(const MidiPlayEvent&, snd_seq_event_t*);
+
+ float** audioInBuffers;
+ float** audioOutBuffers;
+
+ protected:
+ //int guiPid;
+ //QProcess* guiQProc;
+
+ public:
+ DssiSynthIF(SynthI* s);
+ //DssiSynthIF();
+
+ virtual ~DssiSynthIF();
+
+ virtual DssiSynth* dssiSynth() { return synth; }
+ virtual SynthI* dssiSynthI() { return synti; }
+
+ virtual bool initGui();
+ virtual void guiHeartBeat();
+ virtual bool guiVisible() const;
+ virtual void showGui(bool v);
+ virtual bool hasGui() const { return synth->_hasGui; }
+ virtual void getGeometry(int*, int*, int*, int*) const {}
+ virtual void setGeometry(int, int, int, int) {}
+
+ virtual void preProcessAlways();
+
+ //virtual void getData(MidiEventList*, unsigned pos, int ports, unsigned n, float** buffer) ;
+ virtual iMPEvent getData(MidiPort*, MPEventList*, iMPEvent, unsigned pos, int ports, unsigned n, float** buffer);
+
+ //virtual bool putEvent(const MidiEvent& ev);
+ virtual bool putEvent(const MidiPlayEvent& ev);
+
+ //virtual MidiEvent receiveEvent();
+ virtual MidiPlayEvent receiveEvent();
+
+ virtual int eventsPending() const { return 0; }
+
+ //virtual int channels() const { return synth->_outports; }
+ virtual int channels() const;
+ virtual int totalOutChannels() const;
+ virtual int totalInChannels() const;
+
+ virtual void deactivate3() {}
+
+ //virtual QString getPatchName(int, int);
+ virtual const char* getPatchName(int, int, int, bool) const { return ""; }
+ virtual const char* getPatchName(int, int, MType, bool);
+
+ //virtual void populatePatchPopup(QMenu*, int);
+ virtual void populatePatchPopup(Q3PopupMenu*, int, MType, bool);
+
+ //virtual void write(Xml& xml) const;
+ virtual void write(int level, Xml& xml) const;
+
+ virtual float getParameter(unsigned long /*idx*/) const;
+ virtual void setParameter(unsigned long /*idx*/, float /*value*/);
+
+ //virtual int getControllerInfo(int, const char**, int*, int*, int*) { return 0; }
+ virtual int getControllerInfo(int, const char**, int*, int*, int*, int*);
+
+ bool init(DssiSynth* s);
+
+ //StringParamMap& stringParameters() { return synti->stringParameters(); }
+
+ #ifdef OSC_SUPPORT
+ OscDssiIF& oscIF() { return _oscif; }
+ /*
+ int oscProgram(lo_arg**);
+ int oscControl(lo_arg**);
+ int oscMidi(lo_arg**);
+ int oscConfigure(lo_arg**);
+ int oscUpdate(lo_arg**);
+ //int oscExiting(lo_arg**);
+ */
+
+ int oscProgram(unsigned long /*prog*/, unsigned long /*bank*/);
+ int oscControl(unsigned long /*dssiPort*/, float /*val*/);
+ int oscMidi(int /*a*/, int /*b*/, int /*c*/);
+ int oscConfigure(const char */*key*/, const char */*val*/);
+ int oscUpdate();
+ //int oscExiting();
+ #endif
+
+ //-------------------------
+ // Methods for PluginIBase:
+ //-------------------------
+ bool on() const;
+ void setOn(bool /*val*/);
+ int pluginID();
+ int id();
+ QString pluginLabel() const;
+ QString name() const;
+ AudioTrack* track();
+ void enableController(int /*i*/, bool v = true);
+ bool controllerEnabled(int /*i*/) const;
+ bool controllerEnabled2(int /*i*/) const;
+ void updateControllers();
+ void writeConfiguration(int /*level*/, Xml& /*xml*/);
+ bool readConfiguration(Xml& /*xml*/, bool readPreset=false);
+ int parameters() const;
+ void setParam(int /*i*/, double /*val*/);
+ double param(int /*i*/) const;
+ const char* paramName(int /*i*/);
+ LADSPA_PortRangeHint range(int /*i*/);
+
+ friend class DssiSynth;
+ };
+
+extern void initDSSI();
+
+#endif
+
diff --git a/muse2/muse/evdata.h b/muse2/muse/evdata.h
new file mode 100644
index 00000000..59155d48
--- /dev/null
+++ b/muse2/muse/evdata.h
@@ -0,0 +1,67 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: evdata.h,v 1.2.2.2 2008/08/18 00:15:23 terminator356 Exp $
+//
+// (C) Copyright 1999-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __EVDATA_H__
+#define __EVDATA_H__
+
+#include <string.h>
+// #include <memory.h>
+
+//---------------------------------------------------------
+// EvData
+// variable len event data (sysex, meta etc.)
+//---------------------------------------------------------
+
+class EvData {
+ int* refCount;
+
+ public:
+ unsigned char* data;
+ int dataLen;
+
+ EvData() {
+ data = 0;
+ dataLen = 0;
+ refCount = new int(1);
+ }
+ EvData(const EvData& ed) {
+ data = ed.data;
+ dataLen = ed.dataLen;
+ refCount = ed.refCount;
+ (*refCount)++;
+ }
+
+ EvData& operator=(const EvData& ed) {
+ if (data == ed.data)
+ return *this;
+ if (--(*refCount) == 0) {
+ delete refCount;
+ delete[] data;
+ }
+ data = ed.data;
+ dataLen = ed.dataLen;
+ refCount = ed.refCount;
+ (*refCount)++;
+ return *this;
+ }
+
+ ~EvData() {
+ if (--(*refCount) == 0) {
+ delete[] data;
+ delete refCount;
+ }
+ }
+ void setData(const unsigned char* p, int l) {
+ data = new unsigned char[l];
+ memcpy(data, p, l);
+ dataLen = l;
+ }
+ };
+
+#endif
+
diff --git a/muse2/muse/event.cpp b/muse2/muse/event.cpp
new file mode 100644
index 00000000..5d16fde9
--- /dev/null
+++ b/muse2/muse/event.cpp
@@ -0,0 +1,328 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: event.cpp,v 1.8.2.5 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2000-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+// #include <memory.h>
+//#include "audioconvert.h"
+#include "event.h"
+#include "eventbase.h"
+#include "waveevent.h"
+#include "midievent.h"
+//#include "globals.h"
+
+// Added by Tim. p3.3.20
+//#define USE_SAMPLERATE
+
+//---------------------------------------------------------
+// Event
+//---------------------------------------------------------
+
+EventBase::EventBase(EventType t)
+ {
+ _type = t;
+ Pos::setType(_type == Wave ? FRAMES : TICKS);
+ refCount = 0;
+ _selected = false;
+ }
+
+EventBase::EventBase(const EventBase& ev)
+ : PosLen(ev)
+ {
+ refCount = 0;
+ _selected = ev._selected;
+ _type = ev._type;
+ }
+
+//---------------------------------------------------------
+// move
+//---------------------------------------------------------
+
+void EventBase::move(int tickOffset)
+ {
+ setTick(tick() + tickOffset);
+ }
+
+//---------------------------------------------------------
+// dump
+//---------------------------------------------------------
+
+void EventBase::dump(int n) const
+ {
+ for (int i = 0; i < n; ++i)
+ putchar(' ');
+ printf("Event %p refs:%d ", this, refCount);
+ PosLen::dump(n+2);
+ }
+
+//---------------------------------------------------------
+// clone
+//---------------------------------------------------------
+
+Event Event::clone()
+ {
+ // p3.3.31
+ //printf("Event::clone() this:%p\n", this);
+
+ // p3.3.31
+ //return Event(ev->clone());
+ #ifdef USE_SAMPLERATE
+ return Event(ev->clone(), _audConv);
+ #else
+ return Event(ev->clone());
+ #endif
+ }
+
+Event::Event()
+{
+ ev = 0;
+ //_sfCurFrame = 0;
+ //_audConv = 0;
+}
+
+Event::Event(EventType t) {
+ //_sfCurFrame = 0;
+ //_audConv = 0;
+
+ if (t == Wave)
+ ev = new WaveEventBase(t);
+ else
+ ev = new MidiEventBase(t);
+ ++(ev->refCount);
+ }
+Event::Event(const Event& e) {
+ //_sfCurFrame = 0;
+ //_audConv = 0;
+
+ ev = e.ev;
+ if(ev)
+ ++(ev->refCount);
+
+ #ifdef USE_SAMPLERATE
+ //_audConv = AudioConverter::getAudioConverter(e._audConv);
+ if(e._audConv)
+ _audConv = e._audConv->reference();
+ #endif
+ }
+Event::Event(EventBase* eb) {
+ //_sfCurFrame = 0;
+ //_audConv = 0;
+
+ ev = eb;
+ ++(ev->refCount);
+
+ #ifdef USE_SAMPLERATE
+ if(!ev->sndFile().isNull())
+ //_audConv = AudioConverter::getAudioConverter(eb, SRC_SINC_MEDIUM_QUALITY);
+ //_audConv = new AudioConverter(ev->sndFile().channels(), SRC_SINC_MEDIUM_QUALITY);
+ _audConv = new SRCAudioConverter(ev->sndFile().channels(), SRC_SINC_MEDIUM_QUALITY);
+ #endif
+ }
+#ifdef USE_SAMPLERATE
+Event::Event(EventBase* eb, AudioConverter* cv) {
+ _sfCurFrame = 0;
+ _audConv = 0;
+
+ ev = eb;
+ ++(ev->refCount);
+
+ if(cv)
+ _audConv = cv->reference();
+ }
+#endif
+
+Event::~Event() {
+ if (ev && --(ev->refCount) == 0) {
+ delete ev;
+ ev=0;
+ }
+
+ #ifdef USE_SAMPLERATE
+ AudioConverter::release(_audConv);
+ #endif
+ }
+
+bool Event::empty() const { return ev == 0; }
+EventType Event::type() const { return ev ? ev->type() : Note; }
+
+void Event::setType(EventType t) {
+ if (ev && --(ev->refCount) == 0) {
+ delete ev;
+ ev = 0;
+ }
+ if (t == Wave)
+ ev = new WaveEventBase(t);
+ else
+ ev = new MidiEventBase(t);
+ ++(ev->refCount);
+ }
+
+Event& Event::operator=(const Event& e) {
+ /*
+ if (ev == e.ev)
+ return *this;
+ if (ev && --(ev->refCount) == 0) {
+ delete ev;
+ ev = 0;
+ }
+ ev = e.ev;
+ if (ev)
+ ++(ev->refCount);
+ return *this;
+ */
+
+ if (ev != e.ev)
+ {
+ if (ev && --(ev->refCount) == 0) {
+ delete ev;
+ ev = 0;
+ }
+ ev = e.ev;
+ if (ev)
+ ++(ev->refCount);
+ }
+
+ #ifdef USE_SAMPLERATE
+ if (_audConv != e._audConv)
+ {
+ if(_audConv)
+ AudioConverter::release(_audConv);
+ //_audConv = AudioConverter::getAudioConverter(e._audConv);
+ _audConv = e._audConv->reference();
+ }
+ #endif
+ return *this;
+ }
+
+bool Event::operator==(const Event& e) const {
+ return ev == e.ev;
+ }
+
+int Event::getRefCount() const { return ev->getRefCount(); }
+bool Event::selected() const { return ev->_selected; }
+void Event::setSelected(bool val) { ev->_selected = val; }
+void Event::move(int offset) { ev->move(offset); }
+
+//void Event::read(Xml& xml) { ev->read(xml); }
+void Event::read(Xml& xml)
+{
+ ev->read(xml);
+
+ #ifdef USE_SAMPLERATE
+ if(!ev->sndFile().isNull())
+ {
+ if(_audConv)
+ {
+ _audConv->setChannels(ev->sndFile().channels());
+ }
+ else
+ {
+ //int srcerr;
+ //if(debugMsg)
+ // printf("Event::read Creating samplerate converter with %d channels\n", ev->sndFile().channels());
+ //_src_state = src_new(SRC_SINC_MEDIUM_QUALITY, ev->sndFile().channels(), &srcerr);
+// _audConv = new AudioConverter(ev->sndFile().channels(), SRC_SINC_MEDIUM_QUALITY);
+ _audConv = new SRCAudioConverter(ev->sndFile().channels(), SRC_SINC_MEDIUM_QUALITY);
+ //if(!_src_state)
+ //if(!_audConv)
+ // printf("Event::read Creation of samplerate converter with %d channels failed:%s\n", ev->sndFile().channels(), src_strerror(srcerr));
+ }
+ }
+ #endif
+}
+
+
+//void Event::write(int a, Xml& xml, const Pos& o) const { ev->write(a, xml, o); }
+void Event::write(int a, Xml& xml, const Pos& o, bool forceWavePaths) const { ev->write(a, xml, o, forceWavePaths); }
+void Event::dump(int n) const { ev->dump(n); }
+Event Event::mid(unsigned a, unsigned b) { return Event(ev->mid(a, b)); }
+
+bool Event::isNote() const { return ev->isNote(); }
+bool Event::isNoteOff() const { return ev->isNoteOff(); }
+bool Event::isNoteOff(const Event& e) const { return ev->isNoteOff(e); }
+int Event::dataA() const { return ev->dataA(); }
+int Event::pitch() const { return ev->dataA(); }
+void Event::setA(int val) { ev->setA(val); }
+void Event::setPitch(int val) { ev->setA(val); }
+int Event::dataB() const { return ev->dataB(); }
+int Event::velo() const { return ev->dataB(); }
+void Event::setB(int val) { ev->setB(val); }
+void Event::setVelo(int val) { ev->setB(val); }
+int Event::dataC() const { return ev->dataC(); }
+int Event::veloOff() const { return ev->dataC(); }
+void Event::setC(int val) { ev->setC(val); }
+void Event::setVeloOff(int val) { ev->setC(val); }
+
+const unsigned char* Event::data() const { return ev->data(); }
+int Event::dataLen() const { return ev->dataLen(); }
+void Event::setData(const unsigned char* data, int len) { ev->setData(data, len); }
+const EvData Event::eventData() const { return ev->eventData(); }
+
+const QString Event::name() const { return ev->name(); }
+void Event::setName(const QString& s) { ev->setName(s); }
+int Event::spos() const { return ev->spos(); }
+void Event::setSpos(int s) { ev->setSpos(s); }
+SndFileR Event::sndFile() const { return ev->sndFile(); }
+
+//void Event::setSndFile(SndFileR& sf) { ev->setSndFile(sf); }
+void Event::setSndFile(SndFileR& sf)
+{
+ ev->setSndFile(sf);
+
+ #ifdef USE_SAMPLERATE
+ //if(_audConv)
+// if(_audConv && !sf.isNull())
+// {
+ //_audConv->setSndFile(sf);
+ //if(sf.isNull())
+ // AudioConverter::release(_audConv);
+ //else
+// _audConv->setChannels(sf.channels());
+// }
+
+ if(_audConv)
+ {
+ // Do we release? Or keep the converter around, while gaining speed since no rapid creation/destruction.
+ //if(sf.isNull())
+ // _audConv = AudioConverter::release(_audConv);
+ //else
+ // _audConv->setChannels(sf.channels());
+ if(!sf.isNull())
+ _audConv->setChannels(sf.channels());
+ }
+ else
+ {
+ if(!sf.isNull())
+ _audConv = new SRCAudioConverter(ev->sndFile().channels(), SRC_SINC_MEDIUM_QUALITY);
+ }
+ #endif
+}
+
+//void Event::read(unsigned offset, float** bpp, int channels, int nn, bool overwrite)
+//void Event::readAudio(unsigned offset, float** bpp, int channels, int nn, bool doSeek, bool overwrite)
+// p3.3.33
+void Event::readAudio(WavePart* part, unsigned offset, float** bpp, int channels, int nn, bool doSeek, bool overwrite)
+ {
+ //ev->read(offset, bpp, channels, nn, overwrite);
+ //ev->readAudio(offset, bpp, channels, nn, doSeek, overwrite);
+ //_sfCurFrame = ev->readAudio(_src_state, _sfCurFrame, offset, bpp, channels, nn, doSeek, overwrite);
+ // p3.3.33
+ ev->readAudio(part, offset, bpp, channels, nn, doSeek, overwrite);
+ }
+void Event::setTick(unsigned val) { ev->setTick(val); }
+unsigned Event::tick() const { return ev->tick(); }
+unsigned Event::frame() const { return ev->frame(); }
+void Event::setFrame(unsigned val) { ev->setFrame(val); }
+void Event::setLenTick(unsigned val) { ev->setLenTick(val); }
+void Event::setLenFrame(unsigned val) { ev->setLenFrame(val); }
+unsigned Event::lenTick() const { return ev->lenTick(); }
+unsigned Event::lenFrame() const { return ev->lenFrame(); }
+Pos Event::end() const { return ev->end(); }
+unsigned Event::endTick() const { return ev->end().tick(); }
+unsigned Event::endFrame() const { return ev->end().frame(); }
+void Event::setPos(const Pos& p) { ev->setPos(p); }
+
diff --git a/muse2/muse/event.h b/muse2/muse/event.h
new file mode 100644
index 00000000..0b0a2fbd
--- /dev/null
+++ b/muse2/muse/event.h
@@ -0,0 +1,150 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: event.h,v 1.7.2.4 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __EVENT_H__
+#define __EVENT_H__
+
+#include <qstring.h>
+#include <map>
+//#include <samplerate.h>
+#include <sys/types.h>
+
+#include "wave.h" // wg. SndFile
+#include "pos.h"
+#include "evdata.h"
+
+enum EventType { Note, Controller, Sysex, PAfter, CAfter, Meta, Wave };
+
+class Xml;
+class EventBase;
+//class AudioConverter;
+class WavePart;
+
+//---------------------------------------------------------
+// Event
+//---------------------------------------------------------
+
+class Event {
+ EventBase* ev;
+
+ //off_t _sfCurFrame;
+ //AudioConverter* _audConv;
+
+ public:
+ //Event() { ev = 0; }
+ Event();
+ Event(EventType t);
+ Event(const Event& e);
+ Event(EventBase* eb);
+
+ //#ifdef USE_SAMPLERATE
+ //Event(EventBase* eb, AudioConverter* cv);
+ //#endif
+
+ virtual ~Event();
+
+ bool empty() const;
+ EventType type() const;
+
+ void setType(EventType t);
+ Event& operator=(const Event& e);
+ bool operator==(const Event& e) const;
+
+ int getRefCount() const;
+ bool selected() const;
+ void setSelected(bool val);
+ void move(int offset);
+
+ void read(Xml& xml);
+ //void write(int a, Xml& xml, const Pos& offset) const;
+ void write(int a, Xml& xml, const Pos& offset, bool ForceWavePaths = false) const;
+ void dump(int n = 0) const;
+ Event clone();
+ Event mid(unsigned a, unsigned b);
+
+ bool isNote() const;
+ bool isNoteOff() const;
+ bool isNoteOff(const Event& e) const;
+ int dataA() const;
+ int pitch() const;
+ void setA(int val);
+ void setPitch(int val);
+ int dataB() const;
+ int velo() const;
+ void setB(int val);
+ void setVelo(int val);
+ int dataC() const;
+ int veloOff() const;
+ void setC(int val);
+ void setVeloOff(int val);
+
+ const unsigned char* data() const;
+ int dataLen() const;
+ void setData(const unsigned char* data, int len);
+ const EvData eventData() const;
+
+ const QString name() const;
+ void setName(const QString& s);
+ int spos() const;
+ void setSpos(int s);
+ //AudioConverter* audioConverter() { return _audConv;}
+ SndFileR sndFile() const;
+ virtual void setSndFile(SndFileR& sf);
+
+ //virtual void read(unsigned offset, float** bpp, int channels, int nn, bool overwrite = true);
+ //virtual void readAudio(unsigned /*offset*/, float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/);
+ virtual void readAudio(WavePart* /*part*/, unsigned /*offset*/, float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/);
+
+ void setTick(unsigned val);
+ unsigned tick() const;
+ unsigned frame() const;
+ void setFrame(unsigned val);
+ void setLenTick(unsigned val);
+ void setLenFrame(unsigned val);
+ unsigned lenTick() const;
+ unsigned lenFrame() const;
+ Pos end() const;
+ unsigned endTick() const;
+ unsigned endFrame() const;
+ void setPos(const Pos& p);
+ };
+
+typedef std::multimap <unsigned, Event, std::less<unsigned> > EL;
+typedef EL::iterator iEvent;
+typedef EL::reverse_iterator riEvent;
+typedef EL::const_iterator ciEvent;
+typedef std::pair <iEvent, iEvent> EventRange;
+
+//---------------------------------------------------------
+// EventList
+// tick sorted list of events
+//---------------------------------------------------------
+
+class EventList : public EL {
+ int ref; // number of references to this EventList
+ int aref; // number of active references (exclude undo list)
+ void deselect();
+
+ public:
+ EventList() { ref = 0; aref = 0; }
+ ~EventList() {}
+
+ void incRef(int n) { ref += n; }
+ int refCount() const { return ref; }
+ void incARef(int n) { aref += n; }
+ int arefCount() const { return aref; }
+
+ iEvent find(const Event&);
+ iEvent add(Event& event);
+ void move(Event& event, unsigned tick);
+ void dump() const;
+ void read(Xml& xml, const char* name, bool midi);
+ };
+
+#endif
+
diff --git a/muse2/muse/eventbase.h b/muse2/muse/eventbase.h
new file mode 100644
index 00000000..6684bf57
--- /dev/null
+++ b/muse2/muse/eventbase.h
@@ -0,0 +1,97 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: eventbase.h,v 1.3.2.3 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __EVENTBASE_H__
+#define __EVENTBASE_H__
+
+//#include <samplerate.h>
+#include <sys/types.h>
+
+#include "pos.h"
+#include "event.h"
+
+//class AudioConverter;
+class WavePart;
+
+//---------------------------------------------------------
+// EventBase
+//---------------------------------------------------------
+
+class EventBase : public PosLen {
+ EventType _type;
+
+ protected:
+ int refCount;
+ bool _selected;
+
+ public:
+ EventBase(EventType t);
+ EventBase(const EventBase& ev);
+
+ virtual ~EventBase() {}
+
+ int getRefCount() const { return refCount; }
+ EventType type() const { return _type; }
+ void setType(EventType t) { _type = t; }
+ bool selected() const { return _selected; }
+ void setSelected(bool val) { _selected = val; }
+
+ void move(int offset);
+
+ virtual void read(Xml&) = 0;
+ //virtual void write(int, Xml&, const Pos& offset) const = 0;
+ virtual void write(int, Xml&, const Pos& offset, bool forcePath = false) const = 0;
+ virtual void dump(int n = 0) const;
+ virtual EventBase* mid(unsigned, unsigned) = 0;
+ friend class Event;
+
+ virtual bool isNote() const { return false; }
+ virtual bool isNoteOff() const { return false; }
+ virtual bool isNoteOff(const Event&) const { return false; }
+ virtual int pitch() const { return 0; }
+ virtual int program() const { return 0; }
+ virtual int cntrl() const { return 0; }
+ virtual int dataA() const { return 0; }
+ virtual void setA(int) { }
+ virtual void setPitch(int) { }
+
+ virtual int cntrlVal() const { return 0; }
+ virtual int dataB() const { return 0; }
+ virtual int velo() const { return 0; }
+ virtual void setB(int) { }
+ virtual void setVelo(int) { }
+
+ virtual int veloOff() const { return 0; }
+ virtual int dataC() const { return 0; }
+ virtual void setC(int) { }
+ virtual void setVeloOff(int) { }
+
+ virtual const unsigned char* data() const { return 0; }
+ virtual int dataLen() const { return 0; }
+ virtual void setData(const unsigned char*, int) { }
+ virtual const EvData eventData() const { return EvData(); }
+
+ virtual const QString name() const { return QString("?"); }
+ virtual void setName(const QString&) { }
+ virtual int spos() const { return 0; }
+ virtual void setSpos(int) { }
+ virtual SndFileR sndFile() const { return 0; }
+ virtual void setSndFile(SndFileR&) { }
+ virtual EventBase* clone() = 0;
+
+ //virtual void read(unsigned /*offset*/, float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool overwrite = true) {}
+ //virtual void readAudio(unsigned /*offset*/, float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/) {}
+ //virtual off_t readAudio(SRC_STATE* /*src_state*/, off_t /*sfCurFrame*/, unsigned /*offset*/,
+ // float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/) { return 0; }
+ //virtual off_t readAudio(AudioConverter* /*audConv*/, off_t /*sfCurFrame*/, unsigned /*offset*/,
+ // float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/) { return 0; }
+ virtual void readAudio(WavePart* /*part*/, unsigned /*offset*/,
+ float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/) { }
+ };
+#endif
+
diff --git a/muse2/muse/eventlist.cpp b/muse2/muse/eventlist.cpp
new file mode 100644
index 00000000..23fffc8c
--- /dev/null
+++ b/muse2/muse/eventlist.cpp
@@ -0,0 +1,112 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: eventlist.cpp,v 1.7.2.3 2009/11/05 03:14:35 terminator356 Exp $
+//
+// (C) Copyright 2000-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "tempo.h"
+#include "event.h"
+#include "xml.h"
+
+//---------------------------------------------------------
+// readEventList
+//---------------------------------------------------------
+
+void EventList::read(Xml& xml, const char* name, bool midi)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "event") {
+ Event e(midi ? Note : Wave);
+ e.read(xml);
+ add(e);
+ }
+ else
+ xml.unknown("readEventList");
+ break;
+ case Xml::TagEnd:
+ if (tag == name)
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// add
+//---------------------------------------------------------
+
+iEvent EventList::add(Event& event)
+ {
+ // Added by T356. An event list containing wave events should be sorted by
+ // frames. WaveTrack::fetchData() relies on the sorting order, and
+ // there was a bug that waveparts were sometimes muted because of
+ // incorrect sorting order (by ticks).
+ // Also, when the tempo map is changed, every wave event would have to be
+ // re-added to the event list so that the proper sorting order (by ticks)
+ // could be achieved.
+ // Note that in a med file, the tempo list is loaded AFTER all the tracks.
+ // There was a bug that all the wave events' tick values were not correct,
+ // since they were computed BEFORE the tempo map was loaded.
+ if(event.type() == Wave)
+ return std::multimap<unsigned, Event, std::less<unsigned> >::insert(std::pair<const unsigned, Event> (event.frame(), event));
+ else
+
+ return std::multimap<unsigned, Event, std::less<unsigned> >::insert(std::pair<const unsigned, Event> (event.tick(), event));
+ }
+
+//---------------------------------------------------------
+// move
+//---------------------------------------------------------
+
+void EventList::move(Event& event, unsigned tick)
+ {
+ iEvent i = find(event);
+ erase(i);
+
+ // Added by T356.
+ if(event.type() == Wave)
+ std::multimap<unsigned, Event, std::less<unsigned> >::insert(std::pair<const unsigned, Event> (tempomap.tick2frame(tick), event));
+ else
+
+ std::multimap<unsigned, Event, std::less<unsigned> >::insert(std::pair<const unsigned, Event> (tick, event));
+ }
+
+//---------------------------------------------------------
+// find
+//---------------------------------------------------------
+
+iEvent EventList::find(const Event& event)
+ {
+ // Changed by T356.
+ // Changed by Tim. p3.3.8
+ //EventRange range = equal_range(event.tick());
+ EventRange range = equal_range(event.type() == Wave ? event.frame() : event.tick());
+
+
+ for (iEvent i = range.first; i != range.second; ++i) {
+ if (i->second == event)
+ return i;
+ }
+ return end();
+ }
+
+//---------------------------------------------------------
+// dump
+//---------------------------------------------------------
+
+void EventList::dump() const
+ {
+ for (ciEvent i = begin(); i != end(); ++i)
+ i->second.dump();
+ }
+
diff --git a/muse2/muse/exportmidi.cpp b/muse2/muse/exportmidi.cpp
new file mode 100644
index 00000000..c068d719
--- /dev/null
+++ b/muse2/muse/exportmidi.cpp
@@ -0,0 +1,379 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: exportmidi.cpp,v 1.9.2.1 2009/04/01 01:37:10 terminator356 Exp $
+//
+// (C) Copyright 1999-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <qstring.h>
+
+#include "app.h"
+#include "midifile.h"
+#include "midi.h"
+#include "midictrl.h"
+#include "globals.h"
+#include "filedialog.h"
+#include "track.h"
+#include "song.h"
+#include "mpevent.h"
+#include "event.h"
+#include "marker/marker.h"
+#include "drummap.h"
+#include "gconfig.h"
+
+//---------------------------------------------------------
+// addController
+//---------------------------------------------------------
+
+static void addController(MPEventList* l, int tick, int port, int channel, int a, int b)
+ {
+ // p3.3.37
+ //if (a < 0x1000) { // 7 Bit Controller
+ if (a < CTRL_14_OFFSET) { // 7 Bit Controller
+ l->add(MidiPlayEvent(tick, port, channel, ME_CONTROLLER, a, b));
+ }
+ //else if (a < 0x20000) { // 14 Bit Controller
+ else if (a < CTRL_RPN_OFFSET) { // 14 Bit Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ int dataH = (b >> 7) & 0x7f;
+ int dataL = b & 0x7f;
+ l->add(MidiPlayEvent(tick, port, channel, ME_CONTROLLER, ctrlH, dataH));
+ l->add(MidiPlayEvent(tick+1, port, channel, ME_CONTROLLER, ctrlL, dataL));
+ }
+ //else if (a < 0x30000) { // RPN 7-Bit Controller
+ else if (a < CTRL_NRPN_OFFSET) { // RPN 7-Bit Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ l->add(MidiPlayEvent(tick, port, channel, ME_CONTROLLER, CTRL_HRPN, ctrlH));
+ l->add(MidiPlayEvent(tick+1, port, channel, ME_CONTROLLER, CTRL_LRPN, ctrlL));
+ l->add(MidiPlayEvent(tick+2, port, channel, ME_CONTROLLER, CTRL_HDATA, b));
+ }
+ //else if (a < 0x40000) { // NRPN 7-Bit Controller
+ else if (a < CTRL_INTERNAL_OFFSET) { // NRPN 7-Bit Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ l->add(MidiPlayEvent(tick, port, channel, ME_CONTROLLER, CTRL_HNRPN, ctrlH));
+ l->add(MidiPlayEvent(tick+1, port, channel, ME_CONTROLLER, CTRL_LNRPN, ctrlL));
+ l->add(MidiPlayEvent(tick+2, port, channel, ME_CONTROLLER, CTRL_HDATA, b));
+ }
+ else if (a == CTRL_PITCH) {
+ int a = b + 8192;
+ int b = a >> 7;
+ l->add(MidiPlayEvent(tick, port, channel, ME_PITCHBEND, a & 0x7f, b & 0x7f));
+ }
+ else if (a == CTRL_PROGRAM) {
+ int hb = (b >> 16) & 0xff;
+ int lb = (b >> 8) & 0xff;
+ int pr = b & 0x7f;
+ int tickoffset = 0;
+ switch(song->mtype()) {
+ case MT_GM: // no HBANK/LBANK
+ break;
+ case MT_GS:
+ case MT_XG:
+ case MT_UNKNOWN:
+ if (hb != 0xff) {
+ l->add(MidiPlayEvent(tick, port, channel, ME_CONTROLLER, CTRL_HBANK, hb));
+ ++tickoffset;
+ }
+ if (lb != 0xff) {
+ l->add(MidiPlayEvent(tick+tickoffset, port, channel, ME_CONTROLLER, CTRL_LBANK, lb));
+ ++tickoffset;
+ }
+ break;
+ }
+ l->add(MidiPlayEvent(tick+tickoffset, port, channel, ME_PROGRAM, pr, 0));
+ }
+ //else if (a < 0x60000) { // RPN14 Controller
+ else if (a < CTRL_NRPN14_OFFSET) { // RPN14 Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ int dataH = (b >> 7) & 0x7f;
+ int dataL = b & 0x7f;
+ l->add(MidiPlayEvent(tick, port, channel, ME_CONTROLLER, CTRL_HRPN, ctrlH));
+ l->add(MidiPlayEvent(tick+1, port, channel, ME_CONTROLLER, CTRL_LRPN, ctrlL));
+ l->add(MidiPlayEvent(tick+2, port, channel, ME_CONTROLLER, CTRL_HDATA, dataH));
+ l->add(MidiPlayEvent(tick+3, port, channel, ME_CONTROLLER, CTRL_LDATA, dataL));
+ }
+ //else if (a < 0x70000) { // NRPN14 Controller
+ else if (a < CTRL_NONE_OFFSET) { // NRPN14 Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ int dataH = (b >> 7) & 0x7f;
+ int dataL = b & 0x7f;
+ l->add(MidiPlayEvent(tick, port, channel, ME_CONTROLLER, CTRL_HNRPN, ctrlH));
+ l->add(MidiPlayEvent(tick+1, port, channel, ME_CONTROLLER, CTRL_LNRPN, ctrlL));
+ l->add(MidiPlayEvent(tick+2, port, channel, ME_CONTROLLER, CTRL_HDATA, dataH));
+ l->add(MidiPlayEvent(tick+3, port, channel, ME_CONTROLLER, CTRL_LDATA, dataL));
+ }
+ }
+
+//---------------------------------------------------------
+// exportMidi
+//---------------------------------------------------------
+
+void MusE::exportMidi()
+ {
+ MFile file(QString("midis"), QString(".mid"));
+
+ //FILE* fp = file.open("w", midi_file_pattern, this, false, true,
+ FILE* fp = file.open("w", midi_file_save_pattern, this, false, true,
+ tr("MusE: Export Midi"));
+ if (fp == 0)
+ return;
+ MidiFile mf(fp);
+
+ MidiTrackList* tl = song->midis();
+ int ntracks = tl->size();
+ MidiFileTrackList* mtl = new MidiFileTrackList;
+
+ int i = 0;
+ for (iMidiTrack im = tl->begin(); im != tl->end(); ++im, ++i) {
+ MidiTrack* track = *im;
+ MidiFileTrack* mft = new MidiFileTrack;
+ mtl->push_back(mft);
+ MPEventList* l = &(mft->events);
+ int port = track->outPort();
+ int channel = track->outChannel();
+
+ //---------------------------------------------------
+ // only first midi track contains
+ // - Track Marker
+ // - copyright
+ // - time signature
+ // - tempo map
+ // - GM/GS/XG Initialization
+ //---------------------------------------------------
+
+ if (i == 0) {
+ //---------------------------------------------------
+ // Write Track Marker
+ //
+ MarkerList* ml = song->marker();
+ for (ciMarker m = ml->begin(); m != ml->end(); ++m) {
+ const char* name = m->second.name().latin1();
+ int len = strlen(name);
+ MidiPlayEvent ev(m->first, port, ME_META, (unsigned char*)name, len);
+ ev.setA(0x6);
+ l->add(ev);
+ }
+
+ //---------------------------------------------------
+ // Write Copyright
+ //
+ const char* copyright = config.copyright.latin1();
+ if (copyright && *copyright) {
+ int len = strlen(copyright);
+ MidiPlayEvent ev(0, port, ME_META, (unsigned char*)copyright, len);
+ ev.setA(0x2);
+ l->add(ev);
+ }
+
+ //---------------------------------------------------
+ // Write Coment
+ //
+ QString comment = track->comment();
+ if (!comment.isEmpty()) {
+ int len = comment.length();
+ MidiPlayEvent ev(0, port, ME_META, (const unsigned char*)(comment.latin1()), len);
+ ev.setA(0x1);
+ l->add(ev);
+ }
+
+ //---------------------------------------------------
+ // Write Songtype SYSEX: GM/GS/XG
+ //
+
+ switch(song->mtype()) {
+ case MT_GM:
+ l->add(MidiPlayEvent(0, port, ME_SYSEX, gmOnMsg, gmOnMsgLen));
+ break;
+ case MT_GS:
+ l->add(MidiPlayEvent(0, port, ME_SYSEX, gmOnMsg, gmOnMsgLen));
+ l->add(MidiPlayEvent(250, port, ME_SYSEX, gsOnMsg, gsOnMsgLen));
+ break;
+ case MT_XG:
+ l->add(MidiPlayEvent(0, port, ME_SYSEX, gmOnMsg, gmOnMsgLen));
+ l->add(MidiPlayEvent(250, port, ME_SYSEX, xgOnMsg, xgOnMsgLen));
+ break;
+ case MT_UNKNOWN:
+ break;
+ }
+
+ //---------------------------------------------------
+ // Write Tempomap
+ //
+ TempoList* tl = &tempomap;
+ for (ciTEvent e = tl->begin(); e != tl->end(); ++e) {
+ TEvent* event = e->second;
+ unsigned char data[3];
+ int tempo = event->tempo;
+ data[2] = tempo & 0xff;
+ data[1] = (tempo >> 8) & 0xff;
+ data[0] = (tempo >> 16) & 0xff;
+ MidiPlayEvent ev(event->tick, port, ME_META, data, 3);
+ ev.setA(0x51);
+ l->add(ev);
+ }
+
+ //---------------------------------------------------
+ // Write Signatures
+ //
+ const SigList* sl = &sigmap;
+ for (ciSigEvent e = sl->begin(); e != sl->end(); ++e) {
+ SigEvent* event = e->second;
+ int sz = (config.exp2ByteTimeSigs ? 2 : 4); // export 2 byte timesigs instead of 4 ?
+ unsigned char data[sz];
+ data[0] = event->z;
+ switch(event->n) {
+ case 1: data[1] = 0; break;
+ case 2: data[1] = 1; break;
+ case 4: data[1] = 2; break;
+ case 8: data[1] = 3; break;
+ case 16: data[1] = 4; break;
+ case 32: data[1] = 5; break;
+ case 64: data[1] = 6; break;
+ default:
+ fprintf(stderr, "falsche Signatur; nenner %d\n", event->n);
+ break;
+ }
+ // By T356. In muse the metronome pulse is fixed at 24 (once per quarter-note).
+ // The number of 32nd notes per 24 MIDI clock signals (per quarter-note) is 8.
+ if(!config.exp2ByteTimeSigs)
+ {
+ data[2] = 24;
+ data[3] = 8;
+ }
+
+ MidiPlayEvent ev(event->tick, port, ME_META, data, sz);
+
+ ev.setA(0x58);
+ l->add(ev);
+ }
+ }
+
+ //-----------------------------------
+ // track name
+ //-----------------------------------
+
+ if (!track->name().isEmpty()) {
+ const char* name = track->name().latin1();
+ int len = strlen(name);
+ MidiPlayEvent ev(0, port, ME_META, (unsigned char*)name, len+1);
+ ev.setA(0x3); // Meta Sequence/Track Name
+ l->add(ev);
+ }
+
+ //-----------------------------------
+ // track comment
+ //-----------------------------------
+
+ if (!track->comment().isEmpty()) {
+ const char* comment = track->comment().latin1();
+ int len = strlen(comment);
+ MidiPlayEvent ev(0, port, ME_META, (unsigned char*)comment, len+1);
+ ev.setA(0xf); // Meta Text
+ l->add(ev);
+ }
+ PartList* parts = track->parts();
+ for (iPart p = parts->begin(); p != parts->end(); ++p) {
+ MidiPart* part = (MidiPart*) (p->second);
+ EventList* evlist = part->events();
+ for (iEvent i = evlist->begin(); i != evlist->end(); ++i) {
+ Event ev = i->second;
+ int tick = ev.tick() + part->tick();
+
+ switch (ev.type()) {
+ case Note:
+ {
+ if (ev.velo() == 0) {
+ printf("Warning: midi note has velocity 0, (ignored)\n");
+ continue;
+ }
+ int pitch;
+ if (track->type() == Track::DRUM) {
+ //
+ // Map drum-notes to the drum-map values
+ //
+ int instr = ev.pitch();
+ pitch = drumMap[instr].anote;
+ // port = drumMap[instr].port;
+ // channel = drumMap[instr].channel;
+ }
+ else
+ pitch = ev.pitch();
+
+ int velo = ev.velo();
+ int len = ev.lenTick();
+
+ //---------------------------------------
+ // apply trackinfo values
+ //---------------------------------------
+
+ if (track->transposition
+ || track->velocity
+ || track->compression != 100
+ || track->len != 100) {
+ pitch += track->transposition;
+ if (pitch > 127)
+ pitch = 127;
+ if (pitch < 0)
+ pitch = 0;
+
+ velo += track->velocity;
+ velo = (velo * track->compression) / 100;
+ if (velo > 127)
+ velo = 127;
+ if (velo < 1) // no off event
+ velo = 1;
+ len = (len * track->len) / 100;
+ }
+ if (len <= 0)
+ len = 1;
+ l->add(MidiPlayEvent(tick, port, channel, ME_NOTEON, pitch, velo));
+
+ if(config.expOptimNoteOffs) // Save space by replacing note offs with note on velocity 0
+ l->add(MidiPlayEvent(tick+len, port, channel, ME_NOTEON, pitch, 0));
+ else
+ l->add(MidiPlayEvent(tick+len, port, channel, ME_NOTEOFF, pitch, velo));
+ }
+ break;
+
+ case Controller:
+ addController(l, tick, port, channel, ev.dataA(), ev.dataB());
+ break;
+
+ case Sysex:
+ l->add(MidiPlayEvent(tick, port, ME_SYSEX, ev.eventData()));
+ break;
+
+ case PAfter:
+ l->add(MidiPlayEvent(tick, port, channel, ME_AFTERTOUCH, ev.dataA(), ev.dataB()));
+ break;
+
+ case CAfter:
+ l->add(MidiPlayEvent(tick, port, channel, ME_POLYAFTER, ev.dataA(), ev.dataB()));
+ break;
+
+ case Meta:
+ {
+ MidiPlayEvent mpev(tick, port, ME_META, ev.eventData());
+ mpev.setA(ev.dataA());
+ l->add(mpev);
+ }
+ break;
+ case Wave:
+ break;
+ }
+ }
+ }
+ }
+ mf.setDivision(config.midiDivision);
+ mf.setMType(song->mtype());
+ mf.setTrackList(mtl, ntracks);
+ mf.write();
+ }
+
diff --git a/muse2/muse/fastlog.h b/muse2/muse/fastlog.h
new file mode 100644
index 00000000..23710a8b
--- /dev/null
+++ b/muse2/muse/fastlog.h
@@ -0,0 +1,38 @@
+/* Copyright unknown. Code by Laurent de Soras <laurent@ohmforce.com>.
+ */
+
+#ifndef __pbd_fastlog_h__
+#define __pbd_fastlog_h__
+
+#include <math.h> /* for HUGE_VAL */
+
+static inline float fast_log2 (float val)
+ {
+ /* don't use reinterpret_cast<> because that prevents this
+ from being used by pure C code (for example, GnomeCanvasItems)
+ */
+ union {float f; int i;} t;
+ t.f = val;
+ int* const exp_ptr = &t.i;
+ int x = *exp_ptr;
+ const int log_2 = ((x >> 23) & 255) - 128;
+ x &= ~(255 << 23);
+ x += 127 << 23;
+ *exp_ptr = x;
+ val = ((-1.0f/3) * t.f + 2) * t.f - 2.0f/3;
+ return (val + log_2);
+ }
+
+static inline float fast_log (const float val)
+ {
+ return (fast_log2 (val) * 0.69314718f);
+ }
+
+static inline float fast_log10 (const float val)
+ {
+ return fast_log2(val) / 3.312500f;
+ }
+
+static inline float minus_infinity() { return -HUGE_VAL; }
+
+#endif /* __pbd_fastlog_h__ */
diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp
new file mode 100644
index 00000000..be92b6aa
--- /dev/null
+++ b/muse2/muse/gconfig.cpp
@@ -0,0 +1,135 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: gconfig.cpp,v 1.15.2.13 2009/12/01 03:52:40 terminator356 Exp $
+//
+// (C) Copyright 1999-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "gconfig.h"
+
+GlobalConfigValues config = {
+ {
+ QColor(0xff, 0xff, 0xff), // palette
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff)
+ },
+ {
+ QColor(255, 232, 140), // part colors
+ QColor(0xff, 0x00, 0x00),
+ QColor(0x00, 0xff, 0x00),
+ QColor(0x00, 0x00, 0xff),
+ QColor(0xff, 0xff, 0x00),
+ QColor(0x00, 0xff, 0xff),
+ QColor(0xff, 0x00, 0xff),
+ QColor(0x9f, 0xc7, 0xef),
+ QColor(0x00, 0xff, 0x7f),
+ QColor(0x7f, 0x00, 0x00),
+ QColor(0x00, 0x7f, 0x00),
+ QColor(0x00, 0x00, 0x7f),
+ QColor(0x7f, 0x7f, 0x3f),
+ QColor(0x00, 0x7f, 0x7f),
+ QColor(0x7f, 0x00, 0x7f),
+ QColor(0x00, 0x7f, 0xff),
+ QColor(0x00, 0x3f, 0x3f)
+ },
+ QColor(0, 0, 255), // transportHandleColor;
+ QColor(255, 0, 0), // bigTimeForegroundColor;
+ QColor(0, 0, 0), // bigTimeBackgroundColor;
+ QColor(200, 200, 200), // waveEditBackgroundColor;
+ {
+ QFont(QString("arial"), 10, QFont::Normal),
+ QFont(QString("arial"), 8, QFont::Normal),
+ QFont(QString("arial"), 10, QFont::Normal),
+ QFont(QString("arial"), 10, QFont::Bold),
+ QFont(QString("arial"), 8, QFont::Bold), // timescale numbers
+ QFont(QString("Lucidatypewriter"), 14, QFont::Bold),
+ QFont(QString("arial"), 8, QFont::Bold, true) // Mixer strip labels. Looks and fits better with bold + italic than bold alone,
+ // at the price of only few more pixels than Normal mode.
+ },
+ QColor(84, 97, 114), // trackBg;
+ QColor(0x80, 0xff, 0x80), // selected track Bg;
+ QColor(0x00, 0x00, 0x00), // selected track Fg;
+ QColor(220, 220, 220), // midiTrackBg;
+ QColor(255, 170, 0), // ctrlGraphFg; Medium orange
+ QColor(220, 220, 220), // drumTrackBg;
+ QColor(220, 220, 220), // waveTrackBg;
+ QColor(189, 220, 193), // outputTrackBg;
+ QColor(189, 220, 193), // inputTrackBg;
+ QColor(220, 220, 220), // groupTrackBg;
+ QColor(220, 220, 220), // auxTrackBg;
+ QColor(220, 220, 220), // synthTrackBg;
+ QColor(98, 124, 168), // part canvas bg
+ QColor(0, 0, 0), // mixerBg;
+
+ 384, // division;
+ 1024, // rtcTicks
+ -60, // int minMeter;
+ -60.0, // double minSlider;
+ false, // use Jack freewheel
+ 20, // int guiRefresh;
+ QString(""), // helpBrowser
+ true, // extendedMidi
+ 384, // division for smf export
+ QString(""), // copyright string for smf export
+ 1, // smf export file format
+ false, // midi export file 2 byte timesigs instead of 4
+ true, // optimize midi export file note offs
+ true, // Split imported tracks into multiple parts.
+ 1, // startMode
+ QString(""), // start song path
+ 384, // gui division
+ QRect(0, 0, 400, 300), // GeometryMain;
+ QRect(0, 0, 200, 100), // GeometryTransport;
+ QRect(0, 0, 600, 200), // GeometryBigTime;
+ QRect(0, 0, 400, 300), // GeometryPianoroll;
+ QRect(0, 0, 400, 300), // GeometryDrumedit;
+ //QRect(0, 0, 300, 500), // GeometryMixer; // Obsolete
+ {
+ QString("Mixer A"),
+ QRect(0, 0, 300, 500), // Mixer1
+ true, true, true, true,
+ true, true, true, true
+ },
+ {
+ QString("Mixer B"),
+ QRect(200, 200, 300, 500), // Mixer2
+ true, true, true, true,
+ true, true, true, true
+ },
+ true, // TransportVisible;
+ false, // BigTimeVisible;
+ false, // mixer1Visible;
+ false, // mixer2Visible;
+
+ false, // markerVisible;
+ true, // showSplashScreen
+ 1, // canvasShowPartType 1 - names, 2 events
+ 5, // canvasShowPartEvent
+ true, // canvasShowGrid;
+ QString(""), // canvasBgPixmap;
+ QString(""), // style
+ QString("sweep"), // externalWavEditor
+ false, // useOldStyleStopShortCut
+ true, // moveArmedCheckBox
+ true, // useDenormalBias
+ false, // useOutputLimiter
+ true, // showDidYouKnow
+ false, // vstInPlace Enable VST in-place processing
+ 44100, // Dummy audio preferred sample rate
+ 512 // Dummy audio buffer size
+ };
+
diff --git a/muse2/muse/gconfig.h b/muse2/muse/gconfig.h
new file mode 100644
index 00000000..454ed05d
--- /dev/null
+++ b/muse2/muse/gconfig.h
@@ -0,0 +1,132 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: gconfig.h,v 1.12.2.10 2009/12/01 03:52:40 terminator356 Exp $
+//
+// (C) Copyright 1999-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#include <qcolor.h>
+#include <qfont.h>
+#include <qstring.h>
+#include <qrect.h>
+
+#define NUM_PARTCOLORS 17
+#define NUM_FONTS 7
+
+class Xml;
+
+//---------------------------------------------------------
+// MixerConfig
+//---------------------------------------------------------
+
+struct MixerConfig {
+ QString name;
+ QRect geometry;
+ bool showMidiTracks;
+ bool showDrumTracks;
+ bool showInputTracks;
+ bool showOutputTracks;
+ bool showWaveTracks;
+ bool showGroupTracks;
+ bool showAuxTracks;
+ bool showSyntiTracks;
+
+ //void write(Xml&, const char* name);
+ //void write(int level, Xml& xml, const char* name);
+ void write(int level, Xml& xml);
+ //void read(QDomNode);
+ //void read(Xml& xml, const QString& name);
+ void read(Xml& xml);
+ };
+
+//---------------------------------------------------------
+// GlobalConfigValues
+//---------------------------------------------------------
+
+struct GlobalConfigValues {
+ QColor palette[16];
+ QColor partColors[NUM_PARTCOLORS];
+ QColor transportHandleColor;
+ QColor bigTimeForegroundColor;
+ QColor bigTimeBackgroundColor;
+ QColor waveEditBackgroundColor;
+ //QFont fonts[6];
+ QFont fonts[NUM_FONTS];
+ QColor trackBg;
+ QColor selectTrackBg;
+ QColor selectTrackFg;
+ QColor midiTrackBg;
+ QColor ctrlGraphFg;
+ QColor drumTrackBg;
+ QColor waveTrackBg;
+ QColor outputTrackBg;
+ QColor inputTrackBg;
+ QColor groupTrackBg;
+ QColor auxTrackBg;
+ QColor synthTrackBg;
+ QColor partCanvasBg;
+ QColor mixerBg;
+
+ int division;
+ int rtcTicks;
+ int minMeter;
+ double minSlider;
+ bool freewheelMode;
+ int guiRefresh;
+ QString helpBrowser;
+
+ bool extendedMidi; // extended smf format
+ int midiDivision; // division for smf export
+ QString copyright; // copyright string for smf export
+ int smfFormat; // smf export file type
+ bool exp2ByteTimeSigs; // Export 2 byte time sigs instead of 4 bytes
+ bool expOptimNoteOffs; // Save space by replacing note offs with note on velocity 0
+ bool importMidiSplitParts; // Split imported tracks into multiple parts.
+
+ int startMode; // 0 - start with last song
+ // 1 - start with default template
+ // 2 - start with song
+ QString startSong; // path for start song
+ int guiDivision; // division for tick display
+
+ QRect geometryMain;
+ QRect geometryTransport;
+ QRect geometryBigTime;
+ QRect geometryPianoroll;
+ QRect geometryDrumedit;
+// QRect geometryMixer;
+ MixerConfig mixer1;
+ MixerConfig mixer2;
+ bool transportVisible;
+ bool bigTimeVisible;
+// bool mixerVisible;
+ bool mixer1Visible;
+ bool mixer2Visible;
+ bool markerVisible;
+
+ bool showSplashScreen;
+ int canvasShowPartType; // 1 - names, 2 events
+ int canvasShowPartEvent; //
+ bool canvasShowGrid;
+ QString canvasBgPixmap;
+ QString style;
+
+ QString externalWavEditor;
+ bool useOldStyleStopShortCut;
+ bool moveArmedCheckBox;
+ bool useDenormalBias;
+ bool useOutputLimiter;
+ bool showDidYouKnow;
+ bool vstInPlace; // Enable VST in-place processing
+ int dummyAudioSampleRate;
+ int dummyAudioBufSize;
+ };
+
+extern GlobalConfigValues config;
+
+#endif
+
diff --git a/muse2/muse/givertcap.c b/muse2/muse/givertcap.c
new file mode 100644
index 00000000..2511bc6c
--- /dev/null
+++ b/muse2/muse/givertcap.c
@@ -0,0 +1,94 @@
+/*
+ * COPYRIGHT
+ *
+ * This file is part of Mustajuuri GPL modules. You may distribute it
+ * with or without other Mustajuuri components.
+ *
+ * Author: Tommi Ilmonen, 2001.
+ * Tommi.Ilmonen@hut.fi
+ *
+ * http://www.tml.hut.fi/~tilmonen/mustajuuri/
+
+ * This app also has its own home page at (installation instruction
+ * etc.): http://www.tml.hut.fi/~tilmonen/givertcap/
+
+ * This file is licensed under the GNU Public License (GPL) version
+ * 2. The GPL can also be found from the givertcap home page. Any
+ * application may call civertcap (regardless of the license of the
+ * calling application).
+
+ * If you want a parallel license (for commercial reasons for example),
+ * you should negotiate the matter with the author(s).
+ *
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#undef _POSIX_SOURCE
+#include <sys/capability.h>
+/* If the compilation fails on the preceding line, then you probably
+ do not have the libcap installed.
+
+*/
+
+static void usage(const char *programName)
+{
+ fprintf(stderr,
+ "usage: %s \n\n"
+ " This program gives real-time application capabilities to the"
+ " parent process\n\n"
+ "[Copyright (c) 2001 Tommi Ilmonen <Tommi.Ilmonen@hut.fi>]\n"
+ "Home page: http://www.tml.hut.fi/~tilmonen/givertcap/\n",
+ programName);
+}
+
+int main(int argc, char **argv)
+{
+ if(argc > 1) {
+ usage(argv[0]);
+ return 1;
+ }
+
+ pid_t parentPid = getppid();
+
+ if(!parentPid)
+ return 1;
+
+ cap_t caps = cap_init();
+
+#define nofCaps 3
+
+ /* We need these capabilities:
+
+ CAP_SYS_NICE -> Real-time priority
+ CAP_SYS_RESOURCE -> RTC above 64 Hz
+ CAP_IPC_LOCK -> mlockall
+ */
+
+ cap_value_t capList[nofCaps] =
+ { CAP_SYS_NICE, CAP_SYS_RESOURCE, CAP_IPC_LOCK} ;
+
+ cap_clear(caps);
+ cap_set_flag(caps, CAP_EFFECTIVE, nofCaps, capList , CAP_SET);
+ cap_set_flag(caps, CAP_INHERITABLE, nofCaps, capList , CAP_SET);
+ cap_set_flag(caps, CAP_PERMITTED, nofCaps, capList , CAP_SET);
+
+ /* If your COMPILATION FAILS here then you probably are not running
+ Linux. the function "capsetp" is not part of the POSIX capability
+ standard, but a Linux-specific extension. */
+ if (capsetp(parentPid, caps)) {
+ perror("mjsucaps: capsetp");
+ return 1;
+ }
+
+ ssize_t x;
+// printf("The process %d was give capabilities %s\n",
+// (int) parentPid, cap_to_text(caps, &x));
+ fflush(0);
+
+ // Don't bother to free the memory...
+
+ return 0;
+}
diff --git a/muse2/muse/globaldefs.h b/muse2/muse/globaldefs.h
new file mode 100644
index 00000000..06661771
--- /dev/null
+++ b/muse2/muse/globaldefs.h
@@ -0,0 +1,34 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: globaldefs.h,v 1.3.2.1 2009/05/03 04:14:00 terminator356 Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __GLOBALDEFS_H__
+#define __GLOBALDEFS_H__
+
+// Midi Type
+// MT_GM - General Midi
+// MT_GS - Roland GS
+// MT_XG - Yamaha XG
+
+enum MType { MT_UNKNOWN=0, MT_GM, MT_GS, MT_XG };
+
+enum AutomationType {
+ AUTO_OFF, AUTO_READ, AUTO_TOUCH, AUTO_WRITE
+ };
+
+const int MAX_CHANNELS = 2; // max audio channels
+const int MAX_PLUGINS = 4; // plugins in mixer rack
+
+//const int MIDI_PORTS = 32; // max Number of Midi Ports
+const int MIDI_PORTS = 128; // max Number of Midi Ports
+
+#ifndef MIDI_CHANNELS
+#define MIDI_CHANNELS 16 // Channels per Port
+#endif
+
+#endif
+
diff --git a/muse2/muse/globals.cpp b/muse2/muse/globals.cpp
new file mode 100644
index 00000000..4e57cafd
--- /dev/null
+++ b/muse2/muse/globals.cpp
@@ -0,0 +1,396 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: globals.cpp,v 1.15.2.11 2009/11/25 09:09:43 terminator356 Exp $
+//
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <qpixmap.h>
+//Added by qt3to4:
+#include <Q3ActionGroup>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <qobject.h>
+#include "globals.h"
+#include "config.h"
+
+int recFileNumber = 1;
+
+int sampleRate = 44100;
+unsigned segmentSize = 1024U; // segmentSize in frames (set by JACK)
+unsigned fifoLength = 128; // 131072/segmentSize
+ // 131072 - magic number that gives a sufficient buffer size
+int segmentCount = 2;
+
+// denormal bias value used to eliminate the manifestation of denormals by
+// lifting the zero level slightly above zero
+// denormal problems occur when values get extremely close to zero
+const float denormalBias=1e-18;
+
+bool overrideAudioOutput = false;
+bool overrideAudioInput = false;
+
+QTimer* heartBeatTimer;
+
+bool hIsB = true; // call note h "b"
+
+const signed char sharpTab[14][7] = {
+ { 0, 3, -1, 2, 5, 1, 4 },
+ { 0, 3, -1, 2, 5, 1, 4 },
+ { 0, 3, -1, 2, 5, 1, 4 },
+ { 0, 3, -1, 2, 5, 1, 4 },
+ { 2, 5, 1, 4, 7, 3, 6 },
+ { 2, 5, 1, 4, 7, 3, 6 },
+ { 2, 5, 1, 4, 7, 3, 6 },
+ { 4, 0, 3, -1, 2, 5, 1 },
+ { 7, 3, 6, 2, 5, 1, 4 },
+ { 5, 8, 4, 7, 3, 6, 2 },
+ { 3, 6, 2, 5, 1, 4, 7 },
+ { 1, 4, 0, 3, 6, 2, 5 },
+ { 6, 2, 5, 1, 4, 0, 3 },
+ { 0, 3, -1, 2, 5, 1, 4 },
+ };
+const signed char flatTab[14][7] = {
+ { 4, 1, 5, 2, 6, 3, 7 },
+ { 4, 1, 5, 2, 6, 3, 7 },
+ { 4, 1, 5, 2, 6, 3, 7 },
+ { 4, 1, 5, 2, 6, 3, 7 },
+ { 6, 3, 7, 4, 8, 5, 9 },
+ { 6, 3, 7, 4, 8, 5, 9 },
+ { 6, 3, 7, 4, 8, 5, 9 },
+
+ { 1, 5, 2, 6, 3, 7, 4 },
+ { 4, 1, 5, 2, 6, 3, 7 },
+ { 2, 6, 3, 7, 4, 8, 5 },
+ { 7, 4, 1, 5, 2, 6, 3 },
+ { 5, 2, 6, 3, 7, 4, 8 },
+ { 3, 0, 4, 1, 5, 2, 6 },
+ { 4, 1, 5, 2, 6, 3, 7 },
+ };
+
+QString museGlobalLib;
+QString museGlobalShare;
+QString museUser;
+QString museProject;
+QString museProjectInitPath("./");
+QString configName;
+QString museInstruments;
+QString museUserInstruments;
+
+QString lastWavePath(".");
+QString lastMidiPath(".");
+
+bool debugMode = false;
+bool debugMsg = false;
+bool midiInputTrace = false;
+bool midiOutputTrace = false;
+bool realTimeScheduling = false;
+int realTimePriority = 40; // 80
+int midiRTPrioOverride = -1;
+bool loadPlugins = true;
+bool loadVST = true;
+bool loadDSSI = true;
+bool usePythonBridge = false;
+bool useLASH = true;
+
+/*
+const char* midi_file_pattern[] = {
+ QT_TR_NOOP("Midi/Kar (*.mid *.MID *.kar *.KAR *.mid.gz *.mid.bz2)"),
+ QT_TR_NOOP("Midi (*.mid *.MID *.mid.gz *.mid.bz2)"),
+ QT_TR_NOOP("Karaoke (*.kar *.KAR *.kar.gz *.kar.bz2)"),
+ QT_TR_NOOP("All Files (*)"),
+ 0
+ };
+*/
+const QStringList midi_file_pattern =
+ QStringList::split(";;", QT_TR_NOOP(
+ QString("Midi/Kar (*.mid *.MID *.kar *.KAR *.mid.gz *.mid.bz2);;") +
+ QString("Midi (*.mid *.MID *.mid.gz *.mid.bz2);;") +
+ QString("Karaoke (*.kar *.KAR *.kar.gz *.kar.bz2);;") +
+ QString("All Files (*)")) );
+
+//FIXME: By T356 01/19/2010
+// If saving as a compressed file (gz or bz2),
+// the file is a pipe, and pipes can't seek !
+// This results in a corrupted midi file from MidiFile::writeTrack().
+// So exporting compressed midi has simply been disabled here for now...
+/*
+const char* midi_file_save_pattern[] = {
+ "Midi (*.mid)",
+ "gzip compressed Midi (*.mid.gz)",
+ "bzip2 compressed Midi (*.mid.bz2)",
+ "Karaoke (*.kar)",
+ "gzip compressed karaoke (*.kar.gz)",
+ "bzip2 compressed karaoke (*.kar.bz2)",
+ "All Files (*)",
+ 0
+ };
+QStringList midi_file_save_pattern =
+ QStringList::split(";;", QT_TR_NOOP(
+ QString("Midi (*.mid);;") +
+ QString("gzip compressed Midi (*.mid.gz);;") +
+ QString("bzip2 compressed Midi (*.mid.bz2);;") +
+ QString("Karaoke (*.kar);;") +
+ QString("gzip compressed karaoke (*.kar.gz);;") +
+ QString("bzip2 compressed karaoke (*.kar.bz2);;") +
+ QString("All Files (*)")) );
+*/
+/*
+const char* midi_file_save_pattern[] = {
+ QT_TR_NOOP("Midi (*.mid)"),
+ QT_TR_NOOP("Karaoke (*.kar)"),
+ QT_TR_NOOP("All Files (*)"),
+ 0
+ };
+*/
+const QStringList midi_file_save_pattern =
+ QStringList::split(";;", QT_TR_NOOP(
+ QString("Midi (*.mid);;") +
+ QString("Karaoke (*.kar);;") +
+ QString("All Files (*)")) );
+
+/*
+const char* med_file_pattern[] = {
+ QT_TR_NOOP("med Files (*.med *.med.gz *.med.bz2)"),
+ QT_TR_NOOP("Uncompressed med Files (*.med)"),
+ QT_TR_NOOP("gzip compressed med Files (*.med.gz)"),
+ QT_TR_NOOP("bzip2 compressed med Files (*.med.bz2)"),
+ QT_TR_NOOP("All Files (*)"),
+ 0
+ };
+const char* med_file_save_pattern[] = {
+ QT_TR_NOOP("Uncompressed med Files (*.med)"),
+ QT_TR_NOOP("gzip compressed med Files (*.med.gz)"),
+ QT_TR_NOOP("bzip2 compressed med Files (*.med.bz2)"),
+ QT_TR_NOOP("All Files (*)"),
+ 0
+ };
+*/
+const QStringList med_file_pattern =
+ QStringList::split(";;", QT_TR_NOOP(
+ QString("med Files (*.med *.med.gz *.med.bz2);;") +
+ QString("Uncompressed med Files (*.med);;") +
+ QString("gzip compressed med Files (*.med.gz);;") +
+ QString("bzip2 compressed med Files (*.med.bz2);;") +
+ QString("All Files (*)")) );
+const QStringList med_file_save_pattern =
+ QStringList::split(";;", QT_TR_NOOP(
+ QString("Uncompressed med Files (*.med);;") +
+ QString("gzip compressed med Files (*.med.gz);;") +
+ QString("bzip2 compressed med Files (*.med.bz2);;") +
+ QString("All Files (*)")) );
+
+/*
+const char* image_file_pattern[] = {
+ QT_TR_NOOP("(*.jpg *.gif *.png)"),
+ QT_TR_NOOP("(*.jpg)"),
+ QT_TR_NOOP("(*.gif)"),
+ QT_TR_NOOP("(*.png)"),
+ QT_TR_NOOP("All Files (*)"),
+ 0
+ };
+*/
+const QStringList image_file_pattern =
+ QStringList::split(";;", QT_TR_NOOP(
+ QString("(*.jpg *.gif *.png);;") +
+ QString("(*.jpg);;") +
+ QString("(*.gif);;") +
+ QString("(*.png);;") +
+ QString("All Files (*)")) );
+
+// Not used.
+/*
+const char* ctrl_file_pattern[] = {
+ "ctrl Files (*.ctrl *.ctrl.gz *.ctrl.bz2)",
+ "All Files (*)",
+ 0
+ };
+*/
+
+/*
+const char* part_file_pattern[] = {
+ //QT_TR_NOOP("part Files (*.mpt)"),
+ QT_TR_NOOP("part Files (*.mpt *.mpt.gz *.mpt.bz2)"),
+ QT_TR_NOOP("All Files (*)"),
+ 0
+ };
+const char* part_file_save_pattern[] = {
+ QT_TR_NOOP("part Files (*.mpt)"),
+ QT_TR_NOOP("gzip compressed part Files (*.mpt.gz)"),
+ QT_TR_NOOP("bzip2 compressed part Files (*.mpt.bz2)"),
+ QT_TR_NOOP("All Files (*)"),
+ 0
+ };
+*/
+const QStringList part_file_pattern =
+ QStringList::split(";;", QT_TR_NOOP(
+ QString("part Files (*.mpt *.mpt.gz *.mpt.bz2);;") +
+ QString("All Files (*)")) );
+
+const QStringList part_file_save_pattern =
+ QStringList::split(";;", QT_TR_NOOP(
+ QString("part Files (*.mpt);;") +
+ QString("gzip compressed part Files (*.mpt.gz);;") +
+ QString("bzip2 compressed part Files (*.mpt.bz2);;") +
+ QString("All Files (*)")) );
+
+/*
+const char* plug_file_pattern[] = {
+ QT_TR_NOOP("part Files (*.pre)"),
+ QT_TR_NOOP("All Files (*)"),
+ 0
+ };
+*/
+/*
+const char* preset_file_pattern[] = {
+ QT_TR_NOOP("Presets (*.pre *.pre.gz *.pre.bz2)"),
+ QT_TR_NOOP("All Files (*)"),
+ 0
+ };
+
+const char* preset_file_save_pattern[] = {
+ QT_TR_NOOP("Presets (*.pre)"),
+ QT_TR_NOOP("gzip compressed presets (*.pre.gz)"),
+ QT_TR_NOOP("bzip2 compressed presets (*.pre.bz2)"),
+ QT_TR_NOOP("All Files (*)"),
+ 0
+ };
+*/
+const QStringList preset_file_pattern =
+ QStringList::split(";;", QT_TR_NOOP(
+ QString("Presets (*.pre *.pre.gz *.pre.bz2);;") +
+ QString("All Files (*)")) );
+
+const QStringList preset_file_save_pattern =
+ QStringList::split(";;", QT_TR_NOOP(
+ QString("Presets (*.pre);;") +
+ QString("gzip compressed presets (*.pre.gz);;") +
+ QString("bzip2 compressed presets (*.pre.bz2);;") +
+ QString("All Files (*)")) );
+
+const QStringList drum_map_file_pattern =
+ QStringList::split(";;", QT_TR_NOOP(
+ QString("Presets (*.map *.map.gz *.map.bz2);;") +
+ QString("All Files (*)")) );
+const QStringList drum_map_file_save_pattern =
+ QStringList::split(";;", QT_TR_NOOP(
+ QString("Presets (*.map);;") +
+ QString("gzip compressed presets (*.map.gz);;") +
+ QString("bzip2 compressed presets (*.map.bz2);;") +
+ QString("All Files (*)")) );
+
+const QStringList audio_file_pattern =
+ QStringList::split(";;", QT_TR_NOOP(
+ QString("Wave/Binary (*.wav *.ogg *.bin);;") +
+ QString("Wave (*.wav *.ogg);;") +
+ QString("Binary (*.bin);;") +
+ QString("All Files (*)")) );
+
+Qt::ButtonState globalKeyState;
+
+// Midi Filter Parameter
+int midiInputPorts = 0; // receive from all devices
+int midiInputChannel = 0; // receive all channel
+int midiRecordType = 0; // receive all events
+int midiThruType = 0; // transmit all events
+int midiFilterCtrl1 = 0;
+int midiFilterCtrl2 = 0;
+int midiFilterCtrl3 = 0;
+int midiFilterCtrl4 = 0;
+
+Q3ActionGroup* undoRedo;
+Q3Action* undoAction;
+Q3Action* redoAction;
+Q3ActionGroup* transportAction;
+Q3Action* playAction;
+Q3Action* startAction;
+Q3Action* stopAction;
+Q3Action* rewindAction;
+Q3Action* forwardAction;
+Q3Action* loopAction;
+Q3Action* punchinAction;
+Q3Action* punchoutAction;
+Q3Action* recordAction;
+Q3Action* panicAction;
+
+//AudioMixerApp* audioMixer;
+MusE* muse;
+
+int preMeasures = 2;
+unsigned char measureClickNote = 63;
+unsigned char measureClickVelo = 127;
+unsigned char beatClickNote = 63;
+unsigned char beatClickVelo = 70;
+unsigned char clickChan = 9;
+unsigned char clickPort = 0;
+bool precountEnableFlag = false;
+bool precountFromMastertrackFlag = false;
+int precountSigZ = 4;
+int precountSigN = 4;
+bool precountPrerecord = false;
+bool precountPreroll = false;
+bool midiClickFlag = true;
+bool audioClickFlag = true;
+float audioClickVolume = 0.5f;
+
+bool rcEnable = false;
+unsigned char rcStopNote = 28;
+unsigned char rcRecordNote = 31;
+unsigned char rcGotoLeftMarkNote = 33;
+unsigned char rcPlayNote = 29;
+bool automation = true;
+
+QObject* gRoutingPopupMenuMaster = 0;
+RouteMenuMap gRoutingMenuMap;
+bool gIsOutRoutingPopupMenu = false;
+
+uid_t euid, ruid; // effective user id, real user id
+
+bool midiSeqRunning = false;
+
+//---------------------------------------------------------
+// doSetuid
+// Restore the effective UID to its original value.
+//---------------------------------------------------------
+
+void doSetuid()
+ {
+#ifndef RTCAP
+ int status;
+#ifdef _POSIX_SAVED_IDS
+ status = seteuid (euid);
+#else
+ status = setreuid (ruid, euid);
+#endif
+ if (status < 0) {
+ perror("doSetuid: Couldn't set uid");
+ }
+#endif
+ }
+
+//---------------------------------------------------------
+// undoSetuid
+// Set the effective UID to the real UID.
+//---------------------------------------------------------
+
+void undoSetuid()
+ {
+#ifndef RTCAP
+ int status;
+
+#ifdef _POSIX_SAVED_IDS
+ status = seteuid (ruid);
+#else
+ status = setreuid (euid, ruid);
+#endif
+ if (status < 0) {
+ fprintf(stderr, "undoSetuid: Couldn't set uid (eff:%d,real:%d): %s\n",
+ euid, ruid, strerror(errno));
+ exit (status);
+ }
+#endif
+ }
+
diff --git a/muse2/muse/globals.h b/muse2/muse/globals.h
new file mode 100644
index 00000000..5fdaf754
--- /dev/null
+++ b/muse2/muse/globals.h
@@ -0,0 +1,192 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: globals.h,v 1.10.2.11 2009/11/25 09:09:43 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef GLOBALS_H
+#define GLOBALS_H
+
+#include <sys/types.h>
+//#include <qstring.h>
+//#include <qfont.h>
+//#include <qnamespace.h>
+//Added by qt3to4:
+#include <Q3ActionGroup>
+#include <Qt3Support>
+//#include <qaction.h>
+#include "value.h"
+#include "mtc.h"
+#include "route.h"
+
+#include <unistd.h>
+
+class QString;
+class QFont;
+class QAction;
+class Q3ActionGroup;
+class QStringList;
+
+extern const float denormalBias;
+
+extern int recFileNumber;
+
+extern int sampleRate;
+extern unsigned segmentSize;
+extern unsigned fifoLength; // inversely proportional to segmentSize
+extern int segmentCount;
+
+extern bool overrideAudioOutput;
+extern bool overrideAudioInput;
+
+class QTimer;
+extern QTimer* heartBeatTimer;
+
+extern bool hIsB;
+
+extern const signed char sharpTab[14][7];
+extern const signed char flatTab[14][7];
+
+extern QString museGlobalLib;
+extern QString museGlobalShare;
+extern QString museUser;
+extern QString museProject;
+extern QString museProjectInitPath;
+extern QString configName;
+extern QString museInstruments;
+extern QString museUserInstruments;
+
+extern QString lastWavePath;
+extern QString lastMidiPath;
+
+extern bool debugMode;
+extern bool midiInputTrace;
+extern bool midiOutputTrace;
+extern bool debugMsg;
+extern bool debugSync;
+extern bool loadPlugins;
+extern bool loadVST;
+extern bool loadDSSI;
+extern bool usePythonBridge;
+extern bool useLASH;
+
+extern bool realTimeScheduling;
+extern int realTimePriority;
+extern int midiRTPrioOverride;
+
+/*
+extern const char* midi_file_pattern[]; //!< File name pattern for midi files
+extern const char* midi_file_save_pattern[]; //!< File name pattern for saving midi files
+extern const char* med_file_pattern[]; //!< File name pattern for muse project files
+extern const char* med_file_save_pattern[]; //!< File name pattern for saving muse project files
+extern const char* image_file_pattern[]; //!< File name pattern for image files (gfx)
+//extern const char* ctrl_file_pattern[]; //!< File name pattern for controller-files
+extern const char* part_file_pattern[]; //!< File name pattern for part files
+extern const char* part_file_save_pattern[]; //!< File name pattern for saving part files
+//extern const char* plug_file_pattern[]; //!< File name pattern for plugin files
+extern const char* preset_file_pattern[]; //!< File name pattern for plugin files
+extern const char* preset_file_save_pattern[]; //!< File name pattern for saving plugin files
+*/
+
+extern const QStringList midi_file_pattern;
+extern const QStringList midi_file_save_pattern;
+extern const QStringList med_file_pattern;
+extern const QStringList med_file_save_pattern;
+extern const QStringList image_file_pattern;
+//extern const QStringList ctrl_file_pattern;
+extern const QStringList part_file_pattern;
+extern const QStringList part_file_save_pattern;
+extern const QStringList preset_file_pattern;
+extern const QStringList preset_file_save_pattern;
+extern const QStringList drum_map_file_pattern;
+extern const QStringList drum_map_file_save_pattern;
+extern const QStringList audio_file_pattern;
+
+extern Qt::ButtonState globalKeyState;
+
+extern int midiInputPorts; //!< receive from all devices
+extern int midiInputChannel; //!< receive all channel
+extern int midiRecordType; //!< receive all events
+
+#define MIDI_FILTER_NOTEON 1
+#define MIDI_FILTER_POLYP 2
+#define MIDI_FILTER_CTRL 4
+#define MIDI_FILTER_PROGRAM 8
+#define MIDI_FILTER_AT 16
+#define MIDI_FILTER_PITCH 32
+#define MIDI_FILTER_SYSEX 64
+
+extern int midiThruType; // transmit all events
+extern int midiFilterCtrl1;
+extern int midiFilterCtrl2;
+extern int midiFilterCtrl3;
+extern int midiFilterCtrl4;
+
+#define CMD_RANGE_ALL 0
+#define CMD_RANGE_SELECTED 1
+#define CMD_RANGE_LOOP 2
+
+extern Q3ActionGroup* undoRedo;
+extern Q3Action* undoAction;
+extern Q3Action* redoAction;
+
+extern Q3ActionGroup* transportAction;
+extern Q3Action* playAction;
+extern Q3Action* startAction;
+extern Q3Action* stopAction;
+extern Q3Action* rewindAction;
+extern Q3Action* forwardAction;
+extern Q3Action* loopAction;
+extern Q3Action* punchinAction;
+extern Q3Action* punchoutAction;
+extern Q3Action* recordAction;
+extern Q3Action* panicAction;
+
+//class AudioMixerApp;
+class MusE;
+//extern AudioMixerApp* audioMixer;
+extern MusE* muse;
+
+extern int preMeasures;
+extern unsigned char measureClickNote;
+extern unsigned char measureClickVelo;
+extern unsigned char beatClickNote;
+extern unsigned char beatClickVelo;
+extern unsigned char clickChan;
+extern unsigned char clickPort;
+extern bool precountEnableFlag;
+extern bool precountFromMastertrackFlag;
+extern int precountSigZ;
+extern int precountSigN;
+extern bool precountPrerecord;
+extern bool precountPreroll;
+extern bool midiClickFlag;
+extern bool audioClickFlag;
+extern float audioClickVolume;
+
+extern bool rcEnable;
+extern unsigned char rcStopNote;
+extern unsigned char rcRecordNote;
+extern unsigned char rcGotoLeftMarkNote;
+extern unsigned char rcPlayNote;
+
+extern bool midiSeqRunning;
+extern bool automation;
+
+class QObject;
+// Which audio strip, midi strip, or midi track info strip
+// was responsible for popping up the routing menu.
+extern QObject* gRoutingPopupMenuMaster;
+// Map of routing popup menu item IDs to Routes.
+extern RouteMenuMap gRoutingMenuMap;
+// Whether the routes popup was shown by clicking the output routes button, or input routes button.
+extern bool gIsOutRoutingPopupMenu;
+
+extern uid_t euid, ruid;
+extern void doSetuid();
+extern void undoSetuid();
+extern bool checkAudioDevice();
+#endif
+
diff --git a/muse2/muse/help.cpp b/muse2/muse/help.cpp
new file mode 100644
index 00000000..82d900f1
--- /dev/null
+++ b/muse2/muse/help.cpp
@@ -0,0 +1,112 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: help.cpp,v 1.7.2.4 2009/07/05 23:06:21 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <qmessagebox.h>
+#include <q3process.h>
+
+#include "app.h"
+#include "globals.h"
+#include "gconfig.h"
+#include "icons.h"
+#include "aboutbox_impl.h"
+
+//---------------------------------------------------------
+// startHelpBrowser
+//---------------------------------------------------------
+
+void MusE::startHelpBrowser()
+ {
+ QString lang(getenv("LANG"));
+ QString museHelp = museGlobalShare + QString("/html/index_") + lang + QString(".html");
+ if (access(museHelp.latin1(), R_OK) != 0) {
+ museHelp = museGlobalShare + QString("/html/index.html");
+ if (access(museHelp.latin1(), R_OK) != 0) {
+ QString info(tr("no help found at: "));
+ info += museHelp;
+ QMessageBox::critical(this, tr("MusE: Open Help"), info);
+ return;
+ }
+ }
+ launchBrowser(museHelp);
+ }
+
+//---------------------------------------------------------
+// startHelpBrowser
+//---------------------------------------------------------
+
+void MusE::startHomepageBrowser()
+ {
+ QString museHome = QString("http://www.muse-sequencer.org");
+
+ launchBrowser(museHome);
+ }
+
+//---------------------------------------------------------
+// startBugBrowser
+//---------------------------------------------------------
+
+void MusE::startBugBrowser()
+ {
+ //QString museBugPage("http://www.muse-sequencer.org/wiki/index.php/Report_a_bug");
+ QString museBugPage("http://www.muse-sequencer.org/index.php/Report_a_bug");
+ launchBrowser(museBugPage);
+ }
+
+//---------------------------------------------------------
+// about
+//---------------------------------------------------------
+
+void MusE::about()
+ {
+ AboutBoxImpl ab;
+ ab.show();
+ ab.exec();
+ }
+
+//---------------------------------------------------------
+// aboutQt
+//---------------------------------------------------------
+
+void MusE::aboutQt()
+ {
+ QMessageBox::aboutQt(this, QString("MusE"));
+ }
+
+void MusE::launchBrowser(QString &whereTo)
+ {
+ char testStr[40];
+ strcpy(testStr, "which ");
+ strcat(testStr, config.helpBrowser.latin1());
+ if (config.helpBrowser == "" || system(testStr))
+ {
+ QMessageBox::information( this, "Unable to launch help",
+ "For some reason MusE has failed to detect or launch\n"
+ "a browser on your machine. Please go to Settings->Global Settings->GUI\n"
+ "and insert the program name of your favourite browser.",
+ "Ok",
+ 0 );
+ return;
+ }
+
+ QString exe = QString("/bin/sh");
+ if(QFile::exists(exe))
+ {
+ Q3Process helper(this);
+ helper.addArgument(exe);
+ helper.addArgument("-c");
+ helper.addArgument(config.helpBrowser + " " + whereTo);
+ helper.start();
+ }
+ else
+ {
+ printf("Unable to launch help\n");
+ }
+
+ }
diff --git a/muse2/muse/helper.cpp b/muse2/muse/helper.cpp
new file mode 100644
index 00000000..605d6f5c
--- /dev/null
+++ b/muse2/muse/helper.cpp
@@ -0,0 +1,40 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: helper.cpp,v 1.1.1.1 2003/10/27 18:51:27 wschweer Exp $
+// (C) Copyright 2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "helper.h"
+
+extern bool hIsB;
+static const char* vall[] = {
+ "c","c#","d","d#","e","f","f#","g","g#","a","a#","h"
+ };
+static const char* valu[] = {
+ "C","C#","D","D#","E","F","F#","G","G#","A","A#","H"
+ };
+
+//---------------------------------------------------------
+// pitch2string
+//---------------------------------------------------------
+
+QString pitch2string(int v)
+ {
+ if (v < 0 || v > 127)
+ return QString("----");
+ int octave = (v / 12) - 2;
+ QString o;
+ o.sprintf("%d", octave);
+ int i = v % 12;
+ QString s(octave < 0 ? valu[i] : vall[i]);
+ if (hIsB) {
+ if (s == "h")
+ s = "b";
+ else if (s == "H")
+ s = "B";
+ }
+ return s + o;
+ }
+
+
diff --git a/muse2/muse/helper.h b/muse2/muse/helper.h
new file mode 100644
index 00000000..8c561db6
--- /dev/null
+++ b/muse2/muse/helper.h
@@ -0,0 +1,16 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: helper.h,v 1.1.1.1 2003/10/27 18:52:11 wschweer Exp $
+// (C) Copyright 2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __HELPER_H__
+#define __HELPER_H__
+
+#include <qstring.h>
+
+extern QString pitch2string(int v);
+
+#endif
+
diff --git a/muse2/muse/icons.cpp b/muse2/muse/icons.cpp
new file mode 100644
index 00000000..592ddcbd
--- /dev/null
+++ b/muse2/muse/icons.cpp
@@ -0,0 +1,612 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: icons.cpp,v 1.13.2.8 2009/11/14 03:37:48 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "globals.h"
+#include <qpixmap.h>
+#include <qicon.h>
+
+#include "xpm/track_comment.xpm"
+#include "xpm/audio_bounce_to_file.xpm"
+#include "xpm/audio_bounce_to_track.xpm"
+#include "xpm/audio_restartaudio.xpm"
+#include "xpm/automation_clear_data.xpm"
+#include "xpm/automation_mixer.xpm"
+#include "xpm/automation_take_snapshot.xpm"
+#include "xpm/edit_midi.xpm"
+#include "xpm/midi_edit_instrument.xpm"
+#include "xpm/midi_init_instr.xpm"
+#include "xpm/midi_inputplugins.xpm"
+#include "xpm/midi_inputplugins_midi_input_filter.xpm"
+#include "xpm/midi_inputplugins_midi_input_transform.xpm"
+#include "xpm/midi_inputplugins_random_rhythm_generator.xpm"
+#include "xpm/midi_inputplugins_remote_control.xpm"
+#include "xpm/midi_inputplugins_transpose.xpm"
+#include "xpm/midi_local_off.xpm"
+#include "xpm/midi_reset_instr.xpm"
+#include "xpm/settings_appearance_settings.xpm"
+#include "xpm/settings_configureshortcuts.xpm"
+#include "xpm/settings_follow_song.xpm"
+#include "xpm/settings_globalsettings.xpm"
+#include "xpm/settings_metronome.xpm"
+#include "xpm/settings_midifileexport.xpm"
+#include "xpm/settings_midiport_softsynths.xpm"
+#include "xpm/settings_midisync.xpm"
+#include "xpm/view_bigtime_window.xpm"
+#include "xpm/view_cliplist.xpm"
+#include "xpm/view_marker.xpm"
+#include "xpm/view_mixer.xpm"
+#include "xpm/view_transport_window.xpm"
+
+#include "xpm/pointer.xpm"
+#include "xpm/pencil.xpm"
+#include "xpm/delete.xpm"
+#include "xpm/play.xpm"
+
+#include "xpm/record1.xpm"
+#include "xpm/record.xpm"
+#include "xpm/record_on.xpm"
+#include "xpm/record_off.xpm"
+#include "xpm/stop.xpm"
+#include "xpm/start.xpm"
+#include "xpm/fforward.xpm"
+#include "xpm/frewind.xpm"
+#include "xpm/punchin.xpm"
+#include "xpm/punchout.xpm"
+#include "xpm/punchin1.xpm"
+#include "xpm/punchout1.xpm"
+#include "xpm/loop1.xpm"
+#include "xpm/loop.xpm"
+#include "xpm/dot.xpm"
+#include "xpm/doth.xpm"
+#include "xpm/dot1.xpm"
+#include "xpm/note.xpm"
+#include "xpm/note1.xpm"
+#include "xpm/stick.xpm"
+#include "xpm/wave.xpm"
+#include "xpm/synth.xpm"
+#include "xpm/cmark.xpm"
+#include "xpm/lmark.xpm"
+#include "xpm/rmark.xpm"
+#include "xpm/cut.xpm"
+#include "xpm/steprec.xpm"
+#include "xpm/glue.xpm"
+#include "xpm/draw.xpm"
+#include "xpm/quant.xpm"
+#include "xpm/fileprint.xpm"
+#include "xpm/filesave.xpm"
+#include "xpm/fileopen.xpm"
+#include "xpm/fileprintS.xpm"
+#include "xpm/filesaveS.xpm"
+#include "xpm/fileopenS.xpm"
+#include "xpm/master.xpm"
+#include "xpm/filenew.xpm"
+#include "xpm/filenewS.xpm"
+#include "xpm/home.xpm"
+#include "xpm/back.xpm"
+#include "xpm/forward.xpm"
+
+// #include "xpm/mute.xpm"
+#include "xpm/solobutton_on.xpm"
+#include "xpm/solobutton_off.xpm"
+#include "xpm/solobutton_on_blksq.xpm"
+#include "xpm/solobutton_off_blksq.xpm"
+#include "xpm/mutebutton_on.xpm"
+#include "xpm/mutebutton_off.xpm"
+#include "xpm/rec_echo_on.xpm"
+#include "xpm/rec_echo_off.xpm"
+
+#include "xpm/up.xpm"
+#include "xpm/down.xpm"
+#include "xpm/bold.xpm"
+#include "xpm/italic.xpm"
+#include "xpm/underlined.xpm"
+#include "xpm/gv.xpm"
+#include "xpm/midiin.xpm"
+#include "xpm/sysex.xpm"
+#include "xpm/ctrl.xpm"
+#include "xpm/meta.xpm"
+#include "xpm/pitch.xpm"
+#include "xpm/cafter.xpm"
+#include "xpm/pafter.xpm"
+#include "xpm/flag.xpm"
+#include "xpm/flagS.xpm"
+#include "xpm/lock.xpm"
+#include "xpm/toc.xpm"
+#include "xpm/piano.xpm"
+// #include "xpm/pianoS.xpm"
+#include "xpm/exitS.xpm"
+
+#include "xpm/undo.xpm"
+#include "xpm/redo.xpm"
+#include "xpm/editcut.xpm"
+#include "xpm/editcopy.xpm"
+#include "xpm/editpaste.xpm"
+#include "xpm/undoS.xpm"
+#include "xpm/redoS.xpm"
+#include "xpm/editcutS.xpm"
+#include "xpm/editcopyS.xpm"
+#include "xpm/editpasteS.xpm"
+#include "xpm/editmute.xpm"
+#include "xpm/editmuteS.xpm"
+#include "xpm/editpasteclone.xpm"
+#include "xpm/editpastecloneS.xpm"
+#include "xpm/editpaste2track.xpm"
+#include "xpm/editpaste2trackS.xpm"
+#include "xpm/editpasteclone2track.xpm"
+#include "xpm/editpasteclone2trackS.xpm"
+
+#include "xpm/speaker.xpm"
+#include "xpm/buttondown.xpm"
+#include "xpm/configure.xpm"
+#include "xpm/panic.xpm"
+
+
+// next two lines will vanish soon
+#include "xpm/solobutton.xpm"
+#include "xpm/newmutebutton.xpm"
+#include "xpm/exit.xpm"
+#include "xpm/exit1.xpm"
+
+#include "xpm/redled.xpm"
+#include "xpm/darkredled.xpm"
+#include "xpm/greendot.xpm"
+//#include "xpm/darkgreendot.xpm"
+#include "xpm/bluedot.xpm"
+#include "xpm/graydot.xpm"
+#include "xpm/off.xpm"
+#include "xpm/blacksquare.xpm"
+#include "xpm/blacksqcheck.xpm"
+
+#include "xpm/mastertrackS.xpm"
+#include "xpm/localoffS.xpm"
+#include "xpm/miditransformS.xpm"
+#include "xpm/midi_plugS.xpm"
+#include "xpm/miditransposeS.xpm"
+#include "xpm/mixerS.xpm"
+#include "xpm/mustangS.xpm"
+#include "xpm/resetS.xpm"
+#include "xpm/track_add.xpm"
+#include "xpm/track_delete.xpm"
+#include "xpm/listS.xpm"
+#include "xpm/inputpluginS.xpm"
+#include "xpm/cliplistS.xpm"
+#include "xpm/mixeraudioS.xpm"
+#include "xpm/initS.xpm"
+
+#include "xpm/addtrack_addmiditrack.xpm"
+#include "xpm/addtrack_audiogroup.xpm"
+#include "xpm/addtrack_audioinput.xpm"
+#include "xpm/addtrack_audiooutput.xpm"
+#include "xpm/addtrack_auxsend.xpm"
+#include "xpm/addtrack_drumtrack.xpm"
+#include "xpm/addtrack_wavetrack.xpm"
+#include "xpm/edit_drumms.xpm"
+#include "xpm/edit_list.xpm"
+#include "xpm/edit_wave.xpm"
+#include "xpm/edit_mastertrack.xpm"
+#include "xpm/edit_pianoroll.xpm"
+#include "xpm/edit_score.xpm"
+#include "xpm/edit_track_add.xpm"
+#include "xpm/edit_track_del.xpm"
+#include "xpm/mastertrack_graphic.xpm"
+#include "xpm/mastertrack_list.xpm"
+#include "xpm/midi_transform.xpm"
+#include "xpm/midi_transpose.xpm"
+#include "xpm/select.xpm"
+#include "xpm/select_all.xpm"
+#include "xpm/select_all_parts_on_track.xpm"
+#include "xpm/select_deselect_all.xpm"
+#include "xpm/select_inside_loop.xpm"
+#include "xpm/select_invert_selection.xpm"
+#include "xpm/select_outside_loop.xpm"
+
+#include "xpm/mono.xpm"
+#include "xpm/stereo.xpm"
+#include "xpm/muse_icon.xpm"
+
+QPixmap* track_commentIcon;
+QPixmap* mastertrackSIcon;
+QPixmap* localoffSIcon;
+QPixmap* miditransformSIcon;
+QPixmap* midi_plugSIcon;
+QPixmap* miditransposeSIcon;
+QPixmap* mixerSIcon;
+QPixmap* mustangSIcon;
+QPixmap* resetSIcon;
+QPixmap* track_addIcon;
+QPixmap* track_deleteIcon;
+QPixmap* listSIcon;
+QPixmap* inputpluginSIcon;
+QPixmap* cliplistSIcon;
+QPixmap* mixerAudioSIcon;
+QPixmap* initSIcon;
+
+QPixmap* exitIcon;
+QPixmap* exit1Icon;
+QPixmap* newmuteIcon;
+QPixmap* soloIcon;
+
+QPixmap* pointerIcon;
+QPixmap* pencilIcon;
+QPixmap* deleteIcon;
+QPixmap* punchinIcon;
+QPixmap* punchoutIcon;
+QPixmap* punchin1Icon;
+QPixmap* punchout1Icon;
+QPixmap* loopIcon;
+QPixmap* loop1Icon;
+QPixmap* playIcon;
+
+QPixmap* record1_Icon;
+QPixmap* record_on_Icon;
+QPixmap* record_off_Icon;
+QPixmap* recordIcon;
+QPixmap* stopIcon;
+QPixmap* startIcon;
+QPixmap* fforwardIcon;
+QPixmap* frewindIcon;
+QPixmap* dotIcon;
+QPixmap* dothIcon;
+QPixmap* dot1Icon;
+QPixmap* note1Icon;
+QPixmap* noteIcon;
+QPixmap* stickIcon;
+QPixmap* waveIcon;
+QPixmap* synthIcon;
+QPixmap* markIcon[3];
+QPixmap* cutIcon;
+QPixmap* steprecIcon;
+QPixmap* glueIcon;
+QPixmap* drawIcon;
+QPixmap* quantIcon;
+QPixmap* printIcon;
+QPixmap* printIconS;
+QPixmap* openIcon;
+QPixmap* saveIcon;
+QPixmap* openIconS;
+QPixmap* saveIconS;
+QPixmap* masterIcon;
+QPixmap* filenewIcon;
+QPixmap* filenewIconS;
+QPixmap* homeIcon;
+QPixmap* backIcon;
+QPixmap* forwardIcon;
+QPixmap* muteIcon;
+QPixmap* upIcon;
+QPixmap* downIcon;
+QPixmap* boldIcon;
+QPixmap* italicIcon;
+QPixmap* underlinedIcon;
+QPixmap* gvIcon;
+QPixmap* midiinIcon;
+QPixmap* sysexIcon;
+QPixmap* ctrlIcon;
+QPixmap* metaIcon;
+QPixmap* pitchIcon;
+QPixmap* cafterIcon;
+QPixmap* pafterIcon;
+QPixmap* flagIcon;
+QPixmap* flagIconS;
+QPixmap* lockIcon;
+QPixmap* tocIcon;
+QPixmap* exitIconS;
+
+QPixmap* undoIcon;
+QPixmap* redoIcon;
+QPixmap* undoIconS;
+QPixmap* redoIconS;
+
+QPixmap* speakerIcon;
+QPixmap* buttondownIcon;
+QPixmap* configureIcon;
+
+QPixmap* recEchoIconOn;
+QPixmap* recEchoIconOff;
+QPixmap* muteIconOn;
+QPixmap* muteIconOff;
+QPixmap* soloIconOn;
+QPixmap* soloIconOff;
+QPixmap* soloblksqIconOn;
+QPixmap* soloblksqIconOff;
+QIcon* soloIconSet1;
+QIcon* soloIconSet2;
+
+QPixmap* editmuteIcon;
+QPixmap* editmuteSIcon;
+QPixmap* panicIcon;
+
+QIcon* pianoIconSet;
+QIcon* scoreIconSet;
+QIcon* editcutIconSet;
+QIcon* editmuteIconSet;
+QIcon* editcopyIconSet;
+QIcon* editpasteIconSet;
+QIcon* editpaste2TrackIconSet;
+QIcon* editpasteCloneIconSet;
+QIcon* editpasteClone2TrackIconSet;
+
+QPixmap* redLedIcon;
+QPixmap* darkRedLedIcon;
+QPixmap* greendotIcon;
+//QPixmap* darkgreendotIcon;
+QPixmap* graydotIcon;
+QPixmap* bluedotIcon;
+QPixmap* offIcon;
+QPixmap* blacksquareIcon;
+QPixmap* blacksqcheckIcon;
+
+QPixmap* addtrack_addmiditrackIcon;
+QPixmap* addtrack_audiogroupIcon;
+QPixmap* addtrack_audioinputIcon;
+QPixmap* addtrack_audiooutputIcon;
+QPixmap* addtrack_auxsendIcon;
+QPixmap* addtrack_drumtrackIcon;
+QPixmap* addtrack_wavetrackIcon;
+QPixmap* edit_drummsIcon;
+QPixmap* edit_listIcon;
+QPixmap* edit_waveIcon;
+QPixmap* edit_mastertrackIcon;
+QPixmap* edit_pianorollIcon;
+QPixmap* edit_scoreIcon;
+QPixmap* edit_track_addIcon;
+QPixmap* edit_track_delIcon;
+QPixmap* mastertrack_graphicIcon;
+QPixmap* mastertrack_listIcon;
+QPixmap* midi_transformIcon;
+QPixmap* midi_transposeIcon;
+QPixmap* selectIcon;
+QPixmap* select_allIcon;
+QPixmap* select_all_parts_on_trackIcon;
+QPixmap* select_deselect_allIcon;
+QPixmap* select_inside_loopIcon;
+QPixmap* select_invert_selectionIcon;
+QPixmap* select_outside_loopIcon;
+
+QPixmap* audio_bounce_to_fileIcon;
+QPixmap* audio_bounce_to_trackIcon;
+QPixmap* audio_restartaudioIcon;
+QPixmap* automation_clear_dataIcon;
+QPixmap* automation_mixerIcon;
+QPixmap* automation_take_snapshotIcon;
+QPixmap* edit_midiIcon;
+QPixmap* midi_edit_instrumentIcon;
+QPixmap* midi_init_instrIcon;
+QPixmap* midi_inputpluginsIcon;
+QPixmap* midi_inputplugins_midi_input_filterIcon;
+QPixmap* midi_inputplugins_midi_input_transformIcon;
+QPixmap* midi_inputplugins_random_rhythm_generatorIcon;
+QPixmap* midi_inputplugins_remote_controlIcon;
+QPixmap* midi_inputplugins_transposeIcon;
+QPixmap* midi_local_offIcon;
+QPixmap* midi_reset_instrIcon;
+QPixmap* settings_appearance_settingsIcon;
+QPixmap* settings_configureshortcutsIcon;
+QPixmap* settings_follow_songIcon;
+QPixmap* settings_globalsettingsIcon;
+QPixmap* settings_metronomeIcon;
+QPixmap* settings_midifileexportIcon;
+QPixmap* settings_midiport_softsynthsIcon;
+QPixmap* settings_midisyncIcon;
+QPixmap* view_bigtime_windowIcon;
+QPixmap* view_cliplistIcon;
+QPixmap* view_markerIcon;
+QPixmap* view_mixerIcon;
+QPixmap* view_transport_windowIcon;
+
+QPixmap* monoIcon;
+QPixmap* stereoIcon;
+QPixmap* museIcon;
+
+//---------------------------------------------------------
+// initIcons
+//---------------------------------------------------------
+
+void initIcons()
+ {
+ track_commentIcon = new QPixmap(track_comment_xpm);
+ pointerIcon = new QPixmap(pointer_xpm);
+ pencilIcon = new QPixmap(pencil_xpm);
+ deleteIcon = new QPixmap(delete_xpm);
+ punchinIcon = new QPixmap(punchin_xpm);
+ punchoutIcon = new QPixmap(punchout_xpm);
+ punchin1Icon = new QPixmap(punchin1_xpm);
+ punchout1Icon = new QPixmap(punchout1_xpm);
+ loopIcon = new QPixmap(loop_xpm);
+ loop1Icon = new QPixmap(loop1_xpm);
+ playIcon = new QPixmap(play_xpm);
+
+ record1_Icon = new QPixmap(record1_xpm);
+ record_on_Icon = new QPixmap(record_on_xpm);
+ record_off_Icon = new QPixmap(record_off_xpm);
+ recordIcon = new QPixmap(record_xpm);
+ stopIcon = new QPixmap(stop_xpm);
+ startIcon = new QPixmap(start_xpm);
+ fforwardIcon = new QPixmap(fforward_xpm);
+ frewindIcon = new QPixmap(frewind_xpm);
+ dotIcon = new QPixmap(dot_xpm);
+ dothIcon = new QPixmap(doth_xpm);
+ dot1Icon = new QPixmap(dot1_xpm);
+ noteIcon = new QPixmap(note_xpm);
+ note1Icon = new QPixmap(note1_xpm);
+ stickIcon = new QPixmap(stick_xpm);
+ waveIcon = new QPixmap(wave_xpm);
+ synthIcon = new QPixmap(synth_xpm);
+ markIcon[0] = new QPixmap(cmark_xpm);
+ markIcon[1] = new QPixmap(lmark_xpm);
+ markIcon[2] = new QPixmap(rmark_xpm);
+ cutIcon = new QPixmap(cut_xpm);
+ steprecIcon = new QPixmap(steprec_xpm);
+ glueIcon = new QPixmap(glue_xpm);
+ drawIcon = new QPixmap(draw_xpm);
+ quantIcon = new QPixmap(quant_xpm);
+ saveIcon = new QPixmap(filesave_xpm);
+ printIcon = new QPixmap(fileprint_xpm);
+ openIcon = new QPixmap(fileopen_xpm);
+ saveIconS = new QPixmap(filesaveS_xpm);
+ printIconS = new QPixmap(fileprintS_xpm);
+ openIconS = new QPixmap(fileopenS_xpm);
+ masterIcon = new QPixmap(master_xpm);
+ filenewIcon = new QPixmap(filenew_xpm);
+ filenewIconS = new QPixmap(filenewS_xpm);
+ homeIcon = new QPixmap(home_xpm);
+ backIcon = new QPixmap(back_xpm);
+ forwardIcon = new QPixmap(forward_xpm);
+ muteIcon = new QPixmap(editmuteS_xpm);
+ upIcon = new QPixmap(up_xpm);
+ downIcon = new QPixmap(down_xpm);
+ boldIcon = new QPixmap(bold_xpm);
+ italicIcon = new QPixmap(italic_xpm);
+ underlinedIcon = new QPixmap(underlined_xpm);
+ gvIcon = new QPixmap(gv_xpm);
+ midiinIcon = new QPixmap(midiin_xpm);
+ sysexIcon = new QPixmap(sysex_xpm);
+ ctrlIcon = new QPixmap(ctrl_xpm);
+ metaIcon = new QPixmap(meta_xpm);
+ pitchIcon = new QPixmap(pitch_xpm);
+ cafterIcon = new QPixmap(cafter_xpm);
+ pafterIcon = new QPixmap(pafter_xpm);
+ flagIcon = new QPixmap(flag_xpm);
+ flagIconS = new QPixmap(flagS_xpm);
+ lockIcon = new QPixmap(lock_xpm);
+ tocIcon = new QPixmap(toc_xpm);
+ exitIconS = new QPixmap(exitS_xpm);
+
+ undoIcon = new QPixmap(undo_xpm);
+ redoIcon = new QPixmap(redo_xpm);
+ undoIconS = new QPixmap(undoS_xpm);
+ redoIconS = new QPixmap(redoS_xpm);
+
+ speakerIcon = new QPixmap(speaker_xpm);
+ buttondownIcon = new QPixmap(buttondown_xpm);
+ configureIcon = new QPixmap(configure_xpm);
+
+ editmuteIcon = new QPixmap(editmute_xpm);
+ editmuteSIcon = new QPixmap(editmuteS_xpm);
+ panicIcon = new QPixmap(panic_xpm);
+
+ editcutIconSet = new QIcon(QPixmap(editcutS_xpm)); // ddskrjo
+ editcopyIconSet = new QIcon(QPixmap(editcopyS_xpm));
+ editpasteIconSet = new QIcon(QPixmap(editpasteS_xpm));
+ editmuteIconSet = new QIcon(QPixmap(editmuteS_xpm));
+ editpaste2TrackIconSet = new QIcon(QPixmap(editpaste2trackS_xpm));
+ editpasteCloneIconSet = new QIcon(QPixmap(editpastecloneS_xpm));
+ editpasteClone2TrackIconSet = new QIcon(QPixmap(editpasteclone2trackS_xpm)); // ..
+
+ exitIcon = new QPixmap(exit_xpm);
+ exit1Icon = new QPixmap(exit1_xpm);
+
+ // 2 lines odd code
+ newmuteIcon = new QPixmap(newmutebutton_xpm);
+ soloIcon = new QPixmap(solobutton_xpm);
+
+ recEchoIconOn = new QPixmap(rec_echo_on_xpm);
+ recEchoIconOff = new QPixmap(rec_echo_off_xpm);
+ muteIconOn = new QPixmap(mutebutton_on_xpm);
+ muteIconOff = new QPixmap(mutebutton_off_xpm);
+ soloIconOn = new QPixmap(solobutton_on_xpm);
+ soloIconOff = new QPixmap(solobutton_off_xpm);
+ soloblksqIconOn = new QPixmap(solobutton_on_blksq_xpm);
+ soloblksqIconOff = new QPixmap(solobutton_off_blksq_xpm);
+ soloIconSet1 = new QIcon();
+ soloIconSet2 = new QIcon();
+ soloIconSet1->setPixmap(*soloIconOn, QIcon::Automatic, QIcon::Normal, QIcon::On);
+ soloIconSet1->setPixmap(*soloIconOff, QIcon::Automatic, QIcon::Normal, QIcon::Off);
+ soloIconSet2->setPixmap(*soloblksqIconOn, QIcon::Automatic, QIcon::Normal, QIcon::On);
+ soloIconSet2->setPixmap(*soloblksqIconOff, QIcon::Automatic, QIcon::Normal, QIcon::Off);
+
+ redLedIcon = new QPixmap(redled_xpm);
+ darkRedLedIcon = new QPixmap(darkredled_xpm);
+ greendotIcon = new QPixmap(greendot_xpm);
+ //darkgreendotIcon = new QPixmap(darkgreendot_xpm);
+ bluedotIcon = new QPixmap(bluedot_xpm);
+ graydotIcon = new QPixmap(graydot_xpm);
+ offIcon = new QPixmap(off_xpm);
+ blacksquareIcon = new QPixmap(blacksquare_xpm);
+ blacksqcheckIcon = new QPixmap(blacksqcheck_xpm);
+
+ mastertrackSIcon = new QPixmap(mastertrackS_xpm);
+ localoffSIcon = new QPixmap(localoffS_xpm);
+ miditransformSIcon = new QPixmap(miditransformS_xpm);
+ midi_plugSIcon = new QPixmap(midi_plugS_xpm);
+ miditransposeSIcon = new QPixmap(miditransposeS_xpm);
+ mixerSIcon = new QPixmap(mixerS_xpm);
+ mustangSIcon = new QPixmap(mustangS_xpm);
+ resetSIcon = new QPixmap(resetS_xpm);
+ track_addIcon = new QPixmap(track_add_xpm);
+ track_deleteIcon = new QPixmap(track_delete_xpm);
+ listSIcon = new QPixmap(listS_xpm);
+ inputpluginSIcon = new QPixmap(inputpluginS_xpm);
+ cliplistSIcon = new QPixmap(cliplistS_xpm);
+ mixerAudioSIcon = new QPixmap(mixerAudioS_xpm);
+ initSIcon = new QPixmap(initS_xpm);
+
+ addtrack_addmiditrackIcon = new QPixmap(addtrack_addmiditrack_xpm);
+ addtrack_audiogroupIcon = new QPixmap(addtrack_audiogroup_xpm);
+ addtrack_audioinputIcon = new QPixmap(addtrack_audioinput_xpm);
+ addtrack_audiooutputIcon = new QPixmap(addtrack_audiooutput_xpm);
+ addtrack_auxsendIcon = new QPixmap(addtrack_auxsend_xpm);
+ addtrack_drumtrackIcon = new QPixmap(addtrack_drumtrack_xpm);
+ addtrack_wavetrackIcon = new QPixmap(addtrack_wavetrack_xpm);
+ edit_drummsIcon = new QPixmap(edit_drumms_xpm);
+ edit_listIcon = new QPixmap(edit_list_xpm);
+ edit_waveIcon = new QPixmap(edit_wave_xpm);
+ edit_mastertrackIcon = new QPixmap(edit_mastertrack_xpm);
+ edit_pianorollIcon = new QPixmap(edit_pianoroll_xpm);
+ edit_scoreIcon = new QPixmap(edit_score_xpm);
+ edit_track_addIcon = new QPixmap(edit_track_add_xpm);
+ edit_track_delIcon = new QPixmap(edit_track_del_xpm);
+ mastertrack_graphicIcon = new QPixmap(mastertrack_graphic_xpm);
+ mastertrack_listIcon = new QPixmap(mastertrack_list_xpm);
+ midi_transformIcon = new QPixmap(midi_transform_xpm);
+ midi_transposeIcon = new QPixmap(midi_transpose_xpm);
+ selectIcon = new QPixmap(select_xpm);
+ select_allIcon = new QPixmap(select_all_xpm);
+ select_all_parts_on_trackIcon = new QPixmap(select_all_parts_on_track_xpm);
+ select_deselect_allIcon = new QPixmap(select_deselect_all);
+ select_inside_loopIcon = new QPixmap(select_inside_loop_xpm);
+ select_invert_selectionIcon = new QPixmap(select_invert_selection);
+ select_outside_loopIcon = new QPixmap(select_outside_loop_xpm);
+ pianoIconSet = new QIcon(*edit_pianorollIcon); // ddskrjo
+
+ audio_bounce_to_fileIcon = new QPixmap(audio_bounce_to_file_xpm);
+ audio_bounce_to_trackIcon = new QPixmap(audio_bounce_to_track_xpm);
+ audio_restartaudioIcon = new QPixmap(audio_restartaudio_xpm);
+ automation_clear_dataIcon = new QPixmap(automation_clear_data_xpm);
+ automation_mixerIcon = new QPixmap(automation_mixer_xpm);
+ automation_take_snapshotIcon = new QPixmap(automation_take_snapshot_xpm);
+ edit_midiIcon = new QPixmap(edit_midi_xpm);
+ midi_edit_instrumentIcon = new QPixmap(midi_edit_instrument_xpm);
+ midi_init_instrIcon = new QPixmap(midi_init_instr_xpm);
+ midi_inputpluginsIcon = new QPixmap(midi_inputplugins_xpm);
+ midi_inputplugins_midi_input_filterIcon = new QPixmap(midi_inputplugins_midi_input_filter_xpm);
+ midi_inputplugins_midi_input_transformIcon = new QPixmap(midi_inputplugins_midi_input_transform_xpm);
+ midi_inputplugins_random_rhythm_generatorIcon = new QPixmap(midi_inputplugins_random_rhythm_generator_xpm);
+ midi_inputplugins_remote_controlIcon = new QPixmap(midi_inputplugins_remote_control_xpm);
+ midi_inputplugins_transposeIcon = new QPixmap(midi_inputplugins_transpose_xpm);
+ midi_local_offIcon = new QPixmap(midi_local_off_xpm);
+ midi_reset_instrIcon = new QPixmap(midi_reset_instr_xpm);
+ settings_appearance_settingsIcon = new QPixmap(settings_appearance_settings_xpm);
+ settings_configureshortcutsIcon = new QPixmap(settings_configureshortcuts_xpm);
+ settings_follow_songIcon = new QPixmap(settings_follow_song_xpm);
+ settings_globalsettingsIcon = new QPixmap(settings_globalsettings_xpm);
+ settings_metronomeIcon = new QPixmap(settings_metronome_xpm);
+ settings_midifileexportIcon = new QPixmap(settings_midifileexport_xpm);
+ settings_midiport_softsynthsIcon = new QPixmap(settings_midiport_softsynths_xpm);
+ settings_midisyncIcon = new QPixmap(settings_midisync_xpm);
+ view_bigtime_windowIcon = new QPixmap(view_bigtime_window_xpm);
+ view_cliplistIcon = new QPixmap(view_cliplist_xpm);
+ view_markerIcon = new QPixmap(view_marker_xpm);
+ view_mixerIcon = new QPixmap(view_mixer_xpm);
+ view_transport_windowIcon = new QPixmap(view_transport_window_xpm);
+
+ monoIcon = new QPixmap(mono_xpm);
+ stereoIcon = new QPixmap(stereo_xpm);
+
+ museIcon = new QPixmap(muse_icon_xpm);
+ }
+
diff --git a/muse2/muse/icons.h b/muse2/muse/icons.h
new file mode 100644
index 00000000..ba069fbb
--- /dev/null
+++ b/muse2/muse/icons.h
@@ -0,0 +1,220 @@
+//Added by qt3to4:
+#include <QPixmap>
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: icons.h,v 1.11.2.8 2009/11/14 03:37:48 terminator356 Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef ICONS_H
+#define ICONS_H
+
+class QPixmap;
+class QIcon;
+
+extern QPixmap* track_commentIcon;
+extern QPixmap* pointerIcon;
+extern QPixmap* pencilIcon;
+extern QPixmap* deleteIcon;
+extern QPixmap* punchinIcon;
+extern QPixmap* punchoutIcon;
+extern QPixmap* punchin1Icon;
+extern QPixmap* punchout1Icon;
+extern QPixmap* loopIcon;
+extern QPixmap* loop1Icon;
+extern QPixmap* playIcon;
+extern QPixmap* recordIcon;
+extern QPixmap* stopIcon;
+extern QPixmap* startIcon;
+extern QPixmap* fforwardIcon;
+extern QPixmap* frewindIcon;
+extern QPixmap* dotIcon;
+extern QPixmap* dothIcon;
+extern QPixmap* dot1Icon;
+extern QPixmap* noteIcon;
+extern QPixmap* note1Icon;
+extern QPixmap* stickIcon;
+extern QPixmap* waveIcon;
+extern QPixmap* synthIcon;
+extern QPixmap* markIcon[3];
+
+extern QPixmap* recEchoIconOn;
+extern QPixmap* recEchoIconOff;
+extern QPixmap* muteIconOn;
+extern QPixmap* muteIconOff;
+extern QPixmap* soloIconOn;
+extern QPixmap* soloIconOff;
+
+extern QPixmap* cutIcon;
+extern QPixmap* steprecIcon;
+extern QPixmap* glueIcon;
+extern QPixmap* drawIcon;
+
+extern QPixmap* quantIcon;
+extern QPixmap* printIcon;
+extern QPixmap* printIconS;
+extern QPixmap* openIcon;
+extern QPixmap* saveIcon;
+extern QPixmap* openIconS;
+extern QPixmap* saveIconS;
+extern QPixmap* archiveIcon;
+extern QPixmap* findIcon;
+extern QPixmap* masterIcon;
+extern QPixmap* filenewIcon;
+extern QPixmap* filenewIconS;
+extern QPixmap* homeIcon;
+extern QPixmap* backIcon;
+extern QPixmap* forwardIcon;
+extern QPixmap* muteIcon;
+extern QPixmap* upIcon;
+extern QPixmap* downIcon;
+extern QPixmap* boldIcon;
+extern QPixmap* italicIcon;
+extern QPixmap* underlinedIcon;
+extern QPixmap* gvIcon;
+extern QPixmap* midiinIcon;
+extern QPixmap* sysexIcon;
+extern QPixmap* ctrlIcon;
+extern QPixmap* metaIcon;
+extern QPixmap* pitchIcon;
+extern QPixmap* cafterIcon;
+extern QPixmap* pafterIcon;
+extern QPixmap* flagIcon;
+extern QPixmap* flagIconS;
+extern QPixmap* lockIcon;
+extern QPixmap* tocIcon;
+extern QPixmap* exitIconS;
+
+extern QPixmap* undoIcon;
+extern QPixmap* redoIcon;
+extern QPixmap* undoIconS;
+extern QPixmap* redoIconS;
+
+extern QPixmap* speakerIcon;
+extern QPixmap* buttondownIcon;
+extern QPixmap* configureIcon;
+
+extern QPixmap* editmuteIcon;
+extern QPixmap* editmuteSIcon;
+extern QPixmap* panicIcon;
+
+extern QIcon* pianoIconSet;
+extern QIcon* scoreIconSet;
+extern QIcon* editcutIconSet;
+extern QIcon* editmuteIconSet;
+extern QIcon* editcopyIconSet;
+extern QIcon* editpasteIconSet;
+extern QIcon* editpaste2TrackIconSet;
+extern QIcon* editpasteCloneIconSet;
+extern QIcon* editpasteClone2TrackIconSet;
+
+extern QPixmap* exitIcon;
+extern QPixmap* exit1Icon;
+extern QPixmap* record1_Icon;
+extern QPixmap* record_on_Icon;
+extern QPixmap* record_off_Icon;
+extern QPixmap* newmuteIcon;
+extern QPixmap* soloIcon;
+
+extern QPixmap* muteIconOn;
+extern QPixmap* muteIconOff;
+extern QPixmap* soloIconOn;
+extern QPixmap* soloIconOff;
+extern QPixmap* soloblksqIconOn;
+extern QPixmap* soloblksqIconOff;
+extern QIcon* soloIconSet1;
+extern QIcon* soloIconSet2;
+
+extern QPixmap* redLedIcon;
+extern QPixmap* darkRedLedIcon;
+extern QPixmap* greendotIcon;
+//extern QPixmap* darkgreendotIcon;
+extern QPixmap* graydotIcon;
+extern QPixmap* bluedotIcon;
+extern QPixmap* offIcon;
+extern QPixmap* blacksquareIcon;
+extern QPixmap* blacksqcheckIcon;
+
+extern QPixmap* mastertrackSIcon;
+extern QPixmap* localoffSIcon;
+extern QPixmap* miditransformSIcon;
+extern QPixmap* midi_plugSIcon;
+extern QPixmap* miditransposeSIcon;
+extern QPixmap* mixerSIcon;
+extern QPixmap* mustangSIcon;
+extern QPixmap* resetSIcon;
+extern QPixmap* track_addIcon;
+extern QPixmap* track_deleteIcon;
+extern QPixmap* listSIcon;
+extern QPixmap* inputpluginSIcon;
+extern QPixmap* cliplistSIcon;
+extern QPixmap* mixerAudioSIcon;
+extern QPixmap* initSIcon;
+
+extern QPixmap* addtrack_addmiditrackIcon;
+extern QPixmap* addtrack_audiogroupIcon;
+extern QPixmap* addtrack_audioinputIcon;
+extern QPixmap* addtrack_audiooutputIcon;
+extern QPixmap* addtrack_auxsendIcon;
+extern QPixmap* addtrack_drumtrackIcon;
+extern QPixmap* addtrack_wavetrackIcon;
+extern QPixmap* edit_drummsIcon;
+extern QPixmap* edit_listIcon;
+extern QPixmap* edit_waveIcon;
+extern QPixmap* edit_mastertrackIcon;
+extern QPixmap* edit_pianorollIcon;
+extern QPixmap* edit_scoreIcon;
+extern QPixmap* edit_track_addIcon;
+extern QPixmap* edit_track_delIcon;
+extern QPixmap* mastertrack_graphicIcon;
+extern QPixmap* mastertrack_listIcon;
+extern QPixmap* midi_transformIcon;
+extern QPixmap* midi_transposeIcon;
+extern QPixmap* selectIcon;
+extern QPixmap* select_allIcon;
+extern QPixmap* select_all_parts_on_trackIcon;
+extern QPixmap* select_deselect_allIcon;
+extern QPixmap* select_inside_loopIcon;
+extern QPixmap* select_invert_selectionIcon;
+extern QPixmap* select_outside_loopIcon;
+
+extern QPixmap* audio_bounce_to_fileIcon;
+extern QPixmap* audio_bounce_to_trackIcon;
+extern QPixmap* audio_restartaudioIcon;
+extern QPixmap* automation_clear_dataIcon;
+extern QPixmap* automation_mixerIcon;
+extern QPixmap* automation_take_snapshotIcon;
+extern QPixmap* edit_midiIcon;
+extern QPixmap* midi_edit_instrumentIcon;
+extern QPixmap* midi_init_instrIcon;
+extern QPixmap* midi_inputpluginsIcon;
+extern QPixmap* midi_inputplugins_midi_input_filterIcon;
+extern QPixmap* midi_inputplugins_midi_input_transformIcon;
+extern QPixmap* midi_inputplugins_random_rhythm_generatorIcon;
+extern QPixmap* midi_inputplugins_remote_controlIcon;
+extern QPixmap* midi_inputplugins_transposeIcon;
+extern QPixmap* midi_local_offIcon;
+extern QPixmap* midi_reset_instrIcon;
+extern QPixmap* settings_appearance_settingsIcon;
+extern QPixmap* settings_configureshortcutsIcon;
+extern QPixmap* settings_follow_songIcon;
+extern QPixmap* settings_globalsettingsIcon;
+extern QPixmap* settings_metronomeIcon;
+extern QPixmap* settings_midifileexportIcon;
+extern QPixmap* settings_midiport_softsynthsIcon;
+extern QPixmap* settings_midisyncIcon;
+extern QPixmap* view_bigtime_windowIcon;
+extern QPixmap* view_cliplistIcon;
+extern QPixmap* view_markerIcon;
+extern QPixmap* view_mixerIcon;
+extern QPixmap* view_transport_windowIcon;
+
+extern QPixmap* monoIcon;
+extern QPixmap* stereoIcon;
+
+extern QPixmap* museIcon;
+
+#endif
+
diff --git a/muse2/muse/importmidi.cpp b/muse2/muse/importmidi.cpp
new file mode 100644
index 00000000..2c8bfb24
--- /dev/null
+++ b/muse2/muse/importmidi.cpp
@@ -0,0 +1,608 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: importmidi.cpp,v 1.26.2.10 2009/11/05 03:14:35 terminator356 Exp $
+//
+// (C) Copyright 1999-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <assert.h>
+#include <errno.h>
+#include <values.h>
+#include <qmessagebox.h>
+
+#include "app.h"
+#include "song.h"
+#include "globals.h"
+#include "filedialog.h"
+#include "midi.h"
+#include "midifile.h"
+#include "midiport.h"
+#include "transport.h"
+#include "arranger.h"
+#include "mpevent.h"
+#include "event.h"
+#include "midictrl.h"
+#include "instruments/minstrument.h"
+#include "drummap.h"
+#include "xml.h"
+#include "audio.h"
+#include "gconfig.h"
+
+//---------------------------------------------------------
+// importMidi
+//---------------------------------------------------------
+
+void MusE::importMidi()
+ {
+ QString empty("");
+ importMidi(empty);
+ }
+
+void MusE::importMidi(const QString &file)
+ {
+ QString fn;
+ if (file.isEmpty()) {
+ fn = getOpenFileName(lastMidiPath, midi_file_pattern, this,
+ tr("MusE: Import Midi"), 0);
+ if (fn.isEmpty())
+ return;
+ lastMidiPath = fn;
+ }
+ else
+ fn = file;
+
+ int n = QMessageBox::question(this, appName,
+ tr("Add midi file to current project?\n"),
+ tr("&Add to Project"),
+ tr("&Replace"),
+ tr("&Abort"), 0, 2);
+
+ switch (n) {
+ case 0:
+ importMidi(fn, true);
+ song->update();
+ break;
+ case 1:
+ loadProjectFile(fn, false, false); // replace
+ break;
+ default:
+ return;
+ }
+ }
+
+//---------------------------------------------------------
+// importMidi
+// return true on error
+//---------------------------------------------------------
+
+bool MusE::importMidi(const QString name, bool merge)
+ {
+ bool popenFlag;
+ FILE* fp = fileOpen(this, name, QString(".mid"), "r", popenFlag);
+ if (fp == 0)
+ return true;
+ MidiFile mf(fp);
+ bool rv = mf.read();
+ popenFlag ? pclose(fp) : fclose(fp);
+ if (rv) {
+ QString s(tr("reading midifile\n "));
+ s += name;
+ s += tr("\nfailed: ");
+ s += mf.error();
+ QMessageBox::critical(this, QString("MusE"), s);
+ return rv;
+ }
+ //
+ // evaluate song Type (GM, XG, GS, unknown)
+ //
+ MType t = song->mtype();
+ if (!merge) {
+ t = mf.mtype();
+ song->setMType(t);
+ }
+ MidiInstrument* instr = 0;
+ for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i) {
+ MidiInstrument* mi = *i;
+ if ((mi->iname() == "GM" && ((t == MT_UNKNOWN) || (t == MT_GM)))
+ || ((mi->iname() == "GS") && (t == MT_GS))
+ || ((mi->iname() == "XG") && (t == MT_XG))) {
+ instr = mi;
+ break;
+ }
+ }
+ if (instr == 0) {
+ // the standard instrument files (GM, GS, XG) must be present
+ printf("no instrument, type %d\n", t);
+ abort();
+ }
+
+ MidiFileTrackList* etl = mf.trackList();
+ int division = mf.division();
+
+ //
+ // create MidiTrack and copy events to ->events()
+ // - combine note on/off events
+ // - calculate tick value for internal resolution
+ //
+ for (iMidiFileTrack t = etl->begin(); t != etl->end(); ++t) {
+ MPEventList* el = &((*t)->events);
+ if (el->empty())
+ continue;
+ //
+ // if we split the track, SYSEX and META events go into
+ // the first target track
+
+ bool first = true;
+ // somewhat silly and slooow:
+ for (int port = 0; port < MIDI_PORTS; ++port) {
+ for (int channel = 0; channel < MIDI_CHANNELS; ++channel) {
+ //
+ // check if there are any events for port/channel in track:
+ //
+ iMPEvent i;
+ for (i = el->begin(); i != el->end(); ++i) {
+ MidiPlayEvent ev = *i;
+ if (ev.type() != ME_SYSEX && ev.type() != ME_META
+ && ev.channel() == channel && ev.port() == port)
+ break;
+ }
+ if (i == el->end())
+ continue;
+ MidiTrack* track = new MidiTrack();
+ if ((*t)->isDrumTrack)
+ {
+ track->setType(Track::DRUM);
+ }
+
+ track->setOutChannel(channel);
+ track->setOutPort(port);
+
+ MidiPort* mport = &midiPorts[track->outPort()];
+ // this overwrites any instrument set for this port:
+ mport->setInstrument(instr);
+
+ EventList* mel = track->events();
+ //buildMidiEventList(mel, el, track, division, first);
+ // Don't do loops.
+ buildMidiEventList(mel, el, track, division, first, false);
+ first = false;
+
+ // Removed by T356. Handled by addPortCtrlEvents() below.
+ //for (iEvent i = mel->begin(); i != mel->end(); ++i) {
+ // Event event = i->second;
+ // if (event.type() == Controller) {
+ // importController(channel, mport, event.dataA());
+ // midiPorts[track->outPort()].setCtrl(channel, event.tick(), event.dataA(), event.dataB());
+ // }
+ // }
+
+ // Comment Added by T356.
+ // Hmm. buildMidiEventList already takes care of this.
+ // But it seems to work. How? Must test.
+ if (channel == 9 && song->mtype() != MT_UNKNOWN) {
+ track->setType(Track::DRUM);
+ //
+ // remap drum pitch with drumInmap
+ //
+ EventList* tevents = track->events();
+ for (iEvent i = tevents->begin(); i != tevents->end(); ++i) {
+ Event ev = i->second;
+ if (ev.isNote()) {
+ int pitch = drumInmap[ev.pitch()];
+ ev.setPitch(pitch);
+ }
+ else
+ if(ev.type() == Controller)
+ {
+ int ctl = ev.dataA();
+ MidiController *mc = mport->drumController(ctl);
+ if(mc)
+ ev.setA((ctl & ~0xff) | drumInmap[ctl & 0x7f]);
+ }
+ }
+ }
+
+ processTrack(track);
+
+ // Added by T356. Send all controller values to the port's controller value list.
+ // No, done in song->insertTrack2() now.
+ //track->addPortCtrlEvents();
+
+ song->insertTrack0(track, -1);
+ }
+ }
+ if (first) {
+ //
+ // track does only contain non-channel messages
+ // (SYSEX or META)
+ //
+ MidiTrack* track = new MidiTrack();
+ track->setOutChannel(0);
+ track->setOutPort(0);
+ EventList* mel = track->events();
+ //buildMidiEventList(mel, el, track, division, true);
+ // Do SysexMeta. Don't do loops.
+ buildMidiEventList(mel, el, track, division, true, false);
+ processTrack(track);
+ song->insertTrack0(track, -1);
+ }
+ }
+
+ if (!merge) {
+ TrackList* tl = song->tracks();
+ if (!tl->empty()) {
+ Track* track = tl->front();
+ track->setSelected(true);
+ }
+ song->initLen();
+
+ int z, n;
+ sigmap.timesig(0, z, n);
+
+ int tempo = tempomap.tempo(0);
+ transport->setTimesig(z, n);
+ transport->setTempo(tempo);
+
+ bool masterF = !tempomap.empty();
+ song->setMasterFlag(masterF);
+ transport->setMasterFlag(masterF);
+
+ song->updatePos();
+
+ arranger->reset();
+ arranger->setMode(int(song->mtype()));
+ }
+ else {
+ song->initLen();
+ }
+
+ return false;
+ }
+
+//---------------------------------------------------------
+// processTrack
+// divide events into parts
+//---------------------------------------------------------
+
+void MusE::processTrack(MidiTrack* track)
+ {
+ EventList* tevents = track->events();
+ if (tevents->empty())
+ return;
+
+ //---------------------------------------------------
+ // Parts ermitteln
+ // die Midi-Spuren werden in Parts aufgebrochen;
+ // ein neuer Part wird bei einer LÃÂŊÂÂŋÃ‚Â―cke von einem
+ // Takt gebildet; die LÃÂŊÂÂŋÃ‚Â―nge wird jeweils auf
+ // Takte aufgerundet und aligned
+ //---------------------------------------------------
+
+ PartList* pl = track->parts();
+
+ int lastTick = 0;
+ for (iEvent i = tevents->begin(); i != tevents->end(); ++i) {
+ Event event = i->second;
+ int epos = event.tick() + event.lenTick();
+ if (epos > lastTick)
+ lastTick = epos;
+ }
+
+ QString partname = track->name();
+ int len = song->roundUpBar(lastTick+1);
+
+ // p3.3.27
+ if(config.importMidiSplitParts)
+ {
+
+ int bar2, beat;
+ unsigned tick;
+ sigmap.tickValues(len, &bar2, &beat, &tick);
+
+ int lastOff = 0;
+ int st = -1; // start tick current part
+ int x1 = 0; // start tick current measure
+ int x2 = 0; // end tick current measure
+
+ for (int bar = 0; bar < bar2; ++bar, x1 = x2) {
+ x2 = sigmap.bar2tick(bar+1, 0, 0);
+ if (lastOff > x2) {
+ // this measure is busy!
+ continue;
+ }
+ iEvent i1 = tevents->lower_bound(x1);
+ iEvent i2 = tevents->lower_bound(x2);
+
+ if (i1 == i2) { // empty?
+ if (st != -1) {
+ MidiPart* part = new MidiPart(track);
+ part->setTick(st);
+ part->setLenTick(x1-st);
+ // printf("new part %d len: %d\n", st, x1-st);
+ part->setName(partname);
+ pl->add(part);
+ st = -1;
+ }
+ }
+ else {
+ if (st == -1)
+ st = x1; // begin new part
+ //HACK:
+ //lastOff:
+ for (iEvent i = i1; i != i2; ++i) {
+ Event event = i->second;
+ if (event.type() == Note) {
+ int off = event.tick() + event.lenTick();
+ if (off > lastOff)
+ lastOff = off;
+ }
+ }
+ }
+ }
+ if (st != -1) {
+ MidiPart* part = new MidiPart(track);
+ part->setTick(st);
+ // printf("new part %d len: %d\n", st, x2-st);
+ part->setLenTick(x2-st);
+ part->setName(partname);
+ pl->add(part);
+ }
+ }
+ else
+ {
+ // Just one long part...
+ MidiPart* part = new MidiPart(track);
+ //part->setTick(st);
+ part->setTick(0);
+ part->setLenTick(len);
+ part->setName(partname);
+ pl->add(part);
+ }
+
+ //-------------------------------------------------------------
+ // assign events to parts
+ //-------------------------------------------------------------
+
+ for (iPart p = pl->begin(); p != pl->end(); ++p) {
+ MidiPart* part = (MidiPart*)(p->second);
+ int stick = part->tick();
+ int etick = part->tick() + part->lenTick();
+ iEvent r1 = tevents->lower_bound(stick);
+ iEvent r2 = tevents->lower_bound(etick);
+ int startTick = part->tick();
+
+ EventList* el = part->events();
+ for (iEvent i = r1; i != r2; ++i) {
+ Event ev = i->second;
+ int ntick = ev.tick() - startTick;
+ ev.setTick(ntick);
+ el->add(ev);
+ }
+ tevents->erase(r1, r2);
+ }
+
+ if (tevents->size())
+ printf("-----------events left: %zd\n", tevents->size());
+ for (iEvent i = tevents->begin(); i != tevents->end(); ++i) {
+ printf("%d===\n", i->first);
+ i->second.dump();
+ }
+ // all events should be processed:
+ assert(tevents->empty());
+ }
+
+//---------------------------------------------------------
+// importController
+//---------------------------------------------------------
+
+void MusE::importController(int channel, MidiPort* mport, int n)
+ {
+ MidiInstrument* instr = mport->instrument();
+ MidiCtrlValListList* vll = mport->controller();
+ iMidiCtrlValList i = vll->find(channel, n);
+ if (i != vll->end())
+ return; // controller does already exist
+ MidiController* ctrl = 0;
+ MidiControllerList* mcl = instr->controller();
+// printf("import Ctrl\n");
+ for (iMidiController i = mcl->begin(); i != mcl->end(); ++i) {
+ MidiController* mc = i->second;
+ int cn = mc->num();
+// printf(" %x %x\n", n, cn);
+ if (cn == n) {
+ ctrl = mc;
+ break;
+ }
+ // wildcard?
+ if (((cn & 0xff) == 0xff) && ((cn & ~0xff) == (n & ~0xff))) {
+ ctrl = i->second;
+ break;
+ }
+ }
+ if (ctrl == 0) {
+ printf("controller 0x%x not defined for instrument %s, channel %d\n",
+ n, instr->iname().latin1(), channel);
+// TODO: register default Controller
+// MidiController* MidiPort::midiController(int num) const
+ }
+ MidiCtrlValList* newValList = new MidiCtrlValList(n);
+ vll->add(channel, newValList);
+ }
+
+
+//---------------------------------------------------------
+// importPart
+//---------------------------------------------------------
+void MusE::importPart()
+ {
+ unsigned curPos = song->cpos();
+ TrackList* tracks = song->tracks();
+ Track* track = 0;
+ // Get first selected track:
+ for (iTrack i = tracks->begin(); i != tracks->end(); i++) {
+ Track* t = *i;
+ if (t->selected()) {
+ // Changed by T356. Support mixed .mpt files.
+ //if (t->isMidiTrack()) {
+ if (t->isMidiTrack() || t->type() == Track::WAVE) {
+ track = t;
+ break;
+ }
+ else {
+ //QMessageBox::warning(this, QString("MusE"), tr("Import part is only valid for midi tracks!"));
+ QMessageBox::warning(this, QString("MusE"), tr("Import part is only valid for midi and wave tracks!"));
+ return;
+ }
+ }
+ }
+
+ if (track) {
+ bool loadAll;
+ QString filename = getOpenFileName(QString(""), part_file_pattern, this, tr("MusE: load part"), &loadAll);
+ if (!filename.isEmpty()){
+ // Make a backup of the current clone list, to retain any 'copy' items,
+ // so that pasting works properly after.
+ CloneList copyCloneList = cloneList;
+ // Clear the clone list to prevent any dangerous associations with
+ // current non-original parts.
+ cloneList.clear();
+
+ importPartToTrack(filename, curPos, track);
+
+ // Restore backup of the clone list, to retain any 'copy' items,
+ // so that pasting works properly after.
+ cloneList.clear();
+ cloneList = copyCloneList;
+ }
+ }
+ else {
+ QMessageBox::warning(this, QString("MusE"), tr("No track selected for import"));
+ }
+ }
+
+//---------------------------------------------------------
+// importPartToTrack
+//---------------------------------------------------------
+void MusE::importPartToTrack(QString& filename, unsigned tick, Track* track)
+{
+ // Changed by T356
+ /*
+ bool popenFlag = false;
+ FILE* fp = fileOpen(this, filename, ".mpt", "r", popenFlag, false, false);
+
+ if(fp)
+ {
+ MidiPart* importedPart = new MidiPart((MidiTrack*)track);
+ Xml tmpXml = Xml(fp);
+
+ Xml::Token token = tmpXml.parse();
+ const QString& tag = tmpXml.s1();
+ if (token == Xml::TagStart && tag == "part")
+ {
+ // Make a backup of the current clone list, to retain any 'copy' items,
+ // so that pasting works properly after.
+ CloneList copyCloneList = cloneList;
+ // Clear the clone list to prevent any dangerous associations with
+ // current non-original parts.
+ cloneList.clear();
+
+ importedPart->read(tmpXml);
+ importedPart->setTick(tick);
+
+ // Restore backup of the clone list, to retain any 'copy' items,
+ // so that pasting works properly after.
+ cloneList.clear();
+ cloneList = copyCloneList;
+
+ audio->msgAddPart(importedPart);
+ }
+ else
+ {
+ printf("Unknown tag: %s\n", tag.latin1());
+ }
+ fclose(fp);
+ }
+ return;
+ */
+
+
+ bool popenFlag = false;
+ FILE* fp = fileOpen(this, filename, ".mpt", "r", popenFlag, false, false);
+
+ if(fp)
+ {
+ Xml xml = Xml(fp);
+ bool firstPart = true;
+ int posOffset = 0;
+ int notDone = 0;
+ int done = 0;
+
+ bool end = false;
+ song->startUndo();
+ for (;;)
+ {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token)
+ {
+ case Xml::Error:
+ case Xml::End:
+ end = true;
+ break;
+ case Xml::TagStart:
+ if (tag == "part") {
+ //MidiPart* p = new MidiPart((MidiTrack*)track);
+ //p->read(xml);
+
+ // Read the part.
+ Part* p = 0;
+ p = readXmlPart(xml, track);
+ // If it could not be created...
+ if(!p)
+ {
+ // Increment the number of parts not done and break.
+ ++notDone;
+ break;
+ }
+
+ // Increment the number of parts done.
+ ++done;
+
+ if(firstPart)
+ {
+ firstPart=false;
+ posOffset = tick - p->tick();
+ }
+ p->setTick(p->tick() + posOffset);
+ //finalPos=p->tick() + p->lenTick();
+ ////pos += p->lenTick();
+ audio->msgAddPart(p,false);
+ }
+ else
+ xml.unknown("MusE::importPartToTrack");
+ break;
+ case Xml::TagEnd:
+ break;
+ default:
+ end = true;
+ break;
+ }
+ if(end)
+ break;
+ }
+ fclose(fp);
+ song->endUndo(SC_PART_INSERTED);
+
+ if(notDone)
+ {
+ int tot = notDone + done;
+ QMessageBox::critical(this, QString("MusE"),
+ QString().setNum(notDone) + (tot > 1 ? (tr(" out of ") + QString().setNum(tot)) : QString("")) +
+ (tot > 1 ? tr(" parts") : tr(" part")) +
+ tr(" could not be imported.\nLikely the track is the wrong type."));
+ }
+
+ return;
+ }
+}
diff --git a/muse2/muse/instruments/Makefile.am b/muse2/muse/instruments/Makefile.am
new file mode 100644
index 00000000..6882f39b
--- /dev/null
+++ b/muse2/muse/instruments/Makefile.am
@@ -0,0 +1,15 @@
+include $(top_srcdir)/common.am
+
+if PCH
+AM_CXXFLAGS += -include $(top_srcdir)/all.h
+endif
+
+noinst_LIBRARIES = libinstruments.a
+
+dist_libinstruments_a_SOURCES = \
+ minstrument.cpp minstrument.h \
+ editinstrument.h editinstrument.cpp \
+ editinstrumentbase.ui
+
+nodist_libinstruments_a_SOURCES = \
+ moc_editinstrument.cpp
diff --git a/muse2/muse/instruments/Makefile.in b/muse2/muse/instruments/Makefile.in
new file mode 100644
index 00000000..f7eab504
--- /dev/null
+++ b/muse2/muse/instruments/Makefile.in
@@ -0,0 +1,599 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/common.am
+@PCH_TRUE@am__append_1 = -include $(top_srcdir)/all.h
+subdir = muse/instruments
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
+ $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libinstruments_a_AR = $(AR) $(ARFLAGS)
+libinstruments_a_LIBADD =
+dist_libinstruments_a_OBJECTS = minstrument.$(OBJEXT) \
+ editinstrument.$(OBJEXT) editinstrumentbase.$(OBJEXT)
+nodist_libinstruments_a_OBJECTS = moc_editinstrument.$(OBJEXT)
+libinstruments_a_OBJECTS = $(dist_libinstruments_a_OBJECTS) \
+ $(nodist_libinstruments_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(dist_libinstruments_a_SOURCES) \
+ $(nodist_libinstruments_a_SOURCES)
+DIST_SOURCES = $(dist_libinstruments_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCBOOKSTYLE = @DOCBOOKSTYLE@
+DOCBOOKTARGETS = @DOCBOOKTARGETS@
+DOT = @DOT@
+DOTPATH = @DOTPATH@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@
+FST_CFLAGS = @FST_CFLAGS@
+FST_LIBS = @FST_LIBS@
+Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@
+Fluidsynth_LIBS = @Fluidsynth_LIBS@
+GIVERTCAP = @GIVERTCAP@
+GREP = @GREP@
+HAVEDOT = @HAVEDOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JADE = @JADE@
+LASH_CFLAGS = @LASH_CFLAGS@
+LASH_LIBS = @LASH_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LO_CFLAGS = @LO_CFLAGS@
+LO_LIBS = @LO_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUSECXXFLAGS = @MUSECXXFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSGMLS = @NSGMLS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCH = @PCH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIB = @PYTHON_LIB@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+QTDIR_BIN = @QTDIR_BIN@
+QTDIR_INC = @QTDIR_INC@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+SUIDBUILD = @SUIDBUILD@
+SUIDINSTALL = @SUIDINSTALL@
+USE_SSE = @USE_SSE@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+have_docbook = @have_docbook@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+synth_fluid = @synth_fluid@
+synth_fluidsynth = @synth_fluidsynth@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \
+ -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(am__append_1)
+AM_CPPFLAGS =
+MOC = $(QTDIR_BIN)/moc
+#UIC = $(QTDIR_BIN)/uic3
+UIC = /usr/bin/uic3
+UIFILES = $(wildcard *.ui)
+MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \
+ if grep -q Q_OBJECT $$h; then \
+ echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \
+ fi; \
+ done)
+
+BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+SUFFIXES = .ui .h.gch
+noinst_LIBRARIES = libinstruments.a
+dist_libinstruments_a_SOURCES = \
+ minstrument.cpp minstrument.h \
+ editinstrument.h editinstrument.cpp \
+ editinstrumentbase.ui
+
+nodist_libinstruments_a_SOURCES = \
+ moc_editinstrument.cpp
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .ui .h.gch .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/instruments/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu muse/instruments/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libinstruments.a: $(libinstruments_a_OBJECTS) $(libinstruments_a_DEPENDENCIES)
+ -rm -f libinstruments.a
+ $(libinstruments_a_AR) libinstruments.a $(libinstruments_a_OBJECTS) $(libinstruments_a_LIBADD)
+ $(RANLIB) libinstruments.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/editinstrument.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minstrument.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_editinstrument.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+de:
+ @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done
+
+nde:
+ @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done
+
+.ui.o: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(CXXCOMPILE) -c $*.cpp -o $*.o
+ $(RM) $*.cpp moc_$*.cpp moc_$*.o
+
+.ui.lo: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(LTCXXCOMPILE) -c $*.cpp -o $*.lo
+ $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o
+
+moc_%.cpp: %.h
+ $(MOC) $< -o $@
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/muse2/muse/instruments/ccontrolbase.ui b/muse2/muse/instruments/ccontrolbase.ui
new file mode 100644
index 00000000..3094776f
--- /dev/null
+++ b/muse2/muse/instruments/ccontrolbase.ui
@@ -0,0 +1,525 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>MidiControllerEditDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MidiControllerEditDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>698</width>
+ <height>457</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Define Midi Controller</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonNew</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add</string>
+ </property>
+ <property name="accel">
+ <string>Alt+A</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>create new entry</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>pressing the New button you create a new entry
+in the MusE list of defined controllers</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonDelete</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Delete</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>delete selected entry</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonApply</cstring>
+ </property>
+ <property name="text">
+ <string>A&amp;pply</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Predefined Controller:</string>
+ </property>
+ </widget>
+ <widget class="QListView" row="1" column="1">
+ <column>
+ <property name="text">
+ <string>Name </string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Type </string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>H-Ctrl</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>L-Ctrl</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Min Val</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Max Val</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>viewController</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>list of defined controllers</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This is the MusE list of defined controllers.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Managed Controller for Port</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>midiPortsList</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Channel</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>midiChannel</cstring>
+ </property>
+ <property name="maxValue">
+ <number>16</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QListBox" row="1" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>listController</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This is a list of commonly used midi controllers.
+Note that in MusE pitch and program changes are
+handled like normal controllers.</string>
+ </property>
+ </widget>
+ <widget class="QGroupBox" row="2" column="1">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Properties</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="1">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Min Value</string>
+ </property>
+ <property name="indent">
+ <number>10</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>spinboxMin</cstring>
+ </property>
+ <property name="maxValue">
+ <number>16384</number>
+ </property>
+ <property name="minValue">
+ <number>-16385</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Max Value</string>
+ </property>
+ <property name="indent">
+ <number>10</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>spinboxMax</cstring>
+ </property>
+ <property name="maxValue">
+ <number>16384</number>
+ </property>
+ <property name="minValue">
+ <number>-16385</number>
+ </property>
+ <property name="value">
+ <number>127</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Type</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>entryName</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="1">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>Control7</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Control14</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>RPN</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>NRPN</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>RPN14</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>NRPN14</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Pitch</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Program</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>comboType</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>H-Ctrl</string>
+ </property>
+ <property name="indent">
+ <number>10</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>spinboxHCtrlNo</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Midi Controller Number High Byte</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2_3</cstring>
+ </property>
+ <property name="text">
+ <string>L-Ctrl</string>
+ </property>
+ <property name="indent">
+ <number>10</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>spinboxLCtrlNo</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Midi Controller Number Low Byte</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Range</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>MidiControllerEditDialogBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MidiControllerEditDialogBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>viewController</tabstop>
+ <tabstop>entryName</tabstop>
+ <tabstop>comboType</tabstop>
+ <tabstop>spinboxHCtrlNo</tabstop>
+ <tabstop>spinboxLCtrlNo</tabstop>
+ <tabstop>spinboxMin</tabstop>
+ <tabstop>spinboxMax</tabstop>
+ <tabstop>buttonNew</tabstop>
+ <tabstop>buttonDelete</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonApply</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/instruments/editinstrument.cpp b/muse2/muse/instruments/editinstrument.cpp
new file mode 100644
index 00000000..9e85356a
--- /dev/null
+++ b/muse2/muse/instruments/editinstrument.cpp
@@ -0,0 +1,3541 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: editinstrument.cpp,v 1.2.2.6 2009/05/31 05:12:12 terminator356 Exp $
+//
+// (C) Copyright 2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <q3listbox.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+#include <stdio.h>
+#include <errno.h>
+#include <qmessagebox.h>
+#include <qspinbox.h>
+#include <qcombobox.h>
+#include <qlineedit.h>
+#include <qcheckbox.h>
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <q3filedialog.h>
+#include <qtoolbutton.h>
+#include <q3popupmenu.h>
+#include <qpushbutton.h>
+#include <qtabwidget.h>
+#include <qinputdialog.h>
+
+#include "editinstrument.h"
+#include "minstrument.h"
+#include "globals.h"
+#include "listitem.h"
+#include "song.h"
+#include "xml.h"
+#include "midictrl.h"
+#include "gconfig.h"
+
+enum {
+ COL_NAME = 0, COL_TYPE,
+ COL_HNUM, COL_LNUM, COL_MIN, COL_MAX, COL_DEF
+ };
+
+//---------------------------------------------------------
+// EditInstrument
+//---------------------------------------------------------
+
+EditInstrument::EditInstrument(QWidget* parent, const char* name, Qt::WFlags fl)
+ : EditInstrumentBase(parent, name, fl)
+ {
+ patchpopup = new Q3PopupMenu(patchButton);
+ patchpopup->setCheckable(false);
+
+ // populate instrument list
+ // Populate common controller list.
+ for(int i = 0; i < 128; ++i)
+ listController->insertItem(midiCtrlName(i));
+
+ oldMidiInstrument = 0;
+ oldPatchItem = 0;
+ for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i) {
+ // Imperfect, crude way of ignoring internal instruments, soft synths etc. If it has a gui,
+ // it must be an internal instrument. But this will still allow some vst instruments (without a gui)
+ // to show up in the list.
+ // Hmm, try file path instead...
+ //if((*i)->hasGui())
+ if((*i)->filePath().isEmpty())
+ continue;
+
+ ListBoxData* item = new ListBoxData((*i)->iname());
+ item->setData((void*)*i);
+ instrumentList->insertItem(item);
+ }
+ if(instrumentList->item(0))
+ instrumentList->setSelected(instrumentList->item(0), true);
+ //oldMidiInstrument = (MidiInstrument*)((ListBoxData*)instrumentList->item(0))->data();
+ //oldMidiInstrument = (ListBoxData*)instrumentList->item(0);
+ //oldMidiInstrument = (ListBoxData*)instrumentList->selectedItem();
+
+// MidiInstrument* wip = (MidiInstrument*)((ListBoxData*)instrumentList->item(0))->data();
+// if(wip)
+ // Assignment
+// workingInstrument.assign( *wip );
+
+
+ connect(instrumentList, SIGNAL(selectionChanged()), SLOT(instrumentChanged()));
+ connect(patchView, SIGNAL(selectionChanged()), SLOT(patchChanged()));
+
+ //instrumentChanged();
+ changeInstrument();
+
+ //connect(listController, SIGNAL(selectionChanged()), SLOT(controllerChanged()));
+ connect(viewController, SIGNAL(selectionChanged()), SLOT(controllerChanged()));
+
+ //connect(instrumentName, SIGNAL(textChanged(const QString&)), SLOT(instrumentNameChanged(const QString&)));
+ connect(instrumentName, SIGNAL(returnPressed()), SLOT(instrumentNameReturn()));
+ connect(instrumentName, SIGNAL(lostFocus()), SLOT(instrumentNameReturn()));
+
+ connect(patchNameEdit, SIGNAL(returnPressed()), SLOT(patchNameReturn()));
+ connect(patchNameEdit, SIGNAL(lostFocus()), SLOT(patchNameReturn()));
+ connect(patchDelete, SIGNAL(clicked()), SLOT(deletePatchClicked()));
+ connect(patchNew, SIGNAL(clicked()), SLOT(newPatchClicked()));
+ connect(patchNewGroup, SIGNAL(clicked()), SLOT(newGroupClicked()));
+ //connect(newCategory, SIGNAL(clicked()), SLOT(newCategoryClicked()));
+
+ connect(patchButton, SIGNAL(clicked()), SLOT(patchButtonClicked()));
+ connect(defPatchH, SIGNAL(valueChanged(int)), SLOT(defPatchChanged(int)));
+ connect(defPatchL, SIGNAL(valueChanged(int)), SLOT(defPatchChanged(int)));
+ connect(defPatchProg, SIGNAL(valueChanged(int)), SLOT(defPatchChanged(int)));
+ connect(deleteController, SIGNAL(clicked()), SLOT(deleteControllerClicked()));
+ connect(newController, SIGNAL(clicked()), SLOT(newControllerClicked()));
+ connect(addController, SIGNAL(clicked()), SLOT(addControllerClicked()));
+ connect(listController, SIGNAL(doubleClicked(Q3ListBoxItem*)), SLOT(addControllerClicked()));
+ connect(ctrlType,SIGNAL(activated(int)), SLOT(ctrlTypeChanged(int)));
+ connect(ctrlName, SIGNAL(returnPressed()), SLOT(ctrlNameReturn()));
+ connect(ctrlName, SIGNAL(lostFocus()), SLOT(ctrlNameReturn()));
+ //connect(ctrlName, SIGNAL(textChanged(const QString&)), SLOT(ctrlNameChanged(const QString&)));
+ connect(spinBoxHCtrlNo, SIGNAL(valueChanged(int)), SLOT(ctrlHNumChanged(int)));
+ connect(spinBoxLCtrlNo, SIGNAL(valueChanged(int)), SLOT(ctrlLNumChanged(int)));
+ connect(spinBoxMin, SIGNAL(valueChanged(int)), SLOT(ctrlMinChanged(int)));
+ connect(spinBoxMax, SIGNAL(valueChanged(int)), SLOT(ctrlMaxChanged(int)));
+ connect(spinBoxDefault, SIGNAL(valueChanged(int)), SLOT(ctrlDefaultChanged(int)));
+ connect(nullParamSpinBoxH, SIGNAL(valueChanged(int)), SLOT(ctrlNullParamHChanged(int)));
+ connect(nullParamSpinBoxL, SIGNAL(valueChanged(int)), SLOT(ctrlNullParamLChanged(int)));
+
+ connect(tabWidget3, SIGNAL(currentChanged(QWidget*)), SLOT(tabChanged(QWidget*)));
+ //connect(sysexList, SIGNAL(selectionChanged()), SLOT(sysexChanged()));
+ //connect(deleteSysex, SIGNAL(clicked()), SLOT(deleteSysexClicked()));
+ //connect(newSysex, SIGNAL(clicked()), SLOT(newSysexClicked()));
+ }
+
+//---------------------------------------------------------
+// helpWhatsThis
+//---------------------------------------------------------
+
+void EditInstrument::helpWhatsThis()
+{
+ whatsThis();
+}
+
+//---------------------------------------------------------
+// fileNew
+//---------------------------------------------------------
+
+void EditInstrument::fileNew()
+ {
+ // Allow these to update...
+ instrumentNameReturn();
+ patchNameReturn();
+ ctrlNameReturn();
+
+ for (int i = 1;; ++i) {
+ QString s = QString("Instrument-%1").arg(i);
+ bool found = false;
+ for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i) {
+ if (s == (*i)->iname()) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ //if(oldMidiInstrument)
+ //{
+ //MidiInstrument* oi = (MidiInstrument*)old->data(Qt::UserRole).value<void*>();
+ MidiInstrument* oi = 0;
+ if(oldMidiInstrument)
+ oi = (MidiInstrument*)oldMidiInstrument->data();
+ MidiInstrument* wip = &workingInstrument;
+ //checkDirty(oi);
+ //if(checkDirty(oi))
+ if(checkDirty(wip))
+ // No save was chosen. Restore the actual instrument name.
+ {
+ if(oi)
+ {
+ oldMidiInstrument->setText(oi->iname());
+ //workingInstrument.setIName(oi->iname());
+
+ // No file path? Only a new unsaved instrument can do that. So delete it.
+ if(oi->filePath().isEmpty())
+ // Delete the list item and the instrument.
+ deleteInstrument(oldMidiInstrument);
+
+ instrumentList->triggerUpdate(true);
+ }
+ }
+ //else
+ //{
+ // if(oi)
+ // Save was chosen. Assign the working instrument to the actual instrument.
+ // oi->assign(workingInstrument);
+ //}
+
+ //oi->setDirty(false);
+ workingInstrument.setDirty(false);
+ //}
+
+ MidiInstrument* ni = new MidiInstrument(s);
+ //midiInstruments.append(ni);
+ midiInstruments.push_back(ni);
+ //QListWidgetItem* item = new QListWidgetItem(ni->iname());
+ //InstrumentListItem* item = new InstrumentListItem(ni->iname());
+ ListBoxData* item = new ListBoxData(ni->iname());
+
+ //oldMidiInstrument = item;
+ workingInstrument.assign( *ni );
+ //workingInstrument.setDirty(false);
+
+ //item->setText(ni->iname());
+ item->setData((void*)ni);
+ //QVariant v = qVariantFromValue((void*)(ni));
+ //item->setData(Qt::UserRole, v);
+ //instrumentList->addItem(item);
+ instrumentList->insertItem(item);
+
+ oldMidiInstrument = 0;
+
+ instrumentList->blockSignals(true);
+ instrumentList->setCurrentItem(item);
+ instrumentList->blockSignals(false);
+
+ changeInstrument();
+
+ // We have our new instrument! So set dirty to true.
+ workingInstrument.setDirty(true);
+
+ break;
+ }
+ }
+
+ }
+
+//---------------------------------------------------------
+// fileOpen
+//---------------------------------------------------------
+
+void EditInstrument::fileOpen()
+ {
+ // Allow these to update...
+ //instrumentNameReturn();
+ //patchNameReturn();
+ //ctrlNameReturn();
+
+
+ }
+
+//---------------------------------------------------------
+// fileSave
+//---------------------------------------------------------
+
+void EditInstrument::fileSave()
+{
+ //if (instrument->filePath().isEmpty())
+ if (workingInstrument.filePath().isEmpty())
+ {
+ //fileSaveAs();
+ saveAs();
+ return;
+ }
+
+ // Do not allow a direct overwrite of a 'built-in' muse instrument.
+ QFileInfo qfi(workingInstrument.filePath());
+ if(qfi.dirPath(true) == museInstruments)
+ {
+ //fileSaveAs();
+ saveAs();
+ return;
+ }
+
+ //QFile f(instrument->filePath());
+ //if (!f.open(QIODevice::WriteOnly)) {
+ //FILE* f = fopen(instrument->filePath().latin1(), "w");
+ FILE* f = fopen(workingInstrument.filePath().latin1(), "w");
+ if(f == 0)
+ {
+ //fileSaveAs();
+ saveAs();
+ return;
+ }
+
+ // Allow these to update...
+ instrumentNameReturn();
+ patchNameReturn();
+ ctrlNameReturn();
+
+ //f.close();
+ if(fclose(f) != 0)
+ {
+ //QString s = QString("Creating file:\n") + instrument->filePath() + QString("\nfailed: ")
+ QString s = QString("Creating file:\n") + workingInstrument.filePath() + QString("\nfailed: ")
+ //+ f.errorString();
+ + QString(strerror(errno) );
+ //fprintf(stderr, "poll failed: %s\n", strerror(errno));
+ QMessageBox::critical(this, tr("MusE: Create file failed"), s);
+ return;
+ }
+
+ //if(fileSave(instrument, instrument->filePath()))
+ // instrument->setDirty(false);
+ if(fileSave(&workingInstrument, workingInstrument.filePath()))
+ workingInstrument.setDirty(false);
+}
+
+//---------------------------------------------------------
+// fileSave
+//---------------------------------------------------------
+
+bool EditInstrument::fileSave(MidiInstrument* instrument, const QString& name)
+ {
+ //QFile f(name);
+ //if (!f.open(QIODevice::WriteOnly)) {
+ // QString s("Creating file failed: ");
+ // s += strerror(errno);
+ // QMessageBox::critical(this,
+ // tr("MusE: Create file failed"), s);
+ // return false;
+ // }
+ //Xml xml(&f);
+
+ FILE* f = fopen(name.ascii(), "w");
+ if(f == 0)
+ {
+ //if(debugMsg)
+ // printf("READ IDF %s\n", fi->filePath().latin1());
+ QString s("Creating file failed: ");
+ s += QString(strerror(errno));
+ QMessageBox::critical(this,
+ tr("MusE: Create file failed"), s);
+ return false;
+ }
+
+ Xml xml(f);
+
+ updateInstrument(instrument);
+
+ //instrument->write(xml);
+ instrument->write(0, xml);
+
+ // Assign the working instrument values to the actual current selected instrument...
+ if(oldMidiInstrument)
+ {
+ MidiInstrument* oi = (MidiInstrument*)oldMidiInstrument->data();
+ if(oi)
+ {
+ oi->assign(workingInstrument);
+
+ // Now signal the rest of the app so stuff can change...
+ song->update(SC_CONFIG | SC_MIDI_CONTROLLER);
+ //song->update(SC_CONFIG | SC_MIDI_CONTROLLER | SC_MIDI_CONTROLLER_ADD);
+ }
+ }
+
+ //f.close();
+ //if (f.error()) {
+ if(fclose(f) != 0)
+ {
+ QString s = QString("Write File\n") + name + QString("\nfailed: ")
+ //+ f.errorString();
+ + QString(strerror(errno));
+ //fprintf(stderr, "poll failed: %s\n", strerror(errno));
+ QMessageBox::critical(this, tr("MusE: Write File failed"), s);
+ return false;
+ }
+ return true;
+ }
+
+//---------------------------------------------------------
+// saveAs
+//---------------------------------------------------------
+
+void EditInstrument::saveAs()
+ {
+ // Allow these to update...
+ instrumentNameReturn();
+ patchNameReturn();
+ ctrlNameReturn();
+
+ //QListWidgetItem* item = instrumentList->currentItem();
+// ListBoxData* item = (ListBoxData*)instrumentList->selectedItem();
+// if (item == 0)
+// return;
+ //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>();
+// MidiInstrument* instrument = (MidiInstrument*)item->data();
+
+ //QString path = QDir::homePath() + "/" + config.instrumentPath;
+ //QString path = QDir::homeDirPath() + "/" + museGlobalShare;
+ //QString path = museInstruments;
+ QString path = museUserInstruments;
+
+ if(!QDir(museUserInstruments).exists())
+ {
+ if(QMessageBox::question(this,
+ tr("MusE:"),
+ tr("The user instrument directory\n") + museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") +
+ tr("(You can override with the environment variable MUSEINSTRUMENTS)"),
+ QMessageBox::Ok | QMessageBox::Default,
+ QMessageBox::Cancel | QMessageBox::Escape,
+ Qt::NoButton) == QMessageBox::Ok)
+ {
+ if(QDir().mkdir(museUserInstruments))
+ printf("Created user instrument directory: %s\n", museUserInstruments.latin1());
+ else
+ {
+ printf("Unable to create user instrument directory: %s\n", museUserInstruments.latin1());
+ QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + museUserInstruments);
+ //return;
+ path = museUser;
+ }
+ }
+ else
+ // return;
+ path = museUser;
+ }
+
+ //if (instrument->filePath().isEmpty())
+ if (workingInstrument.filePath().isEmpty())
+ path += QString("/%1.idf").arg(workingInstrument.iname());
+ else {
+ //QFileInfo fi(instrument->filePath());
+ QFileInfo fi(workingInstrument.filePath());
+
+ // Prompt for a new instrument name if the name has not been changed, to avoid duplicates.
+ if(oldMidiInstrument)
+ {
+ MidiInstrument* oi = (MidiInstrument*)oldMidiInstrument->data();
+ if(oi)
+ {
+ if(oi->iname() == workingInstrument.iname())
+ {
+ // Prompt only if it's a user instrument, to avoid duplicates in the user instrument dir.
+ // This will still allow a user instrument to override a built-in instrument with the same name.
+ if(fi.dirPath(true) != museInstruments)
+ {
+ //QMessageBox::critical(this,
+ // tr("MusE: Bad instrument name"),
+ // tr("Please change the instrument name to a new unique name before saving, to avoid duplicates"),
+ // QMessageBox::Ok,
+ // QMessageBox::NoButton,
+ // QMessageBox::NoButton);
+ printf("EditInstrument::saveAs Error: Instrument name %s already used!\n", workingInstrument.iname().latin1());
+ return;
+ }
+ }
+ }
+ }
+ path += QString("/%1.idf").arg(fi.baseName());
+ }
+ //QString s = QFileDialog::getSaveFileName(this,
+ // tr("MusE: Save Instrument Definition"),
+ // path,
+ // tr("Instrument Definition (*.idf)"));
+
+ QString s = Q3FileDialog::getSaveFileName(path, tr("Instrument Definition (*.idf)"), this,
+ tr("MusE: Save Instrument Definition").latin1());
+ if (s.isEmpty())
+ return;
+ //instrument->setFilePath(s);
+ workingInstrument.setFilePath(s);
+
+ //if (fileSave(instrument, s))
+ // instrument->setDirty(false);
+ if(fileSave(&workingInstrument, s))
+ workingInstrument.setDirty(false);
+ }
+
+//---------------------------------------------------------
+// fileSaveAs
+//---------------------------------------------------------
+
+void EditInstrument::fileSaveAs()
+ {
+ // Is this a new unsaved instrument? Just do a normal save.
+ if(workingInstrument.filePath().isEmpty())
+ {
+ saveAs();
+ return;
+ }
+
+ // Allow these to update...
+ instrumentNameReturn();
+ patchNameReturn();
+ ctrlNameReturn();
+
+ MidiInstrument* oi = 0;
+ if(oldMidiInstrument)
+ oi = (MidiInstrument*)oldMidiInstrument->data();
+
+ int res = checkDirty(&workingInstrument, true);
+ switch(res)
+ {
+ // No save:
+ case 1:
+ //item->setText(instrument->iname());
+ //instrumentList->triggerUpdate(true);
+ //instrument->setDirty(false);
+ workingInstrument.setDirty(false);
+ if(oi)
+ {
+ oldMidiInstrument->setText(oi->iname());
+ //workingInstrument.setIName(oi->iname());
+
+ //workingInstrument.assign(*oi);
+
+ // No file path? Only a new unsaved instrument can do that. So delete it.
+ if(oi->filePath().isEmpty())
+ {
+ // Delete the list item and the instrument.
+ deleteInstrument(oldMidiInstrument);
+ oldMidiInstrument = 0;
+ }
+
+ changeInstrument();
+
+ instrumentList->triggerUpdate(true);
+ }
+ return;
+ break;
+
+ // Abort:
+ case 2:
+ return;
+ break;
+
+ // Save:
+ case 0:
+ //if(oi)
+ // oi->assign(workingInstrument);
+ workingInstrument.setDirty(false);
+ break;
+ }
+
+ //QListWidgetItem* item = instrumentList->currentItem();
+// ListBoxData* item = (ListBoxData*)instrumentList->selectedItem();
+// if (item == 0)
+// return;
+ //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>();
+// MidiInstrument* instrument = (MidiInstrument*)item->data();
+
+ bool isuser = false;
+ QString so;
+ if(workingInstrument.iname().isEmpty())
+ so = QString("Instrument");
+ else
+ so = workingInstrument.iname();
+
+ for(int i = 1;; ++i)
+ {
+ QString s = so + QString("-%1").arg(i);
+
+ bool found = false;
+ for(iMidiInstrument imi = midiInstruments.begin(); imi != midiInstruments.end(); ++imi)
+ {
+ if(s == (*imi)->iname())
+ {
+ // Allow override of built-in instrument names.
+ QFileInfo fi((*imi)->filePath());
+ if(fi.dirPath(true) == museInstruments)
+ break;
+ found = true;
+ break;
+ }
+ }
+ if(found)
+ continue;
+
+ bool ok;
+ s = QInputDialog::getText(tr("MusE: Save instrument as"), tr("Enter a new unique instrument name:"),
+ QLineEdit::Normal, s, &ok, this);
+ if(!ok)
+ return;
+ if(s.isEmpty())
+ {
+ --i;
+ continue;
+ }
+
+ isuser = false;
+ bool builtin = false;
+ found = false;
+ for(iMidiInstrument imi = midiInstruments.begin(); imi != midiInstruments.end(); ++imi)
+ {
+ // If an instrument with the same name is found...
+ if((*imi)->iname() == s)
+ {
+ // If it's not the same name as the working instrument, and it's not an internal instrument (soft synth etc.)...
+ if(s != workingInstrument.iname() && !(*imi)->filePath().isEmpty())
+ {
+ QFileInfo fi((*imi)->filePath());
+ // Allow override of built-in and user instruments:
+ // If it's a user instrument, not a built-in instrument...
+ if(fi.dirPath(true) == museUserInstruments)
+ {
+ // No choice really but to overwrite the destination instrument file!
+ // Can not have two user files containing the same instrument name.
+ if(QMessageBox::question(this,
+ tr("MusE: Save instrument as"),
+ tr("The user instrument:\n") + s + tr("\nalready exists. This will overwrite its .idf instrument file.\nAre you sure?"),
+ QMessageBox::Ok | QMessageBox::Default,
+ QMessageBox::Cancel | QMessageBox::Escape,
+ Qt::NoButton) == QMessageBox::Ok)
+ {
+ // Set the working instrument's file path to the found instrument's path.
+ workingInstrument.setFilePath((*imi)->filePath());
+ // Mark as overwriting a user instrument.
+ isuser = true;
+ }
+ else
+ {
+ found = true;
+ break;
+ }
+ }
+ // Assign the found instrument to the working instrument.
+ //workingInstrument.assign(*(*imi));
+ // Assign the found instrument name to the working instrument name.
+ workingInstrument.setIName(s);
+
+ // Find the instrument in the list and set the old instrument to the item.
+ oldMidiInstrument = (ListBoxData*)instrumentList->findItem(s, Q3ListBox::ExactMatch);
+
+ // Mark as a built-in instrument.
+ builtin = true;
+ break;
+ }
+ found = true;
+ break;
+ }
+ }
+ if(found)
+ {
+ so = s;
+ i = 0;
+ continue;
+ }
+
+ so = s;
+
+ // If the name does not belong to a built-in instrument...
+ if(!builtin)
+ {
+ MidiInstrument* ni = new MidiInstrument();
+ ni->assign(workingInstrument);
+ ni->setIName(so);
+ ni->setFilePath(QString());
+ //midiInstruments.append(ni);
+ midiInstruments.push_back(ni);
+ //QListWidgetItem* item = new QListWidgetItem(ni->iname());
+ //InstrumentListItem* item = new InstrumentListItem(ni->iname());
+ //ListBoxData* item = new ListBoxData(ni->iname());
+ ListBoxData* item = new ListBoxData(so);
+
+ //oldMidiInstrument = item;
+ workingInstrument.assign( *ni );
+ //workingInstrument.setDirty(false);
+
+ //item->setText(ni->iname());
+ item->setData((void*)ni);
+ //QVariant v = qVariantFromValue((void*)(ni));
+ //item->setData(Qt::UserRole, v);
+ //instrumentList->addItem(item);
+ instrumentList->insertItem(item);
+
+ oldMidiInstrument = 0;
+
+ instrumentList->blockSignals(true);
+ instrumentList->setCurrentItem(item);
+ instrumentList->blockSignals(false);
+
+ changeInstrument();
+
+ // We have our new instrument! So set dirty to true.
+ workingInstrument.setDirty(true);
+ }
+
+ break;
+ }
+
+ //QString path = QDir::homePath() + "/" + config.instrumentPath;
+ //QString path = QDir::homeDirPath() + "/" + museGlobalShare;
+ //QString path = museInstruments;
+ QString path = museUserInstruments;
+
+ if(!QDir(museUserInstruments).exists())
+ {
+ if(QMessageBox::question(this,
+ tr("MusE:"),
+ tr("The user instrument directory\n") + museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") +
+ tr("(You can override with the environment variable MUSEINSTRUMENTS)"),
+ QMessageBox::Ok | QMessageBox::Default,
+ QMessageBox::Cancel | QMessageBox::Escape,
+ Qt::NoButton) == QMessageBox::Ok)
+ {
+ if(QDir().mkdir(museUserInstruments))
+ printf("Created user instrument directory: %s\n", museUserInstruments.latin1());
+ else
+ {
+ printf("Unable to create user instrument directory: %s\n", museUserInstruments.latin1());
+ QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + museUserInstruments);
+ //return;
+ path = museUser;
+ }
+ }
+ else
+ // return;
+ path = museUser;
+ }
+ path += QString("/%1.idf").arg(so);
+
+ //QString s = QFileDialog::getSaveFileName(this,
+ // tr("MusE: Save Instrument Definition"),
+ // path,
+ // tr("Instrument Definition (*.idf)"));
+
+ QString sfn;
+ // If we are overwriting a user instrument just force the path.
+ if(isuser)
+ sfn = path;
+ else
+ {
+ sfn = Q3FileDialog::getSaveFileName(path, tr("Instrument Definition (*.idf)"), this,
+ tr("MusE: Save Instrument Definition").latin1());
+ if (sfn.isEmpty())
+ return;
+ //instrument->setFilePath(s);
+ workingInstrument.setFilePath(sfn);
+ }
+
+ //if (fileSave(instrument, s))
+ // instrument->setDirty(false);
+ if(fileSave(&workingInstrument, sfn))
+ workingInstrument.setDirty(false);
+ }
+
+//---------------------------------------------------------
+// fileExit
+//---------------------------------------------------------
+
+void EditInstrument::fileExit()
+ {
+
+ }
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void EditInstrument::closeEvent(QCloseEvent* ev)
+ {
+ // Allow these to update...
+ instrumentNameReturn();
+ patchNameReturn();
+ ctrlNameReturn();
+
+ //QListWidgetItem* item = instrumentList->currentItem();
+
+// ListBoxData* item = (ListBoxData*)instrumentList->selectedItem();
+
+// if(item)
+// {
+ //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>();
+// MidiInstrument* instrument = (MidiInstrument*)item->data();
+// int res = checkDirty(instrument, true);
+ MidiInstrument* oi = 0;
+ if(oldMidiInstrument)
+ oi = (MidiInstrument*)oldMidiInstrument->data();
+
+ int res = checkDirty(&workingInstrument, true);
+ switch(res)
+ {
+ // No save:
+ case 1:
+ //item->setText(instrument->iname());
+ //instrumentList->triggerUpdate(true);
+ //instrument->setDirty(false);
+ workingInstrument.setDirty(false);
+ if(oi)
+ {
+ oldMidiInstrument->setText(oi->iname());
+ //workingInstrument.setIName(oi->iname());
+
+ //workingInstrument.assign(*oi);
+
+ // No file path? Only a new unsaved instrument can do that. So delete it.
+ if(oi->filePath().isEmpty())
+ {
+ // Delete the list item and the instrument.
+ deleteInstrument(oldMidiInstrument);
+ oldMidiInstrument = 0;
+ }
+
+ changeInstrument();
+
+ instrumentList->triggerUpdate(true);
+ }
+ break;
+
+ // Abort:
+ case 2:
+ ev->ignore();
+ return;
+ break;
+
+ // Save:
+ case 0:
+ //if(oi)
+ // oi->assign(workingInstrument);
+ workingInstrument.setDirty(false);
+ break;
+
+ }
+
+// }
+
+ Q3MainWindow::closeEvent(ev);
+ }
+
+//---------------------------------------------------------
+// changeInstrument
+//---------------------------------------------------------
+
+void EditInstrument::changeInstrument()
+{
+ ListBoxData* sel = (ListBoxData*)instrumentList->selectedItem();
+ if(!sel)
+ return;
+
+ //oldMidiInstrument = (MidiInstrument*)sel->data();
+ oldMidiInstrument = sel;
+ // Assignment
+ //workingInstrument = *((MidiInstrument*)sel->data());
+
+ // Assign will 'delete' any existing patches, groups, or controllers.
+ workingInstrument.assign( *((MidiInstrument*)sel->data()) );
+
+ workingInstrument.setDirty(false);
+
+ // populate patch list
+
+ patchView->clear();
+ //listController->clear();
+ viewController->clear();
+ //category->clear();
+ //sysexList->clear();
+
+
+ //MidiInstrument* instrument = (MidiInstrument*)sel->data(Qt::UserRole).value<void*>();
+ //MidiInstrument* instrument = (MidiInstrument*)sel->data();
+ //instrument->setDirty(false);
+
+ instrumentName->blockSignals(true);
+ //instrumentName->setText(instrument->iname());
+ instrumentName->setText(workingInstrument.iname());
+ instrumentName->blockSignals(false);
+
+ nullParamSpinBoxH->blockSignals(true);
+ nullParamSpinBoxL->blockSignals(true);
+ int nv = workingInstrument.nullSendValue();
+ if(nv == -1)
+ {
+ nullParamSpinBoxH->setValue(-1);
+ nullParamSpinBoxL->setValue(-1);
+ }
+ else
+ {
+ int nvh = (nv >> 8) & 0xff;
+ int nvl = nv & 0xff;
+ if(nvh == 0xff)
+ nullParamSpinBoxH->setValue(-1);
+ else
+ nullParamSpinBoxH->setValue(nvh & 0x7f);
+ if(nvl == 0xff)
+ nullParamSpinBoxL->setValue(-1);
+ else
+ nullParamSpinBoxL->setValue(nvl & 0x7f);
+ }
+ nullParamSpinBoxH->blockSignals(false);
+ nullParamSpinBoxL->blockSignals(false);
+
+ //std::vector<PatchGroup>* pg = instrument->groups();
+ //PatchGroupList* pg = instrument->groups();
+ PatchGroupList* pg = workingInstrument.groups();
+ //for (std::vector<PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) {
+ for (ciPatchGroup g = pg->begin(); g != pg->end(); ++g) {
+ PatchGroup* pgp = *g;
+ if(pgp)
+ {
+ //QTreeWidgetItem* item = new QTreeWidgetItem;
+ ListViewData* item = new ListViewData(patchView);
+
+ //item->setText(0, g->name);
+ item->setText(0, pgp->name);
+
+ //QVariant v = QVariant::fromValue((void*)0);
+ //item->setData(0, Qt::UserRole, v);
+ //item->setData((void*)*g);
+ //item->setData((void*)0);
+ //item->setData((void*)&*g);
+ item->setData((void*)pgp);
+ //patchView->addTopLevelItem(item);
+
+ //for (ciPatch p = g->patches.begin(); p != g->patches.end(); ++p)
+ for (ciPatch p = pgp->patches.begin(); p != pgp->patches.end(); ++p)
+ {
+ //const Patch& patch = *p;
+ Patch* patch = *p;
+ if(patch)
+ {
+ //QTreeWidgetItem* sitem = new QTreeWidgetItem;
+ ListViewData* sitem = new ListViewData(item);
+ //sitem->setText(0, patch.name);
+ //sitem->setText(0, p->name);
+ sitem->setText(0, patch->name);
+ //QVariant v = QVariant::fromValue((void*)patch);
+ //sitem->setData(0, Qt::UserRole, v);
+ //sitem->setData((void*)&*p);
+ sitem->setData((void*)patch);
+ //item->addChild(sitem);
+ }
+ }
+ }
+ }
+ //patchView->setSelected(patchView->item(0), true);
+
+ oldPatchItem = 0;
+
+ ListViewData* fc = (ListViewData*)patchView->firstChild();
+ if(fc)
+ {
+ // This may cause a patchChanged call.
+ //if(patchView->selectedItem() != fc)
+ patchView->blockSignals(true);
+ patchView->setSelected(fc, true);
+ patchView->blockSignals(false);
+ //else
+ // patchChanged();
+
+ //patchView->firstChild()->setSelected(true);
+ //patchView->triggerUpdate(true);
+ }
+
+ patchChanged();
+
+// oldPatchItem = (ListViewData*)patchView->selectedItem();
+ //patchChanged();
+// if(oldPatchItem)
+// {
+// if(oldPatchItem->parent())
+// patchNameEdit->setText( ((Patch*)oldPatchItem->data())->name );
+// else
+// patchNameEdit->setText( ((PatchGroup*)oldPatchItem->data())->name );
+// }
+
+ //MidiControllerList* cl = instrument->controller();
+ MidiControllerList* cl = workingInstrument.controller();
+ for (ciMidiController ic = cl->begin(); ic != cl->end(); ++ic) {
+ MidiController* c = ic->second;
+ //QListWidgetItem* item = new QListWidgetItem(c->name());
+ // ListBoxData* item = new ListBoxData(c->name());
+ //QVariant v = QVariant::fromValue((void*)c);
+ //item->setData(Qt::UserRole, v);
+ // item->setData((void*)c);
+ // listController->insertItem(item);
+
+ addControllerToView(c);
+ }
+
+
+ //listController->setItemSelected(listController->item(0), true);
+
+// oldController = 0;
+
+ //ListBoxData* ci = (ListBoxData*)listController->item(0);
+ ListViewData* ci = (ListViewData*)viewController->firstChild();
+
+ if(ci)
+ {
+ // This may cause a controllerChanged call.
+ //if(listController->selectedItem != ci)
+ // listController->blockSignals(true);
+ // listController->setSelected(ci, true);
+ // listController->blockSignals(false);
+ //else
+ // controllerChanged();
+
+ viewController->blockSignals(true);
+ viewController->setSelected(ci, true);
+ viewController->blockSignals(false);
+ }
+
+ controllerChanged();
+
+ //oldController = (ListBoxData*)listController->selectedItem();
+
+
+ //controllerChanged(listController->item(0), 0);
+ //controllerChanged();
+
+/*
+ category->addItems(instrument->categories());
+
+ foreach(const SysEx* s, instrument->sysex()) {
+ QListWidgetItem* item = new QListWidgetItem(s->name);
+ QVariant v = QVariant::fromValue((void*)s);
+ item->setData(Qt::UserRole, v);
+ sysexList->addItem(item);
+ }
+
+ sysexList->setItemSelected(sysexList->item(0), true);
+ sysexChanged(sysexList->item(0), 0);
+
+ if (!cl->empty()) {
+ listController->setItemSelected(listController->item(0), true);
+ controllerChanged(listController->item(0), 0);
+ }
+*/
+
+
+}
+
+//---------------------------------------------------------
+// instrumentChanged
+//---------------------------------------------------------
+
+void EditInstrument::instrumentChanged()
+ {
+ ListBoxData* sel = (ListBoxData*)instrumentList->selectedItem();
+ if(!sel)
+ return;
+
+ //printf("instrument changed: %s\n", sel->text().latin1());
+
+ //if (old) {
+ //if(oldMidiInstrument)
+ //{
+ //MidiInstrument* oi = (MidiInstrument*)old->data(Qt::UserRole).value<void*>();
+ MidiInstrument* oi = 0;
+ if(oldMidiInstrument)
+ oi = (MidiInstrument*)oldMidiInstrument->data();
+ MidiInstrument* wip = &workingInstrument;
+ // Returns true if aborted.
+ //checkDirty(oi);
+ //if(checkDirty(oi))
+ if(checkDirty(wip))
+ {
+ // No save was chosen. Abandon changes, or delete if it is new...
+ if(oi)
+ {
+ oldMidiInstrument->setText(oi->iname());
+ //wip->setText(oi->iname());
+
+ // No file path? Only a new unsaved instrument can do that. So delete it.
+ if(oi->filePath().isEmpty())
+ {
+ // Delete the list item and the instrument.
+ deleteInstrument(oldMidiInstrument);
+ oldMidiInstrument = 0;
+ }
+
+ instrumentList->triggerUpdate(true);
+ }
+ }
+ //else
+ //{
+ // Save was chosen.
+ // if(oi)
+ // oi->assign(workingInstrument);
+ //}
+
+ //oi->setDirty(false);
+ //wip->setDirty(false);
+ workingInstrument.setDirty(false);
+ //}
+
+ changeInstrument();
+
+ }
+
+//---------------------------------------------------------
+// instrumentNameReturn
+//---------------------------------------------------------
+
+void EditInstrument::instrumentNameReturn()
+//void EditInstrument::instrumentNameChanged(const QString& s)
+{
+ //instrumentNameChanged(instrumentName->text());
+ ListBoxData* item = (ListBoxData*)instrumentList->selectedItem();
+ if (item == 0)
+ return;
+ QString s = instrumentName->text();
+
+ if(s == item->text())
+ return;
+
+ MidiInstrument* curins = (MidiInstrument*)item->data();
+
+ for(iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i)
+ {
+ if((*i) != curins && s == (*i)->iname())
+ {
+ instrumentName->blockSignals(true);
+ // Grab the last valid name from the item text, since the instrument has not been updated yet.
+ //instrumentName->setText(curins->iname());
+ instrumentName->setText(item->text());
+ instrumentName->blockSignals(false);
+
+ QMessageBox::critical(this,
+ tr("MusE: Bad instrument name"),
+ tr("Please choose a unique instrument name.\n(The name might be used by a hidden instrument.)"),
+ QMessageBox::Ok,
+ Qt::NoButton,
+ Qt::NoButton);
+
+ return;
+ }
+ }
+
+ //if (s != workingInstrument.iname()) {
+ item->setText(s);
+ //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>();
+ //MidiInstrument* instrument = (MidiInstrument*)item->data();
+ //instrument->setDirty(true);
+ workingInstrument.setIName(s);
+ workingInstrument.setDirty(true);
+ //instrumentList->updateItem(item);
+ instrumentList->triggerUpdate(true);
+ //instrumentList->update();
+ // }
+}
+
+//---------------------------------------------------------
+// deleteInstrument
+//---------------------------------------------------------
+
+void EditInstrument::deleteInstrument(ListBoxData* item)
+{
+ if(!item)
+ return;
+
+ //ListBoxData* curritem = (ListBoxData*)instrumentList->selectedItem();
+
+ MidiInstrument* ins = (MidiInstrument*)item->data();
+
+ // Be kind to the list item, just in case we install a delete handler or something.
+ //item->setData(0);
+
+ // Delete the list item.
+ // Test this: Is this going to change the current selection?
+ instrumentList->blockSignals(true);
+ delete item;
+ instrumentList->blockSignals(false);
+
+ // Test this: Neccessary?
+ // if(curritem)
+ // instrumentList->setCurrentItem(curritem);
+
+ if(!ins)
+ return;
+
+ // Remove the instrument from the list.
+ midiInstruments.remove(ins);
+
+ // Delete the instrument.
+ delete ins;
+}
+
+//---------------------------------------------------------
+// tabChanged
+// Added so that patch list is updated when switching tabs,
+// so that 'Program' default values and text are current in controller tab.
+//---------------------------------------------------------
+
+void EditInstrument::tabChanged(QWidget* w)
+{
+ if(!w)
+ return;
+
+ // If we're switching to the Patches tab, just ignore.
+ if(QString(w->name()) == QString("patchesTab"))
+ return;
+
+ if(oldPatchItem)
+ {
+ // Don't bother calling patchChanged, just update the patch or group.
+ if(oldPatchItem->parent())
+ updatePatch(&workingInstrument, (Patch*)oldPatchItem->data());
+ else
+ updatePatchGroup(&workingInstrument, (PatchGroup*)oldPatchItem->data());
+ }
+
+ // We're still on the same item. No need to set oldPatchItem as in patchChanged...
+
+ // If we're switching to the Controller tab, update the default patch button text in case a patch changed...
+ if(QString(w->name()) == QString("controllerTab"))
+ {
+ ListViewData* sel = (ListViewData*)viewController->selectedItem();
+
+ if(!sel || !sel->data())
+ return;
+
+ MidiController* c = (MidiController*)sel->data();
+ MidiController::ControllerType type = midiControllerType(c->num());
+
+ // Grab the controller number from the actual values showing
+ // and set the patch button text.
+ if(type == MidiController::Program)
+ setDefaultPatchName(getDefaultPatchNumber());
+ }
+}
+
+//---------------------------------------------------------
+// patchNameReturn
+//---------------------------------------------------------
+
+void EditInstrument::patchNameReturn()
+{
+ ListViewData* item = (ListViewData*)patchView->selectedItem();
+ if (item == 0)
+ return;
+
+ QString s = patchNameEdit->text();
+
+ if(item->text(0) == s)
+ return;
+
+ PatchGroupList* pg = workingInstrument.groups();
+ for(iPatchGroup g = pg->begin(); g != pg->end(); ++g)
+ {
+ PatchGroup* pgp = *g;
+ // If the item has a parent, it's a patch item.
+ if(item->parent())
+ {
+ Patch* curp = (Patch*)item->data();
+ for(iPatch p = pgp->patches.begin(); p != pgp->patches.end(); ++p)
+ {
+ if((*p) != curp && (*p)->name == s)
+ {
+ patchNameEdit->blockSignals(true);
+ // Grab the last valid name from the item text, since the patch has not been updated yet.
+ //patchNameEdit->setText(curp->name);
+ patchNameEdit->setText(item->text(0));
+ patchNameEdit->blockSignals(false);
+
+ QMessageBox::critical(this,
+ tr("MusE: Bad patch name"),
+ tr("Please choose a unique patch name"),
+ QMessageBox::Ok,
+ Qt::NoButton,
+ Qt::NoButton);
+
+ return;
+ }
+ }
+ }
+ else
+ // The item has no parent. It's a patch group item.
+ {
+ PatchGroup* curpg = (PatchGroup*)item->data();
+ if(pgp != curpg && pgp->name == s)
+ {
+ patchNameEdit->blockSignals(true);
+ // Grab the last valid name from the item text, since the patch group has not been updated yet.
+ //patchNameEdit->setText(curpg->name);
+ patchNameEdit->setText(item->text(0));
+ patchNameEdit->blockSignals(false);
+
+ QMessageBox::critical(this,
+ tr("MusE: Bad patchgroup name"),
+ tr("Please choose a unique patchgroup name"),
+ QMessageBox::Ok,
+ Qt::NoButton,
+ Qt::NoButton);
+
+ return;
+ }
+ }
+ }
+
+ item->setText(0, s);
+ workingInstrument.setDirty(true);
+
+ // Since the name of the patch/group in the working instrument will be updated later,
+ // there's no need to do manually set the name here now.
+ /*
+ // If the item has a parent, it's a patch item.
+ if(item->parent())
+ {
+ Patch* p = item->data();
+ if(s != p->name)
+ {
+ item->setText(s);
+ p->name = s;
+ workingInstrument.setDirty(true);
+ //patchView->triggerUpdate(true);
+ }
+ }
+ else
+ // The item has no parent. It's a patch group item.
+ {
+ PatchGroup* pg = (PatchGroup*)item->data();
+ if(s != pg->name)
+ {
+ item->setText(s);
+ pg->name = s;
+ workingInstrument.setDirty(true);
+ //patchView->triggerUpdate(true);
+ }
+ }
+ */
+}
+
+//---------------------------------------------------------
+// patchChanged
+//---------------------------------------------------------
+
+void EditInstrument::patchChanged()
+ {
+ //if (old && old->data(0, Qt::UserRole).value<void*>()) {
+ if(oldPatchItem)
+ {
+ //QListWidgetItem* item = instrumentList->currentItem();
+ //if (item == 0)
+ // return;
+ //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>();
+ //Patch* p = (Patch*)old->data(0, Qt::UserRole).value<void*>();
+ //updatePatch(instrument, p);
+ if(oldPatchItem->parent())
+ updatePatch(&workingInstrument, (Patch*)oldPatchItem->data());
+ else
+ updatePatchGroup(&workingInstrument, (PatchGroup*)oldPatchItem->data());
+ }
+
+
+ ListViewData* sel = (ListViewData*)patchView->selectedItem();
+ oldPatchItem = sel;
+
+ if(!sel || !sel->data())
+ {
+ patchNameEdit->setText("");
+ spinBoxHBank->setEnabled(false);
+ spinBoxLBank->setEnabled(false);
+ spinBoxProgram->setEnabled(false);
+ checkBoxDrum->setEnabled(false);
+ checkBoxGM->setEnabled(false);
+ checkBoxGS->setEnabled(false);
+ checkBoxXG->setEnabled(false);
+ return;
+ }
+
+ // If the item has a parent, it's a patch item.
+ if(sel->parent())
+ {
+ Patch* p = (Patch*)sel->data();
+ patchNameEdit->setText(p->name);
+ spinBoxHBank->setEnabled(true);
+ spinBoxLBank->setEnabled(true);
+ spinBoxProgram->setEnabled(true);
+ checkBoxDrum->setEnabled(true);
+ checkBoxGM->setEnabled(true);
+ checkBoxGS->setEnabled(true);
+ checkBoxXG->setEnabled(true);
+
+ int hb = ((p->hbank + 1) & 0xff);
+ int lb = ((p->lbank + 1) & 0xff);
+ int pr = ((p->prog + 1) & 0xff);
+ spinBoxHBank->setValue(hb);
+ spinBoxLBank->setValue(lb);
+ spinBoxProgram->setValue(pr);
+ //checkBoxDrum->setChecked(p->drumMap);
+ checkBoxDrum->setChecked(p->drum);
+ checkBoxGM->setChecked(p->typ & 1);
+ checkBoxGS->setChecked(p->typ & 2);
+ checkBoxXG->setChecked(p->typ & 4);
+ //category->setCurrentIndex(p->categorie);
+ }
+ else
+ // The item is a patch group item.
+ {
+ patchNameEdit->setText( ((PatchGroup*)sel->data())->name );
+ spinBoxHBank->setEnabled(false);
+ spinBoxLBank->setEnabled(false);
+ spinBoxProgram->setEnabled(false);
+ checkBoxDrum->setEnabled(false);
+ checkBoxGM->setEnabled(false);
+ checkBoxGS->setEnabled(false);
+ checkBoxXG->setEnabled(false);
+ }
+ }
+
+//---------------------------------------------------------
+// defPatchChanged
+//---------------------------------------------------------
+
+void EditInstrument::defPatchChanged(int)
+{
+ ListViewData* item = (ListViewData*)viewController->selectedItem();
+ if (!item)
+ return;
+
+ MidiController* c = (MidiController*)item->data();
+
+ int val = getDefaultPatchNumber();
+
+ //if(val == c->minVal() - 1)
+ // c->setInitVal(CTRL_VAL_UNKNOWN);
+ //else
+ c->setInitVal(val);
+
+ setDefaultPatchName(val);
+
+ item->setText(COL_DEF, getPatchItemText(val));
+ workingInstrument.setDirty(true);
+}
+
+//---------------------------------------------------------
+// patchButtonClicked
+//---------------------------------------------------------
+
+void EditInstrument::patchButtonClicked()
+{
+ //MidiTrack* track = (MidiTrack*)selected;
+ //int channel = track->outChannel();
+ //int port = track->outPort();
+ //MidiInstrument* instr = midiPorts[port].instrument();
+
+ patchpopup->clear();
+
+ PatchGroupList* pg = workingInstrument.groups();
+
+ if (pg->size() > 1) {
+ for (ciPatchGroup i = pg->begin(); i != pg->end(); ++i) {
+ PatchGroup* pgp = *i;
+ Q3PopupMenu* pm = new Q3PopupMenu(patchpopup);
+ pm->setCheckable(false);
+ pm->setFont(config.fonts[0]);
+ const PatchList& pl = pgp->patches;
+ for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) {
+ const Patch* mp = *ipl;
+ //if ((mp->typ & mask) &&
+ // ((drum && songType != MT_GM) ||
+ // (mp->drum == drumchan)) )
+
+ // {
+ int id = ((mp->hbank & 0xff) << 16)
+ + ((mp->lbank & 0xff) << 8) + (mp->prog & 0xff);
+ pm->insertItem(mp->name, id);
+ // }
+
+ }
+ patchpopup->insertItem(pgp->name, pm);
+ }
+ }
+ else if (pg->size() == 1 ){
+ // no groups
+ const PatchList& pl = pg->front()->patches;
+ for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) {
+ const Patch* mp = *ipl;
+ //if (mp->typ & mask) {
+ int id = ((mp->hbank & 0xff) << 16)
+ + ((mp->lbank & 0xff) << 8) + (mp->prog & 0xff);
+ patchpopup->insertItem(mp->name, id);
+ // }
+ }
+ }
+
+ if(patchpopup->count() == 0)
+ return;
+
+ int rv = patchpopup->exec(patchButton->mapToGlobal(QPoint(10,5)));
+
+ if (rv != -1)
+ {
+ //if(rv != workingInstrument.
+
+ setDefaultPatchControls(rv);
+
+ ListViewData* item = (ListViewData*)viewController->selectedItem();
+ if(item)
+ {
+ MidiController* c = (MidiController*)item->data();
+ c->setInitVal(rv);
+
+ item->setText(COL_DEF, getPatchItemText(rv));
+ }
+ workingInstrument.setDirty(true);
+ }
+
+}
+
+//---------------------------------------------------------
+// addControllerToView
+//---------------------------------------------------------
+
+ListViewData* EditInstrument::addControllerToView(MidiController* mctrl)
+{
+ QString hnum;
+ QString lnum;
+ QString min;
+ QString max;
+ QString def;
+ int defval = mctrl->initVal();
+ int n = mctrl->num();
+ //int h = (n >> 7) & 0x7f;
+ int h = (n >> 8) & 0x7f;
+ int l = n & 0x7f;
+ if((n & 0xff) == 0xff)
+ l = -1;
+
+ MidiController::ControllerType t = midiControllerType(n);
+ switch(t)
+ {
+ case MidiController::Controller7:
+ //case MidiController::RPN:
+ //case MidiController::NRPN:
+ hnum = "---";
+ if(l == -1)
+ lnum = "*";
+ else
+ lnum.setNum(l);
+ min.setNum(mctrl->minVal());
+ max.setNum(mctrl->maxVal());
+ if(defval == CTRL_VAL_UNKNOWN)
+ def = "---";
+ else
+ def.setNum(defval);
+ break;
+ case MidiController::RPN:
+ case MidiController::NRPN:
+ case MidiController::RPN14:
+ case MidiController::NRPN14:
+ case MidiController::Controller14:
+ hnum.setNum(h);
+ if(l == -1)
+ lnum = "*";
+ else
+ lnum.setNum(l);
+ min.setNum(mctrl->minVal());
+ max.setNum(mctrl->maxVal());
+ if(defval == CTRL_VAL_UNKNOWN)
+ def = "---";
+ else
+ def.setNum(defval);
+ break;
+ case MidiController::Pitch:
+ hnum = "---";
+ lnum = "---";
+ min.setNum(mctrl->minVal());
+ max.setNum(mctrl->maxVal());
+ if(defval == CTRL_VAL_UNKNOWN)
+ def = "---";
+ else
+ def.setNum(defval);
+ break;
+ case MidiController::Program:
+ hnum = "---";
+ lnum = "---";
+ min = "---";
+ max = "---";
+ def = getPatchItemText(defval);
+ break;
+
+ default:
+ hnum = "---";
+ lnum = "---";
+ //min.setNum(0);
+ //max.setNum(0);
+ min = "---";
+ max = "---";
+ def = "---";
+ break;
+ }
+
+ ListViewData* ci = new ListViewData(viewController, mctrl->name(), int2ctrlType(t),
+ hnum, lnum, min, max, def);
+ ci->setData((void*)mctrl);
+ //setModified(true);
+
+ return ci;
+}
+
+//---------------------------------------------------------
+// controllerChanged
+//---------------------------------------------------------
+
+void EditInstrument::controllerChanged()
+ {
+ //if (old) {
+// if(oldController)
+// {
+ //QListWidgetItem* item = instrumentList->currentItem();
+ //if (item == 0)
+ // return;
+ //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>();
+ //MidiController* oc = (MidiController*)old->data(Qt::UserRole).value<void*>();
+ //updateController(instrument, oc);
+// updateController(&workingInstrument, (MidiController*)oldController->data());
+// }
+
+ // ListBoxData* sel = (ListBoxData*)listController->selectedItem();
+ ListViewData* sel = (ListViewData*)viewController->selectedItem();
+// oldController = sel;
+
+ if(!sel || !sel->data())
+ {
+ ctrlName->blockSignals(true);
+ ctrlName->setText("");
+ ctrlName->blockSignals(false);
+ //ctrlComment->setText("");
+ return;
+ }
+
+ //MidiController* c = (MidiController*)sel->data(Qt::UserRole).value<void*>();
+ MidiController* c = (MidiController*)sel->data();
+
+ ctrlName->blockSignals(true);
+ ctrlName->setText(c->name());
+ ctrlName->blockSignals(false);
+
+ //ctrlComment->setText(c->comment());
+ int ctrlH = (c->num() >> 8) & 0x7f;
+ int ctrlL = c->num() & 0x7f;
+ if((c->num() & 0xff) == 0xff)
+ ctrlL = -1;
+
+ //int type = int(c->type());
+ MidiController::ControllerType type = midiControllerType(c->num());
+
+ //ctrlType->setCurrentIndex(type);
+ ctrlType->blockSignals(true);
+ ctrlType->setCurrentItem(type);
+ ctrlType->blockSignals(false);
+
+ //ctrlTypeChanged(type);
+
+ spinBoxHCtrlNo->blockSignals(true);
+ spinBoxLCtrlNo->blockSignals(true);
+ spinBoxMin->blockSignals(true);
+ spinBoxMax->blockSignals(true);
+ spinBoxDefault->blockSignals(true);
+
+ //ctrlTypeChanged(type);
+
+ switch (type) {
+ //case MidiController::RPN:
+ //case MidiController::NRPN:
+ case MidiController::Controller7:
+ spinBoxHCtrlNo->setEnabled(false);
+ spinBoxLCtrlNo->setEnabled(true);
+ spinBoxHCtrlNo->setValue(0);
+ spinBoxLCtrlNo->setValue(ctrlL);
+ spinBoxMin->setEnabled(true);
+ spinBoxMax->setEnabled(true);
+ spinBoxMin->setRange(-128, 127);
+ spinBoxMax->setRange(-128, 127);
+ spinBoxMin->setValue(c->minVal());
+ spinBoxMax->setValue(c->maxVal());
+ enableDefaultControls(true, false);
+ break;
+ case MidiController::RPN:
+ case MidiController::NRPN:
+ spinBoxHCtrlNo->setEnabled(true);
+ spinBoxLCtrlNo->setEnabled(true);
+ spinBoxHCtrlNo->setValue(ctrlH);
+ spinBoxLCtrlNo->setValue(ctrlL);
+ spinBoxMin->setEnabled(true);
+ spinBoxMax->setEnabled(true);
+ spinBoxMin->setRange(-128, 127);
+ spinBoxMax->setRange(-128, 127);
+ spinBoxMin->setValue(c->minVal());
+ spinBoxMax->setValue(c->maxVal());
+ enableDefaultControls(true, false);
+ break;
+ case MidiController::Controller14:
+ case MidiController::RPN14:
+ case MidiController::NRPN14:
+ spinBoxHCtrlNo->setEnabled(true);
+ spinBoxLCtrlNo->setEnabled(true);
+ spinBoxHCtrlNo->setValue(ctrlH);
+ spinBoxLCtrlNo->setValue(ctrlL);
+ spinBoxMin->setEnabled(true);
+ spinBoxMax->setEnabled(true);
+ spinBoxMin->setRange(-16384, 16383);
+ spinBoxMax->setRange(-16384, 16383);
+ spinBoxMin->setValue(c->minVal());
+ spinBoxMax->setValue(c->maxVal());
+ enableDefaultControls(true, false);
+ break;
+ case MidiController::Pitch:
+ spinBoxHCtrlNo->setEnabled(false);
+ spinBoxLCtrlNo->setEnabled(false);
+ spinBoxHCtrlNo->setValue(0);
+ spinBoxLCtrlNo->setValue(0);
+ spinBoxMin->setEnabled(true);
+ spinBoxMax->setEnabled(true);
+ spinBoxMin->setRange(-8192, 8191);
+ spinBoxMax->setRange(-8192, 8191);
+ spinBoxMin->setValue(c->minVal());
+ spinBoxMax->setValue(c->maxVal());
+ enableDefaultControls(true, false);
+ break;
+ case MidiController::Program:
+ spinBoxHCtrlNo->setEnabled(false);
+ spinBoxLCtrlNo->setEnabled(false);
+ spinBoxHCtrlNo->setValue(0);
+ spinBoxLCtrlNo->setValue(0);
+ spinBoxMin->setEnabled(false);
+ spinBoxMax->setEnabled(false);
+ spinBoxMin->setRange(0, 0);
+ spinBoxMax->setRange(0, 0);
+ spinBoxMin->setValue(0);
+ spinBoxMax->setValue(0);
+ enableDefaultControls(false, true);
+ break;
+ default:
+ spinBoxHCtrlNo->setEnabled(false);
+ spinBoxLCtrlNo->setEnabled(false);
+ spinBoxMin->setEnabled(false);
+ spinBoxMax->setEnabled(false);
+ enableDefaultControls(false, false);
+ break;
+ }
+
+ if(type == MidiController::Program)
+ {
+ spinBoxDefault->setRange(0, 0);
+ spinBoxDefault->setValue(0);
+ setDefaultPatchControls(c->initVal());
+ }
+ else
+ {
+ spinBoxDefault->setRange(c->minVal() - 1, c->maxVal());
+ if(c->initVal() == CTRL_VAL_UNKNOWN)
+ //spinBoxDefault->setValue(c->minVal() - 1);
+ spinBoxDefault->setValue(spinBoxDefault->minValue());
+ else
+ spinBoxDefault->setValue(c->initVal());
+ }
+
+ //moveWithPart->setChecked(c->moveWithPart());
+
+ spinBoxHCtrlNo->blockSignals(false);
+ spinBoxLCtrlNo->blockSignals(false);
+ spinBoxMin->blockSignals(false);
+ spinBoxMax->blockSignals(false);
+ spinBoxDefault->blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// ctrlNameReturn
+//---------------------------------------------------------
+
+void EditInstrument::ctrlNameReturn()
+//void EditInstrument::ctrlNameChanged(const QString& s)
+{
+ ListViewData* item = (ListViewData*)viewController->selectedItem();
+ if (item == 0)
+ return;
+ MidiController* c = (MidiController*)item->data();
+
+ QString cName = ctrlName->text();
+
+ if(c->name() == cName)
+ return;
+
+ //MidiControllerList* cl = instrument->controller();
+ MidiControllerList* cl = workingInstrument.controller();
+ for(ciMidiController ic = cl->begin(); ic != cl->end(); ++ic)
+ {
+ MidiController* mc = ic->second;
+ if(mc != c && mc->name() == cName)
+ {
+ ctrlName->blockSignals(true);
+ ctrlName->setText(c->name());
+ ctrlName->blockSignals(false);
+
+ QMessageBox::critical(this,
+ tr("MusE: Bad controller name"),
+ tr("Please choose a unique controller name"),
+ QMessageBox::Ok,
+ Qt::NoButton,
+ Qt::NoButton);
+
+ return;
+ }
+ }
+
+ c->setName(ctrlName->text());
+ item->setText(COL_NAME, ctrlName->text());
+ //c->setName(s);
+ //item->setText(COL_NAME, s);
+ workingInstrument.setDirty(true);
+}
+
+//---------------------------------------------------------
+// ctrlTypeChanged
+//---------------------------------------------------------
+
+void EditInstrument::ctrlTypeChanged(int idx)
+ {
+ ListViewData* item = (ListViewData*)viewController->selectedItem();
+ if (item == 0)
+ return;
+
+ MidiController::ControllerType t = (MidiController::ControllerType)idx;
+ MidiController* c = (MidiController*)item->data();
+ if(t == midiControllerType(c->num()))
+ return;
+
+ //if(item)
+ item->setText(COL_TYPE, ctrlType->currentText());
+
+ int hnum = 0, lnum = 0;
+ //int rng = 0;
+ //int min = 0, max = 0;
+
+ spinBoxMin->blockSignals(true);
+ spinBoxMax->blockSignals(true);
+ spinBoxDefault->blockSignals(true);
+
+ switch (t) {
+ //case MidiController::RPN:
+ //case MidiController::NRPN:
+ case MidiController::Controller7:
+ spinBoxHCtrlNo->setEnabled(false);
+ spinBoxLCtrlNo->setEnabled(true);
+ spinBoxMin->setEnabled(true);
+ spinBoxMax->setEnabled(true);
+ enableDefaultControls(true, false);
+ spinBoxMin->setRange(-128, 127);
+ spinBoxMax->setRange(-128, 127);
+
+ spinBoxMin->setValue(0);
+ spinBoxMax->setValue(127);
+ spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value());
+
+ spinBoxDefault->setValue(spinBoxDefault->minValue());
+ lnum = spinBoxLCtrlNo->value();
+ //rng = 127;
+ //min = -128;
+ //max = 127;
+ //if(item)
+ //{
+ //item->setText(COL_LNUM, QString().setNum(spinBoxLCtrlNo->value()));
+ if(lnum == -1)
+ item->setText(COL_LNUM, QString("*"));
+ else
+ item->setText(COL_LNUM, QString().setNum(lnum));
+ item->setText(COL_HNUM, QString("---"));
+ item->setText(COL_MIN, QString().setNum(spinBoxMin->value()));
+ item->setText(COL_MAX, QString().setNum(spinBoxMax->value()));
+ item->setText(COL_DEF, QString("---"));
+ //}
+ break;
+ case MidiController::RPN:
+ case MidiController::NRPN:
+ spinBoxHCtrlNo->setEnabled(true);
+ spinBoxLCtrlNo->setEnabled(true);
+ spinBoxMin->setEnabled(true);
+ spinBoxMax->setEnabled(true);
+ enableDefaultControls(true, false);
+ spinBoxMin->setRange(-128, 127);
+ spinBoxMax->setRange(-128, 127);
+
+ spinBoxMin->setValue(0);
+ spinBoxMax->setValue(127);
+ spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value());
+ spinBoxDefault->setValue(spinBoxDefault->minValue());
+
+ hnum = spinBoxHCtrlNo->value();
+ lnum = spinBoxLCtrlNo->value();
+ //rng = 127;
+ //min = -128;
+ //max = 127;
+ //if(item)
+ //{
+ //item->setText(COL_LNUM, QString().setNum(spinBoxLCtrlNo->value()));
+ //item->setText(COL_HNUM, QString().setNum(spinBoxHCtrlNo->value()));
+ if(lnum == -1)
+ item->setText(COL_LNUM, QString("*"));
+ else
+ item->setText(COL_LNUM, QString().setNum(lnum));
+ item->setText(COL_HNUM, QString().setNum(hnum));
+ item->setText(COL_MIN, QString().setNum(spinBoxMin->value()));
+ item->setText(COL_MAX, QString().setNum(spinBoxMax->value()));
+ item->setText(COL_DEF, QString("---"));
+ //}
+ break;
+ case MidiController::Controller14:
+ case MidiController::RPN14:
+ case MidiController::NRPN14:
+ spinBoxHCtrlNo->setEnabled(true);
+ spinBoxLCtrlNo->setEnabled(true);
+ spinBoxMin->setEnabled(true);
+ spinBoxMax->setEnabled(true);
+ enableDefaultControls(true, false);
+ spinBoxMin->setRange(-16384, 16383);
+ spinBoxMax->setRange(-16384, 16383);
+
+ spinBoxMin->setValue(0);
+ spinBoxMax->setValue(16383);
+ spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value());
+ spinBoxDefault->setValue(spinBoxDefault->minValue());
+
+ hnum = spinBoxHCtrlNo->value();
+ lnum = spinBoxLCtrlNo->value();
+ //rng = 16383;
+ //min = -16384;
+ //max = 16383;
+ //if(item)
+ //{
+ //item->setText(COL_LNUM, QString().setNum(spinBoxLCtrlNo->value()));
+ //item->setText(COL_HNUM, QString().setNum(spinBoxHCtrlNo->value()));
+ if(lnum == -1)
+ item->setText(COL_LNUM, QString("*"));
+ else
+ item->setText(COL_LNUM, QString().setNum(lnum));
+ item->setText(COL_HNUM, QString().setNum(hnum));
+ item->setText(COL_MIN, QString().setNum(spinBoxMin->value()));
+ item->setText(COL_MAX, QString().setNum(spinBoxMax->value()));
+ item->setText(COL_DEF, QString("---"));
+ //}
+ break;
+ case MidiController::Pitch:
+ spinBoxHCtrlNo->setEnabled(false);
+ spinBoxLCtrlNo->setEnabled(false);
+ spinBoxMin->setEnabled(true);
+ spinBoxMax->setEnabled(true);
+ enableDefaultControls(true, false);
+ spinBoxMin->setRange(-8192, 8191);
+ spinBoxMax->setRange(-8192, 8191);
+
+ spinBoxMin->setValue(-8192);
+ spinBoxMax->setValue(8191);
+ spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value());
+ spinBoxDefault->setValue(spinBoxDefault->minValue());
+
+ //rng = 8191;
+ //min = -8192;
+ //max = 8191;
+ //if(item)
+ //{
+ item->setText(COL_LNUM, QString("---"));
+ item->setText(COL_HNUM, QString("---"));
+ item->setText(COL_MIN, QString().setNum(spinBoxMin->value()));
+ item->setText(COL_MAX, QString().setNum(spinBoxMax->value()));
+ item->setText(COL_DEF, QString("---"));
+ //}
+ break;
+ case MidiController::Program:
+ spinBoxHCtrlNo->setEnabled(false);
+ spinBoxLCtrlNo->setEnabled(false);
+ spinBoxMin->setEnabled(false);
+ spinBoxMax->setEnabled(false);
+ enableDefaultControls(false, true);
+ spinBoxMin->setRange(0, 0);
+ spinBoxMax->setRange(0, 0);
+
+ spinBoxMin->setValue(0);
+ spinBoxMax->setValue(0);
+ spinBoxDefault->setRange(0, 0);
+ spinBoxDefault->setValue(0);
+
+ //if(item)
+ //{
+ item->setText(COL_LNUM, QString("---"));
+ item->setText(COL_HNUM, QString("---"));
+ item->setText(COL_MIN, QString("---"));
+ item->setText(COL_MAX, QString("---"));
+
+ //item->setText(COL_DEF, QString("0-0-0"));
+ item->setText(COL_DEF, QString("---"));
+ //}
+ break;
+ // Shouldn't happen...
+ default:
+ spinBoxHCtrlNo->setEnabled(false);
+ spinBoxLCtrlNo->setEnabled(false);
+ spinBoxMin->setEnabled(false);
+ spinBoxMax->setEnabled(false);
+ enableDefaultControls(false, false);
+
+ spinBoxMin->blockSignals(false);
+ spinBoxMax->blockSignals(false);
+ return;
+
+ break;
+ }
+
+ spinBoxMin->blockSignals(false);
+ spinBoxMax->blockSignals(false);
+ spinBoxDefault->blockSignals(false);
+
+ c->setNum(MidiController::genNum(t, hnum, lnum));
+
+ setDefaultPatchControls(0xffffff);
+ if(t == MidiController::Program)
+ {
+ c->setMinVal(0);
+ c->setMaxVal(0xffffff);
+ c->setInitVal(0xffffff);
+ }
+ else
+ {
+ c->setMinVal(spinBoxMin->value());
+ c->setMaxVal(spinBoxMax->value());
+ if(spinBoxDefault->value() == spinBoxDefault->minValue())
+ c->setInitVal(CTRL_VAL_UNKNOWN);
+ else
+ c->setInitVal(spinBoxDefault->value());
+ }
+
+
+ /*
+
+ if(rng != 0)
+ {
+ int mn = c->minVal();
+ int mx = c->maxVal();
+ //if(val > item->text(COL_MAX).toInt())
+ if(mx > max)
+ {
+ c->setMaxVal(max);
+ spinBoxMax->blockSignals(true);
+ spinBoxMax->setValue(max);
+ spinBoxMax->blockSignals(false);
+ if(item)
+ item->setText(COL_MAX, QString().setNum(max));
+ }
+ //else
+ if(mn < min)
+ {
+ c->setMinVal(min);
+ spinBoxMin->blockSignals(true);
+ spinBoxMin->setValue(min);
+ spinBoxMin->blockSignals(false);
+ if(item)
+ item->setText(COL_MIN, QString().setNum(min));
+ }
+ //else
+ if(mx - mn > rng)
+ {
+ //mx = val + rng;
+ c->setMinVal(0);
+ c->setMaxVal(rng);
+ spinBoxMin->blockSignals(true);
+ spinBoxMax->blockSignals(true);
+ spinBoxMin->setValue(0);
+ spinBoxMax->setValue(rng);
+ spinBoxMin->blockSignals(false);
+ spinBoxMax->blockSignals(false);
+ if(item)
+ {
+ item->setText(COL_MIN, QString().setNum(0));
+ item->setText(COL_MAX, QString().setNum(rng));
+ }
+ }
+
+ spinBoxDefault->blockSignals(true);
+
+ spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value());
+ int inval = c->initVal();
+ if(inval == CTRL_VAL_UNKNOWN)
+ spinBoxDefault->setValue(spinBoxDefault->minValue());
+ else
+ {
+ if(inval < c->minVal())
+ {
+ c->setInitVal(c->minVal());
+ spinBoxDefault->setValue(c->minVal());
+ }
+ else
+ if(inval > c->maxVal())
+ {
+ c->setInitVal(c->maxVal());
+ spinBoxDefault->setValue(c->maxVal());
+ }
+ }
+
+ //spinBoxDefault->setRange(c->minVal() - 1, c->maxVal());
+ spinBoxDefault->blockSignals(false);
+
+ }
+
+ */
+
+ workingInstrument.setDirty(true);
+ }
+
+//---------------------------------------------------------
+// ctrlHNumChanged
+//---------------------------------------------------------
+
+void EditInstrument::ctrlHNumChanged(int val)
+ {
+ ListViewData* item = (ListViewData*)viewController->selectedItem();
+ if (item == 0)
+ return;
+ QString s;
+ s.setNum(val);
+ MidiController* c = (MidiController*)item->data();
+ //int n = c->num() & 0xff;
+ int n = c->num() & 0x7fff00ff;
+ c->setNum(n | ((val & 0xff) << 8));
+ item->setText(COL_HNUM, s);
+ workingInstrument.setDirty(true);
+ }
+
+//---------------------------------------------------------
+// ctrlLNumChanged
+//---------------------------------------------------------
+
+void EditInstrument::ctrlLNumChanged(int val)
+ {
+ ListViewData* item = (ListViewData*)viewController->selectedItem();
+ if (item == 0)
+ return;
+ MidiController* c = (MidiController*)item->data();
+ //int n = c->num() & 0xff00;
+ int n = c->num() & ~0xff;
+ c->setNum(n | (val & 0xff));
+ if(val == -1)
+ item->setText(COL_LNUM, QString("*"));
+ else
+ {
+ QString s;
+ s.setNum(val);
+ item->setText(COL_LNUM, s);
+ }
+ workingInstrument.setDirty(true);
+ }
+
+//---------------------------------------------------------
+// ctrlMinChanged
+//---------------------------------------------------------
+
+void EditInstrument::ctrlMinChanged(int val)
+{
+ ListViewData* item = (ListViewData*)viewController->selectedItem();
+ if (item == 0)
+ return;
+
+ QString s;
+ s.setNum(val);
+ item->setText(COL_MIN, s);
+
+ MidiController* c = (MidiController*)item->data();
+ c->setMinVal(val);
+
+ int rng = 0;
+ //switch((MidiController::ControllerType)ctrlType->currentItem())
+ switch(midiControllerType(c->num()))
+ {
+ case MidiController::Controller7:
+ case MidiController::RPN:
+ case MidiController::NRPN:
+ rng = 127;
+ break;
+ case MidiController::Controller14:
+ case MidiController::RPN14:
+ case MidiController::NRPN14:
+ case MidiController::Pitch:
+ rng = 16383;
+ break;
+ default:
+ break;
+ }
+
+ int mx = c->maxVal();
+
+ //if(val > item->text(COL_MAX).toInt())
+ if(val > mx)
+ {
+ c->setMaxVal(val);
+ spinBoxMax->blockSignals(true);
+ spinBoxMax->setValue(val);
+ spinBoxMax->blockSignals(false);
+ item->setText(COL_MAX, s);
+ }
+ else
+ if(mx - val > rng)
+ {
+ mx = val + rng;
+ c->setMaxVal(mx);
+ spinBoxMax->blockSignals(true);
+ spinBoxMax->setValue(mx);
+ spinBoxMax->blockSignals(false);
+ item->setText(COL_MAX, QString().setNum(mx));
+ }
+
+ spinBoxDefault->blockSignals(true);
+
+ spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value());
+
+ int inval = c->initVal();
+ if(inval == CTRL_VAL_UNKNOWN)
+ spinBoxDefault->setValue(spinBoxDefault->minValue());
+ else
+ {
+ if(inval < c->minVal())
+ {
+ c->setInitVal(c->minVal());
+ spinBoxDefault->setValue(c->minVal());
+ }
+ else
+ if(inval > c->maxVal())
+ {
+ c->setInitVal(c->maxVal());
+ spinBoxDefault->setValue(c->maxVal());
+ }
+ }
+
+ spinBoxDefault->blockSignals(false);
+
+ workingInstrument.setDirty(true);
+}
+
+//---------------------------------------------------------
+// ctrlMaxChanged
+//---------------------------------------------------------
+
+void EditInstrument::ctrlMaxChanged(int val)
+{
+ ListViewData* item = (ListViewData*)viewController->selectedItem();
+ if (item == 0)
+ return;
+
+ QString s;
+ s.setNum(val);
+ item->setText(COL_MAX, s);
+
+ MidiController* c = (MidiController*)item->data();
+ c->setMaxVal(val);
+
+ int rng = 0;
+ //switch((MidiController::ControllerType)ctrlType->currentItem())
+ switch(midiControllerType(c->num()))
+ {
+ case MidiController::Controller7:
+ case MidiController::RPN:
+ case MidiController::NRPN:
+ rng = 127;
+ break;
+ case MidiController::Controller14:
+ case MidiController::RPN14:
+ case MidiController::NRPN14:
+ case MidiController::Pitch:
+ rng = 16383;
+ break;
+ default:
+ break;
+ }
+
+ int mn = c->minVal();
+
+ //if(val < item->text(COL_MIN).toInt())
+ if(val < mn)
+ {
+ c->setMinVal(val);
+ spinBoxMin->blockSignals(true);
+ spinBoxMin->setValue(val);
+ spinBoxMin->blockSignals(false);
+ item->setText(COL_MIN, s);
+ }
+ else
+ if(val - mn > rng)
+ {
+ mn = val - rng;
+ c->setMinVal(mn);
+ spinBoxMin->blockSignals(true);
+ spinBoxMin->setValue(mn);
+ spinBoxMin->blockSignals(false);
+ item->setText(COL_MIN, QString().setNum(mn));
+ }
+
+ spinBoxDefault->blockSignals(true);
+
+ spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value());
+
+ int inval = c->initVal();
+ if(inval == CTRL_VAL_UNKNOWN)
+ spinBoxDefault->setValue(spinBoxDefault->minValue());
+ else
+ {
+ if(inval < c->minVal())
+ {
+ c->setInitVal(c->minVal());
+ spinBoxDefault->setValue(c->minVal());
+ }
+ else
+ if(inval > c->maxVal())
+ {
+ c->setInitVal(c->maxVal());
+ spinBoxDefault->setValue(c->maxVal());
+ }
+ }
+
+ spinBoxDefault->blockSignals(false);
+
+ workingInstrument.setDirty(true);
+}
+
+//---------------------------------------------------------
+// ctrlDefaultChanged
+//---------------------------------------------------------
+
+void EditInstrument::ctrlDefaultChanged(int val)
+{
+ ListViewData* item = (ListViewData*)viewController->selectedItem();
+ if (item == 0)
+ return;
+
+ MidiController* c = (MidiController*)item->data();
+
+ if(val == c->minVal() - 1)
+ {
+ c->setInitVal(CTRL_VAL_UNKNOWN);
+ item->setText(COL_DEF, QString("---"));
+ }
+ else
+ {
+ c->setInitVal(val);
+ item->setText(COL_DEF, QString().setNum(val));
+ }
+ workingInstrument.setDirty(true);
+}
+
+//---------------------------------------------------------
+// ctrlNullParamHChanged
+//---------------------------------------------------------
+
+void EditInstrument::ctrlNullParamHChanged(int nvh)
+{
+ int nvl = nullParamSpinBoxL->value();
+ if(nvh == -1)
+ {
+ nullParamSpinBoxL->blockSignals(true);
+ nullParamSpinBoxL->setValue(-1);
+ nullParamSpinBoxL->blockSignals(false);
+ nvl = -1;
+ }
+ else
+ {
+ if(nvl == -1)
+ {
+ nullParamSpinBoxL->blockSignals(true);
+ nullParamSpinBoxL->setValue(0);
+ nullParamSpinBoxL->blockSignals(false);
+ nvl = 0;
+ }
+ }
+ if(nvh == -1 && nvl == -1)
+ workingInstrument.setNullSendValue(-1);
+ else
+ workingInstrument.setNullSendValue((nvh << 8) | nvl);
+ workingInstrument.setDirty(true);
+}
+
+//---------------------------------------------------------
+// ctrlNullParamLChanged
+//---------------------------------------------------------
+
+void EditInstrument::ctrlNullParamLChanged(int nvl)
+{
+ int nvh = nullParamSpinBoxH->value();
+ if(nvl == -1)
+ {
+ nullParamSpinBoxH->blockSignals(true);
+ nullParamSpinBoxH->setValue(-1);
+ nullParamSpinBoxH->blockSignals(false);
+ nvh = -1;
+ }
+ else
+ {
+ if(nvh == -1)
+ {
+ nullParamSpinBoxH->blockSignals(true);
+ nullParamSpinBoxH->setValue(0);
+ nullParamSpinBoxH->blockSignals(false);
+ nvh = 0;
+ }
+ }
+ if(nvh == -1 && nvl == -1)
+ workingInstrument.setNullSendValue(-1);
+ else
+ workingInstrument.setNullSendValue((nvh << 8) | nvl);
+ workingInstrument.setDirty(true);
+}
+
+//---------------------------------------------------------
+// deletePatchClicked
+//---------------------------------------------------------
+
+void EditInstrument::deletePatchClicked()
+ {
+ //QListWidgetItem* item = instrumentList->currentItem();
+// ListBoxData* item = (ListBoxData*)instrumentList->selectedItem();
+// if (item == 0)
+// return;
+ //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>();
+// MidiInstrument* instrument = (MidiInstrument*)item->data();
+ //QTreeWidgetItem* pi = patchView->currentItem();
+ ListViewData* pi = (ListViewData*)patchView->selectedItem();
+ if (pi == 0)
+ return;
+
+ //void* p = pi->data(0, Qt::UserRole).value<void*>();
+// Patch* patch = (Patch*)pi->data();
+ //if (p == 0)
+ // If patch is zero it's a patch group.
+// if(patch == 0)
+
+ // If the item has a parent item, it's a patch item...
+ if(pi->parent())
+ {
+ PatchGroup* group = (PatchGroup*)((ListViewData*)pi->parent())->data();
+
+ // If there is an allocated patch in the data, delete it.
+ //Patch* patch = (Patch*)pi->auxData();
+ Patch* patch = (Patch*)pi->data();
+ if(patch)
+ {
+ if(group)
+ {
+ //for(iPatch ip = group->patches.begin(); ip != group->patches.end(); ++ip)
+ // if(&*ip == patch)
+ // if(*ip == patch)
+ // {
+ //
+ // printf("deletePatchClicked: erasing patch\n");
+ //
+ // group->patches.erase(ip);
+ // break;
+ // }
+ //group->patches.remove( (const Patch&)(*patch) );
+ group->patches.remove(patch);
+ }
+ delete patch;
+ }
+ }
+ else
+ // The item has no parent item, it's a patch group item...
+ {
+ // Is there an allocated patch group in the data?
+ //PatchGroup* group = (PatchGroup*)pi->auxData();
+ PatchGroup* group = (PatchGroup*)pi->data();
+ if(group)
+ {
+
+ PatchGroupList* pg = workingInstrument.groups();
+ //for(ciPatchGroup ipg = pg->begin(); ipg != pg->end(); ++ipg)
+ for(iPatchGroup ipg = pg->begin(); ipg != pg->end(); ++ipg)
+ {
+
+ //printf("deletePatchClicked: working patch group name:%s ad:%X group name:%s ad:%X\n", (*ipg)->name.latin1(), (unsigned int)(*ipg), group->name.latin1(), (unsigned int) group);
+
+ //if(&*ipg == group)
+ if(*ipg == group)
+ {
+ pg->erase(ipg);
+ break;
+ }
+ }
+
+ // Iterate all child list view (patch) items. Find and delete any allocated patches in the items' data.
+// for(ListViewData* i = (ListViewData*)pi->firstChild(); i; i = (ListViewData*)i->nextSibling())
+// {
+ //Patch* patch = (Patch*)i->auxData();
+// Patch* patch = (Patch*)i->data();
+// if(patch)
+// {
+ //delete patch;
+ //group->patches.remove(*patch);
+ const PatchList& pl = group->patches;
+ for(ciPatch ip = pl.begin(); ip != pl.end(); ++ip)
+ {
+// if(&*ip == patch)
+// {
+// group->patches.erase(ip);
+// break;
+// }
+
+ // Delete the patch.
+ if(*ip)
+ delete *ip;
+ }
+
+ //group->patches.clear();
+
+// }
+// }
+
+ // Now delete the group.
+ delete group;
+
+ }
+ }
+
+ //oldPatchItem = (ListViewData*)patchView->selectedItem();
+ //oldPatchItem = 0;
+
+ // Now delete the patch or group item (and any child patch items) from the list view tree.
+ // !!! This will trigger a patchChanged call.
+ patchView->blockSignals(true);
+ delete pi;
+ if(patchView->currentItem())
+ patchView->setSelected(patchView->currentItem(), true);
+ patchView->blockSignals(false);
+
+ oldPatchItem = 0;
+ patchChanged();
+
+ //Patch* patch = (Patch*)p;
+
+ //std::vector<PatchGroup>* pg = instrument->groups();
+ //for (std::vector<PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) {
+ // for (iPatch p = g->patches.begin(); p != g->patches.end(); ++p) {
+ // if (patch == *p) {
+ // g->patches.erase(p);
+ // delete pi;
+ // instrument->setDirty(true);
+ // return;
+ // }
+ // }
+ // }
+ //printf("fatal: patch not found\n");
+ //delete patch;
+ //delete pi;
+
+
+ workingInstrument.setDirty(true);
+ }
+
+//---------------------------------------------------------
+// newPatchClicked
+//---------------------------------------------------------
+
+void EditInstrument::newPatchClicked()
+ {
+ //QListWidgetItem* item = instrumentList->currentItem();
+// ListBoxData* item = (ListBoxData*)instrumentList->selectedItem();
+// if (item == 0)
+// return;
+
+ if(oldPatchItem)
+ {
+ if(oldPatchItem->parent())
+ updatePatch(&workingInstrument, (Patch*)oldPatchItem->data());
+ else
+ updatePatchGroup(&workingInstrument, (PatchGroup*)oldPatchItem->data());
+ }
+
+ //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>();
+// MidiInstrument* instrument = (MidiInstrument*)item->data();
+ //std::vector<PatchGroup>* pg = instrument->groups();
+// PatchGroupList* pg = instrument->groups();
+ PatchGroupList* pg = workingInstrument.groups();
+ QString patchName;
+ for (int i = 1;; ++i) {
+ patchName = QString("Patch-%1").arg(i);
+ bool found = false;
+
+ //for (std::vector<PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) {
+ for (iPatchGroup g = pg->begin(); g != pg->end(); ++g) {
+ PatchGroup* pgp = *g;
+ //for (iPatch p = g->patches.begin(); p != g->patches.end(); ++p) {
+ for (iPatch p = pgp->patches.begin(); p != pgp->patches.end(); ++p) {
+ //if (p->name == patchName) {
+ if ((*p)->name == patchName) {
+ found = true;
+ break;
+ }
+ }
+ if (found)
+ break;
+ }
+ if (!found)
+ break;
+ }
+
+ //
+ // search current patch group
+ //
+ //PatchGroup* pGroup = 0;
+ //QTreeWidgetItem* pi = patchView->currentItem();
+ ListViewData* pi = (ListViewData*)patchView->selectedItem();
+ if (pi == 0)
+ return;
+
+ // If there is data then pi is a patch item, and there must be a parent patch group item (with null data).
+ //if (pi->data(0, Qt::UserRole).value<void*>())
+ //if (pi->data())
+
+ Patch* selpatch = 0;
+
+ // If there is a parent item then pi is a patch item, and there must be a parent patch group item.
+ if(pi->parent())
+ {
+ // Remember the current selected patch.
+ selpatch = (Patch*)pi->data();
+
+ pi = (ListViewData*)pi->parent();
+ }
+
+ PatchGroup* group = (PatchGroup*)pi->data();
+ if(!group)
+ return;
+
+ //for (std::vector<PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) {
+// for (ciPatchGroup g = pg->begin(); g != pg->end(); ++g) {
+// if (g->name == pi->text(0)) {
+// pGroup = &*g;
+// break;
+// }
+// }
+// if (pGroup == 0) {
+// printf("group not found\n");
+// return;
+// }
+
+ // Create a new Patch, then store its pointer in a new patch item,
+ // to be added later to the patch group only upon save...
+ //Patch patch;
+ //patch.name = patchName;
+ Patch* patch = new Patch;
+ int hb = -1;
+ int lb = -1;
+ int prg = 0;
+ patch->hbank = hb;
+ patch->lbank = lb;
+ patch->prog = prg;
+ patch->typ = -1;
+ patch->drum = false;
+
+ if(selpatch)
+ {
+ hb = selpatch->hbank;
+ lb = selpatch->lbank;
+ prg = selpatch->prog;
+ patch->typ = selpatch->typ;
+ patch->drum = selpatch->drum;
+ }
+
+ bool found = false;
+
+ // The 129 is to accommodate -1 values. Yes, it may cause one extra redundant loop but hey,
+ // if it hasn't found an available patch number by then, another loop won't matter.
+ for(int k = 0; k < 129; ++k)
+ {
+ for(int j = 0; j < 129; ++j)
+ {
+ for(int i = 0; i < 128; ++i)
+ {
+ found = false;
+
+ for(iPatchGroup g = pg->begin(); g != pg->end(); ++g)
+ {
+ PatchGroup* pgp = *g;
+ for(iPatch ip = pgp->patches.begin(); ip != pgp->patches.end(); ++ip)
+ {
+ Patch* p = *ip;
+ if((p->prog == ((prg + i) & 0x7f)) &&
+ ((p->lbank == -1 && lb == -1) || (p->lbank == ((lb + j) & 0x7f))) &&
+ ((p->hbank == -1 && hb == -1) || (p->hbank == ((hb + k) & 0x7f))))
+ {
+ found = true;
+ break;
+ }
+ }
+ if(found)
+ break;
+ }
+
+ if(!found)
+ {
+ patch->prog = (prg + i) & 0x7f;
+ if(lb == -1)
+ patch->lbank = -1;
+ else
+ patch->lbank = (lb + j) & 0x7f;
+
+ if(hb == -1)
+ patch->hbank = -1;
+ else
+ patch->hbank = (hb + k) & 0x7f;
+
+ //patch->typ = selpatch->typ;
+ //patch->drum = selpatch->drum;
+ break;
+ }
+
+ }
+ if(!found)
+ break;
+ }
+ if(!found)
+ break;
+ }
+
+ patch->name = patchName;
+
+ group->patches.push_back(patch);
+ //Patch* pp = &(group->patches.back());
+
+ //QTreeWidgetItem* sitem = new QTreeWidgetItem;
+ ListViewData* sitem = new ListViewData(pi);
+ //sitem->setText(0, patch->name);
+ sitem->setText(0, patchName);
+
+ patchNameEdit->setText(patchName);
+
+ //QVariant v = QVariant::fromValue((void*)(patch));
+ //sitem->setData(0, Qt::UserRole, v);
+
+ // Set the list view item's data.
+ sitem->setData((void*)patch);
+ //sitem->setAuxData((void*)patch);
+ //sitem->setData((void*)pp);
+
+ //pi->addChild(sitem);
+
+ //printf("newPatchClicked: before patchView->setCurrentItem\n");
+
+ //patchView->setCurrentItem(sitem);
+
+ //printf("newPatchClicked: after patchView->setCurrentItem\n");
+
+ //oldPatchItem = 0;
+
+ // May cause patchChanged call.
+ patchView->blockSignals(true);
+ patchView->setSelected(sitem, true);
+ patchView->ensureItemVisible(sitem);
+ patchView->blockSignals(false);
+
+ //oldPatchItem = (ListViewData*)patchView->selectedItem();
+ //oldPatchItem = sitem;
+ //oldPatchItem = 0;
+
+ spinBoxHBank->setEnabled(true);
+ spinBoxLBank->setEnabled(true);
+ spinBoxProgram->setEnabled(true);
+ checkBoxDrum->setEnabled(true);
+ checkBoxGM->setEnabled(true);
+ checkBoxGS->setEnabled(true);
+ checkBoxXG->setEnabled(true);
+
+ oldPatchItem = 0;
+ patchChanged();
+
+ //instrument->setDirty(true);
+ workingInstrument.setDirty(true);
+ }
+
+//---------------------------------------------------------
+// newGroupClicked
+//---------------------------------------------------------
+
+void EditInstrument::newGroupClicked()
+ {
+ //QListWidgetItem* item = instrumentList->currentItem();
+// ListBoxData* item = (ListBoxData*)instrumentList->selectedItem();
+// if (item == 0)
+// return;
+
+ if(oldPatchItem)
+ {
+ if(oldPatchItem->parent())
+ updatePatch(&workingInstrument, (Patch*)oldPatchItem->data());
+ else
+ updatePatchGroup(&workingInstrument, (PatchGroup*)oldPatchItem->data());
+ }
+
+ //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>();
+// MidiInstrument* instrument = (MidiInstrument*)item->data();
+ //std::vector<PatchGroup>* pg = instrument->groups();
+// PatchGroupList* pg = instrument->groups();
+ PatchGroupList* pg = workingInstrument.groups();
+ QString groupName;
+ for (int i = 1;; ++i) {
+ groupName = QString("Group-%1").arg(i);
+ bool found = false;
+
+ //for (std::vector<PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) {
+ for (ciPatchGroup g = pg->begin(); g != pg->end(); ++g) {
+ //if (g->name == groupName) {
+ if ((*g)->name == groupName) {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ break;
+ }
+
+ // Create a new PatchGroup, then store its pointer in a new patch group item,
+ // to be added later to the instrument only upon save...
+ PatchGroup* group = new PatchGroup;
+ group->name = groupName;
+ //PatchGroup group;
+ //group.name = groupName;
+
+ pg->push_back(group);
+ //PatchGroup* pgp = &(pg->back());
+
+ //QTreeWidgetItem* sitem = new QTreeWidgetItem;
+ ListViewData* sitem = new ListViewData(patchView);
+ sitem->setText(0, groupName);
+
+ patchNameEdit->setText(groupName);
+
+ //QVariant v = QVariant::fromValue((void*)0);
+ //sitem->setData(0, Qt::UserRole, v);
+ //sitem->setData((void*)0);
+
+ // Set the list view item's data.
+ sitem->setData((void*)group);
+ //sitem->setAuxData((void*)pgp);
+
+ //patchView->addTopLevelItem(sitem);
+ //patchView->setCurrentItem(sitem);
+
+ //oldPatchItem = 0;
+
+ // May cause patchChanged call.
+ patchView->blockSignals(true);
+ patchView->setSelected(sitem, true);
+ patchView->blockSignals(false);
+
+ //oldPatchItem = (ListViewData*)patchView->selectedItem();
+ oldPatchItem = sitem;
+ //oldPatchItem = 0;
+ //patchChanged();
+
+ spinBoxHBank->setEnabled(false);
+ spinBoxLBank->setEnabled(false);
+ spinBoxProgram->setEnabled(false);
+ checkBoxDrum->setEnabled(false);
+ checkBoxGM->setEnabled(false);
+ checkBoxGS->setEnabled(false);
+ checkBoxXG->setEnabled(false);
+
+ //instrument->setDirty(true);
+ workingInstrument.setDirty(true);
+ }
+
+//---------------------------------------------------------
+// deleteControllerClicked
+//---------------------------------------------------------
+
+void EditInstrument::deleteControllerClicked()
+ {
+ //QListWidgetItem* item = instrumentList->currentItem();
+ //ListBoxData* item = (ListBoxData*)instrumentList->selectedItem();
+ //QListWidgetItem* item2 = listController->currentItem();
+// ListBoxData* item = (ListBoxData*)listController->selectedItem();
+ ListViewData* item = (ListViewData*)viewController->selectedItem();
+
+ //if (item == 0 || item2 == 0)
+ if(!item)
+ return;
+ //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>();
+// MidiInstrument* instrument = (MidiInstrument*)item->data();
+ //MidiController* ctrl = (MidiController*)item2->data(Qt::UserRole).value<void*>();
+ //MidiController* ctrl = (MidiController*)item2->data();
+ //MidiControllerList* cl = instrument->controller();
+ //cl->removeAll(ctrl);
+
+ MidiController* ctrl = (MidiController*)item->data();
+ if(!ctrl)
+ return;
+
+ workingInstrument.controller()->erase(ctrl->num());
+ // Now delete the controller.
+ delete ctrl;
+
+ // Now remove the controller item from the list.
+ // This may cause a controllerChanged call.
+// listController->blockSignals(true);
+ viewController->blockSignals(true);
+ delete item;
+ if(viewController->currentItem())
+ viewController->setSelected(viewController->currentItem(), true);
+// listController->blockSignals(false);
+ viewController->blockSignals(false);
+
+ //oldController = (ListBoxData*)listController->selectedItem();
+// oldController = 0;
+
+ controllerChanged();
+
+ //instrument->setDirty(true);
+ workingInstrument.setDirty(true);
+ }
+
+//---------------------------------------------------------
+// newControllerClicked
+//---------------------------------------------------------
+
+void EditInstrument::newControllerClicked()
+ {
+ //QListWidgetItem* item = instrumentList->currentItem();
+ //if (item == 0)
+ // return;
+ //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>();
+
+// if(oldController)
+// updateController(&workingInstrument, (MidiController*)oldController->data());
+
+ QString cName;
+ //MidiControllerList* cl = instrument->controller();
+ MidiControllerList* cl = workingInstrument.controller();
+ for (int i = 1;; ++i) {
+ //ctrlName = QString("Controller-%d").arg(i);
+ cName = QString("Controller-%1").arg(i);
+ bool found = false;
+ for (iMidiController ic = cl->begin(); ic != cl->end(); ++ic) {
+ MidiController* c = ic->second;
+ if (c->name() == cName) {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ break;
+ }
+
+ MidiController* ctrl = new MidiController();
+ ctrl->setNum(CTRL_MODULATION);
+ ctrl->setMinVal(0);
+ ctrl->setMaxVal(127);
+ ctrl->setInitVal(CTRL_VAL_UNKNOWN);
+
+ ListViewData* ci = (ListViewData*)viewController->selectedItem();
+
+ // To allow for quick multiple successive controller creation.
+ // If there's a current controller item selected, copy initial values from it.
+ bool found = false;
+ if(ci)
+ {
+ MidiController* selctl = (MidiController*)ci->data();
+ // Assign.
+ // *ctrl = *selctl;
+
+ // Auto increment controller number.
+ //int l = ctrl->num() & 0x7f;
+ //int h = ctrl->num() & 0xffffff00;
+ int l = selctl->num() & 0x7f;
+ int h = selctl->num() & 0xffffff00;
+
+ // Ignore internal controllers and wild cards.
+ //if(((h & 0xff0000) != 0x40000) && ((ctrl->num() & 0xff) != 0xff))
+ if(((h & 0xff0000) != 0x40000) && ((selctl->num() & 0xff) != 0xff))
+ {
+ // Assign.
+ *ctrl = *selctl;
+
+ for (int i = 1; i < 128; ++i)
+ {
+ //ctrlName = QString("Controller-%d").arg(i);
+ //cName = QString("Controller-%1").arg(i);
+ int j = ((i + l) & 0x7f) | h;
+ found = false;
+ for (iMidiController ic = cl->begin(); ic != cl->end(); ++ic)
+ {
+ MidiController* c = ic->second;
+ if(c->num() == j)
+ {
+ found = true;
+ break;
+ }
+ }
+ if(!found)
+ {
+ ctrl->setNum(j);
+ break;
+ }
+ }
+ }
+ }
+
+ ctrl->setName(cName);
+
+ //item = new QListWidgetItem(ctrlName);
+// ListBoxData* item = new ListBoxData(ctrlName);
+
+ //QVariant v = qVariantFromValue((void*)(ctrl));
+ //item->setData(Qt::UserRole, v);
+// item->setData((void*)ctrl);
+ //listController->addItem(item);
+// listController->insertItem(item);
+ //listController->setCurrentItem(item);
+
+ workingInstrument.controller()->add(ctrl);
+ ListViewData* item = addControllerToView(ctrl);
+
+// listController->blockSignals(true);
+// listController->setSelected(item, true);
+// listController->blockSignals(false);
+ viewController->blockSignals(true);
+ viewController->setSelected(item, true);
+ viewController->blockSignals(false);
+
+ //oldController = (ListBoxData*)listController->selectedItem();
+// oldController = item;
+ //oldController = 0;
+ // MidiController is a class, with itialized values. We have to call this to show the values.
+ // To make multiple entries easier, don't bother calling this.
+ controllerChanged();
+
+ //instrument->setDirty(true);
+ workingInstrument.setDirty(true);
+ }
+
+//---------------------------------------------------------
+// addControllerClicked
+//---------------------------------------------------------
+
+void EditInstrument::addControllerClicked()
+{
+ //int lnum = listController->currentItem();
+ //if(lnum == -1)
+ // return;
+
+ //QString name = midiCtrlName(lnum);
+
+ int idx = listController->currentItem();
+ if(idx == -1)
+ return;
+
+ int lnum = -1;
+ QString name = listController->currentText();
+ for(int i = 0; i < 128; i++)
+ {
+ if(midiCtrlName(i) == name)
+ {
+ lnum = i;
+ break;
+ }
+ }
+ if(lnum == -1)
+ {
+ printf("Add controller: Controller not found: %s\n", name.latin1());
+ return;
+ }
+
+ int num = MidiController::genNum(MidiController::Controller7, 0, lnum);
+
+ MidiControllerList* cl = workingInstrument.controller();
+ for(iMidiController ic = cl->begin(); ic != cl->end(); ++ic)
+ {
+ MidiController* c = ic->second;
+ if(c->name() == name)
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Cannot add common controller"),
+ tr("A controller named ") + name + tr(" already exists."),
+ QMessageBox::Ok,
+ Qt::NoButton,
+ Qt::NoButton);
+
+ return;
+ }
+
+ if(c->num() == num)
+ {
+ QMessageBox::critical(this,
+ tr("MusE: Cannot add common controller"),
+ tr("A controller number ") + QString().setNum(num) + tr(" already exists."),
+ QMessageBox::Ok,
+ Qt::NoButton,
+ Qt::NoButton);
+
+ return;
+ }
+ }
+
+ MidiController* ctrl = new MidiController();
+ ctrl->setNum(num);
+ ctrl->setMinVal(0);
+ ctrl->setMaxVal(127);
+ ctrl->setInitVal(CTRL_VAL_UNKNOWN);
+ ctrl->setName(name);
+
+ workingInstrument.controller()->add(ctrl);
+
+ ListViewData* item = addControllerToView(ctrl);
+
+ viewController->blockSignals(true);
+ viewController->setSelected(item, true);
+ viewController->blockSignals(false);
+
+ controllerChanged();
+
+ workingInstrument.setDirty(true);
+}
+
+/*
+//---------------------------------------------------------
+// deleteSysexClicked
+//---------------------------------------------------------
+
+void EditInstrument::deleteSysexClicked()
+ {
+ //QListWidgetItem* item = instrumentList->currentItem();
+ //QListWidgetItem* item2 = sysexList->currentItem();
+ //if (item == 0 || item2 == 0)
+ // return;
+
+ //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>();
+ //SysEx* sysex = (SysEx*)item2->data(Qt::UserRole).value<void*>();
+ //QList<SysEx*> sl = instrument->sysex();
+ //instrument->removeSysex(sysex);
+ //delete item2;
+ //instrument->setDirty(true);
+
+
+
+ ListBoxData* item = (ListBoxData*)sysexList->selectedItem();
+ if(!item)
+ return;
+
+ EventList* el = (EventList*)item->data();
+ if(!el)
+ return;
+
+ }
+*/
+
+//---------------------------------------------------------
+// updatePatchGroup
+//---------------------------------------------------------
+
+void EditInstrument::updatePatchGroup(MidiInstrument* instrument, PatchGroup* pg)
+ {
+ if (pg->name != patchNameEdit->text()) {
+ pg->name = patchNameEdit->text();
+ instrument->setDirty(true);
+ }
+ }
+
+//---------------------------------------------------------
+// updatePatch
+//---------------------------------------------------------
+
+void EditInstrument::updatePatch(MidiInstrument* instrument, Patch* p)
+ {
+ if (p->name != patchNameEdit->text()) {
+ p->name = patchNameEdit->text();
+ instrument->setDirty(true);
+ }
+
+ signed char hb = (spinBoxHBank->value() - 1) & 0xff;
+ //if (p->hbank != (spinBoxHBank->value() & 0xff)) {
+ // p->hbank = spinBoxHBank->value() & 0xff;
+ if (p->hbank != hb) {
+ p->hbank = hb;
+
+ instrument->setDirty(true);
+ }
+
+ signed char lb = (spinBoxLBank->value() - 1) & 0xff;
+ //if (p->lbank != (spinBoxLBank->value() & 0xff)) {
+ // p->lbank = spinBoxLBank->value() & 0xff;
+ if (p->lbank != lb) {
+ p->lbank = lb;
+
+ instrument->setDirty(true);
+ }
+
+ signed char pr = (spinBoxProgram->value() - 1) & 0xff;
+ if (p->prog != pr) {
+ p->prog = pr;
+
+ instrument->setDirty(true);
+ }
+
+ if (p->drum != checkBoxDrum->isChecked()) {
+ p->drum = checkBoxDrum->isChecked();
+ instrument->setDirty(true);
+ }
+
+ // there is no logical xor in c++
+ bool a = p->typ & 1;
+ bool b = p->typ & 2;
+ bool c = p->typ & 4;
+ bool aa = checkBoxGM->isChecked();
+ bool bb = checkBoxGS->isChecked();
+ bool cc = checkBoxXG->isChecked();
+ if ((a ^ aa) || (b ^ bb) || (c ^ cc)) {
+ int value = 0;
+ if (checkBoxGM->isChecked())
+ value |= 1;
+ if (checkBoxGS->isChecked())
+ value |= 2;
+ if (checkBoxXG->isChecked())
+ value |= 4;
+ p->typ = value;
+ instrument->setDirty(true);
+ }
+
+ //if (p->categorie != category->currentIndex()) {
+ // p->categorie = category->currentIndex();
+ // instrument->setDirty(true);
+ // }
+ }
+
+/*
+//---------------------------------------------------------
+// updateController
+//---------------------------------------------------------
+
+void EditInstrument::updateController(MidiInstrument* instrument, MidiController* oc)
+ {
+ printf("updateController: A\n");
+
+ int ctrlH = spinBoxHCtrlNo->value();
+ int ctrlL = spinBoxLCtrlNo->value();
+ //MidiController::ControllerType type = (MidiController::ControllerType)ctrlType->currentIndex();
+ MidiController::ControllerType type = (MidiController::ControllerType)ctrlType->currentItem();
+ int num = MidiController::genNum(type, ctrlH, ctrlL);
+ //int num = (ctrlH << 8) & 0x7f + ctrlL & 0x7f;
+
+ printf("updateController: B\n");
+
+ if (num != oc->num()) {
+
+ printf("updateController: num changed, setting dirty. num:%d c->num:%d\n", num, oc->num());
+
+ oc->setNum(num);
+ instrument->setDirty(true);
+ }
+
+ if(type != MidiController::Pitch && type != MidiController::Program)
+ {
+ if (spinBoxMin->value() != oc->minVal()) {
+
+ printf("updateController: min changed, setting dirty. min:%d c->min:%d\n", spinBoxMin->value(), oc->minVal());
+
+ oc->setMinVal(spinBoxMin->value());
+ instrument->setDirty(true);
+ }
+ if (spinBoxMax->value() != oc->maxVal()) {
+
+ printf("updateController: max changed, setting dirty. num:%d max:%d c->max:%d\n", num, spinBoxMax->value(), oc->maxVal());
+
+ oc->setMaxVal(spinBoxMax->value());
+ instrument->setDirty(true);
+ }
+
+ int dv = spinBoxDefault->value();
+ if(dv == oc->minVal() - 1)
+ dv = CTRL_VAL_UNKNOWN;
+
+ //if (spinBoxDefault->value() != oc->initVal()) {
+ if(dv != oc->initVal()) {
+ //oc->setInitVal(spinBoxDefault->value());
+ oc->setInitVal(dv);
+
+ printf("updateController: default changed, setting dirty. def:%d c->init:%d\n", dv, oc->initVal());
+
+ instrument->setDirty(true);
+ }
+ }
+
+
+ printf("updateController: C\n");
+
+ //if (moveWithPart->isChecked() ^ oc->moveWithPart()) {
+ // oc->setMoveWithPart(moveWithPart->isChecked());
+ // instrument->setDirty(true);
+ // }
+ if (ctrlName->text() != oc->name()) {
+ oc->setName(ctrlName->text());
+
+ printf("updateController: name changed, setting dirty. name:%s c->name:%s\n", ctrlName->text().latin1(), oc->name().latin1());
+
+ instrument->setDirty(true);
+ }
+ //if (ctrlComment->toPlainText() != oc->comment()) {
+ // oc->setComment(ctrlComment->toPlainText());
+ // instrument->setDirty(true);
+ // }
+
+ printf("updateController: D\n");
+
+ }
+*/
+
+//---------------------------------------------------------
+// updateInstrument
+//---------------------------------------------------------
+
+void EditInstrument::updateInstrument(MidiInstrument* instrument)
+ {
+ //QListWidgetItem* sysexItem = sysexList->currentItem();
+ //ListBoxData* sysexItem = sysexList->currentItem();
+ //if (sysexItem) {
+ // SysEx* so = (SysEx*)sysexItem->data(Qt::UserRole).value<void*>();
+ // updateSysex(instrument, so);
+ // }
+
+ //QListWidgetItem* ctrlItem = listController->currentItem();
+ //ListBoxData* ctrlItem = (ListBoxData*)listController->currentItem();
+ //ListBoxData* ctrlItem = (ListBoxData*)listController->selectedItem();
+// ListViewData* ctrlItem = (ListViewData*)viewController->selectedItem();
+
+// if (ctrlItem) {
+ //MidiController* ctrl = (MidiController*)ctrlItem->data(Qt::UserRole).value<void*>();
+
+// printf("updateInstrument: AB\n");
+
+// MidiController* ctrl = (MidiController*)ctrlItem->data();
+
+// printf("updateInstrument: AC\n");
+
+// updateController(instrument, ctrl);
+// }
+
+// printf("updateInstrument: B\n");
+
+ //QTreeWidgetItem* patchItem = patchView->currentItem();
+ ListViewData* patchItem = (ListViewData*)patchView->selectedItem();
+ if (patchItem)
+ {
+ //Patch* p = (Patch*)patchItem->data(0, Qt::UserRole).value<void*>();
+
+ // If the item has a parent, it's a patch item.
+ if(patchItem->parent())
+ updatePatch(instrument, (Patch*)patchItem->data());
+ else
+ updatePatchGroup(instrument, (PatchGroup*)patchItem->data());
+
+ }
+ }
+
+//---------------------------------------------------------
+// checkDirty
+// return true on Abort
+//---------------------------------------------------------
+
+int EditInstrument::checkDirty(MidiInstrument* i, bool isClose)
+ {
+ updateInstrument(i);
+ if (!i->dirty())
+ //return false;
+ return 0;
+ int n;
+ if(isClose)
+ n = QMessageBox::warning(this, tr("MusE"),
+ tr("The current Instrument contains unsaved data\n"
+ "Save Current Instrument?"),
+ tr("&Save"), tr("&Nosave"), tr("&Abort"), 0, 2);
+ else
+ n = QMessageBox::warning(this, tr("MusE"),
+ tr("The current Instrument contains unsaved data\n"
+ "Save Current Instrument?"),
+ tr("&Save"), tr("&Nosave"), 0, 1);
+ if (n == 0) {
+ if (i->filePath().isEmpty())
+ {
+ //fileSaveAs();
+ saveAs();
+ }
+ else {
+ //QFile f(i->filePath());
+ //if (!f.open(QIODevice::WriteOnly))
+ FILE* f = fopen(i->filePath().latin1(), "w");
+ if(f == 0)
+ //fileSaveAs();
+ saveAs();
+ else {
+ //f.close();
+ if(fclose(f) != 0)
+ printf("EditInstrument::checkDirty: Error closing file\n");
+
+ if(fileSave(i, i->filePath()))
+ i->setDirty(false);
+ }
+ }
+ //return false;
+ return 0;
+ }
+ //return n == 2;
+ return n;
+ }
+
+//---------------------------------------------------------
+// getPatchItemText
+//---------------------------------------------------------
+
+QString EditInstrument::getPatchItemText(int val)
+{
+ QString s;
+ if(val == CTRL_VAL_UNKNOWN)
+ s = "---";
+ else
+ {
+ int hb = ((val >> 16) & 0xff) + 1;
+ if (hb == 0x100)
+ hb = 0;
+ int lb = ((val >> 8) & 0xff) + 1;
+ if (lb == 0x100)
+ lb = 0;
+ int pr = (val & 0xff) + 1;
+ if (pr == 0x100)
+ pr = 0;
+ s.sprintf("%d-%d-%d", hb, lb, pr);
+ }
+
+ return s;
+}
+
+//---------------------------------------------------------
+// enableDefaultControls
+//---------------------------------------------------------
+
+void EditInstrument::enableDefaultControls(bool enVal, bool enPatch)
+{
+ spinBoxDefault->setEnabled(enVal);
+ patchButton->setEnabled(enPatch);
+ if(!enPatch)
+ {
+ patchButton->blockSignals(true);
+ patchButton->setText("---");
+ patchButton->blockSignals(false);
+ }
+ defPatchH->setEnabled(enPatch);
+ defPatchL->setEnabled(enPatch);
+ defPatchProg->setEnabled(enPatch);
+}
+
+//---------------------------------------------------------
+// setDefaultPatchName
+//---------------------------------------------------------
+
+void EditInstrument::setDefaultPatchName(int val)
+{
+ const char* patchname = getPatchName(val);
+ patchButton->blockSignals(true);
+ patchButton->setText(QString(patchname));
+ patchButton->blockSignals(false);
+}
+
+//---------------------------------------------------------
+// getDefaultPatchNumber
+//---------------------------------------------------------
+
+int EditInstrument::getDefaultPatchNumber()
+{
+ int hval = defPatchH->value() - 1;
+ int lval = defPatchL->value() - 1;
+ int prog = defPatchProg->value() - 1;
+ if(hval == -1)
+ hval = 0xff;
+ if(lval == -1)
+ lval = 0xff;
+ if(prog == -1)
+ prog = 0xff;
+
+ return ((hval & 0xff) << 16) + ((lval & 0xff) << 8) + (prog & 0xff);
+}
+
+//---------------------------------------------------------
+// setDefaultPatchNumbers
+//---------------------------------------------------------
+
+void EditInstrument::setDefaultPatchNumbers(int val)
+{
+ int hb;
+ int lb;
+ int pr;
+
+ if(val == CTRL_VAL_UNKNOWN)
+ hb = lb = pr = 0;
+ else
+ {
+ hb = ((val >> 16) & 0xff) + 1;
+ if (hb == 0x100)
+ hb = 0;
+ lb = ((val >> 8) & 0xff) + 1;
+ if (lb == 0x100)
+ lb = 0;
+ pr = (val & 0xff) + 1;
+ if (pr == 0x100)
+ pr = 0;
+ }
+
+ defPatchH->blockSignals(true);
+ defPatchL->blockSignals(true);
+ defPatchProg->blockSignals(true);
+ defPatchH->setValue(hb);
+ defPatchL->setValue(lb);
+ defPatchProg->setValue(pr);
+ defPatchH->blockSignals(false);
+ defPatchL->blockSignals(false);
+ defPatchProg->blockSignals(false);
+}
+
+//---------------------------------------------------------
+// setDefaultPatchControls
+//---------------------------------------------------------
+
+void EditInstrument::setDefaultPatchControls(int val)
+{
+ setDefaultPatchNumbers(val);
+ setDefaultPatchName(val);
+}
+
+//---------------------------------------------------------
+// getPatchName
+//---------------------------------------------------------
+
+const char* EditInstrument::getPatchName(int prog)
+{
+ int pr = prog & 0xff;
+ if(prog == CTRL_VAL_UNKNOWN || pr == 0xff)
+ return "---";
+
+ //int hbank = (prog >> 16) & 0x7f;
+ //int lbank = (prog >> 8) & 0x7f;
+ int hbank = (prog >> 16) & 0xff;
+ int lbank = (prog >> 8) & 0xff;
+
+ PatchGroupList* pg = workingInstrument.groups();
+
+ for(ciPatchGroup i = pg->begin(); i != pg->end(); ++i) {
+ const PatchList& pl = (*i)->patches;
+ for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) {
+ const Patch* mp = *ipl;
+ if (//(mp->typ & tmask) &&
+ (pr == mp->prog)
+ //&& ((drum && mode != MT_GM) ||
+ // (mp->drum == drumchan))
+
+ //&& (hbank == mp->hbank || !hb || mp->hbank == -1)
+ //&& (lbank == mp->lbank || !lb || mp->lbank == -1))
+ && (hbank == mp->hbank || mp->hbank == -1)
+ && (lbank == mp->lbank || mp->lbank == -1))
+ return mp->name.latin1();
+ }
+ }
+ return "---";
+}
+
diff --git a/muse2/muse/instruments/editinstrument.h b/muse2/muse/instruments/editinstrument.h
new file mode 100644
index 00000000..ef01f525
--- /dev/null
+++ b/muse2/muse/instruments/editinstrument.h
@@ -0,0 +1,92 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: editinstrument.h,v 1.1.1.1.2.4 2009/05/31 05:12:12 terminator356 Exp $
+//
+// (C) Copyright 2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __EDITINSTRUMENT_H__
+#define __EDITINSTRUMENT_H__
+
+#include "editinstrumentbase.h"
+#include "minstrument.h"
+#include "midictrl.h"
+//Added by qt3to4:
+#include <Q3PopupMenu>
+#include <QCloseEvent>
+class ListBoxData;
+class ListViewData;
+
+//---------------------------------------------------------
+// EditInstrument
+//---------------------------------------------------------
+
+class EditInstrument : public EditInstrumentBase {
+ Q_OBJECT
+
+ MidiInstrument workingInstrument;
+ ListBoxData* oldMidiInstrument;
+ ListViewData* oldPatchItem;
+ void closeEvent(QCloseEvent*);
+ int checkDirty(MidiInstrument*, bool isClose = false);
+ bool fileSave(MidiInstrument*, const QString&);
+ void saveAs();
+ void updateInstrument(MidiInstrument*);
+ void updatePatch(MidiInstrument*, Patch*);
+ void updatePatchGroup(MidiInstrument*, PatchGroup*);
+ void changeInstrument();
+ ListViewData* addControllerToView(MidiController* mctrl);
+ QString getPatchItemText(int);
+ void enableDefaultControls(bool, bool);
+ void setDefaultPatchName(int);
+ int getDefaultPatchNumber();
+ void setDefaultPatchNumbers(int);
+ void setDefaultPatchControls(int);
+ const char* getPatchName(int);
+ void deleteInstrument(ListBoxData*);
+ Q3PopupMenu* patchpopup;
+
+ private slots:
+ virtual void fileNew();
+ virtual void fileOpen();
+ virtual void fileSave();
+ virtual void fileSaveAs();
+ virtual void fileExit();
+ virtual void helpWhatsThis();
+ void instrumentChanged();
+ void tabChanged(QWidget*);
+ void patchChanged();
+ void controllerChanged();
+ //void instrumentNameChanged(const QString&);
+ void instrumentNameReturn();
+ void patchNameReturn();
+ void deletePatchClicked();
+ void newPatchClicked();
+ void newGroupClicked();
+ void patchButtonClicked();
+ void defPatchChanged(int);
+ //void newCategoryClicked();
+ void deleteControllerClicked();
+ void newControllerClicked();
+ void addControllerClicked();
+ void ctrlTypeChanged(int);
+ //void ctrlNameChanged(const QString&);
+ void ctrlNameReturn();
+ void ctrlHNumChanged(int);
+ void ctrlLNumChanged(int);
+ void ctrlMinChanged(int);
+ void ctrlMaxChanged(int);
+ void ctrlDefaultChanged(int);
+ //void sysexChanged();
+ //void deleteSysexClicked();
+ //void newSysexClicked();
+ void ctrlNullParamHChanged(int);
+ void ctrlNullParamLChanged(int);
+
+ public:
+ EditInstrument(QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = Qt::WType_TopLevel);
+ };
+
+#endif
+
diff --git a/muse2/muse/instruments/editinstrumentbase.ui b/muse2/muse/instruments/editinstrumentbase.ui
new file mode 100644
index 00000000..8f5ecc7b
--- /dev/null
+++ b/muse2/muse/instruments/editinstrumentbase.ui
@@ -0,0 +1,1840 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>EditInstrumentBase</class>
+<widget class="QMainWindow">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>802</width>
+ <height>505</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>802</width>
+ <height>464</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>MusE: Instrument Editor</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>splitter4</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>780</width>
+ <height>365</height>
+ </size>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout26</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Instrument Name:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>instrumentName</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Selected instrument name.</string>
+ </property>
+ </widget>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>instrumentList</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>List of defined instruments.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget3</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>patchesTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Pa&amp;tches</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>splitter5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Group/Patch</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>patchView</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>List of groups and patches.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout26</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Properties</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabelPatchName</cstring>
+ </property>
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>patchNameEdit</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Group or patch name</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Group or patch name</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>High Bank:</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout22</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>spinBoxHBank</cstring>
+ </property>
+ <property name="specialValueText">
+ <string>---</string>
+ <comment>dont care</comment>
+ </property>
+ <property name="maxValue">
+ <number>128</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Patch high bank number</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Patch high bank number. --- means don't care.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>373</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Low Bank:</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout23</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>spinBoxLBank</cstring>
+ </property>
+ <property name="specialValueText">
+ <string>---</string>
+ </property>
+ <property name="maxValue">
+ <number>128</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Patch low bank number</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Patch low bank number. --- means don't care.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>373</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel4_3</cstring>
+ </property>
+ <property name="text">
+ <string>Program:</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout24</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>spinBoxProgram</cstring>
+ </property>
+ <property name="maxValue">
+ <number>128</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Patch program number</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Patch program number</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>373</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>checkBoxDrum</cstring>
+ </property>
+ <property name="text">
+ <string>Drum</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Drum patch</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If set, the patch is available only for drum channels.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>checkBoxGM</cstring>
+ </property>
+ <property name="text">
+ <string>GM</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>GM patch</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If set, the patch is available in a 'GM' or 'NO' midi song type.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>checkBoxGS</cstring>
+ </property>
+ <property name="text">
+ <string>GS</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>GS patch</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If set, the patch is available in a 'GS' or 'NO' midi song type.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>checkBoxXG</cstring>
+ </property>
+ <property name="text">
+ <string>XG</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>XG patch</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If set, the patch is available in an 'XG' or 'NO' midi song type.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>90</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>patchDelete</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Delete</string>
+ </property>
+ <property name="accel">
+ <string>Alt+D</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Delete group or patch</string>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>patchNew</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>New &amp;Patch</string>
+ </property>
+ <property name="accel">
+ <string>Alt+P</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>New patch</string>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>patchNewGroup</cstring>
+ </property>
+ <property name="text">
+ <string>New &amp;Group</string>
+ </property>
+ <property name="accel">
+ <string>Alt+G</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>New group</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>240</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>controllerTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Contro&amp;ller</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>splitter4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Common:</string>
+ </property>
+ </widget>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>listController</cstring>
+ </property>
+ <property name="variableWidth">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This is a list of commonly used midi controllers.
+Note that in MusE pitch and program changes are
+handled like normal controllers.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout17</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Name </string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Type </string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>H-Ctrl</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>L-Ctrl</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Min </string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Max </string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Def </string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>viewController</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>List of defined controllers</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>List of defined controllers.</string>
+ </property>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Properties</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout33</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>ctrlName</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Midi controller name</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout37</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2_4</cstring>
+ </property>
+ <property name="text">
+ <string>Type:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>Control7</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Control14</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>RPN</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>NRPN</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>RPN14</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>NRPN14</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Pitch</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Program</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>ctrlType</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Midi controller type</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Midi controller type</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer15</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>H-Ctrl</string>
+ </property>
+ <property name="indent">
+ <number>10</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>spinBoxHCtrlNo</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Midi controller number high byte</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Midi controller number high byte</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer16</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2_3_2</cstring>
+ </property>
+ <property name="text">
+ <string>L-Ctrl</string>
+ </property>
+ <property name="indent">
+ <number>10</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>spinBoxLCtrlNo</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="specialValueText">
+ <string>*</string>
+ <comment>wild card</comment>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ <property name="minValue">
+ <number>-1</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Midi controller number low byte (* means drum controller)</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Midi controller number low byte.
+If low byte is * then the controller is a
+ 'drum controller'. For drum tracks and
+ GS/XG type songs and instruments.
+Allows controllers for each instrument in
+ Muse's drum map. The low byte will be
+ replaced by the 'ANote' in the drum map.
+Examples: The GS and XG instruments'
+ Drum controllers.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout38</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel4_2</cstring>
+ </property>
+ <property name="text">
+ <string>Range:</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer17</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Min</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="indent">
+ <number>10</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>spinBoxMin</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maxValue">
+ <number>16383</number>
+ </property>
+ <property name="minValue">
+ <number>-16384</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Minimum value. If negative, auto-translate.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Minimum value. If the minimum value
+ is negative, the range will automatically
+ be translated to a positive range.
+
+Useful for controllers which should be
+ displayed with zero bias. For example,
+'Pan': Minimum: -64 Maximum: 63
+True range: Min: 0 Max: 127 (bias = 64)
+'CoarseTuning': Min: -24 Max: 23
+True range: Min: 40 Max: 87 (bias = 64)
+
+Bias is determined from controller type:
+7-bit Controller7 / RPN: Bias = 64
+14-bit Controller14 / RPN14: Bias = 8192
+
+Type 'Pitch' is the exception. It is biased
+ at zero, even with a negative minimum:
+'Pitch': Min: -8192 Max: 8191
+True range: Min: -8192 Max: 8191 (bias 0)</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer18</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Max</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="indent">
+ <number>10</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>spinBoxMax</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maxValue">
+ <number>16383</number>
+ </property>
+ <property name="minValue">
+ <number>-16384</number>
+ </property>
+ <property name="value">
+ <number>127</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Maximum value</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Maximum value</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout16</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer13_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>Default:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="6">
+ <property name="name">
+ <cstring>textLabel2_4</cstring>
+ </property>
+ <property name="text">
+ <string>L-Bank</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="5">
+ <property name="name">
+ <cstring>defPatchH</cstring>
+ </property>
+ <property name="specialValueText">
+ <string>off</string>
+ </property>
+ <property name="maxValue">
+ <number>128</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="7">
+ <property name="name">
+ <cstring>defPatchL</cstring>
+ </property>
+ <property name="specialValueText">
+ <string>off</string>
+ </property>
+ <property name="maxValue">
+ <number>128</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="6">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Progr.</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="7">
+ <property name="name">
+ <cstring>defPatchProg</cstring>
+ </property>
+ <property name="specialValueText">
+ <string>off</string>
+ </property>
+ <property name="maxValue">
+ <number>128</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="2" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>patchButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>210</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>???</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="4">
+ <property name="name">
+ <cstring>textLabel1_5</cstring>
+ </property>
+ <property name="text">
+ <string>H-Bank</string>
+ </property>
+ </widget>
+ <spacer row="0" column="3">
+ <property name="name">
+ <cstring>spacer12_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QSpinBox" row="0" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spinBoxDefault</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>85</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="specialValueText">
+ <string>off</string>
+ <comment>dont care</comment>
+ </property>
+ <property name="maxValue">
+ <number>16383</number>
+ </property>
+ <property name="minValue">
+ <number>-1</number>
+ </property>
+ <property name="value">
+ <number>-1</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Default value. Off: No default.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Default (initial) value. Off means no default.
+
+If a default value is chosen, the value will be sent
+ to the controller when the controller is added to
+ the song (in piano roll or event editor). When
+ the song is re-loaded, the value is sent again.
+Otherwise the controller remains at its last value.
+Controllers are also automatically added to a
+ song upon reception of a midi controller event.
+
+Caution! Watch out for controllers such as
+ 'Sustain' and 'ResetAllController' with default
+ values. You should probably turn 'off' their
+ default (in piano roll or drum edit, and
+ instrument editor).</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout10</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>addController</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add</string>
+ </property>
+ <property name="accel">
+ <string>Alt+A</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Add common controller</string>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>deleteController</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Delete</string>
+ </property>
+ <property name="accel">
+ <string>Alt+D</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Delete controller</string>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>newController</cstring>
+ </property>
+ <property name="text">
+ <string>New &amp;Controller</string>
+ </property>
+ <property name="accel">
+ <string>Alt+C</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Create a new controller</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer13</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>200</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>nullValLabelH</cstring>
+ </property>
+ <property name="text">
+ <string>Null Param Hi:</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>nullParamSpinBoxH</cstring>
+ </property>
+ <property name="specialValueText">
+ <string>off</string>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ <property name="minValue">
+ <number>-1</number>
+ </property>
+ <property name="value">
+ <number>127</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Null parameter number High byte</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If set, these 'null' parameter numbers will
+ be sent after each RPN/NRPN event.
+This prevents subsequent 'data' events
+ from corrupting the RPN/NRPN controller.
+Typically, set to 127/127, or an unused
+ RPN/NRPN controller number.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer13_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>200</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>nullValLabelL</cstring>
+ </property>
+ <property name="text">
+ <string> Lo:</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>nullParamSpinBoxL</cstring>
+ </property>
+ <property name="specialValueText">
+ <string>off</string>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ <property name="minValue">
+ <number>-1</number>
+ </property>
+ <property name="value">
+ <number>127</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Null parameter number Low byte</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If set, these 'null' parameter numbers will
+ be sent after each RPN/NRPN event.
+This prevents subsequent 'data' events
+ from corrupting the RPN/NRPN controller.
+Typically, set to 127/127, or an unused
+ RPN/NRPN controller number.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>sysExTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>S&amp;ysEx</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>splitter2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2_3</cstring>
+ </property>
+ <property name="text">
+ <string>SysEx List:</string>
+ </property>
+ </widget>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>sysexList</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_4</cstring>
+ </property>
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>sysexName</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Hex Entry:</string>
+ </property>
+ </widget>
+ <widget class="QTextEdit">
+ <property name="name">
+ <cstring>sysexData</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout10</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>deleteSysex</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Delete</string>
+ </property>
+ <property name="accel">
+ <string>Alt+D</string>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>newSysex</cstring>
+ </property>
+ <property name="text">
+ <string>New SysE&amp;x</string>
+ </property>
+ <property name="accel">
+ <string>Alt+X</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>60</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<menubar>
+ <property name="name">
+ <cstring>MenuBar</cstring>
+ </property>
+ <property name="defaultUp">
+ <bool>false</bool>
+ </property>
+ <item text="&amp;File" name="fileMenu">
+ <action name="fileNewAction"/>
+ <action name="fileOpenAction"/>
+ <action name="fileSaveAction"/>
+ <action name="fileSaveAsAction"/>
+ <separator/>
+ <action name="fileExitAction"/>
+ </item>
+ <item text="&amp;Help" name="Help">
+ <action name="whatsThisAction"/>
+ </item>
+</menubar>
+<toolbars>
+ <toolbar dock="2">
+ <property name="name">
+ <cstring>toolBar</cstring>
+ </property>
+ <property name="label">
+ <string>Tools</string>
+ </property>
+ <action name="fileNewAction"/>
+ <action name="fileOpenAction"/>
+ <action name="fileSaveAction"/>
+ <action name="fileSaveAsAction"/>
+ <action name="whatsThisAction"/>
+ </toolbar>
+</toolbars>
+<actions>
+ <action>
+ <property name="name">
+ <cstring>fileNewAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image0</iconset>
+ </property>
+ <property name="text">
+ <string>New</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;New</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+N</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileOpenAction</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="iconSet">
+ <iconset>image1</iconset>
+ </property>
+ <property name="text">
+ <string>Open</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Open...</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+O</string>
+ </property>
+ <property name="visible">
+ <bool>false</bool>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileSaveAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image2</iconset>
+ </property>
+ <property name="text">
+ <string>Save</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Save</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+S</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileSaveAsAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image3</iconset>
+ </property>
+ <property name="text">
+ <string>Save As</string>
+ </property>
+ <property name="menuText">
+ <string>Save &amp;As...</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileExitAction</cstring>
+ </property>
+ <property name="text">
+ <string>Exit</string>
+ </property>
+ <property name="menuText">
+ <string>E&amp;xit</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>filenew_itemAction</cstring>
+ </property>
+ <property name="text">
+ <string>new item</string>
+ </property>
+ <property name="menuText">
+ <string>new item</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>whatsThisAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image4</iconset>
+ </property>
+ <property name="text">
+ <string>What's this?</string>
+ </property>
+ <property name="menuText">
+ <string>What's this?</string>
+ </property>
+ </action>
+</actions>
+<images>
+ <image name="image0">
+ <data format="PNG" length="187">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000008249444154388ded95310ac0200c4593d2c334d0c535e0d2c3e75ae9d442353521e0e60741233ee5f355141198a1bd2d30b346168a088ee637aba8aabf0d00804e720f60823d95525c7867454474d0db6766b56c4981af7a7dc6163c05e6ca7dad81a7c088c340e4c04f32bccd52a98868811778810732af74e42df084b3febc6956dc1a2d33a3204eed990000000049454e44ae426082</data>
+ </image>
+ <image name="image1">
+ <data format="PNG" length="230">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000ad49444154388db594510ec3200c436db45371b7699a76375f8b7d8caa11cd18d1827f225af1621908256187ca16ea4ef02dbaa1d6daec5a12c7ff9218021f9bbc4692689b32ebf02c541253321ee3017ac6bf728b420180005a6b00d08e25c835eecc403fbc130ab077e2e57ba47931c68375aee2395eab73b91947b3f6e4666ca1af670c787f7caa9bf1bf50f34072a117c7595003ce859e56bbb2a08019f4995060f5b67fd16c56a4cde3516f027970cd357a563f0000000049454e44ae426082</data>
+ </image>
+ <image name="image2">
+ <data format="PNG" length="230">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000ad49444154388dd595c10a85201045af0f172e5af83d0afd5944f4670f9aef69e1a25d2d62c2b230c302cf460c3b5ca7310511e10d24001863e69c52221292277db78e4d0b0cff2149646bbbbd636b0b00f8650a1920e34bce514e63aac66dce49996862e53494d3c1735f0aaca5e472de123f255a8a63b2bbbc96b83c7150e3be0b5b2786df0d97e2ab85a97cdb6e4d9b2e3aeef2f191f67f5467dfa4bc762b4f2cf8cecb753d1191d88973b300c3df2bac2a2aaca70000000049454e44ae426082</data>
+ </image>
+ <image name="image3">
+ <data format="PNG" length="264">89504e470d0a1a0a0000000d49484452000000100000001008060000001ff3ff61000000cf49444154388da593410ec2300c0467090f4a8f3df421fd425f013f834b7af5872273a0a952a010c0926545ceaed6eb4480f3471c00628c009c3801978fb5c60870774712ee6d62246d15745df7b5f4a2e0f0d838eb8c74ddadafc2638cbe8cd21435a65981a43501ccac5d41e9d577b8afdf8fb529b5bb9b19df6ce7581f8ab37598d92ef113c1e36c2d0a36269a19ee4e4a49a5ee225f1100ccf3ac699a7c1c4772ce1f9fe6d3087ddfafa01082007fe781587e638c113323a5a49cb3871036b500866158cd36334829b190fc94376721c8f72ecfaff50000000049454e44ae426082</data>
+ </image>
+ <image name="image4">
+ <data format="PNG" length="243">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000ba49444154388dd594db0980300c451371aa0c90b93a5707b86be957306dd387423fbc206221a7370fc30068878e2dd45f824fff212217001e0588e4ab3e4b8948558bb8c6b18834813514500694537ac039971786a588e006351851e9d29f77c133e72b1a36cfc37dda269f7eed98fd0fd273d96ba82f4fddbc330a6801edb4f8464631cb73ecb3891a596bea7836d7afc000783415bdf4bd9a5298437bf766da9e25f0d7b423f16c1f9be3b7976edb6e53c75ff5bf45bf0d7c034d505e874a59314b0000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>fileNewAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>fileNew()</slot>
+ </connection>
+ <connection>
+ <sender>fileOpenAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>fileOpen()</slot>
+ </connection>
+ <connection>
+ <sender>fileSaveAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>fileSave()</slot>
+ </connection>
+ <connection>
+ <sender>fileSaveAsAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>fileSaveAs()</slot>
+ </connection>
+ <connection>
+ <sender>fileExitAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>fileExit()</slot>
+ </connection>
+ <connection>
+ <sender>whatsThisAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>helpWhatsThis()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>instrumentName</tabstop>
+ <tabstop>instrumentList</tabstop>
+ <tabstop>tabWidget3</tabstop>
+ <tabstop>patchView</tabstop>
+ <tabstop>patchNameEdit</tabstop>
+ <tabstop>spinBoxHBank</tabstop>
+ <tabstop>spinBoxLBank</tabstop>
+ <tabstop>spinBoxProgram</tabstop>
+ <tabstop>checkBoxDrum</tabstop>
+ <tabstop>checkBoxGM</tabstop>
+ <tabstop>checkBoxGS</tabstop>
+ <tabstop>checkBoxXG</tabstop>
+ <tabstop>listController</tabstop>
+ <tabstop>viewController</tabstop>
+ <tabstop>ctrlName</tabstop>
+ <tabstop>ctrlType</tabstop>
+ <tabstop>spinBoxHCtrlNo</tabstop>
+ <tabstop>spinBoxLCtrlNo</tabstop>
+ <tabstop>spinBoxMin</tabstop>
+ <tabstop>spinBoxMax</tabstop>
+ <tabstop>spinBoxDefault</tabstop>
+ <tabstop>sysexList</tabstop>
+ <tabstop>sysexName</tabstop>
+ <tabstop>sysexData</tabstop>
+</tabstops>
+<slots>
+ <slot>fileNew()</slot>
+ <slot>fileOpen()</slot>
+ <slot>fileSave()</slot>
+ <slot>fileSaveAs()</slot>
+ <slot>fileExit()</slot>
+ <slot>helpWhatsThis()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/instruments/midictrledit.cpp b/muse2/muse/instruments/midictrledit.cpp
new file mode 100644
index 00000000..6577b65f
--- /dev/null
+++ b/muse2/muse/instruments/midictrledit.cpp
@@ -0,0 +1,733 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midictrledit.cpp,v 1.1.1.1.2.2 2008/08/18 00:15:24 terminator356 Exp $
+//
+// (C) Copyright 2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+
+#include "app.h"
+#include "midiport.h"
+#include "mididev.h"
+#include "midictrl.h"
+#include "midictrledit.h"
+#include "minstrument.h"
+#include "song.h"
+#include "xml.h"
+#include "filedialog.h"
+#include "globals.h"
+
+#include <q3listview.h>
+#include <qlineedit.h>
+#include <q3listbox.h>
+#include <qcombobox.h>
+#include <qspinbox.h>
+#include <qpushbutton.h>
+#include <qtoolbutton.h>
+
+MidiControllerEditDialog* midiControllerEditDialog;
+
+static MidiController predefinedMidiController[] = {
+ MidiController(QString("Pitch"), 0x40000, -8192, +8191, 0),
+ };
+enum {
+ COL_NAME = 0, COL_TYPE,
+ COL_HNUM, COL_LNUM, COL_MIN, COL_MAX
+ };
+//---------------------------------------------------------
+// addControllerToView
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::addControllerToView(MidiController* mctrl)
+ {
+ QString hnum;
+ QString lnum;
+ QString min;
+ QString max;
+ int n = mctrl->num();
+ int h = (n >> 8) & 0x7f;
+ int l = n & 0x7f;
+ MidiController::ControllerType t = midiControllerType(n);
+ switch(t)
+ {
+ case MidiController::Controller7:
+ hnum = "---";
+ lnum.setNum(l);
+ min.setNum(mctrl->minVal());
+ max.setNum(mctrl->maxVal());
+ break;
+ case MidiController::RPN:
+ case MidiController::NRPN:
+ case MidiController::RPN14:
+ case MidiController::NRPN14:
+ case MidiController::Controller14:
+ hnum.setNum(h);
+ lnum.setNum(l);
+ min.setNum(mctrl->minVal());
+ max.setNum(mctrl->maxVal());
+ break;
+ case MidiController::Pitch:
+ hnum = "---";
+ lnum = "---";
+ min.setNum(mctrl->minVal());
+ max.setNum(mctrl->maxVal());
+ break;
+ default:
+ hnum = "---";
+ lnum = "---";
+ min.setNum(0);
+ max.setNum(0);
+ break;
+ }
+
+ new Q3ListViewItem(viewController,
+ mctrl->name(),
+ int2ctrlType(t),
+ hnum, lnum, min, max
+ );
+
+ }
+//---------------------------------------------------------
+// MidiControllerEditDialog
+//---------------------------------------------------------
+
+MidiControllerEditDialog::MidiControllerEditDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
+ : MidiControllerEditDialogBase(parent, name, modal, fl)
+ {
+ _lastPort = midiPortsList->currentItem();
+ viewController->setColumnAlignment(COL_HNUM, Qt::AlignCenter);
+ viewController->setColumnAlignment(COL_LNUM, Qt::AlignCenter);
+ viewController->setColumnAlignment(COL_MIN, Qt::AlignCenter);
+ viewController->setColumnAlignment(COL_MAX, Qt::AlignCenter);
+ viewController->setColumnWidthMode(COL_NAME, Q3ListView::Maximum);
+
+ // populate list of predefined controller
+ updatePredefinedList();
+
+ // populate ports pulldown
+ updateMidiPortsList();
+ connect(buttonNew, SIGNAL(clicked()), SLOT(ctrlAdd()));
+ connect(buttonDelete, SIGNAL(clicked()), SLOT(ctrlDelete()));
+ connect(entryName, SIGNAL(textChanged(const QString&)), SLOT(nameChanged(const QString&)));
+ connect(comboType, SIGNAL(activated(const QString&)), SLOT(typeChanged(const QString&)));
+ connect(spinboxHCtrlNo, SIGNAL(valueChanged(int)), SLOT(valueHChanged(int)));
+ connect(spinboxLCtrlNo, SIGNAL(valueChanged(int)), SLOT(valueLChanged(int)));
+ connect(spinboxMin, SIGNAL(valueChanged(int)), SLOT(minChanged(int)));
+ connect(spinboxMax, SIGNAL(valueChanged(int)), SLOT(maxChanged(int)));
+ connect(viewController, SIGNAL(selectionChanged()), SLOT(controllerChanged()));
+ connect(buttonApply, SIGNAL(clicked()), SLOT(apply()));
+ connect(midiPortsList, SIGNAL(activated(int)), SLOT(portChanged(int)));
+
+ updateViewController();
+ _modified = false;
+ buttonApply->setEnabled(false);
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::songChanged(int flags)
+{
+ // Is it simply a midi controller value adjustment? Forget it.
+ if(flags == SC_MIDI_CONTROLLER)
+ return;
+
+ if(flags & (SC_CONFIG | SC_MIDI_CONTROLLER))
+ //if(flags & (SC_CONFIG | SC_MIDI_CONTROLLER_ADD))
+ {
+ //listController->blockSignals(true);
+ midiPortsList->blockSignals(true);
+ //viewController->blockSignals(true);
+ updatePredefinedList();
+ updateMidiPortsList();
+ updateViewController();
+ //viewController->setCurrentItem(viewController->firstChild());
+ //controllerChanged(viewController->currentItem());
+ //listController->blockSignals(false);
+ midiPortsList->blockSignals(false);
+ //viewController->blockSignals(false);
+ }
+}
+
+//---------------------------------------------------------
+// updatePredefinedList
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::updatePredefinedList()
+{
+ listController->clear();
+ int size = sizeof(predefinedMidiController) / sizeof(*predefinedMidiController);
+ for (int i = 0; i < size; ++i)
+ listController->insertItem(predefinedMidiController[i].name());
+ listController->setSelected(0, true);
+}
+
+//---------------------------------------------------------
+// updateMidiPortsList
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::updateMidiPortsList()
+{
+ midiPortsList->clear();
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ MidiPort* port = &midiPorts[i];
+ MidiDevice* dev = port->device();
+ QString name;
+ name.sprintf("%d(%s)", port->portno()+1,
+ dev ? dev->name().latin1() : "none");
+ midiPortsList->insertItem(name, i);
+ }
+ _lastPort = midiPortsList->currentItem();
+}
+
+//---------------------------------------------------------
+// updateViewController
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::updateViewController()
+{
+ //for (iMidiController i = midiControllerList.begin();
+ // i != midiControllerList.end(); ++i) {
+ // addControllerToView(&*i);
+ int mpidx = midiPortsList->currentItem();
+
+ viewController->clear();
+ //MidiControllerList* mcl;
+ MidiInstrument* mi = midiPorts[mpidx].instrument();
+ //if(mi)
+ MidiControllerList* mcl = mi->controller();
+ //else
+ // mcl = &defaultMidiController;
+ for (iMidiController i = mcl->begin(); i != mcl->end(); ++i)
+ addControllerToView(*i);
+
+ viewController->blockSignals(true);
+ viewController->setCurrentItem(viewController->firstChild());
+ controllerChanged(viewController->currentItem());
+ viewController->blockSignals(false);
+
+ setModified(false);
+}
+
+//---------------------------------------------------------
+// reject
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::setModified(bool v)
+{
+ if(v == _modified)
+ return;
+
+ _modified = v;
+
+ if(v)
+ {
+ buttonApply->setEnabled(true);
+ }
+ else
+ {
+ buttonApply->setEnabled(false);
+ }
+}
+
+//---------------------------------------------------------
+// reject
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::reject()
+ {
+ //MidiControllerList* mcl;
+// MidiInstrument* mi = midiPorts[mpidx].instrument();
+ //if(mi)
+// MidiControllerList* mcl = mi->controller();
+ //else
+ // mcl = &defaultMidiController;
+// for (iMidiController i = mcl->begin(); i != mcl->end(); ++i)
+// addControllerToView(*i);
+
+ // Restore the list before closing this dialog.
+ updateViewController();
+ //setModified(false);
+
+ MidiControllerEditDialogBase::reject();
+ }
+
+//---------------------------------------------------------
+// apply
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::apply()
+{
+ int mpidx = midiPortsList->currentItem();
+ //MidiControllerList* mcl;
+ MidiInstrument* mi = midiPorts[mpidx].instrument();
+ //if(mi)
+ MidiControllerList* mcl = mi->controller();
+ //else
+ // mcl = &defaultMidiController;
+ mcl->clear();
+
+
+ Q3ListViewItem* item = viewController->firstChild();
+ int hval;
+ int lval;
+ while (item) {
+ hval = item->text(COL_HNUM).toInt();
+ lval = item->text(COL_LNUM).toInt();
+ MidiController* c = new MidiController();
+ c->setName(item->text(COL_NAME));
+
+ MidiController::ControllerType type = ctrlType2Int(item->text(COL_TYPE));
+
+ switch(type) {
+ case MidiController::Controller7:
+ c->setNum(lval);
+ break;
+ case MidiController::Controller14:
+ c->setNum((hval << 8 | lval) | CTRL_14_OFFSET);
+ break;
+ case MidiController::RPN:
+ c->setNum((hval << 8 | lval) | CTRL_RPN_OFFSET);
+ break;
+ case MidiController::NRPN:
+ c->setNum((hval << 8 | lval) | CTRL_NRPN_OFFSET);
+ break;
+ case MidiController::RPN14:
+ c->setNum((hval << 8 | lval) | CTRL_RPN14_OFFSET);
+ break;
+ case MidiController::NRPN14:
+ c->setNum((hval << 8 | lval) | CTRL_NRPN14_OFFSET);
+ break;
+ case MidiController::Program:
+ c->setNum(CTRL_PROGRAM);
+ break;
+ case MidiController::Pitch:
+ c->setNum(CTRL_PITCH);
+ break;
+ default:
+ break;
+ }
+ if(type == MidiController::Program)
+ {
+ c->setMinVal(0);
+ c->setMaxVal(0xffffff);
+ }
+ else
+ {
+ c->setMinVal(item->text(COL_MIN).toInt());
+ c->setMaxVal(item->text(COL_MAX).toInt());
+ }
+
+ mcl->push_back(c);
+
+ item = item->nextSibling();
+ }
+
+ // Update the list before closing this dialog.
+ //updateViewController();
+ //setModified(false);
+ song->update(SC_CONFIG | SC_MIDI_CONTROLLER);
+}
+
+//---------------------------------------------------------
+// ctrlAdd
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::ctrlAdd()
+ {
+ Q3ListBoxItem* item = listController->selectedItem();
+ if (item == 0)
+ return;
+ QString name = item->text();
+ int size = sizeof(predefinedMidiController) / sizeof(*predefinedMidiController);
+ for (int i = 0; i < size; ++i) {
+ MidiController* c = &predefinedMidiController[i];
+ if (c->name() != name)
+ continue;
+ MidiController::ControllerType t = midiControllerType(c->num());
+ QString type = int2ctrlType(t);
+ QString min, max;
+ QString hno, lno;
+ int h = (c->num() >> 8) & 0x7f;
+ int l = c->num() & 0x7f;
+
+ switch(t) {
+ case MidiController::Controller7:
+ min.setNum(c->minVal());
+ max.setNum(c->maxVal());
+ hno = "---";
+ lno.setNum(l);
+ break;
+ case MidiController::RPN:
+ case MidiController::NRPN:
+ case MidiController::RPN14:
+ case MidiController::NRPN14:
+ case MidiController::Controller14:
+ min.setNum(c->minVal());
+ max.setNum(c->maxVal());
+ hno.setNum(h);
+ lno.setNum(l);
+ break;
+ case MidiController::Pitch:
+ min.setNum(c->minVal());
+ max.setNum(c->maxVal());
+ hno = "---";
+ lno = "---";
+ break;
+ default:
+ hno = "---";
+ lno = "---";
+ min.setNum(0);
+ max.setNum(0);
+ break;
+ }
+
+ Q3ListViewItem* item = new Q3ListViewItem(viewController,
+ name, type, hno, lno, min, max);
+
+ viewController->blockSignals(true);
+ viewController->setCurrentItem(item);
+ controllerChanged(item);
+ viewController->blockSignals(false);
+
+ setModified(true);
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// ctrlDelete
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::ctrlDelete()
+ {
+ Q3ListViewItem* item = viewController->currentItem();
+ if (item == 0)
+ return;
+ delete item;
+
+ setModified(true);
+ }
+
+//---------------------------------------------------------
+// accept
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::accept()
+ {
+ apply();
+ MidiControllerEditDialogBase::accept();
+ }
+
+//---------------------------------------------------------
+// portChanged
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::portChanged(int n)
+ {
+ if(n == _lastPort)
+ return;
+ _lastPort = n;
+
+ //listController->blockSignals(true);
+ //midiPortsList->blockSignals(true);
+ //viewController->blockSignals(true);
+ //updatePredefinedList();
+ //updateMidiPortsList();
+ //reject(); // populate list
+ updateViewController();
+ //viewController->setCurrentItem(viewController->firstChild());
+ //controllerChanged(viewController->currentItem());
+ //listController->blockSignals(false);
+ //midiPortsList->blockSignals(false);
+ //viewController->blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// nameChanged
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::nameChanged(const QString& s)
+ {
+ Q3ListViewItem* item = viewController->currentItem();
+ if (item == 0)
+ return;
+ item->setText(COL_NAME, s);
+
+ setModified(true);
+ }
+
+//---------------------------------------------------------
+// typeChanged
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::typeChanged(const QString& s)
+ {
+ Q3ListViewItem* item = viewController->currentItem();
+ if (item == 0)
+ return;
+ item->setText(COL_TYPE, s);
+ switch(ctrlType2Int(s)) {
+ case MidiController::Controller14:
+ case MidiController::RPN14:
+ case MidiController::NRPN14:
+ item->setText(COL_LNUM, QString("0"));
+ item->setText(COL_HNUM, QString("0"));
+ item->setText(COL_MIN, QString("0"));
+ item->setText(COL_MAX, QString("16383"));
+ break;
+ case MidiController::Controller7:
+ item->setText(COL_MIN, QString("0"));
+ item->setText(COL_MAX, QString("127"));
+ item->setText(COL_LNUM, QString("0"));
+ item->setText(COL_HNUM, QString("---"));
+ break;
+ case MidiController::RPN:
+ case MidiController::NRPN:
+ item->setText(COL_MIN, QString("0"));
+ item->setText(COL_MAX, QString("127"));
+ item->setText(COL_LNUM, QString("0"));
+ item->setText(COL_HNUM, QString("0"));
+ break;
+
+ case MidiController::Program:
+
+ item->setText(COL_MIN, QString("---"));
+ item->setText(COL_MAX, QString("---"));
+ item->setText(COL_LNUM, QString("---"));
+ item->setText(COL_HNUM, QString("---"));
+ break;
+ case MidiController::Pitch:
+ item->setText(COL_MIN, QString("-8192"));
+ item->setText(COL_MAX, QString("8191"));
+ item->setText(COL_LNUM, QString("---"));
+ item->setText(COL_HNUM, QString("---"));
+ break;
+ default:
+ break;
+ }
+
+ setModified(true);
+
+ controllerChanged(item);
+ }
+
+//---------------------------------------------------------
+// valueHChanged
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::valueHChanged(int val)
+ {
+ Q3ListViewItem* item = viewController->currentItem();
+ if (item == 0)
+ return;
+ QString s;
+ s.setNum(val);
+ item->setText(COL_HNUM, s);
+
+ setModified(true);
+ }
+
+//---------------------------------------------------------
+// valueLChanged
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::valueLChanged(int val)
+ {
+ Q3ListViewItem* item = viewController->currentItem();
+ if (item == 0)
+ return;
+ QString s;
+ s.setNum(val);
+ item->setText(COL_LNUM, s);
+
+ setModified(true);
+ }
+
+//---------------------------------------------------------
+// controllerChanged
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::controllerChanged()
+ {
+ Q3ListViewItem* item = viewController->selectedItem();
+ controllerChanged(item);
+ }
+
+void MidiControllerEditDialog::controllerChanged(Q3ListViewItem* item)
+ {
+ if (item == 0) {
+ entryName->setEnabled(false);
+ comboType->setEnabled(false);
+ spinboxHCtrlNo->setEnabled(false);
+ spinboxLCtrlNo->setEnabled(false);
+ spinboxMin->setEnabled(false);
+ spinboxMax->setEnabled(false);
+ return;
+ }
+
+ entryName->blockSignals(true);
+ comboType->blockSignals(true);
+ spinboxHCtrlNo->blockSignals(true);
+ spinboxLCtrlNo->blockSignals(true);
+ spinboxMin->blockSignals(true);
+ spinboxMax->blockSignals(true);
+
+ entryName->setEnabled(true);
+ entryName->setText(item->text(COL_NAME));
+ comboType->setCurrentItem(int(ctrlType2Int(item->text(COL_TYPE))));
+ switch (ctrlType2Int(item->text(COL_TYPE))) {
+ case MidiController::Controller7:
+ comboType->setEnabled(true);
+ spinboxHCtrlNo->setEnabled(false);
+ spinboxLCtrlNo->setEnabled(true);
+ spinboxMin->setEnabled(true);
+ spinboxMax->setEnabled(true);
+ spinboxHCtrlNo->setValue(0);
+ spinboxLCtrlNo->setValue(item->text(COL_LNUM).toInt());
+ spinboxMin->setRange(0, 127);
+ spinboxMax->setRange(0, 127);
+ spinboxMin->setValue(item->text(COL_MIN).toInt());
+ spinboxMax->setValue(item->text(COL_MAX).toInt());
+ break;
+
+ case MidiController::RPN:
+ case MidiController::NRPN:
+ comboType->setEnabled(true);
+ spinboxHCtrlNo->setEnabled(true);
+ spinboxLCtrlNo->setEnabled(true);
+ spinboxMin->setEnabled(true);
+ spinboxMax->setEnabled(true);
+ spinboxHCtrlNo->setValue(item->text(COL_HNUM).toInt());
+ spinboxLCtrlNo->setValue(item->text(COL_LNUM).toInt());
+ spinboxMin->setRange(0, 127);
+ spinboxMax->setRange(0, 127);
+ spinboxMin->setValue(item->text(COL_MIN).toInt());
+ spinboxMax->setValue(item->text(COL_MAX).toInt());
+ break;
+ case MidiController::Controller14:
+ case MidiController::RPN14:
+ case MidiController::NRPN14:
+ comboType->setEnabled(true);
+ spinboxHCtrlNo->setEnabled(true);
+ spinboxLCtrlNo->setEnabled(true);
+ spinboxMin->setEnabled(true);
+ spinboxMax->setEnabled(true);
+
+ spinboxHCtrlNo->setValue(item->text(COL_HNUM).toInt());
+ spinboxLCtrlNo->setValue(item->text(COL_LNUM).toInt());
+ spinboxMin->setRange(0, 16383);
+ spinboxMax->setRange(0, 16383);
+ spinboxMin->setValue(item->text(COL_MIN).toInt());
+ spinboxMax->setValue(item->text(COL_MAX).toInt());
+ break;
+
+ case MidiController::Pitch:
+ comboType->setEnabled(true);
+ spinboxHCtrlNo->setEnabled(false);
+ spinboxLCtrlNo->setEnabled(false);
+ spinboxMin->setEnabled(true);
+ spinboxMax->setEnabled(true);
+ spinboxHCtrlNo->setValue(0);
+ spinboxLCtrlNo->setValue(0);
+ spinboxMin->setRange(-8192, 8191);
+ spinboxMax->setRange(-8192, 8191);
+ spinboxMin->setValue(item->text(COL_MIN).toInt());
+ spinboxMax->setValue(item->text(COL_MAX).toInt());
+ break;
+
+ case MidiController::Program:
+ comboType->setEnabled(true);
+ spinboxHCtrlNo->setEnabled(false);
+ spinboxLCtrlNo->setEnabled(false);
+ spinboxMin->setEnabled(false);
+ spinboxMax->setEnabled(false);
+ spinboxHCtrlNo->setValue(0);
+ spinboxLCtrlNo->setValue(0);
+ spinboxMin->setRange(0, 0);
+ spinboxMax->setRange(0, 0);
+ spinboxMin->setValue(0);
+ spinboxMax->setValue(0);
+ break;
+ default:
+ break;
+ }
+ entryName->blockSignals(false);
+ comboType->blockSignals(false);
+ spinboxHCtrlNo->blockSignals(false);
+ spinboxLCtrlNo->blockSignals(false);
+ spinboxMin->blockSignals(false);
+ spinboxMax->blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// minChanged
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::minChanged(int val)
+ {
+ Q3ListViewItem* item = viewController->currentItem();
+ if (item == 0)
+ return;
+
+ QString s;
+ s.setNum(val);
+ item->setText(COL_MIN, s);
+
+ if(val > item->text(COL_MAX).toInt())
+ {
+ spinboxMax->blockSignals(true);
+ spinboxMax->setValue(val);
+ item->setText(COL_MAX, s);
+ spinboxMax->blockSignals(false);
+ }
+ setModified(true);
+ }
+
+//---------------------------------------------------------
+// maxChanged
+//---------------------------------------------------------
+
+void MidiControllerEditDialog::maxChanged(int val)
+ {
+ Q3ListViewItem* item = viewController->currentItem();
+ if (item == 0)
+ return;
+
+ QString s;
+ s.setNum(val);
+ item->setText(COL_MAX, s);
+
+ if(val < item->text(COL_MIN).toInt())
+ {
+ spinboxMin->blockSignals(true);
+ spinboxMin->setValue(val);
+ item->setText(COL_MIN, s);
+ spinboxMin->blockSignals(false);
+ }
+ setModified(true);
+ }
+
+//---------------------------------------------------------
+// configMidiController
+//---------------------------------------------------------
+
+void configMidiController()
+ {
+ if (midiControllerEditDialog == 0)
+ {
+ midiControllerEditDialog = new MidiControllerEditDialog();
+ midiControllerEditDialog->show();
+ }
+ else
+ {
+ if(midiControllerEditDialog->isShown())
+ midiControllerEditDialog->hide();
+ else
+ midiControllerEditDialog->show();
+ }
+ }
diff --git a/muse2/muse/instruments/midictrledit.h b/muse2/muse/instruments/midictrledit.h
new file mode 100644
index 00000000..e1624f29
--- /dev/null
+++ b/muse2/muse/instruments/midictrledit.h
@@ -0,0 +1,56 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midictrledit.h,v 1.1.1.1.2.1 2008/08/18 00:15:25 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MIDICTRLEDIT_H__
+#define __MIDICTRLEDIT_H__
+
+#include "ccontrolbase.h"
+#include "midictrl.h"
+
+//---------------------------------------------------------
+// MidiControllerEditDialog
+//---------------------------------------------------------
+
+class MidiControllerEditDialog : public MidiControllerEditDialogBase {
+ Q_OBJECT
+
+ int _lastPort;
+ bool _modified;
+
+ void addControllerToView(MidiController* mctrl);
+ void mergeReplace(bool replace);
+ void updatePredefinedList();
+ void updateMidiPortsList();
+ void updateViewController();
+ void setModified(bool);
+
+ private slots:
+ void ctrlAdd();
+ void ctrlDelete();
+ virtual void accept();
+ virtual void reject();
+ void apply();
+ void nameChanged(const QString&);
+ void typeChanged(const QString&);
+ void valueHChanged(int);
+ void valueLChanged(int);
+ void controllerChanged(Q3ListViewItem*);
+ void controllerChanged();
+ void minChanged(int);
+ void maxChanged(int);
+ void portChanged(int);
+ void songChanged(int);
+
+ public:
+ MidiControllerEditDialog(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WFlags fl = 0);
+ };
+
+extern MidiControllerEditDialog* midiControllerEditDialog;
+extern void configMidiController();
+#endif
+
diff --git a/muse2/muse/instruments/minstrument.cpp b/muse2/muse/instruments/minstrument.cpp
new file mode 100644
index 00000000..a69f504e
--- /dev/null
+++ b/muse2/muse/instruments/minstrument.cpp
@@ -0,0 +1,850 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: minstrument.cpp,v 1.10.2.5 2009/03/28 01:46:10 terminator356 Exp $
+//
+// (C) Copyright 2000-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+
+#include <q3popupmenu.h>
+#include <qdir.h>
+#include <qfileinfo.h>
+
+#include "minstrument.h"
+#include "midiport.h"
+#include "globals.h"
+#include "xml.h"
+#include "event.h"
+#include "mpevent.h"
+#include "midictrl.h"
+#include "gconfig.h"
+
+MidiInstrumentList midiInstruments;
+MidiInstrument* genericMidiInstrument;
+
+static const char* gmdrumname = "GM-drums";
+
+//---------------------------------------------------------
+// readEventList
+//---------------------------------------------------------
+
+static void readEventList(Xml& xml, EventList* el, const char* name)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "event") {
+ Event e(Note);
+ e.read(xml);
+ el->add(e);
+ }
+ else
+ xml.unknown("readEventList");
+ break;
+ case Xml::TagEnd:
+ if (tag == name)
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+//---------------------------------------------------------
+// loadIDF
+//---------------------------------------------------------
+
+static void loadIDF(QFileInfo* fi)
+ {
+/*
+ QFile qf(fi->filePath());
+ if (!qf.open(IO_ReadOnly)) {
+ printf("cannot open file %s\n", fi->fileName().latin1());
+ return;
+ }
+ if (debugMsg)
+ printf(" load instrument definition <%s>\n", fi->filePath().local8Bit().data());
+ QDomDocument doc;
+ int line, column;
+ QString err;
+ if (!doc.setContent(&qf, false, &err, &line, &column)) {
+ QString col, ln, error;
+ col.setNum(column);
+ ln.setNum(line);
+ error = err + " at line: " + ln + " col: " + col;
+ printf("error reading file <%s>:\n %s\n",
+ fi->filePath().latin1(), error.latin1());
+ return;
+ }
+ QDomNode node = doc.documentElement();
+ while (!node.isNull()) {
+ QDomElement e = node.toElement();
+ if (e.isNull())
+ continue;
+ if (e.tagName() == "muse") {
+ QString version = e.attribute(QString("version"));
+ for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ QDomElement e = n.toElement();
+ if (e.tagName() == "MidiInstrument") {
+ MidiInstrument* i = new MidiInstrument();
+ i->read(n);
+ i->setFilePath(fi->filePath());
+ bool replaced = false;
+ for (int idx = 0; idx < midiInstruments.size(); ++idx) {
+ if (midiInstruments[idx]->iname() == i->iname()) {
+ midiInstruments.replace(idx, i);
+ replaced = true;
+ if (debugMsg)
+ printf("Midi Instrument Definition <%s> overwritten\n",
+ i->iname().toLocal8Bit().data());
+ break;
+ }
+ }
+ if (!replaced)
+ midiInstruments += i;
+ }
+ }
+ }
+ else
+ printf("MusE:laodIDF: %s not supported\n", e.tagName().latin1());
+ node = node.nextSibling();
+ }
+ qf.close();
+*/
+
+ FILE* f = fopen(fi->filePath().ascii(), "r");
+ if (f == 0)
+ return;
+ if (debugMsg)
+ printf("READ IDF %s\n", fi->filePath().latin1());
+ Xml xml(f);
+
+ bool skipmode = true;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (skipmode && tag == "muse")
+ skipmode = false;
+ else if (skipmode)
+ break;
+ else if (tag == "MidiInstrument") {
+ MidiInstrument* i = new MidiInstrument();
+ i->setFilePath(fi->filePath());
+ i->read(xml);
+ // Ignore duplicate named instruments.
+ iMidiInstrument ii = midiInstruments.begin();
+ for(; ii != midiInstruments.end(); ++ii)
+ {
+ if((*ii)->iname() == i->iname())
+ break;
+ }
+ if(ii == midiInstruments.end())
+ midiInstruments.push_back(i);
+ else
+ delete i;
+ }
+ else
+ xml.unknown("muse");
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if (!skipmode && tag == "muse") {
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ fclose(f);
+
+
+ }
+
+//---------------------------------------------------------
+// initMidiInstruments
+//---------------------------------------------------------
+
+void initMidiInstruments()
+ {
+ genericMidiInstrument = new MidiInstrument(QWidget::tr("generic midi"));
+ midiInstruments.push_back(genericMidiInstrument);
+ if (debugMsg)
+ printf("load user instrument definitions from <%s>\n", museUserInstruments.latin1());
+ QDir usrInstrumentsDir(museUserInstruments, QString("*.idf"));
+ if (usrInstrumentsDir.exists()) {
+ QFileInfoList list = usrInstrumentsDir.entryInfoList();
+ QFileInfoList::iterator it=list.begin(); // ddskrjo
+ while(it != list.end()) { // ddskrjo
+ loadIDF(&*it);
+ ++it;
+ }
+ }
+ //else
+ //{
+ // if(usrInstrumentsDir.mkdir(museUserInstruments))
+ // printf("Created user instrument directory: %s\n", museUserInstruments.latin1());
+ // else
+ // printf("Unable to create user instrument directory: %s\n", museUserInstruments.latin1());
+ //}
+
+ if (debugMsg)
+ printf("load instrument definitions from <%s>\n", museInstruments.latin1());
+ QDir instrumentsDir(museInstruments, QString("*.idf"));
+ if (instrumentsDir.exists()) {
+ QFileInfoList list = instrumentsDir.entryInfoList();
+ QFileInfoListIterator it=list.begin(); // ddskrjo
+ while(it!=list.end()) {
+ loadIDF(&*it);
+ ++it;
+ }
+ }
+ else
+ printf("Instrument directory not found: %s\n", museInstruments.latin1());
+
+ }
+
+//---------------------------------------------------------
+// registerMidiInstrument
+//---------------------------------------------------------
+
+MidiInstrument* registerMidiInstrument(const QString& name)
+ {
+ for (iMidiInstrument i = midiInstruments.begin();
+ i != midiInstruments.end(); ++i) {
+ if ((*i)->iname() == name)
+ return *i;
+ }
+ return genericMidiInstrument;
+ }
+
+//---------------------------------------------------------
+// removeMidiInstrument
+//---------------------------------------------------------
+
+void removeMidiInstrument(const QString& name)
+ {
+ for (iMidiInstrument i = midiInstruments.begin();
+ i != midiInstruments.end(); ++i) {
+ if ((*i)->iname() == name) {
+ midiInstruments.erase(i);
+ return;
+ }
+ }
+ }
+
+void removeMidiInstrument(const MidiInstrument* instr)
+ {
+ for (iMidiInstrument i = midiInstruments.begin();
+ i != midiInstruments.end(); ++i) {
+ if (*i == instr) {
+ midiInstruments.erase(i);
+ return;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// MidiInstrument
+//---------------------------------------------------------
+
+void MidiInstrument::init()
+ {
+ _nullvalue = -1;
+ _initScript = 0;
+ _midiInit = new EventList();
+ _midiReset = new EventList();
+ _midiState = new EventList();
+ _controller = new MidiControllerList;
+
+ // add some default controller to controller list
+ // this controllers are always available for all instruments
+ //
+ MidiController* prog = new MidiController("Program", CTRL_PROGRAM, 0, 0xffffff, 0);
+ _controller->add(prog);
+ _dirty = false;
+ }
+
+MidiInstrument::MidiInstrument()
+ {
+ init();
+ }
+
+//---------------------------------------------------------
+// MidiInstrument
+//---------------------------------------------------------
+
+MidiInstrument::MidiInstrument(const QString& txt)
+ {
+ _name = txt;
+ init();
+ }
+
+//---------------------------------------------------------
+// MidiInstrument
+//---------------------------------------------------------
+
+MidiInstrument::~MidiInstrument()
+ {
+ for (ciPatchGroup g = pg.begin(); g != pg.end(); ++g)
+ {
+ PatchGroup* pgp = *g;
+ const PatchList& pl = pgp->patches;
+ for (ciPatch p = pl.begin(); p != pl.end(); ++p)
+ {
+ delete *p;
+ }
+ delete pgp;
+ }
+
+
+ delete _midiInit;
+ delete _midiReset;
+ delete _midiState;
+ for(iMidiController i = _controller->begin(); i != _controller->end(); ++i)
+ delete i->second;
+ delete _controller;
+
+ if (_initScript)
+ delete _initScript;
+ }
+
+/*
+//---------------------------------------------------------
+// uniqueCopy
+//---------------------------------------------------------
+
+MidiInstrument& MidiInstrument::uniqueCopy(const MidiInstrument& ins)
+{
+ _initScript = 0;
+ _midiInit = new EventList();
+ _midiReset = new EventList();
+ _midiState = new EventList();
+ //---------------------------------------------------------
+ // TODO: Copy the init script, and the lists.
+ //---------------------------------------------------------
+ _controller = new MidiControllerList(*(ins._controller));
+
+ // Assignment
+ pg = ins.pg;
+
+ _name = ins._name;
+ _filePath = ins._filePath;
+
+ // Hmm, dirty, yes? But init sets it to false...
+ //_dirty = ins._dirty;
+ //_dirty = false;
+ _dirty = true;
+
+ return *this;
+}
+*/
+
+//---------------------------------------------------------
+// assign
+//---------------------------------------------------------
+
+MidiInstrument& MidiInstrument::assign(const MidiInstrument& ins)
+{
+ //---------------------------------------------------------
+ // TODO: Copy the _initScript, and _midiInit, _midiReset, and _midiState lists.
+ //---------------------------------------------------------
+
+ for(iMidiController i = _controller->begin(); i != _controller->end(); ++i)
+ delete i->second;
+ _controller->clear();
+
+ _nullvalue = ins._nullvalue;
+
+ // Assignment
+ // *_controller = *(ins._controller);
+ for(ciMidiController i = ins._controller->begin(); i != ins._controller->end(); ++i)
+ {
+ MidiController* mc = i->second;
+ _controller->add(new MidiController(*mc));
+ }
+
+// pg.clear();
+// for(iPatchGroup ipg = pg.begin(); ipg != pg.end(); ++ipg)
+// {
+ //ipg->patches.clear();
+
+ //const PatchGroup& g = *ipg;
+ //for(ciPatch ip = ipg->begin(); ip != ipg->end(); ++ipg)
+ //{
+
+ //}
+// }
+
+ for (ciPatchGroup g = pg.begin(); g != pg.end(); ++g)
+ {
+ PatchGroup* pgp = *g;
+ const PatchList& pl = pgp->patches;
+ for (ciPatch p = pl.begin(); p != pl.end(); ++p)
+ {
+ delete *p;
+ }
+
+ delete pgp;
+ }
+ pg.clear();
+
+ // Assignment
+// pg = ins.pg;
+ for(ciPatchGroup g = ins.pg.begin(); g != ins.pg.end(); ++g)
+ {
+ PatchGroup* pgp = *g;
+ const PatchList& pl = pgp->patches;
+ PatchGroup* npg = new PatchGroup;
+ npg->name = pgp->name;
+ pg.push_back(npg);
+ for (ciPatch p = pl.begin(); p != pl.end(); ++p)
+ {
+ Patch* pp = *p;
+ Patch* np = new Patch;
+ np->typ = pp->typ;
+ np->hbank = pp->hbank;
+ np->lbank = pp->lbank;
+ np->prog = pp->prog;
+ np->name = pp->name;
+ np->drum = pp->drum;
+ npg->patches.push_back(np);
+ }
+ }
+
+ _name = ins._name;
+ _filePath = ins._filePath;
+
+ // Hmm, dirty, yes? But init sets it to false...
+ //_dirty = ins._dirty;
+ //_dirty = false;
+ //_dirty = true;
+
+ return *this;
+}
+
+//---------------------------------------------------------
+// reset
+// send note off to all channels
+//---------------------------------------------------------
+
+void MidiInstrument::reset(int portNo, MType)
+ {
+ MidiPlayEvent ev;
+ ev.setType(0x90);
+ MidiPort* port = &midiPorts[portNo];
+ if (port == 0)
+ return;
+ ev.setPort(portNo);
+ for (int chan = 0; chan < MIDI_CHANNELS; ++chan) {
+ ev.setChannel(chan);
+ for (int pitch = 0; pitch < 128; ++pitch) {
+ ev.setA(pitch);
+ ev.setB(0);
+ port->sendEvent(ev);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// readPatchGroup
+//---------------------------------------------------------
+
+void PatchGroup::read(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "Patch") {
+ Patch* patch = new Patch;
+ patch->read(xml);
+ patches.push_back(patch);
+ }
+ else
+ xml.unknown("PatchGroup");
+ break;
+ case Xml::Attribut:
+ if (tag == "name")
+ name = xml.s2();
+ break;
+ case Xml::TagEnd:
+ if (tag == "PatchGroup")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void Patch::read(Xml& xml)
+ {
+ typ = -1;
+ hbank = -1;
+ lbank = -1;
+ prog = 0;
+ drum = false;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ xml.unknown("Patch");
+ break;
+ case Xml::Attribut:
+ if (tag == "name")
+ name = xml.s2();
+ else if (tag == "mode")
+ typ = xml.s2().toInt();
+ else if (tag == "hbank")
+ hbank = xml.s2().toInt();
+ else if (tag == "lbank")
+ lbank = xml.s2().toInt();
+ else if (tag == "prog")
+ prog = xml.s2().toInt();
+ else if (tag == "drum")
+ drum = xml.s2().toInt();
+ break;
+ case Xml::TagEnd:
+ if (tag == "Patch")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void Patch::write(int level, Xml& xml)
+ {
+ //if (drumMap == 0)
+ //{
+ //QString s = QString("Patch name=\"%1\"").arg(Xml::xmlString(name));
+ //if (typ != -1)
+ // s += QString(" mode=\"%d\"").arg(typ);
+ //s += QString(" hbank=\"%1\" lbank=\"%2\" prog=\"%3\"").arg(hbank).arg(lbank).arg(prog);
+ //xml.tagE(s);
+ xml.nput(level, "<Patch name=\"%s\"", Xml::xmlString(name).latin1());
+ if(typ != -1)
+ xml.nput(" mode=\"%d\"", typ);
+
+ if(hbank != -1)
+ xml.nput(" hbank=\"%d\"", hbank);
+
+ if(lbank != -1)
+ xml.nput(" lbank=\"%d\"", lbank);
+
+ xml.nput(" prog=\"%d\"", prog);
+
+ //xml.nput(level, " hbank=\"%d\" lbank=\"%d\" prog=\"%d\"", hbank, lbank, prog);
+ if(drum)
+ //xml.nput(level, " drum=\"%d\"", int(drum));
+ xml.nput(" drum=\"%d\"", int(drum));
+ //xml.put(level, " />");
+ xml.put(" />");
+
+ //return;
+ //}
+
+ //QString s = QString("drummap name=\"%1\"").arg(Xml::xmlString(name));
+ //s += QString(" hbank=\"%1\" lbank=\"%2\" prog=\"%3\"").arg(hbank).arg(lbank).arg(prog);
+ //xml.stag(s);
+ //for (int i = 0; i < DRUM_MAPSIZE; ++i) {
+ // DrumMapEntry* dm = drumMap->entry(i);
+ // dm->write(xml);
+ // }
+ //xml.etag("drummap");
+ }
+
+//---------------------------------------------------------
+// readMidiState
+//---------------------------------------------------------
+
+void MidiInstrument::readMidiState(Xml& xml)
+ {
+ _midiState->read(xml, "midistate", true);
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void MidiInstrument::read(Xml& xml)
+ {
+ bool ok;
+ int base = 10;
+ _nullvalue = -1;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "Patch") {
+ Patch* patch = new Patch;
+ patch->read(xml);
+ if (pg.empty()) {
+ PatchGroup* p = new PatchGroup;
+ p->patches.push_back(patch);
+ pg.push_back(p);
+ }
+ else
+ pg[0]->patches.push_back(patch);
+ }
+ else if (tag == "PatchGroup") {
+ PatchGroup* p = new PatchGroup;
+ p->read(xml);
+ pg.push_back(p);
+ }
+ else if (tag == "Controller") {
+ MidiController* mc = new MidiController();
+ mc->read(xml);
+ // Added by Tim. Copied from muse 2.
+ //
+ // HACK: make predefined "Program" controller overloadable
+ //
+ if (mc->name() == "Program") {
+ for (iMidiController i = _controller->begin(); i != _controller->end(); ++i) {
+ if (i->second->name() == mc->name()) {
+ delete i->second;
+ _controller->erase(i);
+ break;
+ }
+ }
+ }
+
+ _controller->add(mc);
+ }
+ else if (tag == "Init")
+ readEventList(xml, _midiInit, "Init");
+ else if (tag == "Reset")
+ readEventList(xml, _midiReset, "Reset");
+ else if (tag == "State")
+ readEventList(xml, _midiState, "State");
+ else if (tag == "InitScript") {
+ if (_initScript)
+ delete _initScript;
+ const char* istr = xml.parse1().latin1();
+ int len = strlen(istr) +1;
+ if (len > 1) {
+ _initScript = new char[len];
+ memcpy(_initScript, istr, len);
+ }
+ }
+
+ else
+ xml.unknown("MidiInstrument");
+ break;
+ case Xml::Attribut:
+ if (tag == "name")
+ setIName(xml.s2());
+ else if(tag == "nullparam") {
+ _nullvalue = xml.s2().toInt(&ok, base);
+ }
+ break;
+ case Xml::TagEnd:
+ if (tag == "MidiInstrument")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void MidiInstrument::write(int level, Xml& xml)
+ {
+ xml.header();
+ //xml.stag("muse version=\"2.1\"");
+ xml.tag(level, "muse version=\"1.0\"");
+ //xml.stag(QString("MidiInstrument name=\"%1\"").arg(Xml::xmlString(iname())));
+ level++;
+ //xml.tag(level, "MidiInstrument name=\"%s\"", Xml::xmlString(iname()).latin1());
+ xml.nput(level, "<MidiInstrument name=\"%s\"", Xml::xmlString(iname()).latin1());
+
+ if(_nullvalue != -1)
+ {
+ QString nv;
+ nv.setNum(_nullvalue);
+ xml.nput(" nullparam=\"%s\"", nv.latin1());
+ }
+ xml.put(">");
+
+ // -------------
+ // What about Init, Reset, State, and InitScript ?
+ // -------------
+
+ //std::vector<PatchGroup>* pg = groups();
+ //for (std::vector<PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) {
+ level++;
+ //for (std::vector<PatchGroup>::iterator g = pg.begin(); g != pg.end(); ++g) {
+ for (ciPatchGroup g = pg.begin(); g != pg.end(); ++g) {
+ PatchGroup* pgp = *g;
+ const PatchList& pl = pgp->patches;
+ //xml.stag(QString("PatchGroup name=\"%1\"").arg(Xml::xmlString(g->name)));
+ //xml.tag(level, "PatchGroup name=\"%s\"", Xml::xmlString(g->name).latin1());
+ xml.tag(level, "PatchGroup name=\"%s\"", Xml::xmlString(pgp->name).latin1());
+ level++;
+ //for (iPatch p = g->patches.begin(); p != g->patches.end(); ++p)
+ for (ciPatch p = pl.begin(); p != pl.end(); ++p)
+ //(*p)->write(xml);
+ //p->write(level, xml);
+ (*p)->write(level, xml);
+ level--;
+ //xml.etag("PatchGroup");
+ xml.etag(level, "PatchGroup");
+ }
+ for (iMidiController ic = _controller->begin(); ic != _controller->end(); ++ic)
+ //(*ic)->write(xml);
+ ic->second->write(level, xml);
+ //xml.etag("MidiInstrument");
+ level--;
+ xml.etag(level, "MidiInstrument");
+ //xml.etag("muse");
+ level--;
+ xml.etag(level, "muse");
+ }
+
+//---------------------------------------------------------
+// getPatchName
+//---------------------------------------------------------
+
+const char* MidiInstrument::getPatchName(int channel, int prog, MType mode, bool drum)
+ {
+ int pr = prog & 0xff;
+ if(prog == CTRL_VAL_UNKNOWN || pr == 0xff)
+ return "<unknown>";
+
+ int hbank = (prog >> 16) & 0xff;
+ int lbank = (prog >> 8) & 0xff;
+ int tmask = 1;
+ bool drumchan = channel == 9;
+ bool hb = false;
+ bool lb = false;
+ switch (mode) {
+ case MT_GS:
+ tmask = 2;
+ hb = true;
+ break;
+ case MT_XG:
+ hb = true;
+ lb = true;
+ tmask = 4;
+ break;
+ case MT_GM:
+ if(drumchan)
+ return gmdrumname;
+ tmask = 1;
+ break;
+ default:
+ hb = true; // MSB bank matters
+ lb = true; // LSB bank matters
+ break;
+ }
+ for (ciPatchGroup i = pg.begin(); i != pg.end(); ++i) {
+ const PatchList& pl = (*i)->patches;
+ for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) {
+ const Patch* mp = *ipl;
+ if ((mp->typ & tmask)
+ && (pr == mp->prog)
+ && ((drum && mode != MT_GM) ||
+ (mp->drum == drumchan))
+
+ && (hbank == mp->hbank || !hb || mp->hbank == -1)
+ && (lbank == mp->lbank || !lb || mp->lbank == -1))
+ return mp->name.latin1();
+ }
+ }
+ return "<unknown>";
+ }
+
+//---------------------------------------------------------
+// populatePatchPopup
+//---------------------------------------------------------
+
+void MidiInstrument::populatePatchPopup(Q3PopupMenu* menu, int chan, MType songType, bool drum)
+ {
+ menu->clear();
+ int mask = 0;
+ bool drumchan = chan == 9;
+ switch (songType) {
+ case MT_XG: mask = 4; break;
+ case MT_GS: mask = 2; break;
+ case MT_GM:
+ if(drumchan)
+ return;
+ mask = 1;
+ break;
+ case MT_UNKNOWN: mask = 7; break;
+ }
+ if (pg.size() > 1) {
+ for (ciPatchGroup i = pg.begin(); i != pg.end(); ++i) {
+ PatchGroup* pgp = *i;
+ Q3PopupMenu* pm = new Q3PopupMenu(menu);
+ pm->setCheckable(false);
+ pm->setFont(config.fonts[0]);
+ const PatchList& pl = pgp->patches;
+ for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) {
+ const Patch* mp = *ipl;
+ if ((mp->typ & mask) &&
+ ((drum && songType != MT_GM) ||
+ (mp->drum == drumchan)) )
+ {
+ int id = ((mp->hbank & 0xff) << 16)
+ + ((mp->lbank & 0xff) << 8) + (mp->prog & 0xff);
+ pm->insertItem(mp->name, id);
+ }
+
+ }
+ menu->insertItem(pgp->name, pm);
+ }
+ }
+ else if (pg.size() == 1 ){
+ // no groups
+ const PatchList& pl = pg.front()->patches;
+ for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) {
+ const Patch* mp = *ipl;
+ if (mp->typ & mask) {
+ int id = ((mp->hbank & 0xff) << 16)
+ + ((mp->lbank & 0xff) << 8) + (mp->prog & 0xff);
+ menu->insertItem(mp->name, id);
+ }
+ }
+ }
+ }
+
diff --git a/muse2/muse/instruments/minstrument.h b/muse2/muse/instruments/minstrument.h
new file mode 100644
index 00000000..70c123ec
--- /dev/null
+++ b/muse2/muse/instruments/minstrument.h
@@ -0,0 +1,135 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: minstrument.h,v 1.3.2.3 2009/03/09 02:05:18 terminator356 Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MINSTRUMENT_H__
+#define __MINSTRUMENT_H__
+
+#include "globaldefs.h"
+#include <list>
+#include <vector>
+//Added by qt3to4:
+#include <Q3PopupMenu>
+
+class MidiPort;
+class Q3PopupMenu;
+class MidiPlayEvent;
+class Xml;
+class EventList;
+class MidiControllerList;
+class QString;
+
+//---------------------------------------------------------
+// Patch
+//---------------------------------------------------------
+
+struct Patch {
+ signed char typ; // 1 - GM 2 - GS 4 - XG
+ signed char hbank, lbank, prog;
+ QString name;
+ bool drum;
+ void read(Xml&);
+ void write(int level, Xml&);
+ };
+
+typedef std::list<Patch*> PatchList;
+typedef PatchList::iterator iPatch;
+typedef PatchList::const_iterator ciPatch;
+
+//---------------------------------------------------------
+// PatchGroup
+//---------------------------------------------------------
+
+struct PatchGroup {
+ QString name;
+ PatchList patches;
+ void read(Xml&);
+ };
+
+typedef std::vector<PatchGroup*> PatchGroupList;
+typedef PatchGroupList::iterator iPatchGroup;
+typedef PatchGroupList::const_iterator ciPatchGroup;
+
+//---------------------------------------------------------
+// MidiInstrument
+//---------------------------------------------------------
+
+class MidiInstrument {
+ PatchGroupList pg;
+ MidiControllerList* _controller;
+ bool _dirty;
+ int _nullvalue;
+
+ void init();
+
+ protected:
+ EventList* _midiInit;
+ EventList* _midiReset;
+ EventList* _midiState;
+ char* _initScript;
+ QString _name;
+ QString _filePath;
+
+ public:
+ MidiInstrument();
+ virtual ~MidiInstrument();
+ MidiInstrument(const QString& txt);
+ const QString& iname() const { return _name; }
+ void setIName(const QString& txt) { _name = txt; }
+
+ //MidiInstrument& uniqueCopy(const MidiInstrument&);
+ // Assign will 'delete' all existing patches and groups from the instrument.
+ MidiInstrument& assign(const MidiInstrument&);
+ QString filePath() const { return _filePath; }
+ void setFilePath(const QString& s) { _filePath = s; }
+ bool dirty() const { return _dirty; }
+ void setDirty(bool v) { _dirty = v; }
+
+
+ EventList* midiInit() const { return _midiInit; }
+ EventList* midiReset() const { return _midiReset; }
+ EventList* midiState() const { return _midiState; }
+ const char* initScript() const { return _initScript; }
+ MidiControllerList* controller() const { return _controller; }
+ int nullSendValue() { return _nullvalue; }
+ void setNullSendValue(int v) { _nullvalue = v; }
+
+ void readMidiState(Xml& xml);
+ virtual bool guiVisible() const { return false; }
+ virtual void showGui(bool) {}
+ virtual bool hasGui() const { return false; }
+ virtual void writeToGui(const MidiPlayEvent&) {}
+
+ virtual void reset(int, MType);
+ virtual const char* getPatchName(int,int,MType,bool);
+ virtual void populatePatchPopup(Q3PopupMenu*, int, MType, bool);
+ void read(Xml&);
+ void write(int level, Xml&);
+ PatchGroupList* groups() { return &pg; }
+ };
+
+//---------------------------------------------------------
+// MidiInstrumentList
+//---------------------------------------------------------
+
+class MidiInstrumentList : public std::list<MidiInstrument*> {
+
+ public:
+ MidiInstrumentList() {}
+ };
+
+typedef MidiInstrumentList::iterator iMidiInstrument;
+
+extern MidiInstrumentList midiInstruments;
+extern MidiInstrument* genericMidiInstrument;
+extern void initMidiInstruments();
+extern MidiInstrument* registerMidiInstrument(const QString&);
+extern void removeMidiInstrument(const QString& name);
+extern void removeMidiInstrument(const MidiInstrument* instr);
+
+#endif
+
diff --git a/muse2/muse/key.cpp b/muse2/muse/key.cpp
new file mode 100644
index 00000000..0f34f8ea
--- /dev/null
+++ b/muse2/muse/key.cpp
@@ -0,0 +1,35 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: key.cpp,v 1.1.1.1 2003/10/27 18:51:22 wschweer Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include "key.h"
+#include "globals.h"
+
+int NKey::offsets[14] = {
+ 0, 7, 14, -7,
+ -(12),
+ -19, -26, -10, -14, -2, -4, -6, -8, 0
+ };
+
+int NKey::width() const
+ {
+ return 25;
+ }
+
+//---------------------------------------------------------
+// Scale::width
+//---------------------------------------------------------
+
+int Scale::width() const
+ {
+ int i = val;
+ if (i < 0)
+ i = -i;
+ return i * 7;
+ }
+
diff --git a/muse2/muse/key.h b/muse2/muse/key.h
new file mode 100644
index 00000000..1c1c4cac
--- /dev/null
+++ b/muse2/muse/key.h
@@ -0,0 +1,54 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: key.h,v 1.1.1.1 2003/10/27 18:51:25 wschweer Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __KEY_H__
+#define __KEY_H__
+
+#include <stdio.h>
+class QPainter;
+class QPoint;
+class Xml;
+
+//---------------------------------------------------------
+// NKey
+//---------------------------------------------------------
+
+class NKey {
+ static int offsets[14];
+ int val;
+ public:
+ NKey() { val = 7; }
+ NKey(int k) { val = k; }
+ void draw(QPainter& p, const QPoint& pt) const;
+ int idx() const { return val; }
+ int offset() const { return offsets[val]; }
+ void read(Xml&);
+ void write(int, Xml&) const;
+ void set(int n) { val = n; }
+ int width() const;
+ };
+
+//---------------------------------------------------------
+// Scale
+//---------------------------------------------------------
+
+class Scale {
+ int val; // 1 = 1 sharp, -1 1 flat
+ bool minor;
+ public:
+ Scale() { val = 0; minor = false; }
+ Scale(int s, bool m = false) { val = s; minor = m; }
+ int idx() const { return val; }
+ void read(Xml&);
+ void write(int, Xml&) const;
+ void set(int n) { val = n; }
+ void setMajorMinor(bool f) { minor = f; } // true == minor
+ int width() const;
+ };
+#endif
+
diff --git a/muse2/muse/ladspa.h b/muse2/muse/ladspa.h
new file mode 100644
index 00000000..7bbc338f
--- /dev/null
+++ b/muse2/muse/ladspa.h
@@ -0,0 +1,599 @@
+/* ladspa.h
+
+ Linux Audio Developer's Simple Plugin API Version 1.1[provisional,
+ LGPL]. Copyright (C) 2000-2002 Richard W.E. Furse, Paul
+ Barton-Davis, Stefan Westerfeld.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef LADSPA_INCLUDED
+#define LADSPA_INCLUDED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*****************************************************************************/
+
+/* Overview:
+
+ There is a large number of synthesis packages in use or development
+ on the Linux platform at this time. This API (`The Linux Audio
+ Developer's Simple Plugin API') attempts to give programmers the
+ ability to write simple `plugin' audio processors in C/C++ and link
+ them dynamically (`plug') into a range of these packages (`hosts').
+ It should be possible for any host and any plugin to communicate
+ completely through this interface.
+
+ This API is deliberately short and simple. To achieve compatibility
+ with a range of promising Linux sound synthesis packages it
+ attempts to find the `greatest common divisor' in their logical
+ behaviour. Having said this, certain limiting decisions are
+ implicit, notably the use of a fixed type (LADSPA_Data) for all
+ data transfer and absence of a parameterised `initialisation'
+ phase. See below for the LADSPA_Data typedef.
+
+ Plugins are expected to distinguish between control and audio
+ data. Plugins have `ports' that are inputs or outputs for audio or
+ control data and each plugin is `run' for a `block' corresponding
+ to a short time interval measured in samples. Audio data is
+ communicated using arrays of LADSPA_Data, allowing a block of audio
+ to be processed by the plugin in a single pass. Control data is
+ communicated using single LADSPA_Data values. Control data has a
+ single value at the start of a call to the `run()' or `run_adding()'
+ function, and may be considered to remain this value for its
+ duration. The plugin may assume that all its input and output ports
+ have been connected to the relevant data location (see the
+ `connect_port()' function below) before it is asked to run.
+
+ Plugins will reside in shared object files suitable for dynamic
+ linking by dlopen() and family. The file will provide a number of
+ `plugin types' that can be used to instantiate actual plugins
+ (sometimes known as `plugin instances') that can be connected
+ together to perform tasks.
+
+ This API contains very limited error-handling. */
+
+/*****************************************************************************/
+
+/* Fundamental data type passed in and out of plugin. This data type
+ is used to communicate audio samples and control values. It is
+ assumed that the plugin will work sensibly given any numeric input
+ value although it may have a preferred range (see hints below).
+
+ For audio it is generally assumed that 1.0f is the `0dB' reference
+ amplitude and is a `normal' signal level. */
+
+typedef float LADSPA_Data;
+
+/*****************************************************************************/
+
+/* Special Plugin Properties:
+
+ Optional features of the plugin type are encapsulated in the
+ LADSPA_Properties type. This is assembled by ORing individual
+ properties together. */
+
+typedef int LADSPA_Properties;
+
+/* Property LADSPA_PROPERTY_REALTIME indicates that the plugin has a
+ real-time dependency (e.g. listens to a MIDI device) and so its
+ output must not be cached or subject to significant latency. */
+#define LADSPA_PROPERTY_REALTIME 0x1
+
+/* Property LADSPA_PROPERTY_INPLACE_BROKEN indicates that the plugin
+ may cease to work correctly if the host elects to use the same data
+ location for both input and output (see connect_port()). This
+ should be avoided as enabling this flag makes it impossible for
+ hosts to use the plugin to process audio `in-place.' */
+#define LADSPA_PROPERTY_INPLACE_BROKEN 0x2
+
+/* Property LADSPA_PROPERTY_HARD_RT_CAPABLE indicates that the plugin
+ is capable of running not only in a conventional host but also in a
+ `hard real-time' environment. To qualify for this the plugin must
+ satisfy all of the following:
+
+ (1) The plugin must not use malloc(), free() or other heap memory
+ management within its run() or run_adding() functions. All new
+ memory used in run() must be managed via the stack. These
+ restrictions only apply to the run() function.
+
+ (2) The plugin will not attempt to make use of any library
+ functions with the exceptions of functions in the ANSI standard C
+ and C maths libraries, which the host is expected to provide.
+
+ (3) The plugin will not access files, devices, pipes, sockets, IPC
+ or any other mechanism that might result in process or thread
+ blocking.
+
+ (4) The plugin will take an amount of time to execute a run() or
+ run_adding() call approximately of form (A+B*SampleCount) where A
+ and B depend on the machine and host in use. This amount of time
+ may not depend on input signals or plugin state. The host is left
+ the responsibility to perform timings to estimate upper bounds for
+ A and B. */
+#define LADSPA_PROPERTY_HARD_RT_CAPABLE 0x4
+
+#define LADSPA_IS_REALTIME(x) ((x) & LADSPA_PROPERTY_REALTIME)
+#define LADSPA_IS_INPLACE_BROKEN(x) ((x) & LADSPA_PROPERTY_INPLACE_BROKEN)
+#define LADSPA_IS_HARD_RT_CAPABLE(x) ((x) & LADSPA_PROPERTY_HARD_RT_CAPABLE)
+
+/*****************************************************************************/
+
+/* Plugin Ports:
+
+ Plugins have `ports' that are inputs or outputs for audio or
+ data. Ports can communicate arrays of LADSPA_Data (for audio
+ inputs/outputs) or single LADSPA_Data values (for control
+ input/outputs). This information is encapsulated in the
+ LADSPA_PortDescriptor type which is assembled by ORing individual
+ properties together.
+
+ Note that a port must be an input or an output port but not both
+ and that a port must be a control or audio port but not both. */
+
+typedef int LADSPA_PortDescriptor;
+
+/* Property LADSPA_PORT_INPUT indicates that the port is an input. */
+#define LADSPA_PORT_INPUT 0x1
+
+/* Property LADSPA_PORT_OUTPUT indicates that the port is an output. */
+#define LADSPA_PORT_OUTPUT 0x2
+
+/* Property LADSPA_PORT_CONTROL indicates that the port is a control
+ port. */
+#define LADSPA_PORT_CONTROL 0x4
+
+/* Property LADSPA_PORT_AUDIO indicates that the port is a audio
+ port. */
+#define LADSPA_PORT_AUDIO 0x8
+
+#define LADSPA_IS_PORT_INPUT(x) ((x) & LADSPA_PORT_INPUT)
+#define LADSPA_IS_PORT_OUTPUT(x) ((x) & LADSPA_PORT_OUTPUT)
+#define LADSPA_IS_PORT_CONTROL(x) ((x) & LADSPA_PORT_CONTROL)
+#define LADSPA_IS_PORT_AUDIO(x) ((x) & LADSPA_PORT_AUDIO)
+
+/*****************************************************************************/
+
+/* Plugin Port Range Hints:
+
+ The host may wish to provide a representation of data entering or
+ leaving a plugin (e.g. to generate a GUI automatically). To make
+ this more meaningful, the plugin should provide `hints' to the host
+ describing the usual values taken by the data.
+
+ Note that these are only hints. The host may ignore them and the
+ plugin must not assume that data supplied to it is meaningful. If
+ the plugin receives invalid input data it is expected to continue
+ to run without failure and, where possible, produce a sensible
+ output (e.g. a high-pass filter given a negative cutoff frequency
+ might switch to an all-pass mode).
+
+ Hints are meaningful for all input and output ports but hints for
+ input control ports are expected to be particularly useful.
+
+ More hint information is encapsulated in the
+ LADSPA_PortRangeHintDescriptor type which is assembled by ORing
+ individual hint types together. Hints may require further
+ LowerBound and UpperBound information.
+
+ All the hint information for a particular port is aggregated in the
+ LADSPA_PortRangeHint structure. */
+
+typedef int LADSPA_PortRangeHintDescriptor;
+
+/* Hint LADSPA_HINT_BOUNDED_BELOW indicates that the LowerBound field
+ of the LADSPA_PortRangeHint should be considered meaningful. The
+ value in this field should be considered the (inclusive) lower
+ bound of the valid range. If LADSPA_HINT_SAMPLE_RATE is also
+ specified then the value of LowerBound should be multiplied by the
+ sample rate. */
+#define LADSPA_HINT_BOUNDED_BELOW 0x1
+
+/* Hint LADSPA_HINT_BOUNDED_ABOVE indicates that the UpperBound field
+ of the LADSPA_PortRangeHint should be considered meaningful. The
+ value in this field should be considered the (inclusive) upper
+ bound of the valid range. If LADSPA_HINT_SAMPLE_RATE is also
+ specified then the value of UpperBound should be multiplied by the
+ sample rate. */
+#define LADSPA_HINT_BOUNDED_ABOVE 0x2
+
+/* Hint LADSPA_HINT_TOGGLED indicates that the data item should be
+ considered a Boolean toggle. Data less than or equal to zero should
+ be considered `off' or `false,' and data above zero should be
+ considered `on' or `true.' LADSPA_HINT_TOGGLED may not be used in
+ conjunction with any other hint except LADSPA_HINT_DEFAULT_0 or
+ LADSPA_HINT_DEFAULT_1. */
+#define LADSPA_HINT_TOGGLED 0x4
+
+/* Hint LADSPA_HINT_SAMPLE_RATE indicates that any bounds specified
+ should be interpreted as multiples of the sample rate. For
+ instance, a frequency range from 0Hz to the Nyquist frequency (half
+ the sample rate) could be requested by this hint in conjunction
+ with LowerBound = 0 and UpperBound = 0.5. Hosts that support bounds
+ at all must support this hint to retain meaning. */
+#define LADSPA_HINT_SAMPLE_RATE 0x8
+
+/* Hint LADSPA_HINT_LOGARITHMIC indicates that it is likely that the
+ user will find it more intuitive to view values using a logarithmic
+ scale. This is particularly useful for frequencies and gains. */
+#define LADSPA_HINT_LOGARITHMIC 0x10
+
+/* Hint LADSPA_HINT_INTEGER indicates that a user interface would
+ probably wish to provide a stepped control taking only integer
+ values. Any bounds set should be slightly wider than the actual
+ integer range required to avoid floating point rounding errors. For
+ instance, the integer set {0,1,2,3} might be described as [-0.1,
+ 3.1]. */
+#define LADSPA_HINT_INTEGER 0x20
+
+/* The various LADSPA_HINT_HAS_DEFAULT_* hints indicate a `normal'
+ value for the port that is sensible as a default. For instance,
+ this value is suitable for use as an initial value in a user
+ interface or as a value the host might assign to a control port
+ when the user has not provided one. Defaults are encoded using a
+ mask so only one default may be specified for a port. Some of the
+ hints make use of lower and upper bounds, in which case the
+ relevant bound or bounds must be available and
+ LADSPA_HINT_SAMPLE_RATE must be applied as usual. The resulting
+ default must be rounded if LADSPA_HINT_INTEGER is present. Default
+ values were introduced in LADSPA v1.1. */
+#define LADSPA_HINT_DEFAULT_MASK 0x3C0
+
+/* This default values indicates that no default is provided. */
+#define LADSPA_HINT_DEFAULT_NONE 0x0
+
+/* This default hint indicates that the suggested lower bound for the
+ port should be used. */
+#define LADSPA_HINT_DEFAULT_MINIMUM 0x40
+
+/* This default hint indicates that a low value between the suggested
+ lower and upper bounds should be chosen. For ports with
+ LADSPA_HINT_LOGARITHMIC, this should be exp(log(lower) * 0.75 +
+ log(upper) * 0.25). Otherwise, this should be (lower * 0.75 + upper
+ * 0.25). */
+#define LADSPA_HINT_DEFAULT_LOW 0x80
+
+/* This default hint indicates that a middle value between the
+ suggested lower and upper bounds should be chosen. For ports with
+ LADSPA_HINT_LOGARITHMIC, this should be exp(log(lower) * 0.5 +
+ log(upper) * 0.5). Otherwise, this should be (lower * 0.5 + upper *
+ 0.5). */
+#define LADSPA_HINT_DEFAULT_MIDDLE 0xC0
+
+/* This default hint indicates that a high value between the suggested
+ lower and upper bounds should be chosen. For ports with
+ LADSPA_HINT_LOGARITHMIC, this should be exp(log(lower) * 0.25 +
+ log(upper) * 0.75). Otherwise, this should be (lower * 0.25 + upper
+ * 0.75). */
+#define LADSPA_HINT_DEFAULT_HIGH 0x100
+
+/* This default hint indicates that the suggested upper bound for the
+ port should be used. */
+#define LADSPA_HINT_DEFAULT_MAXIMUM 0x140
+
+/* This default hint indicates that the number 0 should be used. Note
+ that this default may be used in conjunction with
+ LADSPA_HINT_TOGGLED. */
+#define LADSPA_HINT_DEFAULT_0 0x200
+
+/* This default hint indicates that the number 1 should be used. Note
+ that this default may be used in conjunction with
+ LADSPA_HINT_TOGGLED. */
+#define LADSPA_HINT_DEFAULT_1 0x240
+
+/* This default hint indicates that the number 100 should be used. */
+#define LADSPA_HINT_DEFAULT_100 0x280
+
+/* This default hint indicates that the Hz frequency of `concert A'
+ should be used. This will be 440 unless the host uses an unusual
+ tuning convention, in which case it may be within a few Hz. */
+#define LADSPA_HINT_DEFAULT_440 0x2C0
+
+#define LADSPA_IS_HINT_BOUNDED_BELOW(x) ((x) & LADSPA_HINT_BOUNDED_BELOW)
+#define LADSPA_IS_HINT_BOUNDED_ABOVE(x) ((x) & LADSPA_HINT_BOUNDED_ABOVE)
+#define LADSPA_IS_HINT_TOGGLED(x) ((x) & LADSPA_HINT_TOGGLED)
+#define LADSPA_IS_HINT_SAMPLE_RATE(x) ((x) & LADSPA_HINT_SAMPLE_RATE)
+#define LADSPA_IS_HINT_LOGARITHMIC(x) ((x) & LADSPA_HINT_LOGARITHMIC)
+#define LADSPA_IS_HINT_INTEGER(x) ((x) & LADSPA_HINT_INTEGER)
+
+#define LADSPA_IS_HINT_HAS_DEFAULT(x) ((x) & LADSPA_HINT_DEFAULT_MASK)
+#define LADSPA_IS_HINT_DEFAULT_MINIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_MINIMUM)
+#define LADSPA_IS_HINT_DEFAULT_LOW(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_LOW)
+#define LADSPA_IS_HINT_DEFAULT_MIDDLE(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_MIDDLE)
+#define LADSPA_IS_HINT_DEFAULT_HIGH(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_HIGH)
+#define LADSPA_IS_HINT_DEFAULT_MAXIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_MAXIMUM)
+#define LADSPA_IS_HINT_DEFAULT_0(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_0)
+#define LADSPA_IS_HINT_DEFAULT_1(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_1)
+#define LADSPA_IS_HINT_DEFAULT_100(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_100)
+#define LADSPA_IS_HINT_DEFAULT_440(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_440)
+
+typedef struct _LADSPA_PortRangeHint {
+
+ /* Hints about the port. */
+ LADSPA_PortRangeHintDescriptor HintDescriptor;
+
+ /* Meaningful when hint LADSPA_HINT_BOUNDED_BELOW is active. When
+ LADSPA_HINT_SAMPLE_RATE is also active then this value should be
+ multiplied by the relevant sample rate. */
+ LADSPA_Data LowerBound;
+
+ /* Meaningful when hint LADSPA_HINT_BOUNDED_ABOVE is active. When
+ LADSPA_HINT_SAMPLE_RATE is also active then this value should be
+ multiplied by the relevant sample rate. */
+ LADSPA_Data UpperBound;
+
+} LADSPA_PortRangeHint;
+
+/*****************************************************************************/
+
+/* Plugin Handles:
+
+ This plugin handle indicates a particular instance of the plugin
+ concerned. It is valid to compare this to NULL (0 for C++) but
+ otherwise the host should not attempt to interpret it. The plugin
+ may use it to reference internal instance data. */
+
+typedef void * LADSPA_Handle;
+
+/*****************************************************************************/
+
+/* Descriptor for a Type of Plugin:
+
+ This structure is used to describe a plugin type. It provides a
+ number of functions to examine the type, instantiate it, link it to
+ buffers and workspaces and to run it. */
+
+typedef struct _LADSPA_Descriptor {
+
+ /* This numeric identifier indicates the plugin type
+ uniquely. Plugin programmers may reserve ranges of IDs from a
+ central body to avoid clashes. Hosts may assume that IDs are
+ below 0x1000000. */
+ unsigned long UniqueID;
+
+ /* This identifier can be used as a unique, case-sensitive
+ identifier for the plugin type within the plugin file. Plugin
+ types should be identified by file and label rather than by index
+ or plugin name, which may be changed in new plugin
+ versions. Labels must not contain white-space characters. */
+ const char * Label;
+
+ /* This indicates a number of properties of the plugin. */
+ LADSPA_Properties Properties;
+
+ /* This member points to the null-terminated name of the plugin
+ (e.g. "Sine Oscillator"). */
+ const char * Name;
+
+ /* This member points to the null-terminated string indicating the
+ maker of the plugin. This can be an empty string but not NULL. */
+ const char * Maker;
+
+ /* This member points to the null-terminated string indicating any
+ copyright applying to the plugin. If no Copyright applies the
+ string "None" should be used. */
+ const char * Copyright;
+
+ /* This indicates the number of ports (input AND output) present on
+ the plugin. */
+ unsigned long PortCount;
+
+ /* This member indicates an array of port descriptors. Valid indices
+ vary from 0 to PortCount-1. */
+ const LADSPA_PortDescriptor * PortDescriptors;
+
+ /* This member indicates an array of null-terminated strings
+ describing ports (e.g. "Frequency (Hz)"). Valid indices vary from
+ 0 to PortCount-1. */
+ const char * const * PortNames;
+
+ /* This member indicates an array of range hints for each port (see
+ above). Valid indices vary from 0 to PortCount-1. */
+ const LADSPA_PortRangeHint * PortRangeHints;
+
+ /* This may be used by the plugin developer to pass any custom
+ implementation data into an instantiate call. It must not be used
+ or interpreted by the host. It is expected that most plugin
+ writers will not use this facility as LADSPA_Handle should be
+ used to hold instance data. */
+ void * ImplementationData;
+
+ /* This member is a function pointer that instantiates a plugin. A
+ handle is returned indicating the new plugin instance. The
+ instantiation function accepts a sample rate as a parameter. The
+ plugin descriptor from which this instantiate function was found
+ must also be passed. This function must return NULL if
+ instantiation fails.
+
+ Note that instance initialisation should generally occur in
+ activate() rather than here. */
+ LADSPA_Handle (*instantiate)(const struct _LADSPA_Descriptor * Descriptor,
+ unsigned long SampleRate);
+
+ /* This member is a function pointer that connects a port on an
+ instantiated plugin to a memory location at which a block of data
+ for the port will be read/written. The data location is expected
+ to be an array of LADSPA_Data for audio ports or a single
+ LADSPA_Data value for control ports. Memory issues will be
+ managed by the host. The plugin must read/write the data at these
+ locations every time run() or run_adding() is called and the data
+ present at the time of this connection call should not be
+ considered meaningful.
+
+ connect_port() may be called more than once for a plugin instance
+ to allow the host to change the buffers that the plugin is
+ reading or writing. These calls may be made before or after
+ activate() or deactivate() calls.
+
+ connect_port() must be called at least once for each port before
+ run() or run_adding() is called. When working with blocks of
+ LADSPA_Data the plugin should pay careful attention to the block
+ size passed to the run function as the block allocated may only
+ just be large enough to contain the block of samples.
+
+ Plugin writers should be aware that the host may elect to use the
+ same buffer for more than one port and even use the same buffer
+ for both input and output (see LADSPA_PROPERTY_INPLACE_BROKEN).
+ However, overlapped buffers or use of a single buffer for both
+ audio and control data may result in unexpected behaviour. */
+ void (*connect_port)(LADSPA_Handle Instance,
+ unsigned long Port,
+ LADSPA_Data * DataLocation);
+
+ /* This member is a function pointer that initialises a plugin
+ instance and activates it for use. This is separated from
+ instantiate() to aid real-time support and so that hosts can
+ reinitialise a plugin instance by calling deactivate() and then
+ activate(). In this case the plugin instance must reset all state
+ information dependent on the history of the plugin instance
+ except for any data locations provided by connect_port() and any
+ gain set by set_run_adding_gain(). If there is nothing for
+ activate() to do then the plugin writer may provide a NULL rather
+ than an empty function.
+
+ When present, hosts must call this function once before run() (or
+ run_adding()) is called for the first time. This call should be
+ made as close to the run() call as possible and indicates to
+ real-time plugins that they are now live. Plugins should not rely
+ on a prompt call to run() after activate(). activate() may not be
+ called again unless deactivate() is called first. Note that
+ connect_port() may be called before or after a call to
+ activate(). */
+ void (*activate)(LADSPA_Handle Instance);
+
+ /* This method is a function pointer that runs an instance of a
+ plugin for a block. Two parameters are required: the first is a
+ handle to the particular instance to be run and the second
+ indicates the block size (in samples) for which the plugin
+ instance may run.
+
+ Note that if an activate() function exists then it must be called
+ before run() or run_adding(). If deactivate() is called for a
+ plugin instance then the plugin instance may not be reused until
+ activate() has been called again.
+
+ If the plugin has the property LADSPA_PROPERTY_HARD_RT_CAPABLE
+ then there are various things that the plugin should not do
+ within the run() or run_adding() functions (see above). */
+ void (*run)(LADSPA_Handle Instance,
+ unsigned long SampleCount);
+
+ /* This method is a function pointer that runs an instance of a
+ plugin for a block. This has identical behaviour to run() except
+ in the way data is output from the plugin. When run() is used,
+ values are written directly to the memory areas associated with
+ the output ports. However when run_adding() is called, values
+ must be added to the values already present in the memory
+ areas. Furthermore, output values written must be scaled by the
+ current gain set by set_run_adding_gain() (see below) before
+ addition.
+
+ run_adding() is optional. When it is not provided by a plugin,
+ this function pointer must be set to NULL. When it is provided,
+ the function set_run_adding_gain() must be provided also. */
+ void (*run_adding)(LADSPA_Handle Instance,
+ unsigned long SampleCount);
+
+ /* This method is a function pointer that sets the output gain for
+ use when run_adding() is called (see above). If this function is
+ never called the gain is assumed to default to 1. Gain
+ information should be retained when activate() or deactivate()
+ are called.
+
+ This function should be provided by the plugin if and only if the
+ run_adding() function is provided. When it is absent this
+ function pointer must be set to NULL. */
+ void (*set_run_adding_gain)(LADSPA_Handle Instance,
+ LADSPA_Data Gain);
+
+ /* This is the counterpart to activate() (see above). If there is
+ nothing for deactivate() to do then the plugin writer may provide
+ a NULL rather than an empty function.
+
+ Hosts must deactivate all activated units after they have been
+ run() (or run_adding()) for the last time. This call should be
+ made as close to the last run() call as possible and indicates to
+ real-time plugins that they are no longer live. Plugins should
+ not rely on prompt deactivation. Note that connect_port() may be
+ called before or after a call to deactivate().
+
+ Deactivation is not similar to pausing as the plugin instance
+ will be reinitialised when activate() is called to reuse it. */
+ void (*deactivate)(LADSPA_Handle Instance);
+
+ /* Once an instance of a plugin has been finished with it can be
+ deleted using the following function. The instance handle passed
+ ceases to be valid after this call.
+
+ If activate() was called for a plugin instance then a
+ corresponding call to deactivate() must be made before cleanup()
+ is called. */
+ void (*cleanup)(LADSPA_Handle Instance);
+
+} LADSPA_Descriptor;
+
+/**********************************************************************/
+
+/* Accessing a Plugin: */
+
+/* The exact mechanism by which plugins are loaded is host-dependent,
+ however all most hosts will need to know is the name of shared
+ object file containing the plugin types. To allow multiple hosts to
+ share plugin types, hosts may wish to check for environment
+ variable LADSPA_PATH. If present, this should contain a
+ colon-separated path indicating directories that should be searched
+ (in order) when loading plugin types.
+
+ A plugin programmer must include a function called
+ "ladspa_descriptor" with the following function prototype within
+ the shared object file. This function will have C-style linkage (if
+ you are using C++ this is taken care of by the `extern "C"' clause
+ at the top of the file).
+
+ A host will find the plugin shared object file by one means or
+ another, find the ladspa_descriptor() function, call it, and
+ proceed from there.
+
+ Plugin types are accessed by index (not ID) using values from 0
+ upwards. Out of range indexes must result in this function
+ returning NULL, so the plugin count can be determined by checking
+ for the least index that results in NULL being returned. */
+
+const LADSPA_Descriptor * ladspa_descriptor(unsigned long Index);
+
+/* Datatype corresponding to the ladspa_descriptor() function. */
+typedef const LADSPA_Descriptor *
+(*LADSPA_Descriptor_Function)(unsigned long Index);
+
+/**********************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LADSPA_INCLUDED */
+
+/* EOF */
diff --git a/muse2/muse/liste/Makefile.am b/muse2/muse/liste/Makefile.am
new file mode 100644
index 00000000..3fa30b8b
--- /dev/null
+++ b/muse2/muse/liste/Makefile.am
@@ -0,0 +1,16 @@
+include $(top_srcdir)/common.am
+
+if PCH
+AM_CXXFLAGS += -include $(top_srcdir)/all.h
+endif
+
+noinst_LIBRARIES = libliste.a
+
+dist_libliste_a_SOURCES = \
+ listedit.cpp listedit.h \
+ editevent.cpp editevent.h \
+ editctrlbase.ui
+
+nodist_libliste_a_SOURCES = \
+ moc_listedit.cpp \
+ moc_editevent.cpp
diff --git a/muse2/muse/liste/Makefile.in b/muse2/muse/liste/Makefile.in
new file mode 100644
index 00000000..ca126675
--- /dev/null
+++ b/muse2/muse/liste/Makefile.in
@@ -0,0 +1,601 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/common.am
+@PCH_TRUE@am__append_1 = -include $(top_srcdir)/all.h
+subdir = muse/liste
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
+ $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libliste_a_AR = $(AR) $(ARFLAGS)
+libliste_a_LIBADD =
+dist_libliste_a_OBJECTS = listedit.$(OBJEXT) editevent.$(OBJEXT) \
+ editctrlbase.$(OBJEXT)
+nodist_libliste_a_OBJECTS = moc_listedit.$(OBJEXT) \
+ moc_editevent.$(OBJEXT)
+libliste_a_OBJECTS = $(dist_libliste_a_OBJECTS) \
+ $(nodist_libliste_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(dist_libliste_a_SOURCES) $(nodist_libliste_a_SOURCES)
+DIST_SOURCES = $(dist_libliste_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCBOOKSTYLE = @DOCBOOKSTYLE@
+DOCBOOKTARGETS = @DOCBOOKTARGETS@
+DOT = @DOT@
+DOTPATH = @DOTPATH@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@
+FST_CFLAGS = @FST_CFLAGS@
+FST_LIBS = @FST_LIBS@
+Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@
+Fluidsynth_LIBS = @Fluidsynth_LIBS@
+GIVERTCAP = @GIVERTCAP@
+GREP = @GREP@
+HAVEDOT = @HAVEDOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JADE = @JADE@
+LASH_CFLAGS = @LASH_CFLAGS@
+LASH_LIBS = @LASH_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LO_CFLAGS = @LO_CFLAGS@
+LO_LIBS = @LO_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUSECXXFLAGS = @MUSECXXFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSGMLS = @NSGMLS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCH = @PCH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIB = @PYTHON_LIB@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+QTDIR_BIN = @QTDIR_BIN@
+QTDIR_INC = @QTDIR_INC@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+SUIDBUILD = @SUIDBUILD@
+SUIDINSTALL = @SUIDINSTALL@
+USE_SSE = @USE_SSE@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+have_docbook = @have_docbook@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+synth_fluid = @synth_fluid@
+synth_fluidsynth = @synth_fluidsynth@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \
+ -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(am__append_1)
+AM_CPPFLAGS =
+MOC = $(QTDIR_BIN)/moc
+#UIC = $(QTDIR_BIN)/uic3
+UIC = /usr/bin/uic3
+UIFILES = $(wildcard *.ui)
+MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \
+ if grep -q Q_OBJECT $$h; then \
+ echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \
+ fi; \
+ done)
+
+BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+SUFFIXES = .ui .h.gch
+noinst_LIBRARIES = libliste.a
+dist_libliste_a_SOURCES = \
+ listedit.cpp listedit.h \
+ editevent.cpp editevent.h \
+ editctrlbase.ui
+
+nodist_libliste_a_SOURCES = \
+ moc_listedit.cpp \
+ moc_editevent.cpp
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .ui .h.gch .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/liste/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu muse/liste/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libliste.a: $(libliste_a_OBJECTS) $(libliste_a_DEPENDENCIES)
+ -rm -f libliste.a
+ $(libliste_a_AR) libliste.a $(libliste_a_OBJECTS) $(libliste_a_LIBADD)
+ $(RANLIB) libliste.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/editevent.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listedit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_editevent.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_listedit.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+de:
+ @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done
+
+nde:
+ @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done
+
+.ui.o: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(CXXCOMPILE) -c $*.cpp -o $*.o
+ $(RM) $*.cpp moc_$*.cpp moc_$*.o
+
+.ui.lo: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(LTCXXCOMPILE) -c $*.cpp -o $*.lo
+ $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o
+
+moc_%.cpp: %.h
+ $(MOC) $< -o $@
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/muse2/muse/liste/editctrlbase.ui b/muse2/muse/liste/editctrlbase.ui
new file mode 100644
index 00000000..e018a802
--- /dev/null
+++ b/muse2/muse/liste/editctrlbase.ui
@@ -0,0 +1,702 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>EditCtrlBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MyDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>601</width>
+ <height>413</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Edit Controller Event</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="3">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Time Position</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Available Controller:</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="0">
+ <property name="name">
+ <cstring>buttonNewController</cstring>
+ </property>
+ <property name="text">
+ <string>Create New Controller</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="PosEdit" row="0" column="4">
+ <property name="name">
+ <cstring>timePos</cstring>
+ </property>
+ </widget>
+ <widget class="QWidgetStack" row="1" column="3" rowspan="2" colspan="2">
+ <property name="name">
+ <cstring>widgetStack</cstring>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>104</red>
+ <green>137</green>
+ <blue>236</blue>
+ </color>
+ </property>
+ <property name="palette">
+ <palette>
+ <active>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>238</red>
+ <green>234</green>
+ <blue>222</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>246</red>
+ <green>244</green>
+ <blue>238</blue>
+ </color>
+ <color>
+ <red>119</red>
+ <green>117</green>
+ <blue>111</blue>
+ </color>
+ <color>
+ <red>158</red>
+ <green>155</green>
+ <blue>147</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>104</red>
+ <green>137</green>
+ <blue>236</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </active>
+ <disabled>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>238</red>
+ <green>234</green>
+ <blue>222</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>119</red>
+ <green>117</green>
+ <blue>111</blue>
+ </color>
+ <color>
+ <red>158</red>
+ <green>155</green>
+ <blue>147</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>104</red>
+ <green>137</green>
+ <blue>236</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>192</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>0</green>
+ <blue>128</blue>
+ </color>
+ </disabled>
+ <inactive>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>238</red>
+ <green>234</green>
+ <blue>222</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>119</red>
+ <green>117</green>
+ <blue>111</blue>
+ </color>
+ <color>
+ <red>158</red>
+ <green>155</green>
+ <blue>147</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>104</red>
+ <green>137</green>
+ <blue>236</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>192</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>0</green>
+ <blue>128</blue>
+ </color>
+ </inactive>
+ </palette>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSlider" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>valSlider</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>controllerName</cstring>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </property>
+ <property name="frameShape">
+ <enum>LineEditPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="text">
+ <string>textLabel3</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Controller</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="1">
+ <property name="name">
+ <cstring>valSpinBox</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <spacer row="0" column="1">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>1</number>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>H-Bank</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>L-Bank</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel4_2</cstring>
+ </property>
+ <property name="text">
+ <string>Program</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="1">
+ <property name="name">
+ <cstring>hbank</cstring>
+ </property>
+ <property name="specialValueText">
+ <string>off</string>
+ </property>
+ <property name="maxValue">
+ <number>128</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="1">
+ <property name="name">
+ <cstring>lbank</cstring>
+ </property>
+ <property name="specialValueText">
+ <string>off</string>
+ </property>
+ <property name="maxValue">
+ <number>128</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="4" column="1">
+ <property name="name">
+ <cstring>program</cstring>
+ </property>
+ <property name="maxValue">
+ <number>128</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ </widget>
+ <spacer row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>140</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>patchName</cstring>
+ </property>
+ <property name="text">
+ <string>pushButton4</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="5">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="Line" row="3" column="0" rowspan="1" colspan="5">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <property name="lineWidth">
+ <number>3</number>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <property name="midLineWidth">
+ <number>2</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QListBox" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>ctrlList</cstring>
+ </property>
+ <property name="currentItem">
+ <number>-1</number>
+ </property>
+ </widget>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>60</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="Line" row="0" column="2" rowspan="3" colspan="1">
+ <property name="name">
+ <cstring>line2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>VLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <property name="lineWidth">
+ <number>3</number>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <property name="midLineWidth">
+ <number>2</number>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>PosEdit</class>
+ <header location="global">posedit.h</header>
+ <sizehint>
+ <width>50</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </customwidget>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>valSlider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>valSpinBox</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+ <connection>
+ <sender>valSpinBox</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>valSlider</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>../widgets/posedit.h</includehint>
+</includehints>
+</UI>
diff --git a/muse2/muse/liste/editevent.cpp b/muse2/muse/liste/editevent.cpp
new file mode 100644
index 00000000..ef084440
--- /dev/null
+++ b/muse2/muse/liste/editevent.cpp
@@ -0,0 +1,853 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: editevent.cpp,v 1.12.2.6 2009/02/02 21:38:00 terminator356 Exp $
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <q3multilineedit.h>
+#include <qmessagebox.h>
+#include <qslider.h>
+#include <qradiobutton.h>
+#include <qspinbox.h>
+#include <q3listbox.h>
+#include <q3widgetstack.h>
+#include <q3popupmenu.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+#include <Q3VBoxLayout>
+#include <Q3BoxLayout>
+
+#include "song.h"
+#include "event.h"
+#include "midictrl.h"
+#include "editevent.h"
+#include "pitchedit.h"
+#include "intlabel.h"
+#include "globals.h"
+#include "posedit.h"
+#include "gconfig.h"
+#include "midiport.h"
+#include "midiedit/drummap.h"
+#include "instruments/minstrument.h"
+#include "midi.h"
+
+//---------------------------------------------------------
+// string2qhex
+//---------------------------------------------------------
+
+QString string2hex(const unsigned char* data, int len)
+ {
+ QString d;
+ QString s;
+ for (int i = 0; i < len; ++i) {
+ if ((i > 0) && ((i % 8)==0)) {
+ d += "\n";
+ }
+ else if (i)
+ d += " ";
+ d += s.sprintf("%02x", data[i]);
+ }
+ return d;
+ }
+
+//---------------------------------------------------------
+// hex2string
+//---------------------------------------------------------
+
+char* hex2string(QWidget* parent, const char* src, int& len)
+ {
+ char buffer[2048];
+ char* dst = buffer;
+
+ while (*src) {
+ while (*src == ' ' || *src == '\n')
+ ++src;
+ char* ep;
+ long val = strtol(src, &ep, 16);
+ if (ep == src) {
+ QMessageBox::information(parent,
+ QString("MusE"),
+ QWidget::tr("Cannot convert sysex string"));
+ return 0;
+ }
+ src = ep;
+ *dst++ = val;
+ if (dst - buffer >= 2048) {
+ QMessageBox::information(parent,
+ QString("MusE"),
+ QWidget::tr("Hex String too long (2048 bytes limit)"));
+ return 0;
+ }
+ }
+ len = dst - buffer;
+ char* b = new char[len+1];
+ memcpy(b, buffer, len);
+ b[len] = 0;
+ return b;
+ }
+
+//---------------------------------------------------------
+// getEvent
+//---------------------------------------------------------
+
+Event EditNoteDialog::getEvent(int tick, const Event& event, QWidget* parent)
+ {
+ EditNoteDialog* dlg = new EditNoteDialog(tick, event, parent);
+ Event nevent;
+ if (dlg->exec() == QDialog::Accepted) {
+ nevent = dlg->event();
+ }
+ delete dlg;
+ return nevent;
+ }
+
+Event EditSysexDialog::getEvent(int tick, const Event& event, QWidget* parent)
+ {
+ EditSysexDialog* dlg = new EditSysexDialog(tick, event, parent);
+ Event nevent;
+ if (dlg->exec() == QDialog::Accepted) {
+ nevent = dlg->event();
+ }
+ delete dlg;
+ return nevent;
+ }
+
+Event EditMetaDialog::getEvent(int tick, const Event& event, QWidget* parent)
+ {
+ EditEventDialog* dlg = new EditMetaDialog(tick, event, parent);
+ Event nevent;
+ if (dlg->exec() == QDialog::Accepted) {
+ nevent = dlg->event();
+ }
+ delete dlg;
+ return nevent;
+ }
+
+Event EditCAfterDialog::getEvent(int tick, const Event& event, QWidget* parent)
+ {
+ EditEventDialog* dlg = new EditCAfterDialog(tick, event, parent);
+ Event nevent;
+ if (dlg->exec() == QDialog::Accepted) {
+ nevent = dlg->event();
+ }
+ delete dlg;
+ return nevent;
+ }
+
+Event EditPAfterDialog::getEvent(int tick, const Event& event, QWidget* parent)
+ {
+ EditEventDialog* dlg = new EditPAfterDialog(tick, event, parent);
+ Event nevent;
+ if (dlg->exec() == QDialog::Accepted) {
+ nevent = dlg->event();
+ }
+ delete dlg;
+ return nevent;
+ }
+
+//---------------------------------------------------------
+// EditEventDialog
+//---------------------------------------------------------
+
+EditEventDialog::EditEventDialog(QWidget* parent, const char* name)
+ : QDialog(parent, name, true)
+ {
+ Q3VBoxLayout* xlayout = new Q3VBoxLayout(this);
+ layout1 = new Q3GridLayout(this); // ddskrjo this
+ xlayout->addLayout(layout1);
+
+ //---------------------------------------------------
+ // Ok, Cancel
+ //---------------------------------------------------
+
+ Q3BoxLayout* w5 = new Q3HBoxLayout(this); // ddskrjo this
+ xlayout->addLayout(w5);
+ QPushButton* okB = new QPushButton(tr("Ok"), this);
+ okB->setDefault(true);
+ QPushButton* cancelB = new QPushButton(tr("Cancel"), this);
+ okB->setFixedWidth(80);
+ cancelB->setFixedWidth(80);
+ w5->addWidget(okB);
+ w5->addSpacing(12);
+ w5->addWidget(cancelB);
+ w5->addStretch(1);
+ connect(cancelB, SIGNAL(clicked()), SLOT(reject()));
+ connect(okB, SIGNAL(clicked()), SLOT(accept()));
+ }
+
+//---------------------------------------------------------
+// EditNoteDialog
+//---------------------------------------------------------
+
+EditNoteDialog::EditNoteDialog(int tick, const Event& event,
+ QWidget* parent, const char* name)
+ : EditNoteDialogBase(parent, name)
+ {
+ if (!event.empty()) {
+ epos->setValue(tick);
+ il1->setValue(event.lenTick());
+ pl->setValue(event.pitch());
+ il2->setValue(event.velo());
+ il3->setValue(event.veloOff());
+ }
+ else {
+ epos->setValue(tick);
+ il1->setValue(96);
+ pl->setValue(64);
+ il2->setValue(100);
+ il3->setValue(0);
+ }
+ }
+
+//---------------------------------------------------------
+// EditNoteDialog::event
+//---------------------------------------------------------
+
+Event EditNoteDialog::event()
+ {
+ Event event(Note);
+ event.setTick(epos->pos().tick());
+ event.setA(pl->value());
+ event.setB(il2->value());
+ event.setC(il3->value());
+ event.setLenTick(il1->value());
+ return event;
+ }
+
+//---------------------------------------------------------
+// EditSysExDialog
+//---------------------------------------------------------
+
+EditSysexDialog::EditSysexDialog(int tick, const Event& event,
+ QWidget* parent, const char* name)
+ : EditSysexDialogBase(parent, name)
+ {
+ sysex = 0;
+ if (!event.empty()) {
+ epos->setValue(tick);
+ edit->setText(string2hex(event.data(), event.dataLen()));
+ }
+ else {
+ epos->setValue(tick);
+ }
+ }
+
+//---------------------------------------------------------
+// ~EditSysexDialog
+//---------------------------------------------------------
+
+EditSysexDialog::~EditSysexDialog()
+ {
+ if (sysex)
+ delete sysex;
+ }
+
+//---------------------------------------------------------
+// EditSysExDialog::event
+//---------------------------------------------------------
+
+Event EditSysexDialog::event()
+ {
+ Event event(Sysex);
+ event.setTick(epos->pos().tick());
+ event.setData(sysex, len);
+ return event;
+ }
+
+//---------------------------------------------------------
+// accept
+//---------------------------------------------------------
+
+void EditSysexDialog::accept()
+ {
+ QString qsrc = edit->text();
+ const char* src = qsrc.latin1();
+
+ sysex = (unsigned char*)hex2string(this, src, len);
+ if (sysex)
+ QDialog::accept();
+ }
+
+//---------------------------------------------------------
+// EditMetaDialog
+//---------------------------------------------------------
+
+EditMetaDialog::EditMetaDialog(int tick, const Event& ev,
+ QWidget* parent, const char* name)
+ : EditEventDialog(parent, name)
+ {
+ meta = 0;
+ setCaption(tr("MusE: Enter Meta Event"));
+
+ QLabel* l1 = new QLabel(tr("Time Position"), this);
+ epos = new PosEdit(this);
+
+ QLabel* l2 = new QLabel(tr("Meta Type"), this);
+ il2 = new IntLabel(-1, 0, 127, this, -1);
+ il2->setFixedWidth(100);
+ il2->setFrame(true);
+ il2->setDark();
+ typeLabel = new QLabel(this);
+ typeLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
+ Q3HBoxLayout* typeLayout = new Q3HBoxLayout(this);
+ typeLayout->addWidget(il2);
+ typeLayout->addWidget(typeLabel);
+ typeLayout->addStretch();
+
+ hexButton = new QRadioButton(tr("Enter Hex"), this, "hextoggle");
+ hexButton->setChecked(true);
+ connect(hexButton, SIGNAL(toggled(bool)), SLOT(toggled(bool)));
+
+ edit = new Q3MultiLineEdit(this);
+ edit->setFont(config.fonts[5]);
+
+ if (!ev.empty()) {
+ epos->setValue(tick);
+ il2->setValue(ev.dataA());
+ toggled(true);
+ edit->setText(string2hex(ev.data(), ev.dataLen()));
+ }
+ else {
+ epos->setValue(tick);
+ il2->setValue(0);
+ }
+
+ typeChanged(il2->value());
+ connect(il2, SIGNAL(valueChanged(int)), SLOT(typeChanged(int)));
+
+ layout1->addWidget(l1, 0, 0);
+ layout1->addWidget(epos, 0, 1, Qt::AlignLeft);
+ layout1->addWidget(l2, 1, 0);
+
+ //layout1->addWidget(il2, 1, 1, AlignLeft);
+ layout1->addLayout(typeLayout, 1, 1);
+
+ layout1->addMultiCellWidget(hexButton, 2, 2, 0, 1);
+ layout1->addMultiCellWidget(edit, 3, 3, 0, 1);
+ }
+
+//---------------------------------------------------------
+// typeChanged
+//---------------------------------------------------------
+
+void EditMetaDialog::typeChanged(int val)
+{
+ typeLabel->setText(midiMetaName(val));
+}
+
+//---------------------------------------------------------
+// toggled
+//---------------------------------------------------------
+
+void EditMetaDialog::toggled(bool flag)
+ {
+ QString qsrc = edit->text();
+ const char* src = qsrc.latin1();
+ edit->clear();
+
+ QString dst;
+ if (flag) { // convert to hex
+ dst = string2hex((unsigned char*)src, strlen(src));
+ }
+ else { // convert to string
+ int len;
+ dst = hex2string(this, src, len);
+ }
+ edit->setText(dst);
+ }
+
+//---------------------------------------------------------
+// ~EditMetaDialog
+//---------------------------------------------------------
+
+EditMetaDialog::~EditMetaDialog()
+ {
+ if (meta)
+ delete meta;
+ }
+
+//---------------------------------------------------------
+// EditMetaDialog::event
+//---------------------------------------------------------
+
+Event EditMetaDialog::event()
+ {
+ Event event(Meta);
+ event.setTick(epos->pos().tick());
+ event.setA(il2->value());
+ event.setData(meta, len); // TODO ??
+ return event;
+ }
+
+//---------------------------------------------------------
+// accept
+//---------------------------------------------------------
+
+void EditMetaDialog::accept()
+ {
+ QString qsrc = edit->text();
+ const char* src = qsrc.latin1();
+ if (!hexButton->isChecked()) {
+ meta = (unsigned char*)strdup(src);
+ len = strlen(src);
+ QDialog::accept();
+ return;
+ }
+
+ meta = (unsigned char*)hex2string(this, src, len);
+ if (meta)
+ QDialog::accept();
+ }
+
+//---------------------------------------------------------
+// EditCAfterDialog
+//---------------------------------------------------------
+
+EditCAfterDialog::EditCAfterDialog(int tick, const Event& event,
+ QWidget* parent, const char* name)
+ : EditEventDialog(parent, name)
+ {
+ setCaption(tr("MusE: Enter Channel Aftertouch"));
+
+ QLabel* l1 = new QLabel(tr("Time Position"), this);
+ epos = new PosEdit(this);
+
+ QLabel* l2 = new QLabel(tr("Pressure"), this);
+ il2 = new IntLabel(-1, 0, 127, this, -1);
+ il2->setFrame(true);
+ il2->setDark();
+
+ QSlider* slider = new QSlider(0, 127, 1, 0, Qt::Horizontal, this);
+ connect(slider, SIGNAL(valueChanged(int)), il2, SLOT(setValue(int)));
+ connect(il2, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
+
+ if (!event.empty()) {
+ epos->setValue(tick);
+ il2->setValue(event.dataA());
+ slider->setValue(event.dataA());
+ }
+ else {
+ epos->setValue(tick);
+ il2->setValue(64);
+ slider->setValue(64);
+ }
+
+ layout1->addWidget(l1, 0, 0);
+ layout1->addWidget(epos, 0, 1, Qt::AlignLeft);
+ layout1->addWidget(l2, 1, 0);
+ layout1->addWidget(il2, 1, 1, Qt::AlignLeft);
+ layout1->addMultiCellWidget(slider, 2, 2, 0, 1);
+ }
+
+//---------------------------------------------------------
+// EditCAfterDialog::event
+//---------------------------------------------------------
+
+Event EditCAfterDialog::event()
+ {
+ Event event(CAfter);
+ event.setTick(epos->pos().tick());
+ event.setA(il2->value());
+ return event;
+ }
+
+//---------------------------------------------------------
+// EditPAfterDialog
+//---------------------------------------------------------
+
+EditPAfterDialog::EditPAfterDialog(int tick, const Event& event,
+ QWidget* parent, const char* name)
+ : EditEventDialog(parent, name)
+ {
+ setCaption(tr("MusE: Enter Poly Aftertouch"));
+
+ QLabel* l1 = new QLabel(tr("Time Position"), this);
+ epos = new PosEdit(this);
+
+ QLabel* l2 = new QLabel(tr("Pitch"), this);
+ pl = new PitchEdit(this);
+ QLabel* l3 = new QLabel(tr("Pressure"), this);
+ il2 = new IntLabel(-1, 0, 127, this, -1);
+ il2->setFrame(true);
+ il2->setDark();
+
+ QSlider* slider = new QSlider(0, 127, 1, 0, Qt::Horizontal, this);
+ connect(slider, SIGNAL(valueChanged(int)), il2, SLOT(setValue(int)));
+ connect(il2, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
+
+ if (!event.empty()) {
+ epos->setValue(tick);
+ pl->setValue(event.pitch());
+ il2->setValue(event.dataB());
+ slider->setValue(event.dataB());
+ }
+ else {
+ epos->setValue(tick);
+ pl->setValue(64);
+ il2->setValue(64);
+ slider->setValue(64);
+ }
+
+ layout1->addWidget(l1, 0, 0);
+ layout1->addWidget(epos, 0, 1, Qt::AlignLeft);
+ layout1->addWidget(l2, 1, 0);
+ layout1->addWidget(pl, 1, 1, Qt::AlignLeft);
+ layout1->addWidget(l3, 2, 0);
+ layout1->addWidget(il2, 2, 1, Qt::AlignLeft);
+ layout1->addMultiCellWidget(slider, 3, 3, 0, 1);
+ }
+
+//---------------------------------------------------------
+// EditPAfterDialog::event
+//---------------------------------------------------------
+
+Event EditPAfterDialog::event()
+ {
+ Event event(PAfter);
+ event.setTick(epos->pos().tick());
+ event.setA(pl->value());
+ event.setB(il2->value());
+ return event;
+ }
+//---------------------------------------------------------
+// getEvent
+//---------------------------------------------------------
+
+Event EditCtrlDialog::getEvent(int tick, const Event& event,
+ const MidiPart* part, QWidget* parent)
+ {
+ EditCtrlDialog* dlg = new EditCtrlDialog(tick, event, part, parent);
+ Event nevent;
+ if (dlg->exec() == QDialog::Accepted) {
+ nevent = dlg->event();
+ }
+ delete dlg;
+ return nevent;
+ }
+
+//---------------------------------------------------------
+// EditCtrlDialog::event
+//---------------------------------------------------------
+
+Event EditCtrlDialog::event()
+ {
+ Event event(Controller);
+ event.setTick(timePos->pos().tick());
+ event.setA(num);
+ if (num == CTRL_PROGRAM)
+ event.setB(val);
+ else
+ event.setB(valSlider->value() + midiPorts[part->track()->outPort()].midiController(num)->bias());
+ return event;
+ }
+
+//---------------------------------------------------------
+// EditCtrlDialog
+// PosEdit* timePos;
+// QSlider* valSlider;
+// QSpinBox* valSpinBox;
+// QLabel* controllerName;
+// QListBox* ctrlList;
+// QPushButton* buttonNewController;
+//---------------------------------------------------------
+
+EditCtrlDialog::EditCtrlDialog(int tick, const Event& event,
+ const MidiPart* p, QWidget* parent, const char* name)
+ : EditCtrlBase(parent, name), part(p)
+ {
+ val = 0;
+ num = 0;
+ if (!event.empty()) {
+ num = event.dataA();
+ val = event.dataB();
+ }
+
+ pop = new Q3PopupMenu(this);
+ pop->setCheckable(false);
+
+ MidiTrack* track = part->track();
+ int portn = track->outPort();
+ MidiPort* port = &midiPorts[portn];
+ bool isDrum = track->type() == Track::DRUM;
+ MidiCtrlValListList* cll = port->controller();
+
+ ctrlList->clear();
+ ctrlList->setSelectionMode(Q3ListBox::Single);
+
+ //
+ // populate list of available controller
+ //
+
+ std::list<QString> sList;
+ typedef std::list<QString>::iterator isList;
+
+ for (iMidiCtrlValList i = cll->begin(); i != cll->end(); ++i) {
+ MidiCtrlValList* cl = i->second;
+ int num = cl->num();
+
+ // dont show drum specific controller if not a drum track
+ if ((num & 0xff) == 0xff) {
+ if (!isDrum)
+ continue;
+ }
+ MidiController* c = port->midiController(num);
+ isList i = sList.begin();
+ for (; i != sList.end(); ++i) {
+ if (*i == c->name())
+ break;
+ }
+ if (i == sList.end())
+ sList.push_back(c->name());
+ }
+ MidiController* mc = port->midiController(num);
+ int idx = 0;
+ int selectionIndex = 0;
+ for (isList i = sList.begin(); i != sList.end(); ++i, ++idx) {
+ ctrlList->insertItem(*i);
+ if (mc->name() == *i)
+ selectionIndex = idx;
+ }
+ ctrlList->setSelected(selectionIndex, true);
+
+ valSlider->setRange(mc->minVal(), mc->maxVal());
+ valSpinBox->setRange(mc->minVal(), mc->maxVal());
+
+ controllerName->setText(mc->name());
+
+ if(!event.empty())
+ {
+ if(num == CTRL_PROGRAM)
+ {
+ widgetStack->raiseWidget(1);
+ updatePatch();
+ }
+ else
+ {
+ widgetStack->raiseWidget(0);
+ valSlider->setValue(val - mc->bias());
+ }
+ }
+ else
+ ctrlListClicked(ctrlList->selectedItem());
+ connect(ctrlList, SIGNAL(clicked(Q3ListBoxItem*)), SLOT(ctrlListClicked(Q3ListBoxItem*)));
+ connect(buttonNewController, SIGNAL(clicked()), SLOT(newController()));
+ connect(hbank, SIGNAL(valueChanged(int)), SLOT(programChanged()));
+ connect(lbank, SIGNAL(valueChanged(int)), SLOT(programChanged()));
+ connect(program, SIGNAL(valueChanged(int)), SLOT(programChanged()));
+ connect(patchName, SIGNAL(released()), SLOT(instrPopup()));
+ timePos->setValue(tick);
+
+ }
+//---------------------------------------------------------
+// newController
+//---------------------------------------------------------
+
+void EditCtrlDialog::newController()
+ {
+ Q3PopupMenu* pop = new Q3PopupMenu(this);
+ pop->setCheckable(this);
+ //
+ // populate popup with all controllers available for
+ // current instrument
+ //
+ MidiTrack* track = part->track();
+ int portn = track->outPort();
+ MidiPort* port = &midiPorts[portn];
+ MidiInstrument* instr = port->instrument();
+ MidiControllerList* mcl = instr->controller();
+
+ MidiCtrlValListList* cll = port->controller();
+ int channel = track->outChannel();
+ for (iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci)
+ {
+ if(cll->find(channel, ci->second->num()) == cll->end())
+ pop->insertItem(ci->second->name());
+ }
+ int rv = pop->exec(buttonNewController->mapToGlobal(QPoint(0,0)));
+ if (rv != -1) {
+ QString s = pop->text(rv);
+ for (iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) {
+ MidiController* mc = ci->second;
+ if (mc->name() == s) {
+ if(cll->find(channel, mc->num()) == cll->end())
+ {
+ MidiCtrlValList* vl = new MidiCtrlValList(mc->num());
+ cll->add(channel, vl);
+ //song->update(SC_MIDI_CONTROLLER_ADD);
+ }
+ for (int idx = 0; ;++idx) {
+ QString str = ctrlList->text(idx);
+ if (s == str)
+ {
+ ctrlList->setSelected(idx, true);
+ ctrlListClicked(ctrlList->item(idx));
+ break;
+ }
+ if (str.isNull()) {
+ ctrlList->insertItem(s);
+ ctrlList->setSelected(idx, true);
+ ctrlListClicked(ctrlList->item(idx));
+ break;
+ }
+ }
+
+ break;
+ }
+ }
+ }
+ delete pop;
+ }
+//---------------------------------------------------------
+// ctrlListClicked
+//---------------------------------------------------------
+
+void EditCtrlDialog::ctrlListClicked(Q3ListBoxItem* item)
+ {
+ if (item == 0)
+ return;
+ QString s(item->text());
+
+ MidiTrack* track = part->track();
+ int portn = track->outPort();
+ MidiPort* port = &midiPorts[portn];
+ MidiCtrlValListList* cll = port->controller();
+
+ iMidiCtrlValList i;
+ for (i = cll->begin(); i != cll->end(); ++i) {
+ MidiCtrlValList* cl = i->second;
+ num = cl->num();
+ MidiController* c = port->midiController(num);
+ if (s == c->name()) {
+ if (num == CTRL_PROGRAM) {
+ widgetStack->raiseWidget(1);
+
+ val = c->initVal();
+ if(val == CTRL_VAL_UNKNOWN)
+ val = 0;
+ updatePatch();
+ }
+ else {
+ widgetStack->raiseWidget(0);
+ valSlider->setRange(c->minVal(), c->maxVal());
+ valSpinBox->setRange(c->minVal(), c->maxVal());
+ controllerName->setText(s);
+ val = c->initVal();
+
+ if(val == CTRL_VAL_UNKNOWN || val == 0)
+ {
+ switch(num)
+ {
+ case CTRL_PANPOT:
+ val = 64 - c->bias();
+ break;
+ case CTRL_VOLUME:
+ val = 100;
+ break;
+ default:
+ val = 0;
+ break;
+ }
+ }
+ valSlider->setValue(val);
+ }
+ break;
+ }
+ }
+ if (i == cll->end())
+ printf("controller %s not found!\n", s.latin1());
+ }
+
+//---------------------------------------------------------
+// updatePatch
+//---------------------------------------------------------
+
+void EditCtrlDialog::updatePatch()
+ {
+ MidiTrack* track = part->track();
+ int port = track->outPort();
+ int channel = track->outChannel();
+ MidiInstrument* instr = midiPorts[port].instrument();
+ const char* name = instr->getPatchName(channel, val, song->mtype(), track->type() == Track::DRUM);
+ patchName->setText(QString(name));
+
+ int hb = ((val >> 16) & 0xff) + 1;
+ if (hb == 0x100)
+ hb = 0;
+ int lb = ((val >> 8) & 0xff) + 1;
+ if (lb == 0x100)
+ lb = 0;
+ int pr = (val & 0xff) + 1;
+ if (pr == 0x100)
+ pr = 0;
+
+ hbank->blockSignals(true);
+ lbank->blockSignals(true);
+ program->blockSignals(true);
+
+ hbank->setValue(hb);
+ lbank->setValue(lb);
+ program->setValue(pr);
+
+ hbank->blockSignals(false);
+ lbank->blockSignals(false);
+ program->blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// instrPopup
+//---------------------------------------------------------
+
+void EditCtrlDialog::instrPopup()
+ {
+ MidiTrack* track = part->track();
+ int channel = track->outChannel();
+ int port = track->outPort();
+ MidiInstrument* instr = midiPorts[port].instrument();
+ instr->populatePatchPopup(pop, channel, song->mtype(), track->type() == Track::DRUM);
+
+ if(pop->count() == 0)
+ return;
+ int rv = pop->exec(patchName->mapToGlobal(QPoint(10,5)));
+ if (rv != -1) {
+ val = rv;
+ updatePatch();
+ }
+ }
+
+//---------------------------------------------------------
+// programChanged
+//---------------------------------------------------------
+
+void EditCtrlDialog::programChanged()
+ {
+// MidiTrack* track = part->track();
+// int channel = track->outChannel();
+// int port = track->outPort();
+ int hb = hbank->value();
+ int lb = lbank->value();
+ int prog = program->value();
+
+ if (hb > 0 && hb < 129)
+ hb -= 1;
+ else
+ hb = 0xff;
+ if (lb > 0 && lb < 129)
+ lb -= 1;
+ else
+ lb = 0xff;
+ if (prog > 0 && prog < 129)
+ prog -= 1;
+ else
+ prog = 0xff;
+
+ val = (hb << 16) + (lb << 8) + prog;
+ updatePatch();
+ }
+
diff --git a/muse2/muse/liste/editevent.h b/muse2/muse/liste/editevent.h
new file mode 100644
index 00000000..769ba256
--- /dev/null
+++ b/muse2/muse/liste/editevent.h
@@ -0,0 +1,196 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: editevent.h,v 1.6.2.1 2008/05/21 00:28:53 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __EDIT_EVENT_H__
+#define __EDIT_EVENT_H__
+
+#include <qdialog.h>
+//Added by qt3to4:
+#include <Q3PopupMenu>
+#include <Q3GridLayout>
+#include <QLabel>
+
+#include "editnotedialogbase.h"
+#include "editsysexdialogbase.h"
+#include "editctrlbase.h"
+#include "event.h"
+
+class PosEdit;
+class IntLabel;
+class PitchEdit;
+class Q3GridLayout;
+class Q3MultiLineEdit;
+class QRadioButton;
+class PosEdit;
+class MidiPart;
+class Q3ListBoxItem;
+class Q3PopupMenu;
+//---------------------------------------------------------
+// EditEventDialog
+//---------------------------------------------------------
+
+class EditEventDialog : public QDialog {
+ Q_OBJECT
+
+ protected:
+ Q3GridLayout* layout1;
+
+ public:
+ EditEventDialog(QWidget* parent=0, const char* name=0);
+ virtual Event event() = 0;
+ };
+
+//---------------------------------------------------------
+// EditNoteDialog
+//---------------------------------------------------------
+
+class EditNoteDialog : public EditNoteDialogBase {
+ Q_OBJECT
+
+ public:
+ EditNoteDialog(int tick, const Event&,
+ QWidget* parent=0, const char* name=0);
+ static Event getEvent(int tick, const Event&,
+ QWidget* parent = 0);
+ virtual Event event();
+ };
+
+//---------------------------------------------------------
+// EditSysExDialog
+//---------------------------------------------------------
+
+class EditSysexDialog : public EditSysexDialogBase {
+ Q_OBJECT
+
+ unsigned char* sysex;
+ int len;
+
+ protected:
+ Q3GridLayout* layout;
+
+ private slots:
+ virtual void accept();
+
+ public:
+ EditSysexDialog(int tick, const Event&,
+ QWidget* parent=0, const char* name=0);
+ ~EditSysexDialog();
+ static Event getEvent(int tick, const Event&,
+ QWidget* parent = 0);
+ virtual Event event();
+ };
+
+//---------------------------------------------------------
+// EditCtrlDialog
+//---------------------------------------------------------
+
+class EditCtrlDialog : public EditCtrlBase {
+ Q_OBJECT
+
+ int num; // controller number
+ int val; // controller value (for prog. changes)
+
+ const MidiPart* part;
+ Q3PopupMenu* pop;
+
+ void updatePatch();
+
+ private slots:
+ void ctrlListClicked(Q3ListBoxItem*);
+ void newController();
+ void programChanged();
+ void instrPopup();
+
+ protected:
+ Q3GridLayout* layout;
+
+
+ public:
+ EditCtrlDialog(int tick, const Event&,
+ const MidiPart*, QWidget* parent=0, const char* name=0);
+ static Event getEvent(int tick, const Event&, const MidiPart*,
+ QWidget* parent = 0);
+ virtual Event event();
+ };
+
+//---------------------------------------------------------
+// EditMetaDialog
+//---------------------------------------------------------
+
+class EditMetaDialog : public EditEventDialog {
+ Q_OBJECT
+
+ unsigned char* meta;
+ int len;
+ PosEdit* epos;
+ Q3MultiLineEdit* edit;
+ IntLabel* il2;
+ QRadioButton* hexButton;
+ QLabel* typeLabel;
+
+ protected:
+ Q3GridLayout* layout;
+
+ private slots:
+ virtual void accept();
+ void toggled(bool);
+ void typeChanged(int);
+
+ public:
+ EditMetaDialog(int tick, const Event&,
+ QWidget* parent=0, const char* name=0);
+ ~EditMetaDialog();
+ static Event getEvent(int tick, const Event&,
+ QWidget* parent = 0);
+ virtual Event event();
+ };
+
+//---------------------------------------------------------
+// EditCAfterDialog
+//---------------------------------------------------------
+
+class EditCAfterDialog : public EditEventDialog {
+ Q_OBJECT
+
+ PosEdit* epos;
+ IntLabel* il2;
+
+ protected:
+ Q3GridLayout* layout;
+
+ public:
+ EditCAfterDialog(int tick, const Event&,
+ QWidget* parent=0, const char* name=0);
+ static Event getEvent(int tick, const Event&,
+ QWidget* parent = 0);
+ virtual Event event();
+ };
+
+//---------------------------------------------------------
+// EditPAfterDialog
+//---------------------------------------------------------
+
+class EditPAfterDialog : public EditEventDialog {
+ Q_OBJECT
+
+ PosEdit* epos;
+ PitchEdit* pl;
+ IntLabel* il2;
+
+ protected:
+ Q3GridLayout* layout;
+
+ public:
+ EditPAfterDialog(int tick, const Event&,
+ QWidget* parent=0, const char* name=0);
+ static Event getEvent(int tick, const Event&,
+ QWidget* parent = 0);
+ virtual Event event();
+ };
+
+#endif
+
diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp
new file mode 100644
index 00000000..4cdb7892
--- /dev/null
+++ b/muse2/muse/liste/listedit.cpp
@@ -0,0 +1,909 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: listedit.cpp,v 1.11.2.11 2009/05/24 21:43:44 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <q3toolbar.h>
+#include <qtooltip.h>
+#include <qtoolbutton.h>
+#include <qlayout.h>
+#include <q3hbox.h>
+#include <qscrollbar.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <q3buttongroup.h>
+#include <q3listbox.h>
+#include <q3listview.h>
+#include <q3header.h>
+#include <q3popupmenu.h>
+#include <qmenubar.h>
+#include <qaction.h>
+#include <q3accel.h>
+#include <Qt3Support>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include <Q3ActionGroup>
+#include <QCloseEvent>
+
+#include "listedit.h"
+#include "mtscale.h"
+#include "globals.h"
+#include "icons.h"
+#include "editevent.h"
+#include "xml.h"
+#include "pitchedit.h"
+#include "song.h"
+#include "audio.h"
+#include "shortcuts.h"
+#include "midi.h"
+#include "event.h"
+#include "midiport.h"
+#include "midictrl.h"
+
+//---------------------------------------------------------
+// EventListItem
+//---------------------------------------------------------
+
+class EventListItem : public Q3ListViewItem {
+ public:
+ Event event;
+ MidiPart* part;
+
+ EventListItem(Q3ListView* parent, Event ev, MidiPart* p)
+ : Q3ListViewItem(parent) {
+ event = ev;
+ part = p;
+ }
+ virtual QString text(int col) const;
+ virtual int compare(Q3ListViewItem* i, int col, bool ascend) const
+ {
+ EventListItem* eli = (EventListItem*)i;
+ switch(col)
+ {
+ case 0:
+ return event.tick() - eli->event.tick();
+ break;
+ case 1:
+ return part->tick() + event.tick() - (eli->part->tick() + eli->event.tick());
+ break;
+ case 2:
+ return key(col, ascend).localeAwareCompare(i->key(col, ascend));
+ break;
+ case 3:
+ return part->track()->outChannel() - eli->part->track()->outChannel();
+ break;
+ case 4:
+ return event.dataA() - eli->event.dataA();
+ break;
+ case 5:
+ return event.dataB() - eli->event.dataB();
+ break;
+ case 6:
+ return event.dataC() - eli->event.dataC();
+ break;
+ case 7:
+ return event.lenTick() - eli->event.lenTick();
+ break;
+ case 8:
+ return key(col, ascend).localeAwareCompare(i->key(col, ascend));
+ break;
+ default:
+ return 0;
+ }
+ }
+ };
+/*---------------------------------------------------------
+ * midi_meta_name
+ *---------------------------------------------------------*/
+
+static QString midiMetaComment(const Event& ev)
+ {
+ int meta = ev.dataA();
+ QString s = midiMetaName(meta);
+
+ switch (meta) {
+ case 0:
+ case 0x2f:
+ case 0x51:
+ case 0x54:
+ case 0x58:
+ case 0x59:
+ case 0x74:
+ case 0x7f: return s;
+
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ case 0x0a:
+ case 0x0b:
+ case 0x0c:
+ case 0x0d:
+ case 0x0e:
+ case 0x0f:
+ {
+ s += QString(": ");
+ const char* txt = (char*)(ev.data());
+ int len = ev.dataLen();
+ char buffer[len+1];
+ memcpy(buffer, txt, len);
+ buffer[len] = 0;
+
+ for (int i = 0; i < len; ++i) {
+ if (buffer[i] == '\n' || buffer[i] == '\r')
+ buffer[i] = ' ';
+ }
+ return s + QString(buffer);
+ }
+
+ case 0x20:
+ case 0x21:
+ default:
+ {
+ s += QString(": ");
+ int i;
+ int len = ev.lenTick();
+ int n = len > 10 ? 10 : len;
+ for (i = 0; i < n; ++i) {
+ if (i >= ev.dataLen())
+ break;
+ s += QString(" 0x");
+ QString k;
+ k.setNum(ev.data()[i] & 0xff, 16);
+ s += k;
+ }
+ if (i == 10)
+ s += QString("...");
+ return s;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void ListEdit::closeEvent(QCloseEvent* e)
+ {
+ emit deleted((unsigned long)this);
+ e->accept();
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void ListEdit::songChanged(int type)
+ {
+ if (type == 0)
+ return;
+ if (type & (SC_PART_REMOVED | SC_PART_MODIFIED
+ | SC_PART_INSERTED | SC_EVENT_REMOVED | SC_EVENT_MODIFIED
+ | SC_EVENT_INSERTED | SC_SELECTION)) {
+ if (type & (SC_PART_REMOVED | SC_PART_INSERTED))
+ genPartlist();
+ // close window if editor has no parts anymore
+ if (parts()->empty()) {
+ close(false);
+ return;
+ }
+ if (type == SC_SELECTION) {
+ bool update = false;
+ Q3ListViewItem* ci = 0;
+ for (Q3ListViewItem* i = liste->firstChild(); i; i = i->nextSibling()) {
+ if (i->isSelected() ^ ((EventListItem*)i)->event.selected()) {
+ i->setSelected(((EventListItem*)i)->event.selected());
+ if (i->isSelected())
+ ci = i;
+ update = true;
+ }
+ }
+ if (update) {
+ if (ci)
+ liste->setCurrentItem(ci);
+ liste->triggerUpdate();
+ }
+ }
+ else {
+ curPart = 0;
+ curTrack = 0;
+ liste->clear();
+ for (iPart p = parts()->begin(); p != parts()->end(); ++p) {
+ MidiPart* part = (MidiPart*) (p->second);
+ if (part->sn() == curPartId)
+ curPart = part;
+ EventList* el = part->events();
+ for (iEvent i = el->begin(); i != el->end(); ++i) {
+ EventListItem* item = new EventListItem(liste, i->second, part);
+ item->setSelected(i->second.selected());
+ if (item->event.tick() == (unsigned) selectedTick) { //prevent compiler warning: comparison of signed/unsigned)
+ liste->setCurrentItem(item);
+ item->setSelected(true);
+ liste->ensureItemVisible(item);
+ }
+ }
+ }
+ }
+
+ // p3.3.34
+ //if (curPart == 0)
+ // curPart = (MidiPart*)(parts()->begin()->second);
+ //curTrack = curPart->track();
+ if(!curPart)
+ {
+ if(!parts()->empty())
+ {
+ curPart = (MidiPart*)(parts()->begin()->second);
+ if(curPart)
+ curTrack = curPart->track();
+ else
+ curPart = 0;
+ }
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// text
+//---------------------------------------------------------
+
+QString EventListItem::text(int col) const
+ {
+ QString s;
+ QString commentLabel;
+ switch(col) {
+ case 0:
+ s.setNum(event.tick());
+ break;
+ case 1:
+ {
+ int t = event.tick() + part->tick();
+ int bar, beat;
+ unsigned tick;
+ sigmap.tickValues(t, &bar, &beat, &tick);
+ s.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick);
+ }
+ break;
+ case 2:
+ switch(event.type()) {
+ case Note:
+ s = QString("Note");
+ break;
+ case Controller:
+ {
+ const char* cs;
+ switch (midiControllerType(event.dataA())) {
+ case MidiController::Controller7: cs = "Ctrl7"; break;
+ case MidiController::Controller14: cs = "Ctrl14"; break;
+ case MidiController::RPN: cs = "RPN"; break;
+ case MidiController::NRPN: cs = "NRPN"; break;
+ case MidiController::Pitch: cs = "Pitch"; break;
+ case MidiController::Program: cs = "Program"; break;
+ case MidiController::RPN14: cs = "RPN14"; break;
+ case MidiController::NRPN14: cs = "NRPN14"; break;
+ default: cs = "Ctrl?"; break;
+ }
+ s = QString(cs);
+ }
+ break;
+ case Sysex:
+ {
+ commentLabel = QString("len ");
+ QString k;
+ k.setNum(event.dataLen());
+ commentLabel += k;
+ commentLabel += QString(" ");
+
+ commentLabel += nameSysex(event.dataLen(), event.data());
+ int i;
+ for (i = 0; i < 10; ++i) {
+ if (i >= event.dataLen())
+ break;
+ commentLabel += QString(" 0x");
+ QString k;
+ k.setNum(event.data()[i] & 0xff, 16);
+ commentLabel += k;
+ }
+ if (i == 10)
+ commentLabel += QString("...");
+ }
+ s = QString("SysEx");
+ break;
+ case PAfter:
+ s = QString("PoAT");
+ break;
+ case CAfter:
+ s = QString("ChAT");
+ break;
+ case Meta:
+ commentLabel = midiMetaComment(event);
+ s = QString("Meta");
+ break;
+ case Wave:
+ break;
+ default:
+ printf("unknown event type %d\n", event.type());
+ }
+ break;
+ case 3:
+ s.setNum(part->track()->outChannel() + 1);
+ break;
+ case 4:
+ if (event.isNote() || event.type() == PAfter)
+ s = pitch2string(event.dataA());
+ else if (event.type() == Controller)
+ s.setNum(event.dataA() & 0xffff); // mask off type bits
+ else
+ s.setNum(event.dataA());
+ break;
+ case 5:
+ if(event.type() == Controller &&
+ midiControllerType(event.dataA()) == MidiController::Program)
+ {
+ int val = event.dataB();
+ int hb = ((val >> 16) & 0xff) + 1;
+ if (hb == 0x100)
+ hb = 0;
+ int lb = ((val >> 8) & 0xff) + 1;
+ if (lb == 0x100)
+ lb = 0;
+ int pr = (val & 0xff) + 1;
+ if (pr == 0x100)
+ pr = 0;
+ s.sprintf("%d-%d-%d", hb, lb, pr);
+ }
+ else
+ s.setNum(event.dataB());
+ break;
+ case 6:
+ s.setNum(event.dataC());
+ break;
+ case 7:
+ s.setNum(event.lenTick());
+ break;
+ case 8:
+ switch(event.type()) {
+ case Controller:
+ {
+ MidiPort* mp = &midiPorts[part->track()->outPort()];
+ MidiController* mc = mp->midiController(event.dataA());
+ s = mc->name();
+ }
+ break;
+ case Sysex:
+ {
+ s = QString("len ");
+ QString k;
+ k.setNum(event.dataLen());
+ s += k;
+ s += QString(" ");
+
+ commentLabel += nameSysex(event.dataLen(), event.data());
+ int i;
+ for (i = 0; i < 10; ++i) {
+ if (i >= event.dataLen())
+ break;
+ s += QString(" 0x");
+ QString k;
+ k.setNum(event.data()[i] & 0xff, 16);
+ s += k;
+ }
+ if (i == 10)
+ s += QString("...");
+ }
+ break;
+ case Meta:
+ s = midiMetaComment(event);
+ break;
+ default:
+ break;
+ }
+ break;
+
+ }
+ return s;
+ }
+
+//---------------------------------------------------------
+// ListEdit
+//---------------------------------------------------------
+
+ListEdit::ListEdit(PartList* pl)
+ : MidiEditor(0, 0, pl)
+ {
+ insertItems = new Q3ActionGroup(this, "InsertItems", false);
+ insertNote = new Q3Action(tr("Insert Note"), QIcon(*note1Icon), tr("insert Note"),
+ 0, insertItems);
+ insertSysEx = new Q3Action(tr("Insert SysEx"), QIcon(*sysexIcon), tr("insert SysEx"),
+ 0, insertItems);
+ insertCtrl = new Q3Action(tr("Insert Ctrl"), QIcon(*ctrlIcon), tr("insert Ctrl"),
+ 0, insertItems);
+ insertMeta = new Q3Action(tr("Insert Meta"), QIcon(*metaIcon), tr("insert Meta"),
+ 0, insertItems);
+ insertCAfter = new Q3Action(tr("Insert Channel Aftertouch"), QIcon(*cafterIcon), tr("insert Channel Aftertouch"),
+ 0, insertItems);
+ insertPAfter = new Q3Action(tr("Insert Key Aftertouch"), QIcon(*pafterIcon), tr("insert Poly Aftertouch"),
+ 0, insertItems);
+
+ connect(insertNote, SIGNAL(activated()), SLOT(editInsertNote()));
+ connect(insertSysEx, SIGNAL(activated()), SLOT(editInsertSysEx()));
+ connect(insertCtrl, SIGNAL(activated()), SLOT(editInsertCtrl()));
+ connect(insertMeta, SIGNAL(activated()), SLOT(editInsertMeta()));
+ connect(insertCAfter, SIGNAL(activated()), SLOT(editInsertCAfter()));
+ connect(insertPAfter, SIGNAL(activated()), SLOT(editInsertPAfter()));
+
+ //---------Pulldown Menu----------------------------
+ menuEdit = new Q3PopupMenu(this);
+ menuBar()->insertItem(tr("&Edit"), menuEdit);
+ undoRedo->addTo(menuEdit);
+
+ Q3Accel* qa = new Q3Accel(this);
+ qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Z), song, SLOT(undo()));
+ qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Y), song, SLOT(redo()));
+
+ menuEdit->insertSeparator();
+#if 0
+ menuEdit->insertItem(tr("Cut"), EList::CMD_CUT);
+ menuEdit->setAccel(Qt::CTRL+Qt::Key_X, EList::CMD_CUT);
+ menuEdit->insertItem(tr("Copy"), EList::CMD_COPY);
+ menuEdit->setAccel(Qt::CTRL+Qt::Key_C, EList::CMD_COPY);
+ menuEdit->insertItem(tr("Paste"), EList::CMD_PASTE);
+ menuEdit->setAccel(Qt::CTRL+Qt::Key_V, EList::CMD_PASTE);
+ menuEdit->insertSeparator();
+#endif
+ menuEdit->insertItem(tr("Delete Events"), CMD_DELETE);
+ menuEdit->setAccel(Qt::Key_Delete, CMD_DELETE);
+ menuEdit->insertSeparator();
+
+ insertItems->addTo(menuEdit);
+
+ connect(menuEdit, SIGNAL(activated(int)), SLOT(cmd(int)));
+
+ //---------ToolBar----------------------------------
+ listTools = new Q3ToolBar(this, "list-tools");
+ listTools->setLabel(tr("List Tools"));
+ undoRedo->addTo(listTools);
+ Q3ToolBar* insertTools = new Q3ToolBar(this, "insert");
+ insertTools->setLabel(tr("Insert Tools"));
+ insertItems->addTo(insertTools);
+
+ //
+ //---------------------------------------------------
+ // liste
+ //---------------------------------------------------
+ //
+
+ liste = new Q3ListView(mainw);
+ QFontMetrics fm(liste->font());
+ int n = fm.width('9');
+ int b = 24;
+ int c = fm.width(QString("Val B"));
+ int sortIndW = n * 3;
+ liste->setAllColumnsShowFocus(true);
+ liste->setSorting(0);
+ liste->setSelectionMode(Q3ListView::Extended);
+ liste->setShowSortIndicator(true);
+ liste->addColumn(tr("Tick"), n * 6 + b);
+ liste->addColumn(tr("Bar"), fm.width(QString("9999.99.999")) + b);
+ liste->addColumn(tr("Type"), fm.width(QString("Program")) + b);
+ liste->addColumn(tr("Ch"), n * 2 + b + sortIndW);
+ liste->addColumn(tr("Val A"), c + b + sortIndW);
+ liste->addColumn(tr("Val B"), c + b + sortIndW);
+ liste->addColumn(tr("Val C"), c + b + sortIndW);
+ liste->addColumn(tr("Len"), n * 4 + b + sortIndW);
+ liste->addColumn(tr("Comment"), fm.width(QString("MainVolume")) + 70);
+ liste->setResizeMode(Q3ListView::LastColumn);
+ connect(liste, SIGNAL(selectionChanged()), SLOT(selectionChanged()));
+ connect(liste, SIGNAL(doubleClicked(Q3ListViewItem*)), SLOT(doubleClicked(Q3ListViewItem*)));
+ //---------------------------------------------------
+ // Rest
+ //---------------------------------------------------
+
+ mainGrid->setRowStretch(1, 100);
+ mainGrid->setColStretch(0, 100);
+ mainGrid->addMultiCellWidget(liste, 1, 2, 0, 0);
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ songChanged(-1);
+
+ // p3.3.34
+ // Was crashing because of -1 stored, because there was an invalid
+ // part pointer stored.
+ //curPart = (MidiPart*)(pl->begin()->second);
+ if(pl->empty())
+ {
+ curPart = 0;
+ curPartId = -1;
+ }
+ else
+ {
+ curPart = (MidiPart*)pl->begin()->second;
+ if(curPart)
+ curPartId = curPart->sn();
+ else
+ {
+ curPart = 0;
+ curPartId = -1;
+ }
+ }
+
+ initShortcuts();
+ }
+
+//---------------------------------------------------------
+// ~ListEdit
+//---------------------------------------------------------
+
+ListEdit::~ListEdit()
+ {
+ undoRedo->removeFrom(listTools);
+ }
+
+//---------------------------------------------------------
+// editInsertNote
+//---------------------------------------------------------
+
+void ListEdit::editInsertNote()
+ {
+ // p3.3.34
+ if(!curPart)
+ return;
+
+ Event event = EditNoteDialog::getEvent(curPart->tick(), Event(), this);
+ if (!event.empty()) {
+ //No events before beginning of part + take Part offset into consideration
+ unsigned tick = event.tick();
+ if (tick < curPart->tick())
+ tick = 0;
+ else
+ tick-= curPart->tick();
+ event.setTick(tick);
+ // Indicate do undo, and do not handle port controller values.
+ //audio->msgAddEvent(event, curPart);
+ audio->msgAddEvent(event, curPart, true, false, false);
+ }
+ }
+
+//---------------------------------------------------------
+// editInsertSysEx
+//---------------------------------------------------------
+
+void ListEdit::editInsertSysEx()
+ {
+ // p3.3.34
+ if(!curPart)
+ return;
+
+ Event event = EditSysexDialog::getEvent(curPart->tick(), Event(), this);
+ if (!event.empty()) {
+ //No events before beginning of part + take Part offset into consideration
+ unsigned tick = event.tick();
+ if (tick < curPart->tick())
+ tick = 0;
+ else
+ tick-= curPart->tick();
+ event.setTick(tick);
+ // Indicate do undo, and do not handle port controller values.
+ //audio->msgAddEvent(event, curPart);
+ audio->msgAddEvent(event, curPart, true, false, false);
+ }
+ }
+
+//---------------------------------------------------------
+// editInsertCtrl
+//---------------------------------------------------------
+
+void ListEdit::editInsertCtrl()
+ {
+ // p3.3.34
+ if(!curPart)
+ return;
+
+ Event event = EditCtrlDialog::getEvent(curPart->tick(), Event(), curPart, this);
+ if (!event.empty()) {
+ //No events before beginning of part + take Part offset into consideration
+ unsigned tick = event.tick();
+ if (tick < curPart->tick())
+ tick = 0;
+ else
+ tick-= curPart->tick();
+ event.setTick(tick);
+ // Indicate do undo, and do port controller values and clone parts.
+ //audio->msgAddEvent(event, curPart);
+ audio->msgAddEvent(event, curPart, true, true, true);
+ }
+ }
+
+//---------------------------------------------------------
+// editInsertMeta
+//---------------------------------------------------------
+
+void ListEdit::editInsertMeta()
+ {
+ // p3.3.34
+ if(!curPart)
+ return;
+
+ Event event = EditMetaDialog::getEvent(curPart->tick(), Event(), this);
+ if (!event.empty()) {
+ //No events before beginning of part + take Part offset into consideration
+ unsigned tick = event.tick();
+ if (tick < curPart->tick())
+ tick = 0;
+ else
+ tick-= curPart->tick();
+ event.setTick(tick);
+ // Indicate do undo, and do not handle port controller values.
+ //audio->msgAddEvent(event, curPart);
+ audio->msgAddEvent(event, curPart, true, false, false);
+ }
+ }
+
+//---------------------------------------------------------
+// editInsertCAfter
+//---------------------------------------------------------
+
+void ListEdit::editInsertCAfter()
+ {
+ // p3.3.34
+ if(!curPart)
+ return;
+
+ Event event = EditCAfterDialog::getEvent(curPart->tick(), Event(), this);
+ if (!event.empty()) {
+ //No events before beginning of part + take Part offset into consideration
+ unsigned tick = event.tick();
+ if (tick < curPart->tick())
+ tick = 0;
+ else
+ tick-= curPart->tick();
+ event.setTick(tick);
+ // Indicate do undo, and do not handle port controller values.
+ //audio->msgAddEvent(event, curPart);
+ audio->msgAddEvent(event, curPart, true, false, false);
+ }
+ }
+
+//---------------------------------------------------------
+// editInsertPAfter
+//---------------------------------------------------------
+
+void ListEdit::editInsertPAfter()
+ {
+ // p3.3.34
+ if(!curPart)
+ return;
+
+ Event ev;
+ Event event = EditPAfterDialog::getEvent(curPart->tick(), ev, this);
+ if (!event.empty()) {
+ //No events before beginning of part + take Part offset into consideration
+ unsigned tick = event.tick();
+ if (tick < curPart->tick())
+ tick = 0;
+ else
+ tick-= curPart->tick();
+ event.setTick(tick);
+ // Indicate do undo, and do not handle port controller values.
+ //audio->msgAddEvent(event, curPart);
+ audio->msgAddEvent(event, curPart, true, false, false);
+ }
+ }
+
+//---------------------------------------------------------
+// editEvent
+//---------------------------------------------------------
+
+void ListEdit::editEvent(Event& event, MidiPart* part)
+ {
+ int tick = event.tick() + part->tick();
+ Event nevent;
+ switch(event.type()) {
+ case Note:
+ nevent = EditNoteDialog::getEvent(tick, event, this);
+ break;
+ case Controller:
+ nevent = EditCtrlDialog::getEvent(tick, event, part, this);
+ break;
+ case Sysex:
+ nevent = EditSysexDialog::getEvent(tick, event, this);
+ break;
+ case PAfter:
+ nevent = EditPAfterDialog::getEvent(tick, event, this);
+ break;
+ case CAfter:
+ nevent = EditCAfterDialog::getEvent(tick, event, this);
+ break;
+ case Meta:
+ nevent = EditMetaDialog::getEvent(tick, event, this);
+ break;
+ default:
+ return;
+ }
+ if (!nevent.empty()) {
+ // TODO: check for event != nevent
+ int tick = nevent.tick() - part->tick();
+ nevent.setTick(tick);
+ if (tick < 0)
+ printf("event not in part %d - %d - %d, not changed\n", part->tick(),
+ nevent.tick(), part->tick() + part->lenTick());
+ else
+ {
+ if(event.type() == Controller)
+ // Indicate do undo, and do port controller values and clone parts.
+ //audio->msgChangeEvent(event, nevent, part);
+ audio->msgChangeEvent(event, nevent, part, true, true, true);
+ else
+ // Indicate do undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, nevent, part);
+ audio->msgChangeEvent(event, nevent, part, true, false, false);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void ListEdit::readStatus(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ switch (token) {
+ case Xml::TagStart:
+ if (tag == "midieditor")
+ MidiEditor::readStatus(xml);
+ else
+ xml.unknown("ListEdit");
+ break;
+ case Xml::TagEnd:
+ if (tag == "listeditor")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void ListEdit::writeStatus(int level, Xml& xml) const
+ {
+ writePartList(level, xml);
+ xml.tag(level++, "listeditor");
+ MidiEditor::writeStatus(level, xml);
+ xml.tag(level, "/listeditor");
+ }
+
+//---------------------------------------------------------
+// selectionChanged
+//---------------------------------------------------------
+
+void ListEdit::selectionChanged()
+ {
+ bool update = false;
+ for (Q3ListViewItem* i = liste->firstChild(); i; i = i->nextSibling()) {
+ if (i->isSelected() ^ ((EventListItem*)i)->event.selected()) {
+ ((EventListItem*)i)->event.setSelected(i->isSelected());
+ update = true;
+ }
+ }
+ if (update)
+ song->update(SC_SELECTION);
+ }
+
+//---------------------------------------------------------
+// doubleClicked
+//---------------------------------------------------------
+
+void ListEdit::doubleClicked(Q3ListViewItem* item)
+ {
+ EventListItem* ev = (EventListItem*) item;
+ editEvent(ev->event, ev->part);
+ }
+
+//---------------------------------------------------------
+// cmd
+//---------------------------------------------------------
+
+void ListEdit::cmd(int cmd)
+ {
+ switch(cmd) {
+ case CMD_DELETE:
+ bool found = false;
+ for (Q3ListViewItem* i = liste->firstChild(); i; i = i->nextSibling())
+ {
+ EventListItem *item = (EventListItem *) i;
+ if (i->isSelected() || item->event.selected())
+ {
+ found = true;
+ break;
+ }
+ }
+ if(!found)
+ break;
+ song->startUndo();
+
+ EventListItem *deletedEvent=NULL;
+ for (Q3ListViewItem* i = liste->firstChild(); i; i = i->nextSibling()) {
+ EventListItem *item = (EventListItem *) i;
+
+ if (i->isSelected() || item->event.selected()) {
+ deletedEvent=item;
+ // Indicate no undo, and do port controller values and clone parts.
+ //audio->msgDeleteEvent(item->event, item->part, false);
+ audio->msgDeleteEvent(item->event, item->part, false, true, true);
+ }
+ }
+
+ unsigned int nextTick=0;
+ // find biggest tick
+ for (Q3ListViewItem* i = liste->firstChild(); i; i = i->nextSibling()) {
+ EventListItem *item = (EventListItem *) i;
+ if (item->event.tick() > nextTick && item != deletedEvent)
+ nextTick=item->event.tick();
+ }
+ // check if there's a tick that is "just" bigger than the deleted
+ for (Q3ListViewItem* i = liste->firstChild(); i; i = i->nextSibling()) {
+ EventListItem *item = (EventListItem *) i;
+ if (item->event.tick() >= deletedEvent->event.tick() &&
+ item->event.tick() < nextTick &&
+ item != deletedEvent ) {
+ nextTick=item->event.tick();
+ }
+ }
+ selectedTick=nextTick;
+ song->endUndo(SC_EVENT_MODIFIED);
+ //printf("selected tick = %d\n", selectedTick);
+ //emit selectionChanged();
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// configChanged
+//---------------------------------------------------------
+
+void ListEdit::configChanged()
+ {
+ initShortcuts();
+ }
+
+//---------------------------------------------------------
+// initShortcuts
+//---------------------------------------------------------
+
+void ListEdit::initShortcuts()
+ {
+ insertNote->setAccel(shortcuts[SHRT_LE_INS_NOTES].key);
+ insertSysEx->setAccel(shortcuts[SHRT_LE_INS_SYSEX].key);
+ insertCtrl->setAccel(shortcuts[SHRT_LE_INS_CTRL].key);
+ insertMeta->setAccel(shortcuts[SHRT_LE_INS_META].key);
+ insertCAfter->setAccel(shortcuts[SHRT_LE_INS_CHAN_AFTERTOUCH].key);
+ insertPAfter->setAccel(shortcuts[SHRT_LE_INS_POLY_AFTERTOUCH].key);
+ }
+
+//---------------------------------------------------------
+// viewKeyPressEvent
+//---------------------------------------------------------
+
+void ListEdit::keyPressEvent(QKeyEvent* event)
+ {
+int key = event->key();
+if (key == Qt::Key_Escape) {
+ close();
+ return;
+ }
+ }
diff --git a/muse2/muse/liste/listedit.h b/muse2/muse/liste/listedit.h
new file mode 100644
index 00000000..efa0a591
--- /dev/null
+++ b/muse2/muse/liste/listedit.h
@@ -0,0 +1,81 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: listedit.h,v 1.3.2.3 2006/09/19 22:03:33 spamatica Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __LIST_EDIT_H__
+#define __LIST_EDIT_H__
+
+#include "midieditor.h"
+#include "noteinfo.h"
+#include "cobject.h"
+//Added by qt3to4:
+#include <Q3PopupMenu>
+#include <QKeyEvent>
+#include <QCloseEvent>
+#include <Q3ActionGroup>
+#include <Qt3Support>
+
+class Event;
+class MidiTrack;
+class PartList;
+class MidiPart;
+class MidiPart;
+class Xml;
+class Q3ActionGroup;
+class QAction;
+class Q3ListView;
+class Q3ListViewItem;
+
+//---------------------------------------------------------
+// ListEdit
+//---------------------------------------------------------
+
+class ListEdit : public MidiEditor {
+ Q3ListView* liste;
+ Q3PopupMenu* menuEdit;
+ Q3ActionGroup* insertItems;
+ Q3ToolBar* listTools;
+ MidiTrack* curTrack;
+ MidiPart* curPart;
+ int selectedTick;
+ int curPartId;
+
+ enum { CMD_DELETE };
+
+ Q_OBJECT
+ virtual void closeEvent(QCloseEvent*);
+ virtual void keyPressEvent(QKeyEvent*);
+ void initShortcuts();
+ Q3Action *insertNote, *insertSysEx, *insertCtrl, *insertMeta, *insertCAfter, *insertPAfter;
+
+ private slots:
+ void editInsertNote();
+ void editInsertSysEx();
+ void editInsertCtrl();
+ void editInsertMeta();
+ void editInsertCAfter();
+ void editInsertPAfter();
+ void editEvent(Event&, MidiPart*);
+ void selectionChanged();
+ void doubleClicked(Q3ListViewItem*);
+ void cmd(int cmd);
+ void configChanged();
+
+ public slots:
+ void songChanged(int);
+
+ signals:
+ void deleted(unsigned long);
+
+ public:
+ ListEdit(PartList*);
+ ~ListEdit();
+ virtual void readStatus(Xml&);
+ virtual void writeStatus(int, Xml&) const;
+ };
+
+#endif
+
diff --git a/muse2/muse/make.inc b/muse2/muse/make.inc
new file mode 100644
index 00000000..a88e1f95
--- /dev/null
+++ b/muse2/muse/make.inc
@@ -0,0 +1,164 @@
+#=========================================================
+# MusE
+# Linux Music Editor
+# $Id: make.inc,v 1.1.1.1 2003/10/27 18:51:34 wschweer Exp $
+# (C) Copyright 1999-2001 Werner Schweer (ws@seh.de)
+#=========================================================
+
+#----------------------------------------------------
+# basic path
+#
+ifndef QTDIR_BIN
+QTDIR_BIN = /usr/qt3/bin
+endif
+
+ifndef QTDIR_LIB
+QTDIR_LIB = /usr/qt3/lib
+endif
+
+ifndef QTDIR_INC
+QTDIR_INC = /usr/qt3/include
+endif
+
+PREFIX = /usr/muse
+INSTDIR = $(PREFIX)/share
+INSTLIBDIR = $(PREFIX)/lib
+BINDIR = /usr/bin
+
+#-----------------------------------------------------
+# basic flags
+#
+# experimental KDE Flag
+# compiles with KDE Support:
+#
+# KMainWindow <--> QMainWindow
+# KToolbar <--> QToolBar
+#
+# Current Status: donīt use: (set to NO); there are some issues
+# If you want to debug this:
+# you also need Tommi Ilmonenīs "givertcap" because
+# you cannot run MusE suid root with KDE libs
+HAVE_KDE = no
+KDEDIR = /usr/kde2
+
+#
+# AUDIO, ALSA - always required
+# ALSACVS - use newest ALSA CVS (include /usr/include/alsa/asoundlib.h
+# instead of /usr/include/sys/asooundlib.h)
+AUDIO = yes
+ALSA = yes
+OSS = yes
+ALSACVS = yes
+
+# use Tommi Ilmonenīs "givertcap "to give RealTime capabilities to
+# MusE; with the use of this utility MusE did not need "suid root"
+# flags anymore
+# more info at http://www.tml.hut.fi/~tilmonen/givertcap/
+
+RTCAP = no
+
+#---------------------------------------------------------------
+
+CC = /usr/bin/g++
+QTLIB = qt-mt
+MOC = $(QTDIR_BIN)/moc
+UIC = $(QTDIR_BIN)/uic
+LUPDATE = $(QTDIR_BIN)/lupdate
+LRELEASE = $(QTDIR_BIN)/lrelease
+CPP = cpp
+
+#-----------------------------------------------------
+OLDVERSION = 0.5.1
+VERSION = 0.5.2
+
+INCLUDES = -I.
+#FLAGS = -Wall -W -Wshadow -D_GNU_SOURCE
+FLAGS = -Wall -W -D_GNU_SOURCE
+# FLAGS = -W -D_GNU_SOURCE
+ifeq ($(HAVE_KDE),yes)
+INCLUDES += -I$(KDEDIR)/include
+FLAGS += -DHAVE_KDE
+endif
+
+ifeq ($(ALSACVS),yes)
+FLAGS += -DALSACVS
+endif
+
+#-----------------------------------------------------
+# DEBUG = yes generates debuggable (non optimized) version
+#
+DEBUG = no
+
+ifeq ($(DEBUG),yes)
+FLAGS += -g # -DMEMORY_DEBUG
+else
+FLAGS += -O2 -g
+FLAGS += -DNDEBUG
+endif
+
+ifeq ($(AUDIO),yes)
+FLAGS += -DAUDIO
+endif
+
+ifeq ($(RTCAP),yes)
+FLAGS += -DRTCAP
+endif
+
+#-----------------------------------------------------
+# nothing to config below this line
+#
+ifdef TOPDIR
+INCLUDES += -Imidiedit -Iscore -Iarranger -Iliste
+INCLUDES += -Iwidgets -Imixer -Idriver -Iwaveedit -Implugins
+else
+INCLUDES += -I$(MUSETOP) -I$(MUSETOP)/widgets -I$(MUSETOP)/driver
+endif
+
+INCLUDES += -Iarchiv -I$(QTDIR_INC)
+FLAGS += -DQT_CLEAN_NAMESPACE -DQT_NOCOMPAT -DQT_NO_ASCII_CAST
+# FLAGS += -fno-exceptions
+FLAGS += -D_REENTRANT -DVERSION=\"$(VERSION)\"
+FLAGS += -DINSTDIR=\"$(INSTDIR)\"
+FLAGS += -DINSTLIBDIR=\"$(INSTLIBDIR)\"
+
+ifeq ($(ALSA),yes)
+FLAGS += -DALSA
+endif
+ifeq ($(OSS),yes)
+FLAGS += -DOSS
+endif
+
+ALL_CFLAGS = $(FLAGS) $(INCLUDES) $(CFLAGS)
+
+.PHONY: all target clean depend test translations
+.SUFFIXES: .ui
+
+%.o: %.c
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
+obj/%.o: %.c
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
+.ui.h:
+ $(UIC) $< -o $*.h
+.ui.c:
+ $(UIC) -o $*.c -impl $*.h $<
+obj/moc_%.c: %.h
+ $(MOC) $< -o obj/moc_$*.c
+
+
+all: target
+
+clean::
+ -@rm -f *.o obj/* *.bak $(GENSRC:=.h) $(GENSRC:=.c)
+
+depend:: $(GENSRC:=.h)
+depend::
+ -$(CC) -MM $(ALL_CFLAGS) $(SRC:=.c) $(MSRC:=.c) | sed -e 's/^.*\.o:/obj\/\0/' >.depend
+
+-include .depend
+
+ifndef TOPDIR
+MAKE = make
+endif
+
+install:: ;
+
diff --git a/muse2/muse/marker/Makefile.am b/muse2/muse/marker/Makefile.am
new file mode 100644
index 00000000..f577d695
--- /dev/null
+++ b/muse2/muse/marker/Makefile.am
@@ -0,0 +1,15 @@
+include $(top_srcdir)/common.am
+
+if PCH
+AM_CXXFLAGS += -include $(top_srcdir)/all.h
+endif
+
+noinst_LIBRARIES = libmarker.a
+
+dist_libmarker_a_SOURCES = \
+ marker.cpp marker.h \
+ markerview.cpp markerview.h
+
+nodist_libmarker_a_SOURCES = \
+ moc_markerview.cpp
+
diff --git a/muse2/muse/marker/Makefile.in b/muse2/muse/marker/Makefile.in
new file mode 100644
index 00000000..d9ed6779
--- /dev/null
+++ b/muse2/muse/marker/Makefile.in
@@ -0,0 +1,596 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/common.am
+@PCH_TRUE@am__append_1 = -include $(top_srcdir)/all.h
+subdir = muse/marker
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
+ $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libmarker_a_AR = $(AR) $(ARFLAGS)
+libmarker_a_LIBADD =
+dist_libmarker_a_OBJECTS = marker.$(OBJEXT) markerview.$(OBJEXT)
+nodist_libmarker_a_OBJECTS = moc_markerview.$(OBJEXT)
+libmarker_a_OBJECTS = $(dist_libmarker_a_OBJECTS) \
+ $(nodist_libmarker_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(dist_libmarker_a_SOURCES) $(nodist_libmarker_a_SOURCES)
+DIST_SOURCES = $(dist_libmarker_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCBOOKSTYLE = @DOCBOOKSTYLE@
+DOCBOOKTARGETS = @DOCBOOKTARGETS@
+DOT = @DOT@
+DOTPATH = @DOTPATH@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@
+FST_CFLAGS = @FST_CFLAGS@
+FST_LIBS = @FST_LIBS@
+Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@
+Fluidsynth_LIBS = @Fluidsynth_LIBS@
+GIVERTCAP = @GIVERTCAP@
+GREP = @GREP@
+HAVEDOT = @HAVEDOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JADE = @JADE@
+LASH_CFLAGS = @LASH_CFLAGS@
+LASH_LIBS = @LASH_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LO_CFLAGS = @LO_CFLAGS@
+LO_LIBS = @LO_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUSECXXFLAGS = @MUSECXXFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSGMLS = @NSGMLS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCH = @PCH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIB = @PYTHON_LIB@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+QTDIR_BIN = @QTDIR_BIN@
+QTDIR_INC = @QTDIR_INC@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+SUIDBUILD = @SUIDBUILD@
+SUIDINSTALL = @SUIDINSTALL@
+USE_SSE = @USE_SSE@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+have_docbook = @have_docbook@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+synth_fluid = @synth_fluid@
+synth_fluidsynth = @synth_fluidsynth@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \
+ -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(am__append_1)
+AM_CPPFLAGS =
+MOC = $(QTDIR_BIN)/moc
+#UIC = $(QTDIR_BIN)/uic3
+UIC = /usr/bin/uic3
+UIFILES = $(wildcard *.ui)
+MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \
+ if grep -q Q_OBJECT $$h; then \
+ echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \
+ fi; \
+ done)
+
+BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+SUFFIXES = .ui .h.gch
+noinst_LIBRARIES = libmarker.a
+dist_libmarker_a_SOURCES = \
+ marker.cpp marker.h \
+ markerview.cpp markerview.h
+
+nodist_libmarker_a_SOURCES = \
+ moc_markerview.cpp
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .ui .h.gch .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/marker/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu muse/marker/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libmarker.a: $(libmarker_a_OBJECTS) $(libmarker_a_DEPENDENCIES)
+ -rm -f libmarker.a
+ $(libmarker_a_AR) libmarker.a $(libmarker_a_OBJECTS) $(libmarker_a_LIBADD)
+ $(RANLIB) libmarker.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/marker.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/markerview.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_markerview.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+de:
+ @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done
+
+nde:
+ @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done
+
+.ui.o: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(CXXCOMPILE) -c $*.cpp -o $*.o
+ $(RM) $*.cpp moc_$*.cpp moc_$*.o
+
+.ui.lo: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(LTCXXCOMPILE) -c $*.cpp -o $*.lo
+ $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o
+
+moc_%.cpp: %.h
+ $(MOC) $< -o $@
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/muse2/muse/marker/marker.cpp b/muse2/muse/marker/marker.cpp
new file mode 100644
index 00000000..eee0be02
--- /dev/null
+++ b/muse2/muse/marker/marker.cpp
@@ -0,0 +1,90 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: marker.cpp,v 1.2 2003/12/10 18:34:22 wschweer Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "marker.h"
+#include "xml.h"
+
+Marker* MarkerList::add(const Marker& marker)
+ {
+ iMarker i = insert(std::pair<const int, Marker> (marker.tick(), Marker(marker)));
+ return &i->second;
+ }
+
+Marker* MarkerList::add(const QString& s, int t, bool lck)
+ {
+ Marker marker(s);
+ marker.setType(lck ? Pos::FRAMES : Pos::TICKS);
+ marker.setTick(t);
+ iMarker i = insert(std::pair<const int, Marker> (t, marker));
+ return &i->second;
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void Marker::read(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ xml.unknown("Marker");
+ break;
+ case Xml::Attribut:
+ if (tag == "tick")
+ setTick(xml.s2().toInt());
+ else if (tag == "lock")
+ setType(xml.s2().toInt() ? FRAMES:TICKS);
+ else if (tag == "name")
+ {
+ _name = xml.s2();
+ }
+ break;
+ case Xml::TagEnd:
+ if (xml.s1() == "marker")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void MarkerList::write(int level, Xml& xml) const
+ {
+ for (ciMarker i = begin(); i != end(); ++i) {
+ const Marker& m = i->second;
+ xml.put(level, "<marker tick=\"%d\" lock=\"%d\" name=\"%s\" />",
+ //m.tick(), m.type()==Pos::FRAMES, m.name().latin1());
+ m.tick(), m.type()==Pos::FRAMES, Xml::xmlString(m.name()).latin1());
+ }
+ }
+
+//---------------------------------------------------------
+// remove
+//---------------------------------------------------------
+
+void MarkerList::remove(Marker* m)
+ {
+ for (iMarker i = begin(); i != end(); ++i) {
+ Marker* mm = &i->second;
+ if (mm == m) {
+ erase(i);
+ return;
+ }
+ }
+ printf("MarkerList::remove(): marker not found\n");
+ }
+
diff --git a/muse2/muse/marker/marker.h b/muse2/muse/marker/marker.h
new file mode 100644
index 00000000..a00e1fc6
--- /dev/null
+++ b/muse2/muse/marker/marker.h
@@ -0,0 +1,51 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: marker.h,v 1.2 2003/12/15 11:41:00 wschweer Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MARKER_H__
+#define __MARKER_H__
+
+#include <map>
+#include <qstring.h>
+#include "xml.h"
+#include "pos.h"
+
+//---------------------------------------------------------
+// Marker
+//---------------------------------------------------------
+
+class Marker : public Pos {
+ QString _name;
+ bool _current;
+
+ public:
+ Marker() : _current(false) {}
+ Marker(const QString& s, bool cur = false)
+ : _name(s), _current(cur) {}
+ void read(Xml&);
+ const QString name() const { return _name; }
+ void setName(const QString& s) { _name = s; }
+ bool current() const { return _current; }
+ void setCurrent(bool f) { _current = f; }
+ };
+
+//---------------------------------------------------------
+// MarkerList
+//---------------------------------------------------------
+
+class MarkerList : public std::multimap<unsigned, Marker, std::less<unsigned> > {
+ public:
+ Marker* add(const Marker& m);
+ Marker* add(const QString& s, int t, bool lck);
+ void write(int, Xml&) const;
+ void remove(Marker*);
+ };
+
+typedef std::multimap<unsigned, Marker, std::less<unsigned> >::iterator iMarker;
+typedef std::multimap<unsigned, Marker, std::less<unsigned> >::const_iterator ciMarker;
+
+#endif
+
diff --git a/muse2/muse/marker/markerview.cpp b/muse2/muse/marker/markerview.cpp
new file mode 100644
index 00000000..39885ec7
--- /dev/null
+++ b/muse2/muse/marker/markerview.cpp
@@ -0,0 +1,597 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: markerview.cpp,v 1.7.2.6 2009/08/25 20:28:45 spamatica Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "marker.h"
+#include "markerview.h"
+#include "xml.h"
+#include "globals.h"
+#include "sync.h"
+#include "icons.h"
+#include "song.h"
+#include "posedit.h"
+
+#include <q3toolbar.h>
+#include <qtoolbutton.h>
+#include <qtooltip.h>
+#include <qlayout.h>
+#include <qsizegrip.h>
+#include <q3popupmenu.h>
+#include <qmenubar.h>
+#include <qaction.h>
+#include <q3groupbox.h>
+#include <qlineedit.h>
+#include <Qt3Support>
+//Added by qt3to4:
+#include <QCloseEvent>
+#include <Q3VBoxLayout>
+
+enum { COL_TICK = 0, COL_SMPTE, COL_LOCK, COL_NAME };
+
+//---------------------------------------------------------
+// tick
+//---------------------------------------------------------
+
+unsigned MarkerItem::tick() const
+ {
+ return _marker->tick();
+ }
+
+//---------------------------------------------------------
+// name
+//---------------------------------------------------------
+
+const QString MarkerItem::name() const
+ {
+ return _marker->name();
+ }
+
+//---------------------------------------------------------
+// lock
+//---------------------------------------------------------
+
+bool MarkerItem::lock() const
+ {
+ return _marker->type() == Pos::FRAMES;
+ }
+
+//---------------------------------------------------------
+// MarkerItem
+//---------------------------------------------------------
+
+MarkerItem::MarkerItem(Q3ListView* parent, Marker* m)
+ : Q3ListViewItem(parent)
+ {
+ _marker = m;
+ setText(COL_NAME, m->name());
+ setTick(m->tick());
+ if (m->type() == Pos::FRAMES)
+ setPixmap(COL_LOCK, *lockIcon);
+ setLock(m->type() == Pos::FRAMES);
+ }
+
+//---------------------------------------------------------
+// setName
+//---------------------------------------------------------
+
+void MarkerItem::setName(const QString& s)
+ {
+ setText(COL_NAME, s);
+ _marker = song->setMarkerName(_marker, s);
+ }
+
+//---------------------------------------------------------
+// setLock
+//---------------------------------------------------------
+
+void MarkerItem::setLock(bool lck)
+ {
+ setPixmap(COL_LOCK, lck ? *lockIcon : 0);
+ _marker = song->setMarkerLock(_marker, lck);
+ }
+
+//---------------------------------------------------------
+// setTick
+//---------------------------------------------------------
+
+void MarkerItem::setTick(unsigned v)
+ {
+ if (_marker->tick() != v)
+ _marker = song->setMarkerTick(_marker, v);
+ QString s;
+ int bar, beat;
+ unsigned tick;
+ sigmap.tickValues(v, &bar, &beat, &tick);
+ s.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick);
+ setText(COL_TICK, s);
+
+ double time = double(tempomap.tick2frame(v))/double(sampleRate);
+ int hour = int(time) / 3600;
+ int min = (int(time) % 3600)/60;
+ int sec = int(time) % 60;
+ double rest = time - (hour*3600 + min * 60 + sec);
+ switch(mtcType) {
+ case 0: // 24 frames sec
+ rest *= 24;
+ break;
+ case 1: // 25
+ rest *= 25;
+ break;
+ case 2: // 30 drop frame
+ rest *= 30;
+ break;
+ case 3: // 30 non drop frame
+ rest *= 30;
+ break;
+ }
+ int frame = int(rest);
+ int subframe = int((rest-frame)*100);
+ s.sprintf("%02d:%02d:%02d:%02d:%02d",
+ hour, min, sec, frame, subframe);
+ setText(COL_SMPTE, s);
+ }
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void MarkerView::closeEvent(QCloseEvent* e)
+ {
+ emit deleted((unsigned long)this);
+ emit closed();
+ e->accept();
+ }
+
+//---------------------------------------------------------
+// MarkerView
+//---------------------------------------------------------
+
+MarkerView::MarkerView(QWidget* parent)
+ : TopWin(parent, "markerview", Qt::WType_TopLevel /*| WDestructiveClose*/)
+ {
+ setCaption(tr("MusE: Marker"));
+
+ //---------Actions----------------------------
+ Q3Action* markerAdd = new Q3Action(tr("add marker"),
+ QIcon(*flagIcon), tr("Add Marker"),
+ 0, this, "add marker");
+ connect(markerAdd, SIGNAL(activated()), SLOT(addMarker()));
+
+ Q3Action* markerDelete = new Q3Action(tr("delete marker"),
+ QIcon(*deleteIcon), tr("Delete Marker"),
+ 0, this, "delete marker");
+ connect(markerDelete, SIGNAL(activated()), SLOT(deleteMarker()));
+
+ //---------Pulldown Menu----------------------------
+ Q3PopupMenu* fileMenu = new Q3PopupMenu(this);
+ menuBar()->insertItem(tr("&File"), fileMenu);
+ Q3PopupMenu* editMenu = new Q3PopupMenu(this);
+ menuBar()->insertItem(tr("&Edit"), editMenu);
+ markerAdd->addTo(editMenu);
+ markerDelete->addTo(editMenu);
+
+ //---------ToolBar----------------------------------
+ tools = new Q3ToolBar(this, "marker-tools");
+ undoRedo->addTo(tools);
+
+ Q3ToolBar* edit = new Q3ToolBar(this, "edit tools");
+ markerAdd->addTo(edit);
+ markerDelete->addTo(edit);
+
+ //---------------------------------------------------
+ // master
+ //---------------------------------------------------
+
+ QWidget* w = new QWidget(this, "main");
+ setCentralWidget(w);
+ Q3VBoxLayout* vbox = new Q3VBoxLayout(w);
+
+ table = new Q3ListView(w);
+ table->setAllColumnsShowFocus(true);
+ table->setSelectionMode(Q3ListView::Single);
+ table->setSorting(COL_TICK, true);
+
+ table->addColumn(tr("Bar:Beat:Tick"));
+ table->addColumn(tr("Hr:Mn:Sc:Fr:Sf"));
+ table->addColumn(tr("Lock"));
+ table->addColumn(tr("Text"));
+ table->setColumnWidth(3, 200);
+ table->setColumnWidthMode(3, Q3ListView::Maximum);
+ connect(table, SIGNAL(selectionChanged()),
+ SLOT(markerSelectionChanged()));
+ connect(table, SIGNAL(clicked(Q3ListViewItem*)),
+ SLOT(clicked(Q3ListViewItem*)));
+
+ Q3GroupBox* props = new Q3GroupBox(4, Qt::Horizontal, tr("Marker Properties"), w);
+
+ editTick = new PosEdit(props);
+ editTick->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
+ QSizePolicy::Fixed));
+
+ editSMPTE = new PosEdit(props);
+ editSMPTE->setSmpte(true);
+ editSMPTE->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
+ QSizePolicy::Fixed));
+
+ lock = new QToolButton(props);
+ lock->setPixmap(*lockIcon);
+ lock->setToggleButton(true);
+
+ editName = new QLineEdit(props);
+ editName->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,
+ QSizePolicy::Preferred));
+ connect(editName, SIGNAL(textChanged(const QString&)),
+ SLOT(nameChanged(const QString&)));
+ connect(editTick, SIGNAL(valueChanged(const Pos&)),
+ SLOT(tickChanged(const Pos&)));
+ connect(editSMPTE, SIGNAL(valueChanged(const Pos&)),
+ SLOT(tickChanged(const Pos&)));
+ connect(editSMPTE, SIGNAL(valueChanged(const Pos&)),
+ editTick, SLOT(setValue(const Pos&)));
+ connect(editTick, SIGNAL(valueChanged(const Pos&)),
+ editSMPTE, SLOT(setValue(const Pos&)));
+ connect(lock, SIGNAL(toggled(bool)),
+ SLOT(lockChanged(bool)));
+ connect(song, SIGNAL(markerChanged(int)),
+ SLOT(markerChanged(int)));
+
+ vbox->addWidget(table);
+ vbox->addWidget(props);
+
+ //---------------------------------------------------
+ // Rest
+ //---------------------------------------------------
+
+ //connect(song, SIGNAL(songChanged(int)), SLOT(updateList()));
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+
+ updateList();
+
+ // work around for probable QT/WM interaction bug.
+ // for certain window managers, e.g xfce, this window is
+ // is displayed although not specifically set to show();
+ // bug: 2811156 Softsynth GUI unclosable with XFCE4 (and a few others)
+ show();
+ hide();
+
+ }
+
+//---------------------------------------------------------
+// MArkerView
+//---------------------------------------------------------
+
+MarkerView::~MarkerView()
+ {
+ // p3.3.47
+ //printf("MarkerView::~MarkerView() before undoRedo->removeFrom(tools)\n");
+
+ undoRedo->removeFrom(tools);
+ }
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void MarkerView::readStatus(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ switch (token) {
+ case Xml::TagStart:
+ xml.unknown("Marker");
+ break;
+ case Xml::TagEnd:
+ if (tag == "marker")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void MarkerView::writeStatus(int level, Xml& xml) const
+ {
+ xml.tag(level++, "marker");
+ xml.tag(level, "/marker");
+ }
+
+//---------------------------------------------------------
+// addMarker
+//---------------------------------------------------------
+void MarkerView::addMarker()
+ {
+ addMarker(-1);
+ }
+void MarkerView::addMarker(int i)
+ {
+ if( i==-1 ) i = song->cpos();
+
+ // Changed p3.3.43 Let Song::addMarker emit markerChanged(MARKER_ADD)
+ // and handle it in MarkerView::markerChanged(int)
+ //Marker* m = song->addMarker(QString(""), i, false);
+ //MarkerItem* newItem = new MarkerItem(table, m);
+ //table->setSelected(newItem, true);
+ //
+ song->addMarker(QString(""), i, false);
+ }
+
+//---------------------------------------------------------
+// deleteMarker
+//---------------------------------------------------------
+
+void MarkerView::deleteMarker()
+ {
+ MarkerItem* item = (MarkerItem*)table->selectedItem();
+ if (item) {
+ song->removeMarker(item->marker());
+
+ // Removed p3.3.43 Let Song::removeMarker emit markerChanged(MARKER_REMOVE)
+ // and handle it in MarkerView::markerChanged(int)
+ //delete item;
+ }
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void MarkerView::songChanged(int flags)
+{
+ // Is it simply a midi controller value adjustment? Forget it.
+ if(flags == SC_MIDI_CONTROLLER)
+ return;
+
+ updateList();
+}
+
+//---------------------------------------------------------
+// updateList
+//---------------------------------------------------------
+
+void MarkerView::updateList()
+{
+ // Added p3.3.43 Manage selected item, due to clearing of table...
+ MarkerList* marker = song->marker();
+ MarkerItem* selitem = (MarkerItem*)table->selectedItem();
+ Marker* selm = selitem ? selitem->marker() : 0;
+ // p3.3.44 Look for removed markers before added markers...
+ if(selitem)
+ {
+ MarkerItem* mitem = (MarkerItem*)table->firstChild();
+ while(mitem)
+ {
+ bool found = false;
+ for(iMarker i = marker->begin(); i != marker->end(); ++i)
+ {
+ Marker* m = &i->second;
+ if(m == mitem->marker())
+ {
+ found = true;
+ break;
+ }
+ }
+ // Anything removed from the marker list?
+ if(!found)
+ {
+ // If it is the current selected item, it no longer exists. Make the next item be selected.
+ if(mitem == selitem)
+ {
+ MarkerItem* mi = (MarkerItem*)selitem->nextSibling();
+ if(mi)
+ {
+ selitem = mi;
+ selm = selitem->marker();
+ }
+ }
+ }
+ mitem = (MarkerItem*)mitem->nextSibling();
+ }
+ }
+ // Look for added markers...
+ for(iMarker i = marker->begin(); i != marker->end(); ++i)
+ {
+ Marker* m = &i->second;
+ bool found = false;
+ MarkerItem* item = (MarkerItem*)table->firstChild();
+ while(item)
+ {
+ if(item->marker() == m)
+ {
+ found = true;
+ break;
+ }
+ item = (MarkerItem*)item->nextSibling();
+ }
+ // Anything new found in the marker list?
+ if(!found)
+ selm = m;
+ }
+
+ table->clear();
+ //MarkerList* marker = song->marker();
+ for (iMarker i = marker->begin(); i != marker->end(); ++i)
+ {
+ Marker* m = &i->second;
+
+ // Changed p3.3.43
+ //QString tick;
+ //tick.setNum(i->first);
+ //new MarkerItem(table, m);
+ MarkerItem* item = new MarkerItem(table, m);
+ if(m == selm)
+ {
+ m->setCurrent(true);
+ table->setSelected(item, true);
+ }
+ else
+ {
+ m->setCurrent(false);
+ }
+ }
+}
+
+//---------------------------------------------------------
+// markerSelected
+//---------------------------------------------------------
+
+void MarkerView::markerSelectionChanged()
+ {
+ MarkerItem* item = (MarkerItem*)table->selectedItem();
+ if (item == 0) { // never triggered
+ editTick->setValue(0);
+ editSMPTE->setValue(0);
+ editName->setText(QString(""));
+ lock->setOn(false);
+ editSMPTE->setEnabled(false);
+ editTick->setEnabled(false);
+ lock->setEnabled(false);
+ editName->setEnabled(false);
+ }
+ else {
+ editTick->setValue(item->tick());
+ editSMPTE->setValue(item->tick());
+ editName->setText(item->name());
+ editName->setEnabled(true);
+ lock->setOn(item->lock());
+ lock->setEnabled(true);
+
+ //printf("MarkerView::markerSelectionChanged item->lock:%d\n", item->lock());
+
+ editSMPTE->setEnabled(item->lock());
+ editTick->setEnabled(!item->lock());
+ }
+ }
+
+void MarkerView::clicked(Q3ListViewItem* i)
+ {
+ MarkerItem* item = (MarkerItem*)i;
+ if (item == 0) {
+ table->clearSelection();
+ return;
+ }
+ Pos p(item->tick(), true);
+ song->setPos(0, p, true, true, false);
+ }
+
+//---------------------------------------------------------
+// nameChanged
+//---------------------------------------------------------
+
+void MarkerView::nameChanged(const QString& s)
+ {
+ MarkerItem* item = (MarkerItem*)table->selectedItem();
+ if (item)
+ item->setName(s);
+ }
+
+//---------------------------------------------------------
+// tickChanged
+//---------------------------------------------------------
+
+void MarkerView::tickChanged(const Pos& pos)
+ {
+ MarkerItem* item = (MarkerItem*)table->selectedItem();
+ if (item) {
+ item->setTick(pos.tick());
+ Pos p(pos.tick(), true);
+ song->setPos(0, p, true, true, false);
+ table->sort();
+ }
+ }
+
+//---------------------------------------------------------
+// lockChanged
+//---------------------------------------------------------
+
+void MarkerView::lockChanged(bool lck)
+ {
+ MarkerItem* item = (MarkerItem*)table->selectedItem();
+ if (item) {
+ item->setLock(lck);
+ editSMPTE->setEnabled(item->lock());
+ editTick->setEnabled(!item->lock());
+ }
+ }
+
+//---------------------------------------------------------
+// posChanged
+// select appropriate Marker
+//---------------------------------------------------------
+
+void MarkerView::markerChanged(int val)
+{
+ //if (val != Song::MARKER_CUR)
+ // return;
+ // p3.3.43
+ switch(val)
+ {
+ // MARKER_CUR, MARKER_ADD, MARKER_REMOVE, MARKER_NAME,
+ // MARKER_TICK, MARKER_LOCK
+ case Song::MARKER_ADD:
+ case Song::MARKER_REMOVE:
+ updateList();
+ break; // Try falling through and let it try to select something. No, let updateList() do it...
+
+ case Song::MARKER_CUR:
+ {
+
+ MarkerList* marker = song->marker();
+ for (iMarker i = marker->begin(); i != marker->end(); ++i) {
+ if (i->second.current()) {
+ MarkerItem* item = (MarkerItem*)table->firstChild();
+ while (item) {
+ if (item->marker() == &i->second) {
+ table->setSelected(item, true);
+ return;
+ }
+ item = (MarkerItem*)item->nextSibling();
+ }
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+void MarkerView::nextMarker()
+ {
+ unsigned int curPos = song->cpos();//prevent compiler warning: comparison of sigend/unsigned
+ unsigned int nextPos = 0xFFFFFFFF;
+ MarkerList* marker = song->marker();
+ for (iMarker i = marker->begin(); i != marker->end(); ++i) {
+ if (i->second.tick() > curPos && i->second.tick() < nextPos)
+ nextPos = i->second.tick();
+ }
+ if (nextPos == 0xFFFFFFFF)
+ return;
+ Pos p(nextPos, true);
+ song->setPos(0, p, true, true, false);
+
+ }
+void MarkerView::prevMarker()
+ {
+ unsigned int curPos = song->cpos();//prevent compiler warning: comparison of sigend/unsigned
+ unsigned int nextPos = 0;
+ MarkerList* marker = song->marker();
+ for (iMarker i = marker->begin(); i != marker->end(); ++i) {
+ if (i->second.tick() < curPos && i->second.tick() > nextPos)
+ nextPos = i->second.tick();
+ }
+/* if (nextPos == 0)
+ return;*/
+ Pos p(nextPos, true);
+ song->setPos(0, p, true, true, false);
+ }
diff --git a/muse2/muse/marker/markerview.h b/muse2/muse/marker/markerview.h
new file mode 100644
index 00000000..b9f5a85d
--- /dev/null
+++ b/muse2/muse/marker/markerview.h
@@ -0,0 +1,84 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: markerview.h,v 1.4.2.3 2008/08/18 00:15:25 terminator356 Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MARKERVIEW_H__
+#define __MARKERVIEW_H__
+
+#include "cobject.h"
+#include <q3mainwindow.h>
+#include <q3listview.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+
+class QLineEdit;
+class PosEdit;
+class QToolButton;
+class Marker;
+class Q3ToolBar;
+class Pos;
+
+//---------------------------------------------------------
+// MarkerItem
+//---------------------------------------------------------
+
+class MarkerItem : public Q3ListViewItem {
+ Marker* _marker;
+
+ public:
+ MarkerItem(Q3ListView* parent, Marker* m);
+ Marker* marker() const { return _marker; }
+ unsigned tick() const;
+ const QString name() const;
+ bool lock() const;
+ void setName(const QString& s);
+ void setTick(unsigned t);
+ void setLock(bool lck);
+ };
+
+//---------------------------------------------------------
+// MarkerView
+//---------------------------------------------------------
+
+class MarkerView : public TopWin {
+ Q3ListView* table;
+ QLineEdit* editName;
+ PosEdit* editSMPTE;
+ PosEdit* editTick;
+ QToolButton* lock;
+ Q3ToolBar* tools;
+
+ Q_OBJECT
+ virtual void closeEvent(QCloseEvent*);
+
+ private slots:
+ void addMarker();
+ void addMarker(int);
+ void deleteMarker();
+ void markerSelectionChanged();
+ void nameChanged(const QString&);
+ void tickChanged(const Pos&);
+ void lockChanged(bool);
+ void markerChanged(int);
+ void clicked(Q3ListViewItem*);
+ void updateList();
+ void songChanged(int);
+
+ signals:
+ void deleted(unsigned long);
+ void closed();
+
+ public:
+ MarkerView(QWidget* parent);
+ ~MarkerView();
+ virtual void readStatus(Xml&);
+ virtual void writeStatus(int, Xml&) const;
+ void nextMarker();
+ void prevMarker();
+ };
+
+#endif
+
diff --git a/muse2/muse/master/Makefile.am b/muse2/muse/master/Makefile.am
new file mode 100644
index 00000000..55222bd4
--- /dev/null
+++ b/muse2/muse/master/Makefile.am
@@ -0,0 +1,19 @@
+include $(top_srcdir)/common.am
+
+if PCH
+AM_CXXFLAGS += -include $(top_srcdir)/all.h
+endif
+
+noinst_LIBRARIES = libmaster.a
+
+dist_libmaster_a_SOURCES = \
+ lmaster.cpp lmaster.h \
+ masteredit.cpp masteredit.h \
+ master.cpp master.h \
+ tscale.cpp tscale.h
+
+nodist_libmaster_a_SOURCES = \
+ moc_lmaster.cpp \
+ moc_masteredit.cpp \
+ moc_master.cpp \
+ moc_tscale.cpp
diff --git a/muse2/muse/master/Makefile.in b/muse2/muse/master/Makefile.in
new file mode 100644
index 00000000..19449168
--- /dev/null
+++ b/muse2/muse/master/Makefile.in
@@ -0,0 +1,609 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/common.am
+@PCH_TRUE@am__append_1 = -include $(top_srcdir)/all.h
+subdir = muse/master
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
+ $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libmaster_a_AR = $(AR) $(ARFLAGS)
+libmaster_a_LIBADD =
+dist_libmaster_a_OBJECTS = lmaster.$(OBJEXT) masteredit.$(OBJEXT) \
+ master.$(OBJEXT) tscale.$(OBJEXT)
+nodist_libmaster_a_OBJECTS = moc_lmaster.$(OBJEXT) \
+ moc_masteredit.$(OBJEXT) moc_master.$(OBJEXT) \
+ moc_tscale.$(OBJEXT)
+libmaster_a_OBJECTS = $(dist_libmaster_a_OBJECTS) \
+ $(nodist_libmaster_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(dist_libmaster_a_SOURCES) $(nodist_libmaster_a_SOURCES)
+DIST_SOURCES = $(dist_libmaster_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCBOOKSTYLE = @DOCBOOKSTYLE@
+DOCBOOKTARGETS = @DOCBOOKTARGETS@
+DOT = @DOT@
+DOTPATH = @DOTPATH@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@
+FST_CFLAGS = @FST_CFLAGS@
+FST_LIBS = @FST_LIBS@
+Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@
+Fluidsynth_LIBS = @Fluidsynth_LIBS@
+GIVERTCAP = @GIVERTCAP@
+GREP = @GREP@
+HAVEDOT = @HAVEDOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JADE = @JADE@
+LASH_CFLAGS = @LASH_CFLAGS@
+LASH_LIBS = @LASH_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LO_CFLAGS = @LO_CFLAGS@
+LO_LIBS = @LO_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUSECXXFLAGS = @MUSECXXFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSGMLS = @NSGMLS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCH = @PCH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIB = @PYTHON_LIB@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+QTDIR_BIN = @QTDIR_BIN@
+QTDIR_INC = @QTDIR_INC@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+SUIDBUILD = @SUIDBUILD@
+SUIDINSTALL = @SUIDINSTALL@
+USE_SSE = @USE_SSE@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+have_docbook = @have_docbook@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+synth_fluid = @synth_fluid@
+synth_fluidsynth = @synth_fluidsynth@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \
+ -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(am__append_1)
+AM_CPPFLAGS =
+MOC = $(QTDIR_BIN)/moc
+#UIC = $(QTDIR_BIN)/uic3
+UIC = /usr/bin/uic3
+UIFILES = $(wildcard *.ui)
+MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \
+ if grep -q Q_OBJECT $$h; then \
+ echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \
+ fi; \
+ done)
+
+BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+SUFFIXES = .ui .h.gch
+noinst_LIBRARIES = libmaster.a
+dist_libmaster_a_SOURCES = \
+ lmaster.cpp lmaster.h \
+ masteredit.cpp masteredit.h \
+ master.cpp master.h \
+ tscale.cpp tscale.h
+
+nodist_libmaster_a_SOURCES = \
+ moc_lmaster.cpp \
+ moc_masteredit.cpp \
+ moc_master.cpp \
+ moc_tscale.cpp
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .ui .h.gch .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/master/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu muse/master/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libmaster.a: $(libmaster_a_OBJECTS) $(libmaster_a_DEPENDENCIES)
+ -rm -f libmaster.a
+ $(libmaster_a_AR) libmaster.a $(libmaster_a_OBJECTS) $(libmaster_a_LIBADD)
+ $(RANLIB) libmaster.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmaster.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/master.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/masteredit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_lmaster.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_master.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_masteredit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_tscale.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tscale.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+de:
+ @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done
+
+nde:
+ @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done
+
+.ui.o: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(CXXCOMPILE) -c $*.cpp -o $*.o
+ $(RM) $*.cpp moc_$*.cpp moc_$*.o
+
+.ui.lo: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(LTCXXCOMPILE) -c $*.cpp -o $*.lo
+ $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o
+
+moc_%.cpp: %.h
+ $(MOC) $< -o $@
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp
new file mode 100644
index 00000000..0638049e
--- /dev/null
+++ b/muse2/muse/master/lmaster.cpp
@@ -0,0 +1,715 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: lmaster.cpp,v 1.2.2.8 2009/03/09 02:05:18 terminator356 Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "lmaster.h"
+#include "xml.h"
+#include "song.h"
+#include "globals.h"
+#include "audio.h"
+#include "posedit.h"
+#include "sigedit.h"
+#include "shortcuts.h"
+#include "debug.h"
+
+#include <q3toolbar.h>
+#include <qtoolbutton.h>
+#include <qtooltip.h>
+#include <qlayout.h>
+#include <qsizegrip.h>
+#include <q3popupmenu.h>
+#include <qmenubar.h>
+#include <q3listview.h>
+#include <qmessagebox.h>
+#include <qstyle.h>
+#include <q3accel.h>
+#include <qaction.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+
+#define LMASTER_BEAT_COL 0
+#define LMASTER_TIME_COL 1
+#define LMASTER_TYPE_COL 2
+#define LMASTER_VAL_COL 3
+
+#define LMASTER_MSGBOX_STRING "MusE: List Editor"
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void LMaster::closeEvent(QCloseEvent* e)
+ {
+ emit deleted((unsigned long)this);
+ e->accept();
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void LMaster::songChanged(int type)
+ {
+ if (type & (SC_SIG | SC_TEMPO))
+ updateList();
+ }
+
+//---------------------------------------------------------
+// LMaster
+//---------------------------------------------------------
+
+LMaster::LMaster()
+ : MidiEditor(0, 0, 0)
+ {
+ pos_editor = 0;
+ editor = 0;
+ sig_editor = 0;
+ editedItem = 0;
+ editingNewItem = false;
+ setCaption(tr("MusE: Mastertrack"));
+ setMinimumHeight(100);
+ setFixedWidth(400);
+
+ //---------Pulldown Menu----------------------------
+ menuEdit = new Q3PopupMenu(this);
+ menuBar()->insertItem(tr("&Edit"), menuEdit);
+ undoRedo->addTo(menuEdit);
+ menuEdit->insertSeparator();
+ menuEdit->insertItem(tr("Insert Tempo"), CMD_INSERT_TEMPO);
+ menuEdit->insertItem(tr("Insert Signature"), CMD_INSERT_SIG);
+ menuEdit->insertItem(tr("Edit Positon"), CMD_EDIT_BEAT);
+ menuEdit->insertItem(tr("Edit Value"), CMD_EDIT_VALUE);
+
+ menuEdit->insertItem(tr("Delete Event"), CMD_DELETE);
+ menuEdit->setAccel(Qt::Key_Delete, CMD_DELETE);
+
+ connect(menuEdit, SIGNAL(activated(int)), SLOT(cmd(int)));
+
+ //---------ToolBar----------------------------------
+ tools = new Q3ToolBar(this, "list-tools");
+ undoRedo->addTo(tools);
+
+ Q3ToolBar* edit = new Q3ToolBar(this, "edit tools");
+ QToolButton* tempoButton = new QToolButton(edit);
+ QToolButton* timeSigButton = new QToolButton(edit);
+ tempoButton->setText(tr("Tempo"));
+ timeSigButton->setText(tr("Timesig"));
+ QToolTip::add(tempoButton, tr("new tempo"));
+ QToolTip::add(timeSigButton, tr("new signature"));
+ Q3Accel* qa = new Q3Accel(this);
+ qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Z), song, SLOT(undo()));
+ qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Y), song, SLOT(redo()));
+
+ //---------------------------------------------------
+ // master
+ //---------------------------------------------------
+
+ view = new Q3ListView(mainw);
+ view->setAllColumnsShowFocus(true);
+ view->setSelectionMode(Q3ListView::Single);
+ view->addColumn(tr("Meter"), 100);
+ view->addColumn(tr("Time"), 100);
+ view->addColumn(tr("Type"), 100);
+ view->addColumn(tr("Value"), 100);
+ view->setSorting(-1);
+
+ //---------------------------------------------------
+ // Rest
+ //---------------------------------------------------
+
+// QSizeGrip* corner = new QSizeGrip(mainw);
+
+ mainGrid->setRowStretch(0, 100);
+ mainGrid->setColStretch(0, 100);
+
+ mainGrid->addWidget(view, 0, 0);
+// mainGrid->addWidget(corner, 1, 1, AlignBottom | AlignRight);
+ updateList();
+
+ connect(view, SIGNAL(selectionChanged(Q3ListViewItem*)), SLOT(select(Q3ListViewItem*)));
+ connect(view, SIGNAL(pressed(Q3ListViewItem*, const QPoint&, int)), SLOT(itemPressed(Q3ListViewItem*, const QPoint&, int)));
+ connect(view, SIGNAL(doubleClicked(Q3ListViewItem* )), SLOT(itemDoubleClicked(Q3ListViewItem*)));
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ connect(tempoButton, SIGNAL(clicked()), SLOT(tempoButtonClicked()));
+ connect(timeSigButton, SIGNAL(clicked()), SLOT(timeSigButtonClicked()));
+
+ initShortcuts();
+ }
+
+//---------------------------------------------------------
+// ~LMaster
+//---------------------------------------------------------
+
+LMaster::~LMaster()
+ {
+ undoRedo->removeFrom(tools);
+ }
+
+//---------------------------------------------------------
+// insertSig
+//---------------------------------------------------------
+
+void LMaster::insertSig(const SigEvent* ev)
+ {
+ new LMasterSigEventItem(view, ev);
+ }
+
+//---------------------------------------------------------
+// insertTempo
+//---------------------------------------------------------
+
+void LMaster::insertTempo(const TEvent* ev)
+ {
+ new LMasterTempoItem(view, ev);
+ }
+
+//---------------------------------------------------------
+// updateList
+//---------------------------------------------------------
+
+void LMaster::updateList()
+ {
+ LMasterLViewItem* selected = (LMasterLViewItem*) view->selectedItem();
+ LMASTER_LVTYPE type = LMASTER_TEMPO;
+ unsigned tick = 0;
+
+ if (selected) {
+ type = selected->getType();
+ tick = selected->tick();
+ }
+
+ view->clear();
+ const TempoList* t = &tempomap;
+ const SigList* s = &sigmap;
+
+ criTEvent it = t->rbegin();
+ criSigEvent is = s->rbegin();
+ for (;;) {
+ if (it == t->rend()) {
+ while(is != s->rend()) {
+ insertSig(is->second);
+ ++is;
+ }
+ break;
+ }
+ if (is == s->rend()) {
+ while (it != t->rend()) {
+ insertTempo(it->second);
+ ++it;
+ }
+ break;
+ }
+ if (is->second->tick > it->second->tick) {
+ insertSig(is->second);
+ ++is;
+ }
+ else {
+ insertTempo(it->second);
+ ++it;
+ }
+ }
+
+ // Try to reselect the previous selection:
+ if(selected)
+ {
+ LMasterLViewItem* tmp = getItemAtPos(tick, type);
+ if (tmp) {
+ view->clearSelection();
+ view->setSelected(tmp, true);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void LMaster::readStatus(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ switch (token) {
+ case Xml::TagStart:
+ if (tag == "midieditor")
+ MidiEditor::readStatus(xml);
+ else
+ xml.unknown("LMaster");
+ break;
+ case Xml::TagEnd:
+ if (tag == "lmaster")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void LMaster::writeStatus(int level, Xml& xml) const
+ {
+ xml.tag(level++, "lmaster");
+ MidiEditor::writeStatus(level, xml);
+ xml.tag(level, "/lmaster");
+ }
+
+//---------------------------------------------------------
+// select
+//---------------------------------------------------------
+
+void LMaster::select(Q3ListViewItem* /*item*/)
+ {
+// printf("select %x\n", unsigned(item));
+ }
+
+//---------------------------------------------------------
+// cmd
+//---------------------------------------------------------
+
+void LMaster::cmd(int cmd)
+ {
+ switch(cmd) {
+ case CMD_DELETE: {
+ LMasterLViewItem* l = (LMasterLViewItem*) view->selectedItem();
+ if (!l)
+ return;
+ // Delete item:
+ if (l->tick() != 0) {
+ if (l == view->lastItem())
+ view->setSelected(l->itemAbove(), true);
+ else
+ view->setSelected(l->itemBelow(), true);
+
+ switch (l->getType()) {
+ case LMASTER_TEMPO:
+ {
+ LMasterTempoItem* t = (LMasterTempoItem*) l;
+ audio->msgDeleteTempo(t->tick(), t->tempo(), true);
+ break;
+ }
+ case LMASTER_SIGEVENT:
+ {
+ LMasterSigEventItem* s = (LMasterSigEventItem*) l;
+ audio->msgRemoveSig(s->tick(), s->z(), s->n());
+ break;
+ }
+ default:
+ M_ERROR("Default switch statement reached");
+ break;
+ }
+ }
+ break;
+ }
+ case CMD_INSERT_TEMPO:
+ tempoButtonClicked();
+ break;
+ case CMD_INSERT_SIG:
+ timeSigButtonClicked();
+ break;
+ case CMD_EDIT_BEAT:
+ case CMD_EDIT_VALUE:
+ cmd == CMD_EDIT_VALUE ? editorColumn = LMASTER_VAL_COL : editorColumn = LMASTER_BEAT_COL;
+ if (view->selectedItem() && !editedItem) {
+ itemDoubleClicked(view->selectedItem());
+ }
+ break;
+ }
+ }
+
+/*!
+ \fn LMaster::itemPressed(QListViewItem* i, const QPoint& p, int column)
+ */
+void LMaster::itemPressed(Q3ListViewItem* i, const QPoint& /*p*/, int column)
+ {
+ //printf("itemPressed, column: %d\n", column);
+ if (editedItem) {
+ if (editorColumn != column || editedItem != i)
+ returnPressed();
+ }
+ else
+ editorColumn = column;
+ }
+
+//---------------------------------------------------------
+// itemDoubleClicked(QListViewItem* item)
+//! Sets lmaster in edit mode, and opens editor for selected value
+//---------------------------------------------------------
+void LMaster::itemDoubleClicked(Q3ListViewItem* i)
+ {
+ //printf("itemDoubleClicked\n");
+
+ if (!editedItem && editorColumn == LMASTER_VAL_COL) {
+ editedItem = (LMasterLViewItem*) i;
+ QRect itemRect = view->itemRect(editedItem);
+ int x1 = view->columnWidth(LMASTER_BEAT_COL) + view->columnWidth(LMASTER_TIME_COL)
+ + view->columnWidth(LMASTER_TYPE_COL);
+ itemRect.setX(x1);
+ //Qt makes crazy things with itemRect if this is called directly..
+ if (editingNewItem) {
+ QFontMetrics fm(font());
+ int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth,0 , this); // ddskrjo 0
+ int h = fm.height() + fw * 2;
+ itemRect.setWidth(view->columnWidth(LMASTER_VAL_COL));
+ itemRect.setY(1);
+ itemRect.setHeight(h);
+ }
+
+
+ // Edit tempo value:
+ if (editedItem->getType() == LMASTER_TEMPO) {
+ if (!editor)
+ editor = new QLineEdit(view->viewport(), "lineedit");
+ editor->setText(editedItem->text(LMASTER_VAL_COL));
+ editor->setGeometry(itemRect);
+ editor->show();
+ editor->setFocus();
+ editor->selectAll();
+ connect(editor, SIGNAL(returnPressed()), SLOT(returnPressed()));
+ }
+ else { // Edit signatur value:
+ if (!sig_editor)
+ sig_editor = new SigEdit(view->viewport(), "sigedit");
+ sig_editor->setValue(editedItem->text(LMASTER_VAL_COL));
+ sig_editor->setGeometry(itemRect);
+ sig_editor->show();
+ sig_editor->setFocus();
+ connect(sig_editor, SIGNAL(returnPressed()), SLOT(returnPressed()));
+ }
+ }
+ // Edit tempo or signal position:
+ else if (!editedItem && editorColumn == LMASTER_BEAT_COL) {
+ editedItem = (LMasterLViewItem*) i;
+ // Don't allow movement of initial values:
+ if (editedItem->tick() == 0) {
+ QMessageBox::information(this, tr(LMASTER_MSGBOX_STRING),
+ tr("Reposition of the initial tempo and signature events is not allowed") );
+ editedItem = 0;
+ }
+ // Everything OK
+ else {
+ if (!pos_editor)
+ pos_editor = new PosEdit(view->viewport(), "tmpposedit");
+ pos_editor->setValue(editedItem->tick());
+ QRect itemRect = view->itemRect(editedItem);
+ itemRect.setX(0);
+ itemRect.setWidth(view->columnWidth(LMASTER_BEAT_COL));
+ pos_editor->setGeometry(itemRect);
+ pos_editor->show();
+ pos_editor->setFocus();
+ connect(pos_editor, SIGNAL(returnPressed()), SLOT(returnPressed()));
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// returnPressed()
+//! called when editor is closed
+//---------------------------------------------------------
+void LMaster::returnPressed()
+ {
+ if (!editedItem)
+ return;
+
+ setFocus();
+ // Tempo event:
+ if (editedItem->getType() == LMASTER_TEMPO && editorColumn == LMASTER_VAL_COL) {
+ QString input = editor->text();
+ editor->hide();
+ repaint();
+ LMasterTempoItem* e = (LMasterTempoItem*) editedItem;
+ const TEvent* t = e->getEvent();
+ unsigned tick = t->tick;
+ bool conversionOK;
+ double dbl_input = input.toDouble(&conversionOK);
+ if (conversionOK && dbl_input < 250.0) {
+ int tempo = (int) ((1000000.0 * 60.0)/dbl_input);
+
+ if (!editingNewItem) {
+ song->startUndo();
+ audio->msgDeleteTempo(tick, e->tempo(), false);
+ audio->msgAddTempo(tick, tempo, false);
+ song->endUndo(SC_TEMPO);
+ }
+ //
+ // New item edited:
+ //
+ else {
+ audio->msgAddTempo(tick, tempo, true);
+ }
+ }
+ else {
+ QMessageBox::warning(this, tr("MusE: List Editor"),
+ tr("Input error, conversion not OK or value out of range"),
+ QMessageBox::Ok, Qt::NoButton
+ );
+ }
+ }
+ //
+ // Beat column, change position of a particular tempo or signature event
+ //
+ else if (editorColumn == LMASTER_BEAT_COL) {
+ int oldtick = editedItem->tick();
+ int newtick = pos_editor->pos().tick();
+ if (newtick == 0) { // Do not allow change of position to beginning of song
+ QMessageBox::warning(this, tr(LMASTER_MSGBOX_STRING),
+ tr("Reposition of tempo and signature events to start position is not allowed!"),
+ QMessageBox::Ok, Qt::NoButton
+ );
+ }
+ else if (oldtick != newtick) { // Ignore if tick hasn't changed
+ if (editedItem->getType() == LMASTER_TEMPO) {
+ LMasterTempoItem* t = (LMasterTempoItem*) editedItem;
+ int tempo = t->tempo();
+ song->startUndo();
+ audio->msgDeleteTempo(oldtick, tempo, false);
+ audio->msgAddTempo(newtick, tempo, false);
+ song->endUndo(SC_TEMPO);
+ // Select the item:
+ Q3ListViewItem* newSelected = (Q3ListViewItem*) getItemAtPos(newtick, LMASTER_TEMPO);
+ if (newSelected) {
+ view->clearSelection();
+ view->setSelected(newSelected, true);
+ }
+ }
+ else if (editedItem->getType() == LMASTER_SIGEVENT) {
+ LMasterSigEventItem* t = (LMasterSigEventItem*) editedItem;
+ int z = t->z();
+ int n = t->n();
+ if (!editingNewItem) {
+ song->startUndo();
+ audio->msgRemoveSig(oldtick, z, n, false); //Delete first, in order to get sane tick-value
+ newtick = pos_editor->pos().tick();
+ audio->msgAddSig(newtick, z, n, false);
+ song->endUndo(SC_SIG);
+ }
+ else
+ audio->msgAddSig(newtick, z, n, false);
+ //audio->msgAddSig(newtick, z, n, true);
+
+ // Select the item:
+ Q3ListViewItem* newSelected = (Q3ListViewItem*) getItemAtPos(newtick, LMASTER_SIGEVENT);
+ if (newSelected) {
+ view->clearSelection();
+ view->setSelected(newSelected, true);
+ }
+ }
+
+ }
+ pos_editor->hide();
+ repaint();
+ }
+ //
+ // SigEvent, value changed:
+ //
+ else if (editedItem->getType() == LMASTER_SIGEVENT && editorColumn == LMASTER_VAL_COL)
+ {
+ Sig newSig = sig_editor->sig();
+
+ sig_editor->hide();
+
+ // Added p3.3.43 Prevents aborting with 0 z or n.
+ if(newSig.isValid())
+ {
+
+ LMasterSigEventItem* e = (LMasterSigEventItem*) editedItem;
+ int tick = e->tick();
+ if (!editingNewItem) {
+ song->startUndo();
+ if (tick > 0)
+ audio->msgRemoveSig(tick, e->z(), e->n(), false);
+ audio->msgAddSig(tick, newSig.z, newSig.n, false);
+ song->endUndo(SC_SIG);
+ }
+ else
+ audio->msgAddSig(tick, newSig.z, newSig.n, true);
+ }
+ }
+
+ view->setFocus();
+ // No item edited now:
+ editedItem = 0;
+ editorColumn = -1;
+ editingNewItem = false;
+ }
+
+
+/*!
+ \fn LMasterLViewItem::text(int column)
+ \brief Returns the initialized text to the View
+ */
+QString LMasterLViewItem::text(int column) const
+ {
+ QString ret = "?";
+ switch (column) {
+ case LMASTER_BEAT_COL:
+ ret = c1;
+ break;
+ case LMASTER_TIME_COL:
+ ret = c2;
+ break;
+ case LMASTER_TYPE_COL:
+ ret = c3;
+ break;
+ case LMASTER_VAL_COL:
+ ret = c4;
+ break;
+ default:
+ fprintf(stderr,"LMasterLViewItem::text(int): Default switch statement reached... Unknown column.\n");
+ break;
+ }
+ return ret;
+ }
+
+//---------------------------------------------------------
+// LMasterTempoItem
+//! Initializes a LMasterTempoItem with a TEvent
+//---------------------------------------------------------
+LMasterTempoItem::LMasterTempoItem(Q3ListView* parent, const TEvent* ev)
+ : LMasterLViewItem(parent)
+ {
+ tempoEvent = ev;
+ unsigned t = ev->tick;
+ //QString c1, c2, c3, c4;
+ int bar, beat;
+ unsigned tick;
+ sigmap.tickValues(t, &bar, &beat, &tick);
+ c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick);
+
+ double time = double(ev->frame) / double(sampleRate);
+ int min = int(time) / 60;
+ int sec = int(time) % 60;
+ int msec = int((time - (min*60 + sec)) * 1000.0);
+ c2.sprintf("%03d:%02d:%03d", min, sec, msec);
+ c3 = "Tempo";
+ double dt = (1000000.0 * 60.0)/ev->tempo;
+ c4.setNum(dt, 'f', 3);
+ }
+
+//---------------------------------------------------------
+// LMasterSigEventItem
+//! Initializes a ListView item with a SigEvent
+//---------------------------------------------------------
+LMasterSigEventItem::LMasterSigEventItem(Q3ListView* parent, const SigEvent* ev)
+ : LMasterLViewItem(parent)
+ {
+ sigEvent = ev;
+ unsigned t = ev->tick;
+ int bar, beat;
+ unsigned tick;
+ sigmap.tickValues(t, &bar, &beat, &tick);
+ c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick);
+
+ double time = double(tempomap.tick2frame(t)) / double (sampleRate);
+ int min = int(time) / 60;
+ int sec = int(time) % 60;
+ int msec = int((time - (min*60 + sec)) * 1000.0);
+ c2.sprintf("%03d:%02d:%03d", min, sec, msec);
+ c3 = "Timesig";
+ c4.sprintf("%d/%d", ev->z, ev->n);
+ }
+
+//---------------------------------------------------------
+// tempoButtonClicked()
+//! inserts a new tempo-item in the list and starts the editor for it
+//---------------------------------------------------------
+void LMaster::tempoButtonClicked()
+ {
+ LMasterTempoItem* lastTempo = (LMasterTempoItem*) getLastOfType(LMASTER_TEMPO);
+ QString beatString = ((LMasterLViewItem*)lastTempo)->text(LMASTER_BEAT_COL);
+ int m, b, t;
+ Pos p = Pos(beatString);
+ p.mbt(&m, &b, &t);
+ m++; //Next bar
+ int newTick = sigmap.bar2tick(m, b, t);
+ TEvent* ev = new TEvent(lastTempo->tempo(), newTick);
+ new LMasterTempoItem(view, ev);
+ Q3ListViewItem* newTempoItem = view->firstChild();
+
+ editingNewItem = true; // State
+ editorColumn = LMASTER_VAL_COL; // Set that we edit editorColumn
+ view->clearSelection();
+ view->setSelected(newTempoItem, true);
+ itemDoubleClicked(newTempoItem);
+ }
+
+
+//---------------------------------------------------------
+// tempoButtonClicked()
+//! inserts a new sig-item in the list and starts the editor for it
+//---------------------------------------------------------
+void LMaster::timeSigButtonClicked()
+ {
+ LMasterSigEventItem* lastSig = (LMasterSigEventItem*) getLastOfType(LMASTER_SIGEVENT);
+ QString beatString = ((LMasterLViewItem*)lastSig)->text(LMASTER_BEAT_COL);
+ int m, b, t;
+ Pos p = Pos(beatString);
+ p.mbt(&m, &b, &t);
+ m++;
+ int newTick = sigmap.bar2tick(m, b, t);
+ SigEvent* ev = new SigEvent(lastSig->z(), lastSig->n(), newTick);
+ new LMasterSigEventItem(view, ev);
+ Q3ListViewItem* newSigItem = view->firstChild();
+
+ editingNewItem = true; // State
+ editorColumn = LMASTER_VAL_COL; // Set that we edit editorColumn
+ view->clearSelection();
+ view->setSelected(newSigItem, true);
+ itemDoubleClicked(newSigItem);
+ }
+
+
+/*!
+ \fn LMaster::getLastOfType(LMASTER_LVTYPE t)
+ */
+LMasterLViewItem* LMaster::getLastOfType(LMASTER_LVTYPE t)
+ {
+ LMasterLViewItem* tmp = (LMasterLViewItem*) view->lastItem();
+ while (tmp->getType() != t) {
+ tmp = (LMasterLViewItem*) tmp->itemAbove();
+ }
+ return tmp;
+ }
+
+
+/*!
+ \fn LMaster::getItemAtPos(unsigned tick, LMASTER_LVTYPE t)
+ */
+LMasterLViewItem* LMaster::getItemAtPos(unsigned tick, LMASTER_LVTYPE t)
+ {
+ LMasterLViewItem* tmp = (LMasterLViewItem*) view->firstChild();
+ while (tmp) {
+ if (tmp->getType() == t && tmp->tick() == tick)
+ return tmp;
+ tmp = (LMasterLViewItem*) tmp->itemBelow();
+ }
+
+ return 0;
+ }
+
+
+/*!
+ \fn LMaster::configChanged()
+ */
+void LMaster::configChanged()
+ {
+ initShortcuts();
+ }
+
+
+/*!
+ \fn LMaster::initShortcuts()
+ */
+void LMaster::initShortcuts()
+ {
+ menuEdit->setAccel(shortcuts[SHRT_LM_INS_TEMPO].key, CMD_INSERT_TEMPO);
+ menuEdit->setAccel(shortcuts[SHRT_LM_INS_SIG].key, CMD_INSERT_SIG);
+ menuEdit->setAccel(shortcuts[SHRT_LM_EDIT_BEAT].key, CMD_EDIT_BEAT);
+ menuEdit->setAccel(shortcuts[SHRT_LM_EDIT_VALUE].key, CMD_EDIT_VALUE);
+ }
diff --git a/muse2/muse/master/lmaster.h b/muse2/muse/master/lmaster.h
new file mode 100644
index 00000000..b67f64bf
--- /dev/null
+++ b/muse2/muse/master/lmaster.h
@@ -0,0 +1,145 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: lmaster.h,v 1.1.1.1.2.5 2005/12/11 21:29:23 spamatica Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __LMASTER_EDIT_H__
+#define __LMASTER_EDIT_H__
+
+#include <qwidget.h>
+#include <qlineedit.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <Q3PopupMenu>
+#include <QCloseEvent>
+#include "midieditor.h"
+#include "noteinfo.h"
+#include "cobject.h"
+#include <q3mainwindow.h>
+#include <q3listview.h>
+#include "tempo.h"
+#include "sig.h"
+
+class QToolButton;
+class Q3ListView;
+class SigEvent;
+class QLineEdit;
+class QMouseEvent;
+class PosEdit;
+class SigEdit;
+
+enum LMASTER_LVTYPE
+ {
+ LMASTER_TEMPO = 0,
+ LMASTER_SIGEVENT
+ };
+
+//---------------------------------------------------------
+// LMasterLViewItem
+//! QListViewItem base class for LMasterTempoItem and LMasterSigEventItem
+//---------------------------------------------------------
+class LMasterLViewItem : public Q3ListViewItem {
+ protected:
+ QString c1, c2, c3, c4;
+
+ public:
+ LMasterLViewItem(Q3ListView* parent)
+ : Q3ListViewItem(parent) { }
+ LMasterLViewItem(Q3ListView* parent, Q3ListViewItem* after)
+ : Q3ListViewItem(parent, after) { }
+ virtual QString text(int column) const;
+ virtual LMASTER_LVTYPE getType() = 0;
+ virtual unsigned tick() = 0;
+ };
+
+//---------------------------------------------------------
+// LMasterTempoItem
+//! QListViewItem which holds data for a TEvent
+//---------------------------------------------------------
+class LMasterTempoItem : public LMasterLViewItem {
+
+ private:
+ const TEvent* tempoEvent;
+
+ public:
+ LMasterTempoItem(Q3ListView* parent, const TEvent* t);
+ virtual LMASTER_LVTYPE getType() { return LMASTER_TEMPO; }
+ const TEvent* getEvent() { return tempoEvent; }
+ virtual unsigned tick() { return tempoEvent->tick; }
+ int tempo() { return tempoEvent->tempo; }
+ };
+
+//---------------------------------------------------------
+// LMasterTempoItem
+//! QListViewItem which holds data for a SigEvent
+//---------------------------------------------------------
+class LMasterSigEventItem : public LMasterLViewItem {
+
+ private:
+ const SigEvent* sigEvent;
+
+ public:
+ LMasterSigEventItem(Q3ListView* parent, const SigEvent* s);
+ virtual LMASTER_LVTYPE getType() { return LMASTER_SIGEVENT; }
+ const SigEvent* getEvent() { return sigEvent; }
+ virtual unsigned tick() { return sigEvent->tick; }
+ int z() { return sigEvent->z; }
+ int n() { return sigEvent->n; }
+ };
+
+
+//---------------------------------------------------------
+// LMaster
+//---------------------------------------------------------
+
+class LMaster : public MidiEditor {
+ Q3ListView* view;
+ Q3ToolBar* tools;
+ Q3PopupMenu* menuEdit;
+
+ enum { CMD_DELETE, CMD_INSERT_SIG, CMD_INSERT_TEMPO, CMD_EDIT_BEAT, CMD_EDIT_VALUE };
+
+ Q_OBJECT
+ virtual void closeEvent(QCloseEvent*);
+ void updateList();
+ void insertTempo(const TEvent*);
+ void insertSig(const SigEvent*);
+ LMasterLViewItem* getItemAtPos(unsigned tick, LMASTER_LVTYPE t);
+ void initShortcuts();
+ QLineEdit* editor;
+ PosEdit* pos_editor;
+ // State-like members:
+ LMasterLViewItem* editedItem;
+ SigEdit* sig_editor;
+ int editorColumn;
+ bool editingNewItem;
+
+ private slots:
+ void select(Q3ListViewItem*);
+ void itemDoubleClicked(Q3ListViewItem* item);
+ void returnPressed();
+ void itemPressed(Q3ListViewItem* i, const QPoint& p, int column);
+ void tempoButtonClicked();
+ void timeSigButtonClicked();
+ void cmd(int cmd);
+
+ public slots:
+ void songChanged(int);
+ void configChanged();
+
+ signals:
+ void deleted(unsigned long);
+
+ public:
+ LMaster();
+ ~LMaster();
+ virtual void readStatus(Xml&);
+ virtual void writeStatus(int, Xml&) const;
+ LMasterLViewItem* getLastOfType(LMASTER_LVTYPE t);
+ };
+
+
+#endif
+
diff --git a/muse2/muse/master/master.cpp b/muse2/muse/master/master.cpp
new file mode 100644
index 00000000..65204bef
--- /dev/null
+++ b/muse2/muse/master/master.cpp
@@ -0,0 +1,341 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: master.cpp,v 1.3 2004/04/11 13:03:32 wschweer Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <values.h>
+
+#include <qlineedit.h>
+#include <q3popupmenu.h>
+#include <qpainter.h>
+#include <q3header.h>
+#include <qcursor.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QEvent>
+
+#include "globals.h"
+#include "master.h"
+#include "song.h"
+#include "scrollscale.h"
+#include "midi.h"
+#include "midieditor.h"
+#include "icons.h"
+#include "audio.h"
+
+extern void drawTickRaster(QPainter& p, int x, int y,
+ int w, int h, int quant);
+
+//---------------------------------------------------------
+// Master
+//---------------------------------------------------------
+
+Master::Master(MidiEditor* e, QWidget* parent, int xmag, int ymag)
+ : View(parent, xmag, ymag)
+ {
+ editor = e;
+ setBg(Qt::white);
+ vscroll = 0;
+ pos[0] = 0;
+ pos[1] = 0;
+ pos[2] = 0;
+ setMouseTracking(true);
+ connect(song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool)));
+ connect(song, SIGNAL(songChanged(int)), this, SLOT(redraw()));
+ }
+
+//---------------------------------------------------------
+// setPos
+//---------------------------------------------------------
+
+void Master::setPos(int idx, unsigned val, bool adjustScrollbar)
+ {
+ if (pos[idx] == val)
+ return;
+
+ int opos = mapx(pos[idx]);
+ int npos = mapx(val);
+
+ if (adjustScrollbar && idx == 0) {
+ switch (song->follow()) {
+ case Song::NO:
+ break;
+ case Song::JUMP:
+ if (npos >= width()) {
+ int ppos = val - rmapxDev(width()/8);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ else if (npos < 0) {
+ int ppos = val - rmapxDev(width()*3/4);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ break;
+ case Song::CONTINUOUS:
+ if (npos > (width()/2)) {
+ int ppos = pos[idx] - rmapxDev(width()/2);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ else if (npos < (width()/2)) {
+ int ppos = pos[idx] - rmapxDev(width()/2);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ break;
+ }
+ }
+
+ int x;
+ int w = 1;
+ if (opos > npos) {
+ w += opos - npos;
+ x = npos;
+ }
+ else {
+ w += npos - opos;
+ x = opos;
+ }
+ pos[idx] = val;
+ redraw(QRect(x-1, 0, w+2, height()));
+ }
+
+//---------------------------------------------------------
+// leaveEvent
+//---------------------------------------------------------
+
+void Master::leaveEvent(QEvent*)
+ {
+ emit tempoChanged(-1);
+ emit timeChanged(MAXINT);
+ }
+
+//---------------------------------------------------------
+// pdraw
+//---------------------------------------------------------
+
+void Master::pdraw(QPainter& p, const QRect& rect)
+ {
+ View::pdraw(p, rect); // calls draw()
+ p.resetXForm();
+
+ int x = rect.x();
+ int y = rect.y();
+ int w = rect.width() + 2;
+ int h = rect.height();
+
+ int wh = height();
+ //---------------------------------------------------
+ // draw Canvas Items
+ //---------------------------------------------------
+
+ const TempoList* tl = &tempomap;
+ for (ciTEvent i = tl->begin(); i != tl->end(); ++i) {
+ TEvent* e = i->second;
+ int etick = mapx(i->first);
+ int stick = mapx(i->second->tick);
+ int tempo = mapy(280000 - int(60000000000.0/(e->tempo)));
+
+ if (tempo < 0)
+ tempo = 0;
+ if (tempo < wh) {
+ p.fillRect(stick, tempo, etick-stick, wh, Qt::blue);
+ }
+ }
+
+ //---------------------------------------------------
+ // draw marker
+ //---------------------------------------------------
+
+ int xp = mapx(pos[0]);
+ if (xp >= x && xp < x+w) {
+ p.setPen(Qt::red);
+ p.drawLine(xp, y, xp, y+h);
+ }
+ xp = mapx(pos[1]);
+ if (xp >= x && xp < x+w) {
+ p.setPen(Qt::blue);
+ p.drawLine(xp, y, xp, y+h);
+ }
+ xp = mapx(pos[2]);
+ if (xp >= x && xp < x+w) {
+ p.setPen(Qt::blue);
+ p.drawLine(xp, y, xp, y+h);
+ }
+ }
+
+//---------------------------------------------------------
+// draw
+//---------------------------------------------------------
+
+void Master::draw(QPainter& p, const QRect& rect)
+ {
+ drawTickRaster(p, rect.x(), rect.y(),
+ rect.width(), rect.height(), 0);
+ }
+
+//---------------------------------------------------------
+// viewMousePressEvent
+//---------------------------------------------------------
+
+void Master::viewMousePressEvent(QMouseEvent* event)
+ {
+ start = event->pos();
+ Tool activeTool = tool;
+// bool shift = event->state() & ShiftButton;
+
+ switch (activeTool) {
+ case PointerTool:
+ drag = DRAG_LASSO_START;
+ break;
+
+ case PencilTool:
+ drag = DRAG_NEW;
+ song->startUndo();
+ newVal(start.x(), start.x(), start.y());
+ break;
+
+ case RubberTool:
+ drag = DRAG_DELETE;
+ song->startUndo();
+ deleteVal(start.x(), start.x());
+ break;
+
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// viewMouseMoveEvent
+//---------------------------------------------------------
+
+void Master::viewMouseMoveEvent(QMouseEvent* event)
+ {
+ QPoint pos = event->pos();
+// QPoint dist = pos - start;
+// bool moving = dist.y() >= 3 || dist.y() <= 3 || dist.x() >= 3 || dist.x() <= 3;
+
+ switch (drag) {
+ case DRAG_NEW:
+ newVal(start.x(), pos.x(), pos.y());
+ start = pos;
+ break;
+
+ case DRAG_DELETE:
+ deleteVal(start.x(), pos.x());
+ start = pos;
+ break;
+
+ default:
+ break;
+ }
+ emit tempoChanged(280000 - event->y());
+ int x = pos.x();
+ if (x < 0)
+ x = 0;
+ emit timeChanged(editor->rasterVal(x));
+ }
+
+//---------------------------------------------------------
+// viewMouseReleaseEvent
+//---------------------------------------------------------
+
+void Master::viewMouseReleaseEvent(QMouseEvent*)
+ {
+ switch (drag) {
+ case DRAG_RESIZE:
+ case DRAG_NEW:
+ case DRAG_DELETE:
+ song->endUndo(SC_TEMPO);
+ break;
+ default:
+ break;
+ }
+ drag = DRAG_OFF;
+ }
+
+//---------------------------------------------------------
+// deleteVal
+//---------------------------------------------------------
+
+bool Master::deleteVal1(unsigned int x1, unsigned int x2)
+ {
+ bool songChanged = false;
+
+ TempoList* tl = &tempomap;
+ for (iTEvent i = tl->begin(); i != tl->end(); ++i) {
+ if (i->first < x1)
+ continue;
+ if (i->first >= x2)
+ break;
+ iTEvent ii = i;
+ ++ii;
+ if (ii != tl->end()) {
+ int tempo = ii->second->tempo;
+ audio->msgDeleteTempo(i->first, tempo, false);
+ songChanged = true;
+ }
+ }
+ return songChanged;
+ }
+
+void Master::deleteVal(int x1, int x2)
+ {
+ if (deleteVal1(editor->rasterVal1(x1), x2))
+ redraw();
+ }
+
+//---------------------------------------------------------
+// setTool
+//---------------------------------------------------------
+
+void Master::setTool(int t)
+ {
+ if (tool == Tool(t))
+ return;
+ tool = Tool(t);
+ switch(tool) {
+ case PencilTool:
+ setCursor(QCursor(*pencilIcon, 4, 15));
+ break;
+ default:
+ setCursor(QCursor(Qt::arrowCursor));
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// newVal
+//---------------------------------------------------------
+
+void Master::newVal(int x1, int x2, int y)
+ {
+ int xx1 = editor->rasterVal1(x1);
+ int xx2 = editor->rasterVal2(x2);
+
+ if (xx1 > xx2) {
+ int tmp = xx2;
+ xx2 = xx1;
+ xx1 = tmp;
+ }
+ deleteVal1(xx1, xx2);
+ audio->msgAddTempo(xx1, int(60000000000.0/(280000 - y)), false);
+ redraw();
+ }
diff --git a/muse2/muse/master/master.h b/muse2/muse/master/master.h
new file mode 100644
index 00000000..ee5bfd21
--- /dev/null
+++ b/muse2/muse/master/master.h
@@ -0,0 +1,69 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: master.h,v 1.3 2004/04/11 13:03:32 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MASTER_H__
+#define __MASTER_H__
+
+#include <qpoint.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QEvent>
+
+#include "view.h"
+#include "song.h"
+#include "tools.h"
+
+class ScrollScale;
+class QPainter;
+class QRect;
+class MidiEditor;
+
+//---------------------------------------------------------
+// Master
+//---------------------------------------------------------
+
+class Master : public View {
+ enum DragMode { DRAG_OFF, DRAG_NEW, DRAG_MOVE_START, DRAG_MOVE,
+ DRAG_DELETE, DRAG_COPY_START, DRAG_COPY,
+ DRAG_RESIZE, DRAG_LASSO_START, DRAG_LASSO
+ };
+ ScrollScale* vscroll;
+ unsigned pos[3];
+ QPoint start;
+ Tool tool;
+ DragMode drag;
+ MidiEditor* editor;
+
+ Q_OBJECT
+ virtual void pdraw(QPainter&, const QRect&);
+ virtual void viewMouseMoveEvent(QMouseEvent* event);
+ virtual void leaveEvent(QEvent*e);
+ virtual void viewMousePressEvent(QMouseEvent* event);
+ virtual void viewMouseReleaseEvent(QMouseEvent*);
+
+ void draw(QPainter&, const QRect&);
+ void newVal(int x1, int x2, int y);
+ bool deleteVal1(unsigned int x1, unsigned int x2);
+ void deleteVal(int x1, int x2);
+
+ signals:
+ void followEvent(int);
+ void xposChanged(int);
+ void yposChanged(int);
+ void timeChanged(unsigned);
+ void tempoChanged(int);
+
+ public slots:
+ void setPos(int, unsigned, bool adjustScrollbar);
+ void setTool(int t);
+
+ public:
+ Master(MidiEditor*, QWidget* parent, int xmag, int ymag);
+ };
+
+#endif
+
diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp
new file mode 100644
index 00000000..ef8abde8
--- /dev/null
+++ b/muse2/muse/master/masteredit.cpp
@@ -0,0 +1,403 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: masteredit.cpp,v 1.4.2.5 2009/07/01 22:14:56 spamatica Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "masteredit.h"
+#include "mtscale.h"
+#include "hitscale.h"
+#include "sigscale.h"
+#include "scrollscale.h"
+#include "poslabel.h"
+#include "master.h"
+#include "utils.h"
+#include "tscale.h"
+#include "tempolabel.h"
+#include "xml.h"
+#include "lcombo.h"
+#include "doublelabel.h"
+#include "sigedit.h"
+#include "globals.h"
+
+#include <values.h>
+#include <q3toolbar.h>
+#include <qtoolbutton.h>
+#include <qtooltip.h>
+#include <q3accel.h>
+#include <qlayout.h>
+#include <q3hbox.h>
+#include <qsizegrip.h>
+#include <qscrollbar.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <q3buttongroup.h>
+#include <q3listbox.h>
+#include <qcombobox.h>
+#include <q3header.h>
+#include <q3popupmenu.h>
+#include <qmenubar.h>
+#include <qaction.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+
+int MasterEdit::_rasterInit = 0;
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void MasterEdit::closeEvent(QCloseEvent* e)
+ {
+ emit deleted((unsigned long)this);
+ e->accept();
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void MasterEdit::songChanged(int type)
+ {
+ if (type & SC_TEMPO) {
+ int tempo = tempomap.tempo(song->cpos());
+ curTempo->blockSignals(true);
+ curTempo->setValue(double(60000000.0/tempo));
+
+ curTempo->blockSignals(false);
+ }
+ if (type & SC_SIG) {
+ int z, n;
+ sigmap.timesig(song->cpos(), z, n);
+ curSig->blockSignals(true);
+ curSig->setValue(Sig(z, n));
+ curSig->blockSignals(false);
+ sign->redraw();
+ }
+ if (type & SC_MASTER) {
+ enableButton->blockSignals(true);
+ enableButton->setOn(song->masterFlag());
+ enableButton->blockSignals(false);
+ }
+ }
+
+//---------------------------------------------------------
+// MasterEdit
+//---------------------------------------------------------
+
+MasterEdit::MasterEdit()
+ : MidiEditor(0, _rasterInit, 0)
+ {
+ setCaption(tr("MusE: Mastertrack"));
+ _raster = 0; // measure
+ setMinimumSize(400, 300);
+ resize(500, 350);
+
+ //---------Pulldown Menu----------------------------
+// QPopupMenu* file = new QPopupMenu(this);
+// menuBar()->insertItem("&File", file);
+
+ //---------ToolBar----------------------------------
+ tools = new Q3ToolBar(tr("edit tools"), this);
+ undoRedo->addTo(tools);
+
+ EditToolBar* tools2 = new EditToolBar(this,
+ PointerTool | PencilTool | RubberTool);
+
+ Q3ToolBar* enableMaster = new Q3ToolBar(tr("EnableMaster"), this);
+ enableButton = new QToolButton(enableMaster);
+ enableButton->setToggleButton(true);
+ enableButton->setText(tr("Enable"));
+ QToolTip::add(enableButton, tr("Enable usage of master track"));
+ enableButton->setOn(song->masterFlag());
+ connect(enableButton, SIGNAL(toggled(bool)), song, SLOT(setMasterFlag(bool)));
+
+ Q3ToolBar* info = new Q3ToolBar(tr("Info"), this);
+ QLabel* label = new QLabel(tr("Cursor"), info);
+ label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ label->setIndent(3);
+
+ cursorPos = new PosLabel(info);
+ tempo = new TempoLabel(info);
+
+ const char* rastval[] = {
+ QT_TR_NOOP("Off"), "Bar", "1/2", "1/4", "1/8", "1/16"
+ };
+ rasterLabel = new LabelCombo(tr("Snap"), info);
+ rasterLabel->setFocusPolicy(Qt::NoFocus);
+ for (int i = 0; i < 6; i++)
+ rasterLabel->insertItem(tr(rastval[i]), i);
+ rasterLabel->setCurrentItem(1);
+ connect(rasterLabel, SIGNAL(activated(int)), SLOT(_setRaster(int)));
+
+ QToolTip::add(cursorPos, tr("time at cursor position"));
+ QToolTip::add(tempo, tr("tempo at cursor position"));
+
+ //---------values for current position---------------
+ new QLabel(tr("CurPos "), info);
+ curTempo = new TempoEdit(info);
+ curSig = new SigEdit(info);
+ curSig->setValue(Sig(4, 4));
+ QToolTip::add(curTempo, tr("tempo at current position"));
+ QToolTip::add(curSig, tr("time signature at current position"));
+ connect(curSig, SIGNAL(valueChanged(int,int)), song, SLOT(setSig(int,int)));
+ connect(curTempo, SIGNAL(valueChanged(double)), song, SLOT(setTempo(double)));
+
+ //---------------------------------------------------
+ // master
+ //---------------------------------------------------
+
+ int xscale = -20;
+ int yscale = -500;
+ hscroll = new ScrollScale(-100, -2, xscale, song->len(), Qt::Horizontal, mainw);
+ vscroll = new ScrollScale(-1000, -100, yscale, 120000, Qt::Vertical, mainw);
+ vscroll->setRange(30000, 250000);
+ time1 = new MTScale(&_raster, mainw, xscale);
+ sign = new SigScale(&_raster, mainw, xscale);
+// thits = new HitScale(&_raster, mainw, xscale);
+
+ canvas = new Master(this, mainw, xscale, yscale);
+
+// zhits = new HitScale(&_raster, mainw, xscale);
+ time2 = new MTScale(&_raster, mainw, xscale);
+ tscale = new TScale(mainw, yscale);
+ time2->setBarLocator(true);
+
+ //---------------------------------------------------
+ // Rest
+ //---------------------------------------------------
+
+// QSizeGrip* corner = new QSizeGrip(mainw);
+
+ mainGrid->setRowStretch(5, 100);
+ mainGrid->setColStretch(1, 100);
+
+ mainGrid->addWidget(hLine(mainw), 0, 1);
+ mainGrid->addWidget(time1, 1, 1);
+ mainGrid->addWidget(hLine(mainw), 2, 1);
+ mainGrid->addWidget(sign, 3, 1);
+ mainGrid->addWidget(hLine(mainw), 4, 1);
+// mainGrid->addWidget(thits, 5, 1);
+// mainGrid->addWidget(hLine(mainw), 6, 1);
+ mainGrid->addWidget(canvas, 5, 1);
+ mainGrid->addWidget(tscale, 5, 0);
+ mainGrid->addWidget(hLine(mainw), 6, 1);
+// mainGrid->addWidget(zhits, 9, 1);
+// mainGrid->addWidget(hLine(mainw), 7, 1);
+ mainGrid->addWidget(time2, 7, 1);
+ mainGrid->addWidget(hscroll, 8, 1);
+ mainGrid->addMultiCellWidget(vscroll, 0, 9, 2, 2);
+// mainGrid->addWidget(corner, 9, 2, AlignBottom | AlignRight);
+
+ connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int)));
+ connect(vscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setYPos(int)));
+ connect(vscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setYMag(int)));
+
+ connect(vscroll, SIGNAL(scrollChanged(int)), tscale, SLOT(setYPos(int)));
+ connect(vscroll, SIGNAL(scaleChanged(int)), tscale, SLOT(setYMag(int)));
+
+ connect(hscroll, SIGNAL(scrollChanged(int)), time1, SLOT(setXPos(int)));
+ connect(hscroll, SIGNAL(scrollChanged(int)), sign, SLOT(setXPos(int)));
+// connect(hscroll, SIGNAL(scrollChanged(int)), thits, SLOT(setXPos(int)));
+ connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int)));
+// connect(hscroll, SIGNAL(scrollChanged(int)), zhits, SLOT(setXPos(int)));
+ connect(hscroll, SIGNAL(scrollChanged(int)), time2, SLOT(setXPos(int)));
+
+ connect(hscroll, SIGNAL(scaleChanged(int)), time1, SLOT(setXMag(int)));
+ connect(hscroll, SIGNAL(scaleChanged(int)), sign, SLOT(setXMag(int)));
+// connect(hscroll, SIGNAL(scaleChanged(int)), thits, SLOT(setXMag(int)));
+ connect(hscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setXMag(int)));
+// connect(hscroll, SIGNAL(scaleChanged(int)), zhits, SLOT(setXMag(int)));
+ connect(hscroll, SIGNAL(scaleChanged(int)), time2, SLOT(setXMag(int)));
+
+ connect(time1, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
+// connect(sign, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
+// connect(thits, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
+// connect(canvas, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
+// connect(zhits, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
+ connect(time2, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
+
+ connect(tscale, SIGNAL(tempoChanged(int)), SLOT(setTempo(int)));
+ connect(canvas, SIGNAL(tempoChanged(int)), SLOT(setTempo(int)));
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ connect(song, SIGNAL(posChanged(int,unsigned,bool)), SLOT(posChanged(int,unsigned,bool)));
+
+ connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int)));
+ connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
+ }
+
+//---------------------------------------------------------
+// ~MasterEdit
+//---------------------------------------------------------
+
+MasterEdit::~MasterEdit()
+ {
+ undoRedo->removeFrom(tools);
+ }
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void MasterEdit::readStatus(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "midieditor")
+ MidiEditor::readStatus(xml);
+ else if (tag == "ypos")
+ vscroll->setPos(xml.parseInt());
+ else if (tag == "ymag") {
+ // vscroll->setMag(xml.parseInt());
+ int mag = xml.parseInt();
+ vscroll->setMag(mag);
+ }
+ else
+ xml.unknown("MasterEdit");
+ break;
+ case Xml::TagEnd:
+ if (tag == "master") {
+ // raster setzen
+ int item = 0;
+ switch(_raster) {
+ case 1: item = 0; break;
+ case 0: item = 1; break;
+ case 768: item = 2; break;
+ case 384: item = 3; break;
+ case 192: item = 4; break;
+ case 96: item = 5; break;
+ }
+ _rasterInit = _raster;
+ rasterLabel->setCurrentItem(item);
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void MasterEdit::writeStatus(int level, Xml& xml) const
+ {
+ xml.tag(level++, "master");
+ xml.intTag(level, "ypos", vscroll->pos());
+ xml.intTag(level, "ymag", vscroll->mag());
+ MidiEditor::writeStatus(level, xml);
+ xml.tag(level, "/master");
+ }
+
+//---------------------------------------------------------
+// readConfiguration
+//---------------------------------------------------------
+
+void MasterEdit::readConfiguration(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "raster")
+ _rasterInit = xml.parseInt();
+ else
+ xml.unknown("MasterEdit");
+ break;
+ case Xml::TagEnd:
+ if (tag == "masteredit")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// writeConfiguration
+//---------------------------------------------------------
+
+void MasterEdit::writeConfiguration(int level, Xml& xml)
+ {
+ xml.tag(level++, "masteredit");
+ xml.intTag(level, "raster", _rasterInit);
+ xml.tag(level, "/masteredit");
+ }
+
+//---------------------------------------------------------
+// _setRaster
+//---------------------------------------------------------
+
+void MasterEdit::_setRaster(int index)
+ {
+ static int rasterTable[] = {
+ 1, 0, 768, 384, 192, 96
+ };
+ _raster = rasterTable[index];
+ _rasterInit = _raster;
+ }
+
+//---------------------------------------------------------
+// posChanged
+//---------------------------------------------------------
+
+void MasterEdit::posChanged(int idx, unsigned val, bool)
+ {
+ if (idx == 0) {
+ int z, n;
+ int tempo = tempomap.tempo(val);
+ sigmap.timesig(val, z, n);
+ curTempo->blockSignals(true);
+ curSig->blockSignals(true);
+
+ curTempo->setValue(double(60000000.0/tempo));
+ curSig->setValue(Sig(z, n));
+
+ curTempo->blockSignals(false);
+ curSig->blockSignals(false);
+ }
+ }
+
+//---------------------------------------------------------
+// setTime
+//---------------------------------------------------------
+
+void MasterEdit::setTime(unsigned tick)
+ {
+ if (tick == MAXINT)
+ cursorPos->setEnabled(false);
+ else {
+ cursorPos->setEnabled(true);
+ cursorPos->setValue(tick);
+ time1->setPos(3, tick, false);
+ time2->setPos(3, tick, false);
+ }
+ }
+
+//---------------------------------------------------------
+// setTempo
+//---------------------------------------------------------
+
+void MasterEdit::setTempo(int val)
+ {
+ if (val == -1)
+ tempo->setEnabled(false);
+ else {
+ tempo->setEnabled(true);
+ tempo->setValue(val);
+ }
+ }
+
diff --git a/muse2/muse/master/masteredit.h b/muse2/muse/master/masteredit.h
new file mode 100644
index 00000000..88ada6eb
--- /dev/null
+++ b/muse2/muse/master/masteredit.h
@@ -0,0 +1,83 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: masteredit.h,v 1.3.2.2 2009/04/01 01:37:11 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MASTER_EDIT_H__
+#define __MASTER_EDIT_H__
+
+#include <qwidget.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+#include "midieditor.h"
+#include "noteinfo.h"
+#include "cobject.h"
+#include <q3mainwindow.h>
+
+class QToolButton;
+class Master;
+class ScrollScale;
+class MTScale;
+class SigScale;
+class HitScale;
+class TScale;
+class TempoEdit;
+class SigEdit;
+class LabelCombo;
+class PosLabel;
+class TempoLabel;
+
+//---------------------------------------------------------
+// MasterEdit
+//---------------------------------------------------------
+
+class MasterEdit : public MidiEditor {
+ Master* canvas;
+ ScrollScale* hscroll;
+ ScrollScale* vscroll;
+ MTScale* time1;
+ MTScale* time2;
+ SigScale* sign;
+ HitScale* thits;
+ HitScale* zhits;
+ TScale* tscale;
+
+ TempoEdit* curTempo;
+ SigEdit* curSig;
+ LabelCombo* rasterLabel;
+ Q3ToolBar* tools;
+ PosLabel* cursorPos;
+ TempoLabel* tempo;
+ QToolButton* enableButton;
+
+ static int _rasterInit;
+
+ Q_OBJECT
+ virtual void closeEvent(QCloseEvent*);
+
+ private slots:
+ void _setRaster(int);
+ void posChanged(int,unsigned,bool);
+ void setTime(unsigned);
+ void setTempo(int);
+
+ public slots:
+ void songChanged(int);
+// void tempoChanged(double);
+
+ signals:
+ void deleted(unsigned long);
+
+ public:
+ MasterEdit();
+ ~MasterEdit();
+ virtual void readStatus(Xml&);
+ virtual void writeStatus(int, Xml&) const;
+ static void readConfiguration(Xml&);
+ static void writeConfiguration(int, Xml&);
+ };
+
+#endif
+
diff --git a/muse2/muse/master/tscale.cpp b/muse2/muse/master/tscale.cpp
new file mode 100644
index 00000000..e31af92c
--- /dev/null
+++ b/muse2/muse/master/tscale.cpp
@@ -0,0 +1,61 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: tscale.cpp,v 1.2 2003/12/17 11:04:14 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include "tscale.h"
+#include "globals.h"
+#include "gconfig.h"
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QEvent>
+
+//---------------------------------------------------------
+// TScale
+//---------------------------------------------------------
+
+TScale::TScale(QWidget* parent, int ymag)
+ : View(parent, 1, ymag)
+ {
+ setFont(config.fonts[3]);
+ int w = 4 * QFontMetrics(config.fonts[4]).width('0');
+ setFixedWidth(w);
+ setMouseTracking(true);
+ }
+
+//---------------------------------------------------------
+// draw
+//---------------------------------------------------------
+
+void TScale::pdraw(QPainter& p, const QRect& r)
+ {
+ int y = r.y();
+ int h = r.height();
+ p.setFont(config.fonts[4]);
+ QString s;
+ for (int i = 30000; i <= 250000; i += 10000) {
+ int yy = mapy(280000 - i);
+ if (yy < y)
+ break;
+ if (yy-15 > y+h)
+ continue;
+ p.drawLine(0, yy, width(), yy);
+ s.setNum(i/1000);
+ QFontMetrics fm(config.fonts[4]);
+ p.drawText(width() - fm.width(s) - 1, yy-2, s);
+ }
+ }
+
+void TScale::viewMouseMoveEvent(QMouseEvent* event)
+ {
+ emit tempoChanged(280000 - event->y());
+ }
+
+void TScale::leaveEvent(QEvent*)
+ {
+ emit tempoChanged(-1);
+ }
+
diff --git a/muse2/muse/master/tscale.h b/muse2/muse/master/tscale.h
new file mode 100644
index 00000000..08f91c7e
--- /dev/null
+++ b/muse2/muse/master/tscale.h
@@ -0,0 +1,38 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: tscale.h,v 1.1.1.1 2003/10/27 18:52:36 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __TSCALE_H__
+#define __TSCALE_H__
+
+#include "view.h"
+//Added by qt3to4:
+#include <QEvent>
+#include <QMouseEvent>
+
+//---------------------------------------------------------
+// Tscale
+//---------------------------------------------------------
+
+class TScale : public View {
+ double curTempo;
+ Q_OBJECT
+
+ virtual void viewMouseMoveEvent(QMouseEvent* event);
+ virtual void leaveEvent(QEvent*e);
+
+ protected:
+ virtual void pdraw(QPainter&, const QRect&);
+
+ signals:
+ void tempoChanged(int);
+
+ public:
+ TScale(QWidget*, int);
+ };
+
+#endif
+
diff --git a/muse2/muse/memory.cpp b/muse2/muse/memory.cpp
new file mode 100644
index 00000000..6a5b5c0c
--- /dev/null
+++ b/muse2/muse/memory.cpp
@@ -0,0 +1,100 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: memory.cpp,v 1.1.1.1.2.2 2009/12/19 23:35:39 spamatica Exp $
+//
+// (C) Copyright 2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "memory.h"
+
+Pool audioRTmemoryPool;
+Pool midiRTmemoryPool;
+
+//---------------------------------------------------------
+// Pool
+//---------------------------------------------------------
+
+Pool::Pool()
+ {
+ for (int idx = 0; idx < dimension; ++idx) {
+ head[idx] = 0;
+ chunks[idx] = 0;
+ grow(idx); // preallocate
+ }
+ }
+
+//---------------------------------------------------------
+// ~Pool
+//---------------------------------------------------------
+
+Pool::~Pool()
+ {
+ for (int i = 0; i < dimension; ++i) {
+ Chunk* n = chunks[i];
+ while (n) {
+ Chunk* p = n;
+ n = n->next;
+ delete p;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// grow
+//---------------------------------------------------------
+
+void Pool::grow(int idx)
+ {
+// printf("grow memory idx %d\n", idx);
+
+ int esize = (idx+1) * sizeof(unsigned long);
+
+ Chunk* n = new Chunk;
+ n->next = chunks[idx];
+ chunks[idx] = n;
+
+ const int nelem = Chunk::size / esize;
+ char* start = n->mem;
+ char* last = &start[(nelem-1) * esize];
+
+ for (char* p = start; p < last; p += esize)
+ reinterpret_cast<Verweis*>(p)->next =
+ reinterpret_cast<Verweis*>(p + esize);
+ reinterpret_cast<Verweis*>(last)->next = 0;
+ head[idx] = reinterpret_cast<Verweis*>(start);
+ }
+
+
+#ifdef TEST
+//=========================================================
+// TEST
+//=========================================================
+
+struct mops {
+ char a, c;
+ int b;
+ mops(int x) : b(x) {}
+ };
+
+typedef std::list<struct mops, RTalloc<struct mops> > List;
+// typedef std::vector<struct mops> List;
+typedef List::iterator iList;
+
+//---------------------------------------------------------
+// main
+// 2.8 s normal 0.7 vector
+// 2.5 s RTalloc
+// 1.18 alle optimierungen (0.97)
+//---------------------------------------------------------
+
+int main()
+ {
+ List l;
+
+ for (int i = 0; i < 10000000; ++i)
+ l.push_back(mops(i));
+ return 0;
+ }
+#endif
+
diff --git a/muse2/muse/memory.h b/muse2/muse/memory.h
new file mode 100644
index 00000000..e2ffb150
--- /dev/null
+++ b/muse2/muse/memory.h
@@ -0,0 +1,180 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: memory.h,v 1.4.2.3 2009/12/15 22:08:50 spamatica Exp $
+//
+// (C) Copyright 2003-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MEMORY_H__
+#define __MEMORY_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <map>
+
+// most of the following code is based on examples
+// from Bjarne Stroustrup: "Die C++ Programmiersprache"
+
+//---------------------------------------------------------
+// Pool
+//---------------------------------------------------------
+
+class Pool {
+ struct Verweis {
+ Verweis* next;
+ };
+ struct Chunk {
+ enum { size = 4 * 1024 };
+ Chunk* next;
+ char mem[size];
+ };
+ enum { dimension = 21 };
+ Chunk* chunks[dimension];
+ Verweis* head[dimension];
+ Pool(Pool&);
+ void operator=(Pool&);
+ void grow(int idx);
+
+ public:
+ Pool();
+ ~Pool();
+ void* alloc(size_t n);
+ void free(void* b, size_t n);
+ };
+
+//---------------------------------------------------------
+// alloc
+//---------------------------------------------------------
+
+inline void* Pool::alloc(size_t n)
+ {
+ if (n == 0)
+ return 0;
+ int idx = ((n + sizeof(unsigned long) - 1) / sizeof(unsigned long)) - 1;
+ if (idx >= dimension) {
+ printf("panic: alloc %zd %d %d\n", n, idx, dimension);
+ exit(-1);
+ }
+ if (head[idx] == 0)
+ grow(idx);
+ Verweis* p = head[idx];
+ head[idx] = p->next;
+ return p;
+ }
+
+//---------------------------------------------------------
+// free
+//---------------------------------------------------------
+
+inline void Pool::free(void* b, size_t n)
+ {
+ if (b == 0 || n == 0)
+ return;
+ int idx = ((n + sizeof(unsigned long) - 1) / sizeof(unsigned long)) - 1;
+ if (idx >= dimension) {
+ printf("panic: free %zd %d %d\n", n, idx, dimension);
+ exit(-1);
+ }
+ Verweis* p = static_cast<Verweis*>(b);
+ p->next = head[idx];
+ head[idx] = p;
+ }
+
+extern Pool audioRTmemoryPool;
+extern Pool midiRTmemoryPool;
+
+//---------------------------------------------------------
+// audioRTalloc
+//---------------------------------------------------------
+
+template <class T> class audioRTalloc
+ {
+ public:
+ typedef T value_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ typedef T* pointer;
+ typedef const T* const_pointer;
+
+ typedef T& reference;
+ typedef const T& const_reference;
+
+ pointer address(reference x) const { return &x; }
+ const_pointer address(const_reference x) const { return &x; }
+
+ audioRTalloc();
+ template <class U> audioRTalloc(const audioRTalloc<U>&) {}
+ ~audioRTalloc() {}
+
+ pointer allocate(size_type n, void * = 0) {
+ return static_cast<T*>(audioRTmemoryPool.alloc(n * sizeof(T)));
+ }
+ void deallocate(pointer p, size_type n) {
+ audioRTmemoryPool.free(p, n * sizeof(T));
+ }
+
+ audioRTalloc<T>& operator=(const audioRTalloc&) { return *this; }
+ void construct(pointer p, const T& val) {
+ new ((T*) p) T(val);
+ }
+ void destroy(pointer p) {
+ p->~T();
+ }
+ size_type max_size() const { return size_t(-1); }
+
+ template <class U> struct rebind { typedef audioRTalloc<U> other; };
+ template <class U> audioRTalloc& operator=(const audioRTalloc<U>&) { return *this; }
+ };
+
+template <class T> audioRTalloc<T>::audioRTalloc() {}
+
+//---------------------------------------------------------
+// midiRTalloc
+//---------------------------------------------------------
+
+template <class T> class midiRTalloc
+ {
+ public:
+ typedef T value_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ typedef T* pointer;
+ typedef const T* const_pointer;
+
+ typedef T& reference;
+ typedef const T& const_reference;
+
+ pointer address(reference x) const { return &x; }
+ const_pointer address(const_reference x) const { return &x; }
+
+ midiRTalloc();
+ template <class U> midiRTalloc(const midiRTalloc<U>&) {}
+ ~midiRTalloc() {}
+
+ pointer allocate(size_type n, void * = 0) {
+ return static_cast<T*>(midiRTmemoryPool.alloc(n * sizeof(T)));
+ }
+ void deallocate(pointer p, size_type n) {
+ midiRTmemoryPool.free(p, n * sizeof(T));
+ }
+
+ midiRTalloc<T>& operator=(const midiRTalloc&) { return *this; }
+ void construct(pointer p, const T& val) {
+ new ((T*) p) T(val);
+ }
+ void destroy(pointer p) {
+ p->~T();
+ }
+ size_type max_size() const { return size_t(-1); }
+
+ template <class U> struct rebind { typedef midiRTalloc<U> other; };
+ template <class U> midiRTalloc& operator=(const midiRTalloc<U>&) { return *this; }
+ };
+
+template <class T> midiRTalloc<T>::midiRTalloc() {}
+
+#endif
+
diff --git a/muse2/muse/midi.cpp b/muse2/muse/midi.cpp
new file mode 100644
index 00000000..3ec40065
--- /dev/null
+++ b/muse2/muse/midi.cpp
@@ -0,0 +1,1542 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midi.cpp,v 1.43.2.22 2009/11/09 20:28:28 terminator356 Exp $
+//
+// (C) Copyright 1999/2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <cmath>
+#include <errno.h>
+#include <values.h>
+#include <assert.h>
+
+#include "song.h"
+#include "midi.h"
+#include "drummap.h"
+#include "event.h"
+#include "globals.h"
+#include "midictrl.h"
+#include "marker/marker.h"
+#include "midiport.h"
+#include "midictrl.h"
+#include "audio.h"
+#include "mididev.h"
+#include "driver/alsamidi.h"
+#include "driver/jackmidi.h"
+#include "wave.h"
+#include "synth.h"
+#include "sync.h"
+#include "midiseq.h"
+#include "gconfig.h"
+#include "ticksynth.h"
+
+extern void dump(const unsigned char* p, int n);
+
+const unsigned char gmOnMsg[] = { 0x7e, 0x7f, 0x09, 0x01 };
+const unsigned char gsOnMsg[] = { 0x41, 0x10, 0x42, 0x12, 0x40, 0x00, 0x7f, 0x00, 0x41 };
+const unsigned char gsOnMsg2[] = { 0x41, 0x10, 0x42, 0x12, 0x40, 0x01, 0x33, 0x50, 0x3c };
+const unsigned char gsOnMsg3[] = { 0x41, 0x10, 0x42, 0x12, 0x40, 0x01, 0x34, 0x50, 0x3b };
+const unsigned char xgOnMsg[] = { 0x43, 0x10, 0x4c, 0x00, 0x00, 0x7e, 0x00 };
+const unsigned int gmOnMsgLen = sizeof(gmOnMsg);
+const unsigned int gsOnMsgLen = sizeof(gsOnMsg);
+const unsigned int gsOnMsg2Len = sizeof(gsOnMsg2);
+const unsigned int gsOnMsg3Len = sizeof(gsOnMsg3);
+const unsigned int xgOnMsgLen = sizeof(xgOnMsg);
+
+const unsigned char mmcDeferredPlayMsg[] = { 0x7f, 0x7f, 0x06, 0x03 };
+const unsigned char mmcStopMsg[] = { 0x7f, 0x7f, 0x06, 0x01 };
+const unsigned char mmcLocateMsg[] = { 0x7f, 0x7f, 0x06, 0x44, 0x06, 0x01, 0, 0, 0, 0, 0 };
+
+const unsigned int mmcDeferredPlayMsgLen = sizeof(mmcDeferredPlayMsg);
+const unsigned int mmcStopMsgLen = sizeof(mmcStopMsg);
+const unsigned int mmcLocateMsgLen = sizeof(mmcLocateMsg);
+
+#define CALC_TICK(the_tick) lrintf((float(the_tick) * float(config.division) + float(div/2)) / float(div));
+/*---------------------------------------------------------
+ * midi_meta_name
+ *---------------------------------------------------------*/
+
+QString midiMetaName(int meta)
+ {
+ const char* s = "";
+ switch (meta) {
+ case 0: s = "Sequence Number"; break;
+ case 1: s = "Text Event"; break;
+ case 2: s = "Copyright"; break;
+ case 3: s = "Sequence/Track Name"; break;
+ case 4: s = "Instrument Name"; break;
+ case 5: s = "Lyric"; break;
+ case 6: s = "Marker"; break;
+ case 7: s = "Cue Point"; break;
+ case 8:
+ case 9:
+ case 0x0a:
+ case 0x0b:
+ case 0x0c:
+ case 0x0d:
+ case 0x0e:
+ case 0x0f: s = "Text"; break;
+ case 0x20: s = "Channel Prefix"; break;
+ case 0x21: s = "Port Change"; break;
+ case 0x2f: s = "End of Track"; break;
+ case 0x51: s = "Set Tempo"; break;
+ case 0x54: s = "SMPTE Offset"; break;
+ case 0x58: s = "Time Signature"; break;
+ case 0x59: s = "Key Signature"; break;
+ case 0x74: s = "Sequencer-Specific1"; break;
+ case 0x7f: s = "Sequencer-Specific2"; break;
+ default:
+ break;
+ }
+ return QString(s);
+ }
+
+//---------------------------------------------------------
+// QString nameSysex
+//---------------------------------------------------------
+
+QString nameSysex(unsigned int len, const unsigned char* buf)
+ {
+ QString s;
+ switch(buf[0]) {
+ case 0x00:
+ if (buf[1] == 0 && buf[2] == 0x41)
+ s = "Microsoft";
+ break;
+ case 0x01: s = "Sequential Circuits: "; break;
+ case 0x02: s = "Big Briar: "; break;
+ case 0x03: s = "Octave / Plateau: "; break;
+ case 0x04: s = "Moog: "; break;
+ case 0x05: s = "Passport Designs: "; break;
+ case 0x06: s = "Lexicon: "; break;
+ case 0x07: s = "Kurzweil"; break;
+ case 0x08: s = "Fender"; break;
+ case 0x09: s = "Gulbransen"; break;
+ case 0x0a: s = "Delta Labas"; break;
+ case 0x0b: s = "Sound Comp."; break;
+ case 0x0c: s = "General Electro"; break;
+ case 0x0d: s = "Techmar"; break;
+ case 0x0e: s = "Matthews Research"; break;
+ case 0x10: s = "Oberheim"; break;
+ case 0x11: s = "PAIA: "; break;
+ case 0x12: s = "Simmons: "; break;
+ case 0x13: s = "DigiDesign"; break;
+ case 0x14: s = "Fairlight: "; break;
+ case 0x15: s = "JL Cooper"; break;
+ case 0x16: s = "Lowery"; break;
+ case 0x17: s = "Lin"; break;
+ case 0x18: s = "Emu"; break;
+ case 0x1b: s = "Peavy"; break;
+ case 0x20: s = "Bon Tempi: "; break;
+ case 0x21: s = "S.I.E.L: "; break;
+ case 0x23: s = "SyntheAxe: "; break;
+ case 0x24: s = "Hohner"; break;
+ case 0x25: s = "Crumar"; break;
+ case 0x26: s = "Solton"; break;
+ case 0x27: s = "Jellinghaus Ms"; break;
+ case 0x28: s = "CTS"; break;
+ case 0x29: s = "PPG"; break;
+ case 0x2f: s = "Elka"; break;
+ case 0x36: s = "Cheetah"; break;
+ case 0x3e: s = "Waldorf"; break;
+ case 0x40: s = "Kawai: "; break;
+ case 0x41: s = "Roland: "; break;
+ case 0x42: s = "Korg: "; break;
+ case 0x43: s = "Yamaha: "; break;
+ case 0x44: s = "Casio"; break;
+ case 0x45: s = "Akai"; break;
+ case 0x7c: s = "MusE Soft Synth"; break;
+ case 0x7d: s = "Educational Use"; break;
+ case 0x7e: s = "Universal: Non Real Time"; break;
+ case 0x7f: s = "Universal: Real Time"; break;
+ default: s = "??: "; break;
+ }
+ //
+ // following messages should not show up in event list
+ // they are filtered while importing midi files
+ //
+ if ((len == gmOnMsgLen) && memcmp(buf, gmOnMsg, gmOnMsgLen) == 0)
+ s += "GM-ON";
+ else if ((len == gsOnMsgLen) && memcmp(buf, gsOnMsg, gsOnMsgLen) == 0)
+ s += "GS-ON";
+ else if ((len == xgOnMsgLen) && memcmp(buf, xgOnMsg, xgOnMsgLen) == 0)
+ s += "XG-ON";
+ return s;
+ }
+
+//---------------------------------------------------------
+// buildMidiEventList
+// TODO:
+// parse data increment/decrement controller
+// NRPN/RPN fine/course data 7/14 Bit
+// must we set datah/datal to zero after change
+// of NRPN/RPN register?
+// generally: how to handle incomplete messages
+//---------------------------------------------------------
+
+void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track,
+ int div, bool addSysexMeta, bool doLoops)
+ {
+ int hbank = 0xff;
+ int lbank = 0xff;
+ int rpnh = -1;
+ int rpnl = -1;
+ int datah = 0;
+ int datal = 0;
+ int dataType = 0; // 0 : disabled, 0x20000 : rpn, 0x30000 : nrpn
+
+ EventList mel;
+
+ for (iMPEvent i = el->begin(); i != el->end(); ++i) {
+ MidiPlayEvent ev = *i;
+ if (!addSysexMeta && (ev.type() == ME_SYSEX || ev.type() == ME_META))
+ continue;
+ if (!(ev.type() == ME_SYSEX || ev.type() == ME_META
+ || ((ev.channel() == track->outChannel()) && (ev.port() == track->outPort()))))
+ continue;
+ unsigned tick = ev.time();
+ // Added by Tim. p3.3.8
+
+ // Added by T356.
+ if(doLoops)
+ {
+ if(tick >= song->lPos().tick() && tick < song->rPos().tick())
+ {
+ int loopn = ev.loopNum();
+ int loopc = audio->loopCount();
+ int cmode = song->cycleMode(); // CYCLE_NORMAL, CYCLE_MIX, CYCLE_REPLACE
+ // If we want REPLACE and the event was recorded in a previous loop,
+ // just ignore it. This will effectively ignore ALL previous loop events inside
+ // the left and right markers, regardless of where recording was started or stopped.
+ // We want to keep any loop 0 note-offs from notes which crossed over the left marker.
+ // To avoid more searching here, just keep ALL note-offs from loop 0, and let code below
+ // sort out and keep which ones had note-ons.
+ if(!(ev.isNoteOff() && loopn == 0))
+ {
+ if(cmode == Song::CYCLE_REPLACE && loopn < loopc)
+ {
+ // Added by Tim. p3.3.8
+ //printf("buildMidiEventList: CYCLE_REPLACE t:%d type:%d A:%d B:%d ln:%d lc:%d\n", tick, ev.type(), ev.dataA(), ev.dataB(), loopn, loopc);
+
+ continue;
+ }
+ // If we want NORMAL, same as REPLACE except keep all events from the previous loop
+ // from rec stop position to right marker (and beyond).
+ if(cmode == Song::CYCLE_NORMAL)
+ {
+ // Not sure of accuracy here. Adjust? Adjusted when used elsewhere?
+ unsigned endRec = audio->getEndRecordPos().tick();
+ if((tick < endRec && loopn < loopc) || (tick >= endRec && loopn < (loopc - 1)))
+ {
+ // Added by Tim. p3.3.8
+ //printf("buildMidiEventList: CYCLE_NORMAL t:%d type:%d A:%d B:%d ln:%d lc:%d\n", tick, ev.type(), ev.dataA(), ev.dataB(), loopn, loopc);
+
+ continue;
+ }
+ }
+ }
+ }
+ }
+
+ Event e;
+ switch(ev.type()) {
+ case ME_NOTEON:
+ e.setType(Note);
+
+ if (track->type() == Track::DRUM) {
+ int instr = drumInmap[ev.dataA()];
+ e.setPitch(instr);
+ }
+ else
+ {
+ e.setPitch(ev.dataA());
+ }
+
+ e.setVelo(ev.dataB());
+ e.setLenTick(0);
+ break;
+ case ME_NOTEOFF:
+ e.setType(Note);
+ if (track->type() == Track::DRUM) {
+ int instr = drumInmap[ev.dataA()];
+ e.setPitch(instr);
+ }
+ else
+ e.setPitch(ev.dataA());
+ e.setVelo(0);
+ e.setVeloOff(ev.dataB());
+ e.setLenTick(0);
+ break;
+ case ME_POLYAFTER:
+ e.setType(PAfter);
+ e.setA(ev.dataA());
+ e.setB(ev.dataB());
+ break;
+ case ME_CONTROLLER:
+ {
+ int val = ev.dataB();
+ switch(ev.dataA()) {
+ case CTRL_HBANK:
+ hbank = val;
+ break;
+
+ case CTRL_LBANK:
+ lbank = val;
+ break;
+
+ case CTRL_HDATA:
+ datah = val;
+ // check if a CTRL_LDATA follows
+ // e.g. wie have a 14 bit controller:
+ {
+ iMPEvent ii = i;
+ ++ii;
+ bool found = false;
+ for (; ii != el->end(); ++ii) {
+ MidiPlayEvent ev = *ii;
+ if (ev.type() == ME_CONTROLLER) {
+ if (ev.dataA() == CTRL_LDATA) {
+ // handle later
+ found = true;
+ }
+ break;
+ }
+ }
+ if (!found) {
+ if (rpnh == -1 || rpnl == -1) {
+ printf("parameter number not defined, data 0x%x\n", datah);
+ }
+ else {
+ int ctrl = dataType | (rpnh << 8) | rpnl;
+ e.setType(Controller);
+ e.setA(ctrl);
+ e.setB(datah);
+ }
+ }
+ }
+ break;
+
+ case CTRL_LDATA:
+ datal = val;
+
+ if (rpnh == -1 || rpnl == -1) {
+ printf("parameter number not defined, data 0x%x 0x%x, tick %d, channel %d\n",
+ datah, datal, tick, track->outChannel());
+ break;
+ }
+ // assume that the sequence is always
+ // CTRL_HDATA - CTRL_LDATA
+ // eg. that LDATA is always send last
+
+ e.setType(Controller);
+ // 14 Bit RPN/NRPN
+ e.setA((dataType+0x30000) | (rpnh << 8) | rpnl);
+ e.setB((datah << 7) | datal);
+ break;
+
+ case CTRL_HNRPN:
+ rpnh = val;
+ dataType = 0x30000;
+ break;
+
+ case CTRL_LNRPN:
+ rpnl = val;
+ dataType = 0x30000;
+ break;
+
+ case CTRL_HRPN:
+ rpnh = val;
+ dataType = 0x20000;
+ break;
+
+ case CTRL_LRPN:
+ rpnl = val;
+ dataType = 0x20000;
+ break;
+
+ default:
+ e.setType(Controller);
+ int ctl = ev.dataA();
+ e.setA(ctl);
+
+ if(track->type() == Track::DRUM)
+ {
+ // Is it a drum controller event, according to the track port's instrument?
+ MidiController *mc = midiPorts[track->outPort()].drumController(ctl);
+ if(mc)
+ // Store an index into the drum map.
+ e.setA((ctl & ~0xff) | drumInmap[ctl & 0x7f]);
+ }
+
+ e.setB(val);
+ break;
+ }
+ }
+ break;
+
+ case ME_PROGRAM:
+ e.setType(Controller);
+ e.setA(CTRL_PROGRAM);
+ e.setB((hbank << 16) | (lbank << 8) | ev.dataA());
+ break;
+
+ case ME_AFTERTOUCH:
+ e.setType(CAfter);
+ e.setA(ev.dataA());
+ break;
+
+ case ME_PITCHBEND:
+ e.setType(Controller);
+ e.setA(CTRL_PITCH);
+ e.setB(ev.dataA());
+ break;
+
+ case ME_SYSEX:
+ e.setType(Sysex);
+ e.setData(ev.data(), ev.len());
+ break;
+
+ case ME_META:
+ {
+ const unsigned char* data = ev.data();
+ switch (ev.dataA()) {
+ case 0x01: // Text
+ if (track->comment().isEmpty())
+ track->setComment(QString((const char*)data));
+ else
+ track->setComment(track->comment() + "\n" + QString((const char*)data));
+ break;
+ case 0x03: // Sequence-/TrackName
+ track->setName(QString((char*)data));
+ break;
+ case 0x6: // Marker
+ {
+ unsigned ltick = CALC_TICK(tick);//(tick * config.division + div/2) / div;
+ song->addMarker(QString((const char*)(data)), ltick, false);
+ }
+ break;
+ case 0x5: // Lyrics
+ case 0x8: // text
+ case 0x9:
+ case 0xa:
+ break;
+
+ case 0x0f: // Track Comment
+ track->setComment(QString((char*)data));
+ break;
+ case 0x51: // Tempo
+ {
+ unsigned tempo = data[2] + (data[1] << 8) + (data[0] <<16);
+ unsigned ltick = CALC_TICK(tick);// (unsigned(tick) * unsigned(config.division) + unsigned(div/2)) / unsigned(div);
+ // After ca 10 mins 32 bits will not be enough... This expression has to be changed/factorized or so in some "sane" way...
+ tempomap.addTempo(ltick, tempo);
+ }
+ break;
+ case 0x58: // Time Signature
+ {
+ int timesig_z = data[0];
+ int n = data[1];
+ int timesig_n = 1;
+ for (int i = 0; i < n; i++)
+ timesig_n *= 2;
+ int ltick = CALC_TICK(tick);//(tick * config.division + div/2) / div;
+ sigmap.add(ltick, timesig_z, timesig_n);
+ }
+ break;
+ case 0x59: // Key Signature
+ // track->scale.set(data[0]);
+ // track->scale.setMajorMinor(data[1]);
+ break;
+ default:
+ printf("unknown Meta 0x%x %d\n", ev.dataA(), ev.dataA());
+ }
+ }
+ break;
+ } // switch(ev.type()
+ if (!e.empty()) {
+ e.setTick(tick);
+ // Added by Tim. p3.3.8
+ //printf("buildMidiEventList: mel adding t:%d type:%d A:%d B:%d C:%d\n", tick, e.type(), e.dataA(), e.dataB(), e.dataC());
+
+ mel.add(e);
+ }
+ } // i != el->end()
+
+ //---------------------------------------------------
+ // resolve NoteOff events
+ //---------------------------------------------------
+
+// for (iEvent i = mel.begin(); i != mel.end(); ++i) {
+// Event event = i->second;
+// if (event.isNote())
+// event.setLenTick(0);
+// }
+
+ // Added by Tim. p3.3.8
+
+ // The loop is a safe way to delete while iterating.
+ bool loop;
+ do
+ {
+ loop = false;
+
+ for (iEvent i = mel.begin(); i != mel.end(); ++i) {
+ Event ev = i->second;
+ if (ev.isNote()) {
+ if (ev.isNoteOff()) {
+ iEvent k;
+ bool found = false;
+ for (k = i; k != mel.end(); ++k) {
+ Event event = k->second;
+ if (event.tick() > ev.tick())
+ break;
+ if (event.isNoteOff(ev)) {
+ ev.setLenTick(1);
+ ev.setVelo(event.velo());
+ ev.setVeloOff(0);
+ // Added by Tim. p3.3.8
+ //printf("buildMidiEventList: found note off: event t:%d len:%d type:%d A:%d B:%d C:%d ev t:%d len:%d type:%d A:%d B:%d C:%d\n", event.tick(), event.lenTick(), event.type(), event.dataA(), event.dataB(), event.dataC(), ev.tick(), ev.lenTick(), ev.type(), ev.dataA(), ev.dataB(), ev.dataC());
+
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ printf("NOTE OFF without Note ON tick %d type %d %d %d\n",
+ ev.tick(), ev.type(), ev.pitch(), ev.velo());
+ }
+ else {
+ mel.erase(k);
+
+ // Changed by Tim. p3.3.8
+ //continue;
+ loop = true;
+ break;
+
+ }
+ }
+ // Added by Tim. p3.3.8
+
+ // If the event length is not zero, it means the event and its
+ // note on/off have already been taken care of. So ignore it.
+ if(ev.lenTick() != 0)
+ {
+ continue;
+ }
+
+ iEvent k;
+ for (k = mel.lower_bound(ev.tick()); k != mel.end(); ++k) {
+ Event event = k->second;
+ if (ev.isNoteOff(event)) {
+ int t = k->first - i->first;
+ if (t <= 0) {
+ if (debugMsg) {
+ printf("Note len is (%d-%d)=%d, set to 1\n",
+ k->first, i->first, k->first - i->first);
+ ev.dump();
+ event.dump();
+ }
+ t = 1;
+ }
+ ev.setLenTick(t);
+ ev.setVeloOff(event.veloOff());
+ // Added by Tim. p3.3.8
+ //printf("buildMidiEventList: set len and velOff: event t:%d len:%d type:%d A:%d B:%d C:%d ev t:%d len:%d type:%d A:%d B:%d C:%d\n", event.tick(), event.lenTick(), event.type(), event.dataA(), event.dataB(), event.dataC(), ev.tick(), ev.lenTick(), ev.type(), ev.dataA(), ev.dataB(), ev.dataC());
+
+ break;
+ }
+ }
+ if (k == mel.end()) {
+ printf("-no note-off! %d pitch %d velo %d\n",
+ ev.tick(), ev.pitch(), ev.velo());
+ //
+ // switch off at end of measure
+ //
+ int endTick = song->roundUpBar(ev.tick()+1);
+ ev.setLenTick(endTick-ev.tick());
+ }
+ else {
+ mel.erase(k);
+ // Added by Tim. p3.3.8
+ loop = true;
+ break;
+
+ }
+ }
+ }
+ }
+ while (loop);
+
+// DEBUG: any note offs left?
+
+ // Removed by Tim. p3.3.8
+ //for (iEvent i = mel.begin(); i != mel.end(); ++i) {
+ // Event ev = i->second;
+ // if (ev.isNoteOff()) {
+ // printf("+extra note-off! %d pitch %d velo %d\n",
+ // i->first, ev.pitch(), ev.velo());
+// ev.dump();
+ // }
+ // }
+
+ for (iEvent i = mel.begin(); i != mel.end(); ++i) {
+ Event ev = i->second;
+ if (ev.isNoteOff()) {
+ printf("+extra note-off! %d pitch %d velo %d\n",
+ i->first, ev.pitch(), ev.velo());
+// ev.dump();
+ continue;
+ }
+ int tick = CALC_TICK(ev.tick()); //(ev.tick() * config.division + div/2) / div;
+ if (ev.isNote()) {
+ int lenTick = CALC_TICK(ev.lenTick()); //(ev.lenTick() * config.division + div/2) / div;
+ ev.setLenTick(lenTick);
+ }
+ ev.setTick(tick);
+ del->add(ev);
+ }
+ }
+
+//---------------------------------------------------------
+// midiPortsChanged
+//---------------------------------------------------------
+
+void Audio::midiPortsChanged()
+ {
+ write(sigFd, "P", 1);
+ }
+
+//---------------------------------------------------------
+// sendLocalOff
+//---------------------------------------------------------
+
+void Audio::sendLocalOff()
+ {
+ for (int k = 0; k < MIDI_PORTS; ++k) {
+ for (int i = 0; i < MIDI_CHANNELS; ++i)
+ midiPorts[k].sendEvent(MidiPlayEvent(0, k, i, ME_CONTROLLER, CTRL_LOCAL_OFF, 0));
+ }
+ }
+
+//---------------------------------------------------------
+// panic
+//---------------------------------------------------------
+
+void Audio::panic()
+ {
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ MidiPort* port = &midiPorts[i];
+ if (port == 0) // ??
+ continue;
+ for (int chan = 0; chan < MIDI_CHANNELS; ++chan) {
+ port->sendEvent(MidiPlayEvent(0, i, chan, ME_CONTROLLER, CTRL_ALL_SOUNDS_OFF, 0));
+ port->sendEvent(MidiPlayEvent(0, i, chan, ME_CONTROLLER, CTRL_RESET_ALL_CTRL, 0));
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// initDevices
+// - called on seek to position 0
+// - called from arranger pulldown menu
+//---------------------------------------------------------
+
+void Audio::initDevices()
+ {
+ //
+ // mark all used ports
+ //
+ bool activePorts[MIDI_PORTS];
+ for (int i = 0; i < MIDI_PORTS; ++i)
+ activePorts[i] = false;
+
+ MidiTrackList* tracks = song->midis();
+ for (iMidiTrack it = tracks->begin(); it != tracks->end(); ++it) {
+ MidiTrack* track = *it;
+ activePorts[track->outPort()] = true;
+ }
+ if (song->click())
+ activePorts[clickPort] = true;
+
+ //
+ // test for explicit instrument initialization
+ //
+
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ if (!activePorts[i])
+ continue;
+
+ MidiPort* port = &midiPorts[i];
+ MidiInstrument* instr = port->instrument();
+ MidiDevice* md = port->device();
+
+ if (instr && md) {
+ EventList* events = instr->midiInit();
+ if (events->empty())
+ continue;
+ for (iEvent ie = events->begin(); ie != events->end(); ++ie) {
+ MidiPlayEvent ev(0, i, 0, ie->second);
+ md->putEvent(ev);
+ }
+ activePorts[i] = false; // no standard initialization
+ }
+ }
+ //
+ // damit Midi-Devices, die mehrere Ports besitzen, wie z.B.
+ // das Korg NS5R, nicht mehrmals zwischen GM und XG/GS hin und
+ // hergeschaltet werden, wird zunÃÂÂŊÂÂÂŋÃƒÂ‚Ã‚Â―hst auf allen Ports GM
+ // initialisiert, und dann erst XG/GS
+ //
+
+ // Standard initialization...
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ if (!activePorts[i])
+ continue;
+ MidiPort* port = &midiPorts[i];
+ switch(song->mtype()) {
+ case MT_GS:
+ case MT_UNKNOWN:
+ break;
+ case MT_GM:
+ case MT_XG:
+ port->sendGmOn();
+ break;
+ }
+ }
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ if (!activePorts[i])
+ continue;
+ MidiPort* port = &midiPorts[i];
+ switch(song->mtype()) {
+ case MT_UNKNOWN:
+ break;
+ case MT_GM:
+ port->sendGmInitValues();
+ break;
+ case MT_GS:
+ port->sendGsOn();
+ port->sendGsInitValues();
+ break;
+ case MT_XG:
+ port->sendXgOn();
+ port->sendXgInitValues();
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// collectEvents
+// collect events for next audio segment
+//---------------------------------------------------------
+
+void Audio::collectEvents(MidiTrack* track, unsigned int cts, unsigned int nts)
+ {
+ int port = track->outPort();
+ int channel = track->outChannel();
+ int defaultPort = port;
+
+ MidiDevice* md = midiPorts[port].device();
+ MPEventList* playEvents = md->playEvents();
+ MPEventList* stuckNotes = md->stuckNotes();
+
+ PartList* pl = track->parts();
+ for (iPart p = pl->begin(); p != pl->end(); ++p) {
+ MidiPart* part = (MidiPart*)(p->second);
+ // dont play muted parts
+ if (part->mute())
+ continue;
+ EventList* events = part->events();
+ unsigned partTick = part->tick();
+ unsigned partLen = part->lenTick();
+ int delay = track->delay;
+
+ if (cts > nts) {
+ printf("processMidi: FATAL: cur > next %d > %d\n",
+ cts, nts);
+ return;
+ }
+ unsigned offset = delay + partTick;
+ if (offset > nts)
+ continue;
+ unsigned stick = (offset > cts) ? 0 : cts - offset;
+ unsigned etick = nts - offset;
+ // By T356. Do not play events which are past the end of this part.
+ if(etick > partLen)
+ continue;
+
+ iEvent ie = events->lower_bound(stick);
+ iEvent iend = events->lower_bound(etick);
+
+ for (; ie != iend; ++ie) {
+ Event ev = ie->second;
+ port = defaultPort; //Reset each loop
+ //
+ // dont play any meta events
+ //
+ if (ev.type() == Meta)
+ continue;
+ if (track->type() == Track::DRUM) {
+ int instr = ev.pitch();
+ // ignore muted drums
+ if (ev.isNote() && drumMap[instr].mute)
+ continue;
+ }
+ unsigned tick = ev.tick() + offset;
+ unsigned frame = tempomap.tick2frame(tick) + frameOffset;
+ switch (ev.type()) {
+ case Note:
+ {
+ int len = ev.lenTick();
+ int pitch = ev.pitch();
+ int velo = ev.velo();
+ if (track->type() == Track::DRUM) {
+ //
+ // Map drum-notes to the drum-map values
+ //
+ int instr = ev.pitch();
+ pitch = drumMap[instr].anote;
+ port = drumMap[instr].port; //This changes to non-default port
+ channel = drumMap[instr].channel;
+ velo = int(double(velo) * (double(drumMap[instr].vol) / 100.0)) ;
+ }
+ else {
+ //
+ // transpose non drum notes
+ //
+ pitch += (track->transposition + song->globalPitchShift());
+ }
+
+ if (pitch > 127)
+ pitch = 127;
+ if (pitch < 0)
+ pitch = 0;
+ velo += track->velocity;
+ velo = (velo * track->compression) / 100;
+ if (velo > 127)
+ velo = 127;
+ if (velo < 1) // no off event
+ velo = 1;
+ len = (len * track->len) / 100;
+ if (len <= 0) // dont allow zero length
+ len = 1;
+ int veloOff = ev.veloOff();
+
+ if (port == defaultPort) {
+ //printf("Adding event normally: frame=%d port=%d channel=%d pitch=%d velo=%d\n",frame, port, channel, pitch, velo);
+
+ // p3.3.25
+ // If syncing to external midi sync, we cannot use the tempo map.
+ // Therefore we cannot get sub-tick resolution. Just use ticks instead of frames.
+ if(extSyncFlag.value())
+ playEvents->add(MidiPlayEvent(tick, port, channel, 0x90, pitch, velo));
+ else
+
+ playEvents->add(MidiPlayEvent(frame, port, channel, 0x90, pitch, velo));
+
+ stuckNotes->add(MidiPlayEvent(tick + len, port, channel,
+ veloOff ? 0x80 : 0x90, pitch, veloOff));
+ }
+ else { //Handle events to different port than standard.
+ MidiDevice* mdAlt = midiPorts[port].device();
+ if (mdAlt) {
+
+ // p3.3.25
+ if(extSyncFlag.value())
+ mdAlt->playEvents()->add(MidiPlayEvent(tick, port, channel, 0x90, pitch, velo));
+ else
+
+ mdAlt->playEvents()->add(MidiPlayEvent(frame, port, channel, 0x90, pitch, velo));
+
+ mdAlt->stuckNotes()->add(MidiPlayEvent(tick + len, port, channel,
+ veloOff ? 0x80 : 0x90, pitch, veloOff));
+ }
+ }
+
+ if(velo > track->activity())
+ track->setActivity(velo);
+ }
+ break;
+
+ // Added by T356.
+ case Controller:
+ {
+ //int len = ev.lenTick();
+ //int pitch = ev.pitch();
+ if (track->type() == Track::DRUM)
+ {
+ int ctl = ev.dataA();
+ // Is it a drum controller event, according to the track port's instrument?
+ MidiController *mc = midiPorts[defaultPort].drumController(ctl);
+ if(mc)
+ {
+ int instr = ctl & 0x7f;
+ ctl &= ~0xff;
+ int pitch = drumMap[instr].anote & 0x7f;
+ port = drumMap[instr].port; //This changes to non-default port
+ channel = drumMap[instr].channel;
+ MidiDevice* mdAlt = midiPorts[port].device();
+ if(mdAlt)
+ {
+ // p3.3.25
+ // If syncing to external midi sync, we cannot use the tempo map.
+ // Therefore we cannot get sub-tick resolution. Just use ticks instead of frames.
+ if(extSyncFlag.value())
+ mdAlt->playEvents()->add(MidiPlayEvent(tick, port, channel,
+ ME_CONTROLLER, ctl | pitch, ev.dataB()));
+ else
+
+ //playEvents->add(MidiPlayEvent(frame, port, channel, ev));
+ mdAlt->playEvents()->add(MidiPlayEvent(frame, port, channel,
+ ME_CONTROLLER, ctl | pitch, ev.dataB()));
+
+ }
+ break;
+ }
+ }
+ // p3.3.25
+ if(extSyncFlag.value())
+ playEvents->add(MidiPlayEvent(tick, port, channel, ev));
+ else
+
+ playEvents->add(MidiPlayEvent(frame, port, channel, ev));
+ }
+ break;
+
+
+ default:
+ // p3.3.25
+ if(extSyncFlag.value())
+ playEvents->add(MidiPlayEvent(tick, port, channel, ev));
+ else
+
+ playEvents->add(MidiPlayEvent(frame, port, channel, ev));
+
+ break;
+ }
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// processMidi
+// - collects midi events for current audio segment and
+// sends them to midi thread
+// - current audio segment position is (curTickPos, nextTickPos)
+// - called from midiseq thread,
+// executed in audio thread
+//---------------------------------------------------------
+
+void Audio::processMidi()
+ {
+ midiBusy=true;
+ //
+ // TODO: syntis should directly write into recordEventList
+ //
+ for (iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) {
+ MidiDevice* md = *id;
+
+ MPEventList* playEvents = md->playEvents();
+ //
+ // erase already played events:
+ //
+ iMPEvent nextPlayEvent = md->nextPlayEvent();
+ playEvents->erase(playEvents->begin(), nextPlayEvent);
+
+ // klumsy hack for synti devices:
+ if(md->isSynti())
+ {
+ SynthI* s = (SynthI*)md;
+ while (s->eventsPending())
+ {
+ MidiRecordEvent ev = s->receiveEvent();
+ md->recordEvent(ev);
+ }
+ }
+
+ // Is it a Jack midi device?
+ //MidiJackDevice* mjd = dynamic_cast<MidiJackDevice*>(md);
+ //if(mjd)
+ // mjd->collectMidiEvents();
+ md->collectMidiEvents();
+
+ // Take snapshots of the current sizes of the recording fifos,
+ // because they may change while here in process, asynchronously.
+ md->beforeProcess();
+ }
+
+ MPEventList* playEvents = metronome->playEvents();
+ iMPEvent nextPlayEvent = metronome->nextPlayEvent();
+ playEvents->erase(playEvents->begin(), nextPlayEvent);
+
+ // p3.3.25
+ bool extsync = extSyncFlag.value();
+
+ for (iMidiTrack t = song->midis()->begin(); t != song->midis()->end(); ++t)
+ {
+ MidiTrack* track = *t;
+ int port = track->outPort();
+ MidiDevice* md = midiPorts[port].device();
+
+ // Changed by Tim. p3.3.8
+ //if(md == 0)
+ // continue;
+ //MPEventList* playEvents = md->playEvents();
+ //if (playEvents == 0)
+ // continue;
+ //if (!track->isMute())
+ MPEventList* playEvents = 0;
+ if(md)
+ {
+ playEvents = md->playEvents();
+
+ // only add track events if the track is unmuted
+ if(!track->isMute())
+ {
+ if(isPlaying() && (curTickPos < nextTickPos))
+ collectEvents(track, curTickPos, nextTickPos);
+ }
+ }
+
+ //
+ //----------midi recording
+ //
+ if (track->recordFlag())
+ {
+ //int portMask = track->inPortMask();
+ // p3.3.38 Removed
+ //unsigned int portMask = track->inPortMask();
+ //int channelMask = track->inChannelMask();
+
+ MPEventList* rl = track->mpevents();
+ MidiPort* tport = &midiPorts[port];
+
+ // p3.3.38
+ //for (iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id)
+ //{
+ RouteList* irl = track->inRoutes();
+ for(ciRoute r = irl->begin(); r != irl->end(); ++r)
+ {
+ //if(!r->isValid() || (r->type != Route::ALSA_MIDI_ROUTE && r->type != Route::JACK_MIDI_ROUTE))
+ //if(!r->isValid() || (r->type != Route::MIDI_DEVICE_ROUTE))
+ if(!r->isValid() || (r->type != Route::MIDI_PORT_ROUTE)) // p3.3.49
+ continue;
+
+ int devport = r->midiPort; // p3.3.49
+ if (devport == -1)
+ continue;
+
+ //MidiDevice* dev = *id;
+ //MidiDevice* dev = r->device;
+ MidiDevice* dev = midiPorts[devport].device(); // p3.3.49
+ if(!dev)
+ continue;
+
+
+ // p3.3.50 Removed
+ //int channel = r->channel;
+ // NOTE: TODO: Special for input device sysex 'channel' marked as -1, ** IF we end up going with that method **.
+ // This would mean having a separate 'System' channel listed in the routing popups.
+ // The other alternative is to accept sysex from a device as long as ANY regular channel is routed from it,
+ // this does not require a 'System' channel listed in the routing popups.
+ // But that requires more code below... Done.
+ //if(channel == -1)
+ //channel = MIDI_CHANNELS; // Special channel '17'
+ // continue;
+
+ //int devport = dev->midiPort();
+
+ // record only from ports marked in portMask:
+ //if (devport == -1 || !(portMask & (1 << devport)))
+ //if (devport == -1)
+ // continue;
+
+ //MREventList* el = dev->recordEvents();
+ //MidiFifo& rf = dev->recordEvents();
+
+
+ int channelMask = r->channel; // p3.3.50
+ if(channelMask == -1 || channelMask == 0)
+ continue;
+ for(int channel = 0; channel < MIDI_CHANNELS; ++channel) // p3.3.50
+ {
+ if(!(channelMask & (1 << channel)))
+ continue;
+
+ if(!dev->sysexFIFOProcessed())
+ {
+ // Set to the sysex fifo at first.
+ MidiFifo& rf = dev->recordEvents(MIDI_CHANNELS);
+ // Get the frozen snapshot of the size.
+ int count = dev->tmpRecordCount(MIDI_CHANNELS);
+
+ for(int i = 0; i < count; ++i)
+ {
+ MidiPlayEvent event(rf.peek(i));
+
+ //unsigned time = event.time() + segmentSize*(segmentCount-1);
+ //unsigned time = event.time() + (extsync ? config.division/24 : segmentSize*(segmentCount-1));
+ //unsigned time = extsync ? curTickPos : (event.time() + segmentSize*(segmentCount-1));
+ //event.setTime(time);
+ //if(!extsync)
+ // event.setTime(event.time() + segmentSize*(segmentCount-1));
+
+ event.setPort(port);
+
+ // dont't echo controller changes back to software
+ // synthesizer:
+ if(!dev->isSynti() && md && track->recEcho())
+ playEvents->add(event);
+
+ // If syncing externally the event time is already in units of ticks, set above.
+ if(!extsync)
+ {
+ //time = tempomap.frame2tick(event.time());
+ //event.setTime(time); // set tick time
+ event.setTime(tempomap.frame2tick(event.time())); // set tick time
+ }
+
+ if(recording)
+ rl->add(event);
+ }
+
+ dev->setSysexFIFOProcessed(true);
+ }
+
+ // Set to the sysex fifo at first.
+ ///MidiFifo& rf = dev->recordEvents(MIDI_CHANNELS);
+ // Get the frozen snapshot of the size.
+ ///int count = dev->tmpRecordCount(MIDI_CHANNELS);
+
+ // Iterate once for sysex fifo (if needed), once for channel fifos.
+ ///for(int sei = 0; sei < 2; ++sei)
+ {
+ // If on first pass, do sysex fifo.
+ /*
+ if(sei == 0)
+ {
+ // Ignore any further channel routes on this device if already done here.
+ if(dev->sysexFIFOProcessed())
+ continue;
+ // Go ahead and set this now.
+ dev->setSysexFIFOProcessed(true);
+ // Allow it to fall through with the sysex fifo and count...
+ }
+ else
+ {
+ // We're on the second pass, do channel fifos.
+ rf = dev->recordEvents(channel);
+ // Get the frozen snapshot of the size.
+ count = dev->tmpRecordCount(channel);
+ }
+ */
+
+ MidiFifo& rf = dev->recordEvents(channel);
+ int count = dev->tmpRecordCount(channel);
+
+ //for (iMREvent ie = el->begin(); ie != el->end(); ++ie)
+ for(int i = 0; i < count; ++i)
+ {
+ MidiPlayEvent event(rf.peek(i));
+
+ //int channel = ie->channel();
+ ///int channel = event.channel();
+
+ int defaultPort = devport;
+ ///if (!(channelMask & (1 << channel)))
+ ///{
+ /// continue;
+ ///}
+
+ //MidiPlayEvent event(*ie);
+ int drumRecPitch=0; //prevent compiler warning: variable used without initialization
+ MidiController *mc = 0;
+ int ctl = 0;
+
+ //Hmmm, hehhh...
+ // TODO: Clean up a bit around here when it comes to separate events for rec & for playback.
+ // But not before 0.7 (ml)
+
+ int prePitch = 0, preVelo = 0;
+
+ event.setChannel(track->outChannel());
+
+ if (event.isNote() || event.isNoteOff())
+ {
+ //
+ // apply track values
+ //
+
+ //Apply drum inkey:
+ if (track->type() == Track::DRUM)
+ {
+ int pitch = event.dataA();
+ //Map note that is played according to drumInmap
+ drumRecPitch = drumMap[(unsigned int)drumInmap[pitch]].enote;
+ devport = drumMap[(unsigned int)drumInmap[pitch]].port;
+ event.setPort(devport);
+ channel = drumMap[(unsigned int)drumInmap[pitch]].channel;
+ event.setA(drumMap[(unsigned int)drumInmap[pitch]].anote);
+ event.setChannel(channel);
+ }
+ else
+ { //Track transpose if non-drum
+ prePitch = event.dataA();
+ int pitch = prePitch + track->transposition;
+ if (pitch > 127)
+ pitch = 127;
+ if (pitch < 0)
+ pitch = 0;
+ event.setA(pitch);
+ }
+
+ if (!event.isNoteOff())
+ {
+ preVelo = event.dataB();
+ int velo = preVelo + track->velocity;
+ velo = (velo * track->compression) / 100;
+ if (velo > 127)
+ velo = 127;
+ if (velo < 1)
+ velo = 1;
+ event.setB(velo);
+ }
+ }
+ // Added by T356.
+ else
+ if(event.type() == ME_CONTROLLER)
+ {
+ if(track->type() == Track::DRUM)
+ {
+ ctl = event.dataA();
+ // Regardless of what port the event came from, is it a drum controller event
+ // according to the track port's instrument?
+ mc = tport->drumController(ctl);
+ if(mc)
+ {
+ int pitch = ctl & 0x7f;
+ ctl &= ~0xff;
+ int dmindex = drumInmap[pitch] & 0x7f;
+ //Map note that is played according to drumInmap
+ drumRecPitch = drumMap[dmindex].enote;
+ devport = drumMap[dmindex].port;
+ event.setPort(devport);
+ channel = drumMap[dmindex].channel;
+ event.setA(ctl | drumMap[dmindex].anote);
+ event.setChannel(channel);
+ }
+ }
+ }
+
+ // p3.3.25
+ // MusE uses a fixed clocks per quarternote of 24.
+ // At standard 384 ticks per quarternote for example,
+ // 384/24=16 for a division of 16 sub-frames (16 MusE 'ticks').
+ // That is what we'll use if syncing externally.
+ //unsigned time = event.time() + segmentSize*(segmentCount-1);
+ //unsigned time = event.time() + (extsync ? config.division/24 : segmentSize*(segmentCount-1));
+ // p3.3.34
+ // Oops, use the current tick.
+ //unsigned time = extsync ? curTickPos : (event.time() + segmentSize*(segmentCount-1));
+ //event.setTime(time);
+ // p3.3.35
+ // If ext sync, events are now time-stamped with last tick in MidiDevice::recordEvent().
+ // TODO: Tested, but record resolution not so good. Switch to wall clock based separate list in MidiDevice.
+ // p3.3.36
+ //if(!extsync)
+ // event.setTime(event.time() + segmentSize*(segmentCount-1));
+
+ // dont't echo controller changes back to software
+ // synthesizer:
+
+ if (!dev->isSynti())
+ {
+ //Check if we're outputting to another port than default:
+ if (devport == defaultPort) {
+ event.setPort(port);
+ if(md && track->recEcho())
+ playEvents->add(event);
+ }
+ else {
+ // Hmm, this appears to work, but... Will this induce trouble with md->setNextPlayEvent??
+ MidiDevice* mdAlt = midiPorts[devport].device();
+ if(mdAlt && track->recEcho())
+ mdAlt->playEvents()->add(event);
+ }
+ // Shall we activate meters even while rec echo is off? Sure, why not...
+ if(event.isNote() && event.dataB() > track->activity())
+ track->setActivity(event.dataB());
+ }
+
+ // p3.3.25
+ // If syncing externally the event time is already in units of ticks, set above.
+ if(!extsync)
+ {
+ // p3.3.35
+ //time = tempomap.frame2tick(event.time());
+ //event.setTime(time); // set tick time
+ event.setTime(tempomap.frame2tick(event.time())); // set tick time
+ }
+
+ // Special handling of events stored in rec-lists. a bit hACKish. TODO: Clean up (after 0.7)! :-/ (ml)
+ if (recording)
+ {
+ // In these next steps, it is essential to set the recorded event's port
+ // to the track port so buildMidiEventList will accept it. Even though
+ // the port may have no device "<none>".
+ //
+ if (track->type() == Track::DRUM)
+ {
+ // Is it a drum controller event?
+ if(mc)
+ {
+ MidiPlayEvent drumRecEvent = event;
+ drumRecEvent.setA(ctl | drumRecPitch);
+ // In this case, preVelo is simply the controller value.
+ drumRecEvent.setB(preVelo);
+ drumRecEvent.setPort(port); //rec-event to current port
+ drumRecEvent.setChannel(track->outChannel()); //rec-event to current channel
+ rl->add(drumRecEvent);
+ }
+ else
+ {
+
+ MidiPlayEvent drumRecEvent = event;
+ drumRecEvent.setA(drumRecPitch);
+ drumRecEvent.setB(preVelo);
+ // Changed by T356.
+ // Tested: Events were not being recorded for a drum map entry pointing to a
+ // different port. This must have been wrong - buildMidiEventList would ignore this.
+ //drumRecEvent.setPort(devport);
+ drumRecEvent.setPort(port); //rec-event to current port
+
+ drumRecEvent.setChannel(track->outChannel()); //rec-event to current channel
+ rl->add(drumRecEvent);
+ }
+ }
+ else
+ {
+ // Restore record-pitch to non-transposed value since we don't want the note transposed twice next
+ MidiPlayEvent recEvent = event;
+ if (prePitch)
+ recEvent.setA(prePitch);
+ if (preVelo)
+ recEvent.setB(preVelo);
+ recEvent.setPort(port);
+ recEvent.setChannel(track->outChannel());
+
+ rl->add(recEvent);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ // Added by Tim. p3.3.8
+ if(md)
+ {
+
+ md->setNextPlayEvent(playEvents->begin());
+ }
+ }
+
+ //
+ // clear all recorded events in midiDevices
+ // process stuck notes
+ //
+ for (iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) {
+ MidiDevice* md = *id;
+
+ ///md->recordEvents()->clear();
+ // By T356. Done processing this rec buffer, now flip to the other one.
+ ///md->flipRecBuffer();
+ // We are done with the 'frozen' recording fifos, remove the events.
+ md->afterProcess();
+
+ MPEventList* stuckNotes = md->stuckNotes();
+ MPEventList* playEvents = md->playEvents();
+
+ iMPEvent k;
+ for (k = stuckNotes->begin(); k != stuckNotes->end(); ++k) {
+ if (k->time() >= nextTickPos)
+ break;
+ MidiPlayEvent ev(*k);
+
+ // p3.3.25
+ //int frame = tempomap.tick2frame(k->time()) + frameOffset;
+ if(extsync)
+ {
+ ev.setTime(k->time());
+ }
+ else
+ {
+ int frame = tempomap.tick2frame(k->time()) + frameOffset;
+ ev.setTime(frame);
+ }
+
+ // p3.3.25
+ //ev.setTime(frame);
+
+ playEvents->add(ev);
+ }
+ stuckNotes->erase(stuckNotes->begin(), k);
+ md->setNextPlayEvent(playEvents->begin());
+ }
+
+ //---------------------------------------------------
+ // insert metronome clicks
+ //---------------------------------------------------
+
+ MidiDevice* md = 0;
+ if (midiClickFlag)
+ md = midiPorts[clickPort].device();
+ if (song->click() && (isPlaying() || state == PRECOUNT)) {
+ MPEventList* playEvents = 0;
+ MPEventList* stuckNotes = 0;
+ if (md) {
+ playEvents = md->playEvents();
+ stuckNotes = md->stuckNotes();
+ }
+ int bar, beat;
+ unsigned tick;
+ bool isMeasure = false;
+ while (midiClick < nextTickPos) {
+ if (isPlaying()) {
+ sigmap.tickValues(midiClick, &bar, &beat, &tick);
+ isMeasure = beat == 0;
+ }
+ else if (state == PRECOUNT) {
+ isMeasure = (clickno % clicksMeasure) == 0;
+ }
+ // p3.3.25
+ //int frame = tempomap.tick2frame(midiClick) + frameOffset;
+ int evtime = extsync ? midiClick : tempomap.tick2frame(midiClick) + frameOffset;
+
+ // p3.3.25
+ //MidiPlayEvent ev(frame, clickPort, clickChan, ME_NOTEON,
+ MidiPlayEvent ev(evtime, clickPort, clickChan, ME_NOTEON,
+ beatClickNote, beatClickVelo);
+
+ if (md) {
+ // p3.3.25
+ //MidiPlayEvent ev(frame, clickPort, clickChan, ME_NOTEON,
+ MidiPlayEvent ev(evtime, clickPort, clickChan, ME_NOTEON,
+ beatClickNote, beatClickVelo);
+
+ if (isMeasure) {
+ ev.setA(measureClickNote);
+ ev.setB(measureClickVelo);
+ }
+ playEvents->add(ev);
+ }
+ if (audioClickFlag) {
+ // p3.3.25
+ //MidiPlayEvent ev1(frame, 0, 0, ME_NOTEON, 0, 0);
+ MidiPlayEvent ev1(evtime, 0, 0, ME_NOTEON, 0, 0);
+
+ ev1.setA(isMeasure ? 0 : 1);
+ metronome->playEvents()->add(ev1);
+ }
+ if (md) {
+ ev.setB(0);
+ // p3.3.25
+ // Removed. Why was this here?
+ //frame = tempomap.tick2frame(midiClick+20) + frameOffset;
+ //
+ // Does it mean this should be changed too?
+ // No, stuck notes are in units of ticks, not frames like (normal, non-external) play events...
+ ev.setTime(midiClick+10);
+
+ if (md)
+ stuckNotes->add(ev);
+ }
+
+ if (isPlaying())
+ midiClick = sigmap.bar2tick(bar, beat+1, 0);
+ else if (state == PRECOUNT) {
+ midiClick += ticksBeat;
+ if (clickno)
+ --clickno;
+ else
+ state = START_PLAY;
+ }
+ }
+ if (md)
+ md->setNextPlayEvent(playEvents->begin());
+ if (audioClickFlag)
+ metronome->setNextPlayEvent(metronome->playEvents()->begin());
+ }
+
+ if (state == STOP) {
+ //---------------------------------------------------
+ // end all notes
+ //---------------------------------------------------
+
+ for (iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd) {
+ MidiDevice* md = *imd;
+ MPEventList* playEvents = md->playEvents();
+ MPEventList* stuckNotes = md->stuckNotes();
+ for (iMPEvent k = stuckNotes->begin(); k != stuckNotes->end(); ++k) {
+ MidiPlayEvent ev(*k);
+ ev.setTime(0); // play now
+ playEvents->add(ev);
+ }
+ stuckNotes->clear();
+ }
+ }
+
+
+ // p3.3.36
+ //int tickpos = audio->tickPos();
+ //bool extsync = extSyncFlag.value();
+ //
+ // Special for Jack midi devices: Play all Jack midi events up to curFrame.
+ //
+ for(iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id)
+ {
+ //MidiDevice* md = *id;
+ // Is it a Jack midi device?
+ //MidiJackDevice* mjd = dynamic_cast<MidiJackDevice*>(md);
+ //if(!mjd)
+ // continue;
+ //mjd->processMidi();
+ (*id)->processMidi();
+
+ /*
+ int port = md->midiPort();
+ MidiPort* mp = port != -1 ? &midiPorts[port] : 0;
+ MPEventList* el = md->playEvents();
+ if (el->empty())
+ continue;
+ iMPEvent i = md->nextPlayEvent();
+ for(; i != el->end(); ++i)
+ {
+ // If syncing to external midi sync, we cannot use the tempo map.
+ // Therefore we cannot get sub-tick resolution. Just use ticks instead of frames.
+ //if(i->time() > curFrame)
+ if(i->time() > (extsync ? tickpos : curFrame))
+ {
+ //printf(" curT %d frame %d\n", i->time(), curFrame);
+ break; // skip this event
+ }
+
+ if(mp)
+ {
+ if(mp->sendEvent(*i))
+ break;
+ }
+ else
+ {
+ if(md->putEvent(*i))
+ break;
+ }
+ }
+ md->setNextPlayEvent(i);
+ */
+ }
+
+ midiBusy=false;
+ }
+
diff --git a/muse2/muse/midi.h b/muse2/muse/midi.h
new file mode 100644
index 00000000..ee13fb36
--- /dev/null
+++ b/muse2/muse/midi.h
@@ -0,0 +1,72 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midi.h,v 1.4.2.2 2009/11/09 20:28:28 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MIDI_H__
+#define __MIDI_H__
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <qstring.h>
+
+enum {
+ ME_NOTEOFF = 0x80,
+ ME_NOTEON = 0x90,
+ ME_POLYAFTER = 0xa0,
+ ME_CONTROLLER = 0xb0,
+ ME_PROGRAM = 0xc0,
+ ME_AFTERTOUCH = 0xd0,
+ ME_PITCHBEND = 0xe0,
+ ME_SYSEX = 0xf0,
+ ME_META = 0xff,
+ ME_MTC_QUARTER = 0xf1,
+ ME_SONGPOS = 0xf2,
+ ME_SONGSEL = 0xf3,
+ ME_TUNE_REQ = 0xf6,
+ ME_SYSEX_END = 0xf7,
+ ME_CLOCK = 0xf8,
+ ME_TICK = 0xf9,
+ ME_START = 0xfa,
+ ME_CONTINUE = 0xfb,
+ ME_STOP = 0xfc,
+ ME_SENSE = 0xfe
+ };
+
+#define ME_TIMESIG 0x58
+
+extern const unsigned char gmOnMsg[];
+
+extern const unsigned char gsOnMsg[];
+extern const unsigned char gsOnMsg2[];
+extern const unsigned char gsOnMsg3[];
+extern const unsigned char xgOnMsg[];
+extern const unsigned char mmcDeferredPlayMsg[];
+extern const unsigned char mmcStopMsg[];
+extern const unsigned char mmcLocateMsg[];
+
+extern const unsigned int gmOnMsgLen;
+extern const unsigned int gsOnMsgLen;
+extern const unsigned int gsOnMsg2Len;
+extern const unsigned int gsOnMsg3Len;
+extern const unsigned int xgOnMsgLen;
+extern const unsigned int mmcDeferredPlayMsgLen;
+extern const unsigned int mmcStopMsgLen;
+extern const unsigned int mmcLocateMsgLen;
+
+QString nameSysex(unsigned int len, const unsigned char* buf);
+QString midiMetaName(int);
+
+class EventList;
+class MPEventList;
+class MidiTrack;
+//extern void buildMidiEventList(EventList* mel, const MPEventList* el, MidiTrack* track, int division, bool);
+extern void buildMidiEventList(EventList* mel, const MPEventList* el, MidiTrack* track, int division, bool /*addSysexMeta*/, bool /*doLoops*/);
+// extern bool checkSysex(MidiTrack* track, unsigned int len, unsigned char* buf);
+
+#endif
+
diff --git a/muse2/muse/midictrl.cpp b/muse2/muse/midictrl.cpp
new file mode 100644
index 00000000..3994fe90
--- /dev/null
+++ b/muse2/muse/midictrl.cpp
@@ -0,0 +1,781 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midictrl.cpp,v 1.17.2.10 2009/06/10 00:34:59 terminator356 Exp $
+//
+// (C) Copyright 2001-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <assert.h>
+#include <stdio.h>
+
+#include <qobject.h>
+#include "midictrl.h"
+#include "xml.h"
+#include "globals.h"
+
+static const char* ctrlName[] = {
+ "BankSelMSB", "Modulation", "BreathCtrl", "Control 3", "Foot Ctrl",
+ "Porta Time", "DataEntMSB", "MainVolume", "Balance", "Control 9",
+/*10*/ "Pan", "Expression", "Control 12", "Control 13", "Control 14",
+ "Control 15", "Gen.Purp.1", "Gen.Purp.2", "Gen.Purp.3", "Gen.Purp.4",
+/*20*/ "Control 20", "Control 21", "Control 22", "Control 23", "Control 24",
+ "Control 25", "Control 26", "Control 27", "Control 28", "Control 29",
+/*30*/ "Control 30", "Control 31", "BankSelLSB", "Modul. LSB", "BrthCt.LSB",
+ "Control 35", "FootCt.LSB", "Port.T LSB", "DataEntLSB", "MainVolLSB",
+ "BalanceLSB", "Control 41", "Pan LSB", "Expr. LSB", "Control 44",
+ "Control 45", "Control 46", "Control 47", "Gen.P.1LSB", "Gen.P.2LSB",
+/*50*/ "Gen.P.3LSB", "Gen.P.4LSB", "Control 52", "Control 53", "Control 54",
+ "Control 55", "Control 56", "Control 57", "Control 58", "Control 59",
+ "Control 60", "Control 61", "Control 62", "Control 63", "Sustain",
+ "Porta Ped", "Sostenuto", "Soft Pedal", "Control 68", "Hold 2",
+ "Control 70", "HarmonicCo", "ReleaseTime", "Attack Time", "Brightness",
+ "Control 75", "Control 76", "Control 77", "Control 78", "Control 79",
+ "Gen.Purp.5", "Gen.Purp.6", "Gen.Purp.7", "Gen.Purp.8", "Porta Ctrl",
+ "Control 85", "Control 86", "Control 87", "Control 88", "Control 89",
+ "Control 90", "Effect1Dep", "Effect2Dep", "Effect3Dep", "Effect4Dep",
+ "Phaser Dep", "Data Incr", "Data Decr", "NRPN LSB", "NRPN MSB",
+/*100*/ "RPN LSB", "RPN MSB", "Control102", "Control103", "Control104",
+ "Control105", "Control106", "Control107", "Control108", "Control109",
+ "Control110", "Control111", "Control112", "Control113", "Control114",
+ "Control115", "Control116", "Control117", "Control118", "Control119",
+ "AllSndOff", "Reset Ctrl", "Local Ctrl", "AllNoteOff", "OmniModOff",
+ "OmniModeOn", "MonoModeOn", "PolyModeOn"
+ };
+
+#if 0
+static const char* ctrl14Name[] = {
+ "BankSel", "Modulation", "BreathCtrl",
+ "Control 3", "Foot Ctrl", "Porta Time", "DataEntry",
+ "MainVolume", "Balance", "Control 9", "Pan",
+ "Expression", "Control 12", "Control 13", "Control 14",
+ "Control 15", "Gen.Purp.1", "Gen.Purp.2", "Gen.Purp.3",
+ "Gen.Purp.4", "Control 20", "Control 21", "Control 22",
+ "Control 23", "Control 24", "Control 25", "Control 26",
+ "Control 27", "Control 28", "Control 29", "Control 30",
+ "Control 31",
+ };
+#endif
+
+enum {
+ COL_NAME = 0, COL_TYPE,
+ COL_HNUM, COL_LNUM, COL_MIN, COL_MAX
+ };
+
+MidiControllerList defaultMidiController;
+//
+// some global controller which are always available:
+//
+MidiController veloCtrl("Velocity", CTRL_VELOCITY, 0, 127, 0);
+static MidiController pitchCtrl("PitchBend", CTRL_PITCH, -8192, +8191, 0);
+static MidiController programCtrl("Program", CTRL_PROGRAM, 0, 0xffffff, 0);
+// Removed p3.3.37
+//static MidiController mastervolCtrl("MasterVolume", CTRL_MASTER_VOLUME, 0, 0x3fff, 0x3000);
+static MidiController volumeCtrl("MainVolume", CTRL_VOLUME, 0, 127, 100);
+static MidiController panCtrl("Pan", CTRL_PANPOT, -64, 63, 0);
+
+
+//---------------------------------------------------------
+// ctrlType2Int
+// int2ctrlType
+//---------------------------------------------------------
+
+static struct {
+ MidiController::ControllerType type;
+ QString name;
+ } ctrlTypes[] = {
+ { MidiController::Controller7, QString("Control7") },
+ { MidiController::Controller14, QString("Control14") },
+ { MidiController::RPN, QString("RPN") },
+ { MidiController::NRPN, QString("NRPN") },
+ { MidiController::RPN14, QString("RPN14") },
+ { MidiController::NRPN14, QString("NRPN14") },
+ { MidiController::Pitch, QString("Pitch") },
+ { MidiController::Program, QString("Program") },
+ { MidiController::Controller7, QString("Control") }, // alias
+ };
+
+//---------------------------------------------------------
+// ctrlType2Int
+//---------------------------------------------------------
+
+MidiController::ControllerType ctrlType2Int(const QString& s)
+ {
+ int n = sizeof(ctrlTypes)/sizeof(*ctrlTypes);
+ for (int i = 0; i < n; ++i) {
+ if (ctrlTypes[i].name == s)
+ return ctrlTypes[i].type;
+ }
+ return MidiController::ControllerType(0);
+ }
+
+//---------------------------------------------------------
+// int2ctrlType
+//---------------------------------------------------------
+
+const QString& int2ctrlType(int n)
+ {
+ static QString dontKnow("?T?");
+ int size = sizeof(ctrlTypes)/sizeof(*ctrlTypes);
+ for (int i = 0; i < size; ++i) {
+ if (ctrlTypes[i].type == n)
+ return ctrlTypes[i].name;
+ }
+ return dontKnow;
+ }
+
+//---------------------------------------------------------
+// initMidiController
+//---------------------------------------------------------
+
+void initMidiController()
+ {
+ defaultMidiController.add(&veloCtrl);
+ defaultMidiController.add(&pitchCtrl);
+ defaultMidiController.add(&programCtrl);
+ // Removed p3.3.37
+ //defaultMidiController.add(&mastervolCtrl);
+ defaultMidiController.add(&volumeCtrl);
+ defaultMidiController.add(&panCtrl);
+ }
+
+//---------------------------------------------------------
+// midiCtrlName
+//---------------------------------------------------------
+
+QString midiCtrlName(int ctrl)
+ {
+ if (ctrl < 0x10000)
+ return QString(ctrlName[ctrl]);
+ return QString("?N?");
+ }
+
+//---------------------------------------------------------
+// MidiController
+//---------------------------------------------------------
+
+MidiController::MidiController()
+ : _name(QString(QT_TR_NOOP("Velocity")))
+ {
+ _num = CTRL_VELOCITY;
+ _minVal = 0;
+ _maxVal = 127;
+ _initVal = 0;
+ updateBias();
+ }
+
+MidiController::MidiController(const QString& s, int n, int min, int max, int init)
+ : _name(s), _num(n), _minVal(min), _maxVal(max), _initVal(init)
+ {
+ updateBias();
+ }
+
+MidiController::MidiController(const MidiController& mc)
+{
+ copy(mc);
+}
+
+//---------------------------------------------------------
+// copy
+//---------------------------------------------------------
+
+void MidiController::copy(const MidiController &mc)
+{
+ _name = mc._name;
+ _num = mc._num;
+ _minVal = mc._minVal;
+ _maxVal = mc._maxVal;
+ _initVal = mc._initVal;
+ //updateBias();
+ _bias = mc._bias;
+}
+
+//---------------------------------------------------------
+// operator =
+//---------------------------------------------------------
+
+MidiController& MidiController::operator=(const MidiController &mc)
+{
+ copy(mc);
+ return *this;
+}
+
+//---------------------------------------------------------
+// type
+//---------------------------------------------------------
+
+MidiController::ControllerType midiControllerType(int num)
+ {
+ // p3.3.37
+ //if (num < 0x10000)
+ if (num < CTRL_14_OFFSET)
+ return MidiController::Controller7;
+ //if (num < 0x20000)
+ if (num < CTRL_RPN_OFFSET)
+ return MidiController::Controller14;
+ //if (num < 0x30000)
+ if (num < CTRL_NRPN_OFFSET)
+ return MidiController::RPN;
+ //if (num < 0x40000)
+ if (num < CTRL_INTERNAL_OFFSET)
+ return MidiController::NRPN;
+ if (num == CTRL_PITCH)
+ return MidiController::Pitch;
+ if (num == CTRL_PROGRAM)
+ return MidiController::Program;
+ if (num == CTRL_VELOCITY)
+ return MidiController::Velo;
+ //if (num < 0x60000)
+ if (num < CTRL_NRPN14_OFFSET)
+ return MidiController::RPN14;
+ //if (num < 0x70000)
+ if (num < CTRL_NONE_OFFSET)
+ return MidiController::NRPN14;
+ return MidiController::Controller7;
+ }
+
+//---------------------------------------------------------
+// updateBias
+//---------------------------------------------------------
+
+void MidiController::updateBias()
+{
+ // If the specified minimum value is negative, we will
+ // translate to a positive-biased range.
+ // Cue: A controller like 'coarse tuning', is meant to be displayed
+ // as -24/+24, but really is centered on 64 and goes from 40 to 88.
+ int b;
+ int mn, mx;
+ ControllerType t = midiControllerType(_num);
+ switch (t)
+ {
+ case RPN:
+ case NRPN:
+ case Controller7:
+ b = 64;
+ mn = 0;
+ mx = 127;
+ break;
+ case Controller14:
+ case RPN14:
+ case NRPN14:
+ b = 8192;
+ mn = 0;
+ mx = 16383;
+ break;
+ case Program:
+ b = 0x800000;
+ mn = 0;
+ mx = 0xffffff;
+ break;
+ case Pitch:
+ b = 0;
+ mn = -8192;
+ mx = 8191;
+ break;
+ //case Velo: // cannot happen
+ default:
+ b = 64;
+ mn = 0;
+ mx = 127;
+ break;
+ }
+
+ // Special handling of pan: Only thing to do is force the range!
+ //if(_num == CTRL_PANPOT)
+ //{
+ // _minVal = -64;
+ // _maxVal = 63;
+ // _initVal = 0;
+ //}
+
+ // TODO: Limit _minVal and _maxVal to range.
+
+ if(_minVal >= 0)
+ _bias = 0;
+ else
+ {
+ _bias = b;
+
+ if(t != Program && t != Pitch)
+ {
+ // Adjust bias to fit desired range.
+ if(_minVal + _bias < mn)
+ //_minVal = mn - _bias;
+ _bias += mn - _minVal + _bias;
+ else
+ if(_maxVal + _bias > mx)
+ //_maxVal = mx - _bias;
+ _bias -= _maxVal + _bias - mx;
+ }
+ }
+}
+
+
+//---------------------------------------------------------
+// MidiController::write
+//---------------------------------------------------------
+
+void MidiController::write(int level, Xml& xml) const
+{
+ ControllerType t = midiControllerType(_num);
+ if(t == Velo)
+ return;
+
+ QString type(int2ctrlType(t));
+
+ int h = (_num >> 8) & 0x7f;
+ int l = _num & 0x7f;
+
+ QString sl;
+ if ((_num & 0xff) == 0xff)
+ sl = "pitch";
+ else
+ sl.setNum(l);
+
+ xml.nput(level, "<Controller name=\"%s\"", Xml::xmlString(_name).latin1());
+ if(t != Controller7)
+ xml.nput(" type=\"%s\"", type.latin1());
+
+ int mn = 0;
+ int mx = 0;
+ switch (t)
+ {
+ case RPN:
+ case NRPN:
+ xml.nput(" h=\"%d\"", h);
+ xml.nput(" l=\"%s\"", sl.latin1());
+ mx = 127;
+ break;
+ case Controller7:
+ xml.nput(" l=\"%s\"", sl.latin1());
+ mx = 127;
+ break;
+ case Controller14:
+ case RPN14:
+ case NRPN14:
+ xml.nput(" h=\"%d\"", h);
+ xml.nput(" l=\"%s\"", sl.latin1());
+ mx = 16383;
+ break;
+ case Pitch:
+ mn = -8192;
+ mx = 8191;
+ break;
+ case Program:
+ case Velo: // Cannot happen
+ break;
+ }
+
+ if(t == Program)
+ {
+ if(_initVal != CTRL_VAL_UNKNOWN && _initVal != 0xffffff)
+ xml.nput(" init=\"0x%x\"", _initVal);
+ }
+ else
+ {
+ if(_minVal != mn)
+ xml.nput(" min=\"%d\"", _minVal);
+ if(_maxVal != mx)
+ xml.nput(" max=\"%d\"", _maxVal);
+
+ if(_initVal != CTRL_VAL_UNKNOWN)
+ xml.nput(" init=\"%d\"", _initVal);
+ }
+ //xml.put(level, " />");
+ xml.put(" />");
+}
+
+//---------------------------------------------------------
+// MidiController::read
+//---------------------------------------------------------
+
+void MidiController::read(Xml& xml)
+ {
+ ControllerType t = Controller7;
+ _initVal = CTRL_VAL_UNKNOWN;
+ static const int NOT_SET = 0x100000;
+ _minVal = NOT_SET;
+ _maxVal = NOT_SET;
+ int h = 0;
+ int l = 0;
+ bool ok;
+ int base = 10;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::Attribut:
+ {
+ QString s = xml.s2();
+ if (s.left(2) == "0x")
+ base = 16;
+ if (tag == "name")
+ _name = xml.s2();
+ else if (tag == "type")
+ t = ctrlType2Int(xml.s2());
+ else if (tag == "h")
+ h = xml.s2().toInt(&ok, base);
+ else if (tag == "l") {
+ // By T356 08/16/08. Changed wildcard to '*'.
+ // Changed back to 'pitch' again.
+ // Support instrument files with '*' as wildcard.
+ if ((xml.s2() == "*") || (xml.s2() == "pitch"))
+ l = 0xff;
+ else
+ l = xml.s2().toInt(&ok, base);
+ }
+ else if (tag == "min")
+ _minVal = xml.s2().toInt(&ok, base);
+ else if (tag == "max")
+ _maxVal = xml.s2().toInt(&ok, base);
+ else if (tag == "init")
+ _initVal = xml.s2().toInt(&ok, base);
+ }
+ break;
+ case Xml::TagStart:
+ xml.unknown("MidiController");
+ break;
+ case Xml::TagEnd:
+ if (tag == "Controller") {
+ _num = (h << 8) + l;
+ switch (t) {
+ case RPN:
+ if (_maxVal == NOT_SET)
+ _maxVal = 127;
+ // p3.3.37
+ //_num |= 0x20000;
+ _num |= CTRL_RPN_OFFSET;
+ break;
+ case NRPN:
+ if (_maxVal == NOT_SET)
+ _maxVal = 127;
+ //_num |= 0x30000;
+ _num |= CTRL_NRPN_OFFSET;
+ break;
+ case Controller7:
+ if (_maxVal == NOT_SET)
+ _maxVal = 127;
+ break;
+ case Controller14:
+ //_num |= 0x10000;
+ _num |= CTRL_14_OFFSET;
+ if (_maxVal == NOT_SET)
+ _maxVal = 16383;
+ break;
+ case RPN14:
+ if (_maxVal == NOT_SET)
+ _maxVal = 16383;
+ //_num |= 0x50000;
+ _num |= CTRL_RPN14_OFFSET;
+ break;
+ case NRPN14:
+ if (_maxVal == NOT_SET)
+ _maxVal = 16383;
+ //_num |= 0x60000;
+ _num |= CTRL_NRPN14_OFFSET;
+ break;
+ case Pitch:
+ if (_maxVal == NOT_SET)
+ _maxVal = 8191;
+ if (_minVal == NOT_SET)
+ _minVal = -8192;
+ _num = CTRL_PITCH;
+ break;
+ case Program:
+ if (_maxVal == NOT_SET)
+ _maxVal = 0xffffff;
+ _num = CTRL_PROGRAM;
+ break;
+ case Velo: // cannot happen
+ break;
+ }
+ if (_minVal == NOT_SET)
+ _minVal = 0;
+
+ updateBias();
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// genNum
+//---------------------------------------------------------
+
+int MidiController::genNum(MidiController::ControllerType t, int h, int l)
+ {
+ int val = (h << 8) + l;
+ switch(t) {
+ case Controller7:
+ return l;
+ case Controller14:
+ return val + CTRL_14_OFFSET;
+ case RPN:
+ //return l + CTRL_RPN_OFFSET;
+ return val + CTRL_RPN_OFFSET;
+ case NRPN:
+ //return l + CTRL_NRPN_OFFSET;
+ return val + CTRL_NRPN_OFFSET;
+ case RPN14:
+ return val + CTRL_RPN14_OFFSET;
+ case NRPN14:
+ return val + CTRL_NRPN14_OFFSET;
+ case Pitch:
+ return CTRL_PITCH;
+ case Program:
+ return CTRL_PROGRAM;
+ default:
+ return -1;
+ }
+ }
+
+//---------------------------------------------------------
+// MidiCtrlValList
+//---------------------------------------------------------
+
+MidiCtrlValList::MidiCtrlValList(int c)
+ {
+ ctrlNum = c;
+ _hwVal = CTRL_VAL_UNKNOWN;
+ _lastValidHWVal = CTRL_VAL_UNKNOWN;
+ }
+
+//---------------------------------------------------------
+// clearDelete
+//---------------------------------------------------------
+
+void MidiCtrlValListList::clearDelete(bool deleteLists)
+{
+ for(iMidiCtrlValList imcvl = begin(); imcvl != end(); ++imcvl)
+ {
+ if(imcvl->second)
+ {
+ imcvl->second->clear();
+ if(deleteLists)
+ delete imcvl->second;
+ }
+ }
+ if(deleteLists)
+ clear();
+}
+
+//---------------------------------------------------------
+// setHwVal
+// Returns false if value is already equal, true if value is changed.
+//---------------------------------------------------------
+
+bool MidiCtrlValList::setHwVal(const int v)
+{
+ if(_hwVal == v)
+ return false;
+
+ _hwVal = v;
+ if(_hwVal != CTRL_VAL_UNKNOWN)
+ _lastValidHWVal = _hwVal;
+
+ return true;
+}
+
+//---------------------------------------------------------
+// setHwVals
+// Sets current and last HW values.
+// Handy for forcing labels to show 'off' and knobs to show specific values
+// without having to send two messages.
+// Returns false if both values are already set, true if either value is changed.
+//---------------------------------------------------------
+
+bool MidiCtrlValList::setHwVals(const int v, int const lastv)
+{
+ if(_hwVal == v && _lastValidHWVal == lastv)
+ return false;
+
+ _hwVal = v;
+ // Don't want to break our own rules - _lastValidHWVal can't be unknown while _hwVal is valid...
+ // But _hwVal can be unknown while _lastValidHWVal is valid...
+ if(lastv == CTRL_VAL_UNKNOWN)
+ _lastValidHWVal = _hwVal;
+ else
+ _lastValidHWVal = lastv;
+
+ return true;
+}
+
+//---------------------------------------------------------
+// partAtTick
+//---------------------------------------------------------
+
+Part* MidiCtrlValList::partAtTick(int tick) const
+{
+ // Determine (first) part at tick. Return 0 if none found.
+
+ ciMidiCtrlVal i = lower_bound(tick);
+ if (i == end() || i->first != tick) {
+ if (i == begin())
+ return 0;
+ --i;
+ }
+ return i->second.part;
+}
+
+//---------------------------------------------------------
+// iValue
+//---------------------------------------------------------
+
+iMidiCtrlVal MidiCtrlValList::iValue(int tick)
+{
+ // Determine value at tick, using values stored by ANY part...
+
+ iMidiCtrlVal i = lower_bound(tick);
+ if (i == end() || i->first != tick) {
+ if (i == begin())
+ return end();
+ --i;
+ }
+ return i;
+}
+
+//---------------------------------------------------------
+// value
+//---------------------------------------------------------
+
+int MidiCtrlValList::value(int tick) const
+{
+ // Determine value at tick, using values stored by ANY part...
+
+ ciMidiCtrlVal i = lower_bound(tick);
+ if (i == end() || i->first != tick) {
+ if (i == begin())
+ return CTRL_VAL_UNKNOWN;
+ --i;
+ }
+ return i->second.val;
+}
+
+int MidiCtrlValList::value(int tick, Part* part) const
+{
+ // Determine value at tick, using values stored by the SPECIFIC part...
+
+ // Get the first value found with with a tick equal or greater than specified tick.
+ ciMidiCtrlVal i = lower_bound(tick);
+ // Since values from different parts can have the same tick, scan for part in all values at that tick.
+ for(ciMidiCtrlVal j = i; j != end() && j->first == tick; ++j)
+ {
+ if(j->second.part == part)
+ return j->second.val;
+ }
+ // Scan for part in all previous values, regardless of tick.
+ while(i != begin())
+ {
+ --i;
+ if(i->second.part == part)
+ return i->second.val;
+ }
+ // No previous values were found belonging to the specified part.
+ return CTRL_VAL_UNKNOWN;
+}
+
+//---------------------------------------------------------
+// add
+// return true if new controller value added or replaced
+//---------------------------------------------------------
+
+// Changed by T356.
+//bool MidiCtrlValList::add(int tick, int val)
+bool MidiCtrlValList::addMCtlVal(int tick, int val, Part* part)
+ {
+ iMidiCtrlVal e = findMCtlVal(tick, part);
+
+ if (e != end()) {
+ if(e->second.val != val)
+ {
+ e->second.val = val;
+ return true;
+ }
+ return false;
+ }
+
+ MidiCtrlVal v;
+ v.val = val;
+ v.part = part;
+ insert(std::pair<const int, MidiCtrlVal> (tick, v));
+ return true;
+ }
+
+//---------------------------------------------------------
+// del
+//---------------------------------------------------------
+
+// Changed by T356.
+//void MidiCtrlValList::del(int tick)
+void MidiCtrlValList::delMCtlVal(int tick, Part* part)
+{
+ iMidiCtrlVal e = findMCtlVal(tick, part);
+ if (e == end()) {
+ if(debugMsg)
+ printf("MidiCtrlValList::delMCtlVal(%d): not found (size %zd)\n", tick, size());
+ return;
+ }
+ erase(e);
+}
+
+//---------------------------------------------------------
+// find
+//---------------------------------------------------------
+
+// Changed by T356.
+//iMidiCtrlVal MidiCtrlValList::find(int tick, Part* part)
+iMidiCtrlVal MidiCtrlValList::findMCtlVal(int tick, Part* part)
+{
+ MidiCtrlValRange range = equal_range(tick);
+ for(iMidiCtrlVal i = range.first; i != range.second; ++i)
+ {
+ if(i->second.part == part)
+ return i;
+ }
+ return end();
+}
+
+//---------------------------------------------------------
+// MidiControllerList
+//---------------------------------------------------------
+
+MidiControllerList::MidiControllerList(const MidiControllerList& mcl) : std::map<int, MidiController*>()
+{
+ //copy(mcl);
+
+ for(ciMidiController i = mcl.begin(); i != mcl.end(); ++i)
+ {
+ MidiController* mc = i->second;
+ add(new MidiController(*mc));
+ }
+}
+
+//---------------------------------------------------------
+// copy
+//---------------------------------------------------------
+//void MidiControllerList::copy(const MidiControllerList &mcl)
+//{
+// clear();
+// for(ciMidiController i = mcl.begin(); i != mcl.end(); ++i)
+// {
+// MidiController* mc = *i;
+// push_back(new MidiController(*mc));
+// }
+//}
+
+//---------------------------------------------------------
+// operator =
+//---------------------------------------------------------
+//MidiControllerList& MidiControllerList::operator= (const MidiControllerList &mcl)
+//{
+// copy(mcl);
+// return *this;
+//}
diff --git a/muse2/muse/midictrl.h b/muse2/muse/midictrl.h
new file mode 100644
index 00000000..69650a65
--- /dev/null
+++ b/muse2/muse/midictrl.h
@@ -0,0 +1,255 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midictrl.h,v 1.16.2.8 2009/11/25 09:09:43 terminator356 Exp $
+//
+// (C) Copyright 1999-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MIDICTRL_H__
+#define __MIDICTRL_H__
+
+#include <qstring.h>
+#include <list>
+#include <map>
+
+const int CTRL_HBANK = 0x00;
+const int CTRL_LBANK = 0x20;
+
+const int CTRL_HDATA = 0x06;
+const int CTRL_LDATA = 0x26;
+
+const int CTRL_HNRPN = 0x63;
+const int CTRL_LNRPN = 0x62;
+
+const int CTRL_HRPN = 0x65;
+const int CTRL_LRPN = 0x64;
+
+const int CTRL_MODULATION = 0x01;
+const int CTRL_PORTAMENTO_TIME = 0x05;
+const int CTRL_VOLUME = 0x07;
+const int CTRL_PANPOT = 0x0a;
+const int CTRL_EXPRESSION = 0x0b;
+const int CTRL_SUSTAIN = 0x40;
+const int CTRL_PORTAMENTO = 0x41;
+const int CTRL_SOSTENUTO = 0x42;
+const int CTRL_SOFT_PEDAL = 0x43;
+const int CTRL_HARMONIC_CONTENT = 0x47;
+const int CTRL_RELEASE_TIME = 0x48;
+const int CTRL_ATTACK_TIME = 0x49;
+
+const int CTRL_BRIGHTNESS = 0x4a;
+const int CTRL_PORTAMENTO_CONTROL = 0x54;
+const int CTRL_REVERB_SEND = 0x5b;
+const int CTRL_CHORUS_SEND = 0x5d;
+const int CTRL_VARIATION_SEND = 0x5e;
+
+const int CTRL_ALL_SOUNDS_OFF = 0x78; // 120
+const int CTRL_RESET_ALL_CTRL = 0x79; // 121
+const int CTRL_LOCAL_OFF = 0x7a; // 122
+
+// controller types 0x10000 - 0x1ffff are 14 bit controller with
+// 0x1xxyy
+// xx - MSB controller
+// yy - LSB controller
+
+// RPN - registered parameter numbers 0x20000 -
+// NRPN - non registered parameter numbers 0x30000 -
+
+// internal controller types:
+const int CTRL_INTERNAL_OFFSET = 0x40000;
+
+// p3.3.37
+//const int CTRL_PITCH = 0x40000;
+//const int CTRL_PROGRAM = 0x40001;
+//const int CTRL_VELOCITY = 0x40002;
+//const int CTRL_MASTER_VOLUME = 0x40003;
+const int CTRL_PITCH = CTRL_INTERNAL_OFFSET;
+const int CTRL_PROGRAM = CTRL_INTERNAL_OFFSET + 1;
+const int CTRL_VELOCITY = CTRL_INTERNAL_OFFSET + 2;
+//const int CTRL_MASTER_VOLUME = CTRL_INTERNAL_OFFSET + 3;
+
+const int CTRL_VAL_UNKNOWN = 0x10000000; // used as unknown hwVal
+
+const int CTRL_14_OFFSET = 0x10000;
+const int CTRL_RPN_OFFSET = 0x20000;
+const int CTRL_NRPN_OFFSET = 0x30000;
+const int CTRL_RPN14_OFFSET = 0x50000;
+const int CTRL_NRPN14_OFFSET = 0x60000;
+const int CTRL_NONE_OFFSET = 0x70000;
+
+class Xml;
+class Part;
+
+//---------------------------------------------------------
+// MidiController
+//---------------------------------------------------------
+
+class MidiController {
+ public:
+ //
+ // mapping of midi controller types to
+ // controller number:
+ //
+ enum ControllerType {
+ Controller7, // num values from 0 - 0x7f
+ Controller14, // values from 0x10000 - 0x12fff
+ RPN, // registered parameter 0x20000 -
+ NRPN, // non registered parameter 0x30000 -
+ RPN14, // registered parameter 0x50000
+ NRPN14, // non registered parameter 0x60000 -
+ Pitch, // num value = CTRL_PITCH
+ Program, // num value = CTRL_PROGRAM
+ Velo // not assigned
+ };
+ private:
+ QString _name;
+ int _num; // Controller Number
+ int _minVal; // controller value range (used in gui)
+ int _maxVal;
+ int _initVal;
+ int _bias;
+ void updateBias();
+
+ public:
+ MidiController();
+ MidiController(const QString& n, int num, int min, int max, int init);
+ MidiController(const MidiController& mc);
+ void copy(const MidiController &mc);
+ MidiController& operator= (const MidiController &mc);
+
+ const QString& name() const { return _name; }
+ int num() const { return _num; }
+ void setName(const QString& s) { _name = s; }
+ void setNum(int v) { _num = v; }
+ void write(int level, Xml& xml) const;
+ void read(Xml& xml);
+ int minVal() const { return _minVal; }
+ int maxVal() const { return _maxVal; }
+ int initVal() const { return _initVal; }
+ void setInitVal(int val) { _initVal = val; }
+ void setMinVal(int val) { _minVal = val; updateBias(); }
+ void setMaxVal(int val) { _maxVal = val; updateBias(); }
+ int bias() const { return _bias; }
+ static int genNum(ControllerType, int, int);
+ };
+
+// Added by T356.
+struct MidiCtrlVal
+{
+ // The part containing the event which this value came from. Used for searching and deleting.
+ Part* part;
+ // The stored value.
+ int val;
+};
+
+//---------------------------------------------------------
+// MidiCtrlValList
+// arrange controller events of a specific type in a
+// list for easy retrieval
+//---------------------------------------------------------
+
+// Changed by T356.
+//typedef std::map<int, int, std::less<int> >::iterator iMidiCtrlVal;
+//typedef std::map<int, int, std::less<int> >::const_iterator ciMidiCtrlVal;
+typedef std::multimap<int, MidiCtrlVal, std::less<int> >::iterator iMidiCtrlVal;
+typedef std::multimap<int, MidiCtrlVal, std::less<int> >::const_iterator ciMidiCtrlVal;
+
+typedef std::pair <iMidiCtrlVal, iMidiCtrlVal> MidiCtrlValRange;
+// Changed by T356.
+//class MidiCtrlValList : public std::map<int, int, std::less<int> > {
+class MidiCtrlValList : public std::multimap<int, MidiCtrlVal, std::less<int> > {
+
+ int ctrlNum;
+ int _lastValidHWVal;
+ int _hwVal; // current set value in midi hardware
+ // can be CTRL_VAL_UNKNOWN
+
+ // Hide built-in finds.
+ iMidiCtrlVal find(const int&) { return end(); };
+ ciMidiCtrlVal find(const int&) const { return end(); };
+
+ public:
+ MidiCtrlValList(int num);
+
+ Part* partAtTick(int tick) const;
+
+ iMidiCtrlVal iValue(int tick);
+ int value(int tick) const;
+ //int value(int tick, Part** part = 0) const;
+ int value(int tick, Part* part) const;
+ // Changed by T356.
+ //bool add(int tick, int value);
+ //void del(int tick);
+ bool addMCtlVal(int tick, int value, Part* part);
+ void delMCtlVal(int tick, Part* part);
+
+ iMidiCtrlVal findMCtlVal(int tick, Part* part);
+
+ int hwVal() const { return _hwVal; }
+ bool setHwVal(const int v);
+ bool setHwVals(const int v, const int lastv);
+ int num() const { return ctrlNum; }
+ int lastValidHWVal() const { return _lastValidHWVal; }
+ };
+
+//---------------------------------------------------------
+// MidiCtrlValListList
+// List of midi controller value lists.
+// This list represents the controller state of a
+// midi port.
+// index = (channelNumber << 24) + ctrlNumber
+//---------------------------------------------------------
+
+typedef std::map<int, MidiCtrlValList*, std::less<int> >::iterator iMidiCtrlValList;
+typedef std::map<int, MidiCtrlValList*, std::less<int> >::const_iterator ciMidiCtrlValList;
+
+class MidiCtrlValListList : public std::map<int, MidiCtrlValList*, std::less<int> > {
+ public:
+ void add(int channel, MidiCtrlValList* vl) {
+ insert(std::pair<const int, MidiCtrlValList*>((channel << 24) + vl->num(), vl));
+ }
+ iMidiCtrlValList find(int channel, int ctrl) {
+ return std::map<int, MidiCtrlValList*, std::less<int> >::find((channel << 24) + ctrl);
+ }
+ void clearDelete(bool deleteLists);
+ };
+
+//---------------------------------------------------------
+// MidiControllerList
+// this is a list of used midi controllers created
+// - excplicit by user
+// - implicit during import of a midi file
+//---------------------------------------------------------
+
+class MidiControllerList : public std::map<int, MidiController*, std::less<int> >
+{
+ public:
+ MidiControllerList() {}
+ MidiControllerList(const MidiControllerList& mcl);
+
+ void add(MidiController* mc) { insert(std::pair<int, MidiController*>(mc->num(), mc)); }
+};
+
+typedef MidiControllerList::iterator iMidiController;
+typedef MidiControllerList::const_iterator ciMidiController;
+typedef MidiControllerList MidiControllerList;
+
+extern MidiControllerList defaultMidiController;
+extern void initMidiController();
+extern MidiController::ControllerType midiControllerType(int num);
+
+
+extern const QString& int2ctrlType(int n);
+extern MidiController::ControllerType ctrlType2Int(const QString& s);
+extern QString midiCtrlName(int ctrl);
+extern MidiController veloCtrl;
+
+
+typedef std::map<int, int, std::less<int> > MidiCtl2LadspaPortMap;
+typedef MidiCtl2LadspaPortMap::iterator iMidiCtl2LadspaPort;
+typedef MidiCtl2LadspaPortMap::const_iterator ciMidiCtl2LadspaPort;
+
+
+#endif
+
diff --git a/muse2/muse/mididev.cpp b/muse2/muse/mididev.cpp
new file mode 100644
index 00000000..7f52fc2e
--- /dev/null
+++ b/muse2/muse/mididev.cpp
@@ -0,0 +1,548 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mididev.cpp,v 1.10.2.6 2009/11/05 03:14:35 terminator356 Exp $
+//
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <config.h>
+
+#include <qmessagebox.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "midictrl.h"
+#include "song.h"
+#include "midi.h"
+#include "midiport.h"
+#include "mididev.h"
+#include "config.h"
+#include "globals.h"
+#include "audio.h"
+#include "midiseq.h"
+//#include "sync.h"
+#include "midiitransform.h"
+
+#ifdef MIDI_DRIVER_MIDI_SERIAL
+extern void initMidiSerial();
+#endif
+extern bool initMidiAlsa();
+extern bool initMidiJack();
+
+MidiDeviceList midiDevices;
+extern void processMidiInputTransformPlugins(MEvent&);
+
+extern unsigned int volatile lastExtMidiSyncTick;
+
+//---------------------------------------------------------
+// initMidiDevices
+//---------------------------------------------------------
+
+void initMidiDevices()
+ {
+#ifdef MIDI_DRIVER_MIDI_SERIAL
+ initMidiSerial();
+#endif
+ if(initMidiAlsa())
+ {
+ QMessageBox::critical(NULL, "MusE fatal error.", "MusE failed to initialize the\n"
+ "Alsa midi subsystem, check\n"
+ "your configuration.");
+ exit(-1);
+ }
+
+ if(initMidiJack())
+ {
+ QMessageBox::critical(NULL, "MusE fatal error.", "MusE failed to initialize the\n"
+ "Jack midi subsystem, check\n"
+ "your configuration.");
+ exit(-1);
+ }
+ }
+
+//---------------------------------------------------------
+// init
+//---------------------------------------------------------
+
+void MidiDevice::init()
+ {
+ _readEnable = false;
+ _writeEnable = false;
+ _rwFlags = 3;
+ _openFlags = 3;
+ _port = -1;
+ _nextPlayEvent = _playEvents.begin();
+ }
+
+//---------------------------------------------------------
+// MidiDevice
+//---------------------------------------------------------
+
+MidiDevice::MidiDevice()
+ {
+ ///_recBufFlipped = false;
+ //_tmpRecordCount = 0;
+ for(unsigned int i = 0; i < MIDI_CHANNELS + 1; ++i)
+ _tmpRecordCount[i] = 0;
+
+ _sysexFIFOProcessed = false;
+ //_sysexWritingChunks = false;
+ _sysexReadingChunks = false;
+
+ init();
+ }
+
+MidiDevice::MidiDevice(const QString& n)
+ : _name(n)
+ {
+ ///_recBufFlipped = false;
+ //_tmpRecordCount = 0;
+ for(unsigned int i = 0; i < MIDI_CHANNELS + 1; ++i)
+ _tmpRecordCount[i] = 0;
+
+ _sysexFIFOProcessed = false;
+ //_sysexWritingChunks = false;
+ _sysexReadingChunks = false;
+
+ init();
+ }
+
+//---------------------------------------------------------
+// filterEvent
+// return true if event filtered
+//---------------------------------------------------------
+
+//static bool filterEvent(const MEvent& event, int type, bool thru)
+bool filterEvent(const MEvent& event, int type, bool thru)
+ {
+ switch(event.type()) {
+ case ME_NOTEON:
+ case ME_NOTEOFF:
+ if (type & MIDI_FILTER_NOTEON)
+ return true;
+ break;
+ case ME_POLYAFTER:
+ if (type & MIDI_FILTER_POLYP)
+ return true;
+ break;
+ case ME_CONTROLLER:
+ if (type & MIDI_FILTER_CTRL)
+ return true;
+ if (!thru && (midiFilterCtrl1 == event.dataA()
+ || midiFilterCtrl2 == event.dataA()
+ || midiFilterCtrl3 == event.dataA()
+ || midiFilterCtrl4 == event.dataA())) {
+ return true;
+ }
+ break;
+ case ME_PROGRAM:
+ if (type & MIDI_FILTER_PROGRAM)
+ return true;
+ break;
+ case ME_AFTERTOUCH:
+ if (type & MIDI_FILTER_AT)
+ return true;
+ break;
+ case ME_PITCHBEND:
+ if (type & MIDI_FILTER_PITCH)
+ return true;
+ break;
+ case ME_SYSEX:
+ if (type & MIDI_FILTER_SYSEX)
+ return true;
+ break;
+ default:
+ break;
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// afterProcess
+// clear all recorded events after a process cycle
+//---------------------------------------------------------
+
+void MidiDevice::afterProcess()
+{
+ //while (_tmpRecordCount--)
+ // _recordFifo.remove();
+
+ for(unsigned int i = 0; i < MIDI_CHANNELS + 1; ++i)
+ {
+ while (_tmpRecordCount[i]--)
+ _recordFifo[i].remove();
+ }
+}
+
+//---------------------------------------------------------
+// beforeProcess
+// "freeze" fifo for this process cycle
+//---------------------------------------------------------
+
+void MidiDevice::beforeProcess()
+{
+ //if (!jackPort(0).isZero())
+ // audioDriver->collectMidiEvents(this, jackPort(0));
+
+ //_tmpRecordCount = _recordFifo.getSize();
+ for(unsigned int i = 0; i < MIDI_CHANNELS + 1; ++i)
+ _tmpRecordCount[i] = _recordFifo[i].getSize();
+
+ // Reset this.
+ _sysexFIFOProcessed = false;
+}
+
+/*
+//---------------------------------------------------------
+// getEvents
+//---------------------------------------------------------
+
+void MidiDevice::getEvents(unsigned , unsigned , int ch, MPEventList* dst) //from //to
+{
+ for (int i = 0; i < _tmpRecordCount; ++i) {
+ const MidiPlayEvent& ev = _recordFifo.peek(i);
+ if (ch == -1 || (ev.channel() == ch))
+ dst->insert(ev);
+ }
+
+ //while(!recordFifo.isEmpty())
+ //{
+ // MidiPlayEvent e(recordFifo.get());
+ // if (ch == -1 || (e.channel() == ch))
+ // dst->insert(e);
+ //}
+}
+*/
+
+/*
+//---------------------------------------------------------
+// recordEvent
+//---------------------------------------------------------
+
+MREventList* MidiDevice::recordEvents()
+{
+ // Return which list is NOT currently being filled with incoming midi events. By T356.
+ if(_recBufFlipped)
+ return &_recordEvents;
+ else
+ return &_recordEvents2;
+}
+*/
+
+//---------------------------------------------------------
+// recordEvent
+//---------------------------------------------------------
+
+void MidiDevice::recordEvent(MidiRecordEvent& event)
+ {
+ // p3.3.35
+ // TODO: Tested, but record resolution not so good. Switch to wall clock based separate list in MidiDevice. And revert this line.
+ //event.setTime(audio->timestamp());
+ event.setTime(extSyncFlag.value() ? lastExtMidiSyncTick : audio->timestamp());
+
+ //printf("MidiDevice::recordEvent event time:%d\n", event.time());
+
+ // Added by Tim. p3.3.8
+
+ // By T356. Set the loop number which the event came in at.
+ //if(audio->isRecording())
+ if(audio->isPlaying())
+ event.setLoopNum(audio->loopCount());
+
+ if (midiInputTrace) {
+ printf("MidiInput: ");
+ event.dump();
+ }
+
+ int typ = event.type();
+
+ if(_port != -1)
+ {
+ int idin = midiPorts[_port].syncInfo().idIn();
+
+// p3.3.26 1/23/10 Section was disabled, enabled by Tim.
+//#if 0
+
+ //---------------------------------------------------
+ // filter some SYSEX events
+ //---------------------------------------------------
+
+ if (typ == ME_SYSEX) {
+ const unsigned char* p = event.data();
+ int n = event.len();
+ if (n >= 4) {
+ if ((p[0] == 0x7f)
+ //&& ((p[1] == 0x7f) || (p[1] == rxDeviceId))) {
+ && ((p[1] == 0x7f) || (idin == 0x7f) || (p[1] == idin))) {
+ if (p[2] == 0x06) {
+ //mmcInput(p, n);
+ midiSeq->mmcInput(_port, p, n);
+ return;
+ }
+ if (p[2] == 0x01) {
+ //mtcInputFull(p, n);
+ midiSeq->mtcInputFull(_port, p, n);
+ return;
+ }
+ }
+ else if (p[0] == 0x7e) {
+ //nonRealtimeSystemSysex(p, n);
+ midiSeq->nonRealtimeSystemSysex(_port, p, n);
+ return;
+ }
+ }
+ }
+ else
+ // p3.3.26 1/23/10 Moved here from alsaProcessMidiInput(). Anticipating Jack midi support, so don't make it ALSA specific. Tim.
+ // Trigger general activity indicator detector. Sysex has no channel, don't trigger.
+ midiPorts[_port].syncInfo().trigActDetect(event.channel());
+
+//#endif
+
+ }
+
+ //
+ // process midi event input filtering and
+ // transformation
+ //
+
+ processMidiInputTransformPlugins(event);
+
+ if (filterEvent(event, midiRecordType, false))
+ return;
+
+ if (!applyMidiInputTransformation(event)) {
+ if (midiInputTrace)
+ printf(" midi input transformation: event filtered\n");
+ return;
+ }
+
+ //
+ // transfer noteOn events to gui for step recording and keyboard
+ // remote control
+ //
+ if (typ == ME_NOTEON) {
+ int pv = ((event.dataA() & 0xff)<<8) + (event.dataB() & 0xff);
+ song->putEvent(pv);
+ }
+
+ ///if(_recBufFlipped)
+ /// _recordEvents2.add(event); // add event to secondary list of recorded events
+ ///else
+ /// _recordEvents.add(event); // add event to primary list of recorded events
+
+ //if(_recordFifo.put(MidiPlayEvent(event)))
+ // printf("MidiDevice::recordEvent: fifo overflow\n");
+
+ // p3.3.38
+ // Do not bother recording if it is NOT actually being used by a port.
+ // Because from this point on, process handles things, by selected port.
+ if(_port == -1)
+ return;
+
+ // Split the events up into channel fifos. Special 'channel' number 17 for sysex events.
+ unsigned int ch = (typ == ME_SYSEX)? MIDI_CHANNELS : event.channel();
+ if(_recordFifo[ch].put(MidiPlayEvent(event)))
+ printf("MidiDevice::recordEvent: fifo channel %d overflow\n", ch);
+ }
+
+//---------------------------------------------------------
+// find
+//---------------------------------------------------------
+
+MidiDevice* MidiDeviceList::find(const QString& s, int typeHint)
+ {
+ for (iMidiDevice i = begin(); i != end(); ++i)
+ if( (typeHint == -1 || typeHint == (*i)->deviceType()) && ((*i)->name() == s) )
+ return *i;
+ return 0;
+ }
+
+iMidiDevice MidiDeviceList::find(const MidiDevice* dev)
+ {
+ for (iMidiDevice i = begin(); i != end(); ++i)
+ if (*i == dev)
+ return i;
+ return end();
+ }
+
+//---------------------------------------------------------
+// add
+//---------------------------------------------------------
+
+void MidiDeviceList::add(MidiDevice* dev)
+ {
+ bool gotUniqueName=false;
+ int increment = 0;
+ QString origname = dev->name();
+ while (!gotUniqueName) {
+ gotUniqueName = true;
+ // check if the name's been taken
+ for (iMidiDevice i = begin(); i != end(); ++i) {
+ const QString s = (*i)->name();
+ if (s == dev->name())
+ {
+ char incstr[4];
+ sprintf(incstr,"_%d",++increment);;
+ dev->setName(origname + incstr);
+ gotUniqueName = false;
+ }
+ }
+ }
+
+ push_back(dev);
+ }
+
+//---------------------------------------------------------
+// remove
+//---------------------------------------------------------
+
+void MidiDeviceList::remove(MidiDevice* dev)
+ {
+ for (iMidiDevice i = begin(); i != end(); ++i) {
+ if (*i == dev) {
+ erase(i);
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// sendNullRPNParams
+//---------------------------------------------------------
+
+bool MidiDevice::sendNullRPNParams(int chn, bool nrpn)
+{
+ if(_port == -1)
+ return false;
+
+ int nv = midiPorts[_port].nullSendValue();
+ if(nv == -1)
+ return false;
+
+ int nvh = (nv >> 8) & 0xff;
+ int nvl = nv & 0xff;
+ if(nvh != 0xff)
+ {
+ if(nrpn)
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_HNRPN, nvh & 0x7f));
+ else
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_HRPN, nvh & 0x7f));
+ }
+ if(nvl != 0xff)
+ {
+ if(nrpn)
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_LNRPN, nvl & 0x7f));
+ else
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_LRPN, nvl & 0x7f));
+ }
+ return true;
+}
+
+//---------------------------------------------------------
+// putEvent
+// return true if event cannot be delivered
+// TODO: retry on controller putMidiEvent
+//---------------------------------------------------------
+
+bool MidiDevice::putEvent(const MidiPlayEvent& ev)
+ {
+ if(!_writeEnable)
+ //return true;
+ return false;
+
+ if (ev.type() == ME_CONTROLLER) {
+ int a = ev.dataA();
+ int b = ev.dataB();
+ int chn = ev.channel();
+ if (a == CTRL_PITCH) {
+ return putMidiEvent(MidiPlayEvent(0, 0, chn, ME_PITCHBEND, b, 0));
+ }
+ if (a == CTRL_PROGRAM) {
+ // don't output program changes for GM drum channel
+ if (!(song->mtype() == MT_GM && chn == 9)) {
+ int hb = (b >> 16) & 0xff;
+ int lb = (b >> 8) & 0xff;
+ int pr = b & 0x7f;
+ if (hb != 0xff)
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_HBANK, hb));
+ if (lb != 0xff)
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_LBANK, lb));
+ return putMidiEvent(MidiPlayEvent(0, 0, chn, ME_PROGRAM, pr, 0));
+ }
+ }
+#if 1 // if ALSA cannot handle RPN NRPN etc.
+
+ // p3.3.37
+ //if (a < 0x1000) { // 7 Bit Controller
+ if (a < CTRL_14_OFFSET) { // 7 Bit Controller
+ //putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, a, b));
+ putMidiEvent(ev);
+ }
+ //else if (a < 0x20000) { // 14 bit high resolution controller
+ else if (a < CTRL_RPN_OFFSET) { // 14 bit high resolution controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ int dataH = (b >> 7) & 0x7f;
+ int dataL = b & 0x7f;
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, ctrlH, dataH));
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, ctrlL, dataL));
+ }
+ //else if (a < 0x30000) { // RPN 7-Bit Controller
+ else if (a < CTRL_NRPN_OFFSET) { // RPN 7-Bit Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_HRPN, ctrlH));
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_LRPN, ctrlL));
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_HDATA, b));
+
+ // Added by T356. Select null parameters so that subsequent data controller
+ // events do not upset the last *RPN controller.
+ sendNullRPNParams(chn, false);
+ }
+ //else if (a < 0x40000) { // NRPN 7-Bit Controller
+ else if (a < CTRL_INTERNAL_OFFSET) { // NRPN 7-Bit Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_HNRPN, ctrlH));
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_LNRPN, ctrlL));
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_HDATA, b));
+
+ sendNullRPNParams(chn, true);
+ }
+ //else if (a < 0x60000) { // RPN14 Controller
+ else if (a < CTRL_NRPN14_OFFSET) { // RPN14 Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ int dataH = (b >> 7) & 0x7f;
+ int dataL = b & 0x7f;
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_HRPN, ctrlH));
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_LRPN, ctrlL));
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_HDATA, dataH));
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_LDATA, dataL));
+
+ sendNullRPNParams(chn, false);
+ }
+ //else if (a < 0x70000) { // NRPN14 Controller
+ else if (a < CTRL_NONE_OFFSET) { // NRPN14 Controller
+ int ctrlH = (a >> 8) & 0x7f;
+ int ctrlL = a & 0x7f;
+ int dataH = (b >> 7) & 0x7f;
+ int dataL = b & 0x7f;
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_HNRPN, ctrlH));
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_LNRPN, ctrlL));
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_HDATA, dataH));
+ putMidiEvent(MidiPlayEvent(0, 0, chn, ME_CONTROLLER, CTRL_LDATA, dataL));
+
+ sendNullRPNParams(chn, true);
+ }
+ else {
+ printf("putEvent: unknown controller type 0x%x\n", a);
+ }
+ return false;
+#endif
+ }
+ return putMidiEvent(ev);
+ }
diff --git a/muse2/muse/mididev.h b/muse2/muse/mididev.h
new file mode 100644
index 00000000..1b2cf055
--- /dev/null
+++ b/muse2/muse/mididev.h
@@ -0,0 +1,157 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mididev.h,v 1.3.2.4 2009/04/04 01:49:50 terminator356 Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MIDIDEV_H__
+#define __MIDIDEV_H__
+
+#include <qstring.h>
+#include <list>
+
+#include "mpevent.h"
+//#include "sync.h"
+#include "route.h"
+#include "globaldefs.h"
+
+//class RouteList;
+class Xml;
+
+//---------------------------------------------------------
+// MidiDevice
+//---------------------------------------------------------
+
+class MidiDevice {
+ MPEventList _stuckNotes;
+ MPEventList _playEvents;
+ iMPEvent _nextPlayEvent;
+ ///MREventList _recordEvents;
+ ///MREventList _recordEvents2;
+
+ // Used for multiple reads of fifos during process.
+ //int _tmpRecordCount;
+ int _tmpRecordCount[MIDI_CHANNELS + 1];
+ bool _sysexFIFOProcessed;
+
+ ///bool _recBufFlipped;
+ // Holds sync settings and detection monitors.
+ //MidiSyncInfo _syncInfo;
+
+ protected:
+ QString _name;
+ int _port; // connected to midi port; -1 - not connected
+ int _rwFlags; // possible open flags, 1 write, 2 read, 3 rw
+ int _openFlags; // configured open flags
+ bool _readEnable; // set when opened/closed.
+ bool _writeEnable; //
+ //int _sysexWriteChunk;
+ //int _sysexReadChunk;
+ //bool _sysexWritingChunks;
+ bool _sysexReadingChunks;
+
+ // Recording fifo.
+ //MidiFifo _recordFifo;
+ // Recording fifos. To speed up processing, one per channel plus one special system 'channel' for channel-less events like sysex.
+ MidiFifo _recordFifo[MIDI_CHANNELS + 1];
+
+ RouteList _inRoutes, _outRoutes;
+
+ void init();
+ virtual bool putMidiEvent(const MidiPlayEvent&) = 0;
+
+ public:
+ enum { ALSA_MIDI=0, JACK_MIDI=1, SYNTH_MIDI=2 };
+
+ MidiDevice();
+ MidiDevice(const QString& name);
+ virtual ~MidiDevice() {}
+
+ virtual int deviceType() = 0;
+
+ virtual void* clientPort() { return 0; }
+ virtual QString open() = 0;
+ virtual void close() = 0;
+ virtual void writeRouting(int, Xml&) const { };
+
+ RouteList* inRoutes() { return &_inRoutes; }
+ RouteList* outRoutes() { return &_outRoutes; }
+ bool noInRoute() const { return _inRoutes.empty(); }
+ bool noOutRoute() const { return _outRoutes.empty(); }
+
+ const QString& name() const { return _name; }
+ virtual void setName(const QString& s) { _name = s; }
+
+ int midiPort() const { return _port; }
+ void setPort(int p) { _port = p; }
+
+ int rwFlags() const { return _rwFlags; }
+ int openFlags() const { return _openFlags; }
+ void setOpenFlags(int val) { _openFlags = val; }
+ void setrwFlags(int val) { _rwFlags = val; }
+ //MidiSyncInfo& syncInfo() { return _syncInfo; }
+
+ virtual bool isSynti() const { return false; }
+ virtual int selectRfd() { return -1; }
+ virtual int selectWfd() { return -1; }
+ virtual int bytesToWrite() { return 0; }
+ virtual void flush() {}
+ virtual void processInput() {}
+ virtual void discardInput() {}
+
+ virtual void recordEvent(MidiRecordEvent&);
+
+ virtual bool putEvent(const MidiPlayEvent&);
+
+ // For Jack-based devices - called in Jack audio process callback
+ virtual void collectMidiEvents() {}
+ virtual void processMidi() {}
+
+ MPEventList* stuckNotes() { return &_stuckNotes; }
+ MPEventList* playEvents() { return &_playEvents; }
+
+ ///MREventList* recordEvents();
+ ///void flipRecBuffer() { _recBufFlipped = _recBufFlipped ? false : true; }
+ ///bool recBufFlipped() { return _recBufFlipped; }
+ void beforeProcess();
+ void afterProcess();
+ //int tmpRecordCount() { return _tmpRecordCount; }
+ int tmpRecordCount(const unsigned int ch) { return _tmpRecordCount[ch]; }
+ //MidiFifo& recordEvents() { return _recordFifo; }
+ MidiFifo& recordEvents(const unsigned int ch) { return _recordFifo[ch]; }
+ bool sysexFIFOProcessed() { return _sysexFIFOProcessed; }
+ void setSysexFIFOProcessed(bool v) { _sysexFIFOProcessed = v; }
+ //bool sysexWritingChunks() { return _sysexWritingChunks; }
+ //void setSysexWritingChunks(bool v) { _sysexWritingChunks = v; }
+ bool sysexReadingChunks() { return _sysexReadingChunks; }
+ void setSysexReadingChunks(bool v) { _sysexReadingChunks = v; }
+ //virtual void getEvents(unsigned /*from*/, unsigned /*to*/, int /*channel*/, MPEventList* /*dst*/);
+
+ iMPEvent nextPlayEvent() { return _nextPlayEvent; }
+ void setNextPlayEvent(iMPEvent i) { _nextPlayEvent = i; }
+ bool sendNullRPNParams(int, bool);
+ };
+
+//---------------------------------------------------------
+// MidiDeviceList
+//---------------------------------------------------------
+
+typedef std::list<MidiDevice*>::iterator iMidiDevice;
+
+class MidiDeviceList : public std::list<MidiDevice*>
+{
+ public:
+ void add(MidiDevice* dev);
+ void remove(MidiDevice* dev);
+ MidiDevice* find(const QString& name, int typeHint = -1);
+ iMidiDevice find(const MidiDevice* dev);
+};
+
+extern MidiDeviceList midiDevices;
+extern void initMidiDevices();
+extern bool filterEvent(const MEvent& event, int type, bool thru);
+
+#endif
+
diff --git a/muse2/muse/midiedit/Makefile.am b/muse2/muse/midiedit/Makefile.am
new file mode 100644
index 00000000..e817dc99
--- /dev/null
+++ b/muse2/muse/midiedit/Makefile.am
@@ -0,0 +1,36 @@
+include $(top_srcdir)/common.am
+
+if PCH
+AM_CXXFLAGS += -include $(top_srcdir)/all.h
+endif
+
+noinst_LIBRARIES = libmidiedit.a
+
+if PCH
+AM_CXXFLAGS += -include $(top_srcdir)/all-pic.h -DINSTPREFIX=\"$(prefix)\"
+else
+AM_CXXFLAGS += -DINSTPREFIX=\"$(prefix)\"
+endif
+
+dist_libmidiedit_a_SOURCES = \
+ drummap.cpp drummap.h \
+ cmd.h \
+ pianoroll.cpp pianoroll.h \
+ piano.cpp piano.h \
+ prcanvas.cpp prcanvas.h \
+ quantconfig.cpp quantconfig.h \
+ drumedit.cpp drumedit.h \
+ dlist.cpp dlist.h \
+ dcanvas.cpp dcanvas.h \
+ ecanvas.cpp ecanvas.h
+
+nodist_libmidiedit_a_SOURCES = \
+ moc_pianoroll.cpp \
+ moc_piano.cpp \
+ moc_prcanvas.cpp \
+ moc_quantconfig.cpp \
+ moc_drumedit.cpp \
+ moc_dlist.cpp \
+ moc_dcanvas.cpp \
+ moc_ecanvas.cpp
+
diff --git a/muse2/muse/midiedit/Makefile.in b/muse2/muse/midiedit/Makefile.in
new file mode 100644
index 00000000..01425ebc
--- /dev/null
+++ b/muse2/muse/midiedit/Makefile.in
@@ -0,0 +1,636 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/common.am
+@PCH_TRUE@am__append_1 = -include $(top_srcdir)/all.h -include \
+@PCH_TRUE@ $(top_srcdir)/all-pic.h -DINSTPREFIX=\"$(prefix)\"
+@PCH_FALSE@am__append_2 = -DINSTPREFIX=\"$(prefix)\"
+subdir = muse/midiedit
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
+ $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libmidiedit_a_AR = $(AR) $(ARFLAGS)
+libmidiedit_a_LIBADD =
+dist_libmidiedit_a_OBJECTS = drummap.$(OBJEXT) pianoroll.$(OBJEXT) \
+ piano.$(OBJEXT) prcanvas.$(OBJEXT) quantconfig.$(OBJEXT) \
+ drumedit.$(OBJEXT) dlist.$(OBJEXT) dcanvas.$(OBJEXT) \
+ ecanvas.$(OBJEXT)
+nodist_libmidiedit_a_OBJECTS = moc_pianoroll.$(OBJEXT) \
+ moc_piano.$(OBJEXT) moc_prcanvas.$(OBJEXT) \
+ moc_quantconfig.$(OBJEXT) moc_drumedit.$(OBJEXT) \
+ moc_dlist.$(OBJEXT) moc_dcanvas.$(OBJEXT) \
+ moc_ecanvas.$(OBJEXT)
+libmidiedit_a_OBJECTS = $(dist_libmidiedit_a_OBJECTS) \
+ $(nodist_libmidiedit_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(dist_libmidiedit_a_SOURCES) \
+ $(nodist_libmidiedit_a_SOURCES)
+DIST_SOURCES = $(dist_libmidiedit_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCBOOKSTYLE = @DOCBOOKSTYLE@
+DOCBOOKTARGETS = @DOCBOOKTARGETS@
+DOT = @DOT@
+DOTPATH = @DOTPATH@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@
+FST_CFLAGS = @FST_CFLAGS@
+FST_LIBS = @FST_LIBS@
+Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@
+Fluidsynth_LIBS = @Fluidsynth_LIBS@
+GIVERTCAP = @GIVERTCAP@
+GREP = @GREP@
+HAVEDOT = @HAVEDOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JADE = @JADE@
+LASH_CFLAGS = @LASH_CFLAGS@
+LASH_LIBS = @LASH_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LO_CFLAGS = @LO_CFLAGS@
+LO_LIBS = @LO_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUSECXXFLAGS = @MUSECXXFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSGMLS = @NSGMLS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCH = @PCH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIB = @PYTHON_LIB@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+QTDIR_BIN = @QTDIR_BIN@
+QTDIR_INC = @QTDIR_INC@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+SUIDBUILD = @SUIDBUILD@
+SUIDINSTALL = @SUIDINSTALL@
+USE_SSE = @USE_SSE@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+have_docbook = @have_docbook@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+synth_fluid = @synth_fluid@
+synth_fluidsynth = @synth_fluidsynth@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \
+ -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(am__append_1) \
+ $(am__append_2)
+AM_CPPFLAGS =
+MOC = $(QTDIR_BIN)/moc
+#UIC = $(QTDIR_BIN)/uic3
+UIC = /usr/bin/uic3
+UIFILES = $(wildcard *.ui)
+MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \
+ if grep -q Q_OBJECT $$h; then \
+ echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \
+ fi; \
+ done)
+
+BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+SUFFIXES = .ui .h.gch
+noinst_LIBRARIES = libmidiedit.a
+dist_libmidiedit_a_SOURCES = \
+ drummap.cpp drummap.h \
+ cmd.h \
+ pianoroll.cpp pianoroll.h \
+ piano.cpp piano.h \
+ prcanvas.cpp prcanvas.h \
+ quantconfig.cpp quantconfig.h \
+ drumedit.cpp drumedit.h \
+ dlist.cpp dlist.h \
+ dcanvas.cpp dcanvas.h \
+ ecanvas.cpp ecanvas.h
+
+nodist_libmidiedit_a_SOURCES = \
+ moc_pianoroll.cpp \
+ moc_piano.cpp \
+ moc_prcanvas.cpp \
+ moc_quantconfig.cpp \
+ moc_drumedit.cpp \
+ moc_dlist.cpp \
+ moc_dcanvas.cpp \
+ moc_ecanvas.cpp
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .ui .h.gch .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/midiedit/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu muse/midiedit/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libmidiedit.a: $(libmidiedit_a_OBJECTS) $(libmidiedit_a_DEPENDENCIES)
+ -rm -f libmidiedit.a
+ $(libmidiedit_a_AR) libmidiedit.a $(libmidiedit_a_OBJECTS) $(libmidiedit_a_LIBADD)
+ $(RANLIB) libmidiedit.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dcanvas.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dlist.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drumedit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drummap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecanvas.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_dcanvas.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_dlist.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_drumedit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_ecanvas.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_piano.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_pianoroll.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_prcanvas.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_quantconfig.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/piano.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pianoroll.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prcanvas.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quantconfig.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+de:
+ @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done
+
+nde:
+ @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done
+
+.ui.o: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(CXXCOMPILE) -c $*.cpp -o $*.o
+ $(RM) $*.cpp moc_$*.cpp moc_$*.o
+
+.ui.lo: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(LTCXXCOMPILE) -c $*.cpp -o $*.lo
+ $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o
+
+moc_%.cpp: %.h
+ $(MOC) $< -o $@
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/muse2/muse/midiedit/cmd.h b/muse2/muse/midiedit/cmd.h
new file mode 100644
index 00000000..abbcdcf3
--- /dev/null
+++ b/muse2/muse/midiedit/cmd.h
@@ -0,0 +1,26 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: cmd.h,v 1.1.1.1 2003/10/27 18:52:20 wschweer Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __CMD_H__
+#define __CMD_H__
+
+#define CMD_LEFT 0
+#define CMD_RIGHT 1
+#define CMD_INSERT 2
+#define CMD_DELETE 3
+#define CMD_1 4
+#define CMD_2 5
+#define CMD_3 6
+#define CMD_4 7
+#define CMD_5 8
+#define CMD_6 9
+#define CMD_7 10
+#define CMD_T 11
+#define CMD_period 12
+
+#endif
+
diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp
new file mode 100644
index 00000000..65138bb4
--- /dev/null
+++ b/muse2/muse/midiedit/dcanvas.cpp
@@ -0,0 +1,1291 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: dcanvas.cpp,v 1.16.2.10 2009/10/15 22:45:50 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qpainter.h>
+#include <qapplication.h>
+#include <qclipboard.h>
+#include <q3dragobject.h>
+//Added by qt3to4:
+#include <QDragLeaveEvent>
+#include <Q3PointArray>
+#include <Q3CString>
+#include <QDragEnterEvent>
+#include <QDragMoveEvent>
+#include <QDropEvent>
+#include <QResizeEvent>
+
+#include <stdio.h>
+#include <values.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+
+#include "dcanvas.h"
+#include "midieditor.h"
+#include "drummap.h"
+#include "event.h"
+#include "mpevent.h"
+#include "xml.h"
+#include "globals.h"
+#include "midiport.h"
+#include "audio.h"
+#include "velocity.h"
+
+#define CARET 10
+#define CARET2 5
+
+//---------------------------------------------------------
+// DEvent
+//---------------------------------------------------------
+
+DEvent::DEvent(Event e, Part* p)
+ : CItem(e, p)
+ {
+ int instr = e.pitch();
+ int y = instr * TH + TH/2;
+ int tick = e.tick() + p->tick();
+ setPos(QPoint(tick, y));
+ setBBox(QRect(-CARET2, -CARET2, CARET, CARET));
+ }
+
+//---------------------------------------------------------
+// addItem
+//---------------------------------------------------------
+
+void DrumCanvas::addItem(Part* part, Event& event)
+ {
+ if (signed(event.tick())<0) {
+ printf("ERROR: trying to add event before current part!\n");
+ return;
+ }
+
+ DEvent* ev = new DEvent(event, part);
+ items.add(ev);
+
+ int diff = event.endTick()-part->lenTick();
+ if (diff > 0) {// too short part? extend it
+ //printf("addItem - this code should not be run!\n");
+ //Part* newPart = part->clone();
+ //newPart->setLenTick(newPart->lenTick()+diff);
+ //audio->msgChangePart(part, newPart,false);
+ //part = newPart;
+ part->setLenTick(part->lenTick()+diff);
+ }
+ }
+
+//---------------------------------------------------------
+// DrumCanvas
+//---------------------------------------------------------
+
+DrumCanvas::DrumCanvas(MidiEditor* pr, QWidget* parent, int sx,
+ int sy, const char* name)
+ : EventCanvas(pr, parent, sx, sy, name)
+ {
+ setVirt(false);
+ songChanged(SC_TRACK_INSERTED);
+ }
+
+//---------------------------------------------------------
+// moveCanvasItems
+//---------------------------------------------------------
+
+void DrumCanvas::moveCanvasItems(CItemList& items, int dp, int dx, DragType dtype, int* pflags)
+{
+ if(editor->parts()->empty())
+ return;
+
+ PartsToChangeMap parts2change;
+
+ int modified = 0;
+ for(iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip)
+ {
+ Part* part = ip->second;
+ if(!part)
+ continue;
+
+ int npartoffset = 0;
+ for(iCItem ici = items.begin(); ici != items.end(); ++ici)
+ {
+ CItem* ci = ici->second;
+ if(ci->part() != part)
+ continue;
+
+ int x = ci->pos().x() + dx;
+ int y = pitch2y(y2pitch(ci->pos().y()) + dp);
+ QPoint newpos = raster(QPoint(x, y));
+
+ // Test moving the item...
+ DEvent* nevent = (DEvent*) ci;
+ Event event = nevent->event();
+ x = newpos.x();
+ if(x < 0)
+ x = 0;
+ int ntick = editor->rasterVal(x) - part->tick();
+ if(ntick < 0)
+ ntick = 0;
+ int diff = ntick + event.lenTick() - part->lenTick();
+
+ // If moving the item would require a new part size...
+ if(diff > npartoffset)
+ npartoffset = diff;
+ }
+
+ if(npartoffset > 0)
+ {
+ // Create new part...
+ // if there are several events that are moved outside the part, it will be recreated for each
+ // so the part _in_ the event will not be valid, ask the authority.
+// Part* newPart = part->clone();
+ //Part* newPart = Canvas::part()->clone();
+
+// newPart->setLenTick(newPart->lenTick() + npartoffset);
+ //audio->msgChangePart(part, newPart,false);
+
+// modified = SC_PART_MODIFIED;
+
+ // BUG FIX: #1650953
+ // Added by T356.
+ // Fixes posted "select and drag past end of part - crashing" bug
+// for(iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip)
+// {
+// if(ip->second == part)
+// {
+// editor->parts()->erase(ip);
+// break;
+// }
+// }
+
+// editor->parts()->add(newPart);
+// audio->msgChangePart(part, newPart,false);
+
+// if(parts2change.find(part) == parts2change.end())
+// parts2change.insert(std::pair<Part*, Part*> (part, newPart));
+ iPartToChange ip2c = parts2change.find(part);
+ if(ip2c == parts2change.end())
+ {
+ PartToChange p2c = {0, npartoffset};
+ parts2change.insert(std::pair<Part*, PartToChange> (part, p2c));
+ }
+ else
+ ip2c->second.xdiff = npartoffset;
+
+
+ //part = newPart; // reassign
+ //item->setPart(part);
+ //item->setEvent(newEvent);
+ //curPart = part;
+ //curPartId = curPart->sn();
+
+ }
+ }
+
+ for(iPartToChange ip2c = parts2change.begin(); ip2c != parts2change.end(); ++ip2c)
+ {
+ Part* opart = ip2c->first;
+ int diff = ip2c->second.xdiff;
+
+ Part* newPart = opart->clone();
+
+ newPart->setLenTick(newPart->lenTick() + diff);
+
+ modified = SC_PART_MODIFIED;
+
+ // BUG FIX: #1650953
+ // Added by T356.
+ // Fixes posted "select and drag past end of part - crashing" bug
+ for(iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip)
+ {
+ if(ip->second == opart)
+ {
+ editor->parts()->erase(ip);
+ break;
+ }
+ }
+
+ editor->parts()->add(newPart);
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(opart, newPart, false);
+ audio->msgChangePart(opart, newPart, false, true, false);
+
+ ip2c->second.npart = newPart;
+
+ }
+
+ iPartToChange icp = parts2change.find(curPart);
+ if(icp != parts2change.end())
+ {
+ curPart = icp->second.npart;
+ curPartId = curPart->sn();
+ }
+
+ std::vector< CItem* > doneList;
+ typedef std::vector< CItem* >::iterator iDoneList;
+
+ for(iCItem ici = items.begin(); ici != items.end(); ++ici)
+ {
+ CItem* ci = ici->second;
+
+ // If this item's part is in the parts2change list, change the item's part to the new part.
+ Part* pt = ci->part();
+ iPartToChange ip2c = parts2change.find(pt);
+ if(ip2c != parts2change.end())
+ ci->setPart(ip2c->second.npart);
+
+ int x = ci->pos().x();
+ int y = ci->pos().y();
+ int nx = x + dx;
+ int ny = pitch2y(y2pitch(y) + dp);
+ QPoint newpos = raster(QPoint(nx, ny));
+ selectItem(ci, true);
+
+ iDoneList idl;
+ for(idl = doneList.begin(); idl != doneList.end(); ++idl)
+ // This compares EventBase pointers to see if they're the same...
+ if((*idl)->event() == ci->event())
+ break;
+
+ // Do not process if the event has already been processed (meaning it's an event in a clone part)...
+ //if(moveItem(ci, newpos, dtype))
+ if(idl != doneList.end())
+ // Just move the canvas item.
+ ci->move(newpos);
+ else
+ {
+ // Currently moveItem always returns true.
+ if(moveItem(ci, newpos, dtype))
+ {
+ // Add the canvas item to the list of done items.
+ doneList.push_back(ci);
+ // Move the canvas item.
+ ci->move(newpos);
+ }
+ }
+
+ if(moving.size() == 1) {
+ itemReleased(curItem, newpos);
+ }
+ if(dtype == MOVE_COPY || dtype == MOVE_CLONE)
+ selectItem(ci, false);
+ }
+
+ if(pflags)
+ *pflags = modified;
+}
+
+//---------------------------------------------------------
+// moveItem
+//---------------------------------------------------------
+
+// Changed by T356.
+//bool DrumCanvas::moveItem(CItem* item, const QPoint& pos, DragType dtype, int* pflags)
+bool DrumCanvas::moveItem(CItem* item, const QPoint& pos, DragType dtype)
+ {
+ DEvent* nevent = (DEvent*) item;
+
+ // Changed by T356.
+ //MidiPart* part = (MidiPart*)Canvas::part(); // part can be dynamically recreated, ask the authority
+ MidiPart* part = (MidiPart*)nevent->part();
+
+ Event event = nevent->event();
+ int x = pos.x();
+ if (x < 0)
+ x = 0;
+ int ntick = editor->rasterVal(x) - part->tick();
+ if (ntick < 0)
+ ntick = 0;
+ int npitch = y2pitch(pos.y());
+ Event newEvent = event.clone();
+
+ newEvent.setPitch(npitch);
+ newEvent.setTick(ntick);
+
+ // Removed by T356.
+ /*
+ // Added by T356.
+ int modified = 0;
+ //song->startUndo();
+ int diff = newEvent.endTick()-part->lenTick();
+ if (diff > 0) // too short part? extend it
+ {
+ // if there are several events that are moved outside the part, it will be recreated for each
+ // so the part _in_ the event will not be valid, ask the authority.
+ //Part* newPart = part->clone();
+ MidiPart* newPart = (MidiPart*)Canvas::part()->clone();
+ newPart->setLenTick(newPart->lenTick()+diff);
+ audio->msgChangePart(Canvas::part(), newPart,false);
+
+ modified = SC_PART_MODIFIED;
+ part = newPart; // reassign
+ for(iPart i = editor->parts()->begin(); i != editor->parts()->end(); ++i)
+ {
+ if(i->second == Canvas::part())
+ {
+ editor->parts()->erase(i);
+ break;
+ }
+ }
+ editor->parts()->add(part);
+ item->setPart(part);
+ item->setEvent(newEvent);
+ curPart = part;
+ curPartId = curPart->sn();
+ }
+ */
+
+ // Added by T356.
+ // msgAddEvent and msgChangeEvent (below) will set these, but set them here first?
+ //item->setPart(part);
+ item->setEvent(newEvent);
+
+ // Added by T356.
+ if(((int)newEvent.endTick() - (int)part->lenTick()) > 0)
+ printf("DrumCanvas::moveItem Error! New event end:%d exceeds length:%d of part:%s\n", newEvent.endTick(), part->lenTick(), part->name().latin1());
+
+ if (dtype == MOVE_COPY || dtype == MOVE_CLONE) {
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgAddEvent(newEvent, part, false);
+ audio->msgAddEvent(newEvent, part, false, false, false);
+ }
+ else {
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, part, false);
+ audio->msgChangeEvent(event, newEvent, part, false, false, false);
+ }
+
+ // Removed by T356.
+ //if(pflags)
+ // *pflags = modified;
+
+ return true;
+ }
+
+//---------------------------------------------------------
+// newItem
+//---------------------------------------------------------
+
+CItem* DrumCanvas::newItem(const QPoint& p, int state)
+ {
+ int instr = y2pitch(p.y()); //drumInmap[y2pitch(p.y())];
+ int velo = drumMap[instr].lv4;
+ if (state == Qt::ShiftModifier)
+ velo = drumMap[instr].lv3;
+ else if (state == Qt::ControlModifier)
+ velo = drumMap[instr].lv2;
+ else if (state == (Qt::ControlModifier | Qt::ShiftModifier))
+ velo = drumMap[instr].lv1;
+ int tick = editor->rasterVal(p.x());
+ tick -= curPart->tick();
+ Event e(Note);
+ e.setTick(tick);
+ e.setPitch(instr);
+ e.setVelo(velo);
+ e.setLenTick(drumMap[instr].len);
+ return new DEvent(e, curPart);
+ }
+
+//---------------------------------------------------------
+// resizeItem
+//---------------------------------------------------------
+
+void DrumCanvas::resizeItem(CItem* item, bool)
+ {
+ DEvent* nevent = (DEvent*) item;
+ Event ev = nevent->event();
+ // Indicate do undo, and do not do port controller values and clone parts.
+ //audio->msgDeleteEvent(ev, nevent->part());
+ audio->msgDeleteEvent(ev, nevent->part(), true, false, false);
+ }
+
+//---------------------------------------------------------
+// newItem
+//---------------------------------------------------------
+
+void DrumCanvas::newItem(CItem* item, bool noSnap)
+ {
+ DEvent* nevent = (DEvent*) item;
+ Event event = nevent->event();
+ int x = item->x();
+ if (!noSnap)
+ x = editor->rasterVal(x);
+ event.setTick(x - nevent->part()->tick());
+ //int npitch = drumMap[y2pitch(item->y())].enote;
+ int npitch = event.pitch();
+ event.setPitch(npitch);
+
+ //
+ // check for existing event
+ // if found change command semantic from insert to delete
+ //
+ EventList* el = nevent->part()->events();
+ iEvent lower = el->lower_bound(event.tick());
+ iEvent upper = el->upper_bound(event.tick());
+
+ for (iEvent i = lower; i != upper; ++i) {
+ Event ev = i->second;
+ // Added by T356. Only do notes.
+ if(!ev.isNote())
+ continue;
+
+ if (ev.pitch() == npitch) {
+ // Indicate do undo, and do not do port controller values and clone parts.
+ //audio->msgDeleteEvent(ev, nevent->part());
+ audio->msgDeleteEvent(ev, nevent->part(), true, false, false);
+ return;
+ }
+ }
+
+ // Added by T356.
+ Part* part = nevent->part();
+ song->startUndo();
+ int modified=SC_EVENT_MODIFIED;
+ int diff = event.endTick()-part->lenTick();
+ if (diff > 0) {// too short part? extend it
+ //printf("extend Part!\n");
+ Part* newPart = part->clone();
+ newPart->setLenTick(newPart->lenTick()+diff);
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(part, newPart,false);
+ audio->msgChangePart(part, newPart, false, true, false);
+ modified=modified|SC_PART_MODIFIED;
+ part = newPart; // reassign
+ }
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgAddEvent(event, part,false);
+ audio->msgAddEvent(event, part, false, false, false);
+ song->endUndo(modified);
+
+ //audio->msgAddEvent(event, nevent->part());
+ }
+
+//---------------------------------------------------------
+// deleteItem
+//---------------------------------------------------------
+
+bool DrumCanvas::deleteItem(CItem* item)
+ {
+ Event ev = ((DEvent*)item)->event();
+ // Indicate do undo, and do not do port controller values and clone parts.
+ //audio->msgDeleteEvent(ev, ((DEvent*)item)->part());
+ audio->msgDeleteEvent(ev, ((DEvent*)item)->part(), true, false, false);
+ return false;
+ }
+
+//---------------------------------------------------------
+// drawItem
+//---------------------------------------------------------
+
+void DrumCanvas::drawItem(QPainter&p, const CItem*item, const QRect& rect)
+ {
+ DEvent* e = (DEvent*) item;
+ int x = 0, y = 0;
+ x = mapx(item->pos().x());
+ y = mapy(item->pos().y());
+ Q3PointArray pa(4);
+ pa.setPoint(0, x - CARET2, y);
+ pa.setPoint(1, x, y - CARET2);
+ pa.setPoint(2, x + CARET2, y);
+ pa.setPoint(3, x, y + CARET2);
+ QRect r(pa.boundingRect());
+ r = r.intersect(rect);
+ if(!r.isValid())
+ return;
+
+ p.setPen(Qt::black);
+
+ if (e->part() != curPart)
+ {
+ if(item->isMoving())
+ p.setBrush(Qt::gray);
+ else if(item->isSelected())
+ p.setBrush(Qt::black);
+ else
+ p.setBrush(Qt::lightGray);
+ }
+ else if (item->isMoving()) {
+ p.setBrush(Qt::gray);
+ }
+ else if (item->isSelected())
+ {
+ p.setBrush(Qt::black);
+ }
+ else
+ {
+ int velo = e->event().velo();
+ DrumMap* dm = &drumMap[y2pitch(y)]; //Get the drum item
+ QColor color;
+ if (velo < dm->lv1)
+ color.setRgb(240, 240, 255);
+ else if (velo < dm->lv2)
+ color.setRgb(200, 200, 255);
+ else if (velo < dm->lv3)
+ color.setRgb(170, 170, 255);
+ else
+ color.setRgb(0, 0, 255);
+ p.setBrush(color);
+ }
+
+ p.drawPolygon(pa);
+ }
+
+//---------------------------------------------------------
+// drawMoving
+// draws moving items
+//---------------------------------------------------------
+
+void DrumCanvas::drawMoving(QPainter& p, const CItem* item, const QRect& rect)
+ {
+ //if(((DEvent*)item)->part() != curPart)
+ // return;
+ //if(!item->isMoving())
+ // return;
+ Q3PointArray pa(4);
+ QPoint pt = map(item->mp());
+ int x = pt.x();
+ int y = pt.y();
+ pa.setPoint(0, x-CARET2, y + TH/2);
+ pa.setPoint(1, x, y + TH/2+CARET2);
+ pa.setPoint(2, x+CARET2, y + TH/2);
+ pa.setPoint(3, x, y + (TH-CARET)/2);
+ QRect mr(pa.boundingRect());
+ mr = mr.intersect(rect);
+ if(!mr.isValid())
+ return;
+ p.setPen(Qt::black);
+ p.setBrush(Qt::black);
+ p.drawPolygon(pa);
+ }
+
+//---------------------------------------------------------
+// drawCanvas
+//---------------------------------------------------------
+
+extern void drawTickRaster(QPainter& p, int, int, int, int, int);
+
+void DrumCanvas::drawCanvas(QPainter& p, const QRect& rect)
+ {
+ int x = rect.x();
+ int y = rect.y();
+ int w = rect.width();
+ int h = rect.height();
+
+ //---------------------------------------------------
+ // horizontal lines
+ //---------------------------------------------------
+
+ int yy = ((y-1) / TH) * TH + TH;
+ for (; yy < y + h; yy += TH) {
+ p.setPen(Qt::gray);
+ p.drawLine(x, yy, x + w, yy);
+ }
+
+ //---------------------------------------------------
+ // vertical lines
+ //---------------------------------------------------
+
+ drawTickRaster(p, x, y, w, h, editor->raster());
+ }
+
+//---------------------------------------------------------
+// y2pitch
+//---------------------------------------------------------
+
+int DrumCanvas::y2pitch(int y) const
+ {
+ int pitch = y/TH;
+ if (pitch >= DRUM_MAPSIZE)
+ pitch = DRUM_MAPSIZE-1;
+ return pitch;
+ }
+
+//---------------------------------------------------------
+// pitch2y
+//---------------------------------------------------------
+
+int DrumCanvas::pitch2y(int pitch) const
+ {
+ return pitch * TH;
+ }
+
+//---------------------------------------------------------
+// cmd
+//---------------------------------------------------------
+
+void DrumCanvas::cmd(int cmd)
+ {
+ switch(cmd) {
+ case CMD_CUT:
+ copy();
+ song->startUndo();
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (!i->second->isSelected())
+ continue;
+ DEvent* e = (DEvent*)(i->second);
+ Event event = e->event();
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgDeleteEvent(event, e->part(), false);
+ audio->msgDeleteEvent(event, e->part(), false, false, false);
+ }
+ song->endUndo(SC_EVENT_REMOVED);
+ break;
+ case CMD_COPY:
+ copy();
+ break;
+ case CMD_PASTE:
+ paste();
+ break;
+ case CMD_SELECT_ALL: // select all
+ for (iCItem k = items.begin(); k != items.end(); ++k) {
+ if (!k->second->isSelected())
+ selectItem(k->second, true);
+ }
+ break;
+ case CMD_SELECT_NONE: // select none
+ deselectAll();
+ break;
+ case CMD_SELECT_INVERT: // invert selection
+ for (iCItem k = items.begin(); k != items.end(); ++k) {
+ selectItem(k->second, !k->second->isSelected());
+ }
+ break;
+ case CMD_SELECT_ILOOP: // select inside loop
+ for (iCItem k = items.begin(); k != items.end(); ++k) {
+ DEvent* nevent =(DEvent*)(k->second);
+ Part* part = nevent->part();
+ Event event = nevent->event();
+ unsigned tick = event.tick() + part->tick();
+ if (tick < song->lpos() || tick >= song->rpos())
+ selectItem(k->second, false);
+ else
+ selectItem(k->second, true);
+ }
+ break;
+ case CMD_SELECT_OLOOP: // select outside loop
+ for (iCItem k = items.begin(); k != items.end(); ++k) {
+ DEvent* nevent = (DEvent*)(k->second);
+ Part* part = nevent->part();
+ Event event = nevent->event();
+ unsigned tick = event.tick() + part->tick();
+ if (tick < song->lpos() || tick >= song->rpos())
+ selectItem(k->second, true);
+ else
+ selectItem(k->second, false);
+ }
+ break;
+ case CMD_SELECT_PREV_PART: // select previous part
+ {
+ Part* pt = editor->curCanvasPart();
+ Part* newpt = pt;
+ PartList* pl = editor->parts();
+ for(iPart ip = pl->begin(); ip != pl->end(); ++ip)
+ if(ip->second == pt)
+ {
+ if(ip == pl->begin())
+ ip = pl->end();
+ --ip;
+ newpt = ip->second;
+ break;
+ }
+ if(newpt != pt)
+ editor->setCurCanvasPart(newpt);
+ }
+ break;
+ case CMD_SELECT_NEXT_PART: // select next part
+ {
+ Part* pt = editor->curCanvasPart();
+ Part* newpt = pt;
+ PartList* pl = editor->parts();
+ for(iPart ip = pl->begin(); ip != pl->end(); ++ip)
+ if(ip->second == pt)
+ {
+ ++ip;
+ if(ip == pl->end())
+ ip = pl->begin();
+ newpt = ip->second;
+ break;
+ }
+ if(newpt != pt)
+ editor->setCurCanvasPart(newpt);
+ }
+ break;
+ case CMD_DEL:
+ if (selectionSize()) {
+ song->startUndo();
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (!i->second->isSelected())
+ continue;
+ Event ev = i->second->event();
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgDeleteEvent(ev, i->second->part(), false);
+ audio->msgDeleteEvent(ev, i->second->part(), false, false, false);
+ }
+ song->endUndo(SC_EVENT_REMOVED);
+ }
+ return;
+
+ case CMD_SAVE:
+ case CMD_LOAD:
+ printf("DrumCanvas:: cmd not implemented %d\n", cmd);
+ break;
+
+ case CMD_FIXED_LEN: //Set notes to the length specified in the drummap
+ if (!selectionSize())
+ break;
+ song->startUndo();
+ for (iCItem k = items.begin(); k != items.end(); ++k) {
+ if (k->second->isSelected()) {
+ DEvent* devent = (DEvent*)(k->second);
+ Event event = devent->event();
+ Event newEvent = event.clone();
+ newEvent.setLenTick(drumMap[event.pitch()].len);
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, devent->part() , false);
+ audio->msgChangeEvent(event, newEvent, devent->part(), false, false, false);
+ }
+ }
+ song->endUndo(SC_EVENT_MODIFIED);
+ break;
+ case CMD_LEFT:
+ {
+ int frames = pos[0] - editor->rasterStep(pos[0]);
+ if (frames < 0)
+ frames = 0;
+ Pos p(frames,true);
+ song->setPos(0, p, true, true, true);
+ }
+ break;
+ case CMD_RIGHT:
+ {
+ Pos p(pos[0] + editor->rasterStep(pos[0]), true);
+ song->setPos(0, p, true, true, true);
+ }
+ break;
+ case CMD_MODIFY_VELOCITY:
+ {
+ Velocity w(this);
+ w.setRange(0); //TODO: Make this work! Probably put _to & _toInit in ecanvas instead
+ if (!w.exec())
+ break;
+ int range = w.range(); // all, selected, looped, sel+loop
+ int rate = w.rateVal();
+ int offset = w.offsetVal();
+
+ song->startUndo();
+ for (iCItem k = items.begin(); k != items.end(); ++k) {
+ DEvent* devent = (DEvent*)(k->second);
+ Event event = devent->event();
+ if (event.type() != Note)
+ continue;
+ unsigned tick = event.tick();
+ bool selected = k->second->isSelected();
+ bool inLoop = (tick >= song->lpos()) && (tick < song->rpos());
+
+ if ((range == 0)
+ || (range == 1 && selected)
+ || (range == 2 && inLoop)
+ || (range == 3 && selected && inLoop)) {
+ int velo = event.velo();
+
+ //velo = rate ? (velo * 100) / rate : 64;
+ velo = (velo * rate) / 100;
+ velo += offset;
+
+ if (velo <= 0)
+ velo = 1;
+ if (velo > 127)
+ velo = 127;
+ if (event.velo() != velo) {
+ Event newEvent = event.clone();
+ newEvent.setVelo(velo);
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, devent->part(), false);
+ audio->msgChangeEvent(event, newEvent, devent->part(), false, false, false);
+ }
+ }
+ }
+ song->endUndo(SC_EVENT_MODIFIED);
+ }
+ break;
+ }
+ updateSelection();
+ redraw();
+ }
+
+//---------------------------------------------------------
+// getTextDrag
+//---------------------------------------------------------
+
+Q3TextDrag* DrumCanvas::getTextDrag(QWidget* parent)
+ {
+ //---------------------------------------------------
+ // generate event list from selected events
+ //---------------------------------------------------
+
+ EventList el;
+ unsigned startTick = MAXINT;
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (!i->second->isSelected())
+ continue;
+ DEvent* ne = (DEvent*)(i->second);
+ Event e = ne->event();
+ if (startTick == MAXINT)
+ startTick = e.tick();
+ el.add(e);
+ }
+
+ //---------------------------------------------------
+ // write events as XML into tmp file
+ //---------------------------------------------------
+
+ FILE* tmp = tmpfile();
+ if (tmp == 0) {
+ fprintf(stderr, "EventCanvas::copy() fopen failed: %s\n",
+ strerror(errno));
+ return 0;
+ }
+ Xml xml(tmp);
+
+ int level = 0;
+ for (ciEvent e = el.begin(); e != el.end(); ++e)
+ e->second.write(level, xml, -startTick);
+
+ //---------------------------------------------------
+ // read tmp file into QTextDrag Object
+ //---------------------------------------------------
+
+ fflush(tmp);
+ struct stat f_stat;
+ if (fstat(fileno(tmp), &f_stat) == -1) {
+ fprintf(stderr, "EventCanvas::copy() fstat failes:<%s>\n",
+ strerror(errno));
+ fclose(tmp);
+ return 0;
+ }
+ int n = f_stat.st_size;
+ char* fbuf = (char*)mmap(0, n+1, PROT_READ|PROT_WRITE,
+ MAP_PRIVATE, fileno(tmp), 0);
+ fbuf[n] = 0;
+ Q3TextDrag* drag = new Q3TextDrag(QString(fbuf), parent);
+ drag->setSubtype("eventlist");
+ munmap(fbuf, n);
+ fclose(tmp);
+ return drag;
+ }
+
+//---------------------------------------------------------
+// copy
+// cut copy paste
+//---------------------------------------------------------
+
+void DrumCanvas::copy()
+ {
+ Q3TextDrag* drag = getTextDrag(0);
+ if (drag)
+ QApplication::clipboard()->setData(drag, QClipboard::Clipboard);
+ }
+
+//---------------------------------------------------------
+// paste
+//---------------------------------------------------------
+
+int DrumCanvas::pasteAt(const QString& pt, int pos)
+ {
+ const char* p = pt.latin1();
+ Xml xml(p);
+
+ // Added by T356.
+ int modified = SC_EVENT_INSERTED;
+
+ song->startUndo();
+ for (;;) {
+ Xml::Token token = xml.parse();
+ QString tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ //song->endUndo(SC_EVENT_INSERTED); By T356
+ song->endUndo(modified);
+ return pos;
+ case Xml::TagStart:
+ if (tag == "event") {
+ Event e(Note);
+ e.read(xml);
+
+ // Added by T356.
+ int tick = e.tick() + pos - curPart->tick();
+ if (tick<0) {
+ printf("DrumCanvas::pasteAt ERROR: trying to add event before current part!\n");
+ song->endUndo(SC_EVENT_INSERTED);
+ //delete el;
+ return pos;
+ }
+ e.setTick(tick);
+ int diff = e.endTick() - curPart->lenTick();
+ if (diff > 0) {// too short part? extend it
+ Part* newPart = curPart->clone();
+ newPart->setLenTick(newPart->lenTick()+diff);
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(curPart, newPart,false);
+ audio->msgChangePart(curPart, newPart, false, true, false);
+
+ modified=modified|SC_PART_MODIFIED;
+ curPart = newPart; // reassign
+ }
+
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgAddEvent(e, curPart, false);
+ audio->msgAddEvent(e, curPart, false, false, false);
+ }
+ else
+ //xml.unknown("EventCanvas::paste"); By T356
+ xml.unknown("DCanvas::pasteAt");
+ break;
+ case Xml::TagEnd:
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// paste
+// paste events
+//---------------------------------------------------------
+
+void DrumCanvas::paste()
+ {
+// Q3CString subtype("eventlist"); // ddskrjo
+ QString subtype("eventlist");
+ QMimeSource* ms = QApplication::clipboard()->data();
+ QString pt;
+ if (!Q3TextDrag::decode(ms, pt, subtype)) {
+ printf("cannot paste: bad data type\n");
+ return;
+ }
+ pasteAt(pt, song->cpos());
+ }
+
+//---------------------------------------------------------
+// startDrag
+//---------------------------------------------------------
+
+void DrumCanvas::startDrag(CItem* /* item*/, bool copymode)
+ {
+ Q3TextDrag* drag = getTextDrag(this);
+ if (drag) {
+// QApplication::clipboard()->setData(drag, QClipboard::Clipboard);
+
+ if (copymode)
+ drag->dragCopy();
+ else
+ drag->dragMove();
+ }
+ }
+
+//---------------------------------------------------------
+// dragEnterEvent
+//---------------------------------------------------------
+
+void DrumCanvas::dragEnterEvent(QDragEnterEvent* event)
+ {
+ event->accept(Q3TextDrag::canDecode(event));
+ }
+
+//---------------------------------------------------------
+// dragMoveEvent
+//---------------------------------------------------------
+
+void DrumCanvas::dragMoveEvent(QDragMoveEvent*)
+ {
+// printf("drag move %x\n", this);
+ }
+
+//---------------------------------------------------------
+// dragLeaveEvent
+//---------------------------------------------------------
+
+void DrumCanvas::dragLeaveEvent(QDragLeaveEvent*)
+ {
+// printf("drag leave\n");
+ }
+
+//---------------------------------------------------------
+// dropEvent
+//---------------------------------------------------------
+
+void DrumCanvas::viewDropEvent(QDropEvent* event)
+ {
+ QString text;
+ if (event->source() == this) {
+ printf("local DROP\n");
+ return;
+ }
+ if (Q3TextDrag::decode(event, text)) {
+// printf("drop <%s>\n", text.ascii());
+ int x = editor->rasterVal(event->pos().x());
+ if (x < 0)
+ x = 0;
+ pasteAt(text, x);
+ }
+ }
+
+//---------------------------------------------------------
+// keyPressed
+//---------------------------------------------------------
+
+void DrumCanvas::keyPressed(int index, bool)
+ {
+ int port = drumMap[index].port;
+ int channel = drumMap[index].channel;
+ int pitch = drumMap[index].anote;
+
+ // play note:
+ MidiPlayEvent e(0, port, channel, 0x90, pitch, 127);
+ audio->msgPlayMidiEvent(&e);
+ }
+
+//---------------------------------------------------------
+// keyReleased
+//---------------------------------------------------------
+
+void DrumCanvas::keyReleased(int index, bool)
+ {
+ int port = drumMap[index].port;
+ int channel = drumMap[index].channel;
+ int pitch = drumMap[index].anote;
+
+ // release note:
+ MidiPlayEvent e(0, port, channel, 0x90, pitch, 0);
+ audio->msgPlayMidiEvent(&e);
+ }
+
+//---------------------------------------------------------
+// mapChanged
+//---------------------------------------------------------
+
+void DrumCanvas::mapChanged(int spitch, int dpitch)
+ {
+ //TODO: Circumvent undo behaviour, since this isn't really a true change of the events,
+ // but merely a change in pitch because the pitch relates to the order of the dlist.
+ // Right now the sequencer spits out internalError: undoOp without startUndo() if start/stopundo is there, which is misleading
+ // If start/stopundo is there, undo misbehaves since it doesn't undo but messes things up
+ // Other solution: implement a specific undo-event for this (SC_DRUMMAP_MODIFIED or something) which undoes movement of
+ // dlist-items (ml)
+
+ std::vector< std::pair<Part*, Event*> > delete_events;
+ std::vector< std::pair<Part*, Event> > add_events;
+
+ typedef std::vector< std::pair<Part*, Event*> >::iterator idel_ev;
+ typedef std::vector< std::pair<Part*, Event> >::iterator iadd_ev;
+
+ /*
+ class delete_events : public std::vector< Part*, Event* >
+ {
+ public:
+ idel_ev find(Part* p, Event* e)
+ {
+
+ };
+ };
+ class add_events : public std::vector< Part*, Event >
+ {
+ public:
+ iadd_ev find(Part* p, Event& e)
+ {
+
+ };
+ };
+ */
+
+ MidiTrackList* tracks = song->midis();
+ for (ciMidiTrack t = tracks->begin(); t != tracks->end(); t++) {
+ MidiTrack* curTrack = *t;
+ if (curTrack->type() != Track::DRUM)
+ continue;
+
+ MidiPort* mp = &midiPorts[curTrack->outPort()];
+ PartList* parts= curTrack->parts();
+ for (iPart part = parts->begin(); part != parts->end(); ++part) {
+ EventList* events = part->second->events();
+ Part* thePart = part->second;
+ for (iEvent i = events->begin(); i != events->end(); ++i) {
+ Event event = i->second;
+ if(event.type() != Controller && event.type() != Note)
+ continue;
+ int pitch = event.pitch();
+ bool drc = false;
+ // Is it a drum controller event, according to the track port's instrument?
+ if(event.type() == Controller && mp->drumController(event.dataA()))
+ {
+ drc = true;
+ pitch = event.dataA() & 0x7f;
+ }
+
+ if (pitch == spitch) {
+ Event* spitch_event = &(i->second);
+ delete_events.push_back(std::pair<Part*, Event*>(thePart, spitch_event));
+ Event newEvent = spitch_event->clone();
+ if(drc)
+ newEvent.setA((newEvent.dataA() & ~0xff) | dpitch);
+ else
+ newEvent.setPitch(dpitch);
+ add_events.push_back(std::pair<Part*, Event>(thePart, newEvent));
+ }
+ else if (pitch == dpitch) {
+ Event* dpitch_event = &(i->second);
+ delete_events.push_back(std::pair<Part*, Event*>(thePart, dpitch_event));
+ Event newEvent = dpitch_event->clone();
+ if(drc)
+ newEvent.setA((newEvent.dataA() & ~0xff) | spitch);
+ else
+ newEvent.setPitch(spitch);
+ add_events.push_back(std::pair<Part*, Event>(thePart, newEvent));
+ }
+ }
+ }
+ }
+
+ song->startUndo();
+ for (idel_ev i = delete_events.begin(); i != delete_events.end(); i++) {
+ //std::pair<Part*, Event*> pair = *i;
+ //Part* thePart = pair.first;
+ //Event* theEvent = pair.second;
+ Part* thePart = (*i).first;
+ Event* theEvent = (*i).second;
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgDeleteEvent(*theEvent, thePart, false);
+ audio->msgDeleteEvent(*theEvent, thePart, false, true, false);
+ }
+
+ DrumMap dm = drumMap[spitch];
+ drumMap[spitch] = drumMap[dpitch];
+ drumMap[dpitch] = dm;
+ drumInmap[int(drumMap[spitch].enote)] = spitch;
+ drumOutmap[int(drumMap[int(spitch)].anote)] = spitch;
+ drumInmap[int(drumMap[int(dpitch)].enote)] = dpitch;
+ drumOutmap[int(drumMap[int(dpitch)].anote)] = dpitch;
+
+ for (iadd_ev i = add_events.begin(); i != add_events.end(); i++) {
+ //std::pair<Part*, Event> pair = *i;
+ //Part* thePart = pair.first;
+ //Event& theEvent = pair.second;
+ Part* thePart = (*i).first;
+ Event& theEvent = (*i).second;
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgAddEvent(theEvent, thePart, false);
+ audio->msgAddEvent(theEvent, thePart, false, true, false);
+ }
+
+ song->endUndo(SC_EVENT_MODIFIED);
+ song->update(SC_DRUMMAP);
+ }
+
+//---------------------------------------------------------
+// resizeEvent
+//---------------------------------------------------------
+
+void DrumCanvas::resizeEvent(QResizeEvent* ev)
+ {
+ if (ev->size().width() != ev->oldSize().width())
+ emit newWidth(ev->size().width());
+ EventCanvas::resizeEvent(ev);
+ }
+
+
+//---------------------------------------------------------
+// modifySelected
+//---------------------------------------------------------
+
+void DrumCanvas::modifySelected(NoteInfo::ValType type, int delta)
+ {
+ audio->msgIdle(true);
+ song->startUndo();
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (!(i->second->isSelected()))
+ continue;
+ DEvent* e = (DEvent*)(i->second);
+ Event event = e->event();
+ if (event.type() != Note)
+ continue;
+
+ MidiPart* part = (MidiPart*)(e->part());
+ Event newEvent = event.clone();
+
+ switch (type) {
+ case NoteInfo::VAL_TIME:
+ {
+ int newTime = event.tick() + delta;
+ if (newTime < 0)
+ newTime = 0;
+ newEvent.setTick(newTime);
+ }
+ break;
+ case NoteInfo::VAL_LEN:
+ /*
+ {
+ int len = event.lenTick() + delta;
+ if (len < 1)
+ len = 1;
+ newEvent.setLenTick(len);
+ }
+ */
+ printf("DrumCanvas::modifySelected - NoteInfo::VAL_LEN not implemented\n");
+ break;
+ case NoteInfo::VAL_VELON:
+ /*
+ {
+ int velo = event->velo() + delta;
+ if (velo > 127)
+ velo = 127;
+ else if (velo < 0)
+ velo = 0;
+ newEvent.setVelo(velo);
+ }
+ */
+ printf("DrumCanvas::modifySelected - NoteInfo::VAL_VELON not implemented\n");
+ break;
+ case NoteInfo::VAL_VELOFF:
+ /*
+ {
+ int velo = event.veloOff() + delta;
+ if (velo > 127)
+ velo = 127;
+ else if (velo < 0)
+ velo = 0;
+ newEvent.setVeloOff(velo);
+ }
+ */
+ printf("DrumCanvas::modifySelected - NoteInfo::VAL_VELOFF not implemented\n");
+ break;
+ case NoteInfo::VAL_PITCH:
+ {
+ int pitch = event.pitch() - delta; // Reversing order since the drumlist is displayed in increasing order
+ if (pitch > 127)
+ pitch = 127;
+ else if (pitch < 0)
+ pitch = 0;
+ newEvent.setPitch(pitch);
+ }
+ break;
+ }
+ song->changeEvent(event, newEvent, part);
+ // Indicate do not do port controller values and clone parts.
+ //song->undoOp(UndoOp::ModifyEvent, newEvent, event, part);
+ song->undoOp(UndoOp::ModifyEvent, newEvent, event, part, false, false);
+ }
+ song->endUndo(SC_EVENT_MODIFIED);
+ audio->msgIdle(false);
+ }
+
+//---------------------------------------------------------
+// curPartChanged
+//---------------------------------------------------------
+
+void DrumCanvas::curPartChanged()
+ {
+ editor->setCaption(getCaption());
+ }
+
diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h
new file mode 100644
index 00000000..7f5034fc
--- /dev/null
+++ b/muse2/muse/midiedit/dcanvas.h
@@ -0,0 +1,93 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: dcanvas.h,v 1.8.2.2 2009/02/02 21:38:00 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __DCANVAS_H__
+#define __DCANVAS_H__
+
+#include "ecanvas.h"
+#include "song.h"
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QDragEnterEvent>
+#include <QDropEvent>
+#include <QDragMoveEvent>
+#include <QDragLeaveEvent>
+
+#define TH 18
+
+class MidiEditor;
+
+//---------------------------------------------------------
+// DEvent
+// ''visual'' Drum Event
+//---------------------------------------------------------
+
+class DEvent : public CItem {
+ public:
+ DEvent(Event e, Part* p);
+ };
+
+class ScrollScale;
+class PianoRoll;
+class Q3TextDrag;
+
+//---------------------------------------------------------
+// DrumCanvas
+//---------------------------------------------------------
+
+class DrumCanvas : public EventCanvas {
+
+ Q_OBJECT
+ virtual void drawCanvas(QPainter&, const QRect&);
+ virtual void drawItem(QPainter&, const CItem*, const QRect&);
+ virtual void drawMoving(QPainter&, const CItem*, const QRect&);
+ virtual void moveCanvasItems(CItemList&, int, int, DragType, int*);
+ // Changed by T356.
+ //virtual bool moveItem(CItem*, const QPoint&, DragType, int*);
+ virtual bool moveItem(CItem*, const QPoint&, DragType);
+ virtual CItem* newItem(const QPoint&, int);
+ virtual void resizeItem(CItem*, bool);
+ virtual void newItem(CItem*, bool);
+ virtual bool deleteItem(CItem*);
+
+ int y2pitch(int y) const;
+ int pitch2y(int pitch) const;
+ Q3TextDrag* getTextDrag(QWidget* parent);
+ void copy();
+ int pasteAt(const QString& pt, int pos);
+ void paste();
+ void startDrag(CItem*, bool copymode);
+ void dragEnterEvent(QDragEnterEvent* event);
+ void dragMoveEvent(QDragMoveEvent*);
+ void dragLeaveEvent(QDragLeaveEvent*);
+ void viewDropEvent(QDropEvent* event);
+ virtual void addItem(Part*, Event&);
+ virtual void resizeEvent(QResizeEvent*);
+ virtual void curPartChanged();
+
+ signals:
+ void newWidth(int);
+
+ public slots:
+ void mapChanged(int, int);
+ void keyPressed(int, bool);
+ void keyReleased(int, bool);
+
+ public:
+ enum {
+ CMD_CUT, CMD_COPY, CMD_PASTE, CMD_SAVE, CMD_LOAD, CMD_RESET,
+ CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT,
+ CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART,
+ CMD_DEL, CMD_FIXED_LEN, CMD_RIGHT, CMD_LEFT, CMD_MODIFY_VELOCITY
+ };
+ DrumCanvas(MidiEditor*, QWidget*, int, int,
+ const char* name = 0);
+ void cmd(int);
+ virtual void modifySelected(NoteInfo::ValType type, int delta);
+ };
+#endif
+
diff --git a/muse2/muse/midiedit/dlist.cpp b/muse2/muse/midiedit/dlist.cpp
new file mode 100644
index 00000000..24ced3d0
--- /dev/null
+++ b/muse2/muse/midiedit/dlist.cpp
@@ -0,0 +1,754 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: dlist.cpp,v 1.9.2.7 2009/10/16 21:50:16 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qpainter.h>
+#include <q3header.h>
+#include <qcursor.h>
+#include <q3popupmenu.h>
+#include <qlineedit.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <QMouseEvent>
+
+#include <stdio.h>
+
+#include "audio.h"
+#include "pitchedit.h"
+#include "midiport.h"
+#include "drummap.h"
+#include "icons.h"
+#include "dlist.h"
+#include "song.h"
+#include "scrollscale.h"
+
+// enum DCols { COL_MUTE=0, COL_NAME, COL_QNT, COL_ENOTE, COL_LEN,
+// COL_ANOTE, COL_CHANNEL, COL_PORT,
+// COL_LV1, COL_LV2, COL_LV3, COL_LV4, COL_NONE=-1};
+
+//---------------------------------------------------------
+// draw
+//---------------------------------------------------------
+
+void DList::draw(QPainter& p, const QRect& rect)
+ {
+ int x = rect.x();
+ int y = rect.y();
+ int w = rect.width();
+ int h = rect.height();
+
+ //---------------------------------------------------
+ // Tracks
+ //---------------------------------------------------
+
+ p.setPen(Qt::black);
+
+ for (int i = 0; i < DRUM_MAPSIZE; ++i) {
+ int yy = i * TH;
+ if (yy+TH < y)
+ continue;
+ if (yy > y + h)
+ break;
+ DrumMap* dm = &drumMap[i];
+// if (dm->selected)
+ if (dm == currentlySelected)
+ p.fillRect(x, yy, w, TH, Qt::yellow);
+// else
+// p.eraseRect(x, yy, w, TH);
+ for (int k = 0; k < header->count(); ++k) {
+ int x = header->sectionPos(k);
+ int w = header->sectionSize(k);
+ QRect r = p.xForm(QRect(x+2, yy, w-4, TH));
+ QString s;
+ int align = Qt::AlignVCenter | Qt::AlignHCenter;
+
+ p.save();
+ p.setWorldXForm(false);
+ switch (k) {
+ case COL_VOL:
+ s.setNum(dm->vol);
+ break;
+ case COL_QNT:
+ s.setNum(dm->quant);
+ break;
+ case COL_LEN:
+ s.setNum(dm->len);
+ break;
+ case COL_ANOTE:
+ s = pitch2string(dm->anote);
+ break;
+ case COL_ENOTE:
+ s = pitch2string(dm->enote);
+ break;
+ case COL_LV1:
+ s.setNum(dm->lv1);
+ break;
+ case COL_LV2:
+ s.setNum(dm->lv2);
+ break;
+ case COL_LV3:
+ s.setNum(dm->lv3);
+ break;
+ case COL_LV4:
+ s.setNum(dm->lv4);
+ break;
+ case COL_MUTE:
+ if (dm->mute) {
+ p.setPen(Qt::red);
+ const QPixmap& pm = *muteIcon;
+ p.drawPixmap(
+ r.x() + r.width()/2 - pm.width()/2,
+ r.y() + r.height()/2 - pm.height()/2,
+ pm);
+ p.setPen(Qt::black);
+ }
+ break;
+ case COL_NAME:
+ s = dm->name;
+ align = Qt::AlignVCenter | Qt::AlignLeft;
+ break;
+ case COL_CHANNEL:
+ s.setNum(dm->channel+1);
+ break;
+ case COL_PORT:
+ s.sprintf("%d:%s", dm->port+1, midiPorts[dm->port].portname().latin1());
+ align = Qt::AlignVCenter | Qt::AlignLeft;
+ break;
+ }
+ if (!s.isEmpty())
+ p.drawText(r, align, s);
+ p.restore();
+ }
+ }
+
+ //---------------------------------------------------
+ // horizontal lines
+ //---------------------------------------------------
+
+ p.setPen(Qt::gray);
+ int yy = (y / TH) * TH;
+ for (; yy < y + h; yy += TH) {
+ p.drawLine(x, yy, x + w, yy);
+ }
+
+ if (drag == DRAG) {
+ int y = (startY/TH) * TH;
+ int dy = startY - y;
+ int yy = curY - dy;
+ p.setPen(Qt::green);
+ p.drawLine(x, yy, x + w, yy);
+ p.drawLine(x, yy+TH, x + w, yy+TH);
+ p.setPen(Qt::gray);
+ }
+
+ //---------------------------------------------------
+ // vertical Lines
+ //---------------------------------------------------
+
+ p.setWorldXForm(false);
+ int n = header->count();
+ x = 0;
+ for (int i = 0; i < n; i++) {
+ //x += header->sectionSize(i);
+ x += header->sectionSize(header->mapToSection(i));
+ p.drawLine(x, 0, x, height());
+ }
+ p.setWorldXForm(true);
+ }
+
+//---------------------------------------------------------
+// devicesPopupMenu
+//---------------------------------------------------------
+
+void DList::devicesPopupMenu(DrumMap* t, int x, int y, bool changeAll)
+ {
+ Q3PopupMenu* p = midiPortsPopup(this);
+ int n = p->exec(mapToGlobal(QPoint(x, y)), 0);
+ bool doemit = false;
+ if (n != -1) {
+ if (!changeAll)
+ {
+ if(n != t->port)
+ {
+ audio->msgIdle(true);
+ //audio->msgRemapPortDrumCtlEvents(getSelectedInstrument(), -1, -1, n);
+ song->remapPortDrumCtrlEvents(getSelectedInstrument(), -1, -1, n);
+ audio->msgIdle(false);
+ t->port = n;
+ doemit = true;
+ }
+ }
+ else {
+ audio->msgIdle(true);
+ // Delete all port controller events.
+ //audio->msgChangeAllPortDrumCtrlEvents(false);
+ song->changeAllPortDrumCtrlEvents(false);
+
+ for (int i = 0; i < DRUM_MAPSIZE; i++)
+ drumMap[i].port = n;
+ // Add all port controller events.
+ //audio->msgChangeAllPortDrumCtrlEvents(true);
+ song->changeAllPortDrumCtrlEvents(true);
+
+ audio->msgIdle(false);
+ doemit = true;
+ }
+ }
+ delete p;
+ if(doemit)
+ {
+ int instr = getSelectedInstrument();
+ if(instr != -1)
+ //emit curDrumInstrumentChanged(instr);
+ song->update(SC_DRUMMAP);
+ }
+ }
+
+//---------------------------------------------------------
+// viewMousePressEvent
+//---------------------------------------------------------
+
+void DList::viewMousePressEvent(QMouseEvent* ev)
+ {
+ int x = ev->x();
+ int y = ev->y();
+ int button = ev->button();
+ bool shift = ev->state() & Qt::ShiftButton;
+ unsigned pitch = y / TH;
+ DrumMap* dm = &drumMap[pitch];
+
+ setCurDrumInstrument(pitch);
+
+ startY = y;
+ sPitch = pitch;
+ drag = START_DRAG;
+
+ DCols col = DCols(x2col(x));
+
+ int val;
+ int incVal = 0;
+ if (button == Qt::RightButton)
+ incVal = 1;
+ else if (button == Qt::MidButton)
+ incVal = -1;
+
+ // Check if we're already editing anything and have pressed the mouse
+ // elsewhere
+ // In that case, treat it as if a return was pressed
+
+ if (button == Qt::LeftButton) {
+ if (((editEntry && editEntry != dm) || col != selectedColumn) && editEntry != 0) {
+ returnPressed();
+ }
+ }
+
+ switch (col) {
+ case COL_NONE:
+ break;
+ case COL_MUTE:
+ if (button == Qt::LeftButton)
+ dm->mute = !dm->mute;
+ break;
+ case COL_PORT:
+ if (button == Qt::RightButton) {
+ bool changeAll = ev->state() & Qt::ControlButton;
+ devicesPopupMenu(dm, mapx(x), mapy(pitch * TH), changeAll);
+ }
+ break;
+ case COL_VOL:
+ val = dm->vol + incVal;
+ if (val < 0)
+ val = 0;
+ else if (val > 200)
+ val = 200;
+ dm->vol = (unsigned char)val;
+ break;
+ case COL_QNT:
+ dm->quant += incVal;
+ // ?? range
+ break;
+ case COL_ENOTE:
+ val = dm->enote + incVal;
+ if (val < 0)
+ val = 0;
+ else if (val > 127)
+ val = 127;
+ //Check if there is any other drumMap with the same inmap value (there should be one (and only one):-)
+ //If so, switch the inmap between the instruments
+ for (int i=0; i<DRUM_MAPSIZE; i++) {
+ if (drumMap[i].enote == val && &drumMap[i] != dm) {
+ drumInmap[int(dm->enote)] = i;
+ drumMap[i].enote = dm->enote;
+ break;
+ }
+ }
+ //TODO: Set all the notes on the track with pitch=dm->enote to pitch=val
+ dm->enote = val;
+ drumInmap[val] = pitch;
+ break;
+ case COL_LEN:
+ val = dm->len + incVal;
+ if (val < 0)
+ val = 0;
+ dm->len = val;
+ break;
+ case COL_ANOTE:
+ val = dm->anote + incVal;
+ if (val < 0)
+ val = 0;
+ else if (val > 127)
+ val = 127;
+ if(val != dm->anote)
+ {
+ audio->msgIdle(true);
+ //audio->msgRemapPortDrumCtlEvents(pitch, val, -1, -1);
+ song->remapPortDrumCtrlEvents(pitch, val, -1, -1);
+ audio->msgIdle(false);
+ dm->anote = val;
+ song->update(SC_DRUMMAP);
+ }
+ emit keyPressed(pitch, shift);//(dm->anote, shift);
+ break;
+ case COL_CHANNEL:
+ val = dm->channel + incVal;
+ if (val < 0)
+ val = 0;
+ else if (val > 127)
+ val = 127;
+
+ if (ev->state() & Qt::ControlButton) {
+ audio->msgIdle(true);
+ // Delete all port controller events.
+ //audio->msgChangeAllPortDrumCtrlEvents(false);
+ song->changeAllPortDrumCtrlEvents(false, true);
+
+ for (int i = 0; i < DRUM_MAPSIZE; i++)
+ drumMap[i].channel = val;
+ // Add all port controller events.
+ //audio->msgChangeAllPortDrumCtrlEvents(true);
+ song->changeAllPortDrumCtrlEvents(true, true);
+ audio->msgIdle(false);
+ song->update(SC_DRUMMAP);
+ }
+ else
+ {
+ if(val != dm->channel)
+ {
+ audio->msgIdle(true);
+ //audio->msgRemapPortDrumCtlEvents(pitch, -1, val, -1);
+ song->remapPortDrumCtrlEvents(pitch, -1, val, -1);
+ audio->msgIdle(false);
+ dm->channel = val;
+ song->update(SC_DRUMMAP);
+ }
+ }
+ break;
+ case COL_LV1:
+ val = dm->lv1 + incVal;
+ if (val < 0)
+ val = 0;
+ else if (val > 127)
+ val = 127;
+ dm->lv1 = val;
+ break;
+ case COL_LV2:
+ val = dm->lv2 + incVal;
+ if (val < 0)
+ val = 0;
+ else if (val > 127)
+ val = 127;
+ dm->lv2 = val;
+ break;
+ case COL_LV3:
+ val = dm->lv3 + incVal;
+ if (val < 0)
+ val = 0;
+ else if (val > 127)
+ val = 127;
+ dm->lv3 = val;
+ break;
+ case COL_LV4:
+ val = dm->lv4 + incVal;
+ if (val < 0)
+ val = 0;
+ else if (val > 127)
+ val = 127;
+ dm->lv4 = val;
+ break;
+ case COL_NAME:
+ emit keyPressed(pitch, shift); //Mapping done on other side, send index
+ break;
+#if 0
+ case COL_CHANNEL:
+ {
+ int channel = t->channel();
+ if (button == Qt::RightButton) {
+ if (channel < 15)
+ ++channel;
+ }
+ else if (button == Qt::MidButton) {
+ if (channel > 0)
+ --channel;
+ }
+ if (channel != t->channel()) {
+ t->setChannel(channel);
+ emit channelChanged();
+ }
+ }
+#endif
+ default:
+ break;
+ }
+ redraw();
+ }
+
+//---------------------------------------------------------
+// viewMouseDoubleClickEvent
+//---------------------------------------------------------
+
+void DList::viewMouseDoubleClickEvent(QMouseEvent* ev)
+ {
+ int x = ev->x();
+ int y = ev->y();
+// int button = ev->button();
+ unsigned pitch = y / TH;
+
+ int section = header->sectionAt(x);
+
+ if ((section == COL_NAME || section == COL_VOL || section == COL_LEN || section == COL_LV1 ||
+ section == COL_LV2 || section == COL_LV3 || section == COL_LV4) && (ev->button() == Qt::LeftButton))
+ {
+ lineEdit(pitch, section);
+ }
+ else
+ viewMousePressEvent(ev);
+ }
+
+
+
+//---------------------------------------------------------
+// lineEdit
+//---------------------------------------------------------
+void DList::lineEdit(int line, int section)
+ {
+ DrumMap* dm = &drumMap[line];
+ editEntry = dm;
+ if (editor == 0) {
+ editor = new DLineEdit(this);
+ connect(editor, SIGNAL(returnPressed()),
+ SLOT(returnPressed()));
+ editor->setFrame(true);
+ }
+ int colx = mapx(header->sectionPos(section));
+ int colw = rmapx(header->sectionSize(section));
+ int coly = mapy(line * TH);
+ int colh = rmapy(TH);
+ selectedColumn = section; //Store selected column to have an idea of which one was selected when return is pressed
+ switch (section) {
+ case COL_NAME:
+ editor->setText(dm->name);
+ break;
+
+ case COL_VOL: {
+ editor->setText(QString::number(dm->vol));
+ break;
+ }
+
+ case COL_LEN: {
+ editor->setText(QString::number(dm->len));
+ break;
+ }
+
+ case COL_LV1:
+ editor->setText(QString::number(dm->lv1));
+ break;
+
+ case COL_LV2:
+ editor->setText(QString::number(dm->lv2));
+ break;
+
+ case COL_LV3:
+ editor->setText(QString::number(dm->lv3));
+ break;
+
+ case COL_LV4:
+ editor->setText(QString::number(dm->lv4));
+ break;
+ }
+
+ // editor->setText(dm->name);
+ editor->end(false);
+ editor->setGeometry(colx, coly, colw, colh);
+ // In all cases but the column name, select all text:
+ if (section != COL_NAME)
+ editor->selectAll();
+ editor->show();
+ editor->setFocus();
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+//---------------------------------------------------------
+// x2col
+//---------------------------------------------------------
+
+int DList::x2col(int x) const
+ {
+ int col = 0;
+ int w = 0;
+ for (; col < header->count(); col++) {
+ w += header->cellSize(col);
+ if (x < w)
+ break;
+ }
+ if (col == header->count())
+ return -1;
+ return header->mapToLogical(col);
+ }
+
+//---------------------------------------------------------
+// setCurDrumInstrument
+//---------------------------------------------------------
+
+void DList::setCurDrumInstrument(int instr)
+ {
+ if (instr < 0 || instr >= DRUM_MAPSIZE -1)
+ return; // illegal instrument
+ DrumMap* dm = &drumMap[instr];
+ if (currentlySelected != dm) {
+ currentlySelected = &drumMap[instr];
+ emit curDrumInstrumentChanged(instr);
+ song->update(SC_DRUMMAP);
+ }
+ }
+
+//---------------------------------------------------------
+// sizeChange
+//---------------------------------------------------------
+
+void DList::sizeChange(int, int, int)
+ {
+ redraw();
+ }
+
+//---------------------------------------------------------
+// returnPressed
+//---------------------------------------------------------
+
+void DList::returnPressed()
+ {
+ int val = -1;
+ if (selectedColumn != COL_NAME)
+ {
+ val = atoi(editor->text().ascii());
+ if (selectedColumn != COL_LEN)
+ {
+ if(selectedColumn == COL_VOL)
+ {
+ if (val > 200) //Check bounds for volume
+ val = 200;
+ if (val < 0)
+ val = 0;
+ }
+ else
+ {
+ if (val > 127) //Check bounds for lv1-lv4 values
+ val = 127;
+ if (val < 0)
+ val = 0;
+ }
+ }
+ }
+
+ switch(selectedColumn) {
+ case COL_NAME:
+ editEntry->name = editor->text();
+ break;
+
+ case COL_LEN:
+ editEntry->len = atoi(editor->text().ascii());
+ break;
+
+ case COL_VOL:
+ editEntry->vol = val;
+ break;
+
+ case COL_LV1:
+ editEntry->lv1 = val;
+ break;
+
+ case COL_LV2:
+ editEntry->lv2 = val;
+ break;
+
+ case COL_LV3:
+ editEntry->lv3 = val;
+ break;
+
+ case COL_LV4:
+ editEntry->lv4 = val;
+ break;
+
+ default:
+ printf("Return pressed in unknown column\n");
+ break;
+ }
+ selectedColumn = -1;
+ editor->hide();
+ editEntry = 0;
+ setFocus();
+ redraw();
+ }
+
+//---------------------------------------------------------
+// moved
+//---------------------------------------------------------
+
+void DList::moved(int, int)
+ {
+ redraw();
+ }
+
+//---------------------------------------------------------
+// tracklistChanged
+//---------------------------------------------------------
+
+void DList::tracklistChanged()
+ {
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void DList::songChanged(int flags)
+ {
+ if (flags & SC_DRUMMAP) {
+ redraw();
+ }
+ }
+
+
+//---------------------------------------------------------
+// DList
+//---------------------------------------------------------
+
+DList::DList(Q3Header* h, QWidget* parent, int ymag)
+ : View(parent, 1, ymag)
+ {
+ setBg(Qt::white);
+ header = h;
+ scroll = 0;
+ header->setTracking(true);
+ connect(header, SIGNAL(sizeChange(int,int,int)),
+ SLOT(sizeChange(int,int,int)));
+ connect(header, SIGNAL(moved(int,int)), SLOT(moved(int,int)));
+ setFocusPolicy(Qt::StrongFocus);
+ drag = NORMAL;
+ editor = 0;
+ editEntry = 0;
+ // always select an drum instrument
+ currentlySelected = &drumMap[0];
+ selectedColumn = -1;
+ }
+
+//---------------------------------------------------------
+// ~DList
+//---------------------------------------------------------
+
+DList::~DList()
+ {
+// if (currentlySelected != 0)
+// currentlySelected->selected = false; //Reset the global thingie
+ }
+
+//---------------------------------------------------------
+// viewMouseMoveEvent
+//---------------------------------------------------------
+
+void DList::viewMouseMoveEvent(QMouseEvent* ev)
+ {
+ curY = ev->y();
+ int delta = curY - startY;
+ switch (drag) {
+ case START_DRAG:
+ if (delta < 0)
+ delta = -delta;
+ if (delta <= 2)
+ return;
+ drag = DRAG;
+ setCursor(QCursor(Qt::sizeVerCursor));
+ redraw();
+ break;
+ case NORMAL:
+ break;
+ case DRAG:
+ redraw();
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// viewMouseReleaseEvent
+//---------------------------------------------------------
+
+void DList::viewMouseReleaseEvent(QMouseEvent* ev)
+ {
+ if (drag == DRAG) {
+ int y = ev->y();
+ unsigned dPitch = y / TH;
+ setCursor(QCursor(Qt::arrowCursor));
+ currentlySelected = &drumMap[int(dPitch)];
+ emit curDrumInstrumentChanged(dPitch);
+ emit mapChanged(sPitch, dPitch); //Track pitch change done in canvas
+ }
+ drag = NORMAL;
+//?? redraw();
+ if (editEntry)
+ editor->setFocus();
+ int x = ev->x();
+ int y = ev->y();
+ bool shift = ev->state() & Qt::ShiftButton;
+ unsigned pitch = y / TH;
+
+ DCols col = DCols(x2col(x));
+
+ switch (col) {
+ case COL_NAME:
+ emit keyReleased(pitch, shift);
+ break;
+ case COL_ANOTE:
+ emit keyReleased(pitch, shift);
+ break;
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// getSelectedInstrument
+//---------------------------------------------------------
+
+int DList::getSelectedInstrument()
+ {
+ if (currentlySelected == 0)
+ return -1;
+ return drumInmap[int(currentlySelected->enote)];
+ }
+
diff --git a/muse2/muse/midiedit/dlist.h b/muse2/muse/midiedit/dlist.h
new file mode 100644
index 00000000..1d7e0114
--- /dev/null
+++ b/muse2/muse/midiedit/dlist.h
@@ -0,0 +1,105 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: dlist.h,v 1.5.2.3 2009/10/16 21:50:16 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __DLIST_H__
+#define __DLIST_H__
+
+#include <qlineedit.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include "view.h"
+
+#define TH 18 // normal Track-hight
+
+class QPainter;
+class Q3Header;
+class ScrollScale;
+class Device;
+class QLineEdit;
+class DrumMap;
+
+
+//---------------------------------------------------------
+// DLineEdit
+//---------------------------------------------------------
+class DLineEdit: public QLineEdit
+{
+ public:
+ DLineEdit(QWidget* parent) : QLineEdit(parent) {}
+ virtual ~DLineEdit() {};
+
+ virtual void keyPressEvent(QKeyEvent* keyItem) {
+ if(keyItem->key() == Qt::Key_Escape) {
+ parentWidget()->setFocus();
+ hide();
+ }
+ else
+ QLineEdit::keyPressEvent(keyItem);
+
+ }
+};
+
+//---------------------------------------------------------
+// DList
+//---------------------------------------------------------
+
+class DList : public View {
+ Q3Header* header;
+ ScrollScale* scroll;
+ QLineEdit* editor;
+ DrumMap* editEntry;
+ DrumMap* currentlySelected;
+ int selectedColumn;
+
+
+ int startY;
+ int curY;
+ int sPitch;
+ enum { NORMAL, START_DRAG, DRAG } drag;
+
+ virtual void draw(QPainter& p, const QRect&);
+ virtual void viewMousePressEvent(QMouseEvent* event);
+ virtual void viewMouseReleaseEvent(QMouseEvent* event);
+ virtual void viewMouseDoubleClickEvent(QMouseEvent*);
+ virtual void viewMouseMoveEvent(QMouseEvent*);
+
+ int x2col(int x) const;
+ void devicesPopupMenu(DrumMap* t, int x, int y, bool changeAll);
+ Q_OBJECT
+ //void setCurDrumInstrument(int n);
+
+ private slots:
+ void sizeChange(int, int, int);
+ void returnPressed();
+ void moved(int, int);
+
+ signals:
+ void channelChanged();
+ void mapChanged(int, int);
+ void keyPressed(int, bool);
+ void keyReleased(int, bool);
+ void curDrumInstrumentChanged(int);
+
+ public slots:
+ void tracklistChanged();
+ void songChanged(int);
+ public:
+ void lineEdit(int line, int section);
+ void setCurDrumInstrument(int n);
+ DList(Q3Header*, QWidget* parent, int ymag);
+ ~DList();
+ void setScroll(ScrollScale* s) { scroll = s; }
+ int getSelectedInstrument();
+
+enum DCols { COL_MUTE=0, COL_NAME, COL_VOL, COL_QNT, COL_ENOTE, COL_LEN,
+ COL_ANOTE, COL_CHANNEL, COL_PORT,
+ COL_LV1, COL_LV2, COL_LV3, COL_LV4, COL_NONE=-1};
+ };
+
+#endif // __DLIST_H_
+
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
new file mode 100644
index 00000000..ebe89ac6
--- /dev/null
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -0,0 +1,1167 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: drumedit.cpp,v 1.22.2.21 2009/11/16 11:29:33 lunar_shuttle Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qtoolbutton.h>
+#include <q3accel.h>
+#include <qlayout.h>
+#include <q3hbox.h>
+#include <qsizegrip.h>
+#include <qscrollbar.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <q3buttongroup.h>
+#include <q3listbox.h>
+#include <q3popupmenu.h>
+#include <qmenubar.h>
+#include <qtooltip.h>
+#include <qapplication.h>
+#include <qclipboard.h>
+#include <qmessagebox.h>
+#include <qaction.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include <Q3ValueList>
+#include <Q3GridLayout>
+#include <QResizeEvent>
+#include <QCloseEvent>
+
+#include "drumedit.h"
+#include "mtscale.h"
+#include "scrollscale.h"
+#include "xml.h"
+#include "dlist.h"
+#include "dcanvas.h"
+#include "ttoolbar.h"
+#include "tb1.h"
+#include "splitter.h"
+#include "utils.h"
+#include "../ctrl/ctrledit.h"
+#include "vscale.h"
+#include "swidget.h"
+#include "globals.h"
+#include "icons.h"
+#include "filedialog.h"
+#include "drummap.h"
+#include "audio.h"
+#include "gconfig.h"
+
+/*
+static const char* map_file_pattern[] = {
+ "Presets (*.map *.map.gz *.map.bz2)",
+ "All Files (*)",
+ 0
+ };
+static const char* map_file_save_pattern[] = {
+ "Presets (*.map)",
+ "gzip compressed presets (*.map.gz)",
+ "bzip2 compressed presets (*.map.bz2)",
+ "All Files (*)",
+ 0
+ };
+*/
+
+int DrumEdit::_quantInit = 96;
+int DrumEdit::_rasterInit = 96;
+int DrumEdit::_widthInit = 600;
+int DrumEdit::_heightInit = 400;
+int DrumEdit::_dlistWidthInit = 50;
+int DrumEdit::_dcanvasWidthInit = 300;
+int DrumEdit::_toInit = 0;
+
+static const int xscale = -10;
+static const int yscale = 1;
+static const int drumeditTools = PointerTool | PencilTool | RubberTool;
+
+//---------------------------------------------------------
+// DWhatsThis::text
+//---------------------------------------------------------
+
+QString DWhatsThis::text(const QPoint& pos)
+ {
+ int section = header->sectionAt(pos.x());
+ if (section == -1)
+ return QString::null;
+ switch(section) {
+ case 0: return Q3Header::tr("mute instrument"); break;
+ case 1: return Q3Header::tr("sound name"); break;
+ case 2: return Q3Header::tr("volume percent"); break;
+ case 3: return Q3Header::tr("quantisation"); break;
+ case 4: return Q3Header::tr("this input note triggers the sound"); break;
+ case 5: return Q3Header::tr("note length"); break;
+ case 6: return Q3Header::tr("this is the note which is played"); break;
+ case 7: return Q3Header::tr("output channel (hold ctl to affect all rows)"); break;
+ case 8: return Q3Header::tr("output port"); break;
+ case 9: return Q3Header::tr("shift + control key: draw velocity level 1"); break;
+ case 10: return Q3Header::tr("control key: draw velocity level 2"); break;
+ case 11: return Q3Header::tr("shift key: draw velocity level 3"); break;
+ case 12: return Q3Header::tr("draw velocity level 4"); break;
+ default: break;
+ }
+ return QString::null;
+ }
+
+//---------------------------------------------------------
+// DHeaderTip::maybeTip
+//---------------------------------------------------------
+
+void DHeaderTip::maybeTip(const QPoint &pos)
+ {
+#if 0 // ddskrjo
+ Header* w = (Header*)parentWidget();
+ int section = w->sectionAt(pos.x());
+ if (section == -1)
+ return;
+ QRect r(w->sectionPos(section), 0, w->sectionSize(section),
+ w->height());
+ QString p;
+ switch(section) {
+ case 0: p = Q3Header::tr("mute instrument"); break;
+ case 1: p = Q3Header::tr("sound name"); break;
+ case 2: p = Q3Header::tr("volume percent"); break;
+ case 3: p = Q3Header::tr("quantisation"); break;
+ case 4: p = Q3Header::tr("this input note triggers the sound"); break;
+ case 5: p = Q3Header::tr("note length"); break;
+ case 6: p = Q3Header::tr("this is the note which is played"); break;
+ case 7: p = Q3Header::tr("output channel (ctl: affect all rows)"); break;
+ case 8: p = Q3Header::tr("output port"); break;
+ case 9: p = Q3Header::tr("shift + control key: draw velocity level 1"); break;
+ case 10: p = Q3Header::tr("control key: draw velocity level 2"); break;
+ case 11: p = Q3Header::tr("shift key: draw velocity level 3"); break;
+ case 12: p = Q3Header::tr("draw velocity level 4"); break;
+ default: return;
+ }
+ tip(r, p);
+#endif
+ }
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void DrumEdit::closeEvent(QCloseEvent* e)
+ {
+ //Store values of the horizontal splitter
+ Q3ValueList<int> sizes = split2->sizes();
+ Q3ValueList<int>::Iterator it = sizes.begin();
+ _dlistWidthInit = *it; //There are only 2 values stored in the sizelist, size of dlist widget and dcanvas widget
+ it++;
+ _dcanvasWidthInit = *it;
+ emit deleted((unsigned long)this);
+ e->accept();
+ }
+
+//---------------------------------------------------------
+// DrumEdit
+//---------------------------------------------------------
+
+DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned initPos)
+ : MidiEditor(_quantInit, _rasterInit, pl, parent, name)
+ {
+ split1w1 = 0;
+ resize(_widthInit, _heightInit);
+ selPart = 0;
+ _to = _toInit;
+ //---------Pulldown Menu----------------------------
+ menuFile = new Q3PopupMenu(this);
+ menuBar()->insertItem(tr("&File"), menuFile);
+
+ menuFile->insertItem(QIcon(*openIcon), tr("Load Map"), DrumCanvas::CMD_LOAD);
+ menuFile->insertItem(QIcon(*saveIcon), tr("Save Map"), DrumCanvas::CMD_SAVE);
+ menuFile->insertItem(tr("Reset GM Map"), DrumCanvas::CMD_RESET);
+
+ menuEdit = new Q3PopupMenu(this);
+ menuBar()->insertItem(tr("&Edit"), menuEdit);
+ undoRedo->addTo(menuEdit);
+ Q3Accel* qa = new Q3Accel(this);
+ qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Z), song, SLOT(undo()));
+ menuEdit->insertSeparator();
+ menuEdit->insertItem(tr("Cut"), DrumCanvas::CMD_CUT);
+ menuEdit->insertItem(tr("Copy"), DrumCanvas::CMD_COPY);
+ menuEdit->insertItem(tr("Paste"), DrumCanvas::CMD_PASTE);
+ menuEdit->insertSeparator();
+ menuEdit->insertItem(tr("Delete Events"), DrumCanvas::CMD_DEL);
+
+ // Functions
+ menuFunctions = new Q3PopupMenu(this);
+ menuBar()->insertItem(tr("&Functions"), menuFunctions);
+ menuFunctions->insertTearOffHandle();
+ menuFunctions->insertItem(tr("Set fixed length"), DrumCanvas::CMD_FIXED_LEN);
+ menuFunctions->insertItem(tr("Modify Velocity"), DrumCanvas::CMD_MODIFY_VELOCITY);
+
+ menuSelect = new Q3PopupMenu(this);
+ menuSelect->insertItem(tr("Select All"), DrumCanvas::CMD_SELECT_ALL);
+ menuSelect->insertItem(tr("Select None"), DrumCanvas::CMD_SELECT_NONE);
+ menuSelect->insertItem(tr("Invert"), DrumCanvas::CMD_SELECT_INVERT);
+ menuSelect->insertSeparator();
+ menuSelect->insertItem(tr("Inside Loop"), DrumCanvas::CMD_SELECT_ILOOP);
+ menuSelect->insertItem(tr("Outside Loop"), DrumCanvas::CMD_SELECT_OLOOP);
+
+ menuSelect->insertSeparator();
+
+ menuSelect->insertItem(tr("Previous Part"), DrumCanvas::CMD_SELECT_PREV_PART);
+ menuSelect->insertItem(tr("Next Part"), DrumCanvas::CMD_SELECT_NEXT_PART);
+
+ menuEdit->insertItem(tr("&Select"), menuSelect);
+
+ Q3PopupMenu* menuScriptPlugins = new Q3PopupMenu(this);
+ song->populateScriptMenu(menuScriptPlugins, this);
+ menuBar()->insertItem(tr("&Plugins"), menuScriptPlugins);
+
+ connect(menuFile, SIGNAL(activated(int)), SLOT(cmd(int)));
+ connect(menuEdit, SIGNAL(activated(int)), SLOT(cmd(int)));
+ connect(menuSelect, SIGNAL(activated(int)), SLOT(cmd(int)));
+ connect(menuFunctions, SIGNAL(activated(int)), SLOT(cmd(int)));
+
+ //---------------------------------------------------
+ // Toolbars
+ //---------------------------------------------------
+
+ tools = new Q3ToolBar(this, "drum-tools");
+ new QToolButton(*openIcon, tr("Load Drummap"),
+ QString::null, this, SLOT(load()),
+ tools, "load drummap from file");
+
+ new QToolButton(*saveIcon, tr("Store Drummap"),
+ QString::null,
+ this, SLOT(save()),
+ tools, "store drummap to file");
+
+ Q3WhatsThis::whatsThisButton(tools);
+
+ tools->addSeparator();
+ undoRedo->addTo(tools);
+ tools->addSeparator();
+
+ srec = new QToolButton(tools, "srec");
+ QToolTip::add(srec, tr("Step Record"));
+ srec->setPixmap(*steprecIcon);
+ srec->setToggleButton(true);
+
+ midiin = new QToolButton(tools, "midiin");
+ QToolTip::add(midiin, tr("Midi Input"));
+ midiin->setPixmap(*midiinIcon);
+ midiin->setToggleButton(true);
+
+ tools2 = new EditToolBar(this, drumeditTools);
+
+ Q3ToolBar* transport = new Q3ToolBar(this);
+ transportAction->addTo(transport);
+
+ // dontt show pitch value in toolbar
+ //toolbar = new Toolbar1(this, _rasterInit, _quantInit, false);
+ toolbar = new Toolbar1(this, _rasterInit, _quantInit);
+ info = new NoteInfo(this);
+
+ //---------------------------------------------------
+ // split
+ //---------------------------------------------------
+
+ split1 = new Splitter(Qt::Vertical, mainw, "split1");
+ QPushButton* ctrl = new QPushButton(tr("ctrl"), mainw, "Ctrl");
+ ctrl->setFont(config.fonts[3]);
+ hscroll = new ScrollScale(-25, -2, xscale, 20000, Qt::Horizontal, mainw);
+ ctrl->setFixedSize(40, hscroll->sizeHint().height());
+ QToolTip::add(ctrl, tr("Add Controller View"));
+
+ QSizeGrip* corner = new QSizeGrip(mainw);
+ corner->setFixedHeight(hscroll->sizeHint().height());
+
+ mainGrid->setRowStretch(0, 100);
+ mainGrid->setColStretch(1, 100);
+
+ mainGrid->addMultiCellWidget(split1, 0, 0, 0, 2);
+ mainGrid->addWidget(ctrl, 1, 0);
+ mainGrid->addWidget(hscroll, 1, 1);
+ mainGrid->addWidget(corner, 1, 2, Qt::AlignBottom|Qt::AlignRight);
+// mainGrid->addRowSpacing(1, hscroll->sizeHint().height());
+
+ split2 = new Splitter(Qt::Horizontal, split1, "split2");
+ split1w1 = new QWidget(split2, "split1w1");
+ QWidget* split1w2 = new QWidget(split2, "split1w2");
+ Q3GridLayout* gridS1 = new Q3GridLayout(split1w1);
+ Q3GridLayout* gridS2 = new Q3GridLayout(split1w2);
+ time = new MTScale(&_raster, split1w2, xscale);
+ canvas = new DrumCanvas(this, split1w2, xscale, yscale);
+ vscroll = new ScrollScale(-4, 1, yscale, DRUM_MAPSIZE*TH, Qt::Vertical, split1w2);
+ int offset = -(config.division/4);
+ canvas->setOrigin(offset, 0);
+ canvas->setCanvasTools(drumeditTools);
+ canvas->setFocus();
+ connect(canvas, SIGNAL(toolChanged(int)), tools2, SLOT(set(int)));
+ time->setOrigin(offset, 0);
+
+ Q3ValueList<int> mops;
+ mops.append(_dlistWidthInit);
+ mops.append(_dcanvasWidthInit);
+ split2->setSizes(mops);
+ // By T356. Not much choice but to disable this for now, to stop runaway resize bug.
+ // Can't seem to get the splitter to readjust when manually setting sizes.
+ //split2->setResizeMode(split1w1, QSplitter::KeepSize);
+
+ gridS2->setRowStretch(1, 100);
+ gridS2->setColStretch(0, 100);
+
+ gridS2->addMultiCellWidget(time, 0, 0, 0, 1);
+ gridS2->addMultiCellWidget(hLine(split1w2), 1, 1, 0, 1);
+ gridS2->addWidget(canvas, 2, 0);
+
+ gridS2->addWidget(vscroll, 2, 1);
+ //
+ // Reihenfolge in dlist.c festgeschrieben ("Dcols")
+ //
+ header = new Header(split1w1, "header");
+ header->setFixedHeight(30);
+ header->addLabel(tr("M"), 20);
+ header->addLabel(tr("Sound"), 100);
+ header->addLabel(tr("Vol"));
+ header->addLabel(tr("QNT"));
+ header->addLabel(tr("E-Note"));
+ header->addLabel(tr("Len"));
+ header->addLabel(tr("A-Note"));
+ header->addLabel(tr("Ch"));
+ header->addLabel(tr("Port"), 60);
+ header->addLabel(tr("LV1"));
+ header->addLabel(tr("LV2"));
+ header->addLabel(tr("LV3"));
+ header->addLabel(tr("LV4"));
+ new DHeaderTip(header);
+ new DWhatsThis(header, header);
+
+ dlist = new DList(header, split1w1, yscale);
+ // p3.3.44
+ setCurDrumInstrument(dlist->getSelectedInstrument());
+
+ connect(dlist, SIGNAL(keyPressed(int, bool)), canvas, SLOT(keyPressed(int, bool)));
+ connect(dlist, SIGNAL(keyReleased(int, bool)), canvas, SLOT(keyReleased(int, bool)));
+ connect(dlist, SIGNAL(mapChanged(int, int)), canvas, SLOT(mapChanged(int, int)));
+
+ gridS1->setRowStretch(1, 100);
+ gridS1->setColStretch(0, 100);
+ gridS1->addWidget(header, 0, 0);
+ gridS1->addWidget(dlist, 1, 0);
+
+ connect(canvas, SIGNAL(newWidth(int)), SLOT(newCanvasWidth(int)));
+ connect(canvas, SIGNAL(verticalScroll(unsigned)), vscroll, SLOT(setPos(unsigned)));
+ connect(canvas, SIGNAL(horizontalScroll(unsigned)),hscroll, SLOT(setPos(unsigned)));
+ connect(canvas, SIGNAL(horizontalScrollNoLimit(unsigned)),hscroll, SLOT(setPosNoLimit(unsigned)));
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged1(int)));
+ connect(song, SIGNAL(songChanged(int)), dlist, SLOT(songChanged(int)));
+ connect(vscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setYPos(int)));
+ connect(vscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setYMag(int)));
+ connect(vscroll, SIGNAL(scaleChanged(int)), dlist, SLOT(setYMag(int)));
+ connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int)));
+ connect(hscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setXMag(int)));
+ connect(srec, SIGNAL(toggled(bool)), canvas, SLOT(setSteprec(bool)));
+ connect(midiin, SIGNAL(toggled(bool)), canvas, SLOT(setMidiin(bool)));
+
+ connect(vscroll, SIGNAL(scrollChanged(int)), dlist, SLOT(setYPos(int)));
+ connect(hscroll, SIGNAL(scrollChanged(int)), time, SLOT(setXPos(int)));
+ connect(hscroll, SIGNAL(scaleChanged(int)), time, SLOT(setXMag(int)));
+
+ connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int)));
+
+ connect(canvas, SIGNAL(selectionChanged(int, Event&, Part*)), this,
+ SLOT(setSelection(int, Event&, Part*)));
+ connect(canvas, SIGNAL(followEvent(int)), SLOT(follow(int)));
+
+ connect(hscroll, SIGNAL(scaleChanged(int)), SLOT(updateHScrollRange()));
+ setCaption(canvas->getCaption());
+
+ updateHScrollRange();
+
+ // connect toolbar
+ connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
+ connect(time, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
+ connect(toolbar, SIGNAL(quantChanged(int)), SLOT(setQuant(int)));
+ connect(toolbar, SIGNAL(rasterChanged(int)), SLOT(setRaster(int)));
+ connect(toolbar, SIGNAL(soloChanged(bool)), SLOT(soloChanged(bool)));
+ connect(info, SIGNAL(valueChanged(NoteInfo::ValType, int)), SLOT(noteinfoChanged(NoteInfo::ValType, int)));
+
+ connect(ctrl, SIGNAL(clicked()), SLOT(addCtrl()));
+
+ QClipboard* cb = QApplication::clipboard();
+ connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged()));
+
+ clipboardChanged(); // enable/disable "Paste"
+ selectionChanged(); // enable/disable "Copy" & "Paste"
+ initShortcuts();
+
+ const Pos cpos=song->cPos();
+ canvas->setPos(0, cpos.tick(), true);
+ canvas->selectAtTick(cpos.tick());
+ //canvas->selectFirst();
+
+ if(canvas->track())
+ toolbar->setSolo(canvas->track()->solo());
+
+ unsigned pos;
+ if(initPos >= MAXINT)
+ pos = song->cpos();
+ else
+ pos = initPos;
+ if(pos > MAXINT)
+ pos = MAXINT;
+ hscroll->setOffset((int)pos);
+ }
+
+//---------------------------------------------------------
+// songChanged1
+//---------------------------------------------------------
+
+void DrumEdit::songChanged1(int bits)
+ {
+ if (bits & SC_SOLO)
+ {
+ toolbar->setSolo(canvas->track()->solo());
+ return;
+ }
+ songChanged(bits);
+
+ }
+
+//---------------------------------------------------------
+// updateHScrollRange
+//---------------------------------------------------------
+
+void DrumEdit::updateHScrollRange()
+{
+ int s, e;
+ canvas->range(&s, &e);
+ // Show one more measure.
+ e += sigmap.ticksMeasure(e);
+ // Show another quarter measure due to imprecise drawing at canvas end point.
+ e += sigmap.ticksMeasure(e) / 4;
+ // Compensate for drum list, splitter handle, and vscroll widths.
+ e += canvas->rmapxDev(dlist->width() + split2->handleWidth() - vscroll->width());
+ int s1, e1;
+ hscroll->range(&s1, &e1);
+ if(s != s1 || e != e1)
+ hscroll->setRange(s, e);
+}
+
+//---------------------------------------------------------
+// follow
+//---------------------------------------------------------
+
+void DrumEdit::follow(int pos)
+ {
+ int s, e;
+ canvas->range(&s, &e);
+
+ if (pos < e && pos >= s)
+ hscroll->setOffset(pos);
+ if (pos < s)
+ hscroll->setOffset(s);
+ }
+
+//---------------------------------------------------------
+// setTime
+//---------------------------------------------------------
+
+void DrumEdit::setTime(unsigned tick)
+ {
+ toolbar->setTime(tick);
+ time->setPos(3, tick, false);
+ }
+
+//---------------------------------------------------------
+// ~DrumEdit
+//---------------------------------------------------------
+
+DrumEdit::~DrumEdit()
+ {
+ undoRedo->removeFrom(tools);
+ }
+
+//---------------------------------------------------------
+// setSelection
+// update Info Line
+//---------------------------------------------------------
+
+void DrumEdit::setSelection(int tick, Event& e, Part* p)
+ {
+ selEvent = e;
+ selPart = (MidiPart*)p;
+ selTick = tick;
+ info->setEnabled(!e.empty());
+ if (!e.empty()) {
+ info->setValues(tick,
+ selEvent.lenTick(),
+ selEvent.pitch(),
+ selEvent.velo(),
+ selEvent.veloOff());
+ }
+ selectionChanged();
+ }
+
+//---------------------------------------------------------
+// soloChanged
+//---------------------------------------------------------
+
+void DrumEdit::soloChanged(bool flag)
+ {
+ audio->msgSetSolo(canvas->track(), flag);
+ song->update(SC_SOLO);
+ }
+
+//---------------------------------------------------------
+// setRaster
+//---------------------------------------------------------
+
+void DrumEdit::setRaster(int val)
+ {
+ _rasterInit = val;
+ MidiEditor::setRaster(val);
+ canvas->redrawGrid();
+ }
+
+//---------------------------------------------------------
+// setQuant
+//---------------------------------------------------------
+
+void DrumEdit::setQuant(int val)
+ {
+ _quantInit = val;
+ MidiEditor::setQuant(val);
+ }
+
+//---------------------------------------------------------
+// edit currently selected Event
+//---------------------------------------------------------
+
+void DrumEdit::noteinfoChanged(NoteInfo::ValType type, int val)
+ {
+ if (selEvent.empty()) {
+ printf("noteinfoChanged while note is zero %d\n", type);
+ return;
+ }
+ Event event = selEvent.clone();
+ switch (type) {
+ case NoteInfo::VAL_TIME:
+ event.setTick(val - selPart->tick());
+ break;
+ case NoteInfo::VAL_LEN:
+ event.setLenTick(val);
+ break;
+ case NoteInfo::VAL_VELON:
+ event.setVelo(val);
+ break;
+ case NoteInfo::VAL_VELOFF:
+ event.setVeloOff(val);
+ break;
+ case NoteInfo::VAL_PITCH:
+ event.setPitch(val);
+ break;
+ }
+ // Indicate do undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(selEvent, event, selPart);
+ audio->msgChangeEvent(selEvent, event, selPart, true, false, false);
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void DrumEdit::writeStatus(int level, Xml& xml) const
+ {
+ writePartList(level, xml);
+ xml.tag(level++, "drumedit");
+ MidiEditor::writeStatus(level, xml);
+
+ for (std::list<CtrlEdit*>::const_iterator i = ctrlEditList.begin();
+ i != ctrlEditList.end(); ++i) {
+ (*i)->writeStatus(level, xml);
+ }
+
+ split1->writeStatus(level, xml);
+ split2->writeStatus(level, xml);
+
+ header->writeStatus(level, xml);
+ xml.intTag(level, "steprec", canvas->steprec());
+ xml.intTag(level, "midiin", canvas->midiin());
+ xml.intTag(level, "xpos", hscroll->pos());
+ xml.intTag(level, "xmag", hscroll->mag());
+ xml.intTag(level, "ypos", vscroll->pos());
+ xml.intTag(level, "ymag", vscroll->mag());
+ xml.tag(level, "/drumedit");
+ }
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void DrumEdit::readStatus(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "steprec") {
+ int val = xml.parseInt();
+ canvas->setSteprec(val);
+ srec->setOn(val);
+ }
+ else if (tag == "midiin") {
+ int val = xml.parseInt();
+ canvas->setMidiin(val);
+ midiin->setOn(val);
+ }
+ else if (tag == "ctrledit") {
+ CtrlEdit* ctrl = addCtrl();
+ ctrl->readStatus(xml);
+ }
+ else if (tag == split1->name())
+ split1->readStatus(xml);
+ else if (tag == split2->name())
+ split2->readStatus(xml);
+ else if (tag == "midieditor")
+ MidiEditor::readStatus(xml);
+ else if (tag == header->name())
+ header->readStatus(xml);
+ else if (tag == "xmag")
+ hscroll->setMag(xml.parseInt());
+ else if (tag == "xpos")
+ hscroll->setPos(xml.parseInt());
+ else if (tag == "ymag")
+ vscroll->setMag(xml.parseInt());
+ else if (tag == "ypos")
+ vscroll->setPos(xml.parseInt());
+ else
+ xml.unknown("DrumEdit");
+ break;
+ case Xml::TagEnd:
+ if (tag == "drumedit") {
+ _quantInit = _quant;
+ _rasterInit = _raster;
+ toolbar->setRaster(_raster);
+ toolbar->setQuant(_quant);
+ canvas->redrawGrid();
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// readConfiguration
+//---------------------------------------------------------
+
+void DrumEdit::readConfiguration(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "quant")
+ _quantInit = xml.parseInt();
+ else if (tag == "raster")
+ _rasterInit = xml.parseInt();
+ else if (tag == "width")
+ _widthInit = xml.parseInt();
+ else if (tag == "height")
+ _heightInit = xml.parseInt();
+ else if (tag == "dcanvaswidth")
+ _dcanvasWidthInit = xml.parseInt();
+ else if (tag == "dlistwidth")
+ _dlistWidthInit = xml.parseInt();
+ else if (tag == "to") {
+ _toInit = xml.parseInt();
+ }
+ else
+ xml.unknown("DrumEdit");
+ break;
+ case Xml::TagEnd:
+ if (tag == "drumedit") {
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// writeConfiguration
+//---------------------------------------------------------
+
+void DrumEdit::writeConfiguration(int level, Xml& xml)
+ {
+ xml.tag(level++, "drumedit");
+ xml.intTag(level, "quant", _quantInit);
+ xml.intTag(level, "raster", _rasterInit);
+ xml.intTag(level, "width", _widthInit);
+ xml.intTag(level, "height", _heightInit);
+ xml.intTag(level, "dlistwidth", _dlistWidthInit);
+ xml.intTag(level, "dcanvaswidth", _dcanvasWidthInit);
+ xml.intTag(level, "to", _toInit);
+ xml.tag(level, "/drumedit");
+ }
+
+//---------------------------------------------------------
+// load
+//---------------------------------------------------------
+
+void DrumEdit::load()
+ {
+ //QString fn = getOpenFileName("drummaps", map_file_pattern,
+ QString fn = getOpenFileName("drummaps", drum_map_file_pattern,
+ this, tr("Muse: Load Drum Map"), 0);
+ if (fn.isEmpty())
+ return;
+ bool popenFlag;
+ FILE* f = fileOpen(this, fn, QString(".map"), "r", popenFlag, true);
+ if (f == 0)
+ return;
+
+ Xml xml(f);
+ int mode = 0;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (mode == 0 && tag == "muse")
+ mode = 1;
+ else if (mode == 1 && tag == "drummap") {
+ readDrumMap(xml, true);
+ mode = 0;
+ }
+ else
+ xml.unknown("DrumEdit");
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if (!mode && tag == "muse")
+ goto ende;
+ default:
+ break;
+ }
+ }
+ende:
+ if (popenFlag)
+ pclose(f);
+ else
+ fclose(f);
+ dlist->redraw();
+ canvas->redraw();
+ }
+
+//---------------------------------------------------------
+// save
+//---------------------------------------------------------
+
+void DrumEdit::save()
+ {
+ //QString fn = getSaveFileName(QString("drummaps"), map_file_pattern,
+ QString fn = getSaveFileName(QString("drummaps"), drum_map_file_save_pattern,
+ this, tr("MusE: Store Drum Map"));
+ if (fn.isEmpty())
+ return;
+ bool popenFlag;
+ FILE* f = fileOpen(this, fn, QString(".map"), "w", popenFlag, false, true);
+ if (f == 0)
+ return;
+ Xml xml(f);
+ xml.header();
+ xml.tag(0, "muse version=\"1.0\"");
+ writeDrumMap(1, xml, true);
+ xml.tag(1, "/muse");
+
+ if (popenFlag)
+ pclose(f);
+ else
+ fclose(f);
+ }
+
+//---------------------------------------------------------
+// reset
+//---------------------------------------------------------
+
+void DrumEdit::reset()
+{
+ if(QMessageBox::warning(this, tr("Drum map"),
+ tr("Reset the drum map with GM defaults?"),
+ QMessageBox::Ok | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape, Qt::NoButton) == QMessageBox::Ok)
+ {
+ resetGMDrumMap();
+ dlist->redraw();
+ canvas->redraw();
+ }
+}
+
+//---------------------------------------------------------
+// cmd
+// pulldown menu commands
+//---------------------------------------------------------
+
+void DrumEdit::cmd(int cmd)
+ {
+ switch(cmd) {
+ case DrumCanvas::CMD_LOAD:
+ load();
+ break;
+ case DrumCanvas::CMD_SAVE:
+ save();
+ break;
+ case DrumCanvas::CMD_RESET:
+ reset();
+ break;
+ default:
+ ((DrumCanvas*)(canvas))->cmd(cmd);
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// clipboardChanged
+//---------------------------------------------------------
+
+void DrumEdit::clipboardChanged()
+ {
+ QMimeSource* ms = QApplication::clipboard()->data(QClipboard::Clipboard);
+ if (ms && ms->format(0)) {
+ bool flag = strcmp(ms->format(0), "text/eventlist;charset=UTF-8") == 0;
+ menuEdit->setItemEnabled(DrumCanvas::CMD_PASTE, flag);
+ }
+ }
+
+//---------------------------------------------------------
+// selectionChanged
+//---------------------------------------------------------
+
+void DrumEdit::selectionChanged()
+ {
+ bool flag = canvas->selectionSize() > 0;
+ menuEdit->setItemEnabled(DrumCanvas::CMD_CUT, flag);
+ menuEdit->setItemEnabled(DrumCanvas::CMD_COPY, flag);
+ menuEdit->setItemEnabled(DrumCanvas::CMD_DEL, flag);
+ }
+
+//---------------------------------------------------------
+// addCtrl
+//---------------------------------------------------------
+
+CtrlEdit* DrumEdit::addCtrl()
+ {
+ CtrlEdit* ctrlEdit = new CtrlEdit(split1, this, xscale, true, "drumCtrlEdit");
+ connect(hscroll, SIGNAL(scrollChanged(int)), ctrlEdit, SLOT(setXPos(int)));
+ connect(hscroll, SIGNAL(scaleChanged(int)), ctrlEdit, SLOT(setXMag(int)));
+ connect(ctrlEdit, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
+ connect(ctrlEdit, SIGNAL(destroyedCtrl(CtrlEdit*)), SLOT(removeCtrl(CtrlEdit*)));
+ connect(ctrlEdit, SIGNAL(yposChanged(int)), toolbar, SLOT(setInt(int)));
+ connect(tools2, SIGNAL(toolChanged(int)), ctrlEdit, SLOT(setTool(int)));
+ connect(dlist, SIGNAL(curDrumInstrumentChanged(int)), SLOT(setCurDrumInstrument(int)));
+
+ //printf("DrumEdit::addCtrl curDrumInstrument:%d\n", dlist->getSelectedInstrument());
+
+ setCurDrumInstrument(dlist->getSelectedInstrument());
+
+ // p3.3.44
+ ctrlEdit->setTool(tools2->curTool());
+
+ ctrlEdit->setXPos(hscroll->pos());
+ ctrlEdit->setXMag(hscroll->getScaleValue());
+
+ if(split1w1)
+ {
+ split2->setCollapsible(split1w1, false);
+ split1w1->setMinimumWidth(CTRL_PANEL_FIXED_WIDTH);
+ }
+ ctrlEdit->setCanvasWidth(canvas->width());
+
+ ctrlEdit->show();
+ ctrlEditList.push_back(ctrlEdit);
+ return ctrlEdit;
+ }
+
+//---------------------------------------------------------
+// removeCtrl
+//---------------------------------------------------------
+
+void DrumEdit::removeCtrl(CtrlEdit* ctrl)
+ {
+ for (std::list<CtrlEdit*>::iterator i = ctrlEditList.begin();
+ i != ctrlEditList.end(); ++i) {
+ if (*i == ctrl) {
+ ctrlEditList.erase(i);
+ break;
+ }
+ }
+
+ if(split1w1)
+ {
+ if(ctrlEditList.empty())
+ {
+ split1w1->setMinimumWidth(0);
+ split2->setCollapsible(split1w1, true);
+ }
+ }
+ }
+//---------------------------------------------------------
+// newCanvasWidth
+//---------------------------------------------------------
+
+void DrumEdit::newCanvasWidth(int w)
+ {
+ int nw = w + (vscroll->width() - 18); // 18 is the fixed width of the CtlEdit VScale widget.
+ if(nw < 1)
+ nw = 1;
+
+ for (std::list<CtrlEdit*>::iterator i = ctrlEditList.begin();
+ i != ctrlEditList.end(); ++i) {
+ // Changed by Tim. p3.3.7
+ //(*i)->setCanvasWidth(w);
+ (*i)->setCanvasWidth(nw);
+ }
+
+ updateHScrollRange();
+ }
+
+//---------------------------------------------------------
+// resizeEvent
+//---------------------------------------------------------
+
+void DrumEdit::resizeEvent(QResizeEvent* ev)
+ {
+ QWidget::resizeEvent(ev);
+ _widthInit = ev->size().width();
+ _heightInit = ev->size().height();
+
+ //TODO: Make the dlist not expand/shrink, but the canvas instead
+ }
+
+
+//---------------------------------------------------------
+// configChanged
+//---------------------------------------------------------
+
+void DrumEdit::configChanged()
+ {
+ initShortcuts();
+ }
+
+static int rasterTable[] = {
+ //-9----8- 7 6 5 4 3(1/4) 2 1
+ 4, 8, 16, 32, 64, 128, 256, 512, 1024, // triple
+ 6, 12, 24, 48, 96, 192, 384, 768, 1536,
+ 9, 18, 36, 72, 144, 288, 576, 1152, 2304 // dot
+ };
+
+//---------------------------------------------------------
+// keyPressEvent
+//---------------------------------------------------------
+void DrumEdit::keyPressEvent(QKeyEvent* event)
+ {
+ DrumCanvas* dc = (DrumCanvas*)canvas;
+ int index = 0;
+ int n = sizeof(rasterTable);
+ for (; index < n; ++index)
+ if (rasterTable[index] == raster())
+ break;
+ int off = (index / 9) * 9;
+ index = index % 9;
+ int val;
+ int key = event->key();
+
+ if (event->state() & Qt::ShiftButton)
+ key += Qt::SHIFT;
+ if (event->state() & Qt::AltButton)
+ key += Qt::ALT;
+ if (event->state() & Qt::ControlButton)
+ key+= Qt::CTRL;
+
+ if (key == Qt::Key_Escape) {
+ close();
+ return;
+ }
+ else if (key == Qt::Key_Up) {
+ dlist->setCurDrumInstrument(dlist->getSelectedInstrument()-1);
+ dlist->redraw();
+ return;
+ }
+ else if (key == Qt::Key_F2) {
+ dlist->lineEdit(dlist->getSelectedInstrument(),(int)DList::COL_NAME);
+ return;
+ }
+ else if (key == Qt::Key_Down) {
+ dlist->setCurDrumInstrument(dlist->getSelectedInstrument()+1);
+ dlist->redraw();
+ return;
+ }
+
+ else if (key == shortcuts[SHRT_POS_INC].key) {
+ dc->cmd(DrumCanvas::CMD_RIGHT);
+ return;
+ }
+ else if (key == shortcuts[SHRT_POS_DEC].key) {
+ dc->cmd(DrumCanvas::CMD_LEFT);
+ return;
+ }
+
+ else if (key == shortcuts[SHRT_TOOL_POINTER].key) {
+ tools2->set(PointerTool);
+ return;
+ }
+ else if (key == shortcuts[SHRT_TOOL_PENCIL].key) {
+ tools2->set(PencilTool);
+ return;
+ }
+ else if (key == shortcuts[SHRT_TOOL_RUBBER].key) {
+ tools2->set(RubberTool);
+ return;
+ }
+ else if (key == shortcuts[SHRT_ZOOM_IN].key) {
+ int mag = hscroll->mag();
+ int zoomlvl = ScrollScale::getQuickZoomLevel(mag);
+ if (zoomlvl < 23)
+ zoomlvl++;
+
+ int newmag = ScrollScale::convertQuickZoomLevelToMag(zoomlvl);
+ hscroll->setMag(newmag);
+ //printf("mag = %d zoomlvl = %d newmag = %d\n", mag, zoomlvl, newmag);
+ return;
+ }
+ else if (key == shortcuts[SHRT_ZOOM_OUT].key) {
+ int mag = hscroll->mag();
+ int zoomlvl = ScrollScale::getQuickZoomLevel(mag);
+ if (zoomlvl > 1)
+ zoomlvl--;
+
+ int newmag = ScrollScale::convertQuickZoomLevelToMag(zoomlvl);
+ hscroll->setMag(newmag);
+ //printf("mag = %d zoomlvl = %d newmag = %d\n", mag, zoomlvl, newmag);
+ return;
+ }
+ else if (key == shortcuts[SHRT_SCROLL_LEFT].key) {
+ int pos = hscroll->pos() - config.division;
+ if (pos < 0)
+ pos = 0;
+ hscroll->setPos(pos);
+ return;
+ }
+ else if (key == shortcuts[SHRT_SCROLL_RIGHT].key) {
+ int pos = hscroll->pos() + config.division;
+ hscroll->setPos(pos);
+ return;
+ }
+
+ /*
+ else if (key == shortcuts[SHRT_INSERT_AT_LOCATION].key) {
+ pc->pianoCmd(CMD_INSERT);
+ return;
+ }
+ */
+ else if (key == shortcuts[SHRT_SET_QUANT_1].key)
+ val = rasterTable[8 + off];
+ else if (key == shortcuts[SHRT_SET_QUANT_2].key)
+ val = rasterTable[7 + off];
+ else if (key == shortcuts[SHRT_SET_QUANT_3].key)
+ val = rasterTable[6 + off];
+ else if (key == shortcuts[SHRT_SET_QUANT_4].key)
+ val = rasterTable[5 + off];
+ else if (key == shortcuts[SHRT_SET_QUANT_5].key)
+ val = rasterTable[4 + off];
+ else if (key == shortcuts[SHRT_SET_QUANT_6].key)
+ val = rasterTable[3 + off];
+ else if (key == shortcuts[SHRT_SET_QUANT_7].key)
+ val = rasterTable[2 + off];
+ else if (key == shortcuts[SHRT_TOGGLE_TRIOL].key)
+ val = rasterTable[index + ((off == 0) ? 9 : 0)];
+ /*
+ else if (key == shortcuts[SHRT_EVENT_COLOR].key) {
+ if (colorMode == 0)
+ colorMode = 1;
+ else if (colorMode == 1)
+ colorMode = 2;
+ else
+ colorMode = 0;
+ setEventColorMode(colorMode);
+ return;
+ }*/
+ else if (key == shortcuts[SHRT_TOGGLE_PUNCT].key)
+ val = rasterTable[index + ((off == 18) ? 9 : 18)];
+
+ else if (key == shortcuts[SHRT_TOGGLE_PUNCT2].key) {//CDW
+ if ((off == 18) && (index > 2)) {
+ val = rasterTable[index + 9 - 1];
+ }
+ else if ((off == 9) && (index < 8)) {
+ val = rasterTable[index + 18 + 1];
+ }
+ else
+ return;
+ }
+ else { //Default:
+ event->ignore();
+ return;
+ }
+ setQuant(val);
+ setRaster(val);
+ toolbar->setQuant(_quant);
+ toolbar->setRaster(_raster);
+ }
+
+
+
+//---------------------------------------------------------
+// initShortcuts
+//---------------------------------------------------------
+
+void DrumEdit::initShortcuts()
+ {
+ menuEdit->setAccel(shortcuts[SHRT_CUT].key, DrumCanvas::CMD_CUT);
+ menuEdit->setAccel(shortcuts[SHRT_COPY].key, DrumCanvas::CMD_COPY);;
+ menuEdit->setAccel(shortcuts[SHRT_PASTE].key, DrumCanvas::CMD_PASTE);
+ menuEdit->setAccel(shortcuts[SHRT_DELETE].key, DrumCanvas::CMD_DEL);
+ menuFile->setAccel(shortcuts[SHRT_OPEN].key, DrumCanvas::CMD_LOAD);
+ menuFile->setAccel(shortcuts[SHRT_SAVE].key, DrumCanvas::CMD_SAVE);
+ menuFunctions->setAccel(shortcuts[SHRT_FIXED_LEN].key, DrumCanvas::CMD_FIXED_LEN);
+ menuFunctions->setAccel(shortcuts[SHRT_MODIFY_VELOCITY].key, DrumCanvas::CMD_MODIFY_VELOCITY);
+ menuSelect->setAccel(shortcuts[SHRT_SELECT_ALL].key, DrumCanvas::CMD_SELECT_ALL);
+ menuSelect->setAccel(shortcuts[SHRT_SELECT_NONE].key, DrumCanvas::CMD_SELECT_NONE);
+ menuSelect->setAccel(shortcuts[SHRT_SELECT_INVERT].key, DrumCanvas::CMD_SELECT_INVERT);
+ menuSelect->setAccel(shortcuts[SHRT_SELECT_ILOOP].key, DrumCanvas::CMD_SELECT_ILOOP);
+ menuSelect->setAccel(shortcuts[SHRT_SELECT_OLOOP].key, DrumCanvas::CMD_SELECT_OLOOP);
+
+ menuSelect->setAccel(shortcuts[SHRT_SELECT_PREV_PART].key, DrumCanvas::CMD_SELECT_PREV_PART);
+ menuSelect->setAccel(shortcuts[SHRT_SELECT_NEXT_PART].key, DrumCanvas::CMD_SELECT_NEXT_PART);
+ }
+
+//---------------------------------------------------------
+// execDeliveredScript
+//---------------------------------------------------------
+void DrumEdit::execDeliveredScript(int id)
+{
+ //QString scriptfile = QString(INSTPREFIX) + SCRIPTSSUFFIX + deliveredScriptNames[id];
+ QString scriptfile = song->getScriptPath(id, true);
+ song->executeScript(scriptfile.latin1(), parts(), quant(), true);
+}
+
+//---------------------------------------------------------
+// execUserScript
+//---------------------------------------------------------
+void DrumEdit::execUserScript(int id)
+{
+ QString scriptfile = song->getScriptPath(id, false);
+ song->executeScript(scriptfile.latin1(), parts(), quant(), true);
+}
+
diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h
new file mode 100644
index 00000000..5043412f
--- /dev/null
+++ b/muse2/muse/midiedit/drumedit.h
@@ -0,0 +1,151 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: drumedit.h,v 1.9.2.7 2009/11/16 11:29:33 lunar_shuttle Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __DRUM_EDIT_H__
+#define __DRUM_EDIT_H__
+
+#include <qwidget.h>
+#include <q3mainwindow.h>
+#include <qtooltip.h>
+#include <q3whatsthis.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QLabel>
+#include <QKeyEvent>
+#include <Q3PopupMenu>
+#include <QCloseEvent>
+
+#include <values.h>
+#include "midieditor.h"
+#include "noteinfo.h"
+#include "cobject.h"
+#include "tools.h"
+#include "header.h"
+#include "shortcuts.h"
+#include "event.h"
+
+class MidiPart;
+class QLabel;
+class DrumCanvas;
+class ScrollScale;
+class ScoreConfig;
+class QToolButton;
+class MTScale;
+class Splitter;
+class PartList;
+class Toolbar1;
+class CtrlCanvas;
+class Xml;
+class Q3PopupMenu;
+class DList;
+class Header;
+class CtrlEdit;
+class Part;
+class SNode;
+
+//---------------------------------------------------------
+// DWhatsThis
+//---------------------------------------------------------
+
+class DWhatsThis : public Q3WhatsThis {
+ Header* header;
+ protected:
+ QString text(const QPoint&);
+ public:
+ DWhatsThis(QWidget* parent, Header* h) : Q3WhatsThis(parent) {
+ header = h;
+ }
+ };
+
+//----------------------------------------------------------
+// DHeaderTip
+//----------------------------------------------------------
+
+class DHeaderTip { // : public QToolTip { ddskrjo
+ public:
+ DHeaderTip(QWidget * parent) {} // : QToolTip(parent) {} ddskrjo
+ virtual ~DHeaderTip(){}
+ protected:
+ void maybeTip(const QPoint &);
+ };
+
+//---------------------------------------------------------
+// DrumEdit
+//---------------------------------------------------------
+
+class DrumEdit : public MidiEditor {
+ Event selEvent;
+ MidiPart* selPart;
+ int selTick;
+ Q3PopupMenu* menuEdit, *menuFunctions, *menuFile, *menuSelect;
+
+ NoteInfo* info;
+ QToolButton* srec;
+ QToolButton* midiin;
+ EditToolBar* tools2;
+
+ Toolbar1* toolbar;
+ Splitter* split1;
+ Splitter* split2;
+ QWidget* split1w1;
+ DList* dlist;
+ Header* header;
+ Q3ToolBar* tools;
+
+ static int _quantInit, _rasterInit;
+ static int _widthInit, _heightInit;
+ static int _dlistWidthInit, _dcanvasWidthInit;
+
+ static int _toInit; //Used in function dialog for applying modification to selection
+ Q_OBJECT
+ void initShortcuts();
+
+ virtual void closeEvent(QCloseEvent*);
+ QWidget* genToolbar(QWidget* parent);
+ virtual void resizeEvent(QResizeEvent*);
+ virtual void keyPressEvent(QKeyEvent*);
+ int _to;//TODO: Make this work
+
+
+ private slots:
+ void setRaster(int);
+ void setQuant(int);
+ void noteinfoChanged(NoteInfo::ValType type, int val);
+ CtrlEdit* addCtrl();
+ void removeCtrl(CtrlEdit* ctrl);
+ void cmd(int);
+ void clipboardChanged(); // enable/disable "Paste"
+ void selectionChanged(); // enable/disable "Copy" & "Paste"
+ void load();
+ void save();
+ void reset();
+ void setTime(unsigned);
+ void follow(int);
+ void newCanvasWidth(int);
+ void configChanged();
+ void songChanged1(int);
+
+ public slots:
+ void setSelection(int, Event&, Part*);
+ void soloChanged(bool); // called by Solo button
+ void execDeliveredScript(int);
+ void execUserScript(int);
+
+ virtual void updateHScrollRange();
+ signals:
+ void deleted(unsigned long);
+
+ public:
+ DrumEdit(PartList*, QWidget* parent = 0, const char* name = 0, unsigned initPos = MAXINT);
+ virtual ~DrumEdit();
+ virtual void readStatus(Xml&);
+ virtual void writeStatus(int, Xml&) const;
+ static void readConfiguration(Xml& xml);
+ static void writeConfiguration(int, Xml&);
+ };
+
+#endif
diff --git a/muse2/muse/midiedit/drummap.cpp b/muse2/muse/midiedit/drummap.cpp
new file mode 100644
index 00000000..46bf2057
--- /dev/null
+++ b/muse2/muse/midiedit/drummap.cpp
@@ -0,0 +1,503 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: drummap.cpp,v 1.3.2.6 2009/10/29 02:14:37 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "audio.h"
+#include "drummap.h"
+#include "xml.h"
+#include "song.h"
+
+char drumOutmap[DRUM_MAPSIZE];
+char drumInmap[128];
+
+DrumMap drumMap[DRUM_MAPSIZE];
+
+//---------------------------------------------------------
+// GM default drum map
+//---------------------------------------------------------
+
+const DrumMap blankdm = { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 127, 127, false };
+
+const DrumMap idrumMap[DRUM_MAPSIZE] = {
+ { QString("Acoustic Bass Drum"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 35, 35, false },
+ { QString("Bass Drum 1"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 36, 36, false },
+ { QString("Side Stick"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 37, 37, false },
+ { QString("Acoustic Snare"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 38, 38, false },
+ { QString("Hand Clap"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 39, 39, false },
+ { QString("Electric Snare"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 40, 40, false },
+ { QString("Low Floor Tom"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 41, 41, false },
+ { QString("Closed Hi-Hat"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 42, 42, false },
+ { QString("High Floor Tom"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 43, 43, false },
+ { QString("Pedal Hi-Hat"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 44, 44, false },
+ { QString("Low Tom"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 45, 45, false },
+ { QString("Open Hi-Hat"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 46, 46, false },
+ { QString("Low-Mid Tom"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 47, 47, false },
+ { QString("Hi-Mid Tom"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 48, 48, false },
+ { QString("Crash Cymbal 1"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 49, 49, false },
+ { QString("High Tom"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 50, 50, false },
+
+ { QString("Ride Cymbal 1"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 51, 51, false },
+ { QString("Chinese Cymbal"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 52, 52, false },
+ { QString("Ride Bell"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 53, 53, false },
+ { QString("Tambourine"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 54, 54, false },
+ { QString("Splash Cymbal"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 55, 55, false },
+ { QString("Cowbell"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 56, 56, false },
+ { QString("Crash Cymbal 2"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 57, 57, false },
+ { QString("Vibraslap"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 58, 58, false },
+ { QString("Ride Cymbal 2"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 59, 59, false },
+ { QString("Hi Bongo"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 60, 60, false },
+ { QString("Low Bongo"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 61, 61, false },
+ { QString("Mute Hi Conga"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 62, 62, false },
+ { QString("Open Hi Conga"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 63, 63, false },
+ { QString("Low Conga"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 64, 64, false },
+ { QString("High Timbale"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 65, 65, false },
+ { QString("Low Timbale"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 66, 66, false },
+
+ { QString("High Agogo"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 67, 67, false },
+ { QString("Low Agogo"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 68, 68, false },
+ { QString("Cabasa"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 69, 69, false },
+ { QString("Maracas"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 70, 70, false },
+ { QString("Short Whistle"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 71, 71, false },
+ { QString("Long Whistle"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 72, 72, false },
+ { QString("Short Guiro"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 73, 73, false },
+ { QString("Long Guiro"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 74, 74, false },
+ { QString("Claves"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 75, 75, false },
+ { QString("Hi Wood Block"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 76, 76, false },
+ { QString("Low Wood Block"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 77, 77, false },
+ { QString("Mute Cuica"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 78, 78, false },
+ { QString("Open Cuica"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 79, 79, false },
+ { QString("Mute Triangle"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 80, 80, false },
+ { QString("Open Triangle"), 100, 16, 32, 9, 0, 70, 90, 127, 110, 81, 81, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 82, 82, false },
+
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 83, 83, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 84, 84, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 85, 85, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 86, 86, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 87, 87, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 88, 88, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 89, 89, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 90, 90, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 91, 91, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 92, 92, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 93, 93, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 94, 94, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 95, 95, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 96, 96, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 97, 97, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 98, 98, false },
+
+ /*
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 83, 83, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 84, 84, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 85, 85, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 86, 86, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 87, 87, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 88, 88, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 89, 89, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 90, 90, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 91, 91, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 92, 92, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 93, 93, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 94, 94, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 95, 95, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 96, 96, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 97, 97, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 98, 98, false },
+
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 83, 83, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 84, 84, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 85, 85, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 86, 86, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 87, 87, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 88, 88, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 89, 89, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 90, 90, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 91, 91, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 92, 92, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 93, 93, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 94, 94, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 95, 95, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 96, 96, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 97, 97, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 98, 98, false },
+
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 83, 83, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 84, 84, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 85, 85, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 86, 86, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 87, 87, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 88, 88, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 89, 89, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 90, 90, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 91, 91, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 92, 92, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 93, 93, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 94, 94, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 95, 95, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 96, 96, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 97, 97, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 98, 98, false },
+
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 83, 83, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 84, 84, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 85, 85, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 86, 86, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 87, 87, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 88, 88, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 89, 89, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 90, 90, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 91, 91, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 92, 92, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 93, 93, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 94, 94, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 95, 95, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 96, 96, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 97, 97, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 98, 98, false }
+ };
+ */
+
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 99, 99, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 100, 100, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 101, 101, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 102, 102, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 103, 103, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 104, 104, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 105, 105, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 106, 106, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 107, 107, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 108, 108, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 109, 109, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 110, 110, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 111, 111, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 112, 112, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 113, 113, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 114, 114, false },
+
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 115, 115, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 116, 116, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 117, 117, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 118, 118, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 119, 119, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 120, 120, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 121, 121, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 122, 122, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 123, 123, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 124, 124, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 125, 125, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 126, 126, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 127, 127, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 0, 0, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 1, 1, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 2, 2, false },
+
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 3, 3, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 4, 4, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 5, 5, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 6, 6, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 7, 7, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 8, 8, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 9, 9, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 10, 10, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 11, 11, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 12, 12, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 13, 13, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 14, 14, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 15, 15, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 16, 16, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 17, 17, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 18, 18, false },
+
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 19, 19, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 20, 20, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 21, 21, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 22, 22, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 23, 23, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 24, 24, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 25, 25, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 26, 26, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 27, 27, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 28, 28, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 29, 29, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 30, 30, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 31, 31, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 32, 32, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 33, 33, false },
+ { QString(""), 100, 16, 32, 9, 0, 70, 90, 127, 110, 34, 34, false }
+ };
+
+
+//---------------------------------------------------------
+// initDrumMap
+// populate Inmap and Outmap
+//---------------------------------------------------------
+
+void initDrumMap()
+ {
+ for (int i = 0; i < DRUM_MAPSIZE; ++i) {
+ DrumMap d = drumMap[i];
+ //Make sure we're not overwriting any values loaded
+ //On init, all these values are zero. If so, just set the drummap entry to the initial drummap entry.
+ if (!(d.vol || d.len || d.channel || d.port || d.lv1 || d.lv2 || d.lv3 || d.lv4 || d.enote || d.anote || d.mute))
+ drumMap[i] = idrumMap[i];
+ }
+ //Finally, setup the inMap, outMap-values
+ memset(drumInmap, 0, sizeof(drumInmap));
+ memset(drumOutmap, 0, sizeof(drumOutmap));
+ for (int i = 0; i < DRUM_MAPSIZE; ++i) {
+ drumInmap[(unsigned int)(drumMap[i].enote)] = i;
+ drumOutmap[(unsigned int)(drumMap[i].anote)] = i;
+ }
+ }
+
+//---------------------------------------------------------
+// resetGMDrumMap
+//---------------------------------------------------------
+
+void resetGMDrumMap()
+ {
+ audio->msgIdle(true);
+ // Delete all port controller events.
+ //audio->msgChangeAllPortDrumCtrlEvents(false);
+ song->changeAllPortDrumCtrlEvents(false);
+
+ for(int i = 0; i < DRUM_MAPSIZE; ++i)
+ drumMap[i] = idrumMap[i];
+ memset(drumInmap, 0, sizeof(drumInmap));
+ memset(drumOutmap, 0, sizeof(drumOutmap));
+ for (int i = 0; i < DRUM_MAPSIZE; ++i) {
+ drumInmap[(unsigned int)(drumMap[i].enote)] = i;
+ drumOutmap[(unsigned int)(drumMap[i].anote)] = i;
+ }
+ // Add all port controller events.
+ //audio->msgChangeAllPortDrumCtrlEvents(true);
+ song->changeAllPortDrumCtrlEvents(true);
+ audio->msgIdle(false);
+ }
+
+//---------------------------------------------------------
+// operator ==
+//---------------------------------------------------------
+
+//bool const DrumMap::operator==(const DrumMap& map) const
+bool DrumMap::operator==(const DrumMap& map) const
+ {
+ return
+ (name == map.name)
+ && vol == map.vol
+ && quant == map.quant
+ && len == map.len
+ && channel == map.channel
+ && port == map.port
+ && lv1 == map.lv1
+ && lv2 == map.lv2
+ && lv3 == map.lv3
+ && lv4 == map.lv4
+ && enote == map.enote
+ && anote == map.anote
+ && mute == map.mute;
+ }
+
+//---------------------------------------------------------
+// writeDrumMap
+//---------------------------------------------------------
+
+void writeDrumMap(int level, Xml& xml, bool external)
+ {
+ xml.tag(level++, "drummap");
+ for (int i = 0; i < DRUM_MAPSIZE; ++i) {
+ DrumMap* dm = &drumMap[i];
+ const DrumMap* idm = &idrumMap[i];
+
+ if (external) {
+ xml.tag(level++, "entry");
+ xml.strTag(level, "name", dm->name);
+ xml.intTag(level, "vol", dm->vol);
+ xml.intTag(level, "quant", dm->quant);
+ xml.intTag(level, "len", dm->len);
+ xml.intTag(level, "channel", dm->channel);
+ xml.intTag(level, "port", dm->port);
+ xml.intTag(level, "lv1", dm->lv1);
+ xml.intTag(level, "lv2", dm->lv2);
+ xml.intTag(level, "lv3", dm->lv3);
+ xml.intTag(level, "lv4", dm->lv4);
+ xml.intTag(level, "enote", dm->enote);
+ xml.intTag(level, "anote", dm->anote);
+ }
+ else {
+ // write only, if entry is different from initial entry
+ if (!external && *dm == *idm)
+ continue;
+ xml.tag(level++, "entry idx=\"%d\"", i);
+ if (dm->name != idm->name)
+ xml.strTag(level, "name", dm->name);
+ if (dm->vol != idm->vol)
+ xml.intTag(level, "vol", dm->vol);
+ if (dm->quant != idm->quant)
+ xml.intTag(level, "quant", dm->quant);
+ if (dm->len != idm->len)
+ xml.intTag(level, "len", dm->len);
+ if (dm->channel != idm->channel)
+ xml.intTag(level, "channel", dm->channel);
+ if (dm->port != idm->port)
+ xml.intTag(level, "port", dm->port);
+ if (dm->lv1 != idm->lv1)
+ xml.intTag(level, "lv1", dm->lv1);
+ if (dm->lv2 != idm->lv2)
+ xml.intTag(level, "lv2", dm->lv2);
+ if (dm->lv3 != idm->lv3)
+ xml.intTag(level, "lv3", dm->lv3);
+ if (dm->lv4 != idm->lv4)
+ xml.intTag(level, "lv4", dm->lv4);
+ if (dm->enote != idm->enote)
+ xml.intTag(level, "enote", dm->enote);
+ if (dm->anote != idm->anote)
+ xml.intTag(level, "anote", dm->anote);
+ if (dm->mute != idm->mute)
+ xml.intTag(level, "mute", dm->mute);
+ }
+ xml.tag(level--, "/entry");
+ }
+ xml.tag(level--, "/drummap");
+ }
+
+//---------------------------------------------------------
+// readDrummapEntry
+//---------------------------------------------------------
+
+static void readDrummapEntry(Xml& xml, DrumMap* dm)
+ {
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "name")
+ dm->name = xml.parse(QString("name"));
+ else if (tag == "vol")
+ dm->vol = (unsigned char)xml.parseInt();
+ else if (tag == "quant")
+ dm->quant = xml.parseInt();
+ else if (tag == "len")
+ dm->len = xml.parseInt();
+ else if (tag == "channel")
+ dm->channel = xml.parseInt();
+ else if (tag == "port")
+ dm->port = xml.parseInt();
+ else if (tag == "lv1")
+ dm->lv1 = xml.parseInt();
+ else if (tag == "lv2")
+ dm->lv2 = xml.parseInt();
+ else if (tag == "lv3")
+ dm->lv3 = xml.parseInt();
+ else if (tag == "lv4")
+ dm->lv4 = xml.parseInt();
+ else if (tag == "enote")
+ dm->enote = xml.parseInt();
+ else if (tag == "anote")
+ dm->anote = xml.parseInt();
+ else if (tag == "mute")
+ dm->mute = xml.parseInt();
+ else if (tag == "selected")
+ //; // dm->selected = xml.parseInt();
+ xml.skip(tag);
+ else
+ xml.unknown("DrumMapEntry");
+ break;
+ case Xml::Attribut:
+ if (tag == "idx") {
+ int idx = xml.s2().toInt() & 0x7f;
+ dm = &drumMap[idx];
+
+ }
+ break;
+ case Xml::TagEnd:
+ if (tag == "entry")
+ {
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// readDrummap
+//---------------------------------------------------------
+
+void readDrumMap(Xml& xml, bool external)
+ {
+ audio->msgIdle(true);
+ // Delete all port controller events.
+ //audio->msgChangeAllPortDrumCtrlEvents(false);
+ song->changeAllPortDrumCtrlEvents(false);
+
+ if (external) {
+ for (int i = 0; i < DRUM_MAPSIZE; ++i)
+ drumMap[i] = blankdm;
+ }
+ else {
+ for (int i = 0; i < DRUM_MAPSIZE; ++i)
+ drumMap[i] = idrumMap[i];
+ }
+ int i = 0;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ audio->msgIdle(false);
+ return;
+ case Xml::TagStart:
+ if (tag == "entry") {
+ if(i >= DRUM_MAPSIZE)
+ {
+ audio->msgIdle(false);
+ return;
+ }
+ readDrummapEntry(xml, external ? &drumMap[i] : 0);
+ ++i;
+ }
+ else if (tag == "comment")
+ xml.parse();
+ else
+ xml.unknown("DrumMap");
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if (tag == "drummap") {
+ memset(drumInmap, 0, sizeof(drumInmap));
+ memset(drumOutmap, 0, sizeof(drumOutmap));
+ for (int i = 0; i < DRUM_MAPSIZE; ++i) {
+ drumInmap[(unsigned int)(drumMap[i].enote)] = i;
+ drumOutmap[(unsigned int)(drumMap[i].anote)] = i;
+ }
+ // Add all port controller events.
+ //audio->msgChangeAllPortDrumCtrlEvents(true);
+ song->changeAllPortDrumCtrlEvents(true);
+
+ audio->msgIdle(false);
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ // Add all port controller events.
+ //audio->msgChangeAllPortDrumCtrlEvents(true);
+ song->changeAllPortDrumCtrlEvents(true);
+ audio->msgIdle(false);
+ }
+
diff --git a/muse2/muse/midiedit/drummap.h b/muse2/muse/midiedit/drummap.h
new file mode 100644
index 00000000..dfe67254
--- /dev/null
+++ b/muse2/muse/midiedit/drummap.h
@@ -0,0 +1,47 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: drummap.h,v 1.3.2.3 2009/10/29 02:14:37 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __DRUMMAP_H__
+#define __DRUMMAP_H__
+
+#include <qstring.h>
+
+class Xml;
+
+//---------------------------------------------------------
+// DrumMap
+//---------------------------------------------------------
+
+struct DrumMap {
+ QString name;
+ unsigned char vol; // playback volume, percent.
+ int quant;
+ int len; // len of event in ticks
+ int channel; // midi channel
+ int port; // midi port
+ char lv1, lv2, lv3, lv4; // velocities
+ char enote, anote; // input note - output note
+ bool mute;
+// bool selected;
+
+ //bool const operator==(const DrumMap& map) const;
+ bool operator==(const DrumMap& map) const;
+ };
+
+#define DRUM_MAPSIZE 128
+
+extern char drumOutmap[DRUM_MAPSIZE];
+extern char drumInmap[DRUM_MAPSIZE];
+extern DrumMap drumMap[DRUM_MAPSIZE];
+extern void initDrumMap();
+extern void writeDrumMap(int level, Xml& xml, bool external);
+extern void readDrumMap(Xml& xml, bool external);
+extern void resetGMDrumMap();
+
+#endif
+
diff --git a/muse2/muse/midiedit/ecanvas.cpp b/muse2/muse/midiedit/ecanvas.cpp
new file mode 100644
index 00000000..7fc7002d
--- /dev/null
+++ b/muse2/muse/midiedit/ecanvas.cpp
@@ -0,0 +1,363 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ecanvas.cpp,v 1.8.2.6 2009/05/03 04:14:00 terminator356 Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <values.h>
+
+#include "midieditor.h"
+#include "ecanvas.h"
+#include "song.h"
+#include "event.h"
+#include "shortcuts.h"
+//Added by qt3to4:
+#include <QKeyEvent>
+#include <QEvent>
+
+//---------------------------------------------------------
+// EventCanvas
+//---------------------------------------------------------
+
+EventCanvas::EventCanvas(MidiEditor* pr, QWidget* parent, int sx,
+ int sy, const char* name)
+ : Canvas(parent, sx, sy, name)
+ {
+ editor = pr;
+ _steprec = false;
+ _midiin = false;
+ _playEvents = false;
+ curVelo = 70;
+
+ setBg(Qt::white);
+ setAcceptDrops(true);
+ setFocusPolicy(Qt::StrongFocus);
+ setMouseTracking(true);
+
+ curPart = (MidiPart*)(editor->parts()->begin()->second);
+ curPartId = curPart->sn();
+ }
+
+//---------------------------------------------------------
+// getCaption
+//---------------------------------------------------------
+
+QString EventCanvas::getCaption() const
+ {
+ int bar1, bar2, xx;
+ unsigned x;
+ sigmap.tickValues(curPart->tick(), &bar1, &xx, &x);
+ sigmap.tickValues(curPart->tick() + curPart->lenTick(), &bar2, &xx, &x);
+
+ return QString("MusE: Part <") + curPart->name()
+ + QString("> %1-%2").arg(bar1+1).arg(bar2+1);
+ }
+
+//---------------------------------------------------------
+// leaveEvent
+//---------------------------------------------------------
+
+void EventCanvas::leaveEvent(QEvent*)
+ {
+ emit pitchChanged(-1);
+ emit timeChanged(MAXINT);
+ }
+
+//---------------------------------------------------------
+// enterEvent
+//---------------------------------------------------------
+
+void EventCanvas::enterEvent(QEvent*)
+ {
+ emit enterCanvas();
+ }
+
+//---------------------------------------------------------
+// raster
+//---------------------------------------------------------
+
+QPoint EventCanvas::raster(const QPoint& p) const
+ {
+ int x = p.x();
+ if (x < 0)
+ x = 0;
+ x = editor->rasterVal(x);
+ int pitch = y2pitch(p.y());
+ int y = pitch2y(pitch);
+ return QPoint(x, y);
+ }
+
+//---------------------------------------------------------
+// startUndo
+//---------------------------------------------------------
+
+void EventCanvas::startUndo(DragType)
+ {
+ song->startUndo();
+ }
+
+//---------------------------------------------------------
+// endUndo
+//---------------------------------------------------------
+
+void EventCanvas::endUndo(DragType dtype, int flags)
+ {
+ song->endUndo(flags | ((dtype == MOVE_COPY || dtype == MOVE_CLONE)
+ ? SC_EVENT_INSERTED : SC_EVENT_MODIFIED));
+ }
+
+//---------------------------------------------------------
+// mouseMove
+//---------------------------------------------------------
+
+void EventCanvas::mouseMove(const QPoint& pos)
+ {
+ emit pitchChanged(y2pitch(pos.y()));
+ int x = pos.x();
+ emit timeChanged(editor->rasterVal(x));
+ }
+
+//---------------------------------------------------------
+// updateSelection
+//---------------------------------------------------------
+
+void EventCanvas::updateSelection()
+ {
+ song->update(SC_SELECTION);
+ }
+
+//---------------------------------------------------------
+// songChanged(type)
+//---------------------------------------------------------
+
+void EventCanvas::songChanged(int flags)
+ {
+ // Is it simply a midi controller value adjustment? Forget it.
+ if(flags == SC_MIDI_CONTROLLER)
+ return;
+
+ if (flags & ~SC_SELECTION) {
+ items.clear();
+ start_tick = MAXINT;
+ end_tick = 0;
+ curPart = 0;
+ for (iPart p = editor->parts()->begin(); p != editor->parts()->end(); ++p) {
+ MidiPart* part = (MidiPart*)(p->second);
+ if (part->sn() == curPartId)
+ curPart = part;
+ unsigned stick = part->tick();
+ unsigned len = part->lenTick();
+ unsigned etick = stick + len;
+ if (stick < start_tick)
+ start_tick = stick;
+ if (etick > end_tick)
+ end_tick = etick;
+
+ EventList* el = part->events();
+ for (iEvent i = el->begin(); i != el->end(); ++i) {
+ Event e = i->second;
+ // Added by T356. Do not add events which are either past, or extend past the end of the part.
+ //if(e.tick() > len)
+ if(e.endTick() > len)
+ break;
+
+ if (e.isNote()) {
+ addItem(part, e);
+ }
+ }
+ }
+ }
+
+ Event event;
+ MidiPart* part = 0;
+ int x = 0;
+ CItem* nevent = 0;
+
+ int n = 0; // count selections
+ for (iCItem k = items.begin(); k != items.end(); ++k) {
+ Event ev = k->second->event();
+ bool selected = ev.selected();
+ if (selected) {
+ k->second->setSelected(true);
+ ++n;
+ if (!nevent) {
+ nevent = k->second;
+ Event mi = nevent->event();
+ curVelo = mi.velo();
+ }
+ }
+ }
+ start_tick = song->roundDownBar(start_tick);
+ end_tick = song->roundUpBar(end_tick);
+
+ if (n == 1) {
+ x = nevent->x();
+ event = nevent->event();
+ part = (MidiPart*)nevent->part();
+ if (curPart != part) {
+ curPart = part;
+ curPartId = curPart->sn();
+ curPartChanged();
+ }
+ }
+ emit selectionChanged(x, event, part);
+ if (curPart == 0)
+ curPart = (MidiPart*)(editor->parts()->begin()->second);
+ redraw();
+ }
+
+//---------------------------------------------------------
+// selectAtTick
+//---------------------------------------------------------
+void EventCanvas::selectAtTick(unsigned int tick)
+ {
+ //Select note nearest tick, if none selected and there are any
+ if (!items.empty() && selectionSize() == 0) {
+ iCItem i = items.begin();
+ CItem* nearest = i->second;
+
+ while (i != items.end()) {
+ CItem* cur=i->second;
+ unsigned int curtk=abs(cur->x() + cur->part()->tick() - tick);
+ unsigned int neartk=abs(nearest->x() + nearest->part()->tick() - tick);
+
+ if (curtk < neartk) {
+ nearest=cur;
+ }
+
+ i++;
+ }
+
+ if (!nearest->isSelected()) {
+ selectItem(nearest, true);
+ songChanged(SC_SELECTION);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// track
+//---------------------------------------------------------
+
+MidiTrack* EventCanvas::track() const
+ {
+ return ((MidiPart*)curPart)->track();
+ }
+
+
+//---------------------------------------------------------
+// keyPress
+//---------------------------------------------------------
+
+void EventCanvas::keyPress(QKeyEvent* event)
+ {
+ int key = event->key();
+ if (event->state() & Qt::ShiftButton)
+ key += Qt::SHIFT;
+ if (event->state() & Qt::AltButton)
+ key += Qt::ALT;
+ if (event->state() & Qt::ControlButton)
+ key+= Qt::CTRL;
+
+ //
+ // Shortcut for DrumEditor & PianoRoll
+ // Sets locators to selected events
+ //
+ if (key == shortcuts[SHRT_LOCATORS_TO_SELECTION].key) {
+ int tick_max = 0;
+ int tick_min = INT_MAX;
+ bool found = false;
+
+ for (iCItem i= items.begin(); i != items.end(); i++) {
+ if (!i->second->isSelected())
+ continue;
+
+ int tick = i->second->x();
+ int len = i->second->event().lenTick();
+ found = true;
+ if (tick + len > tick_max)
+ tick_max = tick + len;
+ if (tick < tick_min)
+ tick_min = tick;
+ }
+ if (found) {
+ Pos p1(tick_min, true);
+ Pos p2(tick_max, true);
+ song->setPos(1, p1);
+ song->setPos(2, p2);
+ }
+ }
+ // Select items by key (PianoRoll & DrumEditor)
+ else if (key == shortcuts[SHRT_SEL_RIGHT].key || key == shortcuts[SHRT_SEL_RIGHT_ADD].key) {
+ iCItem i, iRightmost;
+ CItem* rightmost = NULL;
+ //Get the rightmost selected note (if any)
+ for (i = items.begin(); i != items.end(); ++i) {
+ if (i->second->isSelected()) {
+ iRightmost = i; rightmost = i->second;
+ }
+ }
+ if (rightmost) {
+ iCItem temp = iRightmost; temp++;
+ //If so, deselect current note and select the one to the right
+ if (temp != items.end()) {
+ if (key != shortcuts[SHRT_SEL_RIGHT_ADD].key)
+ deselectAll();
+
+ iRightmost++;
+ iRightmost->second->setSelected(true);
+ updateSelection();
+ }
+ }
+ }
+ //Select items by key: (PianoRoll & DrumEditor)
+ else if (key == shortcuts[SHRT_SEL_LEFT].key || key == shortcuts[SHRT_SEL_LEFT_ADD].key) {
+ iCItem i, iLeftmost;
+ CItem* leftmost = NULL;
+ if (items.size() > 0 ) {
+ for (i = items.end(), i--; i != items.begin(); i--) {
+ if (i->second->isSelected()) {
+ iLeftmost = i; leftmost = i->second;
+ }
+ }
+ if (leftmost) {
+ if (iLeftmost != items.begin()) {
+ //Add item
+ if (key != shortcuts[SHRT_SEL_LEFT_ADD].key)
+ deselectAll();
+
+ iLeftmost--;
+ iLeftmost->second->setSelected(true);
+ updateSelection();
+ }
+ }
+ }
+ }
+ else if (key == shortcuts[SHRT_INC_PITCH].key) {
+ modifySelected(NoteInfo::VAL_PITCH, 1);
+ }
+ else if (key == shortcuts[SHRT_DEC_PITCH].key) {
+ modifySelected(NoteInfo::VAL_PITCH, -1);
+ }
+ else if (key == shortcuts[SHRT_INC_POS].key) {
+ // TODO: Check boundaries
+ modifySelected(NoteInfo::VAL_TIME, editor->raster());
+ }
+ else if (key == shortcuts[SHRT_DEC_POS].key) {
+ // TODO: Check boundaries
+ modifySelected(NoteInfo::VAL_TIME, 0 - editor->raster());
+ }
+
+ else if (key == shortcuts[SHRT_INCREASE_LEN].key) {
+ // TODO: Check boundaries
+ modifySelected(NoteInfo::VAL_LEN, editor->raster());
+ }
+ else if (key == shortcuts[SHRT_DECREASE_LEN].key) {
+ // TODO: Check boundaries
+ modifySelected(NoteInfo::VAL_LEN, 0 - editor->raster());
+ }
+
+ else
+ event->ignore();
+ }
diff --git a/muse2/muse/midiedit/ecanvas.h b/muse2/muse/midiedit/ecanvas.h
new file mode 100644
index 00000000..58df80b5
--- /dev/null
+++ b/muse2/muse/midiedit/ecanvas.h
@@ -0,0 +1,87 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ecanvas.h,v 1.5.2.4 2009/02/02 21:38:00 terminator356 Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __ECANVAS_H__
+#define __ECANVAS_H__
+
+#include "canvas.h"
+#include "noteinfo.h"
+//Added by qt3to4:
+#include <QEvent>
+#include <QKeyEvent>
+
+class MidiPart;
+class MidiTrack;
+class MidiEditor;
+class Part;
+
+struct PartToChange
+{
+ Part* npart;
+ int xdiff;
+};
+typedef std::map<Part*, PartToChange> PartsToChangeMap;
+typedef std::map<Part*, PartToChange>::iterator iPartToChange;
+
+//---------------------------------------------------------
+// EventCanvas
+//---------------------------------------------------------
+
+class EventCanvas : public Canvas {
+ Q_OBJECT
+ virtual void leaveEvent(QEvent*e);
+ virtual void enterEvent(QEvent*e);
+ // Removed by T356.
+ //virtual QPoint raster(const QPoint&) const;
+
+ virtual void startUndo(DragType);
+
+ virtual void endUndo(DragType, int flags = 0);
+ virtual void mouseMove(const QPoint&);
+
+ protected:
+ bool _playEvents;
+ MidiEditor* editor;
+ unsigned start_tick, end_tick;
+ int curVelo;
+ bool _steprec;
+ bool _midiin;
+
+ void updateSelection();
+ virtual void addItem(Part*, Event&) = 0;
+ // Added by T356.
+ virtual QPoint raster(const QPoint&) const;
+
+ public slots:
+ void redrawGrid() { redraw(); }
+ void setSteprec(bool f) { _steprec = f; }
+ void setMidiin(bool f) { _midiin = f; }
+
+ signals:
+ void pitchChanged(int); // current cursor position
+ void timeChanged(unsigned);
+ void selectionChanged(int, Event&, Part*);
+ void enterCanvas();
+
+ public:
+ EventCanvas(MidiEditor*, QWidget*, int, int, const char* name = 0);
+ MidiTrack* track() const;
+ unsigned start() const { return start_tick; }
+ unsigned end() const { return end_tick; }
+ bool midiin() const { return _midiin; }
+ bool steprec() const { return _steprec; }
+ QString getCaption() const;
+ void songChanged(int);
+ void range(int* s, int* e) const { *s = start_tick; *e = end_tick; }
+ void playEvents(bool flag) { _playEvents = flag; }
+ void selectAtTick(unsigned int tick);
+ virtual void modifySelected(NoteInfo::ValType, int) {}
+ virtual void keyPress(QKeyEvent*);
+ };
+
+#endif
+
diff --git a/muse2/muse/midiedit/piano.cpp b/muse2/muse/midiedit/piano.cpp
new file mode 100644
index 00000000..ed7ac9f5
--- /dev/null
+++ b/muse2/muse/midiedit/piano.cpp
@@ -0,0 +1,557 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: piano.cpp,v 1.3 2004/05/31 11:48:55 lunar_shuttle Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qpainter.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <QEvent>
+#include <QMouseEvent>
+
+#include <stdio.h>
+
+#include "piano.h"
+
+static const char *oct_xpm[] = {
+// w h colors
+ "40 91 2 1",
+ ". c #c0c0c0",
+ "# c #000000",
+ // x
+ "####################################### ",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#", // 10
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#", //------------------------
+ "#######################................#",
+ "########################...............#",
+ "########################...............#",
+ "####################################### ", // 7
+ "########################...............#",
+ "########################...............#",
+ "#######################................#", //------------------------
+ ".......................................#",
+ ".......................................#",
+ ".......................................#", // 6
+ ".......................................#",
+ ".......................................#",
+ ".......................................#", //------------------------
+ "#######################................#",
+ "########################...............#",
+ "########################...............#", // 7
+ "####################################### ",
+ "########################...............#",
+ "########################...............#",
+ "#######################................#", //------------------------
+ ".......................................#",
+ ".......................................#",
+ ".......................................#", // 6
+ ".......................................#",
+ ".......................................#",
+ ".......................................#", //------------------------
+ "#######################................#",
+ "########################...............#",
+ "########################...............#", // 7
+ "####################################### ",
+ "########################...............#",
+ "########################...............#",
+ "#######################................#", //------------------------
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#", // 10
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ "####################################### ", //----------------------
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#", // 9
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#", //------------------------
+ "#######################................#",
+ "########################...............#",
+ "########################...............#",
+ "####################################### ", // 7
+ "########################...............#",
+ "########################...............#",
+ "#######################................#", //------------------------
+ ".......................................#",
+ ".......................................#",
+ ".......................................#", // 6
+ ".......................................#",
+ ".......................................#",
+ ".......................................#", //--------------------------
+ "#######################................#",
+ "########################...............#",
+ "########################...............#", // 7
+ "####################################### ",
+ "########################...............#",
+ "########################...............#",
+ "#######################................#", //------------------------
+ ".......................................#",
+ "..........................###..........#",
+ ".........................#...#.........#",
+ ".........................#.............#",
+ ".........................#.............#",
+ ".........................#...#.........#", // 10
+ "..........................###..........#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ };
+
+static const char *mk1_xpmC1[] = {
+ "40 10 2 1",
+ ". c #c0c0c0",
+ "# c #000000",
+ ".......................................#",
+ "..........................###.....#....#",
+ ".........................#...#...##....#",
+ ".........................#........#....#",
+ ".........................#........#....#",
+ ".........................#...#....#....#", // 10
+ "..........................###....###...#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ };
+static const char *mk1_xpmC2[] = {
+ "40 10 2 1",
+ ". c #c0c0c0",
+ "# c #000000",
+ ".......................................#",
+ "..........................###....##....#",
+ ".........................#...#..#..#...#",
+ ".........................#........#....#",
+ ".........................#.......#.....#",
+ ".........................#...#..#......#", // 10
+ "..........................###...####...#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ };
+static const char *mk1_xpmC3[] = {
+ "40 10 2 1",
+ ". c #c0c0c0",
+ "# c #000000",
+ ".......................................#",
+ "..........................###....##....#",
+ ".........................#...#..#..#...#",
+ ".........................#........#....#",
+ ".........................#.........#...#",
+ ".........................#...#..#..#...#", // 10
+ "..........................###....##....#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ };
+static const char *mk1_xpmC4[] = {
+ "40 10 2 1",
+ ". c #c0c0c0",
+ "# c #000000",
+ ".......................................#",
+ "..........................###...#..#...#",
+ ".........................#...#..#..#...#",
+ ".........................#......####...#",
+ ".........................#.........#...#",
+ ".........................#...#.....#...#", // 10
+ "..........................###......#...#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ };
+static const char *mk1_xpmC5[] = {
+ "40 10 2 1",
+ ". c #c0c0c0",
+ "# c #000000",
+ ".......................................#",
+ "..........................###...####...#",
+ ".........................#...#..#......#",
+ ".........................#......###....#",
+ ".........................#.........#...#",
+ ".........................#...#.....#...#", // 10
+ "..........................###...###....#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ };
+
+static const char *mk1_xpmC6[] = {
+ "40 10 2 1",
+ ". c #c0c0c0",
+ "# c #000000",
+ ".......................................#",
+ "..........................###....###...#",
+ ".........................#...#..#......#",
+ ".........................#......###....#",
+ ".........................#......#..#...#",
+ ".........................#...#..#..#...#", // 10
+ "..........................###...###....#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ };
+
+static const char *mk1_xpmC7[] = {
+ "40 10 2 1",
+ ". c #c0c0c0",
+ "# c #000000",
+ ".......................................#",
+ "..........................###...####...#",
+ ".........................#...#.....#...#",
+ ".........................#........#....#",
+ ".........................#.......#.....#",
+ ".........................#...#..#......#", // 10
+ "..........................###...#......#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ };
+static const char *mk1_xpmC8[] = {
+ "40 10 2 1",
+ ". c #c0c0c0",
+ "# c #000000",
+ ".......................................#",
+ "..........................###....##....#",
+ ".........................#...#..#..#....#",
+ ".........................#.......##....#",
+ ".........................#......#..#...#",
+ ".........................#...#..#..#...#", // 10
+ "..........................###....##....#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ };
+
+static const char *mk1_xpm[] = {
+ "40 13 2 1",
+ ". c #ff0000",
+ "# c none",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ "#######################................#",
+ "########################...............#",
+ "########################...............#",
+ "####################################### ",
+ };
+
+static const char *mk2_xpm[] = {
+ "40 13 2 1",
+ ". c #ff0000",
+ "# c none",
+ "########################...............#",
+ "########################...............#",
+ "#######################................#", //------------------------
+ ".......................................#",
+ ".......................................#",
+ ".......................................#", // 6
+ ".......................................#",
+ ".......................................#",
+ ".......................................#", //--------------------------
+ "#######################................#",
+ "########################...............#",
+ "########################...............#", // 7
+ "####################################### ",
+ };
+
+static const char *mk3_xpm[] = {
+ "40 13 2 1",
+ ". c #ff0000",
+ "# c none",
+ "########################...............#",
+ "########################...............#",
+ "#######################................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ ".......................................#",
+ "########################################",
+ };
+
+static const char *mk4_xpm[] = {
+ "40 13 2 1",
+ "# c #ff0000",
+ ". c none",
+ "........................................",
+ "........................................",
+ "........................................",
+ "#######################.................",
+ "########################................",
+ "########################................",
+ "########################................",
+ "########################................",
+ "########################................",
+ "#######################.................",
+ "........................................",
+ "........................................",
+ "........................................",
+ };
+/*
+ 0 1 2 3 4 5 6 7 8 9 10
+ c-2 c-1 C0 C1 C2 C3 C4 C5 C6 C7 C8 - G8
+
+ Grid über Oktave:
+
+ +------------+ ------------------------------
+ 11 | |
+ | h | 7
+ +------+ |
+ 10 | a# +-----+ ..............................
+ +------+ a |
+ 9 | | 6
+ +------+ |
+ 8 | g# +-----+ ..............................
+ +------+ g |
+ 7 | | 5
+ +------+ |
+ 6 | f# +-----+ ..............................
+ +------+ f |
+ 5 | | 4
+ | |
+ +------------+ ------------------------------
+ 4 | |
+ | e | 3
+ +------+ |
+ 3 | d# +-----+ ..............................
+ +------+ d |
+ 2 | | 2
+ +------+ |
+ 1 | c# +-----+ ..............................
+ +------+ c |
+ | | 1
+ 0 | |
+ +------------+ ------------------------------
+ */
+
+//---------------------------------------------------------
+// Piano
+//---------------------------------------------------------
+
+Piano::Piano(QWidget* parent, int ymag)
+ : View(parent, 1, ymag)
+ {
+ setMouseTracking(true);
+ curPitch = -1;
+ octave = new QPixmap(oct_xpm);
+ c_keys[0] = new QPixmap(mk1_xpmC8);
+ c_keys[1] = new QPixmap(mk1_xpmC7);
+ c_keys[2] = new QPixmap(mk1_xpmC6);
+ c_keys[3] = new QPixmap(mk1_xpmC5);
+ c_keys[4] = new QPixmap(mk1_xpmC4);
+ c_keys[5] = new QPixmap(mk1_xpmC3);
+ c_keys[6] = new QPixmap(mk1_xpmC2);
+ c_keys[7] = new QPixmap(mk1_xpmC1);
+
+ mk1 = new QPixmap(mk1_xpm);
+ mk2 = new QPixmap(mk2_xpm);
+ mk3 = new QPixmap(mk3_xpm);
+ mk4 = new QPixmap(mk4_xpm);
+ keyDown = -1;
+ button = Qt::NoButton;
+ }
+
+//---------------------------------------------------------
+// draw
+//---------------------------------------------------------
+
+void Piano::draw(QPainter& p, const QRect& r)
+ {
+ QPoint offset(0, KH*2);
+ p.drawTiledPixmap(r, *octave, r.topLeft()+offset);
+
+ // draw C notes
+ for (int drawKey = 0; drawKey < 8;drawKey++) {
+ int octaveSize=91;
+
+ int drawY = octaveSize * drawKey + 81 - KH*2;
+ if (drawY > r.y() && drawY < r.y() + r.height()) {
+ //printf("drawing c %d at %d r.y %d r.x %d\n",drawKey, drawY, r.y(), r.x());
+ p.drawPixmap(0,drawY,*c_keys[drawKey]);
+ }
+ }
+ //p.drawTiledPixmap(r, *c1, r.topLeft()+offset + coffset);
+ //printf("drawText KH %d %d, x %d y %d\n",KH, curPitch, r.x(), r.y());
+ //p.drawText(r,Qt::AlignAuto,"A");
+ if (curPitch == -1)
+ return;
+ int y = pitch2y(curPitch);
+ QPixmap* pm;
+ switch(curPitch % 12) {
+ case 0:
+ case 5:
+ pm = mk3;
+ break;
+ case 2:
+ case 7:
+ case 9:
+ pm = mk2;
+ break;
+ case 4:
+ case 11:
+ pm = mk1;
+ break;
+ default:
+ pm = mk4;
+ break;
+ }
+ p.drawPixmap(0, y, *pm);
+ }
+
+//---------------------------------------------------------
+// pitch2y
+//---------------------------------------------------------
+
+int Piano::pitch2y(int pitch) const
+ {
+ int tt[] = {
+ 12, 19, 25, 32, 38, 51, 58, 64, 71, 77, 84, 90
+ };
+ int y = (75 * KH) - (tt[pitch%12] + (7 * KH) * (pitch/12));
+ if (y < 0)
+ y = 0;
+ return y;
+ }
+
+//---------------------------------------------------------
+// y2pitch
+//---------------------------------------------------------
+
+int Piano::y2pitch(int y) const
+ {
+ const int total = (10 * 7 + 5) * KH; // 75 Ganztonschritte
+ y = total - y;
+ int oct = (y / (7 * KH)) * 12;
+ char kt[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2,
+ 3, 3, 3, 3, 3, 3, 3,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 6, 6, 6, 6, 6, 6, 6,
+ 7, 7, 7, 7, 7, 7,
+ 8, 8, 8, 8, 8, 8, 8,
+ 9, 9, 9, 9, 9, 9,
+ 10, 10, 10, 10, 10, 10, 10,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11
+ };
+ return kt[y % 91] + oct;
+ }
+
+//---------------------------------------------------------
+// leaveEvent
+//---------------------------------------------------------
+
+void Piano::leaveEvent(QEvent*)
+ {
+ if (keyDown != -1) {
+ emit keyReleased(keyDown, shift);
+ keyDown = -1;
+ }
+ emit pitchChanged(-1);
+ setPitch(-1);
+ }
+
+//---------------------------------------------------------
+// setPitch
+//---------------------------------------------------------
+
+void Piano::setPitch(int pitch)
+ {
+ if (curPitch == pitch)
+ return;
+ curPitch = pitch;
+ redraw();
+ }
+
+//---------------------------------------------------------
+// viewMouseMoveEvent
+//---------------------------------------------------------
+
+void Piano::viewMouseMoveEvent(QMouseEvent* event)
+ {
+ int pitch = y2pitch(event->y());
+ emit pitchChanged(pitch);
+ setPitch(pitch);
+
+ if (button != Qt::NoButton) {
+ int nk = y2pitch(event->y());
+ if (nk < 0 || nk > 127)
+ nk = -1;
+ if (nk != keyDown) {
+ if (keyDown != -1) {
+ emit keyReleased(keyDown, shift);
+ }
+ keyDown = nk;
+ if (keyDown != -1) {
+ int velocity = event->x()*127/40;
+ //emit keyPressed(keyDown, shift);
+ emit keyPressed(keyDown, velocity>127 ? 127 : velocity, shift);
+ }
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// viewMousePressEvent
+//---------------------------------------------------------
+
+void Piano::viewMousePressEvent(QMouseEvent* event)
+ {
+ button = event->button();
+ shift = event->state() & Qt::ShiftButton;
+ if (keyDown != -1) {
+ emit keyReleased(keyDown, shift);
+ keyDown = -1;
+ }
+ keyDown = y2pitch(event->y());
+ if (keyDown < 0 || keyDown > 127) {
+ keyDown = -1;
+ }
+ else {
+ int velocity = event->x()*127/40;
+ emit keyPressed(keyDown, velocity>127 ? 127 : velocity, shift); //emit keyPressed(keyDown, shift);
+ }
+ }
+
+//---------------------------------------------------------
+// viewMouseReleaseEvent
+//---------------------------------------------------------
+
+void Piano::viewMouseReleaseEvent(QMouseEvent* event)
+ {
+ button = Qt::NoButton;
+ shift = event->state() & Qt::ShiftButton;
+ if (keyDown != -1) {
+ emit keyReleased(keyDown, shift);
+ keyDown = -1;
+ }
+ }
+
diff --git a/muse2/muse/midiedit/piano.h b/muse2/muse/midiedit/piano.h
new file mode 100644
index 00000000..2f06b810
--- /dev/null
+++ b/muse2/muse/midiedit/piano.h
@@ -0,0 +1,63 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: piano.h,v 1.2 2004/05/31 11:48:55 lunar_shuttle Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __PIANO_H__
+#define __PIANO_H__
+
+#include "view.h"
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QEvent>
+#include <QPixmap>
+
+class QPainter;
+
+#define KH 13
+
+//---------------------------------------------------------
+// Piano
+//---------------------------------------------------------
+
+class Piano : public View
+ {
+ int curPitch;
+ QPixmap* octave;
+ QPixmap* c_keys[10];
+ QPixmap* mk1;
+ QPixmap* mk2;
+ QPixmap* mk3;
+ QPixmap* mk4;
+ int keyDown;
+ bool shift;
+ int button;
+
+ Q_OBJECT
+ int y2pitch(int) const;
+ int pitch2y(int) const;
+ void viewMouseMoveEvent(QMouseEvent* event);
+ virtual void leaveEvent(QEvent*e);
+
+ virtual void viewMousePressEvent(QMouseEvent* event);
+ virtual void viewMouseReleaseEvent(QMouseEvent*);
+
+ protected:
+ virtual void draw(QPainter&, const QRect&);
+
+ signals:
+ void pitchChanged(int);
+ void keyPressed(int, int, bool);
+ void keyReleased(int, bool);
+
+ public slots:
+ void setPitch(int);
+
+ public:
+ Piano(QWidget*, int);
+ };
+
+#endif
+
diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp
new file mode 100644
index 00000000..93bf615c
--- /dev/null
+++ b/muse2/muse/midiedit/pianoroll.cpp
@@ -0,0 +1,1107 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: pianoroll.cpp,v 1.25.2.15 2009/11/16 11:29:33 lunar_shuttle Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <q3accel.h>
+#include <qlayout.h>
+#include <q3hbox.h>
+#include <qsizegrip.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <q3buttongroup.h>
+#include <qtoolbutton.h>
+#include <qtooltip.h>
+#include <q3popupmenu.h>
+#include <qmenubar.h>
+#include <qapplication.h>
+#include <qclipboard.h>
+#include <qdir.h>
+#include <qaction.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include <Q3GridLayout>
+#include <QResizeEvent>
+#include <QCloseEvent>
+
+#include <stdio.h>
+
+#include "xml.h"
+#include "mtscale.h"
+#include "prcanvas.h"
+#include "pianoroll.h"
+#include "scrollscale.h"
+#include "piano.h"
+#include "../ctrl/ctrledit.h"
+#include "splitter.h"
+#include "ttoolbar.h"
+#include "tb1.h"
+#include "utils.h"
+#include "globals.h"
+#include "gconfig.h"
+#include "icons.h"
+#include "audio.h"
+
+#include "cmd.h"
+#include "quantconfig.h"
+#include "shortcuts.h"
+
+int PianoRoll::_quantInit = 96;
+int PianoRoll::_rasterInit = 96;
+int PianoRoll::_widthInit = 600;
+int PianoRoll::_heightInit = 400;
+int PianoRoll::_quantStrengthInit = 80; // 1 - 100%
+int PianoRoll::_quantLimitInit = 50; // tick value
+bool PianoRoll::_quantLenInit = false;
+int PianoRoll::_toInit = 0;
+int PianoRoll::colorModeInit = 0;
+
+static const int xscale = -10;
+static const int yscale = 1;
+static const int pianoWidth = 40;
+static int pianorollTools = PointerTool | PencilTool | RubberTool | DrawTool;
+
+
+
+
+//---------------------------------------------------------
+// PianoRoll
+//---------------------------------------------------------
+
+PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned initPos)
+ : MidiEditor(_quantInit, _rasterInit, pl, parent, name)
+ {
+ deltaMode = false;
+ resize(_widthInit, _heightInit);
+ selPart = 0;
+ quantConfig = 0;
+ _playEvents = false;
+ _quantStrength = _quantStrengthInit;
+ _quantLimit = _quantLimitInit;
+ _quantLen = _quantLenInit;
+ _to = _toInit;
+ colorMode = colorModeInit;
+ //---------Men----------------------------------
+ menuEdit = new Q3PopupMenu(this);
+ menuBar()->insertItem(tr("&Edit"), menuEdit);
+ undoRedo->addTo(menuEdit);
+ Q3Accel* ud = new Q3Accel(this);
+ ud->connectItem(ud->insertItem(Qt::CTRL+Qt::Key_Z), song, SLOT(undo()));
+ Q3Accel* rd = new Q3Accel(this);
+ rd->connectItem(rd->insertItem(Qt::CTRL+Qt::Key_Y), song, SLOT(redo()));
+
+ menuEdit->insertSeparator();
+ menuEdit->insertItem(tr("Cut"), PianoCanvas::CMD_CUT);
+ menuEdit->setAccel(Qt::CTRL+Qt::Key_X, PianoCanvas::CMD_CUT);
+ menuEdit->insertItem(tr("Copy"), PianoCanvas::CMD_COPY);
+ menuEdit->setAccel(Qt::CTRL+Qt::Key_C, PianoCanvas::CMD_COPY);
+ menuEdit->insertItem(tr("Paste"), PianoCanvas::CMD_PASTE);
+ menuEdit->setAccel(Qt::CTRL+Qt::Key_V, PianoCanvas::CMD_PASTE);
+ menuEdit->insertSeparator();
+ menuEdit->insertItem(tr("Delete Events"), PianoCanvas::CMD_DEL);
+ menuEdit->setAccel(Qt::Key_Delete, PianoCanvas::CMD_DEL);
+ menuEdit->insertSeparator();
+
+ menuSelect = new Q3PopupMenu(this);
+ menuSelect->insertItem(tr("Select All"), PianoCanvas::CMD_SELECT_ALL);
+ menuSelect->insertItem(tr("Select None"), PianoCanvas::CMD_SELECT_NONE);
+ menuSelect->insertItem(tr("Invert"), PianoCanvas::CMD_SELECT_INVERT);
+
+ menuSelect->insertSeparator();
+ menuSelect->insertItem(tr("Inside Loop"), PianoCanvas::CMD_SELECT_ILOOP);
+
+ menuSelect->insertItem(tr("Outside Loop"), PianoCanvas::CMD_SELECT_OLOOP);
+
+ menuSelect->insertSeparator();
+
+ menuSelect->insertItem(tr("Previous Part"), PianoCanvas::CMD_SELECT_PREV_PART);
+ menuSelect->insertItem(tr("Next Part"), PianoCanvas::CMD_SELECT_NEXT_PART);
+
+ menuEdit->insertItem(tr("&Select"), menuSelect);
+
+ eventColor = new Q3PopupMenu(this);
+ eventColor->insertItem(tr("blue"), 0);
+ eventColor->insertItem(tr("pitch colors"), 1);
+ eventColor->insertItem(tr("velocity colors"), 2);
+ connect(eventColor, SIGNAL(activated(int)), SLOT(setEventColorMode(int)));
+
+ menuConfig = new Q3PopupMenu(this);
+ menuBar()->insertItem(tr("&Config"), menuConfig);
+ menu_ids[CMD_EVENT_COLOR] = menuConfig->insertItem(tr("event color"), eventColor, 0);
+
+ menuFunctions = new Q3PopupMenu(this);
+ menuBar()->insertItem(tr("&Functions"), menuFunctions);
+ menuFunctions->insertTearOffHandle();
+ menuFunctions->insertItem(tr("Over Quantize"), PianoCanvas::CMD_OVER_QUANTIZE);
+
+ menuFunctions->insertItem(tr("Note On Quantize"), PianoCanvas::CMD_ON_QUANTIZE);
+
+ menuFunctions->insertItem(tr("Note On/Off Quantize"), PianoCanvas::CMD_ONOFF_QUANTIZE);
+ menuFunctions->insertItem(tr("Iterative Quantize"), PianoCanvas::CMD_ITERATIVE_QUANTIZE);
+
+ menuFunctions->insertSeparator();
+ menu_ids[CMD_CONFIG_QUANT] = menuFunctions->insertItem(tr("Config Quant..."), this, SLOT(configQuant()), 0);
+ menuFunctions->insertSeparator();
+ menuFunctions->insertItem(tr("Modify Gate Time"), PianoCanvas::CMD_MODIFY_GATE_TIME);
+ menuFunctions->insertItem(tr("Modify Velocity"), PianoCanvas::CMD_MODIFY_VELOCITY);
+ menuFunctions->insertItem(tr("Crescendo"), PianoCanvas::CMD_CRESCENDO);
+ menuFunctions->insertItem(tr("Transpose"), PianoCanvas::CMD_TRANSPOSE);
+ menuFunctions->insertItem(tr("Thin Out"), PianoCanvas::CMD_THIN_OUT);
+ menuFunctions->insertItem(tr("Erase Event"), PianoCanvas::CMD_ERASE_EVENT);
+ menuFunctions->insertItem(tr("Note Shift"), PianoCanvas::CMD_NOTE_SHIFT);
+ menuFunctions->insertItem(tr("Move Clock"), PianoCanvas::CMD_MOVE_CLOCK);
+ menuFunctions->insertItem(tr("Copy Measure"), PianoCanvas::CMD_COPY_MEASURE);
+ menuFunctions->insertItem(tr("Erase Measure"), PianoCanvas::CMD_ERASE_MEASURE);
+ menuFunctions->insertItem(tr("Delete Measure"), PianoCanvas::CMD_DELETE_MEASURE);
+ menuFunctions->insertItem(tr("Create Measure"), PianoCanvas::CMD_CREATE_MEASURE);
+ menuFunctions->insertItem(tr("Set fixed length"), PianoCanvas::CMD_FIXED_LEN);
+ menuFunctions->insertItem(tr("Delete overlaps"), PianoCanvas::CMD_DELETE_OVERLAPS);
+
+ menuFunctions->setItemEnabled(PianoCanvas::CMD_CRESCENDO, false);
+ menuFunctions->setItemEnabled(PianoCanvas::CMD_TRANSPOSE, false);
+ menuFunctions->setItemEnabled(PianoCanvas::CMD_THIN_OUT, false);
+ menuFunctions->setItemEnabled(PianoCanvas::CMD_ERASE_EVENT, false);
+ menuFunctions->setItemEnabled(PianoCanvas::CMD_NOTE_SHIFT, false);
+ menuFunctions->setItemEnabled(PianoCanvas::CMD_MOVE_CLOCK, false);
+ menuFunctions->setItemEnabled(PianoCanvas::CMD_COPY_MEASURE, false);
+ menuFunctions->setItemEnabled(PianoCanvas::CMD_ERASE_MEASURE, false);
+ menuFunctions->setItemEnabled(PianoCanvas::CMD_DELETE_MEASURE, false);
+ menuFunctions->setItemEnabled(PianoCanvas::CMD_CREATE_MEASURE, false);
+
+ menuPlugins = new Q3PopupMenu(this);
+ song->populateScriptMenu(menuPlugins, this);
+ menuBar()->insertItem(tr("&Plugins"), menuPlugins);
+ connect(menuEdit, SIGNAL(activated(int)), SLOT(cmd(int)));
+ connect(menuSelect, SIGNAL(activated(int)), SLOT(cmd(int)));
+ connect(menuFunctions, SIGNAL(activated(int)), SLOT(cmd(int)));
+
+ //---------ToolBar----------------------------------
+ tools = new Q3ToolBar(this, "pianoroll-tools");
+ tools->setLabel(tr("Pianoroll Tools"));
+ undoRedo->addTo(tools);
+ tools->addSeparator();
+
+ srec = new QToolButton(tools, "srec");
+ QToolTip::add(srec, tr("Step Record"));
+ srec->setPixmap(*steprecIcon);
+ srec->setToggleButton(true);
+
+ midiin = new QToolButton(tools, "midiin");
+ QToolTip::add(midiin, tr("Midi Input"));
+ midiin->setPixmap(*midiinIcon);
+ midiin->setToggleButton(true);
+
+ speaker = new QToolButton(tools, "speaker");
+ QToolTip::add(speaker, tr("Play Events"));
+ speaker->setPixmap(*speakerIcon);
+ speaker->setToggleButton(true);
+
+ tools2 = new EditToolBar(this, pianorollTools);
+
+ Q3ToolBar* panicToolbar = new Q3ToolBar(this);
+ panicAction->addTo(panicToolbar);
+
+ //-------------------------------------------------------------
+ // Transport Bar
+ Q3ToolBar* transport = new Q3ToolBar(this);
+ transportAction->addTo(transport);
+
+ toolbar = new Toolbar1(this, _rasterInit, _quantInit);
+ info = new NoteInfo(this);
+
+ //---------------------------------------------------
+ // split
+ //---------------------------------------------------
+
+ splitter = new Splitter(Qt::Vertical, mainw, "splitter");
+ QPushButton* ctrl = new QPushButton(tr("ctrl"), mainw, "Ctrl");
+ ctrl->setFont(config.fonts[3]);
+ QToolTip::add(ctrl, tr("Add Controller View"));
+ hscroll = new ScrollScale(-25, -2, xscale, 20000, Qt::Horizontal, mainw);
+ ctrl->setFixedSize(pianoWidth, hscroll->sizeHint().height());
+
+ QSizeGrip* corner = new QSizeGrip(mainw);
+
+ mainGrid->setRowStretch(0, 100);
+ mainGrid->setColStretch(1, 100);
+ mainGrid->addMultiCellWidget(splitter, 0, 0, 0, 2);
+ mainGrid->addWidget(ctrl, 1, 0);
+ mainGrid->addWidget(hscroll, 1, 1);
+ mainGrid->addWidget(corner, 1, 2, Qt::AlignBottom|Qt::AlignRight);
+ mainGrid->addRowSpacing(1, hscroll->sizeHint().height());
+
+ QWidget* split1 = new QWidget(splitter, "split1");
+ Q3GridLayout* gridS1 = new Q3GridLayout(split1);
+ time = new MTScale(&_raster, split1, xscale);
+ Piano* piano = new Piano(split1, yscale);
+ canvas = new PianoCanvas(this, split1, xscale, yscale);
+ vscroll = new ScrollScale(-3, 7, yscale, KH * 75, Qt::Vertical, split1);
+
+ int offset = -(config.division/4);
+ canvas->setOrigin(offset, 0);
+ canvas->setCanvasTools(pianorollTools);
+ canvas->setFocus();
+ connect(canvas, SIGNAL(toolChanged(int)), tools2, SLOT(set(int)));
+ time->setOrigin(offset, 0);
+
+ gridS1->setRowStretch(2, 100);
+ gridS1->setColStretch(1, 100);
+
+ gridS1->addMultiCellWidget(time, 0, 0, 1, 2);
+ gridS1->addMultiCellWidget(hLine(split1), 1, 1, 0, 2);
+ gridS1->addWidget(piano, 2, 0);
+ gridS1->addWidget(canvas, 2, 1);
+
+ gridS1->addWidget(vscroll, 2, 2);
+// gridS1->addWidget(time, 0, 1);
+// gridS1->addWidget(hLine(split1), 1, 1);
+// gridS1->addWidget(piano, 2, 0);
+// gridS1->addWidget(canvas, 2, 1);
+// gridS1->addMultiCellWidget(vscroll, 1, 2, 2, 2);
+
+ piano->setFixedWidth(pianoWidth);
+
+ connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int)));
+
+ connect(ctrl, SIGNAL(clicked()), SLOT(addCtrl()));
+ connect(info, SIGNAL(valueChanged(NoteInfo::ValType, int)), SLOT(noteinfoChanged(NoteInfo::ValType, int)));
+ connect(vscroll, SIGNAL(scrollChanged(int)), piano, SLOT(setYPos(int)));
+ connect(vscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setYPos(int)));
+ connect(vscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setYMag(int)));
+ connect(vscroll, SIGNAL(scaleChanged(int)), piano, SLOT(setYMag(int)));
+
+ connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int)));
+ connect(hscroll, SIGNAL(scrollChanged(int)), time, SLOT(setXPos(int)));
+
+ connect(hscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setXMag(int)));
+ connect(hscroll, SIGNAL(scaleChanged(int)), time, SLOT(setXMag(int)));
+
+ connect(canvas, SIGNAL(pitchChanged(int)), piano, SLOT(setPitch(int)));
+ connect(canvas, SIGNAL(verticalScroll(unsigned)), vscroll, SLOT(setPos(unsigned)));
+ connect(canvas, SIGNAL(horizontalScroll(unsigned)),hscroll, SLOT(setPos(unsigned)));
+ connect(canvas, SIGNAL(horizontalScrollNoLimit(unsigned)),hscroll, SLOT(setPosNoLimit(unsigned)));
+ connect(canvas, SIGNAL(selectionChanged(int, Event&, Part*)), this,
+ SLOT(setSelection(int, Event&, Part*)));
+
+ connect(piano, SIGNAL(keyPressed(int, int, bool)), canvas, SLOT(pianoPressed(int, int, bool)));
+ connect(piano, SIGNAL(keyReleased(int, bool)), canvas, SLOT(pianoReleased(int, bool)));
+ connect(srec, SIGNAL(toggled(bool)), SLOT(setSteprec(bool)));
+ connect(midiin, SIGNAL(toggled(bool)), canvas, SLOT(setMidiin(bool)));
+ connect(speaker, SIGNAL(toggled(bool)), SLOT(setSpeaker(bool)));
+ connect(canvas, SIGNAL(followEvent(int)), SLOT(follow(int)));
+
+ connect(hscroll, SIGNAL(scaleChanged(int)), SLOT(updateHScrollRange()));
+ piano->setYPos(KH * 30);
+ canvas->setYPos(KH * 30);
+ vscroll->setPos(KH * 30);
+ //setSelection(0, 0, 0); //Really necessary? Causes segfault when only 1 item selected, replaced by the following:
+ info->setEnabled(false);
+
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged1(int)));
+
+ setCaption(canvas->getCaption());
+
+ updateHScrollRange();
+ // connect to toolbar
+ connect(canvas, SIGNAL(pitchChanged(int)), toolbar, SLOT(setPitch(int)));
+ connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
+ connect(piano, SIGNAL(pitchChanged(int)), toolbar, SLOT(setPitch(int)));
+ connect(time, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
+ connect(toolbar, SIGNAL(quantChanged(int)), SLOT(setQuant(int)));
+ connect(toolbar, SIGNAL(rasterChanged(int)),SLOT(setRaster(int)));
+ connect(toolbar, SIGNAL(toChanged(int)), SLOT(setTo(int)));
+ connect(toolbar, SIGNAL(soloChanged(bool)), SLOT(soloChanged(bool)));
+
+ setFocusPolicy(Qt::StrongFocus);
+ setEventColorMode(colorMode);
+
+ QClipboard* cb = QApplication::clipboard();
+ connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged()));
+
+ clipboardChanged(); // enable/disable "Paste"
+ selectionChanged(); // enable/disable "Copy" & "Paste"
+ initShortcuts(); // initialize shortcuts
+
+ const Pos cpos=song->cPos();
+ canvas->setPos(0, cpos.tick(), true);
+ canvas->selectAtTick(cpos.tick());
+ //canvas->selectFirst();
+//
+ if(canvas->track())
+ toolbar->setSolo(canvas->track()->solo());
+
+ unsigned pos;
+ if(initPos >= MAXINT)
+ pos = song->cpos();
+ else
+ pos = initPos;
+ if(pos > MAXINT)
+ pos = MAXINT;
+ hscroll->setOffset((int)pos);
+ }
+
+//---------------------------------------------------------
+// songChanged1
+//---------------------------------------------------------
+
+void PianoRoll::songChanged1(int bits)
+ {
+
+ if (bits & SC_SOLO)
+ {
+ toolbar->setSolo(canvas->track()->solo());
+ return;
+ }
+ songChanged(bits);
+ }
+
+//---------------------------------------------------------
+// configChanged
+//---------------------------------------------------------
+
+void PianoRoll::configChanged()
+ {
+ initShortcuts();
+ }
+
+//---------------------------------------------------------
+// updateHScrollRange
+//---------------------------------------------------------
+
+void PianoRoll::updateHScrollRange()
+{
+ int s, e;
+ canvas->range(&s, &e);
+ // Show one more measure.
+ e += sigmap.ticksMeasure(e);
+ // Show another quarter measure due to imprecise drawing at canvas end point.
+ e += sigmap.ticksMeasure(e) / 4;
+ // Compensate for the fixed piano and vscroll widths.
+ e += canvas->rmapxDev(pianoWidth - vscroll->width());
+ int s1, e1;
+ hscroll->range(&s1, &e1);
+ if(s != s1 || e != e1)
+ hscroll->setRange(s, e);
+}
+
+//---------------------------------------------------------
+// follow
+//---------------------------------------------------------
+
+void PianoRoll::follow(int pos)
+ {
+ int s, e;
+ canvas->range(&s, &e);
+
+ if (pos < e && pos >= s)
+ hscroll->setOffset(pos);
+ if (pos < s)
+ hscroll->setOffset(s);
+ }
+
+//---------------------------------------------------------
+// setTime
+//---------------------------------------------------------
+
+void PianoRoll::setTime(unsigned tick)
+ {
+ toolbar->setTime(tick);
+ time->setPos(3, tick, false);
+ }
+
+//---------------------------------------------------------
+// ~Pianoroll
+//---------------------------------------------------------
+
+PianoRoll::~PianoRoll()
+ {
+ undoRedo->removeFrom(tools);
+ }
+
+//---------------------------------------------------------
+// cmd
+// pulldown menu commands
+//---------------------------------------------------------
+
+void PianoRoll::cmd(int cmd)
+ {
+ ((PianoCanvas*)canvas)->cmd(cmd, _quantStrength, _quantLimit, _quantLen, _to);
+ }
+
+//---------------------------------------------------------
+// setSelection
+// update Info Line
+//---------------------------------------------------------
+
+void PianoRoll::setSelection(int tick, Event& e, Part* p)
+ {
+ int selections = canvas->selectionSize();
+
+ selEvent = e;
+ selPart = (MidiPart*)p;
+ selTick = tick;
+
+ if (selections > 1) {
+ info->setEnabled(true);
+ info->setDeltaMode(true);
+ if (!deltaMode) {
+ deltaMode = true;
+ info->setValues(0, 0, 0, 0, 0);
+ tickOffset = 0;
+ lenOffset = 0;
+ pitchOffset = 0;
+ veloOnOffset = 0;
+ veloOffOffset = 0;
+ }
+ }
+ else if (selections == 1) {
+ deltaMode = false;
+ info->setEnabled(true);
+ info->setDeltaMode(false);
+ info->setValues(tick,
+ selEvent.lenTick(),
+ selEvent.pitch(),
+ selEvent.velo(),
+ selEvent.veloOff());
+ }
+ else {
+ deltaMode = false;
+ info->setEnabled(false);
+ }
+ selectionChanged();
+ }
+
+//---------------------------------------------------------
+// edit currently selected Event
+//---------------------------------------------------------
+
+void PianoRoll::noteinfoChanged(NoteInfo::ValType type, int val)
+ {
+ int selections = canvas->selectionSize();
+
+ if (selections == 0) {
+ printf("noteinfoChanged while nothing selected\n");
+ }
+ else if (selections == 1) {
+ Event event = selEvent.clone();
+ switch(type) {
+ case NoteInfo::VAL_TIME:
+ event.setTick(val - selPart->tick());
+ break;
+ case NoteInfo::VAL_LEN:
+ event.setLenTick(val);
+ break;
+ case NoteInfo::VAL_VELON:
+ event.setVelo(val);
+ break;
+ case NoteInfo::VAL_VELOFF:
+ event.setVeloOff(val);
+ break;
+ case NoteInfo::VAL_PITCH:
+ event.setPitch(val);
+ break;
+ }
+ // Indicate do undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(selEvent, event, selPart);
+ audio->msgChangeEvent(selEvent, event, selPart, true, false, false);
+ }
+ else {
+ // multiple events are selected; treat noteinfo values
+ // as offsets to event values
+
+ int delta = 0;
+ switch (type) {
+ case NoteInfo::VAL_TIME:
+ delta = val - tickOffset;
+ tickOffset = val;
+ break;
+ case NoteInfo::VAL_LEN:
+ delta = val - lenOffset;
+ lenOffset = val;
+ break;
+ case NoteInfo::VAL_VELON:
+ delta = val - veloOnOffset;
+ veloOnOffset = val;
+ break;
+ case NoteInfo::VAL_VELOFF:
+ delta = val - veloOffOffset;
+ veloOffOffset = val;
+ break;
+ case NoteInfo::VAL_PITCH:
+ delta = val - pitchOffset;
+ pitchOffset = val;
+ break;
+ }
+ if (delta)
+ canvas->modifySelected(type, delta);
+ }
+ }
+
+//---------------------------------------------------------
+// addCtrl
+//---------------------------------------------------------
+
+CtrlEdit* PianoRoll::addCtrl()
+ {
+ CtrlEdit* ctrlEdit = new CtrlEdit(splitter, this, xscale, false, "pianoCtrlEdit");
+ connect(tools2, SIGNAL(toolChanged(int)), ctrlEdit, SLOT(setTool(int)));
+ connect(hscroll, SIGNAL(scrollChanged(int)), ctrlEdit, SLOT(setXPos(int)));
+ connect(hscroll, SIGNAL(scaleChanged(int)), ctrlEdit, SLOT(setXMag(int)));
+ connect(ctrlEdit, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
+ connect(ctrlEdit, SIGNAL(destroyedCtrl(CtrlEdit*)), SLOT(removeCtrl(CtrlEdit*)));
+ connect(ctrlEdit, SIGNAL(yposChanged(int)), toolbar, SLOT(setInt(int)));
+
+ ctrlEdit->setTool(tools2->curTool());
+ ctrlEdit->setXPos(hscroll->pos());
+ ctrlEdit->setXMag(hscroll->getScaleValue());
+
+ ctrlEdit->show();
+ ctrlEditList.push_back(ctrlEdit);
+ return ctrlEdit;
+ }
+
+//---------------------------------------------------------
+// removeCtrl
+//---------------------------------------------------------
+
+void PianoRoll::removeCtrl(CtrlEdit* ctrl)
+ {
+ for (std::list<CtrlEdit*>::iterator i = ctrlEditList.begin();
+ i != ctrlEditList.end(); ++i) {
+ if (*i == ctrl) {
+ ctrlEditList.erase(i);
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void PianoRoll::closeEvent(QCloseEvent* e)
+ {
+ emit deleted((unsigned long)this);
+ e->accept();
+ }
+
+//---------------------------------------------------------
+// readConfiguration
+//---------------------------------------------------------
+
+void PianoRoll::readConfiguration(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::TagStart:
+ if (tag == "quant")
+ _quantInit = xml.parseInt();
+ else if (tag == "raster")
+ _rasterInit = xml.parseInt();
+ else if (tag == "quantStrength")
+ _quantStrengthInit = xml.parseInt();
+ else if (tag == "quantLimit")
+ _quantLimitInit = xml.parseInt();
+ else if (tag == "quantLen")
+ _quantLenInit = xml.parseInt();
+ else if (tag == "to")
+ _toInit = xml.parseInt();
+ else if (tag == "colormode")
+ colorModeInit = xml.parseInt();
+ else if (tag == "width")
+ _widthInit = xml.parseInt();
+ else if (tag == "height")
+ _heightInit = xml.parseInt();
+ else
+ xml.unknown("PianoRoll");
+ break;
+ case Xml::TagEnd:
+ if (tag == "pianoroll")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// writeConfiguration
+//---------------------------------------------------------
+
+void PianoRoll::writeConfiguration(int level, Xml& xml)
+ {
+ xml.tag(level++, "pianoroll");
+ xml.intTag(level, "quant", _quantInit);
+ xml.intTag(level, "raster", _rasterInit);
+ xml.intTag(level, "quantStrength", _quantStrengthInit);
+ xml.intTag(level, "quantLimit", _quantLimitInit);
+ xml.intTag(level, "quantLen", _quantLenInit);
+ xml.intTag(level, "to", _toInit);
+ xml.intTag(level, "width", _widthInit);
+ xml.intTag(level, "height", _heightInit);
+ xml.intTag(level, "colormode", colorModeInit);
+ xml.etag(level, "pianoroll");
+ }
+
+//---------------------------------------------------------
+// soloChanged
+// signal from solo button
+//---------------------------------------------------------
+
+void PianoRoll::soloChanged(bool flag)
+ {
+ audio->msgSetSolo(canvas->track(), flag);
+ song->update(SC_SOLO);
+ }
+
+//---------------------------------------------------------
+// setRaster
+//---------------------------------------------------------
+
+void PianoRoll::setRaster(int val)
+ {
+ _rasterInit = val;
+ MidiEditor::setRaster(val);
+ canvas->redrawGrid();
+ canvas->setFocus(); // give back focus after kb input
+ }
+
+//---------------------------------------------------------
+// setQuant
+//---------------------------------------------------------
+
+void PianoRoll::setQuant(int val)
+ {
+ _quantInit = val;
+ MidiEditor::setQuant(val);
+ canvas->setFocus();
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void PianoRoll::writeStatus(int level, Xml& xml) const
+ {
+ writePartList(level, xml);
+ xml.tag(level++, "pianoroll");
+ MidiEditor::writeStatus(level, xml);
+ splitter->writeStatus(level, xml);
+
+ for (std::list<CtrlEdit*>::const_iterator i = ctrlEditList.begin();
+ i != ctrlEditList.end(); ++i) {
+ (*i)->writeStatus(level, xml);
+ }
+
+ xml.intTag(level, "steprec", canvas->steprec());
+ xml.intTag(level, "midiin", canvas->midiin());
+ xml.intTag(level, "tool", int(canvas->tool()));
+ xml.intTag(level, "quantStrength", _quantStrength);
+ xml.intTag(level, "quantLimit", _quantLimit);
+ xml.intTag(level, "quantLen", _quantLen);
+ xml.intTag(level, "playEvents", _playEvents);
+ xml.intTag(level, "xpos", hscroll->pos());
+ xml.intTag(level, "xmag", hscroll->mag());
+ xml.intTag(level, "ypos", vscroll->pos());
+ xml.intTag(level, "ymag", vscroll->mag());
+ xml.tag(level, "/pianoroll");
+ }
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void PianoRoll::readStatus(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::TagStart:
+ if (tag == "steprec") {
+ int val = xml.parseInt();
+ canvas->setSteprec(val);
+ srec->setOn(val);
+ }
+ else if (tag == "midiin") {
+ int val = xml.parseInt();
+ canvas->setMidiin(val);
+ midiin->setOn(val);
+ }
+ else if (tag == "tool") {
+ int tool = xml.parseInt();
+ canvas->setTool(tool);
+ tools2->set(tool);
+ }
+ else if (tag == "midieditor")
+ MidiEditor::readStatus(xml);
+ else if (tag == "ctrledit") {
+ CtrlEdit* ctrl = addCtrl();
+ ctrl->readStatus(xml);
+ }
+ else if (tag == splitter->name())
+ splitter->readStatus(xml);
+ else if (tag == "quantStrength")
+ _quantStrength = xml.parseInt();
+ else if (tag == "quantLimit")
+ _quantLimit = xml.parseInt();
+ else if (tag == "quantLen")
+ _quantLen = xml.parseInt();
+ else if (tag == "playEvents") {
+ _playEvents = xml.parseInt();
+ canvas->playEvents(_playEvents);
+ speaker->setOn(_playEvents);
+ }
+ else if (tag == "xmag")
+ hscroll->setMag(xml.parseInt());
+ else if (tag == "xpos")
+ hscroll->setPos(xml.parseInt());
+ else if (tag == "ymag")
+ vscroll->setMag(xml.parseInt());
+ else if (tag == "ypos")
+ vscroll->setPos(xml.parseInt());
+ else
+ xml.unknown("PianoRoll");
+ break;
+ case Xml::TagEnd:
+ if (tag == "pianoroll") {
+ _quantInit = _quant;
+ _rasterInit = _raster;
+ toolbar->setRaster(_raster);
+ toolbar->setQuant(_quant);
+ canvas->redrawGrid();
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+static int rasterTable[] = {
+ //-9----8- 7 6 5 4 3(1/4) 2 1
+ 4, 8, 16, 32, 64, 128, 256, 512, 1024, // triple
+ 6, 12, 24, 48, 96, 192, 384, 768, 1536,
+ 9, 18, 36, 72, 144, 288, 576, 1152, 2304 // dot
+ };
+
+//---------------------------------------------------------
+// viewKeyPressEvent
+//---------------------------------------------------------
+
+void PianoRoll::keyPressEvent(QKeyEvent* event)
+ {
+ if (info->hasFocus()) {
+ event->ignore();
+ return;
+ }
+
+ int index;
+ int n = sizeof(rasterTable)/sizeof(*rasterTable);
+ for (index = 0; index < n; ++index)
+ if (rasterTable[index] == raster())
+ break;
+ if (index == n) {
+ index = 0;
+ // raster 1 is not in table
+ }
+ int off = (index / 9) * 9;
+ index = index % 9;
+
+ int val = 0;
+
+ PianoCanvas* pc = (PianoCanvas*)canvas;
+ int key = event->key();
+
+ if (event->state() & Qt::ShiftButton)
+ key += Qt::SHIFT;
+ if (event->state() & Qt::AltButton)
+ key += Qt::ALT;
+ if (event->state() & Qt::ControlButton)
+ key+= Qt::CTRL;
+
+ if (key == Qt::Key_Escape) {
+ close();
+ return;
+ }
+ else if (key == shortcuts[SHRT_TOOL_POINTER].key) {
+ tools2->set(PointerTool);
+ return;
+ }
+ else if (key == shortcuts[SHRT_TOOL_PENCIL].key) {
+ tools2->set(PencilTool);
+ return;
+ }
+ else if (key == shortcuts[SHRT_TOOL_RUBBER].key) {
+ tools2->set(RubberTool);
+ return;
+ }
+ else if (key == shortcuts[SHRT_TOOL_LINEDRAW].key) {
+ tools2->set(DrawTool);
+ return;
+ }
+ else if (key == shortcuts[SHRT_POS_INC].key) {
+ pc->pianoCmd(CMD_RIGHT);
+ return;
+ }
+ else if (key == shortcuts[SHRT_POS_DEC].key) {
+ pc->pianoCmd(CMD_LEFT);
+ return;
+ }
+ else if (key == shortcuts[SHRT_INSERT_AT_LOCATION].key) {
+ pc->pianoCmd(CMD_INSERT);
+ return;
+ }
+ else if (key == Qt::Key_Delete) {
+ pc->pianoCmd(CMD_DELETE);
+ return;
+ }
+ else if (key == shortcuts[SHRT_ZOOM_IN].key) {
+ int mag = hscroll->mag();
+ int zoomlvl = ScrollScale::getQuickZoomLevel(mag);
+ if (zoomlvl < 23)
+ zoomlvl++;
+
+ int newmag = ScrollScale::convertQuickZoomLevelToMag(zoomlvl);
+ hscroll->setMag(newmag);
+ //printf("mag = %d zoomlvl = %d newmag = %d\n", mag, zoomlvl, newmag);
+ return;
+ }
+ else if (key == shortcuts[SHRT_ZOOM_OUT].key) {
+ int mag = hscroll->mag();
+ int zoomlvl = ScrollScale::getQuickZoomLevel(mag);
+ if (zoomlvl > 1)
+ zoomlvl--;
+
+ int newmag = ScrollScale::convertQuickZoomLevelToMag(zoomlvl);
+ hscroll->setMag(newmag);
+ //printf("mag = %d zoomlvl = %d newmag = %d\n", mag, zoomlvl, newmag);
+ return;
+ }
+ else if (key == shortcuts[SHRT_GOTO_CPOS].key) {
+ PartList* p = this->parts();
+ Part* first = p->begin()->second;
+ hscroll->setPos(song->cpos() - first->tick() );
+ return;
+ }
+ else if (key == shortcuts[SHRT_SCROLL_LEFT].key) {
+ int pos = hscroll->pos() - config.division;
+ if (pos < 0)
+ pos = 0;
+ hscroll->setPos(pos);
+ return;
+ }
+ else if (key == shortcuts[SHRT_SCROLL_RIGHT].key) {
+ int pos = hscroll->pos() + config.division;
+ hscroll->setPos(pos);
+ return;
+ }
+ else if (key == shortcuts[SHRT_SET_QUANT_1].key)
+ val = rasterTable[8 + off];
+ else if (key == shortcuts[SHRT_SET_QUANT_2].key)
+ val = rasterTable[7 + off];
+ else if (key == shortcuts[SHRT_SET_QUANT_3].key)
+ val = rasterTable[6 + off];
+ else if (key == shortcuts[SHRT_SET_QUANT_4].key)
+ val = rasterTable[5 + off];
+ else if (key == shortcuts[SHRT_SET_QUANT_5].key)
+ val = rasterTable[4 + off];
+ else if (key == shortcuts[SHRT_SET_QUANT_6].key)
+ val = rasterTable[3 + off];
+ else if (key == shortcuts[SHRT_SET_QUANT_7].key)
+ val = rasterTable[2 + off];
+ else if (key == shortcuts[SHRT_TOGGLE_TRIOL].key)
+ val = rasterTable[index + ((off == 0) ? 9 : 0)];
+ else if (key == shortcuts[SHRT_EVENT_COLOR].key) {
+ if (colorMode == 0)
+ colorMode = 1;
+ else if (colorMode == 1)
+ colorMode = 2;
+ else
+ colorMode = 0;
+ setEventColorMode(colorMode);
+ return;
+ }
+ else if (key == shortcuts[SHRT_TOGGLE_PUNCT].key)
+ val = rasterTable[index + ((off == 18) ? 9 : 18)];
+
+ else if (key == shortcuts[SHRT_TOGGLE_PUNCT2].key) {//CDW
+ if ((off == 18) && (index > 2)) {
+ val = rasterTable[index + 9 - 1];
+ }
+ else if ((off == 9) && (index < 8)) {
+ val = rasterTable[index + 18 + 1];
+ }
+ else
+ return;
+ }
+ else { //Default:
+ event->ignore();
+ return;
+ }
+ setQuant(val);
+ setRaster(val);
+ toolbar->setQuant(_quant);
+ toolbar->setRaster(_raster);
+ }
+
+//---------------------------------------------------------
+// configQuant
+//---------------------------------------------------------
+
+void PianoRoll::configQuant()
+ {
+ if (!quantConfig) {
+ quantConfig = new QuantConfig(_quantStrength, _quantLimit, _quantLen);
+ connect(quantConfig, SIGNAL(setQuantStrength(int)), SLOT(setQuantStrength(int)));
+ connect(quantConfig, SIGNAL(setQuantLimit(int)), SLOT(setQuantLimit(int)));
+ connect(quantConfig, SIGNAL(setQuantLen(bool)), SLOT(setQuantLen(bool)));
+ }
+ quantConfig->show();
+ }
+
+//---------------------------------------------------------
+// setSteprec
+//---------------------------------------------------------
+
+void PianoRoll::setSteprec(bool flag)
+ {
+ canvas->setSteprec(flag);
+ if (flag == false)
+ midiin->setOn(flag);
+ }
+
+//---------------------------------------------------------
+// setEventColorMode
+//---------------------------------------------------------
+
+void PianoRoll::setEventColorMode(int mode)
+ {
+ colorMode = mode;
+ colorModeInit = colorMode;
+ eventColor->setItemChecked(0, mode == 0);
+ eventColor->setItemChecked(1, mode == 1);
+ eventColor->setItemChecked(2, mode == 2);
+ ((PianoCanvas*)(canvas))->setColorMode(colorMode);
+ }
+
+//---------------------------------------------------------
+// clipboardChanged
+//---------------------------------------------------------
+
+void PianoRoll::clipboardChanged()
+ {
+ QMimeSource* ms = QApplication::clipboard()->data(QClipboard::Clipboard);
+ bool flag = false;
+ if (ms) {
+ for (int i = 0;; ++i) {
+ if (ms->format(i) == 0)
+ break;
+// printf("clipboard changed %s\n", ms->format(i));
+ flag = strcmp(ms->format(i), "text/eventlist;charset=UTF-8") == 0;
+ if (flag)
+ break;
+ }
+ }
+ menuEdit->setItemEnabled(PianoCanvas::CMD_PASTE, flag);
+ }
+
+//---------------------------------------------------------
+// selectionChanged
+//---------------------------------------------------------
+
+void PianoRoll::selectionChanged()
+ {
+ bool flag = canvas->selectionSize() > 0;
+ menuEdit->setItemEnabled(PianoCanvas::CMD_CUT, flag);
+ menuEdit->setItemEnabled(PianoCanvas::CMD_COPY, flag);
+ menuEdit->setItemEnabled(PianoCanvas::CMD_DEL, flag);
+ }
+
+//---------------------------------------------------------
+// setSpeaker
+//---------------------------------------------------------
+
+void PianoRoll::setSpeaker(bool val)
+ {
+ _playEvents = val;
+ canvas->playEvents(_playEvents);
+ }
+
+//---------------------------------------------------------
+// resizeEvent
+//---------------------------------------------------------
+
+void PianoRoll::resizeEvent(QResizeEvent* ev)
+ {
+ QWidget::resizeEvent(ev);
+ _widthInit = ev->size().width();
+ _heightInit = ev->size().height();
+ }
+
+
+//---------------------------------------------------------
+// initShortcuts
+//---------------------------------------------------------
+
+void PianoRoll::initShortcuts()
+ {
+ menuSelect->setAccel(shortcuts[SHRT_SELECT_ALL].key, PianoCanvas::CMD_SELECT_ALL);
+ menuSelect->setAccel(shortcuts[SHRT_SELECT_NONE].key, PianoCanvas::CMD_SELECT_NONE);
+ menuSelect->setAccel(shortcuts[SHRT_SELECT_INVERT].key, PianoCanvas::CMD_SELECT_INVERT);
+ menuSelect->setAccel(shortcuts[SHRT_SELECT_ILOOP].key, PianoCanvas::CMD_SELECT_ILOOP);
+ menuSelect->setAccel(shortcuts[SHRT_SELECT_OLOOP].key, PianoCanvas::CMD_SELECT_OLOOP);
+
+ menuSelect->setAccel(shortcuts[SHRT_SELECT_PREV_PART].key, PianoCanvas::CMD_SELECT_PREV_PART);
+ menuSelect->setAccel(shortcuts[SHRT_SELECT_NEXT_PART].key, PianoCanvas::CMD_SELECT_NEXT_PART);
+
+ menuConfig->setAccel(shortcuts[SHRT_EVENT_COLOR].key, menu_ids[CMD_EVENT_COLOR]);
+
+ menuFunctions->setAccel(shortcuts[SHRT_OVER_QUANTIZE].key, PianoCanvas::CMD_OVER_QUANTIZE);
+ menuFunctions->setAccel(shortcuts[SHRT_ON_QUANTIZE].key, PianoCanvas::CMD_ON_QUANTIZE);
+ menuFunctions->setAccel(shortcuts[SHRT_ONOFF_QUANTIZE].key, PianoCanvas::CMD_ONOFF_QUANTIZE);
+ menuFunctions->setAccel(shortcuts[SHRT_ITERATIVE_QUANTIZE].key, PianoCanvas::CMD_ITERATIVE_QUANTIZE);
+ menuFunctions->setAccel(shortcuts[SHRT_MODIFY_GATE_TIME].key, PianoCanvas::CMD_MODIFY_GATE_TIME);
+ menuFunctions->setAccel(shortcuts[SHRT_MODIFY_VELOCITY].key, PianoCanvas::CMD_MODIFY_VELOCITY);
+ menuFunctions->setAccel(shortcuts[SHRT_CRESCENDO].key, PianoCanvas::CMD_CRESCENDO);
+ menuFunctions->setAccel(shortcuts[SHRT_TRANSPOSE].key, PianoCanvas::CMD_TRANSPOSE);
+ menuFunctions->setAccel(shortcuts[SHRT_THIN_OUT].key, PianoCanvas::CMD_THIN_OUT);
+ menuFunctions->setAccel(shortcuts[SHRT_ERASE_EVENT].key, PianoCanvas::CMD_ERASE_EVENT);
+ menuFunctions->setAccel(shortcuts[SHRT_NOTE_SHIFT].key, PianoCanvas::CMD_NOTE_SHIFT);
+ menuFunctions->setAccel(shortcuts[SHRT_MOVE_CLOCK].key, PianoCanvas::CMD_MOVE_CLOCK);
+ menuFunctions->setAccel(shortcuts[SHRT_COPY_MEASURE].key, PianoCanvas::CMD_COPY_MEASURE);
+ menuFunctions->setAccel(shortcuts[SHRT_ERASE_MEASURE].key, PianoCanvas::CMD_ERASE_MEASURE);
+ menuFunctions->setAccel(shortcuts[SHRT_DELETE_MEASURE].key, PianoCanvas::CMD_DELETE_MEASURE);
+ menuFunctions->setAccel(shortcuts[SHRT_CREATE_MEASURE].key, PianoCanvas::CMD_CREATE_MEASURE);
+ menuFunctions->setAccel(shortcuts[SHRT_CONFIG_QUANT].key, menu_ids[CMD_CONFIG_QUANT]);
+ menuFunctions->setAccel(shortcuts[SHRT_FIXED_LEN].key, PianoCanvas::CMD_FIXED_LEN);
+ menuFunctions->setAccel(shortcuts[SHRT_DELETE_OVERLAPS].key, PianoCanvas::CMD_DELETE_OVERLAPS);
+ }
+
+//---------------------------------------------------------
+// execDeliveredScript
+//---------------------------------------------------------
+void PianoRoll::execDeliveredScript(int id)
+{
+ //QString scriptfile = QString(INSTPREFIX) + SCRIPTSSUFFIX + deliveredScriptNames[id];
+ QString scriptfile = song->getScriptPath(id, true);
+ song->executeScript(scriptfile.latin1(), parts(), quant(), true);
+}
+
+//---------------------------------------------------------
+// execUserScript
+//---------------------------------------------------------
+void PianoRoll::execUserScript(int id)
+{
+ QString scriptfile = song->getScriptPath(id, false);
+ song->executeScript(scriptfile.latin1(), parts(), quant(), true);
+}
+
diff --git a/muse2/muse/midiedit/pianoroll.h b/muse2/muse/midiedit/pianoroll.h
new file mode 100644
index 00000000..8987915a
--- /dev/null
+++ b/muse2/muse/midiedit/pianoroll.h
@@ -0,0 +1,146 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: pianoroll.h,v 1.5.2.4 2009/11/16 11:29:33 lunar_shuttle Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __PIANOROLL_H__
+#define __PIANOROLL_H__
+
+#include <qwidget.h>
+#include <q3mainwindow.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+#include <QResizeEvent>
+#include <QLabel>
+#include <Q3PopupMenu>
+#include <QKeyEvent>
+
+#include <values.h>
+#include "noteinfo.h"
+#include "cobject.h"
+#include "midieditor.h"
+#include "tools.h"
+#include "event.h"
+
+class MidiPart;
+class TimeLabel;
+class PitchLabel;
+class QLabel;
+class PianoCanvas;
+class IntLabel;
+class MTScale;
+class Track;
+class QToolButton;
+class QPushButton;
+class CtrlEdit;
+class Splitter;
+class PartList;
+class Toolbar1;
+class Xml;
+class QuantConfig;
+class ScrollScale;
+class Part;
+class SNode;
+
+//---------------------------------------------------------
+// PianoRoll
+//---------------------------------------------------------
+
+class PianoRoll : public MidiEditor {
+ Event selEvent;
+ MidiPart* selPart;
+ int selTick;
+
+ enum { CMD_EVENT_COLOR, CMD_CONFIG_QUANT, CMD_LAST };
+ int menu_ids[CMD_LAST];
+ Q3PopupMenu *menuEdit, *menuFunctions, *menuSelect, *menuConfig, *menuPlugins;
+
+ int tickOffset;
+ int lenOffset;
+ int pitchOffset;
+ int veloOnOffset;
+ int veloOffOffset;
+ bool deltaMode;
+
+ NoteInfo* info;
+ QToolButton* srec;
+ QToolButton* midiin;
+
+ Toolbar1* toolbar;
+ Splitter* splitter;
+
+ QToolButton* speaker;
+ Q3ToolBar* tools;
+ EditToolBar* tools2;
+
+ Q3PopupMenu* eventColor;
+ int colorMode;
+
+ static int _quantInit, _rasterInit;
+ static int _widthInit, _heightInit;
+
+ static int _quantStrengthInit;
+ static int _quantLimitInit;
+ static bool _quantLenInit;
+ static int _toInit;
+ static int colorModeInit;
+
+ int _quantStrength;
+ int _quantLimit;
+ int _to;
+ bool _quantLen;
+ QuantConfig* quantConfig;
+ bool _playEvents;
+
+
+ Q_OBJECT
+ void initShortcuts();
+ QWidget* genToolbar(QWidget* parent);
+ virtual void closeEvent(QCloseEvent*);
+ virtual void keyPressEvent(QKeyEvent*);
+ virtual void resizeEvent(QResizeEvent*);
+
+ private slots:
+ void setSelection(int, Event&, Part*);
+ void noteinfoChanged(NoteInfo::ValType, int);
+ CtrlEdit* addCtrl();
+ void removeCtrl(CtrlEdit* ctrl);
+ void soloChanged(bool flag);
+ void setRaster(int);
+ void setQuant(int);
+ void configQuant();
+ void setQuantStrength(int val) { _quantStrength = val; }
+ void setQuantLimit(int val) { _quantLimit = val; }
+ void setQuantLen(bool val) { _quantLen = val; }
+ void cmd(int);
+ void setSteprec(bool);
+ void setTo(int val) { _to = val; }
+ void setEventColorMode(int);
+ void clipboardChanged(); // enable/disable "Paste"
+ void selectionChanged(); // enable/disable "Copy" & "Paste"
+ void setSpeaker(bool);
+ void setTime(unsigned);
+ void follow(int pos);
+ void songChanged1(int);
+ void configChanged();
+
+ signals:
+ void deleted(unsigned long);
+
+ public slots:
+ virtual void updateHScrollRange();
+ void execDeliveredScript(int id);
+ void execUserScript(int id);
+ public:
+ PianoRoll(PartList*, QWidget* parent = 0, const char* name = 0, unsigned initPos = MAXINT);
+ ~PianoRoll();
+ virtual void readStatus(Xml&);
+ virtual void writeStatus(int, Xml&) const;
+ static void readConfiguration(Xml&);
+ static void writeConfiguration(int, Xml&);
+ };
+
+#endif
+
diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp
new file mode 100644
index 00000000..484a12ad
--- /dev/null
+++ b/muse2/muse/midiedit/prcanvas.cpp
@@ -0,0 +1,1695 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: prcanvas.cpp,v 1.20.2.19 2009/11/16 11:29:33 lunar_shuttle Exp $
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qapplication.h>
+#include <qclipboard.h>
+#include <qpainter.h>
+#include <q3dragobject.h>
+#include <qmessagebox.h>
+//Added by qt3to4:
+#include <QDragLeaveEvent>
+#include <Q3CString>
+#include <QDragEnterEvent>
+#include <QDragMoveEvent>
+#include <QDropEvent>
+#include <QMouseEvent>
+
+#include <values.h>
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <dirent.h>
+
+#include "xml.h"
+#include "prcanvas.h"
+#include "midiport.h"
+#include "event.h"
+#include "mpevent.h"
+#include "globals.h"
+#include "cmd.h"
+#include "gatetime.h"
+#include "velocity.h"
+#include "song.h"
+#include "audio.h"
+
+//---------------------------------------------------------
+// NEvent
+//---------------------------------------------------------
+
+NEvent::NEvent(Event& e, Part* p, int y) : CItem(e, p)
+ {
+ y = y - KH/4;
+ unsigned tick = e.tick() + p->tick();
+ setPos(QPoint(tick, y));
+ setBBox(QRect(tick, y, e.lenTick(), KH/2));
+ }
+
+//---------------------------------------------------------
+// addItem
+//---------------------------------------------------------
+
+void PianoCanvas::addItem(Part* part, Event& event)
+ {
+ if (signed(event.tick())<0) {
+ printf("ERROR: trying to add event before current part!\n");
+ return;
+ }
+
+ NEvent* ev = new NEvent(event, part, pitch2y(event.pitch()));
+ items.add(ev);
+
+ int diff = event.endTick()-part->lenTick();
+ if (diff > 0) {// too short part? extend it
+ //printf("addItem - this code should not be run!\n");
+ //Part* newPart = part->clone();
+ //newPart->setLenTick(newPart->lenTick()+diff);
+ //audio->msgChangePart(part, newPart,false);
+ //part = newPart;
+ part->setLenTick(part->lenTick()+diff);
+ }
+ }
+
+//---------------------------------------------------------
+// PianoCanvas
+//---------------------------------------------------------
+
+PianoCanvas::PianoCanvas(MidiEditor* pr, QWidget* parent, int sx, int sy)
+ : EventCanvas(pr, parent, sx, sy)
+ {
+ colorMode = 0;
+ cmdRange = 0; // all Events
+ playedPitch = -1;
+
+ songChanged(SC_TRACK_INSERTED);
+ connect(song, SIGNAL(midiNote(int, int)), SLOT(midiNote(int,int)));
+ }
+
+//---------------------------------------------------------
+// pitch2y
+//---------------------------------------------------------
+
+int PianoCanvas::pitch2y(int pitch) const
+ {
+ int tt[] = {
+ 5, 12, 19, 26, 33, 44, 51, 58, 64, 71, 78, 85
+ };
+ int y = (75 * KH) - (tt[pitch%12] + (7 * KH) * (pitch/12));
+ if (y < 0)
+ y = 0;
+ return y;
+ }
+
+//---------------------------------------------------------
+// y2pitch
+//---------------------------------------------------------
+
+int PianoCanvas::y2pitch(int y) const
+ {
+ const int total = (10 * 7 + 5) * KH; // 75 Ganztonschritte
+ y = total - y;
+ int oct = (y / (7 * KH)) * 12;
+ char kt[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 5
+ 1, 1, 1, 1, 1, 1, 1, // 13
+ 2, 2, 2, 2, 2, 2, // 19
+ 3, 3, 3, 3, 3, 3, 3, // 26
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, // 34
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, // 43
+ 6, 6, 6, 6, 6, 6, 6, // 52
+ 7, 7, 7, 7, 7, 7, // 58
+ 8, 8, 8, 8, 8, 8, 8, // 65
+ 9, 9, 9, 9, 9, 9, // 71
+ 10, 10, 10, 10, 10, 10, 10, // 78
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 // 87
+ };
+ return kt[y % 91] + oct;
+ }
+
+//---------------------------------------------------------
+// drawEvent
+// draws a note
+//---------------------------------------------------------
+
+void PianoCanvas::drawItem(QPainter& p, const CItem* item,
+ const QRect& rect)
+ {
+ QRect r = item->bbox();
+ if(!virt())
+ r.moveCenter(map(item->pos()));
+ r = r.intersect(rect);
+ if(!r.isValid())
+ return;
+ p.setPen(Qt::black);
+ struct Triple {
+ int r, g, b;
+ };
+
+ static Triple myColors /*Qt::color1*/[12] = { // ddskrjp
+ { 0xff, 0x3d, 0x39 },
+ { 0x39, 0xff, 0x39 },
+ { 0x39, 0x3d, 0xff },
+ { 0xff, 0xff, 0x39 },
+ { 0xff, 0x3d, 0xff },
+ { 0x39, 0xff, 0xff },
+ { 0xff, 0x7e, 0x7a },
+ { 0x7a, 0x7e, 0xff },
+ { 0x7a, 0xff, 0x7a },
+ { 0xff, 0x7e, 0xbf },
+ { 0x7a, 0xbf, 0xff },
+ { 0xff, 0xbf, 0x7a }
+ };
+
+ NEvent* nevent = (NEvent*) item;
+ Event event = nevent->event();
+ if (nevent->part() != curPart){
+ if(item->isMoving())
+ p.setBrush(Qt::gray);
+ else if(item->isSelected())
+ p.setBrush(Qt::black);
+ else
+ p.setBrush(Qt::lightGray);
+ }
+ else {
+ if (item->isMoving()) {
+ p.setBrush(Qt::gray);
+ }
+ else if (item->isSelected()) {
+ p.setBrush(Qt::black);
+ }
+ else {
+ QColor color;
+ color.setRgb(0, 0, 255);
+ switch(colorMode) {
+ case 0:
+ break;
+ case 1: // pitch
+ {
+ Triple* c = &myColors/*Qt::color1*/[event.pitch() % 12];
+ color.setRgb(c->r, c->g, c->b);
+ }
+ break;
+ case 2: // velocity
+ {
+ int velo = event.velo();
+ if (velo < 64)
+ color.setRgb(velo*4, 0, 0xff);
+ else
+ color.setRgb(0xff, 0, (127-velo) * 4);
+ }
+ break;
+ }
+ p.setBrush(color);
+ }
+ }
+ p.drawRect(r);
+ }
+
+
+//---------------------------------------------------------
+// drawMoving
+// draws moving items
+//---------------------------------------------------------
+
+void PianoCanvas::drawMoving(QPainter& p, const CItem* item, const QRect& rect)
+ {
+ //if(((NEvent*)item)->part() != curPart)
+ // return;
+ //if(!item->isMoving())
+ // return;
+ QRect mr = QRect(item->mp().x(), item->mp().y() - item->height()/2, item->width(), item->height());
+ mr = mr.intersect(rect);
+ if(!mr.isValid())
+ return;
+ p.setPen(Qt::black);
+ p.setBrush(Qt::NoBrush);
+ p.drawRect(mr);
+ }
+
+//---------------------------------------------------------
+// viewMouseDoubleClickEvent
+//---------------------------------------------------------
+
+void PianoCanvas::viewMouseDoubleClickEvent(QMouseEvent* event)
+ {
+ if ((_tool != PointerTool) && (event->button() != Qt::LeftButton)) {
+ mousePress(event);
+ return;
+ }
+ }
+
+//---------------------------------------------------------
+// moveCanvasItems
+//---------------------------------------------------------
+
+void PianoCanvas::moveCanvasItems(CItemList& items, int dp, int dx, DragType dtype, int* pflags)
+{
+ if(editor->parts()->empty())
+ return;
+
+ PartsToChangeMap parts2change;
+
+ int modified = 0;
+ for(iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip)
+ {
+ Part* part = ip->second;
+ if(!part)
+ continue;
+
+ int npartoffset = 0;
+ for(iCItem ici = items.begin(); ici != items.end(); ++ici)
+ {
+ CItem* ci = ici->second;
+ if(ci->part() != part)
+ continue;
+
+ int x = ci->pos().x() + dx;
+ int y = pitch2y(y2pitch(ci->pos().y()) + dp);
+ QPoint newpos = raster(QPoint(x, y));
+
+ // Test moving the item...
+ NEvent* nevent = (NEvent*) ci;
+ Event event = nevent->event();
+ x = newpos.x();
+ if(x < 0)
+ x = 0;
+ int ntick = editor->rasterVal(x) - part->tick();
+ if(ntick < 0)
+ ntick = 0;
+ int diff = ntick + event.lenTick() - part->lenTick();
+
+ // If moving the item would require a new part size...
+ if(diff > npartoffset)
+ npartoffset = diff;
+ }
+
+ if(npartoffset > 0)
+ {
+ // Create new part...
+ // if there are several events that are moved outside the part, it will be recreated for each
+ // so the part _in_ the event will not be valid, ask the authority.
+// Part* newPart = part->clone();
+ //Part* newPart = Canvas::part()->clone();
+
+// newPart->setLenTick(newPart->lenTick() + npartoffset);
+ //audio->msgChangePart(part, newPart,false);
+
+// modified = SC_PART_MODIFIED;
+
+ // BUG FIX: #1650953
+ // Added by T356.
+ // Fixes posted "select and drag past end of part - crashing" bug
+// for(iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip)
+// {
+// if(ip->second == part)
+// {
+// editor->parts()->erase(ip);
+// break;
+// }
+// }
+
+// editor->parts()->add(newPart);
+// audio->msgChangePart(part, newPart,false);
+
+ //if(parts2change.find(part) == parts2change.end())
+ // parts2change.insert(std::pair<Part*, Part*> (part, newPart));
+ iPartToChange ip2c = parts2change.find(part);
+ if(ip2c == parts2change.end())
+ {
+ PartToChange p2c = {0, npartoffset};
+ parts2change.insert(std::pair<Part*, PartToChange> (part, p2c));
+ }
+ else
+ ip2c->second.xdiff = npartoffset;
+
+ //part = newPart; // reassign
+ //item->setPart(part);
+ //item->setEvent(newEvent);
+ //curPart = part;
+ //curPartId = curPart->sn();
+
+ }
+ }
+
+ for(iPartToChange ip2c = parts2change.begin(); ip2c != parts2change.end(); ++ip2c)
+ {
+ Part* opart = ip2c->first;
+ int diff = ip2c->second.xdiff;
+
+ Part* newPart = opart->clone();
+
+ newPart->setLenTick(newPart->lenTick() + diff);
+
+ modified = SC_PART_MODIFIED;
+
+ // BUG FIX: #1650953
+ // Added by T356.
+ // Fixes posted "select and drag past end of part - crashing" bug
+ for(iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip)
+ {
+ if(ip->second == opart)
+ {
+ editor->parts()->erase(ip);
+ break;
+ }
+ }
+
+ editor->parts()->add(newPart);
+ // Indicate no undo, and do port controller values but not clone parts.
+ audio->msgChangePart(opart, newPart, false, true, false);
+
+ ip2c->second.npart = newPart;
+
+ }
+
+ iPartToChange icp = parts2change.find(curPart);
+ if(icp != parts2change.end())
+ {
+ curPart = icp->second.npart;
+ curPartId = curPart->sn();
+ }
+
+ std::vector< CItem* > doneList;
+ typedef std::vector< CItem* >::iterator iDoneList;
+
+ for(iCItem ici = items.begin(); ici != items.end(); ++ici)
+ {
+ CItem* ci = ici->second;
+
+ // If this item's part is in the parts2change list, change the item's part to the new part.
+ Part* pt = ci->part();
+ iPartToChange ip2c = parts2change.find(pt);
+ if(ip2c != parts2change.end())
+ ci->setPart(ip2c->second.npart);
+
+ int x = ci->pos().x();
+ int y = ci->pos().y();
+ int nx = x + dx;
+ int ny = pitch2y(y2pitch(y) + dp);
+ QPoint newpos = raster(QPoint(nx, ny));
+ selectItem(ci, true);
+
+ iDoneList idl;
+ for(idl = doneList.begin(); idl != doneList.end(); ++idl)
+ // This compares EventBase pointers to see if they're the same...
+ if((*idl)->event() == ci->event())
+ break;
+
+ // Do not process if the event has already been processed (meaning it's an event in a clone part)...
+ //if(moveItem(ci, newpos, dtype))
+ if(idl != doneList.end())
+ // Just move the canvas item.
+ ci->move(newpos);
+ else
+ {
+ // Currently moveItem always returns true.
+ if(moveItem(ci, newpos, dtype))
+ {
+ // Add the canvas item to the list of done items.
+ doneList.push_back(ci);
+ // Move the canvas item.
+ ci->move(newpos);
+ }
+ }
+
+ if(moving.size() == 1)
+ itemReleased(curItem, newpos);
+ if(dtype == MOVE_COPY || dtype == MOVE_CLONE)
+ selectItem(ci, false);
+ }
+
+ if(pflags)
+ *pflags = modified;
+}
+
+//---------------------------------------------------------
+// moveItem
+// called after moving an object
+//---------------------------------------------------------
+
+// Changed by T356.
+//bool PianoCanvas::moveItem(CItem* item, const QPoint& pos, DragType dtype, int* pflags)
+bool PianoCanvas::moveItem(CItem* item, const QPoint& pos, DragType dtype)
+ {
+ NEvent* nevent = (NEvent*) item;
+ Event event = nevent->event();
+ int npitch = y2pitch(pos.y());
+ Event newEvent = event.clone();
+ int x = pos.x();
+ if (x < 0)
+ x = 0;
+ if (event.pitch() != npitch && _playEvents) {
+ int port = track()->outPort();
+ int channel = track()->outChannel();
+ // release note:
+ MidiPlayEvent ev1(0, port, channel, 0x90, event.pitch() + track()->transposition, 0);
+ audio->msgPlayMidiEvent(&ev1);
+ MidiPlayEvent ev2(0, port, channel, 0x90, npitch + track()->transposition, event.velo());
+ audio->msgPlayMidiEvent(&ev2);
+ }
+
+ // Changed by T356.
+ Part* part = nevent->part(); //
+ //Part * part = Canvas::part(); // part can be dynamically recreated, ask the authority
+
+ newEvent.setPitch(npitch);
+ int ntick = editor->rasterVal(x) - part->tick();
+ if (ntick < 0)
+ ntick = 0;
+ newEvent.setTick(ntick);
+ newEvent.setLenTick(event.lenTick());
+
+ // Removed by T356.
+ /*
+ int modified=0;
+ //song->startUndo();
+ int diff = newEvent.endTick()-part->lenTick();
+ if (diff > 0){// too short part? extend it
+ // if there are several events that are moved outside the part, it will be recreated for each
+ // so the part _in_ the event will not be valid, ask the authority.
+ //Part* newPart = part->clone();
+ Part* newPart = Canvas::part()->clone();
+
+ newPart->setLenTick(newPart->lenTick()+diff);
+ audio->msgChangePart(Canvas::part(), newPart,false);
+
+ modified = SC_PART_MODIFIED;
+ part = newPart; // reassign
+
+ // BUG FIX: #1650953
+ // Added by T356.
+ // Fixes posted "select and drag past end of part - crashing" bug
+ for(iPart i = editor->parts()->begin(); i != editor->parts()->end(); ++i)
+ {
+ if(i->second == Canvas::part())
+ {
+ editor->parts()->erase(i);
+ break;
+ }
+ }
+ editor->parts()->add(part);
+ item->setPart(part);
+ item->setEvent(newEvent);
+ curPart = part;
+ curPartId = curPart->sn();
+
+ }
+ */
+
+ // Added by T356.
+ // msgAddEvent and msgChangeEvent (below) will set these, but set them here first?
+ //item->setPart(part);
+ item->setEvent(newEvent);
+
+ // Added by T356.
+ if(((int)newEvent.endTick() - (int)part->lenTick()) > 0)
+ printf("PianoCanvas::moveItem Error! New event end:%d exceeds length:%d of part:%s\n", newEvent.endTick(), part->lenTick(), part->name().latin1());
+
+ if (dtype == MOVE_COPY || dtype == MOVE_CLONE)
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgAddEvent(newEvent, part, false);
+ audio->msgAddEvent(newEvent, part, false, false, false);
+ else
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, part, false);
+ audio->msgChangeEvent(event, newEvent, part, false, false, false);
+ //song->endUndo(modified);
+
+ // Removed by T356.
+ //if(pflags)
+ // *pflags = modified;
+
+ return true;
+ }
+
+//---------------------------------------------------------
+// newItem(p, state)
+//---------------------------------------------------------
+
+CItem* PianoCanvas::newItem(const QPoint& p, int)
+ {
+ //printf("newItem point\n");
+ int pitch = y2pitch(p.y());
+ int tick = editor->rasterVal1(p.x());
+ int len = p.x() - tick;
+ tick -= curPart->tick();
+ if (tick < 0)
+ tick=0;
+ Event e = Event(Note);
+ e.setTick(tick);
+ e.setPitch(pitch);
+ e.setVelo(curVelo);
+ e.setLenTick(len);
+ return new NEvent(e, curPart, pitch2y(pitch));
+ }
+
+void PianoCanvas::newItem(CItem* item, bool noSnap)
+ {
+ //printf("newItem citem\n");
+ NEvent* nevent = (NEvent*) item;
+ Event event = nevent->event();
+ int x = item->x();
+ if (x<0)
+ x=0;
+ int w = item->width();
+
+ if (!noSnap) {
+ x = editor->rasterVal1(x); //round down
+ w = editor->rasterVal(x + w) - x;
+ if (w == 0)
+ w = editor->raster();
+ }
+ Part* part = nevent->part();
+ event.setTick(x - part->tick());
+ event.setLenTick(w);
+ event.setPitch(y2pitch(item->y()));
+
+ song->startUndo();
+ int modified=SC_EVENT_MODIFIED;
+ int diff = event.endTick()-part->lenTick();
+ if (diff > 0) {// too short part? extend it
+ //printf("extend Part!\n");
+ Part* newPart = part->clone();
+ newPart->setLenTick(newPart->lenTick()+diff);
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(part, newPart,false);
+ audio->msgChangePart(part, newPart, false, true, false);
+ modified=modified|SC_PART_MODIFIED;
+ part = newPart; // reassign
+ }
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgAddEvent(event, part,false);
+ audio->msgAddEvent(event, part, false, false, false);
+ song->endUndo(modified);
+ }
+
+//---------------------------------------------------------
+// resizeItem
+//---------------------------------------------------------
+
+void PianoCanvas::resizeItem(CItem* item, bool noSnap) // experimental changes to try dynamically extending parts
+ {
+ //printf("resizeItem!\n");
+ NEvent* nevent = (NEvent*) item;
+ Event event = nevent->event();
+ Event newEvent = event.clone();
+ int len;
+
+ Part* part = nevent->part();
+
+ if (noSnap)
+ len = nevent->width();
+ else {
+ //Part* part = nevent->part();
+ unsigned tick = event.tick() + part->tick();
+ len = editor->rasterVal(tick + nevent->width()) - tick;
+ if (len <= 0)
+ len = editor->raster();
+ }
+ song->startUndo();
+ int modified=SC_EVENT_MODIFIED;
+ //printf("event.tick()=%d len=%d part->lenTick()=%d\n",event.endTick(),len,part->lenTick());
+ int diff = event.tick()+len-part->lenTick();
+ if (diff > 0) {// too short part? extend it
+ //printf("extend Part!\n");
+ Part* newPart = part->clone();
+ newPart->setLenTick(newPart->lenTick()+diff);
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(part, newPart,false);
+ audio->msgChangePart(part, newPart, false, true, false);
+ modified=modified|SC_PART_MODIFIED;
+ part = newPart; // reassign
+ }
+
+ newEvent.setLenTick(len);
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, nevent->part(),false);
+ audio->msgChangeEvent(event, newEvent, nevent->part(), false, false, false);
+ song->endUndo(modified);
+ }
+
+//---------------------------------------------------------
+// deleteItem
+//---------------------------------------------------------
+
+bool PianoCanvas::deleteItem(CItem* item)
+ {
+ NEvent* nevent = (NEvent*) item;
+ if (nevent->part() == curPart) {
+ Event ev = nevent->event();
+ // Indicate do undo, and do not do port controller values and clone parts.
+ //audio->msgDeleteEvent(ev, curPart);
+ audio->msgDeleteEvent(ev, curPart, true, false, false);
+ return true;
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// pianoCmd
+//---------------------------------------------------------
+
+void PianoCanvas::pianoCmd(int cmd)
+ {
+ switch(cmd) {
+ case CMD_LEFT:
+ {
+ int frames = pos[0] - editor->rasterStep(pos[0]);
+ if (frames < 0)
+ frames = 0;
+ Pos p(frames,true);
+ song->setPos(0, p, true, true, true); //CDW
+ }
+ break;
+ case CMD_RIGHT:
+ {
+ Pos p(pos[0] + editor->rasterStep(pos[0]), true);
+ //if (p > part->tick())
+ // p = part->tick();
+ song->setPos(0, p, true, true, true); //CDW
+ }
+ break;
+ case CMD_INSERT:
+ {
+ if (pos[0] < start() || pos[0] >= end())
+ break;
+ MidiPart* part = (MidiPart*)curPart;
+
+ if (part == 0)
+ break;
+ song->startUndo();
+ EventList* el = part->events();
+
+ std::list <Event> elist;
+ for (iEvent e = el->lower_bound(pos[0] - part->tick()); e != el->end(); ++e)
+ elist.push_back((Event)e->second);
+ for (std::list<Event>::iterator i = elist.begin(); i != elist.end(); ++i) {
+ Event event = *i;
+ Event newEvent = event.clone();
+ newEvent.setTick(event.tick() + editor->raster());// - part->tick());
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, part, false);
+ audio->msgChangeEvent(event, newEvent, part, false, false, false);
+ }
+ song->endUndo(SC_EVENT_MODIFIED);
+ Pos p(editor->rasterVal(pos[0] + editor->rasterStep(pos[0])), true);
+ song->setPos(0, p, true, false, true);
+ }
+ return;
+ case CMD_DELETE:
+ if (pos[0] < start() || pos[0] >= end())
+ break;
+ {
+ MidiPart* part = (MidiPart*)curPart;
+ if (part == 0)
+ break;
+ song->startUndo();
+ EventList* el = part->events();
+
+ std::list<Event> elist;
+ for (iEvent e = el->lower_bound(pos[0]); e != el->end(); ++e)
+ elist.push_back((Event)e->second);
+ for (std::list<Event>::iterator i = elist.begin(); i != elist.end(); ++i) {
+ Event event = *i;
+ Event newEvent = event.clone();
+ newEvent.setTick(event.tick() - editor->raster() - part->tick());
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, part, false);
+ audio->msgChangeEvent(event, newEvent, part, false, false, false);
+ }
+ song->endUndo(SC_EVENT_MODIFIED);
+ Pos p(editor->rasterVal(pos[0] - editor->rasterStep(pos[0])), true);
+ song->setPos(0, p, true, false, true);
+ }
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// pianoPressed
+//---------------------------------------------------------
+
+void PianoCanvas::pianoPressed(int pitch, int velocity, bool shift)
+ {
+ int port = track()->outPort();
+ int channel = track()->outChannel();
+ pitch += track()->transposition;
+
+ // play note:
+ //MidiPlayEvent e(0, port, channel, 0x90, pitch, 127);
+ MidiPlayEvent e(0, port, channel, 0x90, pitch, velocity);
+ audio->msgPlayMidiEvent(&e);
+
+ if (_steprec && pos[0] >= start_tick && pos[0] < end_tick) {
+ if (curPart == 0)
+ return;
+ int len = editor->raster();
+ unsigned tick = pos[0] - curPart->tick(); //CDW
+ if (shift)
+ tick -= editor->rasterStep(tick);
+ Event e(Note);
+ e.setTick(tick);
+ e.setPitch(pitch);
+ e.setVelo(127);
+ e.setLenTick(len);
+ // Indicate do undo, and do not do port controller values and clone parts.
+ //audio->msgAddEvent(e, curPart);
+ audio->msgAddEvent(e, curPart, true, false, false);
+ tick += editor->rasterStep(tick) + curPart->tick();
+ if (tick != song->cpos()) {
+ Pos p(tick, true);
+ song->setPos(0, p, true, false, true);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// pianoReleased
+//---------------------------------------------------------
+
+void PianoCanvas::pianoReleased(int pitch, bool)
+ {
+ int port = track()->outPort();
+ int channel = track()->outChannel();
+ pitch += track()->transposition;
+
+ // release key:
+ MidiPlayEvent e(0, port, channel, 0x90, pitch, 0);
+ audio->msgPlayMidiEvent(&e);
+ }
+
+//---------------------------------------------------------
+// drawTickRaster
+//---------------------------------------------------------
+
+void drawTickRaster(QPainter& p, int x, int y, int w, int h, int raster)
+ {
+ int bar1, bar2, beat;
+ unsigned tick;
+ sigmap.tickValues(x, &bar1, &beat, &tick);
+ sigmap.tickValues(x+w, &bar2, &beat, &tick);
+ ++bar2;
+ int y2 = y + h;
+ for (int bar = bar1; bar < bar2; ++bar) {
+ unsigned x = sigmap.bar2tick(bar, 0, 0);
+ p.setPen(Qt::black);
+ p.drawLine(x, y, x, y2);
+ int z, n;
+ sigmap.timesig(x, z, n);
+ int q = p.xForm(QPoint(raster, 0)).x() - p.xForm(QPoint(0, 0)).x();
+ int qq = raster;
+ if (q < 8) // grid too dense
+ qq *= 2;
+ //switch (quant) {
+ // case 32:
+ // case 48:
+ // case 64:
+ // case 96:
+ // case 192: // 8tel
+ // case 128: // 8tel Triolen
+ // case 288:
+ p.setPen(Qt::lightGray);
+ if (raster>=4) {
+ int xx = x + qq;
+ int xxx = sigmap.bar2tick(bar, z, 0);
+ while (xx <= xxx) {
+ p.drawLine(xx, y, xx, y2);
+ xx += qq;
+ }
+ xx = xxx;
+ }
+ // break;
+ // default:
+ // break;
+ // }
+ p.setPen(Qt::gray);
+ for (int beat = 1; beat < z; beat++) {
+ int xx = sigmap.bar2tick(bar, beat, 0);
+ p.drawLine(xx, y, xx, y2);
+ }
+
+ }
+ }
+
+//---------------------------------------------------------
+// draw
+//---------------------------------------------------------
+
+void PianoCanvas::drawCanvas(QPainter& p, const QRect& rect)
+ {
+ int x = rect.x();
+ int y = rect.y();
+ int w = rect.width();
+ int h = rect.height();
+
+ //---------------------------------------------------
+ // horizontal lines
+ //---------------------------------------------------
+
+ int yy = ((y-1) / KH) * KH + KH;
+ int key = 75 - (yy / KH);
+ for (; yy < y + h; yy += KH) {
+ switch (key % 7) {
+ case 0:
+ case 3:
+ p.setPen(Qt::black);
+ p.drawLine(x, yy, x + w, yy);
+ break;
+ default:
+ //p.setPen(lightGray);
+ p.fillRect(x, yy-3, w, 6, QBrush(QColor(230,230,230)));
+ //p.drawLine(x, yy, x + w, yy);
+ break;
+ }
+ --key;
+ }
+
+ //---------------------------------------------------
+ // vertical lines
+ //---------------------------------------------------
+
+ drawTickRaster(p, x, y, w, h, editor->raster());
+ }
+
+//---------------------------------------------------------
+// cmd
+// pulldown menu commands
+//---------------------------------------------------------
+
+void PianoCanvas::cmd(int cmd, int quantStrength,
+ int quantLimit, bool quantLen, int range)
+ {
+ cmdRange = range;
+ switch (cmd) {
+ case CMD_CUT:
+ copy();
+ song->startUndo();
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (!(i->second->isSelected()))
+ continue;
+ NEvent* e = (NEvent*)(i->second);
+ Event ev = e->event();
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgDeleteEvent(ev, e->part(), false);
+ audio->msgDeleteEvent(ev, e->part(), false, false, false);
+ }
+ song->endUndo(SC_EVENT_REMOVED);
+ break;
+ case CMD_COPY:
+ copy();
+ break;
+ case CMD_PASTE:
+ paste();
+ break;
+ case CMD_DEL:
+ if (selectionSize()) {
+ song->startUndo();
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (!i->second->isSelected())
+ continue;
+ Event ev = i->second->event();
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgDeleteEvent(ev, i->second->part(), false);
+ audio->msgDeleteEvent(ev, i->second->part(), false, false, false);
+ }
+ song->endUndo(SC_EVENT_REMOVED);
+ }
+ return;
+ case CMD_OVER_QUANTIZE: // over quantize
+ quantize(100, 1, quantLen);
+ break;
+ case CMD_ON_QUANTIZE: // note on quantize
+ quantize(50, 1, false);
+ break;
+ case CMD_ONOFF_QUANTIZE: // note on/off quantize
+ quantize(50, 1, true);
+ break;
+ case CMD_ITERATIVE_QUANTIZE: // Iterative Quantize
+ quantize(quantStrength, quantLimit, quantLen);
+ break;
+ case CMD_SELECT_ALL: // select all
+ for (iCItem k = items.begin(); k != items.end(); ++k) {
+ if (!k->second->isSelected())
+ selectItem(k->second, true);
+ }
+ break;
+ case CMD_SELECT_NONE: // select none
+ deselectAll();
+ break;
+ case CMD_SELECT_INVERT: // invert selection
+ for (iCItem k = items.begin(); k != items.end(); ++k) {
+ selectItem(k->second, !k->second->isSelected());
+ }
+ break;
+ case CMD_SELECT_ILOOP: // select inside loop
+ for (iCItem k = items.begin(); k != items.end(); ++k) {
+ NEvent* nevent = (NEvent*)(k->second);
+ Part* part = nevent->part();
+ Event event = nevent->event();
+ unsigned tick = event.tick() + part->tick();
+ if (tick < song->lpos() || tick >= song->rpos())
+ selectItem(k->second, false);
+ else
+ selectItem(k->second, true);
+ }
+ break;
+ case CMD_SELECT_OLOOP: // select outside loop
+ for (iCItem k = items.begin(); k != items.end(); ++k) {
+ NEvent* nevent = (NEvent*)(k->second);
+ Part* part = nevent->part();
+ Event event = nevent->event();
+ unsigned tick = event.tick() + part->tick();
+ if (tick < song->lpos() || tick >= song->rpos())
+ selectItem(k->second, true);
+ else
+ selectItem(k->second, false);
+ }
+ break;
+ case CMD_SELECT_PREV_PART: // select previous part
+ {
+ Part* pt = editor->curCanvasPart();
+ Part* newpt = pt;
+ PartList* pl = editor->parts();
+ for(iPart ip = pl->begin(); ip != pl->end(); ++ip)
+ if(ip->second == pt)
+ {
+ if(ip == pl->begin())
+ ip = pl->end();
+ --ip;
+ newpt = ip->second;
+ break;
+ }
+ if(newpt != pt)
+ editor->setCurCanvasPart(newpt);
+ }
+ break;
+ case CMD_SELECT_NEXT_PART: // select next part
+ {
+ Part* pt = editor->curCanvasPart();
+ Part* newpt = pt;
+ PartList* pl = editor->parts();
+ for(iPart ip = pl->begin(); ip != pl->end(); ++ip)
+ if(ip->second == pt)
+ {
+ ++ip;
+ if(ip == pl->end())
+ ip = pl->begin();
+ newpt = ip->second;
+ break;
+ }
+ if(newpt != pt)
+ editor->setCurCanvasPart(newpt);
+ }
+ break;
+ case CMD_MODIFY_GATE_TIME:
+ {
+ GateTime w(this);
+ w.setRange(range);
+ if (!w.exec())
+ break;
+ int range = w.range(); // all, selected, looped, sel+loop
+ int rate = w.rateVal();
+ int offset = w.offsetVal();
+
+ song->startUndo();
+ for (iCItem k = items.begin(); k != items.end(); ++k) {
+ NEvent* nevent =(NEvent*)(k->second);
+ Event event = nevent->event();
+ if (event.type() != Note)
+ continue;
+ unsigned tick = event.tick();
+ bool selected = k->second->isSelected();
+ bool inLoop = (tick >= song->lpos()) && (tick < song->rpos());
+
+ if ((range == 0)
+ || (range == 1 && selected)
+ || (range == 2 && inLoop)
+ || (range == 3 && selected && inLoop)) {
+ unsigned int len = event.lenTick(); //prevent compiler warning: comparison singed/unsigned
+
+ len = rate ? (len * 100) / rate : 1;
+ len += offset;
+ if (len < 1)
+ len = 1;
+
+ if (event.lenTick() != len) {
+ Event newEvent = event.clone();
+ newEvent.setLenTick(len);
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, nevent->part(), false);
+ audio->msgChangeEvent(event, newEvent, nevent->part(), false, false, false);
+ }
+ }
+ }
+ song->endUndo(SC_EVENT_MODIFIED);
+ }
+ break;
+
+ case CMD_MODIFY_VELOCITY:
+ {
+ Velocity w(this);
+ w.setRange(range);
+ if (!w.exec())
+ break;
+ int range = w.range(); // all, selected, looped, sel+loop
+ int rate = w.rateVal();
+ int offset = w.offsetVal();
+
+ song->startUndo();
+ for (iCItem k = items.begin(); k != items.end(); ++k) {
+ NEvent* nevent = (NEvent*)(k->second);
+ Event event = nevent->event();
+ if (event.type() != Note)
+ continue;
+ unsigned tick = event.tick();
+ bool selected = k->second->isSelected();
+ bool inLoop = (tick >= song->lpos()) && (tick < song->rpos());
+
+ if ((range == 0)
+ || (range == 1 && selected)
+ || (range == 2 && inLoop)
+ || (range == 3 && selected && inLoop)) {
+ int velo = event.velo();
+
+ //velo = rate ? (velo * 100) / rate : 64;
+ velo = (velo * rate) / 100;
+ velo += offset;
+
+ if (velo <= 0)
+ velo = 1;
+ if (velo > 127)
+ velo = 127;
+ if (event.velo() != velo) {
+ Event newEvent = event.clone();
+ newEvent.setVelo(velo);
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, nevent->part(), false);
+ audio->msgChangeEvent(event, newEvent, nevent->part(), false, false, false);
+ }
+ }
+ }
+ song->endUndo(SC_EVENT_MODIFIED);
+ }
+ break;
+
+ case CMD_FIXED_LEN: //Set notes to the length specified in the drummap
+ if (!selectionSize())
+ break;
+ song->startUndo();
+ for (iCItem k = items.begin(); k != items.end(); ++k) {
+ if (k->second->isSelected()) {
+ NEvent* nevent = (NEvent*)(k->second);
+ Event event = nevent->event();
+ Event newEvent = event.clone();
+ newEvent.setLenTick(editor->raster());
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, nevent->part() , false);
+ audio->msgChangeEvent(event, newEvent, nevent->part(), false, false, false);
+ }
+ }
+ song->endUndo(SC_EVENT_MODIFIED);
+ break;
+
+ case CMD_DELETE_OVERLAPS:
+ if (!selectionSize())
+ break;
+
+ song->startUndo();
+ for (iCItem k = items.begin(); k != items.end(); k++) {
+ if (k->second->isSelected() == false)
+ continue;
+
+ NEvent* e1 = (NEvent*) (k->second); // first note
+ NEvent* e2 = NULL; // ptr to next selected note (which will be checked for overlap)
+ Event ce1 = e1->event();
+ Event ce2;
+
+ if (ce1.type() != Note)
+ continue;
+
+ // Find next selected item on the same pitch
+ iCItem l = k; l++;
+ for (; l != items.end(); l++) {
+ if (l->second->isSelected() == false)
+ continue;
+
+ e2 = (NEvent*) l->second;
+ ce2 = e2->event();
+
+ // Same pitch?
+ if (ce1.dataA() == ce2.dataA())
+ break;
+
+ // If the note has the same len and place we treat it as a duplicate note and not a following note
+ // The best thing to do would probably be to delete the duplicate note, we just want to avoid
+ // matching against the same note
+ if ( ce1.tick() + e1->part()->tick() == ce2.tick() + e2->part()->tick()
+ && ce1.lenTick() + e1->part()->tick() == ce2.lenTick() + e2->part()->tick())
+ {
+ e2 = NULL; // this wasn't what we were looking for
+ continue;
+ }
+
+ }
+
+ if (e2 == NULL) // None found
+ break;
+
+ Part* part1 = e1->part();
+ Part* part2 = e2->part();
+ if (ce2.type() != Note)
+ continue;
+
+
+ unsigned event1pos = ce1.tick() + part1->tick();
+ unsigned event1end = event1pos + ce1.lenTick();
+ unsigned event2pos = ce2.tick() + part2->tick();
+
+ //printf("event1pos %u event1end %u event2pos %u\n", event1pos, event1end, event2pos);
+ if (event1end > event2pos) {
+ Event newEvent = ce1.clone();
+ unsigned newlen = ce1.lenTick() - (event1end - event2pos);
+ //printf("newlen: %u\n", newlen);
+ newEvent.setLenTick(newlen);
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(ce1, newEvent, e1->part(), false);
+ audio->msgChangeEvent(ce1, newEvent, e1->part(), false, false, false);
+ }
+ }
+ song->endUndo(SC_EVENT_MODIFIED);
+ break;
+
+
+ case CMD_CRESCENDO:
+ case CMD_TRANSPOSE:
+ case CMD_THIN_OUT:
+ case CMD_ERASE_EVENT:
+ case CMD_NOTE_SHIFT:
+ case CMD_MOVE_CLOCK:
+ case CMD_COPY_MEASURE:
+ case CMD_ERASE_MEASURE:
+ case CMD_DELETE_MEASURE:
+ case CMD_CREATE_MEASURE:
+ break;
+ default:
+// printf("unknown ecanvas cmd %d\n", cmd);
+ break;
+ }
+ updateSelection();
+ redraw();
+ }
+
+//---------------------------------------------------------
+// quantize
+//---------------------------------------------------------
+
+void PianoCanvas::quantize(int strength, int limit, bool quantLen)
+ {
+ song->startUndo();
+ for (iCItem k = items.begin(); k != items.end(); ++k) {
+ NEvent* nevent = (NEvent*)(k->second);
+ Event event = nevent->event();
+ Part* part = nevent->part();
+ if (event.type() != Note)
+ continue;
+
+ if ((cmdRange & CMD_RANGE_SELECTED) && !k->second->isSelected())
+ continue;
+
+ unsigned tick = event.tick() + part->tick();
+
+ if ((cmdRange & CMD_RANGE_LOOP)
+ && ((tick < song->lpos() || tick >= song->rpos())))
+ continue;
+
+ unsigned int len = event.lenTick(); //prevent compiler warning: comparison singed/unsigned
+ int tick2 = tick + len;
+
+ // quant start position
+ int diff = sigmap.raster(tick, editor->quant()) - tick;
+ if (abs(diff) > limit)
+ tick += ((diff * strength) / 100);
+
+ // quant len
+ diff = sigmap.raster(tick2, editor->quant()) - tick2;
+ if (quantLen && (abs(diff) > limit))
+ len += ((diff * strength) / 100);
+
+ // something changed?
+ if (((event.tick() + part->tick()) != tick) || (event.lenTick() != len)) {
+ Event newEvent = event.clone();
+ newEvent.setTick(tick - part->tick());
+ newEvent.setLenTick(len);
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, part, false);
+ audio->msgChangeEvent(event, newEvent, part, false, false, false);
+ }
+ }
+ song->endUndo(SC_EVENT_MODIFIED);
+ }
+
+//---------------------------------------------------------
+// midiNote
+//---------------------------------------------------------
+
+void PianoCanvas::midiNote(int pitch, int velo)
+ {
+ if (_midiin && _steprec && curPart
+ && !audio->isPlaying() && velo && pos[0] >= start_tick
+ && pos[0] < end_tick
+ && !(globalKeyState & Qt::AltButton)) {
+ unsigned int len = editor->quant();//prevent compiler warning: comparison singed/unsigned
+ unsigned tick = pos[0]; //CDW
+ unsigned starttick = tick;
+ if (globalKeyState & Qt::ShiftButton)
+ tick -= editor->rasterStep(tick);
+
+ //
+ // extend len of last note?
+ //
+ EventList* events = curPart->events();
+ if (globalKeyState & Qt::ControlButton) {
+ for (iEvent i = events->begin(); i != events->end(); ++i) {
+ Event ev = i->second;
+ if (!ev.isNote())
+ continue;
+ if (ev.pitch() == pitch && ((ev.tick() + ev.lenTick()) == /*(int)*/starttick)) {
+ Event e = ev.clone();
+ e.setLenTick(ev.lenTick() + editor->rasterStep(starttick));
+ // Indicate do undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(ev, e, curPart);
+ audio->msgChangeEvent(ev, e, curPart, true, false, false);
+ tick += editor->rasterStep(tick);
+ if (tick != song->cpos()) {
+ Pos p(tick, true);
+ song->setPos(0, p, true, false, true);
+ }
+ return;
+ }
+ }
+ }
+
+ //
+ // if we already entered the note, delete it
+ //
+ EventRange range = events->equal_range(tick);
+ for (iEvent i = range.first; i != range.second; ++i) {
+ Event ev = i->second;
+ if (ev.isNote() && ev.pitch() == pitch) {
+ // Indicate do undo, and do not do port controller values and clone parts.
+ //audio->msgDeleteEvent(ev, curPart);
+ audio->msgDeleteEvent(ev, curPart, true, false, false);
+ if (globalKeyState & Qt::ShiftButton)
+ tick += editor->rasterStep(tick);
+ return;
+ }
+ }
+ Event e(Note);
+ e.setTick(tick - curPart->tick());
+ e.setPitch(pitch);
+ e.setVelo(velo);
+ e.setLenTick(len);
+ // Indicate do undo, and do not do port controller values and clone parts.
+ //audio->msgAddEvent(e, curPart);
+ audio->msgAddEvent(e, curPart, true, false, false);
+ tick += editor->rasterStep(tick);
+ if (tick != song->cpos()) {
+ Pos p(tick, true);
+ song->setPos(0, p, true, false, true);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// getTextDrag
+//---------------------------------------------------------
+
+Q3TextDrag* PianoCanvas::getTextDrag(QWidget* parent)
+ {
+ //---------------------------------------------------
+ // generate event list from selected events
+ //---------------------------------------------------
+
+ EventList el;
+ unsigned startTick = MAXINT;
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (!i->second->isSelected())
+ continue;
+ NEvent* ne = (NEvent*)(i->second);
+ Event e = ne->event();
+ if (startTick == MAXINT)
+ startTick = e.tick();
+ el.add(e);
+ }
+
+ //---------------------------------------------------
+ // write events as XML into tmp file
+ //---------------------------------------------------
+
+ FILE* tmp = tmpfile();
+ if (tmp == 0) {
+ fprintf(stderr, "PianoCanvas::copy() fopen failed: %s\n",
+ strerror(errno));
+ return 0;
+ }
+ Xml xml(tmp);
+
+ int level = 0;
+ xml.tag(level++, "eventlist");
+ for (ciEvent e = el.begin(); e != el.end(); ++e)
+ e->second.write(level, xml, -startTick);
+ xml.etag(--level, "eventlist");
+
+ //---------------------------------------------------
+ // read tmp file into QTextDrag Object
+ //---------------------------------------------------
+
+ fflush(tmp);
+ struct stat f_stat;
+ if (fstat(fileno(tmp), &f_stat) == -1) {
+ fprintf(stderr, "PianoCanvas::copy() fstat failes:<%s>\n",
+ strerror(errno));
+ fclose(tmp);
+ return 0;
+ }
+ int n = f_stat.st_size;
+ char* fbuf = (char*)mmap(0, n+1, PROT_READ|PROT_WRITE,
+ MAP_PRIVATE, fileno(tmp), 0);
+ fbuf[n] = 0;
+ Q3TextDrag* drag = new Q3TextDrag(QString(fbuf), parent);
+ drag->setSubtype("eventlist");
+ munmap(fbuf, n);
+ fclose(tmp);
+ return drag;
+ }
+
+//---------------------------------------------------------
+// copy
+// cut copy paste
+//---------------------------------------------------------
+
+void PianoCanvas::copy()
+ {
+ Q3TextDrag* drag = getTextDrag(0);
+ if (drag)
+ QApplication::clipboard()->setData(drag, QClipboard::Clipboard);
+ }
+
+//---------------------------------------------------------
+// paste
+//---------------------------------------------------------
+
+void PianoCanvas::pasteAt(const QString& pt, int pos)
+ {
+ const char* p = pt.latin1();
+ Xml xml(p);
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "eventlist") {
+ song->startUndo();
+ EventList* el = new EventList();
+ el->read(xml, "eventlist", true);
+ int modified = SC_EVENT_INSERTED;
+ for (iEvent i = el->begin(); i != el->end(); ++i) {
+ Event e = i->second;
+ int tick = e.tick() + pos - curPart->tick();
+ if (tick<0) {
+ printf("ERROR: trying to add event before current part!\n");
+ song->endUndo(SC_EVENT_INSERTED);
+ delete el;
+ return;
+ }
+
+ e.setTick(tick);
+ int diff = e.endTick()-curPart->lenTick();
+ if (diff > 0) {// too short part? extend it
+ Part* newPart = curPart->clone();
+ newPart->setLenTick(newPart->lenTick()+diff);
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(curPart, newPart,false);
+ audio->msgChangePart(curPart, newPart, false, true, false);
+ modified=modified|SC_PART_MODIFIED;
+ curPart = newPart; // reassign
+ }
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgAddEvent(e, curPart, false);
+ audio->msgAddEvent(e, curPart, false, false, false);
+ }
+ song->endUndo(modified);
+ delete el;
+ return;
+ }
+ else
+ xml.unknown("pasteAt");
+ break;
+ case Xml::Attribut:
+ case Xml::TagEnd:
+ default:
+ break;
+ }
+ }
+ }
+//---------------------------------------------------------
+// paste
+// paste events
+//---------------------------------------------------------
+
+void PianoCanvas::paste()
+ {
+ //Q3CString subtype("eventlist"); ddskrjo
+ QString subtype("eventlist");
+ QMimeSource* ms = QApplication::clipboard()->data(QClipboard::Clipboard);
+ QString pt;
+ if (!Q3TextDrag::decode(ms, pt, subtype)) {
+ printf("cannot paste: bad data type\n");
+ return;
+ }
+ pasteAt(pt, song->cpos());
+ }
+
+//---------------------------------------------------------
+// startDrag
+//---------------------------------------------------------
+
+void PianoCanvas::startDrag(CItem* /* item*/, bool copymode)
+ {
+ Q3TextDrag* drag = getTextDrag(this);
+ if (drag) {
+// QApplication::clipboard()->setData(drag, QClipboard::Clipboard);
+
+ if (copymode)
+ drag->dragCopy();
+ else
+ drag->dragMove();
+ }
+ }
+
+//---------------------------------------------------------
+// dragEnterEvent
+//---------------------------------------------------------
+
+void PianoCanvas::dragEnterEvent(QDragEnterEvent* event)
+ {
+ event->accept(Q3TextDrag::canDecode(event));
+ }
+
+//---------------------------------------------------------
+// dragMoveEvent
+//---------------------------------------------------------
+
+void PianoCanvas::dragMoveEvent(QDragMoveEvent*)
+ {
+// printf("drag move %x\n", this);
+ }
+
+//---------------------------------------------------------
+// dragLeaveEvent
+//---------------------------------------------------------
+
+void PianoCanvas::dragLeaveEvent(QDragLeaveEvent*)
+ {
+// printf("drag leave\n");
+ }
+
+//---------------------------------------------------------
+// dropEvent
+//---------------------------------------------------------
+
+void PianoCanvas::viewDropEvent(QDropEvent* event)
+ {
+ QString text;
+ if (event->source() == this) {
+ printf("local DROP\n");
+ return;
+ }
+ if (Q3TextDrag::decode(event, text)) {
+ int x = editor->rasterVal(event->pos().x());
+ if (x < 0)
+ x = 0;
+ pasteAt(text, x);
+ }
+ else {
+ printf("cannot decode drop\n");
+ }
+ }
+
+//---------------------------------------------------------
+// itemPressed
+//---------------------------------------------------------
+
+void PianoCanvas::itemPressed(const CItem* item)
+ {
+ if (!_playEvents)
+ return;
+
+ int port = track()->outPort();
+ int channel = track()->outChannel();
+ NEvent* nevent = (NEvent*) item;
+ Event event = nevent->event();
+ playedPitch = event.pitch() + track()->transposition;
+ int velo = event.velo();
+
+ // play note:
+ MidiPlayEvent e(0, port, channel, 0x90, playedPitch, velo);
+ audio->msgPlayMidiEvent(&e);
+ }
+
+//---------------------------------------------------------
+// itemReleased
+//---------------------------------------------------------
+
+void PianoCanvas::itemReleased(const CItem*, const QPoint&)
+ {
+ if (!_playEvents)
+ return;
+ int port = track()->outPort();
+ int channel = track()->outChannel();
+
+ // release note:
+ MidiPlayEvent ev(0, port, channel, 0x90, playedPitch, 0);
+ audio->msgPlayMidiEvent(&ev);
+ playedPitch = -1;
+ }
+
+//---------------------------------------------------------
+// itemMoved
+//---------------------------------------------------------
+
+void PianoCanvas::itemMoved(const CItem* item, const QPoint& pos)
+ {
+ int npitch = y2pitch(pos.y());
+ if ((playedPitch != -1) && (playedPitch != npitch)) {
+ int port = track()->outPort();
+ int channel = track()->outChannel();
+ NEvent* nevent = (NEvent*) item;
+ Event event = nevent->event();
+
+ // release note:
+ MidiPlayEvent ev1(0, port, channel, 0x90, playedPitch, 0);
+ audio->msgPlayMidiEvent(&ev1);
+ // play note:
+ MidiPlayEvent e2(0, port, channel, 0x90, npitch + track()->transposition, event.velo());
+ audio->msgPlayMidiEvent(&e2);
+ playedPitch = npitch + track()->transposition;
+ }
+ }
+
+//---------------------------------------------------------
+// curPartChanged
+//---------------------------------------------------------
+
+void PianoCanvas::curPartChanged()
+ {
+ editor->setCaption(getCaption());
+ }
+
+//---------------------------------------------------------
+// modifySelected
+//---------------------------------------------------------
+
+void PianoCanvas::modifySelected(NoteInfo::ValType type, int delta)
+ {
+ audio->msgIdle(true);
+ song->startUndo();
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (!(i->second->isSelected()))
+ continue;
+ NEvent* e = (NEvent*)(i->second);
+ Event event = e->event();
+ if (event.type() != Note)
+ continue;
+
+ MidiPart* part = (MidiPart*)(e->part());
+ Event newEvent = event.clone();
+
+ switch (type) {
+ case NoteInfo::VAL_TIME:
+ {
+ int newTime = event.tick() + delta;
+ if (newTime < 0)
+ newTime = 0;
+ newEvent.setTick(newTime);
+ }
+ break;
+ case NoteInfo::VAL_LEN:
+ {
+ int len = event.lenTick() + delta;
+ if (len < 1)
+ len = 1;
+ newEvent.setLenTick(len);
+ }
+ break;
+ case NoteInfo::VAL_VELON:
+ {
+ int velo = event.velo() + delta;
+ if (velo > 127)
+ velo = 127;
+ else if (velo < 0)
+ velo = 0;
+ newEvent.setVelo(velo);
+ }
+ break;
+ case NoteInfo::VAL_VELOFF:
+ {
+ int velo = event.veloOff() + delta;
+ if (velo > 127)
+ velo = 127;
+ else if (velo < 0)
+ velo = 0;
+ newEvent.setVeloOff(velo);
+ }
+ break;
+ case NoteInfo::VAL_PITCH:
+ {
+ int pitch = event.pitch() + delta;
+ if (pitch > 127)
+ pitch = 127;
+ else if (pitch < 0)
+ pitch = 0;
+ newEvent.setPitch(pitch);
+ }
+ break;
+ }
+ song->changeEvent(event, newEvent, part);
+ // Indicate do not do port controller values and clone parts.
+ //song->undoOp(UndoOp::ModifyEvent, newEvent, event, part);
+ song->undoOp(UndoOp::ModifyEvent, newEvent, event, part, false, false);
+ }
+ song->endUndo(SC_EVENT_MODIFIED);
+ audio->msgIdle(false);
+ }
+
diff --git a/muse2/muse/midiedit/prcanvas.h b/muse2/muse/midiedit/prcanvas.h
new file mode 100644
index 00000000..2f50be2e
--- /dev/null
+++ b/muse2/muse/midiedit/prcanvas.h
@@ -0,0 +1,113 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: prcanvas.h,v 1.5.2.6 2009/11/16 11:29:33 lunar_shuttle Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __PRCANVAS_H__
+#define __PRCANVAS_H__
+
+#include "ecanvas.h"
+#include "pianoroll.h"
+//Added by qt3to4:
+#include <QDragEnterEvent>
+#include <QDropEvent>
+#include <QMouseEvent>
+#include <QDragMoveEvent>
+#include <QDragLeaveEvent>
+
+#define KH 13
+
+//---------------------------------------------------------
+// NEvent
+// ''visual'' Note Event
+//---------------------------------------------------------
+
+class NEvent : public CItem {
+ public:
+ NEvent(Event& e, Part* p, int y);
+ };
+
+class ScrollScale;
+class PianoRoll;
+class Q3TextDrag;
+class QRect;
+
+//---------------------------------------------------------
+// PianoCanvas
+//---------------------------------------------------------
+
+class PianoCanvas : public EventCanvas {
+ int cmdRange;
+ int colorMode;
+ int playedPitch;
+
+ Q_OBJECT
+ virtual void viewMouseDoubleClickEvent(QMouseEvent*);
+ virtual void drawItem(QPainter&, const CItem*, const QRect&);
+ virtual void drawMoving(QPainter&, const CItem*, const QRect&);
+ virtual void moveCanvasItems(CItemList&, int, int, DragType, int*);
+ // Changed by T356.
+ //virtual bool moveItem(CItem*, const QPoint&, DragType, int*);
+ virtual bool moveItem(CItem*, const QPoint&, DragType);
+ virtual CItem* newItem(const QPoint&, int);
+ virtual void resizeItem(CItem*, bool noSnap);
+ virtual void newItem(CItem*, bool noSnap);
+ virtual bool deleteItem(CItem*);
+ virtual void startDrag(CItem* item, bool copymode);
+ virtual void dragEnterEvent(QDragEnterEvent* event);
+ virtual void dragMoveEvent(QDragMoveEvent*);
+ virtual void dragLeaveEvent(QDragLeaveEvent*);
+ virtual void viewDropEvent(QDropEvent* event);
+ virtual void addItem(Part*, Event&);
+
+ int y2pitch(int) const;
+ int pitch2y(int) const;
+ virtual void drawCanvas(QPainter&, const QRect&);
+ void quantize(int, int, bool);
+ void copy();
+ void paste();
+ void pasteAt(const QString& pt, int pos);
+ Q3TextDrag* getTextDrag(QWidget*);
+ virtual void itemPressed(const CItem*);
+ virtual void itemReleased(const CItem*, const QPoint&);
+ virtual void itemMoved(const CItem*, const QPoint&);
+ virtual void curPartChanged();
+
+ private slots:
+ void midiNote(int pitch, int velo);
+
+ signals:
+ void quantChanged(int);
+ void rasterChanged(int);
+
+ public slots:
+ void pianoCmd(int);
+ void pianoPressed(int pitch, int velocity, bool shift);
+ void pianoReleased(int pitch, bool);
+
+ public:
+ enum {
+ CMD_CUT, CMD_COPY, CMD_PASTE, CMD_DEL,
+ CMD_OVER_QUANTIZE, CMD_ON_QUANTIZE, CMD_ONOFF_QUANTIZE,
+ CMD_ITERATIVE_QUANTIZE,
+ CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT,
+ CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART,
+ CMD_MODIFY_GATE_TIME, CMD_MODIFY_VELOCITY,
+ CMD_CRESCENDO, CMD_TRANSPOSE, CMD_THIN_OUT, CMD_ERASE_EVENT,
+ CMD_NOTE_SHIFT, CMD_MOVE_CLOCK, CMD_COPY_MEASURE,
+ CMD_ERASE_MEASURE, CMD_DELETE_MEASURE, CMD_CREATE_MEASURE,
+ CMD_FIXED_LEN, CMD_DELETE_OVERLAPS
+ };
+
+ PianoCanvas(MidiEditor*, QWidget*, int, int);
+ void cmd(int, int, int, bool, int);
+ void setColorMode(int mode) {
+ colorMode = mode;
+ redraw();
+ }
+ virtual void modifySelected(NoteInfo::ValType type, int delta);
+ };
+#endif
+
diff --git a/muse2/muse/midiedit/quantconfig.cpp b/muse2/muse/midiedit/quantconfig.cpp
new file mode 100644
index 00000000..f00b713f
--- /dev/null
+++ b/muse2/muse/midiedit/quantconfig.cpp
@@ -0,0 +1,59 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: quantconfig.cpp,v 1.2 2004/04/24 14:58:52 wschweer Exp $
+//
+// (C) Copyright 1999/2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qspinbox.h>
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qradiobutton.h>
+#include <q3groupbox.h>
+#include <q3whatsthis.h>
+
+#include "quantconfig.h"
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+
+const char* wtStrengthTxt = QT_TR_NOOP("sets amount of quantization:\n"
+ "0 - no quantization\n"
+ "100 - full quantization");
+const char* wtQLimitTxt = QT_TR_NOOP("don't quantize notes above this tick limit");
+const char* wtQLenTxt = QT_TR_NOOP("quantize also note len as default");
+
+//---------------------------------------------------------
+// QuantConfig
+//---------------------------------------------------------
+
+QuantConfig::QuantConfig(int s, int l, bool lenFlag)
+ : QDialog()
+ {
+ setCaption(tr("MusE: Config Quantize"));
+ Q3VBoxLayout* layout = new Q3VBoxLayout(this);
+ Q3GroupBox* gb = new Q3GroupBox(2, Qt::Horizontal, tr("Config Quantize"), this);
+ layout->addWidget(gb);
+
+ QLabel* l1 = new QLabel(tr("Strength"), gb);
+ QSpinBox* sb1 = new QSpinBox(0, 100, 1, gb);
+ sb1->setSuffix(QString("%"));
+ sb1->setValue(s);
+ QLabel* l2 = new QLabel(tr("Donīt Quantize"), gb);
+ QSpinBox* sb2 = new QSpinBox(0, 500, 1, gb);
+ sb2->setValue(l);
+ QLabel* l3 = new QLabel(tr("Quant Len"), gb);
+ QRadioButton* but = new QRadioButton(gb);
+ but->setChecked(lenFlag);
+ connect(sb1, SIGNAL(valueChanged(int)), SIGNAL(setQuantStrength(int)));
+ connect(sb2, SIGNAL(valueChanged(int)), SIGNAL(setQuantLimit(int)));
+ connect(but, SIGNAL(toggled(bool)), SIGNAL(setQuantLen(bool)));
+
+ Q3WhatsThis::add(l1, tr(wtStrengthTxt));
+ Q3WhatsThis::add(sb1, tr(wtStrengthTxt));
+ Q3WhatsThis::add(l2, tr(wtQLimitTxt));
+ Q3WhatsThis::add(sb2, tr(wtQLimitTxt));
+ Q3WhatsThis::add(l3, tr(wtQLenTxt));
+ Q3WhatsThis::add(but, tr(wtQLenTxt));
+ }
+
diff --git a/muse2/muse/midiedit/quantconfig.h b/muse2/muse/midiedit/quantconfig.h
new file mode 100644
index 00000000..31ab2285
--- /dev/null
+++ b/muse2/muse/midiedit/quantconfig.h
@@ -0,0 +1,32 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: quantconfig.h,v 1.1.1.1 2003/10/27 18:52:23 wschweer Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __QCONFIG_H__
+#define __QCONFIG_H__
+
+#include <qdialog.h>
+
+//---------------------------------------------------------
+// QuantConfig
+//---------------------------------------------------------
+
+class QuantConfig : public QDialog {
+ Q_OBJECT
+
+ signals:
+ void setQuantStrength(int);
+ void setQuantLimit(int);
+ void setQuantLen(bool);
+
+ public:
+ QuantConfig(int, int, bool);
+ };
+
+
+#endif
+
diff --git a/muse2/muse/midieditor.cpp b/muse2/muse/midieditor.cpp
new file mode 100644
index 00000000..60a95643
--- /dev/null
+++ b/muse2/muse/midieditor.cpp
@@ -0,0 +1,237 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midieditor.cpp,v 1.2.2.2 2009/02/02 21:38:00 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "midieditor.h"
+#include "midiedit/ecanvas.h"
+#include "waveedit/waveview.h"
+#include "scrollscale.h"
+#include "mtscale.h"
+#include <qlayout.h>
+#include <qrect.h>
+#include <qcolor.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include "xml.h"
+#include "part.h"
+#include "track.h"
+#include "song.h"
+
+//---------------------------------------------------------
+// MidiEditor
+//---------------------------------------------------------
+
+MidiEditor::MidiEditor(int q, int r, PartList* pl,
+ QWidget* parent, const char* name) : TopWin(parent, name)
+ {
+ _pl = pl;
+ if (_pl)
+ for (iPart i = _pl->begin(); i != _pl->end(); ++i)
+ _parts.push_back(i->second->sn());
+ _quant = q;
+ _raster = r;
+ canvas = 0;
+ wview = 0;
+ _curDrumInstrument = -1;
+ mainw = new QWidget(this);
+ mainGrid = new Q3GridLayout(mainw);
+ setCentralWidget(mainw);
+ }
+
+//---------------------------------------------------------
+// genPartlist
+//---------------------------------------------------------
+
+void MidiEditor::genPartlist()
+ {
+ _pl->clear();
+ for (std::list<int>::iterator i = _parts.begin(); i != _parts.end(); ++i) {
+ TrackList* tl = song->tracks();
+ for (iTrack it = tl->begin(); it != tl->end(); ++it) {
+ PartList* pl = (*it)->parts();
+ iPart ip;
+ for (ip = pl->begin(); ip != pl->end(); ++ip) {
+ if (ip->second->sn() == *i) {
+ _pl->add(ip->second);
+ break;
+ }
+ }
+ if (ip != pl->end())
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// MidiEditor
+//---------------------------------------------------------
+
+MidiEditor::~MidiEditor()
+ {
+ if (_pl)
+ delete _pl;
+ }
+
+//---------------------------------------------------------
+// quantVal
+//---------------------------------------------------------
+
+int MidiEditor::quantVal(int v) const
+ {
+ int val = ((v+_quant/2)/_quant)*_quant;
+ if (val == 0)
+ val = _quant;
+ return val;
+ }
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void MidiEditor::readStatus(Xml& xml)
+ {
+ if (_pl == 0)
+ _pl = new PartList;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ QString tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "quant")
+ _quant = xml.parseInt();
+ else if (tag == "raster")
+ _raster = xml.parseInt();
+ else if (tag == "topwin")
+ TopWin::readStatus(xml);
+ else
+ xml.unknown("MidiEditor");
+ break;
+ case Xml::TagEnd:
+ if (tag == "midieditor")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// writePartList
+//---------------------------------------------------------
+
+void MidiEditor::writePartList(int level, Xml& xml) const
+ {
+ for (ciPart p = _pl->begin(); p != _pl->end(); ++p) {
+ Part* part = p->second;
+ Track* track = part->track();
+ int trkIdx = song->tracks()->index(track);
+ int partIdx = track->parts()->index(part);
+
+ if((trkIdx == -1) || (partIdx == -1))
+ printf("MidiEditor::writePartList error: trkIdx:%d partIdx:%d\n", trkIdx, partIdx);
+
+ xml.put(level, "<part>%d:%d</part>", trkIdx, partIdx);
+ }
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void MidiEditor::writeStatus(int level, Xml& xml) const
+ {
+ xml.tag(level++, "midieditor");
+ TopWin::writeStatus(level, xml);
+ xml.intTag(level, "quant", _quant);
+ xml.intTag(level, "raster", _raster);
+ xml.tag(level, "/midieditor");
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void MidiEditor::songChanged(int type)
+ {
+
+ if (type) {
+ if (type & (SC_PART_REMOVED | SC_PART_MODIFIED
+ | SC_PART_INSERTED | SC_TRACK_REMOVED)) {
+ genPartlist();
+ // close window if editor has no parts anymore
+ if (parts()->empty()) {
+ close(false);
+ return;
+ }
+ }
+ if (canvas)
+ canvas->songChanged(type);
+ else if (wview)
+ wview->songChanged(type);
+
+ if (type & (SC_PART_REMOVED | SC_PART_MODIFIED
+ | SC_PART_INSERTED | SC_TRACK_REMOVED)) {
+
+ updateHScrollRange();
+ if (canvas)
+ setCaption(canvas->getCaption());
+ else if (wview)
+ setCaption(wview->getCaption());
+ if (type & SC_SIG)
+ time->update();
+
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// setCurDrumInstrument
+//---------------------------------------------------------
+
+void MidiEditor::setCurDrumInstrument(int instr)
+ {
+ _curDrumInstrument = instr;
+ emit curDrumInstrumentChanged(_curDrumInstrument);
+ }
+
+//---------------------------------------------------------
+// curCanvasPart
+//---------------------------------------------------------
+
+Part* MidiEditor::curCanvasPart()
+{
+ if(canvas)
+ return canvas->part();
+ else
+ return 0;
+}
+
+//---------------------------------------------------------
+// curWavePart
+//---------------------------------------------------------
+
+WavePart* MidiEditor::curWavePart()
+{
+ if(wview)
+ return wview->part();
+ else
+ return 0;
+}
+
+//---------------------------------------------------------
+// setCurCanvasPart
+//---------------------------------------------------------
+
+void MidiEditor::setCurCanvasPart(Part* part)
+{
+ if(canvas)
+ canvas->setCurrentPart(part);
+}
+
diff --git a/muse2/muse/midieditor.h b/muse2/muse/midieditor.h
new file mode 100644
index 00000000..16520698
--- /dev/null
+++ b/muse2/muse/midieditor.h
@@ -0,0 +1,86 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midieditor.h,v 1.3.2.2 2009/02/02 21:38:00 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MIDIEDITOR_H__
+#define __MIDIEDITOR_H__
+
+#include "sig.h"
+#include "cobject.h"
+//Added by qt3to4:
+#include <Q3GridLayout>
+
+class PartList;
+class Xml;
+class Q3GridLayout;
+class QWidget;
+class QColor;
+class EventCanvas;
+class ScrollScale;
+class CtrlEdit;
+class MTScale;
+class WaveView;
+class Part;
+class WavePart;
+
+//---------------------------------------------------------
+// MidiEditor
+//---------------------------------------------------------
+
+class MidiEditor : public TopWin {
+ Q_OBJECT
+
+ PartList* _pl;
+ std::list<int> _parts;
+ int _curDrumInstrument; // currently selected instrument if drum
+ // editor
+ protected:
+ ScrollScale* hscroll;
+ ScrollScale* vscroll;
+ MTScale* time;
+ EventCanvas* canvas;
+ WaveView* wview;
+
+ std::list<CtrlEdit*> ctrlEditList;
+ int _quant, _raster;
+ Q3GridLayout* mainGrid;
+ QWidget* mainw;
+ virtual void readStatus(Xml&);
+ virtual void writeStatus(int, Xml&) const;
+ void writePartList(int, Xml&) const;
+ void genPartlist();
+
+ public slots:
+ void songChanged(int type);
+ void setCurDrumInstrument(int instr);
+
+ virtual void updateHScrollRange() { };
+ signals:
+ void curDrumInstrumentChanged(int);
+
+ public:
+ MidiEditor(int, int, PartList*,
+ QWidget* parent = 0, const char* name = 0);
+ ~MidiEditor();
+
+ int quantVal(int v) const;
+ int rasterStep(unsigned tick) const { return sigmap.rasterStep(tick, _raster); }
+ unsigned rasterVal(unsigned v) const { return sigmap.raster(v, _raster); }
+ unsigned rasterVal1(unsigned v) const { return sigmap.raster1(v, _raster); }
+ unsigned rasterVal2(unsigned v) const { return sigmap.raster2(v, _raster); }
+ int quant() const { return _quant; }
+ void setQuant(int val) { _quant = val; }
+ int raster() const { return _raster; }
+ void setRaster(int val) { _raster = val; }
+ PartList* parts() { return _pl; }
+ int curDrumInstrument() const { return _curDrumInstrument; }
+ Part* curCanvasPart();
+ WavePart* curWavePart();
+ void setCurCanvasPart(Part*);
+ };
+
+#endif
+
diff --git a/muse2/muse/midievent.cpp b/muse2/muse/midievent.cpp
new file mode 100644
index 00000000..8f2b0756
--- /dev/null
+++ b/muse2/muse/midievent.cpp
@@ -0,0 +1,175 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midievent.cpp,v 1.7.2.2 2009/05/24 21:43:44 terminator356 Exp $
+//
+// (C) Copyright 2000-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "event.h"
+#include "midievent.h"
+#include "xml.h"
+#include "mpevent.h"
+#include "midictrl.h"
+
+//---------------------------------------------------------
+// MidiEventBase
+//---------------------------------------------------------
+
+MidiEventBase::MidiEventBase(EventType t)
+ : EventBase(t)
+ {
+ a = 0;
+ b = 0;
+ c = 0;
+ }
+
+//---------------------------------------------------------
+// MidiEventBase::mid
+//---------------------------------------------------------
+
+EventBase* MidiEventBase::mid(unsigned b, unsigned e)
+ {
+ if (tick() < b || tick() >= e)
+ return 0;
+ return new MidiEventBase(*this);
+ }
+
+//---------------------------------------------------------
+// isNoteOff
+//---------------------------------------------------------
+
+bool MidiEventBase::isNoteOff() const
+ {
+ return (type() == Note && (velo() == 0));
+ }
+
+bool MidiEventBase::isNoteOff(const Event& e) const
+ {
+ return (e.isNoteOff() && (e.pitch() == a));
+ }
+
+void MidiEventBase::dump(int n) const
+ {
+ EventBase::dump(n);
+ const char* p;
+
+ switch(type()) {
+ case Note: p = "Note "; break;
+ case Controller: p = "Ctrl "; break;
+ case Sysex: p = "Sysex "; break;
+ case PAfter: p = "PAfter "; break;
+ case CAfter: p = "CAfter "; break;
+ case Meta: p = "Meta "; break;
+ default: p = "?? "; break;
+ }
+ for (int i = 0; i < (n+2); ++i)
+ putchar(' ');
+ printf("<%s> a:0x%x(%d) b:0x%x(%d) c:0x%x(%d)\n",
+ p, a, a, b, b, c, c);
+ }
+
+//---------------------------------------------------------
+// MidiEventBase::write
+//---------------------------------------------------------
+
+//void MidiEventBase::write(int level, Xml& xml, const Pos& offset) const
+void MidiEventBase::write(int level, Xml& xml, const Pos& offset, bool /*forcePath*/) const
+ {
+ xml.nput(level++, "<event tick=\"%d\"", tick() + offset.tick());
+ switch (type()) {
+ case Note:
+ xml.nput(" len=\"%d\"", lenTick());
+ break;
+ default:
+ xml.nput(" type=\"%d\"", type());
+ break;
+ }
+
+ // Changed by T356. BUG: *.med does not save meta event types - ID: 2879426
+ if (a)
+ xml.nput(" a=\"%d\"", a);
+ if (b)
+ xml.nput(" b=\"%d\"", b);
+ if (c)
+ xml.nput(" c=\"%d\"", c);
+
+ if (edata.dataLen) {
+ xml.nput(" datalen=\"%d\">\n", edata.dataLen);
+ xml.nput(level, "");
+ for (int i = 0; i < edata.dataLen; ++i)
+ xml.nput("%02x ", edata.data[i] & 0xff);
+ xml.nput("\n");
+ xml.tag(level, "/event");
+ }
+ else {
+ //if (a)
+ // xml.nput(" a=\"%d\"", a);
+ //if (b)
+ // xml.nput(" b=\"%d\"", b);
+ //if (c)
+ // xml.nput(" c=\"%d\"", c);
+ xml.nput(" />\n");
+ }
+ }
+
+//---------------------------------------------------------
+// MidiEventBase::read
+//---------------------------------------------------------
+
+void MidiEventBase::read(Xml& xml)
+ {
+ setType(Note);
+ a = 0;
+ b = 0;
+ c = 0;
+
+ int dataLen = 0;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ xml.unknown("Event");
+ break;
+ case Xml::Text:
+ {
+ const char*s = tag.latin1();
+ edata.data = new unsigned char[dataLen];
+ edata.dataLen = dataLen;
+ unsigned char* d = edata.data;
+ for (int i = 0; i < dataLen; ++i) {
+ char* endp;
+ *d++ = strtol(s, &endp, 16);
+ s = endp;
+ }
+ }
+ break;
+ case Xml::Attribut:
+ if (tag == "tick")
+ setTick(xml.s2().toInt());
+ else if (tag == "type")
+ setType(EventType(xml.s2().toInt()));
+ else if (tag == "len")
+ setLenTick(xml.s2().toInt());
+ else if (tag == "a")
+ a = xml.s2().toInt();
+ else if (tag == "b")
+ b = xml.s2().toInt();
+ else if (tag == "c")
+ c = xml.s2().toInt();
+ else if (tag == "datalen")
+ dataLen = xml.s2().toInt();
+ break;
+ case Xml::TagEnd:
+ if (tag == "event")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
diff --git a/muse2/muse/midievent.h b/muse2/muse/midievent.h
new file mode 100644
index 00000000..48217f57
--- /dev/null
+++ b/muse2/muse/midievent.h
@@ -0,0 +1,62 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midievent.h,v 1.7.2.1 2009/05/24 21:43:44 terminator356 Exp $
+//
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MIDI_EVENT_H__
+#define __MIDI_EVENT_H__
+
+#include "eventbase.h"
+
+//---------------------------------------------------------
+// MidiEventBase
+//---------------------------------------------------------
+
+class MidiEventBase : public EventBase {
+ int a, b, c; // pitch, velo-on, velo-off
+ EvData edata;
+
+ virtual EventBase* clone() { return new MidiEventBase(*this); }
+
+ public:
+ MidiEventBase(EventType t);
+ virtual ~MidiEventBase() {}
+
+ virtual bool isNote() const { return type() == Note; }
+ virtual bool isNoteOff() const;
+ virtual bool isNoteOff(const Event&) const;
+ virtual int pitch() const { return a; }
+ virtual int program() const { return a; }
+ virtual int cntrl() const { return a; }
+ virtual int dataA() const { return a; }
+ virtual void setA(int val) { a = val; }
+ virtual void setPitch(int v) { a = v; }
+
+ virtual int cntrlVal() const { return b; }
+ virtual int dataB() const { return b; }
+ virtual int velo() const { return b; }
+ virtual void setB(int val) { b = val; }
+ virtual void setVelo(int v) { b = v; }
+
+ virtual int veloOff() const { return c; }
+ virtual int dataC() const { return c; }
+ virtual void setC(int val) { c = val; }
+ virtual void setVeloOff(int v) { c = v; }
+
+ virtual const unsigned char* data() const { return edata.data; }
+ virtual int dataLen() const { return edata.dataLen; }
+ virtual void setData(const unsigned char* data, int len) { edata.setData(data, len); }
+ virtual const EvData eventData() const { return edata; }
+
+ virtual void dump(int n = 0) const;
+ virtual void read(Xml&);
+ //virtual void write(int, Xml&, const Pos& offset) const;
+ virtual void write(int, Xml&, const Pos& offset, bool forcePath = false) const;
+ virtual EventBase* mid(unsigned, unsigned);
+ };
+
+#endif
+
diff --git a/muse2/muse/midifile.cpp b/muse2/muse/midifile.cpp
new file mode 100644
index 00000000..319152d7
--- /dev/null
+++ b/muse2/muse/midifile.cpp
@@ -0,0 +1,678 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midifile.cpp,v 1.17 2004/06/18 08:36:43 wschweer Exp $
+//
+// (C) Copyright 1999-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <errno.h>
+#include <values.h>
+#include <assert.h>
+
+#include "song.h"
+#include "midi.h"
+#include "midifile.h"
+#include "drummap.h"
+#include "event.h"
+#include "globals.h"
+#include "midictrl.h"
+#include "marker/marker.h"
+#include "midiport.h"
+#include "midictrl.h"
+#include "mpevent.h"
+#include "gconfig.h"
+
+const char* errString[] = {
+ "no Error",
+ "unexpected EOF",
+ "read Error",
+ "write Error",
+ "bad midifile: 'MTrk' expected",
+ "bad midifile: 'MThd' expected",
+ "bad midi fileformat",
+ };
+
+enum ERROR {
+ MF_NO_ERROR,
+ MF_EOF,
+ MF_READ,
+ MF_WRITE,
+ MF_MTRK,
+ MF_MTHD,
+ MF_FORMAT,
+ };
+
+//---------------------------------------------------------
+// error
+//---------------------------------------------------------
+
+QString MidiFile::error()
+ {
+ return QString(errString[_error]);
+ }
+
+//---------------------------------------------------------
+// MidiFile
+//---------------------------------------------------------
+
+MidiFile::MidiFile(FILE* f)
+ {
+ fp = f;
+ curPos = 0;
+ _mtype = MT_UNKNOWN;
+ _error = MF_NO_ERROR;
+ _tracks = new MidiFileTrackList;
+ }
+
+MidiFile::~MidiFile()
+ {
+ delete _tracks;
+ }
+
+//---------------------------------------------------------
+// read
+// return true on error
+//---------------------------------------------------------
+
+bool MidiFile::read(void* p, size_t len)
+ {
+ for (;;) {
+ curPos += len;
+ size_t rv = fread(p, 1, len, fp);
+ if (rv == len)
+ return false;
+ if (feof(fp)) {
+ _error = MF_EOF;
+ return true;
+ }
+ _error = MF_READ;
+ return true;
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// write
+// return true on error
+//---------------------------------------------------------
+
+bool MidiFile::write(const void* p, size_t len)
+ {
+ size_t rv = fwrite(p, 1, len, fp);
+ if (rv == len)
+ return false;
+ _error = MF_WRITE;
+ return true;
+ }
+
+//---------------------------------------------------------
+// writeShort
+// return true on error
+//---------------------------------------------------------
+
+bool MidiFile::writeShort(int i)
+ {
+ short format = BE_SHORT(i);
+ return write(&format, 2);
+ }
+
+//---------------------------------------------------------
+// writeLong
+// return true on error
+//---------------------------------------------------------
+
+bool MidiFile::writeLong(int i)
+ {
+ int format = BE_LONG(i);
+ return write(&format, 4);
+ }
+
+//---------------------------------------------------------
+// readShort
+//---------------------------------------------------------
+
+int MidiFile::readShort()
+ {
+ short format;
+ read(&format, 2);
+ return BE_SHORT(format);
+ }
+
+//---------------------------------------------------------
+// readLong
+// writeLong
+//---------------------------------------------------------
+
+int MidiFile::readLong()
+ {
+ int format;
+ read(&format, 4);
+ return BE_LONG(format);
+ }
+
+/*---------------------------------------------------------
+ * skip
+ * This is meant for skipping a few bytes in a
+ * file or fifo.
+ *---------------------------------------------------------*/
+
+bool MidiFile::skip(size_t len)
+ {
+ char tmp[len];
+ return read(tmp, len);
+ }
+
+/*---------------------------------------------------------
+ * getvl
+ * Read variable-length number (7 bits per byte, MSB first)
+ *---------------------------------------------------------*/
+
+int MidiFile::getvl()
+ {
+ int l = 0;
+ for (int i = 0; i < 16; i++) {
+ uchar c;
+ if (read(&c, 1))
+ return -1;
+ l += (c & 0x7f);
+ if (!(c & 0x80))
+ return l;
+ l <<= 7;
+ }
+ return -1;
+ }
+
+/*---------------------------------------------------------
+ * putvl
+ * Write variable-length number (7 bits per byte, MSB first)
+ *---------------------------------------------------------*/
+
+void MidiFile::putvl(unsigned val)
+ {
+ unsigned long buf = val & 0x7f;
+ while ((val >>= 7) > 0) {
+ buf <<= 8;
+ buf |= 0x80;
+ buf += (val & 0x7f);
+ }
+ for (;;) {
+ put(buf);
+ if (buf & 0x80)
+ buf >>= 8;
+ else
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// readTrack
+// return true on error
+//---------------------------------------------------------
+
+bool MidiFile::readTrack(MidiFileTrack* t)
+ {
+ MPEventList* el = &(t->events);
+ char tmp[4];
+ if (read(tmp, 4))
+ return true;
+ if (memcmp(tmp, "MTrk", 4)) {
+ _error = MF_MTRK;
+ return true;
+ }
+ int len = readLong(); // len
+ int endPos = curPos + len;
+ status = -1;
+ sstatus = -1; // running status, not reset scanning meta or sysex
+ click = 0;
+
+ int port = 0;
+ int channel = 0;
+
+ for (;;) {
+ MidiPlayEvent event;
+ lastport = -1;
+ lastchannel = -1;
+
+ int rv = readEvent(&event, t);
+ if (lastport != -1) {
+ port = lastport;
+ if (port >= MIDI_PORTS) {
+ printf("port %d >= %d, reset to 0\n", port, MIDI_PORTS);
+ port = 0;
+ }
+ }
+ if (lastchannel != -1) {
+ channel = lastchannel;
+ if (channel >= MIDI_CHANNELS) {
+ printf("channel %d >= %d, reset to 0\n", port, MIDI_CHANNELS);
+ channel = 0;
+ }
+ }
+ if (rv == 0)
+ break;
+ else if (rv == -1)
+ continue;
+ else if (rv == -2) // error
+ return true;
+
+ event.setPort(port);
+ if (event.type() == ME_SYSEX || event.type() == ME_META)
+ event.setChannel(channel);
+ else
+ channel = event.channel();
+ el->add(event);
+ }
+ int end = curPos;
+ if (end != endPos) {
+ printf("MidiFile::readTrack(): TRACKLEN does not fit %d+%d != %d, %d too much\n",
+ endPos-len, len, end, endPos-end);
+ if (end < endPos)
+ skip(endPos - end);
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// readEvent
+// returns:
+// 0 End of track
+// -1 Event filtered
+// -2 Error
+//---------------------------------------------------------
+
+int MidiFile::readEvent(MidiPlayEvent* event, MidiFileTrack* t)
+ {
+ uchar me, type, a, b;
+
+ int nclick = getvl();
+ if (nclick == -1) {
+ printf("readEvent: error 1\n");
+ return 0;
+ }
+ click += nclick;
+ for (;;) {
+ if (read(&me, 1)) {
+ printf("readEvent: error 2\n");
+ return 0;
+ }
+ if (me >= 0xf8 && me <= 0xfe)
+ printf("Midi: Real Time Message 0x%02x??\n", me & 0xff);
+ else
+ break;
+ }
+
+ event->setTime(click);
+ int len;
+ unsigned char* buffer;
+
+ if ((me & 0xf0) == 0xf0) {
+ if (me == 0xf0 || me == 0xf7) {
+ //
+ // SYSEX
+ //
+ status = -1; // no running status
+ len = getvl();
+ if (len == -1) {
+ printf("readEvent: error 3\n");
+ return -2;
+ }
+ buffer = new unsigned char[len];
+ if (read(buffer, len)) {
+ printf("readEvent: error 4\n");
+ delete[] buffer;
+ return -2;
+ }
+ if (buffer[len-1] != 0xf7) {
+ printf("SYSEX endet nicht mit 0xf7!\n");
+ // Forstsetzung folgt?
+ }
+ else
+ --len; // don't count 0xf7
+ event->setType(ME_SYSEX);
+ event->setData(buffer, len);
+ if (((unsigned)len == gmOnMsgLen) && memcmp(buffer, gmOnMsg, gmOnMsgLen) == 0) {
+ setMType(MT_GM);
+ return -1;
+ }
+ if (((unsigned)len == gsOnMsgLen) && memcmp(buffer, gsOnMsg, gsOnMsgLen) == 0) {
+ setMType(MT_GS);
+ return -1;
+ }
+ if (((unsigned)len == xgOnMsgLen) && memcmp(buffer, xgOnMsg, xgOnMsgLen) == 0) {
+ setMType(MT_XG);
+ return -1;
+ }
+ if (buffer[0] == 0x41) { // Roland
+ if (mtype() != MT_UNKNOWN)
+ setMType(MT_GS);
+ }
+ else if (buffer[0] == 0x43) { // Yamaha
+ if (mtype() == MT_UNKNOWN || mtype() == MT_GM)
+ setMType(MT_XG);
+ int type = buffer[1] & 0xf0;
+ switch (type) {
+ case 0x00: // bulk dump
+ buffer[1] = 0;
+ break;
+ case 0x10:
+ if (buffer[1] != 0x10) {
+ buffer[1] = 0x10; // fix to Device 1
+ }
+ if (len == 7 && buffer[2] == 0x4c && buffer[3] == 0x08 && buffer[5] == 7) {
+ // part mode
+ // 0 - normal
+ // 1 - DRUM
+ // 2 - DRUM 1
+ // 3 - DRUM 2
+ // 4 - DRUM 3
+ // 5 - DRUM 4
+ printf("xg set part mode channel %d to %d\n", buffer[4]+1, buffer[6]);
+ if (buffer[6] != 0)
+ t->isDrumTrack = true;
+ }
+ break;
+ case 0x20:
+ printf("YAMAHA DUMP REQUEST\n");
+ return -1;
+ case 0x30:
+ printf("YAMAHA PARAMETER REQUEST\n");
+ return -1;
+ default:
+ printf("YAMAHA unknown SYSEX: data[2]=%02x\n", buffer[1]);
+ return -1;
+ }
+ }
+ return 3;
+ }
+ if (me == 0xff) {
+ //
+ // META
+ //
+ status = -1; // no running status
+ if (read(&type, 1)) { // read type
+ printf("readEvent: error 5\n");
+ return -2;
+ }
+ len = getvl(); // read len
+ if (len == -1) {
+ printf("readEvent: error 6\n");
+ return -2;
+ }
+ buffer = new unsigned char[len+1];
+ if (len) {
+ if (read(buffer, len)) {
+ printf("readEvent: error 7\n");
+ delete[] buffer;
+ return -2;
+ }
+ }
+ buffer[len] = 0;
+ switch(type) {
+ case 0x21: // switch port
+ lastport = buffer[0];
+ delete[] buffer;
+ return -1;
+ case 0x20: // switch channel
+ lastchannel = buffer[0];
+ delete[] buffer;
+ return -1;
+ case 0x2f: // End of Track
+ delete[] buffer;
+ return 0;
+ default:
+ event->setType(ME_META);
+ event->setData(buffer, len+1);
+ event->setA(type);
+ return 3;
+ }
+ }
+ else {
+ printf("Midi: unknown Message 0x%02x\n", me & 0xff);
+ return -1;
+ }
+ }
+
+ if (me & 0x80) { // status byte
+ status = me;
+ sstatus = status;
+ if (read(&a, 1)) {
+ printf("readEvent: error 9\n");
+ return -2;
+ }
+ a &= 0x7F;
+ }
+ else {
+ if (status == -1) {
+ printf("readEvent: no running status, read 0x%02x sstatus %x\n", me, sstatus);
+ if (sstatus == -1)
+ return -1;
+ status = sstatus;
+ }
+ a = me;
+ }
+ b = 0;
+ switch (status & 0xf0) {
+ case ME_NOTEOFF:
+ case ME_NOTEON:
+ case ME_POLYAFTER:
+ case ME_CONTROLLER:
+ case ME_PITCHBEND:
+ if (read(&b, 1)) {
+ printf("readEvent: error 15\n");
+ return -2;
+ }
+ event->setB(b & 0x80 ? 0 : b);
+ break;
+ case ME_PROGRAM:
+ case ME_AFTERTOUCH:
+ break;
+ default: // f1 f2 f3 f4 f5 f6 f7 f8 f9
+ printf("BAD STATUS 0x%02x, me 0x%02x\n", status, me);
+ return -2;
+ }
+ event->setA(a & 0x7f);
+ event->setType(status & 0xf0);
+ event->setChannel(status & 0xf);
+ if ((a & 0x80) || (b & 0x80)) {
+ printf("8'tes Bit in Daten(%02x %02x): tick %d read 0x%02x status:0x%02x\n",
+ a & 0xff, b & 0xff, click, me, status);
+ printf("readEvent: error 16\n");
+ if (b & 0x80) {
+ // Try to fix: interpret as channel byte
+ status = b & 0xf0;
+ sstatus = status;
+ return 3;
+ }
+ return -1;
+ }
+ if (event->type() == ME_PITCHBEND) {
+ int val = (event->dataB() << 7) + event->dataA();
+ val -= 8192;
+ event->setA(val);
+ }
+ return 3;
+ }
+
+//---------------------------------------------------------
+// writeTrack
+//---------------------------------------------------------
+
+bool MidiFile::writeTrack(const MidiFileTrack* t)
+ {
+ //FIXME: By T356 01/19/2010
+ // If saving as a compressed file (gz or bz2),
+ // the file is a pipe, and pipes can't seek !
+ // This results in a corrupted midi file.
+ // So exporting compressed midi has been disabled (elsewhere)
+ // for now...
+
+ const MPEventList* events = &(t->events);
+ write("MTrk", 4);
+ int lenpos = ftell(fp);
+ writeLong(0); // dummy len
+
+ status = -1;
+ int tick = 0;
+ for (iMPEvent i = events->begin(); i != events->end(); ++i) {
+ int ntick = i->time();
+ if (ntick < tick) {
+ printf("MidiFile::writeTrack: ntick %d < tick %d\n", ntick, tick);
+ ntick = tick;
+ }
+ putvl(((ntick - tick) * config.midiDivision + config.division/2)/config.division);
+ tick = ntick;
+ writeEvent(&(*i));
+ }
+
+ //---------------------------------------------------
+ // write "End Of Track" Meta
+ // write Track Len
+ //
+
+ putvl(0);
+ put(0xff); // Meta
+ put(0x2f); // EOT
+ putvl(0); // len 0
+ int endpos = ftell(fp);
+ fseek(fp, lenpos, SEEK_SET);
+ writeLong(endpos-lenpos-4); // tracklen
+ fseek(fp, endpos, SEEK_SET);
+ return false;
+ }
+
+//---------------------------------------------------------
+// writeEvent
+//---------------------------------------------------------
+
+void MidiFile::writeEvent(const MidiPlayEvent* event)
+ {
+ int c = event->channel();
+ int nstat = event->type();
+
+ // we dont save meta data into smf type 0 files:
+
+ if (config.smfFormat == 0 && nstat == ME_META)
+ return;
+
+ nstat |= c;
+ //
+ // running status; except for Sysex- and Meta Events
+ //
+ if (((nstat & 0xf0) != 0xf0) && (nstat != status)) {
+ status = nstat;
+ put(nstat);
+ }
+ switch (event->type()) {
+ case ME_NOTEOFF:
+ case ME_NOTEON:
+ case ME_POLYAFTER:
+ case ME_CONTROLLER:
+ case ME_PITCHBEND:
+ put(event->dataA());
+ put(event->dataB());
+ break;
+ case ME_PROGRAM: // Program Change
+ case ME_AFTERTOUCH: // Channel Aftertouch
+ put(event->dataA());
+ break;
+ case ME_SYSEX:
+ put(0xf0);
+ putvl(event->len() + 1); // including 0xf7
+ write(event->data(), event->len());
+ put(0xf7);
+ status = -1; // invalidate running status
+ break;
+ case ME_META:
+ put(0xff);
+ put(event->dataA());
+ putvl(event->len());
+ write(event->data(), event->len());
+ status = -1;
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// write
+// returns true on error
+//---------------------------------------------------------
+
+bool MidiFile::write()
+ {
+ write("MThd", 4);
+ writeLong(6); // header len
+ writeShort(config.smfFormat);
+ if (config.smfFormat == 0) {
+ writeShort(1);
+ MidiFileTrack dst;
+ for (iMidiFileTrack i = _tracks->begin(); i != _tracks->end(); ++i) {
+ MPEventList* sl = &((*i)->events);
+ for (iMPEvent ie = sl->begin(); ie != sl->end(); ++ie)
+ dst.events.add(*ie);
+ }
+ writeShort(1);
+ writeShort(_division);
+ writeTrack(&dst);
+ }
+ else {
+ writeShort(ntracks);
+
+ writeShort(_division);
+ for (ciMidiFileTrack i = _tracks->begin(); i != _tracks->end(); ++i)
+ writeTrack(*i);
+ }
+ return (ferror(fp) != 0);
+ }
+
+//---------------------------------------------------------
+// readMidi
+// returns true on error
+//---------------------------------------------------------
+
+bool MidiFile::read()
+ {
+ _error = MF_NO_ERROR;
+ int i;
+ char tmp[4];
+
+ if (read(tmp, 4))
+ return true;
+ int len = readLong();
+ if (memcmp(tmp, "MThd", 4) || len < 6) {
+ _error = MF_MTHD;
+ return true;
+ }
+ format = readShort();
+ ntracks = readShort();
+ _division = readShort();
+
+ if (_division < 0)
+ _division = (-(_division/256)) * (_division & 0xff);
+ if (len > 6)
+ skip(len-6); // skip excess bytes
+
+ switch (format) {
+ case 0:
+ {
+ MidiFileTrack* t = new MidiFileTrack;
+ _tracks->push_back(t);
+ if (readTrack(t))
+ return true;
+ }
+ break;
+ case 1:
+ for (i = 0; i < ntracks; i++) {
+ MidiFileTrack* t = new MidiFileTrack;
+ _tracks->push_back(t);
+ if (readTrack(t))
+ return true;
+ }
+ break;
+ default:
+ _error = MF_FORMAT;
+ return true;
+ }
+ return false;
+ }
+
diff --git a/muse2/muse/midifile.h b/muse2/muse/midifile.h
new file mode 100644
index 00000000..da71a00a
--- /dev/null
+++ b/muse2/muse/midifile.h
@@ -0,0 +1,113 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midifile.h,v 1.3 2004/01/04 18:24:43 wschweer Exp $
+//
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MIDIFILE_H__
+#define __MIDIFILE_H__
+
+#include <stdio.h>
+#include <list>
+
+#include "globaldefs.h"
+#include "mpevent.h"
+
+struct MPEventList;
+class MidiPlayEvent;
+
+//---------------------------------------------------------
+// MidiFileTrack
+//---------------------------------------------------------
+
+struct MidiFileTrack {
+ MPEventList events;
+ bool isDrumTrack;
+ MidiFileTrack() {
+ isDrumTrack = false;
+ }
+ };
+
+typedef std::list<MidiFileTrack*> MidiFileTrackList;
+typedef MidiFileTrackList::iterator iMidiFileTrack;
+typedef MidiFileTrackList::const_iterator ciMidiFileTrack;
+
+//---------------------------------------------------------
+// MidiFile
+//---------------------------------------------------------
+
+class MidiFile {
+ int _error;
+ int format; // smf file format
+ int ntracks; // number of midi tracks
+ int _division;
+ MType _mtype;
+ MidiFileTrackList* _tracks;
+
+ int status, click;
+ int sstatus;
+ int lastport, lastchannel;
+ FILE* fp;
+ int curPos;
+
+ bool read(void*, size_t);
+ bool write(const void*, size_t);
+ void put(unsigned char c) { write(&c, 1); }
+ bool skip(size_t);
+ int readShort();
+ bool writeShort(int);
+ int readLong();
+ bool writeLong(int);
+ int getvl();
+ void putvl(unsigned);
+
+ bool readTrack(MidiFileTrack*);
+ bool writeTrack(const MidiFileTrack*);
+
+ int readEvent(MidiPlayEvent*, MidiFileTrack*);
+ void writeEvent(const MidiPlayEvent*);
+
+ public:
+ MidiFile(FILE* f);
+ ~MidiFile();
+ bool read();
+ bool write();
+ QString error();
+ MidiFileTrackList* trackList() { return _tracks; }
+ int tracks() const { return ntracks; }
+ void setTrackList(MidiFileTrackList* tr, int n) {
+ _tracks = tr;
+ ntracks = n;
+ }
+ void setDivision(int d) { _division = d; }
+ int division() const { return _division; }
+ void setMType(MType t) { _mtype = t; }
+ MType mtype() const { return _mtype; }
+ };
+
+#define XCHG_SHORT(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
+#ifdef __i486__
+#define XCHG_LONG(x) \
+ ({ int __value; \
+ asm ("bswap %1; movl %1,%0" : "=g" (__value) : "r" (x)); \
+ __value; })
+#else
+#define XCHG_LONG(x) ((((x)&0xFF)<<24) | \
+ (((x)&0xFF00)<<8) | \
+ (((x)&0xFF0000)>>8) | \
+ (((x)>>24)&0xFF))
+#endif
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define BE_SHORT(x) XCHG_SHORT(x)
+#define BE_LONG(x) XCHG_LONG(x)
+#else
+#define BE_SHORT(x) x
+#define BE_LONG(x) x
+#endif
+
+
+#endif
+
diff --git a/muse2/muse/midiport.cpp b/muse2/muse/midiport.cpp
new file mode 100644
index 00000000..e5b4e63d
--- /dev/null
+++ b/muse2/muse/midiport.cpp
@@ -0,0 +1,1027 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midiport.cpp,v 1.21.2.15 2009/12/07 20:11:51 terminator356 Exp $
+//
+// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+//#include "config.h"
+
+#include <q3popupmenu.h>
+#include "mididev.h"
+#include "midiport.h"
+#include "midictrl.h"
+#include "midi.h"
+#include "minstrument.h"
+#include "xml.h"
+#include "globals.h"
+#include "mpevent.h"
+#include "synth.h"
+#include "app.h"
+#include "song.h"
+
+//#ifdef DSSI_SUPPORT
+//#include "dssihost.h"
+//#endif
+
+MidiPort midiPorts[MIDI_PORTS];
+
+//---------------------------------------------------------
+// initMidiPorts
+//---------------------------------------------------------
+
+void initMidiPorts()
+ {
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ MidiPort* port = &midiPorts[i];
+ port->setInstrument(genericMidiInstrument);
+ port->syncInfo().setPort(i);
+ }
+ }
+
+//---------------------------------------------------------
+// MidiPort
+//---------------------------------------------------------
+
+MidiPort::MidiPort()
+ : _state("not configured")
+ {
+ _device = 0;
+ _instrument = 0;
+ _controller = new MidiCtrlValListList();
+ _foundInSongFile = false;
+
+ //
+ // create minimum set of managed controllers
+ // to make midi mixer operational
+ //
+ for (int i = 0; i < MIDI_CHANNELS; ++i) {
+ addManagedController(i, CTRL_PROGRAM);
+ addManagedController(i, CTRL_VOLUME);
+ addManagedController(i, CTRL_PANPOT);
+ _automationType[i] = AUTO_READ;
+ }
+ }
+
+//---------------------------------------------------------
+// MidiPort
+//---------------------------------------------------------
+
+MidiPort::~MidiPort()
+ {
+ delete _controller;
+ }
+
+//---------------------------------------------------------
+// guiVisible
+//---------------------------------------------------------
+
+bool MidiPort::guiVisible() const
+ {
+ return _instrument ? _instrument->guiVisible() : false;
+ }
+
+//---------------------------------------------------------
+// hasGui
+//---------------------------------------------------------
+
+bool MidiPort::hasGui() const
+ {
+ return _instrument ? _instrument->hasGui() : false;
+ }
+
+//---------------------------------------------------------
+// setDevice
+//---------------------------------------------------------
+
+void MidiPort::setMidiDevice(MidiDevice* dev)
+ {
+ if (_device) {
+ if (_device->isSynti())
+ _instrument = genericMidiInstrument;
+ _device->setPort(-1);
+ _device->close();
+ }
+ if (dev) {
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ MidiPort* mp = &midiPorts[i];
+ if (mp->device() == dev) {
+ if(dev->isSynti())
+ mp->setInstrument(genericMidiInstrument);
+ // move device
+ _state = mp->state();
+ mp->clearDevice();
+ break;
+ }
+ }
+ _device = dev;
+ if (_device->isSynti()) {
+ SynthI* s = (SynthI*)_device;
+ _instrument = s;
+ }
+ _state = _device->open();
+ _device->setPort(portno());
+
+ // By T356. Send all instrument controller initial (default) values to all midi channels now,
+ // except where explicitly initialized in the song.
+ // By sending ALL instrument controller initial values, even if those controllers are NOT
+ // in the song, we can ensure better consistency between songs.
+ // For example: A song is loaded which has a 'reverb level' controller initial value of '100'.
+ // Then a song is loaded which has no such controller (hence no explicit initial value).
+ // The 'reverb level' controller would still be at '100', and could adversely affect the song,
+ // but if the instrument has an available initial value of say '0', it will be used instead.
+ //
+ //if(_instrument)
+ // p3.3.39 NOT for syntis! Use midiState an/or initParams for that.
+ if(_instrument && !_device->isSynti())
+ {
+ MidiControllerList* cl = _instrument->controller();
+ MidiController* mc;
+ for(ciMidiController imc = cl->begin(); imc != cl->end(); ++imc)
+ {
+ //mc = *imc;
+ mc = imc->second;
+ for(int chan = 0; chan < MIDI_CHANNELS; ++chan)
+ {
+ ciMidiCtrlValList i;
+ // Look for an initial value for this midi controller, on this midi channel, in the song...
+ for(i = _controller->begin(); i != _controller->end(); ++i)
+ {
+ int channel = i->first >> 24;
+ int cntrl = i->first & 0xffffff;
+ int val = i->second->hwVal();
+ if(channel == chan && cntrl == mc->num() && val != CTRL_VAL_UNKNOWN)
+ break;
+ }
+ // If no initial value was found for this midi controller, on this midi channel, in the song...
+ if(i == _controller->end())
+ {
+ // If the instrument's midi controller has an initial value, send it now.
+ if(mc->initVal() != CTRL_VAL_UNKNOWN)
+ {
+ int ctl = mc->num();
+
+///#ifdef DSSI_SUPPORT
+ // Exclude dssi synths from this, as some of them have hundreds of controls.
+ // Another difference is dssi synth devices (usually) have readable default port values,
+ // unlike a midi output port, which cannot be queried for a current or default value,
+ // so we blindly send values here. Also some dssi have a different default mechanism or
+ // storage systems for parameters, with complex GUIs with their own manipulation schemes.
+ // Another difference is dssi controls are best manipulated as ladspa controls -
+ // (they ARE ladspa controls). This is stuff I mainly put for midi ports and MESS...
+ // I DO allow midi control of those ladspa controls, so our midi controls shall be updated here...
+ // p3.3.39 Only non-syntis! Use midiState an/or initParams for that.
+ ///if(!_device->isSynti() || (dynamic_cast<DssiSynthIF*>(((SynthI*)_device)->sif()) == 0))
+ ///{
+///#endif
+ // Note the addition of bias!
+ _device->putEvent(MidiPlayEvent(0, portno(), chan,
+ ME_CONTROLLER, ctl, mc->initVal() + mc->bias()));
+///#ifdef DSSI_SUPPORT
+ ///}
+///#endif
+
+ // Set it once so the 'last HW value' is set, and control knobs are positioned at the value...
+ //setHwCtrlState(chan, ctl, mc->initVal() + mc->bias());
+ // Set it again so that control labels show 'off'...
+ //setHwCtrlState(chan, ctl, CTRL_VAL_UNKNOWN);
+ setHwCtrlStates(chan, ctl, CTRL_VAL_UNKNOWN, mc->initVal() + mc->bias());
+ }
+ }
+ }
+ }
+ }
+
+ // init HW controller state
+ // p3.3.39 NOT for syntis! Use midiState an/or initParams for that.
+ if(!_device->isSynti())
+ {
+ for (iMidiCtrlValList i = _controller->begin(); i != _controller->end(); ++i) {
+ int channel = i->first >> 24;
+ int cntrl = i->first & 0xffffff;
+ int val = i->second->hwVal();
+ if (val != CTRL_VAL_UNKNOWN) {
+
+
+///#ifdef DSSI_SUPPORT
+ // Not for dssi synths...
+ ///if(!_device->isSynti() || (dynamic_cast<DssiSynthIF*>(((SynthI*)_device)->sif()) == 0))
+ ///{
+///#endif
+ _device->putEvent(MidiPlayEvent(0, portno(), channel,
+ ME_CONTROLLER, cntrl, val));
+///#ifdef DSSI_SUPPORT
+ ///}
+///#endif
+
+ // Set it once so the 'last HW value' is set, and control knobs are positioned at the value...
+ setHwCtrlState(channel, cntrl, val);
+ // Set it again so that control labels show 'off'...
+ //setHwCtrlState(channel, cntrl, CTRL_VAL_UNKNOWN);
+ //setHwCtrlStates(channel, cntrl, CTRL_VAL_UNKNOWN, val);
+ }
+ }
+ }
+ }
+
+ else
+ clearDevice();
+ }
+
+//---------------------------------------------------------
+// clearDevice
+//---------------------------------------------------------
+
+void MidiPort::clearDevice()
+ {
+ _device = 0;
+ _state = "not configured";
+ }
+
+//---------------------------------------------------------
+// portno
+//---------------------------------------------------------
+
+int MidiPort::portno() const
+ {
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ if (&midiPorts[i] == this)
+ return i;
+ }
+ return -1;
+ }
+
+//---------------------------------------------------------
+// midiPortsPopup
+//---------------------------------------------------------
+
+//QPopupMenu* midiPortsPopup(QWidget* parent)
+Q3PopupMenu* midiPortsPopup(QWidget* parent, int checkPort)
+ {
+ Q3PopupMenu* p = new Q3PopupMenu(parent);
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ MidiPort* port = &midiPorts[i];
+ QString name;
+ name.sprintf("%d:%s", port->portno()+1, port->portname().latin1());
+ p->insertItem(name, i);
+
+ if(i == checkPort)
+ p->setItemChecked(i, true);
+ }
+ return p;
+ }
+
+//---------------------------------------------------------
+// portname
+//---------------------------------------------------------
+
+const QString& MidiPort::portname() const
+ {
+ //static const QString none("<none>");
+ static const QString none(QT_TR_NOOP("<none>"));
+ if (_device)
+ return _device->name();
+ else
+ return none;
+ }
+
+//---------------------------------------------------------
+// tryCtrlInitVal
+//---------------------------------------------------------
+
+void MidiPort::tryCtrlInitVal(int chan, int ctl, int val)
+{
+ if(_instrument)
+ {
+ MidiControllerList* cl = _instrument->controller();
+ //for(ciMidiController imc = cl->begin(); imc != cl->end(); ++imc)
+ ciMidiController imc = cl->find(ctl);
+ if(imc != cl->end())
+ {
+ //MidiController* mc = *imc;
+ MidiController* mc = imc->second;
+ //int cnum = mc->num();
+ //if(cnum == ctl)
+ //{
+ int initval = mc->initVal();
+
+ // Initialize from either the instrument controller's initial value, or the supplied value.
+ if(initval != CTRL_VAL_UNKNOWN)
+ {
+ if(_device)
+ {
+ //MidiPlayEvent ev(song->cpos(), portno(), chan, ME_CONTROLLER, ctl, initval + mc->bias());
+ MidiPlayEvent ev(0, portno(), chan, ME_CONTROLLER, ctl, initval + mc->bias());
+ _device->putEvent(ev);
+ }
+ // Set it once so the 'last HW value' is set, and control knobs are positioned at the value...
+ //setHwCtrlState(chan, ctl, initval + mc->bias());
+ // Set it again so that control labels show 'off'...
+ //setHwCtrlState(chan, ctl, CTRL_VAL_UNKNOWN);
+ setHwCtrlStates(chan, ctl, CTRL_VAL_UNKNOWN, initval + mc->bias());
+
+ return;
+ }
+ }
+ }
+
+ if(_device)
+ {
+ //MidiPlayEvent ev(song->cpos(), portno(), chan, ME_CONTROLLER, ctl, val);
+ MidiPlayEvent ev(0, portno(), chan, ME_CONTROLLER, ctl, val);
+ _device->putEvent(ev);
+ }
+ // Set it once so the 'last HW value' is set, and control knobs are positioned at the value...
+ //setHwCtrlState(chan, ctl, val);
+ // Set it again so that control labels show 'off'...
+ //setHwCtrlState(chan, ctl, CTRL_VAL_UNKNOWN);
+ setHwCtrlStates(chan, ctl, CTRL_VAL_UNKNOWN, val);
+}
+
+//---------------------------------------------------------
+// sendGmInitValues
+//---------------------------------------------------------
+
+void MidiPort::sendGmInitValues()
+{
+ for (int i = 0; i < MIDI_CHANNELS; ++i) {
+ // Changed by T356.
+ //setHwCtrlState(i, CTRL_PROGRAM, 0);
+ //setHwCtrlState(i, CTRL_PITCH, 0);
+ //setHwCtrlState(i, CTRL_VOLUME, 100);
+ //setHwCtrlState(i, CTRL_PANPOT, 64);
+ //setHwCtrlState(i, CTRL_REVERB_SEND, 40);
+ //setHwCtrlState(i, CTRL_CHORUS_SEND, 0);
+
+ // By T356. Initialize from instrument controller if it has an initial value, otherwise use the specified value.
+ // Tested: Ultimately, a track's controller stored values take priority by sending any 'zero time' value
+ // AFTER these GM/GS/XG init routines are called via initDevices().
+ tryCtrlInitVal(i, CTRL_PROGRAM, 0);
+ tryCtrlInitVal(i, CTRL_PITCH, 0);
+ tryCtrlInitVal(i, CTRL_VOLUME, 100);
+ tryCtrlInitVal(i, CTRL_PANPOT, 64);
+ tryCtrlInitVal(i, CTRL_REVERB_SEND, 40);
+ tryCtrlInitVal(i, CTRL_CHORUS_SEND, 0);
+ }
+}
+
+//---------------------------------------------------------
+// sendGsInitValues
+//---------------------------------------------------------
+
+void MidiPort::sendGsInitValues()
+{
+ sendGmInitValues();
+}
+
+//---------------------------------------------------------
+// sendXgInitValues
+//---------------------------------------------------------
+
+void MidiPort::sendXgInitValues()
+{
+ for (int i = 0; i < MIDI_CHANNELS; ++i) {
+ // Changed by T356.
+ //setHwCtrlState(i, CTRL_PROGRAM, 0);
+ //setHwCtrlState(i, CTRL_MODULATION, 0);
+ //setHwCtrlState(i, CTRL_PORTAMENTO_TIME, 0);
+ //setHwCtrlState(i, CTRL_VOLUME, 0x64);
+ //setHwCtrlState(i, CTRL_PANPOT, 0x40);
+ //setHwCtrlState(i, CTRL_EXPRESSION, 0x7f);
+ //setHwCtrlState(i, CTRL_SUSTAIN, 0x0);
+ //setHwCtrlState(i, CTRL_PORTAMENTO, 0x0);
+ //setHwCtrlState(i, CTRL_SOSTENUTO, 0x0);
+ //setHwCtrlState(i, CTRL_SOFT_PEDAL, 0x0);
+ //setHwCtrlState(i, CTRL_HARMONIC_CONTENT, 0x40);
+ //setHwCtrlState(i, CTRL_RELEASE_TIME, 0x40);
+ //setHwCtrlState(i, CTRL_ATTACK_TIME, 0x40);
+ //setHwCtrlState(i, CTRL_BRIGHTNESS, 0x40);
+ //setHwCtrlState(i, CTRL_REVERB_SEND, 0x28);
+ //setHwCtrlState(i, CTRL_CHORUS_SEND, 0x0);
+ //setHwCtrlState(i, CTRL_VARIATION_SEND, 0x0);
+
+ // By T356. Initialize from instrument controller if it has an initial value, otherwise use the specified value.
+ tryCtrlInitVal(i, CTRL_PROGRAM, 0);
+ tryCtrlInitVal(i, CTRL_MODULATION, 0);
+ tryCtrlInitVal(i, CTRL_PORTAMENTO_TIME, 0);
+ tryCtrlInitVal(i, CTRL_VOLUME, 0x64);
+ tryCtrlInitVal(i, CTRL_PANPOT, 0x40);
+ tryCtrlInitVal(i, CTRL_EXPRESSION, 0x7f);
+ tryCtrlInitVal(i, CTRL_SUSTAIN, 0x0);
+ tryCtrlInitVal(i, CTRL_PORTAMENTO, 0x0);
+ tryCtrlInitVal(i, CTRL_SOSTENUTO, 0x0);
+ tryCtrlInitVal(i, CTRL_SOFT_PEDAL, 0x0);
+ tryCtrlInitVal(i, CTRL_HARMONIC_CONTENT, 0x40);
+ tryCtrlInitVal(i, CTRL_RELEASE_TIME, 0x40);
+ tryCtrlInitVal(i, CTRL_ATTACK_TIME, 0x40);
+ tryCtrlInitVal(i, CTRL_BRIGHTNESS, 0x40);
+ tryCtrlInitVal(i, CTRL_REVERB_SEND, 0x28);
+ tryCtrlInitVal(i, CTRL_CHORUS_SEND, 0x0);
+ tryCtrlInitVal(i, CTRL_VARIATION_SEND, 0x0);
+ }
+}
+
+//---------------------------------------------------------
+// sendGmOn
+// send GM-On message to midi device and keep track
+// of device state
+//---------------------------------------------------------
+
+void MidiPort::sendGmOn()
+ {
+ sendSysex(gmOnMsg, gmOnMsgLen);
+ }
+
+//---------------------------------------------------------
+// sendGsOn
+// send Roland GS-On message to midi device and keep track
+// of device state
+//---------------------------------------------------------
+
+void MidiPort::sendGsOn()
+ {
+ //static unsigned char data2[] = { 0x41, 0x10, 0x42, 0x12, 0x40, 0x01, 0x33, 0x50, 0x3c };
+ //static unsigned char data3[] = { 0x41, 0x10, 0x42, 0x12, 0x40, 0x01, 0x34, 0x50, 0x3b };
+ //sendSysex(data2, sizeof(data2));
+ //sendSysex(data3, sizeof(data3));
+ sendSysex(gsOnMsg2, gsOnMsg2Len);
+ sendSysex(gsOnMsg3, gsOnMsg3Len);
+ }
+
+//---------------------------------------------------------
+// sendXgOn
+// send Yamaha XG-On message to midi device and keep track
+// of device state
+//---------------------------------------------------------
+
+void MidiPort::sendXgOn()
+ {
+ sendSysex(xgOnMsg, xgOnMsgLen);
+ }
+
+//---------------------------------------------------------
+// sendSysex
+// send SYSEX message to midi device
+//---------------------------------------------------------
+
+void MidiPort::sendSysex(const unsigned char* p, int n)
+ {
+ if (_device) {
+ MidiPlayEvent event(0, 0, ME_SYSEX, p, n);
+ _device->putEvent(event);
+ }
+ }
+
+//---------------------------------------------------------
+// sendMMCLocate
+//---------------------------------------------------------
+
+void MidiPort::sendMMCLocate(unsigned char ht, unsigned char m, unsigned char s, unsigned char f, unsigned char sf, int devid)
+{
+ unsigned char msg[mmcLocateMsgLen];
+ memcpy(msg, mmcLocateMsg, mmcLocateMsgLen);
+ if(devid != -1)
+ msg[1] = devid;
+ else
+ msg[1] = _syncInfo.idOut();
+ msg[6] = ht;
+ msg[7] = m;
+ msg[8] = s;
+ msg[9] = f;
+ msg[10] = sf;
+ sendSysex(msg, mmcLocateMsgLen);
+}
+
+//---------------------------------------------------------
+// sendMMCStop
+//---------------------------------------------------------
+
+void MidiPort::sendMMCStop(int devid)
+{
+ unsigned char msg[mmcStopMsgLen];
+ memcpy(msg, mmcStopMsg, mmcStopMsgLen);
+ if(devid != -1)
+ msg[1] = devid;
+ else
+ msg[1] = _syncInfo.idOut();
+ sendSysex(msg, mmcStopMsgLen);
+}
+
+//---------------------------------------------------------
+// sendMMCDeferredPlay
+//---------------------------------------------------------
+
+void MidiPort::sendMMCDeferredPlay(int devid)
+{
+ unsigned char msg[mmcDeferredPlayMsgLen];
+ memcpy(msg, mmcDeferredPlayMsg, mmcDeferredPlayMsgLen);
+ if(devid != -1)
+ msg[1] = devid;
+ else
+ msg[1] = _syncInfo.idOut();
+ sendSysex(msg, mmcDeferredPlayMsgLen);
+}
+
+//---------------------------------------------------------
+// sendStart
+//---------------------------------------------------------
+
+void MidiPort::sendStart()
+ {
+ if (_device) {
+ MidiPlayEvent event(0, 0, 0, ME_START, 0, 0);
+ _device->putEvent(event);
+ }
+ }
+
+//---------------------------------------------------------
+// sendStop
+//---------------------------------------------------------
+
+void MidiPort::sendStop()
+ {
+ if (_device) {
+ MidiPlayEvent event(0, 0, 0, ME_STOP, 0, 0);
+ _device->putEvent(event);
+ }
+ }
+
+//---------------------------------------------------------
+// sendClock
+//---------------------------------------------------------
+
+void MidiPort::sendClock()
+ {
+ if (_device) {
+ MidiPlayEvent event(0, 0, 0, ME_CLOCK, 0, 0);
+ _device->putEvent(event);
+ }
+ }
+
+//---------------------------------------------------------
+// sendContinue
+//---------------------------------------------------------
+
+void MidiPort::sendContinue()
+ {
+ if (_device) {
+ MidiPlayEvent event(0, 0, 0, ME_CONTINUE, 0, 0);
+ _device->putEvent(event);
+ }
+ }
+
+//---------------------------------------------------------
+// sendSongpos
+//---------------------------------------------------------
+
+void MidiPort::sendSongpos(int pos)
+ {
+ if (_device) {
+ MidiPlayEvent event(0, 0, 0, ME_SONGPOS, pos, 0);
+ _device->putEvent(event);
+ }
+ }
+
+//---------------------------------------------------------
+// addManagedController
+//---------------------------------------------------------
+
+MidiCtrlValList* MidiPort::addManagedController(int channel, int ctrl)
+ {
+ iMidiCtrlValList cl = _controller->find(channel, ctrl);
+ if (cl == _controller->end()) {
+ MidiCtrlValList* pvl = new MidiCtrlValList(ctrl);
+ _controller->add(channel, pvl);
+ return pvl;
+ }
+ else
+ return cl->second;
+ }
+
+//---------------------------------------------------------
+// limitValToInstrCtlRange
+//---------------------------------------------------------
+
+int MidiPort::limitValToInstrCtlRange(MidiController* mc, int val)
+{
+ if(!_instrument || !mc || val == CTRL_VAL_UNKNOWN)
+ return val;
+
+ //MidiController* mc = imc->second;
+ int mn = mc->minVal();
+ int mx = mc->maxVal();
+ int bias = mc->bias();
+
+ // Subtract controller bias from value.
+ val -= bias;
+
+ // Limit value to controller range.
+ if(val < mn)
+ val = mn;
+ else
+ if(val > mx)
+ val = mx;
+
+ // Re-add controller bias to value.
+ val += bias;
+
+ return val;
+}
+
+int MidiPort::limitValToInstrCtlRange(int ctl, int val)
+{
+ if(!_instrument || val == CTRL_VAL_UNKNOWN)
+ return val;
+
+ MidiControllerList* cl = _instrument->controller();
+
+ // Is it a drum controller?
+ MidiController *mc = drumController(ctl);
+ if(!mc)
+ {
+ // It's not a drum controller. Find it as a regular controller instead.
+ iMidiController imc = cl->find(ctl);
+ if(imc != cl->end())
+ mc = imc->second;
+ }
+
+ // If it's a valid controller, limit the value to the instrument controller range.
+ if(mc)
+ return limitValToInstrCtlRange(mc, val);
+
+ return val;
+}
+
+//---------------------------------------------------------
+// sendEvent
+// return true, if event cannot be delivered
+//---------------------------------------------------------
+
+bool MidiPort::sendEvent(const MidiPlayEvent& ev)
+ {
+ if (ev.type() == ME_CONTROLLER) {
+
+// printf("current sustain %d %d %d\n", hwCtrlState(ev.channel(),CTRL_SUSTAIN), CTRL_SUSTAIN, ev.dataA());
+
+ // Added by T356.
+ int da = ev.dataA();
+ int db = ev.dataB();
+ /*
+ // Is it a drum controller?
+ MidiController* mc = drumController(da);
+ if(mc)
+ {
+ DrumMap* dm = &drumMap[da & 0x7f];
+ int port = dm->port;
+ MidiPort* mp = &midiPorts[port];
+ // Is it NOT for this MidiPort?
+ if(mp && (mp != this))
+ {
+ // Redirect the event to the mapped port and channel...
+ da = (da & ~0xff) | (dm->anote & 0x7f);
+ db = mp->limitValToInstrCtlRange(da, db);
+ MidiPlayEvent nev(ev.time(), port, dm->channel, ME_CONTROLLER, da, db);
+ if(!mp->setHwCtrlState(ev.channel(), da, db))
+ return false;
+ if(!mp->device())
+ return true;
+ return mp->device()->putEvent(nev);
+ }
+ }
+ */
+ db = limitValToInstrCtlRange(da, db);
+
+
+ // Removed by T356.
+ //
+ // optimize controller settings
+ //
+ //if (hwCtrlState(ev.channel(), ev.dataA()) == ev.dataB()) {
+// printf("optimize ctrl %d %x val %d\n", ev.dataA(), ev.dataA(), ev.dataB());
+ // return false;
+ // }
+// printf("set HW Ctrl State ch:%d 0x%x 0x%x\n", ev.channel(), ev.dataA(), ev.dataB());
+ if(!setHwCtrlState(ev.channel(), da, db))
+ return false;
+ }
+ else
+ if (ev.type() == ME_PITCHBEND)
+ {
+ int da = limitValToInstrCtlRange(CTRL_PITCH, ev.dataA());
+ // Removed by T356.
+ //if (hwCtrlState(ev.channel(), CTRL_PITCH) == ev.dataA())
+ // return false;
+
+ if(!setHwCtrlState(ev.channel(), CTRL_PITCH, da))
+ return false;
+ }
+ else
+ if (ev.type() == ME_PROGRAM)
+ {
+ if(!setHwCtrlState(ev.channel(), CTRL_PROGRAM, ev.dataA()))
+ return false;
+ }
+
+
+ if (!_device)
+ return true;
+ return _device->putEvent(ev);
+ }
+
+//---------------------------------------------------------
+// lastValidHWCtrlState
+//---------------------------------------------------------
+
+int MidiPort::lastValidHWCtrlState(int ch, int ctrl) const
+{
+ ch &= 0xff;
+ iMidiCtrlValList cl = _controller->find(ch, ctrl);
+ if (cl == _controller->end()) {
+ return CTRL_VAL_UNKNOWN;
+ }
+ MidiCtrlValList* vl = cl->second;
+ return vl->lastValidHWVal();
+}
+
+//---------------------------------------------------------
+// hwCtrlState
+//---------------------------------------------------------
+
+int MidiPort::hwCtrlState(int ch, int ctrl) const
+ {
+ ch &= 0xff;
+ iMidiCtrlValList cl = _controller->find(ch, ctrl);
+ if (cl == _controller->end()) {
+ //if (debugMsg)
+ // printf("hwCtrlState: chan %d ctrl 0x%x not found\n", ch, ctrl);
+ return CTRL_VAL_UNKNOWN;
+ }
+ MidiCtrlValList* vl = cl->second;
+ return vl->hwVal();
+ }
+
+//---------------------------------------------------------
+// setHwCtrlState
+// Returns false if value is already equal, true if value is set.
+//---------------------------------------------------------
+
+bool MidiPort::setHwCtrlState(int ch, int ctrl, int val)
+ {
+ // Changed by T356.
+ //iMidiCtrlValList cl = _controller->find(ch, ctrl);
+ //if (cl == _controller->end()) {
+ // try to add new controller
+ // addManagedController(ch, ctrl);
+// muse->importController(ch, this, ctrl);
+ // cl = _controller->find(ch, ctrl);
+ // if (cl == _controller->end()) {
+ // if (debugMsg)
+ // printf("setHwCtrlState(%d,0x%x,0x%x): not found\n", ch, ctrl, val);
+ // return;
+ // }
+ // }
+ //MidiCtrlValList* vl = cl->second;
+// printf("setHwCtrlState ch %d ctrl %x val %x\n", ch, ctrl, val);
+
+ // By T356. This will create a new value list if necessary, otherwise it returns the existing list.
+ MidiCtrlValList* vl = addManagedController(ch, ctrl);
+
+ return vl->setHwVal(val);
+ }
+
+//---------------------------------------------------------
+// setHwCtrlStates
+// Sets current and last HW values.
+// Handy for forcing labels to show 'off' and knobs to show specific values
+// without having to send two messages.
+// Returns false if both values are already set, true if either value is changed.
+//---------------------------------------------------------
+
+bool MidiPort::setHwCtrlStates(int ch, int ctrl, int val, int lastval)
+ {
+ // This will create a new value list if necessary, otherwise it returns the existing list.
+ MidiCtrlValList* vl = addManagedController(ch, ctrl);
+
+ return vl->setHwVals(val, lastval);
+ }
+
+// Removed by T356.
+//---------------------------------------------------------
+// setCtrl
+// return true if new controller value added
+//---------------------------------------------------------
+
+//bool MidiPort::setCtrl(int ch, int tick, int ctrl, int val)
+// {
+// if (debugMsg)
+// printf("setCtrl(tick=%d val=%d)\n",tick,val);
+// iMidiCtrlValList cl = _controller->find(ch, ctrl);
+// if (cl == _controller->end()) {
+// if (debugMsg)
+// printf("setCtrl: controller 0x%x for channel %d not found\n", ctrl, ch);
+// return false;
+// }
+// return cl->second->add(tick, val);
+// }
+
+//---------------------------------------------------------
+// setControllerVal
+// This function sets a controller value,
+// creating the controller if necessary.
+// Returns true if a value was actually added or replaced.
+//---------------------------------------------------------
+
+bool MidiPort::setControllerVal(int ch, int tick, int ctrl, int val, Part* part)
+{
+ MidiCtrlValList* pvl;
+ iMidiCtrlValList cl = _controller->find(ch, ctrl);
+ if (cl == _controller->end())
+ {
+ pvl = new MidiCtrlValList(ctrl);
+ _controller->add(ch, pvl);
+ }
+ else
+ pvl = cl->second;
+
+ return pvl->addMCtlVal(tick, val, part);
+}
+
+//---------------------------------------------------------
+// getCtrl
+//---------------------------------------------------------
+
+int MidiPort::getCtrl(int ch, int tick, int ctrl) const
+ {
+ iMidiCtrlValList cl = _controller->find(ch, ctrl);
+ if (cl == _controller->end()) {
+ //if (debugMsg)
+ // printf("getCtrl: controller %d(0x%x) for channel %d not found size %zd\n",
+ // ctrl, ctrl, ch, _controller->size());
+ return CTRL_VAL_UNKNOWN;
+ }
+ return cl->second->value(tick);
+ }
+
+int MidiPort::getCtrl(int ch, int tick, int ctrl, Part* part) const
+ {
+ iMidiCtrlValList cl = _controller->find(ch, ctrl);
+ if (cl == _controller->end()) {
+ //if (debugMsg)
+ // printf("getCtrl: controller %d(0x%x) for channel %d not found size %zd\n",
+ // ctrl, ctrl, ch, _controller->size());
+ return CTRL_VAL_UNKNOWN;
+ }
+ return cl->second->value(tick, part);
+ }
+//---------------------------------------------------------
+// deleteController
+//---------------------------------------------------------
+
+void MidiPort::deleteController(int ch, int tick, int ctrl, Part* part)
+ {
+ iMidiCtrlValList cl = _controller->find(ch, ctrl);
+ if (cl == _controller->end()) {
+ if (debugMsg)
+ printf("deleteController: controller %d(0x%x) for channel %d not found size %zd\n",
+ ctrl, ctrl, ch, _controller->size());
+ return;
+ }
+
+ cl->second->delMCtlVal(tick, part);
+ }
+
+//---------------------------------------------------------
+// midiController
+//---------------------------------------------------------
+
+MidiController* MidiPort::midiController(int num) const
+ {
+ if (_instrument) {
+ MidiControllerList* mcl = _instrument->controller();
+ for (iMidiController i = mcl->begin(); i != mcl->end(); ++i) {
+ int cn = i->second->num();
+ if (cn == num)
+ return i->second;
+ // wildcard?
+ if (((cn & 0xff) == 0xff) && ((cn & ~0xff) == (num & ~0xff)))
+ return i->second;
+ }
+ }
+
+ for (iMidiController i = defaultMidiController.begin(); i != defaultMidiController.end(); ++i) {
+ int cn = i->second->num();
+ if (cn == num)
+ return i->second;
+ // wildcard?
+ if (((cn & 0xff) == 0xff) && ((cn & ~0xff) == (num & ~0xff)))
+ return i->second;
+ }
+
+
+ QString name = midiCtrlName(num);
+ int min = 0;
+ int max = 127;
+
+ MidiController::ControllerType t = midiControllerType(num);
+ switch (t) {
+ case MidiController::RPN:
+ case MidiController::NRPN:
+ case MidiController::Controller7:
+ max = 127;
+ break;
+ case MidiController::Controller14:
+ case MidiController::RPN14:
+ case MidiController::NRPN14:
+ max = 16383;
+ break;
+ case MidiController::Program:
+ max = 0xffffff;
+ break;
+ case MidiController::Pitch:
+ max = 8191;
+ min = -8192;
+ break;
+ case MidiController::Velo: // cannot happen
+ break;
+ }
+ MidiController* c = new MidiController(name, num, min, max, 0);
+ defaultMidiController.add(c);
+ return c;
+ }
+
+//---------------------------------------------------------
+// drumController
+// Returns instrument drum controller if ctl is a drum controller number.
+// Otherwise returns zero.
+//---------------------------------------------------------
+
+MidiController* MidiPort::drumController(int ctl)
+{
+ if(!_instrument)
+ return 0;
+
+ MidiControllerList* cl = _instrument->controller();
+
+ // If it's an RPN, NRPN, RPN14, or NRPN14 controller...
+ if(((ctl - CTRL_RPN_OFFSET >= 0) && (ctl - CTRL_RPN_OFFSET <= 0xffff)) ||
+ ((ctl - CTRL_NRPN_OFFSET >= 0) && (ctl - CTRL_NRPN_OFFSET <= 0xffff)) ||
+ ((ctl - CTRL_RPN14_OFFSET >= 0) && (ctl - CTRL_RPN14_OFFSET <= 0xffff)) ||
+ ((ctl - CTRL_NRPN14_OFFSET >= 0) && (ctl - CTRL_NRPN14_OFFSET <= 0xffff)))
+ {
+ // Does the instrument have a drum controller to match this controller's number?
+ iMidiController imc = cl->find(ctl | 0xff);
+ if(imc != cl->end())
+ // Yes, it's a drum controller. Return a pointer to it.
+ return imc->second;
+ }
+
+ return 0;
+}
+
+int MidiPort::nullSendValue()
+{
+ return _instrument ? _instrument->nullSendValue() : -1;
+}
+
+void MidiPort::setNullSendValue(int v)
+{
+ if(_instrument)
+ _instrument->setNullSendValue(v);
+}
+
+//---------------------------------------------------------
+// writeRouting // p3.3.50
+//---------------------------------------------------------
+
+void MidiPort::writeRouting(int level, Xml& xml) const
+{
+ // If this device is not actually in use by the song, do not write any routes.
+ // This prevents bogus routes from being saved and propagated in the med file.
+ if(!device())
+ return;
+
+ QString s;
+
+ for (ciRoute r = _outRoutes.begin(); r != _outRoutes.end(); ++r)
+ {
+ if(r->type == Route::TRACK_ROUTE && !r->name().isEmpty())
+ {
+ //xml.tag(level++, "Route");
+
+ s = QT_TR_NOOP("Route");
+ if(r->channel != -1 && r->channel != 0)
+ s += QString(QT_TR_NOOP(" channelMask=\"%1\"")).arg(r->channel); // Use new channel mask.
+ xml.tag(level++, s);
+
+ xml.tag(level, "source mport=\"%d\"/", portno());
+
+ s = QT_TR_NOOP("dest");
+ s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(Xml::xmlString(r->name()));
+ xml.tag(level, s);
+
+ xml.etag(level--, "Route");
+ }
+ }
+}
+
diff --git a/muse2/muse/midiport.h b/muse2/muse/midiport.h
new file mode 100644
index 00000000..7c8a408c
--- /dev/null
+++ b/muse2/muse/midiport.h
@@ -0,0 +1,130 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midiport.h,v 1.9.2.6 2009/11/17 22:08:22 terminator356 Exp $
+//
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MIDIPORT_H__
+#define __MIDIPORT_H__
+
+#include "globaldefs.h"
+#include "sync.h"
+#include "route.h"
+//Added by qt3to4:
+#include <Q3PopupMenu>
+
+class MidiDevice;
+class MidiInstrument;
+class MidiCtrlValListList;
+class MidiPlayEvent;
+class MidiController;
+class MidiCtrlValList;
+class Part;
+//class MidiSyncInfo;
+
+//---------------------------------------------------------
+// MidiPort
+//---------------------------------------------------------
+
+class MidiPort {
+ MidiCtrlValListList* _controller;
+ MidiDevice* _device;
+ QString _state; // result of device open
+ MidiInstrument* _instrument;
+ AutomationType _automationType[MIDI_CHANNELS];
+ // Holds sync settings and detection monitors.
+ MidiSyncInfo _syncInfo;
+ // p3.3.50 Just a flag to say the port was found in the song file, even if it has no device right now.
+ bool _foundInSongFile;
+
+ RouteList _inRoutes, _outRoutes;
+
+ void clearDevice();
+
+ public:
+ MidiPort();
+ ~MidiPort();
+
+ //
+ // manipulate active midi controller
+ //
+ MidiCtrlValListList* controller() { return _controller; }
+ int getCtrl(int ch, int tick, int ctrl) const;
+ int getCtrl(int ch, int tick, int ctrl, Part* part) const;
+ // Removed by T356.
+ //bool setCtrl(int ch, int tick, int ctrl, int val);
+ bool setControllerVal(int ch, int tick, int ctrl, int val, Part* part);
+ // Can be CTRL_VAL_UNKNOWN until a valid state is set
+ int lastValidHWCtrlState(int ch, int ctrl) const;
+ int hwCtrlState(int ch, int ctrl) const;
+ bool setHwCtrlState(int ch, int ctrl, int val);
+ bool setHwCtrlStates(int ch, int ctrl, int val, int lastval);
+ void deleteController(int ch, int tick, int ctrl, Part* part);
+
+ bool guiVisible() const;
+ bool hasGui() const;
+
+ int portno() const;
+ bool foundInSongFile() const { return _foundInSongFile; }
+ void setFoundInSongFile(bool b) { _foundInSongFile = b; }
+
+ MidiDevice* device() const { return _device; }
+ const QString& state() const { return _state; }
+ void setState(const QString& s) { _state = s; }
+ void setMidiDevice(MidiDevice* dev);
+ const QString& portname() const;
+ MidiInstrument* instrument() const { return _instrument; }
+ void setInstrument(MidiInstrument* i) { _instrument = i; }
+ MidiController* midiController(int num) const;
+ MidiCtrlValList* addManagedController(int channel, int ctrl);
+ void tryCtrlInitVal(int chan, int ctl, int val);
+ int limitValToInstrCtlRange(int ctl, int val);
+ int limitValToInstrCtlRange(MidiController* mc, int val);
+ MidiController* drumController(int ctl);
+ int nullSendValue();
+ void setNullSendValue(int v);
+
+ RouteList* inRoutes() { return &_inRoutes; }
+ RouteList* outRoutes() { return &_outRoutes; }
+ bool noInRoute() const { return _inRoutes.empty(); }
+ bool noOutRoute() const { return _outRoutes.empty(); }
+ void writeRouting(int, Xml&) const;
+
+ // send events to midi device and keep track of
+ // device state:
+ void sendGmOn();
+ void sendGsOn();
+ void sendXgOn();
+ void sendGmInitValues();
+ void sendGsInitValues();
+ void sendXgInitValues();
+ void sendStart();
+ void sendStop();
+ void sendContinue();
+ void sendSongpos(int);
+ void sendClock();
+ void sendSysex(const unsigned char* p, int n);
+ void sendMMCLocate(unsigned char ht, unsigned char m,
+ unsigned char s, unsigned char f, unsigned char sf, int devid = -1);
+ void sendMMCStop(int devid = -1);
+ void sendMMCDeferredPlay(int devid = -1);
+
+ bool sendEvent(const MidiPlayEvent&);
+ AutomationType automationType(int channel) { return _automationType[channel]; }
+ void setAutomationType(int channel, AutomationType t) {
+ _automationType[channel] = t;
+ }
+ MidiSyncInfo& syncInfo() { return _syncInfo; }
+ };
+
+extern MidiPort midiPorts[MIDI_PORTS];
+extern void initMidiPorts();
+
+class Q3PopupMenu;
+class QWidget;
+//extern QPopupMenu* midiPortsPopup(QWidget*);
+extern Q3PopupMenu* midiPortsPopup(QWidget*, int checkPort = -1);
+#endif
+
diff --git a/muse2/muse/midiseq.cpp b/muse2/muse/midiseq.cpp
new file mode 100644
index 00000000..7d7dedef
--- /dev/null
+++ b/muse2/muse/midiseq.cpp
@@ -0,0 +1,766 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midiseq.cpp,v 1.30.2.21 2009/12/20 05:00:35 terminator356 Exp $
+//
+// high priority task for scheduling midi events
+//
+// (C) Copyright 2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qmessagebox.h>
+#include <qobject.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <poll.h>
+#include <math.h>
+
+#include "globals.h"
+#include "midi.h"
+#include "midiseq.h"
+#include "midiport.h"
+#include "mididev.h"
+#include "midictrl.h"
+#include "audio.h"
+#include "driver/alsamidi.h"
+#include "driver/jackmidi.h"
+#include "sync.h"
+#include "synth.h"
+#include "song.h"
+#include "gconfig.h"
+
+MidiSeq* midiSeq;
+int MidiSeq::ticker = 0;
+volatile bool midiBusy=false;
+
+
+//---------------------------------------------------------
+// readMsg
+//---------------------------------------------------------
+
+static void readMsg(void* p, void*)
+ {
+
+ MidiSeq* at = (MidiSeq*)p;
+ at->readMsg();
+ }
+
+//---------------------------------------------------------
+// processMsg
+//---------------------------------------------------------
+
+void MidiSeq::processMsg(const ThreadMsg* m)
+ {
+ AudioMsg* msg = (AudioMsg*)m;
+ switch(msg->id) {
+ case MS_PROCESS:
+ audio->processMidi();
+ break;
+ case SEQM_SEEK:
+ processSeek();
+ break;
+ case MS_STOP:
+ processStop();
+ break;
+ case MS_SET_RTC:
+ doSetuid();
+ setRtcTicks();
+ undoSetuid();
+ break;
+ case MS_UPDATE_POLL_FD:
+ updatePollFd();
+ break;
+ case SEQM_ADD_TRACK:
+ song->insertTrack2(msg->track, msg->ival);
+ updatePollFd();
+ break;
+ case SEQM_REMOVE_TRACK:
+ song->cmdRemoveTrack(msg->track);
+ updatePollFd();
+ break;
+ case SEQM_CHANGE_TRACK:
+ song->changeTrack((Track*)(msg->p1), (Track*)(msg->p2));
+ updatePollFd();
+ break;
+ case SEQM_ADD_PART:
+ song->cmdAddPart((Part*)msg->p1);
+ break;
+ case SEQM_REMOVE_PART:
+ song->cmdRemovePart((Part*)msg->p1);
+ break;
+ case SEQM_CHANGE_PART:
+ //song->cmdChangePart((Part*)msg->p1, (Part*)msg->p2);
+ song->cmdChangePart((Part*)msg->p1, (Part*)msg->p2, msg->a, msg->b);
+ break;
+ case SEQM_SET_TRACK_OUT_CHAN:
+ {
+ MidiTrack* track = (MidiTrack*)(msg->p1);
+ track->setOutChanAndUpdate(msg->a);
+ }
+ break;
+ case SEQM_SET_TRACK_OUT_PORT:
+ {
+ MidiTrack* track = (MidiTrack*)(msg->p1);
+ track->setOutPortAndUpdate(msg->a);
+ }
+ break;
+ case SEQM_REMAP_PORT_DRUM_CTL_EVS:
+ song->remapPortDrumCtrlEvents(msg->ival, msg->a, msg->b, msg->c);
+ break;
+ case SEQM_CHANGE_ALL_PORT_DRUM_CTL_EVS:
+ song->changeAllPortDrumCtrlEvents((bool)msg->a, (bool)msg->b);
+ break;
+ case SEQM_SET_MIDI_DEVICE:
+ ((MidiPort*)(msg->p1))->setMidiDevice((MidiDevice*)(msg->p2));
+ updatePollFd();
+ break;
+ case SEQM_IDLE:
+ idle = msg->a;
+ break;
+ default:
+ printf("MidiSeq::processMsg() unknown id %d\n", msg->id);
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// processStop
+//---------------------------------------------------------
+
+void MidiSeq::processStop()
+ {
+ // p3.3.28
+ playStateExt = false; // not playing
+
+ //
+ // stop stuck notes
+ //
+ for (iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) {
+ MidiDevice* md = *id;
+ if (md->midiPort() == -1)
+ continue;
+ MPEventList* pel = md->playEvents();
+ MPEventList* sel = md->stuckNotes();
+ pel->clear();
+ for (iMPEvent i = sel->begin(); i != sel->end(); ++i) {
+ MidiPlayEvent ev = *i;
+ ev.setTime(0);
+ pel->add(ev);
+ }
+ sel->clear();
+ md->setNextPlayEvent(pel->begin());
+ }
+ }
+
+//---------------------------------------------------------
+// processSeek
+//---------------------------------------------------------
+
+void MidiSeq::processSeek()
+ {
+ int pos = audio->tickPos();
+ if (pos == 0 && !song->record())
+ audio->initDevices();
+
+ //---------------------------------------------------
+ // set all controller
+ //---------------------------------------------------
+
+ for (iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i) {
+ MidiDevice* dev = *i;
+ int port = dev->midiPort();
+ if (port == -1)
+ continue;
+ MidiPort* mp = &midiPorts[port];
+ MidiCtrlValListList* cll = mp->controller();
+
+ MPEventList* el = dev->playEvents();
+
+ if (audio->isPlaying()) {
+ // stop all notes
+ el->clear();
+ MPEventList* sel = dev->stuckNotes();
+ for (iMPEvent i = sel->begin(); i != sel->end(); ++i) {
+ MidiPlayEvent ev = *i;
+ ev.setTime(0);
+ el->add(ev);
+ }
+ sel->clear();
+ }
+ else
+ el->erase(el->begin(), dev->nextPlayEvent());
+
+ for (iMidiCtrlValList ivl = cll->begin(); ivl != cll->end(); ++ivl) {
+ MidiCtrlValList* vl = ivl->second;
+ //int val = vl->value(pos);
+ //if (val != CTRL_VAL_UNKNOWN) {
+ // int channel = ivl->first >> 24;
+ // el->add(MidiPlayEvent(0, port, channel, ME_CONTROLLER, vl->num(), val));
+ // }
+ iMidiCtrlVal imcv = vl->iValue(pos);
+ if(imcv != vl->end())
+ {
+ Part* p = imcv->second.part;
+ unsigned t = (unsigned)imcv->first;
+ // Do not add values that are outside of the part.
+ if(p && t >= p->tick() && t < (p->tick() + p->lenTick()) )
+ el->add(MidiPlayEvent(0, port, ivl->first >> 24, ME_CONTROLLER, vl->num(), imcv->second.val));
+ }
+ }
+ dev->setNextPlayEvent(el->begin());
+ }
+ }
+
+//---------------------------------------------------------
+// MidiSeq
+//---------------------------------------------------------
+
+//MidiSeq::MidiSeq(int priority, const char* name)
+// : Thread(priority, name)
+MidiSeq::MidiSeq(const char* name)
+ : Thread(name)
+ {
+ // Changed by Tim. p3.3.17
+ //prio = priority;
+ prio = 0;
+
+ idle = false;
+ midiClock = 0;
+ mclock1 = 0.0;
+ mclock2 = 0.0;
+ songtick1 = songtick2 = 0;
+ lastTempo = 0;
+ storedtimediffs = 0;
+ playStateExt = false; // not playing
+ doSetuid();
+ timerFd=selectTimer();
+ undoSetuid();
+
+ }
+
+//---------------------------------------------------------
+// ~MidiSeq
+//---------------------------------------------------------
+
+MidiSeq::~MidiSeq()
+ {
+ delete timer;
+ }
+
+//---------------------------------------------------------
+// selectTimer()
+// select one of the supported timers to use during this run
+//---------------------------------------------------------
+
+signed int MidiSeq::selectTimer()
+ {
+ int tmrFd;
+
+ printf("Trying RTC timer...\n");
+ timer = new RtcTimer();
+ tmrFd = timer->initTimer();
+ if (tmrFd != -1) { // ok!
+ printf("got timer = %d\n", tmrFd);
+ return tmrFd;
+ }
+ delete timer;
+
+ printf("Trying ALSA timer...\n");
+ timer = new AlsaTimer();
+ tmrFd = timer->initTimer();
+ if ( tmrFd!= -1) { // ok!
+ printf("got timer = %d\n", tmrFd);
+ return tmrFd;
+ }
+ delete timer;
+ timer=NULL;
+ QMessageBox::critical( 0, /*tr*/(QString("Failed to start timer!")),
+ /*tr*/(QString("No functional timer was available.\n"
+ "RTC timer not available, check if /dev/rtc is available and readable by current user\n"
+ "Alsa timer not available, check if module snd_timer is available and /dev/snd/timer is available")));
+ printf("No functional timer available!!!\n");
+ exit(1);
+ }
+
+//---------------------------------------------------------
+// threadStart
+// called from loop()
+//---------------------------------------------------------
+
+void MidiSeq::threadStart(void*)
+ {
+ // Removed by Tim. p3.3.17
+ /*
+ struct sched_param rt_param;
+ memset(&rt_param, 0, sizeof(rt_param));
+ int prio_min = sched_get_priority_min(SCHED_FIFO);
+ int prio_max = sched_get_priority_max(SCHED_FIFO);
+
+ if (prio < prio_min) prio = prio_min;
+ else if (prio > prio_max) prio = prio_max;
+
+ rt_param.sched_priority = prio;
+ int rv = pthread_setschedparam(pthread_self(), SCHED_FIFO, &rt_param);
+ if (rv != 0)
+ perror("set realtime scheduler");
+ */
+
+ int policy;
+ if ((policy = sched_getscheduler (0)) < 0) {
+ printf("Cannot get current client scheduler: %s\n", strerror(errno));
+ }
+ if (policy != SCHED_FIFO)
+ printf("midi thread %d _NOT_ running SCHED_FIFO\n", getpid());
+ updatePollFd();
+ }
+
+//---------------------------------------------------------
+// alsaMidiRead
+//---------------------------------------------------------
+
+static void alsaMidiRead(void*, void*)
+ {
+ // calls itself midiDevice->recordEvent(MidiRecordEvent):
+ alsaProcessMidiInput();
+ }
+
+//---------------------------------------------------------
+// midiRead
+//---------------------------------------------------------
+
+static void midiRead(void*, void* d)
+ {
+ MidiDevice* dev = (MidiDevice*) d;
+ dev->processInput();
+ }
+
+//---------------------------------------------------------
+// synthIRead
+//---------------------------------------------------------
+
+#if 0
+static void synthIRead(void*, void* d)
+ {
+ SynthI* syn = (SynthI*) d;
+ syn->processInput();
+ }
+#endif
+
+//---------------------------------------------------------
+// midiWrite
+//---------------------------------------------------------
+
+static void midiWrite(void*, void* d)
+ {
+ MidiDevice* dev = (MidiDevice*) d;
+ dev->flush();
+ }
+
+//---------------------------------------------------------
+// updatePollFd
+//---------------------------------------------------------
+
+void MidiSeq::updatePollFd()
+ {
+ if (!isRunning())
+ return;
+
+ clearPollFd();
+ addPollFd(timerFd, POLLIN, midiTick, this, 0);
+
+ if (timerFd == -1) {
+ fprintf(stderr, "updatePollFd: no timer fd\n");
+ if (!debugMode)
+ exit(-1);
+ }
+
+ addPollFd(toThreadFdr, POLLIN, ::readMsg, this, 0);
+
+ //---------------------------------------------------
+ // midi ports
+ //---------------------------------------------------
+
+ for (iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd) {
+ MidiDevice* dev = *imd;
+ int port = dev->midiPort();
+ const QString name = dev->name();
+ if (port == -1)
+ continue;
+ if ((dev->rwFlags() & 0x2) || (extSyncFlag.value()
+ //&& (rxSyncPort == port || rxSyncPort == -1))) {
+ //&& (dev->syncInfo().MCIn()))) {
+ && (midiPorts[port].syncInfo().MCIn()))) {
+ if(dev->selectRfd() < 0){
+ //fprintf(stderr, "WARNING: read-file-descriptor for {%s} is negative\n", name.latin1());
+ }
+ addPollFd(dev->selectRfd(), POLLIN, ::midiRead, this, dev);
+ }
+ if (dev->bytesToWrite()){
+ if(dev->selectWfd() < 0){
+ //fprintf(stderr, "WARNING: write-file-descriptor for {%s} is negative\n", name.latin1());
+ }
+ addPollFd(dev->selectWfd(), POLLOUT, ::midiWrite, this, dev);
+ }
+ }
+ // special handling for alsa midi:
+ // (one fd for all devices)
+ // this allows for processing of some alsa events
+ // even if no alsa driver is active (assigned to a port)
+ addPollFd(alsaSelectRfd(), POLLIN, ::alsaMidiRead, this, 0);
+ }
+
+//---------------------------------------------------------
+// threadStop
+// called from loop()
+//---------------------------------------------------------
+
+void MidiSeq::threadStop()
+ {
+ timer->stopTimer();
+ //timer.stopTimer();
+ }
+
+//---------------------------------------------------------
+// setRtcTicks
+// return true on success
+//---------------------------------------------------------
+
+bool MidiSeq::setRtcTicks()
+ {
+
+ //timer.setTimerFreq(config.rtcTicks);
+ //timer.startTimer();
+ timer->setTimerFreq(config.rtcTicks);
+ timer->startTimer();
+ realRtcTicks = config.rtcTicks;
+ return true;
+ }
+
+//---------------------------------------------------------
+// start
+// return true on error
+//---------------------------------------------------------
+
+//bool MidiSeq::start()
+void MidiSeq::start(int priority)
+ {
+ // Changed by Tim. p3.3.17
+
+ prio = priority;
+
+ //timerFd = -1;
+
+ doSetuid();
+ //timerFd = selectTimer();
+ //timerFd = timer.initTimer();
+ //printf("timerFd=%d\n",timerFd);
+ setRtcTicks();
+ undoSetuid();
+ //Thread::start();
+ Thread::start(priority);
+ //return false;
+ }
+
+//---------------------------------------------------------
+// processMidiClock
+//---------------------------------------------------------
+
+void MidiSeq::processMidiClock()
+ {
+// if (genMCSync) {
+// midiPorts[txSyncPort].sendClock();
+// }
+
+/* if (state == START_PLAY) {
+ // start play on sync
+ state = PLAY;
+ _midiTick = playTickPos;
+ midiClock = playTickPos;
+
+ int bar, beat, tick;
+ sigmap.tickValues(_midiTick, &bar, &beat, &tick);
+ midiClick = sigmap.bar2tick(bar, beat+1, 0);
+
+ double cpos = tempomap.tick2time(playTickPos);
+ samplePosStart = samplePos - lrint(cpos * sampleRate);
+ rtcTickStart = rtcTick - lrint(cpos * realRtcTicks);
+
+ endSlice = playTickPos;
+ recTick = playTickPos;
+ lastTickPos = playTickPos;
+
+ tempoSN = tempomap.tempoSN();
+
+ startRecordPos.setPosTick(playTickPos);
+ }
+*/
+// midiClock += config.division/24;
+ }
+
+//---------------------------------------------------------
+// midiTick
+//---------------------------------------------------------
+
+void MidiSeq::midiTick(void* p, void*)
+ {
+ MidiSeq* at = (MidiSeq*)p;
+ at->processTimerTick();
+ if (TIMER_DEBUG)
+ {
+ if(MidiSeq::ticker++ > 100)
+ {
+ printf("tick!\n");
+ MidiSeq::ticker=0;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// processTimerTick
+//---------------------------------------------------------
+
+void MidiSeq::processTimerTick()
+ {
+ // Disabled by Tim. p3.3.22
+// extern int watchMidi;
+// ++watchMidi; // make a simple watchdog happy
+
+ //---------------------------------------------------
+ // read elapsed rtc timer ticks
+ //---------------------------------------------------
+
+ // This is required otherwise it freezes.
+ unsigned long nn;
+ if (timerFd != -1) {
+ nn = timer->getTimerTicks();
+ //nn = timer.getTimerTicks();
+ nn >>= 8;
+ }
+
+ if (idle) {
+// printf("IDLE\n");
+ return;
+ }
+ if (midiBusy) {
+ // we hit audio: midiSeq->msgProcess
+ // miss this timer tick
+ return;
+ }
+
+ unsigned curFrame = audio->curFrame();
+
+ // Keep the sync detectors running...
+ // No, done in Song::beat(), (at the much slower heartbeat rate).
+ //
+ //for(int port = 0; port < MIDI_PORTS; ++port)
+ //{
+ // Must keep them running even if there's no device...
+ //if(midiPorts[port].device())
+ // midiPorts[port].syncInfo().setCurFrame(curFrame);
+ //}
+ //for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd)
+ // (*imd)->syncInfo().setCurFrame(curFrame);
+
+ if (!extSyncFlag.value()) {
+ //int curTick = tempomap.frame2tick(curFrame);
+ // Copied from Tempomap.
+ //int curTick = lrint((double(curFrame)/double(sampleRate)) * tempomap.globalTempo() * config.division * 10000.0 / double(tempomap.tempo(song->cpos())));
+ //int curTick = lrint((double(curFrame)/double(sampleRate)) * tempomap.globalTempo() * 240000.0 / double(tempomap.tempo(song->cpos())));
+ int curTick = lrint((double(curFrame)/double(sampleRate)) * double(tempomap.globalTempo()) * double(config.division) * 10000.0 / double(tempomap.tempo(song->cpos())));
+ //int curTick = int((double(curFrame)/double(sampleRate)) * double(tempomap.globalTempo()) * double(config.division * 10000.0) / double(tempomap.tempo(song->cpos())));
+
+/* if ( midiClock > curTick + 100) // reinitialize
+ {
+ midiClock = curTick;
+ }
+ else if( curTick > midiClock + 100) // reinitialize
+ {
+ midiClock = curTick;
+ }*/
+
+ if(midiClock > curTick)
+ midiClock = curTick;
+
+ int div = config.division/24;
+ if(curTick >= midiClock + div) {
+ //if(curTick >= midiClock) {
+ //processMidiClock();
+ int perr = (curTick - midiClock) / div;
+ //int perr = curTick - midiClock;
+
+ bool used = false;
+
+ //if(genMCSync)
+ //{
+ //midiPorts[txSyncPort].sendClock();
+ for(int port = 0; port < MIDI_PORTS; ++port)
+ {
+ MidiPort* mp = &midiPorts[port];
+
+ // No device? Clock out not turned on?
+ //MidiDevice* dev = mp->device();
+ //if(!dev || !mp->syncInfo().MCOut())
+ if(!mp->device() || !mp->syncInfo().MCOut())
+ continue;
+
+ // Shall we check open flags?
+ //if(!(dev->rwFlags() & 0x1) || !(dev->openFlags() & 1))
+ //if(!(dev->openFlags() & 1))
+ // continue;
+
+ used = true;
+
+ mp->sendClock();
+ }
+
+ /*
+ for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd)
+ {
+ MidiDevice* dev = *imd;
+
+ if(!dev->syncInfo().MCOut())
+ continue;
+
+ // Shall we check open flags?
+ //if(!(dev->rwFlags() & 0x1) || !(dev->openFlags() & 1))
+ //if(!(dev->openFlags() & 1))
+ // continue;
+
+ int port = dev->midiPort();
+ // Without this -1 check, interesting sync things can be done by the user without ever
+ // assigning any devices to ports !
+ //if(port < 0 || port > MIDI_PORTS)
+ if(port < -1 || port > MIDI_PORTS)
+ continue;
+
+ if(port == -1)
+ // Send straight to the device... Copied from MidiPort.
+ {
+ MidiPlayEvent event(0, 0, 0, ME_CLOCK, 0, 0);
+ dev->putEvent(event);
+ }
+ else
+ // Go through the port...
+ midiPorts[port].sendClock();
+ }
+ */
+
+ if(debugMsg && used && perr > 1)
+ printf("Dropped %d midi out clock(s). curTick:%d midiClock:%d div:%d\n", perr, curTick, midiClock, div);
+ //}
+
+ // Keeping in mind how (receiving end) Phase Locked Loops (usually) operate...
+ // Increment as if we had caught the timer exactly on the mark, even if the timer
+ // has passed beyond the mark, or even beyond 2 * div.
+ // If we missed some chances to send clock, resume the count where it would have been,
+ // had we not missed chances.
+ // We can't do anything about missed chances except send right away, and make up
+ // for gained time by losing time in the next count...
+ // In other words, use equalization periods to counter gained/lost time, so that
+ // ultimately, over time, the receiver remains in phase, despite any short dropouts / phase glitches.
+ // (midiClock only increments by div units).
+ //
+ // Tested: With midi thread set to high priority, very few clock dropouts ocurred (P4 1.6Ghz).
+ // But target device tick drifts out of phase with muse tick slowly over time, say 20 bars or so.
+ // May need more tweaking, possibly use round with/instead of lrint (above), and/or
+ // do not use equalization periods - set midiClock to fractions of div.
+ // Tested: With RTC resolution at 1024, stability was actually better than with 8192!
+ // It stayed in sync more than 64 bars...
+ //
+ //
+ // Using equalization periods...
+ midiClock += (perr * div);
+ //midiClock += perr;
+ //
+ // No equalization periods... TODO:
+ //midiClock += (perr * div);
+ }
+ }
+
+// if (genMTCSync) {
+ // printf("Midi Time Code Sync generation not impl.\n");
+// }
+
+ // p3.3.25
+ int tickpos = audio->tickPos();
+ bool extsync = extSyncFlag.value();
+ //
+ // play all events upto curFrame
+ //
+ for (iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) {
+ MidiDevice* md = *id;
+ // Is it a Jack midi device? p3.3.36
+ //MidiJackDevice* mjd = dynamic_cast<MidiJackDevice*>(md);
+ //if(mjd)
+ if(md->deviceType() == MidiDevice::JACK_MIDI)
+ continue;
+ if(md->isSynti()) // syntis are handled by audio thread
+ continue;
+ int port = md->midiPort();
+ MidiPort* mp = port != -1 ? &midiPorts[port] : 0;
+ MPEventList* el = md->playEvents();
+ if (el->empty())
+ continue;
+ iMPEvent i = md->nextPlayEvent();
+ for (; i != el->end(); ++i) {
+ // p3.3.25
+ // If syncing to external midi sync, we cannot use the tempo map.
+ // Therefore we cannot get sub-tick resolution. Just use ticks instead of frames.
+ //if (i->time() > curFrame) {
+ if (i->time() > (extsync ? tickpos : curFrame)) {
+ //printf(" curT %d frame %d\n", i->time(), curFrame);
+ break; // skip this event
+ }
+
+ if (mp) {
+ if (mp->sendEvent(*i))
+ break;
+ }
+ else {
+ if (md->putEvent(*i))
+ break;
+ }
+ }
+ md->setNextPlayEvent(i);
+ }
+ }
+
+//---------------------------------------------------------
+// msgMsg
+//---------------------------------------------------------
+
+void MidiSeq::msgMsg(int id)
+ {
+ AudioMsg msg;
+ msg.id = id;
+ Thread::sendMsg(&msg);
+ }
+
+//---------------------------------------------------------
+// msgSetMidiDevice
+// to avoid timeouts in the RT-thread, setMidiDevice
+// is done in GUI context after setting the midi thread
+// into idle mode
+//---------------------------------------------------------
+
+void MidiSeq::msgSetMidiDevice(MidiPort* port, MidiDevice* device)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_IDLE;
+ msg.a = true;
+ Thread::sendMsg(&msg);
+
+ port->setMidiDevice(device);
+
+ msg.id = SEQM_IDLE;
+ msg.a = false;
+ Thread::sendMsg(&msg);
+ }
+
+void MidiSeq::msgProcess() { msgMsg(MS_PROCESS); }
+void MidiSeq::msgSeek() { msgMsg(SEQM_SEEK); }
+void MidiSeq::msgStop() { msgMsg(MS_STOP); }
+void MidiSeq::msgSetRtc() { msgMsg(MS_SET_RTC); }
+void MidiSeq::msgUpdatePollFd() { msgMsg(MS_UPDATE_POLL_FD); }
+
diff --git a/muse2/muse/midiseq.h b/muse2/muse/midiseq.h
new file mode 100644
index 00000000..a11820fe
--- /dev/null
+++ b/muse2/muse/midiseq.h
@@ -0,0 +1,102 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midiseq.h,v 1.6.2.11 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MIDISEQ_H__
+#define __MIDISEQ_H__
+
+#include "thread.h"
+#include "mpevent.h"
+#include "driver/alsatimer.h"
+#include "driver/rtctimer.h"
+
+class MPEventList;
+class SynthI;
+class MTC;
+class MidiPort;
+class MidiDevice;
+
+//---------------------------------------------------------
+// MidiSeq
+//---------------------------------------------------------
+
+class MidiSeq : public Thread {
+ int realRtcTicks;
+ int timerFd;
+ int idle;
+ int prio; // realtime priority
+ int midiClock;
+ static int ticker;
+
+/* Testing */
+ bool playStateExt; // used for keeping play state in sync functions
+ int recTick; // ext sync tick position
+// int lastTickPos; // position of last sync tick
+ // run values:
+// unsigned _midiTick;
+ double mclock1, mclock2;
+ double songtick1, songtick2;
+ int recTick1, recTick2;
+ int lastTempo;
+ double timediff[24];
+ int storedtimediffs;
+
+ void alignAllTicks(int frameOverride = 0);
+/* Testing */
+
+ Timer *timer;
+
+ signed int selectTimer();
+ bool setRtcTicks();
+ static void midiTick(void* p, void*);
+ void processTimerTick();
+ void processSeek();
+ void processStop();
+ void processMidiClock();
+ virtual void processMsg(const ThreadMsg*);
+ void updatePollFd();
+
+ void mtcSyncMsg(const MTC&, int, bool);
+ //void mtcInputFull(const unsigned char* p, int n);
+ //void nonRealtimeSystemSysex(const unsigned char* p, int n);
+
+ public:
+ //MidiSeq(int prio, const char* name);
+ MidiSeq(const char* name);
+
+ ~MidiSeq();
+
+ //bool start();
+ virtual void start(int);
+
+ virtual void threadStop();
+ virtual void threadStart(void*);
+
+ void realtimeSystemInput(int, int);
+ void mtcInputQuarter(int, unsigned char);
+ void setSongPosition(int, int);
+ // void eventReceived(MidiRecordEvent& event);
+ //void mmcInput(const unsigned char* p, int n);
+ void mmcInput(int, const unsigned char*, int);
+ void mtcInputFull(int, const unsigned char*, int);
+ void nonRealtimeSystemSysex(int, const unsigned char*, int);
+
+ void msgMsg(int id);
+ void msgProcess();
+ void msgSeek();
+ void msgStop();
+ void msgSetRtc();
+ void msgUpdatePollFd();
+ void msgAddSynthI(SynthI* synth);
+ void msgRemoveSynthI(SynthI* synth);
+ void msgSetMidiDevice(MidiPort*, MidiDevice*);
+ };
+
+extern MidiSeq* midiSeq;
+extern volatile bool midiBusy;
+#endif
+
diff --git a/muse2/muse/miditransform.cpp b/muse2/muse/miditransform.cpp
new file mode 100644
index 00000000..486f47c5
--- /dev/null
+++ b/muse2/muse/miditransform.cpp
@@ -0,0 +1,1702 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: miditransform.cpp,v 1.8.2.3 2009/05/24 21:43:44 terminator356 Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <list>
+#include <qpushbutton.h>
+#include <qlineedit.h>
+#include <qcombobox.h>
+#include <q3listbox.h>
+#include <qspinbox.h>
+#include <q3multilineedit.h>
+#include <qcheckbox.h>
+
+#include "helper.h"
+#include "spinboxFP.h"
+#include "event.h"
+#include "miditransform.h"
+#include "track.h"
+#include "song.h"
+#include "xml.h"
+#include "globals.h"
+#include "comboQuant.h"
+#include "pitchedit.h"
+#include "audio.h"
+#include "gconfig.h"
+#include "midictrl.h"
+
+//
+// Order of events:
+// Note, Poly Pressure, Control, AfterTouch, Pitch Bend, NRPN, RPN
+//
+#define MIDITRANSFORM_NOTE 0
+#define MIDITRANSFORM_POLY 1
+#define MIDITRANSFORM_CTRL 2
+#define MIDITRANSFORM_ATOUCH 3
+#define MIDITRANSFORM_PITCHBEND 4
+#define MIDITRANSFORM_NRPN 5
+#define MIDITRANSFORM_RPN 6
+
+
+static int eventTypeTable[] = {
+ MIDITRANSFORM_NOTE, MIDITRANSFORM_POLY, MIDITRANSFORM_CTRL, MIDITRANSFORM_ATOUCH,
+ MIDITRANSFORM_PITCHBEND, MIDITRANSFORM_NRPN, MIDITRANSFORM_RPN
+ };
+
+static int procVal2Map[] = { 0, 1, 2, 3, 4, 5, 6, 7, 10, 11 };
+
+//---------------------------------------------------------
+// MidiTransformation
+//---------------------------------------------------------
+
+class MidiTransformation {
+ public:
+ QString name;
+ QString comment;
+
+ ValOp selEventOp;
+ EventType selType;
+
+ ValOp selVal1;
+ int selVal1a, selVal1b;
+ ValOp selVal2;
+ int selVal2a, selVal2b;
+ ValOp selLen;
+ int selLenA, selLenB;
+ ValOp selRange;
+ int selRangeA, selRangeB;
+
+ TransformOperator procEvent;
+ EventType eventType;
+ TransformOperator procVal1;
+ int procVal1a, procVal1b;
+ TransformOperator procVal2;
+ int procVal2a, procVal2b;
+ TransformOperator procLen;
+ int procLenA;
+ TransformOperator procPos;
+ int procPosA;
+
+ TransformFunction funcOp;
+ int quantVal;
+ bool selectedTracks;
+ bool insideLoop;
+
+ MidiTransformation(const QString& s) {
+ name = s;
+ selEventOp = All;
+ selType = Note;
+ selVal1 = Ignore;
+ selVal1a = 0;
+ selVal1b = 0;
+ selVal2 = Ignore;
+ selVal2a = 0;
+ selVal2b = 0;
+ selLen = Ignore;
+ selLenA = 0;
+ selLenB = 0;
+ selRange = Ignore;
+ selRangeA = 0;
+ selRangeB = 0;
+ procEvent = Keep;
+ eventType = Note;
+ procVal1 = Keep;
+ procVal1a = 0;
+ procVal1b = 0;
+ procVal2 = Keep;
+ procVal2a = 0;
+ procVal2b = 0;
+ procLen = Keep;
+ procLenA = 0;
+ procPos = Keep;
+ procPosA = 0;
+ funcOp = Select;
+ quantVal = config.division;
+ selectedTracks = false;
+ insideLoop = false;
+ }
+ void write(int level, Xml& xml);
+ };
+
+class MidiTransformPrivate {
+ public:
+ MidiTransformation* cmt;
+ int cindex; // current index in preset list
+ };
+
+typedef std::list<MidiTransformation* > MidiTransformationList;
+typedef std::list<MidiTransformation* >::iterator iMidiTransformation;
+typedef std::list<MidiTransformation* >::const_iterator ciMidiTransformation;
+
+static MidiTransformationList mtlist;
+
+//---------------------------------------------------------
+// MidiTransformDialog
+// Widgets:
+// presetList nameEntry commentEntry
+// selEventOp selType
+// selVal1Op selVal1a selVal1b
+// selVal2Op selVal2a selVal2b
+// selLenOp selLenA selLenB
+// selRangeOp selBarA selBarB
+//
+// procEventOp procType
+// procVal1Op procVal1a procVal1b
+// procVal2Op procVal2a procVal2b
+// procLenOp procLenA
+// procPosOp procPosA
+// funcOp funcQuantVal
+// processAll selectedTracks insideLoop
+// buttonNew buttonDelete buttonApply buttonOk
+//---------------------------------------------------------
+
+MidiTransformerDialog::MidiTransformerDialog(QWidget* parent,
+ const char* name, bool modal, Qt::WFlags fl)
+ : MidiTransformDialogBase(parent, name, modal, fl)
+ {
+ data = new MidiTransformPrivate;
+ data->cmt = 0;
+ data->cindex = -1;
+ connect(buttonApply, SIGNAL(clicked()), SLOT(apply()));
+ connect(buttonNew, SIGNAL(clicked()), SLOT(presetNew()));
+ connect(buttonDelete, SIGNAL(clicked()), SLOT(presetDelete()));
+ connect(selEventOp, SIGNAL(activated(int)), SLOT(selEventOpSel(int)));
+ connect(selType, SIGNAL(activated(int)), SLOT(selTypeSel(int)));
+ connect(selVal1Op, SIGNAL(activated(int)), SLOT(selVal1OpSel(int)));
+ connect(selVal2Op, SIGNAL(activated(int)), SLOT(selVal2OpSel(int)));
+ connect(selLenOp, SIGNAL(activated(int)), SLOT(selLenOpSel(int)));
+ connect(selRangeOp, SIGNAL(activated(int)), SLOT(selRangeOpSel(int)));
+ connect(procEventOp, SIGNAL(activated(int)), SLOT(procEventOpSel(int)));
+ connect(procType, SIGNAL(activated(int)), SLOT(procEventTypeSel(int)));
+ connect(procVal1Op, SIGNAL(activated(int)), SLOT(procVal1OpSel(int)));
+ connect(procVal2Op, SIGNAL(activated(int)), SLOT(procVal2OpSel(int)));
+ connect(procLenOp, SIGNAL(activated(int)), SLOT(procLenOpSel(int)));
+ connect(procPosOp, SIGNAL(activated(int)), SLOT(procPosOpSel(int)));
+ connect(funcOp, SIGNAL(activated(int)), SLOT(funcOpSel(int)));
+ connect(funcQuantVal, SIGNAL(valueChanged(int)), SLOT(funcQuantValSel(int)));
+ connect(presetList, SIGNAL(highlighted(Q3ListBoxItem*)),
+ SLOT(presetChanged(Q3ListBoxItem*)));
+ connect(nameEntry, SIGNAL(textChanged(const QString&)),
+ SLOT(nameChanged(const QString&)));
+ connect(commentEntry, SIGNAL(textChanged()), SLOT(commentChanged()));
+
+ connect(selVal1a, SIGNAL(valueChanged(int)), SLOT(selVal1aChanged(int)));
+ connect(selVal1b, SIGNAL(valueChanged(int)), SLOT(selVal1bChanged(int)));
+ connect(selVal2a, SIGNAL(valueChanged(int)), SLOT(selVal2aChanged(int)));
+ connect(selVal2b, SIGNAL(valueChanged(int)), SLOT(selVal2bChanged(int)));
+ connect(selLenA, SIGNAL(valueChanged(int)), SLOT(selLenAChanged(int)));
+ connect(selLenB, SIGNAL(valueChanged(int)), SLOT(selLenBChanged(int)));
+ connect(selBarA, SIGNAL(valueChanged(int)), SLOT(selBarAChanged(int)));
+ connect(selBarB, SIGNAL(valueChanged(int)), SLOT(selBarBChanged(int)));
+ connect(procVal1a, SIGNAL(valueChanged(int)), SLOT(procVal1aChanged(int)));
+ connect(procVal1b, SIGNAL(valueChanged(int)), SLOT(procVal1bChanged(int)));
+ connect(procVal2a, SIGNAL(valueChanged(int)), SLOT(procVal2aChanged(int)));
+ connect(procVal2b, SIGNAL(valueChanged(int)), SLOT(procVal2bChanged(int)));
+ connect(procLenA, SIGNAL(valueChanged(int)), SLOT(procLenAChanged(int)));
+ connect(procPosA, SIGNAL(valueChanged(int)), SLOT(procPosAChanged(int)));
+
+ connect(processAll, SIGNAL(toggled(bool)), SLOT(processAllChanged(bool)));
+ connect(selectedTracks, SIGNAL(toggled(bool)), SLOT(selectedTracksChanged(bool)));
+ connect(insideLoop, SIGNAL(toggled(bool)), SLOT(insideLoopChanged(bool)));
+
+ //---------------------------------------------------
+ // populate preset list
+ //---------------------------------------------------
+
+ updatePresetList();
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ }
+
+//---------------------------------------------------------
+// ~MidiTransformDialog
+//---------------------------------------------------------
+
+MidiTransformerDialog::~MidiTransformerDialog()
+ {
+ delete data;
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::songChanged(int flags)
+{
+ // Whenever a song is loaded, flags is -1. Since transforms are part of configuration,
+ // use SC_CONFIG here, to filter unwanted song change events.
+ if(flags & SC_CONFIG)
+ updatePresetList();
+}
+
+//---------------------------------------------------------
+// updatePresetList
+//---------------------------------------------------------
+
+void MidiTransformerDialog::updatePresetList()
+{
+ data->cmt = 0;
+ data->cindex = 0;
+ presetList->clear();
+ for (iMidiTransformation i = mtlist.begin(); i != mtlist.end(); ++i) {
+ presetList->insertItem((*i)->name);
+ if (data->cmt == 0)
+ data->cmt = *i;
+ }
+ if (data->cmt == 0) {
+ data->cmt = new MidiTransformation(tr("New"));
+ mtlist.push_back(data->cmt);
+ presetList->insertItem(tr("New"));
+ presetList->setCurrentItem(0);
+ }
+
+ //data->cindex = 0;
+ //presetList->setCurrentItem(0);
+
+}
+
+//---------------------------------------------------------
+// writeMidiTransforms
+//---------------------------------------------------------
+
+void writeMidiTransforms(int level, Xml& xml)
+ {
+ for (iMidiTransformation i = mtlist.begin(); i != mtlist.end(); ++i) {
+ (*i)->write(level, xml);
+ }
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void MidiTransformation::write(int level, Xml& xml)
+ {
+ xml.tag(level++, "midiTransform");
+ xml.strTag(level, "name", name);
+ xml.strTag(level, "comment", comment);
+ xml.intTag(level, "function", int(funcOp));
+ xml.intTag(level, "selectedTracks", selectedTracks);
+ xml.intTag(level, "insideLoop", insideLoop);
+ if (funcOp == Quantize) {
+ xml.intTag(level, "quantVal", quantVal);
+ }
+ if (funcOp == Transform || funcOp == Insert) {
+ if (procEvent != Keep) {
+ xml.intTag(level, "procEventOp", int(procEvent));
+ xml.intTag(level, "eventType", int(eventType));
+ }
+ if (procVal1 != Keep) {
+ xml.intTag(level, "procVal1Op", int(procVal1));
+ xml.intTag(level, "procVal1a", procVal1a);
+ xml.intTag(level, "procVal1b", procVal1b);
+ }
+ if (procVal2 != Keep) {
+ xml.intTag(level, "procVal2Op", int(procVal2));
+ xml.intTag(level, "procVal2a", procVal2a);
+ xml.intTag(level, "procVal2b", procVal2b);
+ }
+ if (procLen != Keep) {
+ xml.intTag(level, "procLenOp", int(procLen));
+ xml.intTag(level, "procLen", procLenA);
+ }
+ if (procPos != Keep) {
+ xml.intTag(level, "procPosOp", int(procPos));
+ xml.intTag(level, "procPos", procPosA);
+ }
+ }
+ if (selEventOp != Ignore) {
+ xml.intTag(level, "selEventOp", int(selEventOp));
+ xml.intTag(level, "selEventType", int(selType));
+ }
+ if (selVal1 != Ignore) {
+ xml.intTag(level, "selVal1Op", int(selVal1));
+ xml.intTag(level, "selVal1a", selVal1a);
+ xml.intTag(level, "selVal1b", selVal1b);
+ }
+ if (selVal2 != Ignore) {
+ xml.intTag(level, "selVal2Op", int(selVal2));
+ xml.intTag(level, "selVal2a", selVal2a);
+ xml.intTag(level, "selVal2b", selVal2b);
+ }
+ if (selLen != Ignore) {
+ xml.intTag(level, "selLenOp", int(selLen));
+ xml.intTag(level, "selLenA", selLenA);
+ xml.intTag(level, "selLenB", selLenB);
+ }
+ if (selRange != Ignore) {
+ xml.intTag(level, "selRangeOp", int(selRange));
+ xml.intTag(level, "selRangeA", selRangeA);
+ xml.intTag(level, "selRangeB", selRangeB);
+ }
+ xml.etag(level, "midiTransform");
+ }
+
+//---------------------------------------------------------
+// readMidiTransform
+//---------------------------------------------------------
+
+void readMidiTransform(Xml& xml)
+ {
+ MidiTransformation trans(QWidget::tr("new"));
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "name")
+ trans.name = xml.parse1();
+ else if (tag == "comment")
+ trans.comment = xml.parse1();
+ else if (tag == "function")
+ trans.funcOp = TransformFunction(xml.parseInt());
+ else if (tag == "selectedTracks")
+ trans.selectedTracks = xml.parseInt();
+ else if (tag == "insideLoop")
+ trans.insideLoop = xml.parseInt();
+ else if (tag == "quantVal")
+ trans.quantVal = xml.parseInt();
+ else if (tag == "procEventOp")
+ trans.procEvent = TransformOperator(xml.parseInt());
+ else if (tag == "eventType")
+ trans.eventType = EventType(xml.parseInt());
+ else if (tag == "procVal1Op")
+ trans.procVal1 = TransformOperator(xml.parseInt());
+ else if (tag == "procVal1a")
+ trans.procVal1a = xml.parseInt();
+ else if (tag == "procVal1b")
+ trans.procVal1b = xml.parseInt();
+ else if (tag == "procVal2Op")
+ trans.procVal2 = TransformOperator(xml.parseInt());
+ else if (tag == "procVal2a")
+ trans.procVal2a = xml.parseInt();
+ else if (tag == "procVal2b")
+ trans.procVal2b = xml.parseInt();
+ else if (tag == "procLenOp")
+ trans.procLen = TransformOperator(xml.parseInt());
+ else if (tag == "procLen")
+ trans.procLenA = xml.parseInt();
+ else if (tag == "procPosOp")
+ trans.procPos = TransformOperator(xml.parseInt());
+ else if (tag == "procPos")
+ trans.procPosA = xml.parseInt();
+ else if (tag == "selEventOp")
+ trans.selEventOp = ValOp(xml.parseInt());
+ else if (tag == "selEventType")
+ trans.selType = EventType(xml.parseInt());
+ else if (tag == "selVal1Op")
+ trans.selVal1 = ValOp(xml.parseInt());
+ else if (tag == "selVal1a")
+ trans.selVal1a = xml.parseInt();
+ else if (tag == "selVal1b")
+ trans.selVal1b = xml.parseInt();
+ else if (tag == "selVal2Op")
+ trans.selVal2 = ValOp(xml.parseInt());
+ else if (tag == "selVal2a")
+ trans.selVal2a = xml.parseInt();
+ else if (tag == "selVal2b")
+ trans.selVal2b = xml.parseInt();
+ else if (tag == "selLenOp")
+ trans.selLen = ValOp(xml.parseInt());
+ else if (tag == "selLenA")
+ trans.selLenA = xml.parseInt();
+ else if (tag == "selLenB")
+ trans.selLenB = xml.parseInt();
+ else if (tag == "selRangeOp")
+ trans.selRange = ValOp(xml.parseInt());
+ else if (tag == "selRangeA")
+ trans.selRangeA = xml.parseInt();
+ else if (tag == "selRangeB")
+ trans.selRangeB = xml.parseInt();
+ else
+ xml.unknown("midiTransform");
+ break;
+ case Xml::TagEnd:
+ if (xml.s1() == "midiTransform") {
+ // By T356. A previous bug caused some .med files to grow very large
+ // with duplicate transforms. Here we can eliminate those duplicates.
+ for(iMidiTransformation i = mtlist.begin(); i != mtlist.end(); ++i)
+ {
+ if((*i)->name == trans.name)
+ return;
+ }
+
+ MidiTransformation* t = new MidiTransformation(trans);
+ mtlist.push_back(t);
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// clearMidiTransforms
+//---------------------------------------------------------
+
+void clearMidiTransforms()
+{
+ for (iMidiTransformation i = mtlist.begin(); i != mtlist.end(); ++i)
+ {
+ MidiTransformation* t = *i;
+ if(t)
+ delete t;
+ }
+ mtlist.clear();
+}
+
+//---------------------------------------------------------
+// accept
+//---------------------------------------------------------
+
+void MidiTransformerDialog::accept()
+ {
+ apply();
+ reject();
+ }
+
+//---------------------------------------------------------
+// transformEvent
+// subfunction of processEvent()
+//---------------------------------------------------------
+
+void MidiTransformerDialog::transformEvent(Event& event, MidiPart* part,
+ MidiPart* newPart)
+ {
+ MidiTransformation* cmt = data->cmt;
+ Event newEvent = event.clone();
+
+ if (cmt->procEvent != Keep)
+ newEvent.setType(cmt->eventType);
+
+ //---------------------------------------------------
+ // transform value A
+ //---------------------------------------------------
+
+ int val = newEvent.dataA();
+ switch (cmt->procVal1) {
+ case Keep:
+ break;
+ case Plus:
+ val += cmt->procVal1a;
+ break;
+ case Minus:
+ val -= cmt->procVal1a;
+ break;
+ case Multiply:
+ val = int(val * (cmt->procVal1a/100.0) + .5);
+ break;
+ case Divide:
+ val = int(val / (cmt->procVal1a/100.0) + .5);
+ break;
+ case Fix:
+ val = cmt->procVal1a;
+ break;
+ case Value:
+ val = cmt->procVal2a;
+ break;
+ case Invert:
+ val = 128 - val;
+ break;
+ case ScaleMap:
+ printf("scale map not implemented\n");
+ break;
+ case Flip:
+ val = cmt->procVal1a - val;
+ break;
+ case Dynamic: // "crescendo"
+ val = (((cmt->procVal2b-cmt->procVal2a)
+ * (newEvent.tick() - song->lpos()))
+ / (song->rpos() - song->lpos())) + cmt->procVal2a;
+ break;
+ case Random:
+ {
+ int range = cmt->procVal1b - cmt->procVal1a;
+ if (range > 0)
+ val = (rand() % range) + cmt->procVal1a;
+ else if (range < 0)
+ val = (rand() % -range) + cmt->procVal1b;
+ else
+ val = cmt->procVal1a;
+ }
+ break;
+ }
+ if (val < 0)
+ val = 0;
+ if (val > 127)
+ val = 127;
+ newEvent.setA(val);
+
+ //---------------------------------------------------
+ // transform value B
+ //---------------------------------------------------
+
+ val = newEvent.dataB();
+ switch (cmt->procVal2) {
+ case Plus:
+ val += cmt->procVal2a;
+ break;
+ case Minus:
+ val -= cmt->procVal2a;
+ break;
+ case Multiply:
+ val = int(val * (cmt->procVal2a/100.0) + .5);
+ break;
+ case Divide:
+ val = int(val / (cmt->procVal2a/100.0) + .5);
+ break;
+ case Fix:
+ val = cmt->procVal2a;
+ break;
+ case Value:
+ val = cmt->procVal1a;
+ break;
+ case Invert:
+ val = 128 - val;
+ break;
+ case Dynamic:
+ val = (((cmt->procVal2b-cmt->procVal2a)
+ * (newEvent.tick() - song->lpos()))
+ / (song->rpos() - song->lpos())) + cmt->procVal2a;
+ break;
+ case Random:
+ {
+ int range = cmt->procVal2b - cmt->procVal2a;
+ if (range > 0)
+ val = (rand() % range) + cmt->procVal2a;
+ else if (range < 0)
+ val = (rand() % -range) + cmt->procVal2b;
+ else
+ val = cmt->procVal1a;
+ }
+ break;
+ case ScaleMap:
+ case Keep:
+ case Flip:
+ break;
+ }
+ if (val < 0)
+ val = 0;
+ if (val > 127)
+ val = 127;
+ newEvent.setB(val);
+
+ //---------------------------------------------------
+ // transform len
+ //---------------------------------------------------
+
+ int len = newEvent.lenTick();
+ switch (cmt->procLen) {
+ case Plus:
+ len += cmt->procLenA;
+ break;
+ case Minus:
+ len -= cmt->procLenA;
+ break;
+ case Multiply:
+ len = int(val * (cmt->procLenA/100.0) + .5);
+ break;
+ case Divide:
+ len = int(val / (cmt->procLenA/100.0) + .5);
+ break;
+ case Fix:
+ len = cmt->procLenA;
+ break;
+ case Invert:
+ case ScaleMap:
+ case Dynamic:
+ case Random:
+ case Keep:
+ case Flip:
+ case Value:
+ break;
+ }
+ if (len < 0)
+ len = 0;
+ newEvent.setLenTick(len);
+
+ //---------------------------------------------------
+ // transform pos
+ //---------------------------------------------------
+
+ int pos = newEvent.tick();
+ switch (cmt->procPos) {
+ case Plus:
+ pos += cmt->procPosA;
+ break;
+ case Minus:
+ pos -= cmt->procPosA;
+ break;
+ case Multiply:
+ pos = int(val * (cmt->procPosA/100.0) + .5);
+ break;
+ case Divide:
+ pos = int(val / (cmt->procPosA/100.0) + .5);
+ break;
+ case Fix:
+ case Invert:
+ case ScaleMap:
+ case Dynamic:
+ case Random:
+ case Keep:
+ case Flip:
+ case Value:
+ break;
+ }
+ if (pos < 0)
+ pos = 0;
+ newEvent.setTick(pos);
+
+ Event dummy;
+ switch(data->cmt->funcOp) {
+ case Transform:
+ // Indicate do clone parts.
+ removePortCtrlEvents(event, part, true);
+ song->changeEvent(event, newEvent, part);
+ // Indicate do clone parts.
+ addPortCtrlEvents(newEvent, part, true);
+ // Indicate do port controller values and clone parts.
+ //song->undoOp(UndoOp::ModifyEvent, newEvent, event, part);
+ song->undoOp(UndoOp::ModifyEvent, newEvent, event, part, true, true);
+ song->addUpdateFlags(SC_EVENT_MODIFIED);
+ break;
+ case Insert:
+ // Indicate do port controller values and clone parts.
+ //song->undoOp(UndoOp::AddEvent, dummy, newEvent, part);
+ song->undoOp(UndoOp::AddEvent, dummy, newEvent, part, true, true);
+ song->addEvent(newEvent, part);
+ // Indicate do clone parts.
+ addPortCtrlEvents(newEvent, part, true);
+ song->addUpdateFlags(SC_EVENT_INSERTED);
+ break;
+ case Extract:
+ // Indicate do port controller values and clone parts.
+ //song->undoOp(UndoOp::DeleteEvent, dummy, event, part);
+ song->undoOp(UndoOp::DeleteEvent, dummy, event, part, true, true);
+ // Indicate do clone parts.
+ removePortCtrlEvents(event, part, true);
+ song->deleteEvent(event, part);
+ song->addUpdateFlags(SC_EVENT_REMOVED);
+ case Copy:
+ newPart->addEvent(newEvent);
+ break;
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// processEvent
+//---------------------------------------------------------
+
+void MidiTransformerDialog::processEvent(Event& event, MidiPart* part, MidiPart* newPart)
+ {
+ switch(data->cmt->funcOp) {
+ case Select:
+ break;
+ case Quantize:
+ {
+ int tick = event.tick();
+ int rt = sigmap.raster(tick, data->cmt->quantVal) - tick;
+ if (tick != rt) {
+ // Indicate do clone parts.
+ removePortCtrlEvents(event, part, true);
+ Event newEvent = event.clone();
+ newEvent.setTick(rt);
+ song->changeEvent(event, newEvent, part);
+ // Indicate do clone parts.
+ addPortCtrlEvents(newEvent, part, true);
+ // Indicate do port controller values and clone parts.
+ //song->undoOp(UndoOp::ModifyEvent, newEvent, event, part);
+ song->undoOp(UndoOp::ModifyEvent, newEvent, event, part, true, true);
+ song->addUpdateFlags(SC_EVENT_MODIFIED);
+ }
+ }
+ break;
+ case Delete:
+ {
+ Event ev;
+ // Indicate do port controller values and clone parts.
+ //song->undoOp(UndoOp::DeleteEvent, ev, event, part, true, true);
+ song->undoOp(UndoOp::DeleteEvent, ev, event, part, true, true);
+ // Indicate do clone parts.
+ removePortCtrlEvents(event, part, true);
+ song->deleteEvent(event, part);
+ song->addUpdateFlags(SC_EVENT_REMOVED);
+ }
+ break;
+ case Transform:
+ case Insert:
+ case Copy:
+ case Extract:
+ transformEvent(event, part, newPart);
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// isSelected
+// apply Select filter
+// return true if event is selected
+//---------------------------------------------------------
+
+bool MidiTransformerDialog::isSelected(Event& event, MidiPart*)
+ {
+ MidiTransformation* cmt = data->cmt;
+
+ switch (cmt->selEventOp) {
+ case Equal:
+ if (!typesMatch(event, cmt->selType)) {
+ return false;
+ }
+ break;
+ case Unequal:
+ if (typesMatch(event, cmt->selType))
+ return false;
+ break;
+ default:
+ break;
+ }
+ switch (cmt->selVal1) {
+ case Ignore:
+ break;
+ case Equal:
+ if (event.dataA() != cmt->selVal1a)
+ return false;
+ break;
+ case Unequal:
+ if (event.dataA() == cmt->selVal1a)
+ return false;
+ break;
+ case Higher:
+ if (event.dataA() <= cmt->selVal1a)
+ return false;
+ break;
+ case Lower:
+ if (event.dataA() >= cmt->selVal1a)
+ return false;
+ break;
+ case Inside:
+ if ((event.dataA() < cmt->selVal1a)
+ || (event.dataA() >= cmt->selVal1b))
+ return false;
+ break;
+ case Outside:
+ if ((event.dataA() >= cmt->selVal1a)
+ && (event.dataA() < cmt->selVal1b))
+ return false;
+ break;
+ }
+ switch (cmt->selVal2) {
+ case Ignore:
+ break;
+ case Equal:
+ if (event.dataB() != cmt->selVal2a)
+ return false;
+ break;
+ case Unequal:
+ if (event.dataB() == cmt->selVal2a)
+ return false;
+ break;
+ case Higher:
+ if (event.dataB() <= cmt->selVal2a)
+ return false;
+ break;
+ case Lower:
+ if (event.dataB() >= cmt->selVal2a)
+ return false;
+ break;
+ case Inside:
+ if ((event.dataB() < cmt->selVal2a)
+ || (event.dataB() >= cmt->selVal2b))
+ return false;
+ break;
+ case Outside:
+ if ((event.dataB() >= cmt->selVal2a)
+ && (event.dataB() < cmt->selVal2b))
+ return false;
+ break;
+ }
+ int len = event.lenTick();
+ switch (cmt->selLen) {
+ case Ignore:
+ break;
+ case Equal:
+ if (len != cmt->selLenA)
+ return false;
+ break;
+ case Unequal:
+ if (len == cmt->selLenA)
+ return false;
+ break;
+ case Higher:
+ if (len <= cmt->selLenA)
+ return false;
+ break;
+ case Lower:
+ if (len >= cmt->selLenA)
+ return false;
+ break;
+ case Inside:
+ if ((len < cmt->selLenA) || (len >= cmt->selLenB))
+ return false;
+ break;
+ case Outside:
+ if ((len >= cmt->selLenA) && (len < cmt->selLenB))
+ return false;
+ break;
+ }
+ int bar, beat;
+ unsigned tick;
+ sigmap.tickValues(event.tick(), &bar, &beat, &tick);
+ int beat1 = cmt->selRangeA / 1000;
+ unsigned tick1 = cmt->selRangeA % 1000;
+ int beat2 = cmt->selRangeB / 1000;
+ unsigned tick2 = cmt->selRangeB % 1000;
+ switch (cmt->selRange) {
+ case Ignore:
+ break;
+ case Equal:
+ if (beat != beat1 || tick != tick1)
+ return false;
+ break;
+ case Unequal:
+ if (beat == beat1 && tick == tick1)
+ return false;
+ break;
+ case Higher:
+ if (beat <= beat1)
+ return false;
+ if (beat == beat1 && tick <= tick1)
+ return false;
+ break;
+ case Lower:
+ if (beat >= beat1)
+ return false;
+ if (beat == beat1 && tick >= tick1)
+ return false;
+ break;
+ case Inside:
+ if ((beat < beat1) || (beat >= beat2))
+ return false;
+ if (beat == beat1 && tick < tick1)
+ return false;
+ if (beat == beat2 && tick >= tick2)
+ return false;
+ break;
+ case Outside:
+ if ((beat >= beat1) || (beat < beat2))
+ return false;
+ if (beat == beat1 && tick >= tick1)
+ return false;
+ if (beat == beat2 && tick < tick2)
+ return false;
+ break;
+ }
+ return true;
+ }
+
+//---------------------------------------------------------
+// apply
+//---------------------------------------------------------
+
+void MidiTransformerDialog::apply()
+ {
+ int flags = 0;
+ song->startUndo();
+ audio->msgIdle(true);
+ bool copyExtract = (data->cmt->funcOp == Copy)
+ || (data->cmt->funcOp == Extract);
+
+ std::vector< EventList* > doneList;
+ typedef std::vector< EventList* >::iterator iDoneList;
+ iDoneList idl;
+
+ MidiTrackList* tracks = song->midis();
+ MidiTrackList tl;
+ for (iMidiTrack t = tracks->begin(); t != tracks->end(); ++t) {
+ if (data->cmt->selectedTracks && !(*t)->selected())
+ continue;
+ MidiTrack* newTrack = 0;
+ PartList *pl = (*t)->parts();
+ if (copyExtract) {
+ // check wether we must generate a new track
+ for (iPart p = pl->begin(); p != pl->end(); ++p) {
+ MidiPart* part = (MidiPart *) p->second;
+ EventList* el = part->events();
+ // Check if the event list has already been done. Skip repeated clones.
+ for(idl = doneList.begin(); idl != doneList.end(); ++idl)
+ if(*idl == el)
+ break;
+ if(idl != doneList.end())
+ break;
+ doneList.push_back(el);
+
+ for (iEvent i = el->begin(); i != el->end(); ++i) {
+ Event event = i->second;
+ unsigned tick = event.tick();
+ if (data->cmt->insideLoop && (tick < song->lpos() || tick >= song->rpos()))
+ continue;
+ if (isSelected(event, part)) {
+ newTrack = new MidiTrack();
+ tl.push_back(newTrack);
+ break;
+ }
+ }
+ if (newTrack)
+ break;
+ }
+ }
+
+ for (iPart p = pl->begin(); p != pl->end(); ++p) {
+ MidiPart* part = (MidiPart *) p->second;
+ MidiPart* newPart = 0;
+ EventList* el = part->events();
+ // Check if the event list has already been done. Skip repeated clones.
+ for(idl = doneList.begin(); idl != doneList.end(); ++idl)
+ if(*idl == el)
+ break;
+ if(idl != doneList.end())
+ break;
+ doneList.push_back(el);
+
+ if (copyExtract) {
+ // check wether we must generate a new part
+ for (iEvent i = el->begin(); i != el->end(); ++i) {
+ Event event = i->second;
+ unsigned tick = event.tick();
+ if (data->cmt->insideLoop && (tick < song->lpos() || tick >= song->rpos()))
+ continue;
+ if (isSelected(event, part)) {
+ newPart = new MidiPart(newTrack);
+ newPart->setName(part->name());
+ newPart->setColorIndex(part->colorIndex());
+ newPart->setTick(part->tick());
+ newPart->setLenTick(part->lenTick());
+ song->addPart(newPart);
+ flags |= SC_PART_INSERTED;
+ break;
+ }
+ }
+ }
+ EventList pel;
+ for (iEvent i = el->begin(); i != el->end(); ++i) {
+ Event event = i->second;
+ unsigned tick = event.tick();
+ if (data->cmt->insideLoop && (tick < song->lpos() || tick >= song->rpos()))
+ continue;
+ int flag = isSelected(event, part);
+ if (data->cmt->funcOp == Select)
+ event.setSelected(flag);
+ else if (flag)
+ pel.add(event);
+ }
+ for (iEvent i = pel.begin(); i != pel.end(); ++i) {
+ Event event = i->second;
+ processEvent(event, part, newPart);
+ }
+ }
+ }
+ if (!tl.empty()) {
+ flags |= SC_TRACK_INSERTED;
+ for (iTrack t = tl.begin(); t != tl.end(); ++t) {
+ song->insertTrack0(*t, -1);
+ }
+ }
+
+ switch(data->cmt->funcOp) {
+ case Select:
+ flags |= SC_SELECTION;
+ break;
+ case Quantize:
+ flags |= SC_EVENT_MODIFIED;
+ break;
+ case Delete:
+ flags |= SC_EVENT_REMOVED;
+ break;
+ case Transform:
+ flags |= SC_EVENT_MODIFIED;
+ break;
+ case Insert:
+ flags |= SC_EVENT_INSERTED;
+ break;
+ case Copy:
+ flags |= SC_EVENT_INSERTED;
+ case Extract:
+ break;
+ }
+ audio->msgIdle(false);
+ song->endUndo(flags);
+ }
+
+//---------------------------------------------------------
+// setValOp
+//---------------------------------------------------------
+
+void MidiTransformerDialog::setValOp(QWidget* a, QWidget* b, ValOp op)
+ {
+ switch (op) {
+ case Ignore:
+ a->setEnabled(false);
+ b->setEnabled(false);
+ break;
+ case Equal:
+ case Unequal:
+ case Higher:
+ case Lower:
+ a->setEnabled(true);
+ b->setEnabled(false);
+ break;
+ case Inside:
+ case Outside:
+ a->setEnabled(true);
+ b->setEnabled(true);
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// selEventOpSel
+//---------------------------------------------------------
+
+void MidiTransformerDialog::selEventOpSel(int val)
+ {
+ selType->setEnabled(val != All);
+ data->cmt->selEventOp = ValOp(val);
+ selVal1aChanged(data->cmt->selVal1a);
+ selVal1bChanged(data->cmt->selVal1b);
+ }
+
+//---------------------------------------------------------
+// selTypeSel
+//---------------------------------------------------------
+
+void MidiTransformerDialog::selTypeSel(int val)
+ {
+ data->cmt->selType = EventType(eventTypeTable[val]);
+ selVal1aChanged(data->cmt->selVal1a);
+ selVal1bChanged(data->cmt->selVal1b);
+ }
+
+//---------------------------------------------------------
+// selVal1OpSel
+//---------------------------------------------------------
+
+void MidiTransformerDialog::selVal1OpSel(int val)
+ {
+ setValOp(selVal1a, selVal1b, ValOp(val));
+ data->cmt->selVal1 = ValOp(val);
+ }
+
+//---------------------------------------------------------
+// selVal2OpSel
+//---------------------------------------------------------
+
+void MidiTransformerDialog::selVal2OpSel(int val)
+ {
+ setValOp(selVal2a, selVal2b, ValOp(val));
+ data->cmt->selVal2 = ValOp(val);
+ }
+
+//---------------------------------------------------------
+// selLenOpSel
+//---------------------------------------------------------
+
+void MidiTransformerDialog::selLenOpSel(int val)
+ {
+ setValOp(selLenA, selLenB, ValOp(val));
+ data->cmt->selLen = ValOp(val);
+ }
+
+//---------------------------------------------------------
+// selRangeOpSel
+//---------------------------------------------------------
+
+void MidiTransformerDialog::selRangeOpSel(int val)
+ {
+ setValOp(selBarA, selBarB, ValOp(val));
+ data->cmt->selRange = ValOp(val);
+ }
+
+//---------------------------------------------------------
+// procEventOpSel
+//---------------------------------------------------------
+
+void MidiTransformerDialog::procEventOpSel(int val)
+ {
+ TransformOperator op = val == 0 ? Keep : Fix;
+ procType->setEnabled(op == Fix);
+ data->cmt->procEvent = op;
+ }
+
+//---------------------------------------------------------
+// procEventTypeSel
+//---------------------------------------------------------
+
+void MidiTransformerDialog::procEventTypeSel(int val)
+ {
+ data->cmt->eventType = EventType(eventTypeTable[val]);
+ }
+
+//---------------------------------------------------------
+// procVal1OpSel
+//---------------------------------------------------------
+
+void MidiTransformerDialog::procVal1OpSel(int val)
+ {
+ data->cmt->procVal1 = TransformOperator(val);
+ switch(TransformOperator(val)) {
+ case Keep:
+ case Invert:
+ procVal1a->setEnabled(false);
+ procVal1b->setEnabled(false);
+ break;
+ case Multiply:
+ case Divide:
+ procVal1a->setEnabled(true);
+ procVal1a->setPrecision(2);
+ procVal1b->setEnabled(false);
+ break;
+ case Plus:
+ case Minus:
+ case Fix:
+ case Value:
+ case Flip:
+ procVal1a->setPrecision(0);
+ procVal1a->setEnabled(true);
+ procVal1b->setEnabled(false);
+ break;
+ case Random:
+ case ScaleMap:
+ case Dynamic:
+ procVal1a->setPrecision(0);
+ procVal1a->setEnabled(true);
+ procVal1b->setEnabled(true);
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// procVal2OpSel
+//---------------------------------------------------------
+
+void MidiTransformerDialog::procVal2OpSel(int val)
+ {
+ TransformOperator op = TransformOperator(procVal2Map[val]);
+ data->cmt->procVal2 = op;
+
+ switch (op) {
+ case Keep:
+ case Invert:
+ procVal2a->setEnabled(false);
+ procVal2b->setEnabled(false);
+ break;
+ case Multiply:
+ case Divide:
+ procVal2a->setEnabled(true);
+ procVal2a->setPrecision(2);
+ procVal2b->setEnabled(false);
+ break;
+ case Plus:
+ case Minus:
+ case Fix:
+ case Value:
+ procVal2a->setPrecision(0);
+ procVal2a->setEnabled(true);
+ procVal2b->setEnabled(false);
+ break;
+ case Random:
+ case Dynamic:
+ procVal2a->setPrecision(0);
+ procVal2a->setEnabled(true);
+ procVal2b->setEnabled(true);
+ break;
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// procLenOpSel
+//---------------------------------------------------------
+
+void MidiTransformerDialog::procLenOpSel(int val)
+ {
+ TransformOperator op = TransformOperator(val);
+ data->cmt->procLen = op;
+
+ switch (op) {
+ case Keep:
+ case Invert:
+ procLenA->setEnabled(false);
+ break;
+ case Plus:
+ case Minus:
+ case Fix:
+ procLenA->setPrecision(0);
+ procLenA->setEnabled(true);
+ break;
+ case Multiply:
+ case Divide:
+ procLenA->setPrecision(2);
+ procLenA->setEnabled(true);
+ break;
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// procPosOpSel
+//---------------------------------------------------------
+
+void MidiTransformerDialog::procPosOpSel(int val)
+ {
+ TransformOperator op = TransformOperator(val);
+ data->cmt->procPos = op;
+
+ switch (op) {
+ case Keep:
+ case Invert:
+ procPosA->setEnabled(false);
+ break;
+ case Multiply:
+ case Divide:
+ procPosA->setPrecision(2);
+ procPosA->setEnabled(true);
+ break;
+ case Plus:
+ case Minus:
+ procPosA->setPrecision(0);
+ procPosA->setEnabled(true);
+ break;
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// funcOpSel
+//---------------------------------------------------------
+
+void MidiTransformerDialog::funcOpSel(int val)
+ {
+ funcQuantVal->setEnabled(val == Quantize);
+ bool isFuncOp = val == Transform || val == Insert;
+
+ procEventOp->setEnabled(isFuncOp);
+ procType->setEnabled(isFuncOp);
+ procVal1Op->setEnabled(isFuncOp);
+ procVal1a->setEnabled(isFuncOp);
+ procVal1b->setEnabled(isFuncOp);
+ procVal2Op->setEnabled(isFuncOp);
+ procVal2a->setEnabled(isFuncOp);
+ procVal2b->setEnabled(isFuncOp);
+ procLenOp->setEnabled(isFuncOp);
+ procLenA->setEnabled(isFuncOp);
+ procPosOp->setEnabled(isFuncOp);
+ procPosA->setEnabled(isFuncOp);
+ if (isFuncOp) {
+ procEventOpSel(data->cmt->procEvent);
+ procVal1OpSel(data->cmt->procVal1);
+ procVal2OpSel(data->cmt->procVal2);
+ procLenOpSel(data->cmt->procLen);
+ procPosOpSel(data->cmt->procPos);
+ }
+ data->cmt->funcOp = TransformFunction(val);
+ }
+
+//---------------------------------------------------------
+// presetNew
+//---------------------------------------------------------
+
+void MidiTransformerDialog::presetNew()
+ {
+ QString name;
+ for (int i = 0;; ++i) {
+ name.sprintf("New-%d", i);
+ iMidiTransformation imt;
+ for (imt = mtlist.begin(); imt != mtlist.end(); ++imt) {
+ if (name == (*imt)->name)
+ break;
+ }
+ if (imt == mtlist.end())
+ break;
+ }
+ MidiTransformation* mt = new MidiTransformation(name);
+ Q3ListBoxText* lbi = new Q3ListBoxText(presetList, name);
+ mtlist.push_back(mt);
+ presetList->setCurrentItem(lbi);
+ }
+
+//---------------------------------------------------------
+// presetDelete
+//---------------------------------------------------------
+
+void MidiTransformerDialog::presetDelete()
+ {
+ if (data->cindex != -1) {
+ iMidiTransformation mt = mtlist.begin();
+ for (int i = 0; i < data->cindex; ++i, ++mt) {
+ mtlist.erase(mt);
+ presetList->removeItem(data->cindex);
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// presetChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::presetChanged(Q3ListBoxItem* item)
+ {
+ data->cindex = presetList->index(item);
+ iMidiTransformation i;
+ for (i = mtlist.begin(); i != mtlist.end(); ++i) {
+ if (item->text() == (*i)->name) {
+ data->cmt = *i;
+ break;
+ }
+ }
+ if (i == mtlist.end()) {
+ printf("MidiTransformerDialog::presetChanged: not found\n");
+ return;
+ }
+ nameEntry->setText(data->cmt->name);
+ commentEntry->setText(data->cmt->comment);
+
+ selEventOp->setCurrentItem(data->cmt->selEventOp);
+ selEventOpSel(data->cmt->selEventOp);
+
+ for (unsigned i = 0; i < sizeof(eventTypeTable)/sizeof(*eventTypeTable); ++i) {
+ if (eventTypeTable[i] == data->cmt->selType) {
+ selType->setCurrentItem(i);
+ break;
+ }
+ }
+
+ selVal1Op->setCurrentItem(data->cmt->selVal1);
+ selVal1OpSel(data->cmt->selVal1);
+
+ selVal2Op->setCurrentItem(data->cmt->selVal2);
+ selVal2OpSel(data->cmt->selVal2);
+
+ selLenOp->setCurrentItem(data->cmt->selLen);
+ selLenOpSel(data->cmt->selLen);
+
+ selRangeOp->setCurrentItem(data->cmt->selRange);
+ selRangeOpSel(data->cmt->selRange);
+
+ funcOp->setCurrentItem(data->cmt->funcOp);
+ funcOpSel(data->cmt->funcOp);
+
+ // TransformOperator procEvent: Keep, Fix
+ procEventOp->setCurrentItem(data->cmt->procEvent == Fix);
+
+ procEventOpSel(data->cmt->procEvent);
+
+ procVal1Op->setCurrentItem(data->cmt->procVal1);
+ procVal1OpSel(data->cmt->procVal1);
+
+ for (unsigned i = 0; i < sizeof(procVal2Map)/sizeof(*procVal2Map); ++i) {
+ if (procVal2Map[i] == data->cmt->procVal2) {
+ procVal2Op->setCurrentItem(i);
+ break;
+ }
+ }
+ procLenOp->setCurrentItem(data->cmt->procLen);
+ procLenOpSel(data->cmt->procLen);
+
+ procPosOp->setCurrentItem(data->cmt->procPos);
+ procPosOpSel(data->cmt->procPos);
+
+ selVal1aChanged(data->cmt->selVal1a);
+ selVal1bChanged(data->cmt->selVal1b);
+ selVal2a->setValue(data->cmt->selVal2a);
+ selVal2b->setValue(data->cmt->selVal2b);
+ selLenA->setValue(data->cmt->selLenA);
+ selLenB->setValue(data->cmt->selLenB);
+ selBarA->setValue(data->cmt->selRangeA);
+ selBarB->setValue(data->cmt->selRangeB);
+ procVal1a->setValue(data->cmt->procVal1a);
+ procVal1b->setValue(data->cmt->procVal1b);
+ procVal2a->setValue(data->cmt->procVal2a);
+ procVal2b->setValue(data->cmt->procVal2b);
+ procLenA->setValue(data->cmt->procLenA);
+ procPosA->setValue(data->cmt->procPosA);
+ funcQuantVal->setValue(data->cmt->quantVal);
+
+ selectedTracks->setChecked(data->cmt->selectedTracks);
+ selectedTracksChanged(data->cmt->selectedTracks);
+ insideLoop->setChecked(data->cmt->insideLoop);
+ insideLoopChanged(data->cmt->insideLoop);
+ }
+
+//---------------------------------------------------------
+// nameChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::nameChanged(const QString& s)
+ {
+ data->cmt->name = s;
+ Q3ListBoxItem* item = presetList->item(data->cindex);
+ if (s != item->text()) {
+ disconnect(presetList, SIGNAL(highlighted(Q3ListBoxItem*)),
+ this, SLOT(presetChanged(Q3ListBoxItem*)));
+ presetList->changeItem(s, data->cindex);
+ connect(presetList, SIGNAL(highlighted(Q3ListBoxItem*)),
+ SLOT(presetChanged(Q3ListBoxItem*)));
+ }
+ }
+
+//---------------------------------------------------------
+// commentChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::commentChanged()
+ {
+ data->cmt->comment = commentEntry->text();
+ }
+
+//-----------------------------op----------------------------
+// selVal1aChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::selVal1aChanged(int val)
+ {
+ data->cmt->selVal1a = val;
+ if ((data->cmt->selEventOp != All)
+ && (data->cmt->selType == Note)) {
+ selVal1a->setSuffix(" - " + pitch2string(val));
+ }
+ else
+ selVal1a->setSuffix(QString(""));
+ }
+
+//---------------------------------------------------------
+// selVal1bChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::selVal1bChanged(int val)
+ {
+ data->cmt->selVal1b = val;
+ if ((data->cmt->selEventOp != All)
+ && (data->cmt->selType == Note)) {
+ selVal1b->setSuffix(" - " + pitch2string(val));
+ }
+ else
+ selVal1b->setSuffix(QString(""));
+ }
+
+//---------------------------------------------------------
+// selVal2aChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::selVal2aChanged(int val)
+ {
+ data->cmt->selVal2a = val;
+ }
+
+//---------------------------------------------------------
+// selVal2bChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::selVal2bChanged(int val)
+ {
+ data->cmt->selVal2b = val;
+ }
+
+//---------------------------------------------------------
+// selLenAChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::selLenAChanged(int val)
+ {
+ data->cmt->selLenA = val;
+ }
+
+//---------------------------------------------------------
+// selLenBChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::selLenBChanged(int val)
+ {
+ data->cmt->selLenB = val;
+ }
+
+//---------------------------------------------------------
+// selBarAChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::selBarAChanged(int val)
+ {
+ data->cmt->selRangeA = val;
+ }
+
+//---------------------------------------------------------
+// selBarBChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::selBarBChanged(int val)
+ {
+ data->cmt->selRangeB = val;
+ }
+
+//---------------------------------------------------------
+// procVal1aChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::procVal1aChanged(int val)
+ {
+ data->cmt->procVal1a = val;
+ }
+
+//---------------------------------------------------------
+// procVal1bChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::procVal1bChanged(int val)
+ {
+ data->cmt->procVal1b = val;
+ }
+
+//---------------------------------------------------------
+// procVal2aChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::procVal2aChanged(int val)
+ {
+ data->cmt->procVal2a = val;
+ }
+
+//---------------------------------------------------------
+// procVal2bChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::procVal2bChanged(int val)
+ {
+ data->cmt->procVal2b = val;
+ }
+
+//---------------------------------------------------------
+// procLenAChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::procLenAChanged(int val)
+ {
+ data->cmt->procLenA = val;
+ }
+
+//---------------------------------------------------------
+// procPosAChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::procPosAChanged(int val)
+ {
+ data->cmt->procPosA = val;
+ }
+
+//---------------------------------------------------------
+// funcQuantValSel
+//---------------------------------------------------------
+
+void MidiTransformerDialog::funcQuantValSel(int val)
+ {
+ data->cmt->quantVal = val;
+ }
+
+//---------------------------------------------------------
+// processAllChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::processAllChanged(bool val)
+ {
+ if (val == true) {
+ selectedTracks->setChecked(false);
+ insideLoop->setChecked(false);
+ data->cmt->selectedTracks = false;
+ data->cmt->insideLoop = false;
+ }
+ }
+
+//---------------------------------------------------------
+// selectedTracksChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::selectedTracksChanged(bool val)
+ {
+ data->cmt->selectedTracks = val;
+ processAll->setChecked(!val && !data->cmt->insideLoop);
+ }
+
+//---------------------------------------------------------
+// insideLoopChanged
+//---------------------------------------------------------
+
+void MidiTransformerDialog::insideLoopChanged(bool val)
+ {
+ data->cmt->insideLoop = val;
+ processAll->setChecked(!data->cmt->selectedTracks && !val);
+ }
+
+
+
+/*!
+ \fn MidiTransformerDialog::typesMatch(MidiEvent e, unsigned t)
+ */
+bool MidiTransformerDialog::typesMatch(Event& e, unsigned selType)
+ {
+ bool matched = false;
+ switch (selType)
+ {
+ case MIDITRANSFORM_NOTE:
+ matched = (e.type() == Note);
+ break;
+ case MIDITRANSFORM_POLY:
+ matched = (e.type() == PAfter);
+ break;
+ case MIDITRANSFORM_CTRL:
+ matched = (e.type() == Controller);
+ break;
+ case MIDITRANSFORM_ATOUCH:
+ matched = (e.type() == CAfter);
+ break;
+ case MIDITRANSFORM_PITCHBEND:
+ {
+ if (e.type() == Controller) {
+ MidiController::ControllerType c = midiControllerType(e.dataA());
+ matched = (c == MidiController::Pitch);
+ }
+ break;
+ }
+ case MIDITRANSFORM_NRPN:
+ {
+ if (e.type() == Controller) {
+ MidiController::ControllerType c = midiControllerType(e.dataA());
+ matched = (c == MidiController::NRPN);
+ }
+ }
+ case MIDITRANSFORM_RPN:
+ {
+ if (e.type() == Controller) {
+ MidiController::ControllerType c = midiControllerType(e.dataA());
+ matched = (c == MidiController::RPN);
+ }
+ }
+ default:
+ fprintf(stderr, "Error matching type in MidiTransformerDialog: unknown eventtype!\n");
+ break;
+ }
+ //printf("Event type=%d, selType =%d matched=%d\n", e.type(), selType, matched);
+ return matched;
+ }
diff --git a/muse2/muse/miditransform.h b/muse2/muse/miditransform.h
new file mode 100644
index 00000000..3dcb4a98
--- /dev/null
+++ b/muse2/muse/miditransform.h
@@ -0,0 +1,105 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: miditransform.h,v 1.2.2.2 2009/02/02 21:38:00 terminator356 Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MIDITRANSFORM_H__
+#define __MIDITRANSFORM_H__
+
+#include "transformbase.h"
+
+class Q3ListBoxItem;
+class MidiTransformation;
+class MidiTransformPrivate;
+class Event;
+class MidiPart;
+class Xml;
+
+enum ValOp {
+ All=0, Ignore=0, Equal=1, Unequal=2, Higher=3, Lower=4,
+ Inside=5, Outside=6
+ };
+
+enum TransformFunction {
+ Select, Quantize, Delete, Transform, Insert, Copy, Extract
+ };
+
+enum TransformOperator {
+ Keep, Plus, Minus, Multiply, Divide, Fix, Value, Invert,
+ ScaleMap, Flip, Dynamic, Random
+ };
+
+//---------------------------------------------------------
+// MidiTransformDialog
+//---------------------------------------------------------
+
+class MidiTransformerDialog : public MidiTransformDialogBase {
+ Q_OBJECT
+ MidiTransformPrivate* data;
+
+ virtual void accept();
+// virtual void reject();
+ void setValOp(QWidget* a, QWidget* b, ValOp op);
+ void processEvent(Event&, MidiPart*, MidiPart*);
+ bool isSelected(Event&, MidiPart*);
+ void transformEvent(Event&, MidiPart*, MidiPart*);
+ bool typesMatch(Event& e, unsigned selType);
+
+ void updatePresetList();
+
+ private slots:
+ void apply();
+ void presetNew();
+ void presetDelete();
+
+ void selEventOpSel(int);
+ void selTypeSel(int);
+ void selVal1OpSel(int);
+ void selVal2OpSel(int);
+ void selLenOpSel(int);
+ void selRangeOpSel(int);
+ void procEventOpSel(int);
+ void procEventTypeSel(int);
+ void procVal1OpSel(int);
+ void procVal2OpSel(int);
+ void procLenOpSel(int);
+ void procPosOpSel(int);
+ void funcOpSel(int);
+ void presetChanged(Q3ListBoxItem*);
+ void nameChanged(const QString&);
+ void commentChanged();
+ void selVal1aChanged(int);
+ void selVal1bChanged(int);
+ void selVal2aChanged(int);
+ void selVal2bChanged(int);
+ void selLenAChanged(int);
+ void selLenBChanged(int);
+ void selBarAChanged(int);
+ void selBarBChanged(int);
+ void procVal1aChanged(int);
+ void procVal1bChanged(int);
+ void procVal2aChanged(int);
+ void procVal2bChanged(int);
+ void procLenAChanged(int);
+ void procPosAChanged(int);
+ void funcQuantValSel(int);
+ void processAllChanged(bool);
+ void selectedTracksChanged(bool);
+ void insideLoopChanged(bool);
+
+ public slots:
+ void songChanged(int);
+
+ public:
+ MidiTransformerDialog(QWidget* parent = 0, const char* name = 0,
+ bool modal = false, Qt::WFlags fl = 0);
+ ~MidiTransformerDialog();
+ };
+
+extern void writeMidiTransforms(int level, Xml& xml);
+extern void readMidiTransform(Xml&);
+extern void clearMidiTransforms();
+#endif
diff --git a/muse2/muse/mixer/Makefile.am b/muse2/muse/mixer/Makefile.am
new file mode 100644
index 00000000..3d4763c0
--- /dev/null
+++ b/muse2/muse/mixer/Makefile.am
@@ -0,0 +1,26 @@
+include $(top_srcdir)/common.am
+
+if PCH
+AM_CXXFLAGS += -include $(top_srcdir)/all.h
+endif
+
+noinst_LIBRARIES = libmixer.a
+
+dist_libmixer_a_SOURCES = \
+ amixer.cpp amixer.h \
+ meter.cpp meter.h \
+ rack.cpp rack.h \
+ panknob.cpp panknob.h \
+ auxknob.cpp auxknob.h \
+ routedialogbase.ui routedialog.h routedialog.cpp \
+ strip.h strip.cpp astrip.h astrip.cpp mstrip.h mstrip.cpp
+
+nodist_libmixer_a_SOURCES = \
+ moc_amixer.cpp \
+ moc_strip.cpp moc_astrip.cpp moc_mstrip.cpp \
+ moc_meter.cpp \
+ moc_rack.cpp \
+ moc_panknob.cpp \
+ moc_auxknob.cpp \
+ moc_routedialog.cpp
+
diff --git a/muse2/muse/mixer/Makefile.in b/muse2/muse/mixer/Makefile.in
new file mode 100644
index 00000000..a1681599
--- /dev/null
+++ b/muse2/muse/mixer/Makefile.in
@@ -0,0 +1,628 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/common.am
+@PCH_TRUE@am__append_1 = -include $(top_srcdir)/all.h
+subdir = muse/mixer
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
+ $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libmixer_a_AR = $(AR) $(ARFLAGS)
+libmixer_a_LIBADD =
+dist_libmixer_a_OBJECTS = amixer.$(OBJEXT) meter.$(OBJEXT) \
+ rack.$(OBJEXT) panknob.$(OBJEXT) auxknob.$(OBJEXT) \
+ routedialogbase.$(OBJEXT) routedialog.$(OBJEXT) \
+ strip.$(OBJEXT) astrip.$(OBJEXT) mstrip.$(OBJEXT)
+nodist_libmixer_a_OBJECTS = moc_amixer.$(OBJEXT) moc_strip.$(OBJEXT) \
+ moc_astrip.$(OBJEXT) moc_mstrip.$(OBJEXT) moc_meter.$(OBJEXT) \
+ moc_rack.$(OBJEXT) moc_panknob.$(OBJEXT) moc_auxknob.$(OBJEXT) \
+ moc_routedialog.$(OBJEXT)
+libmixer_a_OBJECTS = $(dist_libmixer_a_OBJECTS) \
+ $(nodist_libmixer_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(dist_libmixer_a_SOURCES) $(nodist_libmixer_a_SOURCES)
+DIST_SOURCES = $(dist_libmixer_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCBOOKSTYLE = @DOCBOOKSTYLE@
+DOCBOOKTARGETS = @DOCBOOKTARGETS@
+DOT = @DOT@
+DOTPATH = @DOTPATH@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@
+FST_CFLAGS = @FST_CFLAGS@
+FST_LIBS = @FST_LIBS@
+Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@
+Fluidsynth_LIBS = @Fluidsynth_LIBS@
+GIVERTCAP = @GIVERTCAP@
+GREP = @GREP@
+HAVEDOT = @HAVEDOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JADE = @JADE@
+LASH_CFLAGS = @LASH_CFLAGS@
+LASH_LIBS = @LASH_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LO_CFLAGS = @LO_CFLAGS@
+LO_LIBS = @LO_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUSECXXFLAGS = @MUSECXXFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSGMLS = @NSGMLS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCH = @PCH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIB = @PYTHON_LIB@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+QTDIR_BIN = @QTDIR_BIN@
+QTDIR_INC = @QTDIR_INC@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+SUIDBUILD = @SUIDBUILD@
+SUIDINSTALL = @SUIDINSTALL@
+USE_SSE = @USE_SSE@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+have_docbook = @have_docbook@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+synth_fluid = @synth_fluid@
+synth_fluidsynth = @synth_fluidsynth@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \
+ -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(am__append_1)
+AM_CPPFLAGS =
+MOC = $(QTDIR_BIN)/moc
+#UIC = $(QTDIR_BIN)/uic3
+UIC = /usr/bin/uic3
+UIFILES = $(wildcard *.ui)
+MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \
+ if grep -q Q_OBJECT $$h; then \
+ echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \
+ fi; \
+ done)
+
+BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+SUFFIXES = .ui .h.gch
+noinst_LIBRARIES = libmixer.a
+dist_libmixer_a_SOURCES = \
+ amixer.cpp amixer.h \
+ meter.cpp meter.h \
+ rack.cpp rack.h \
+ panknob.cpp panknob.h \
+ auxknob.cpp auxknob.h \
+ routedialogbase.ui routedialog.h routedialog.cpp \
+ strip.h strip.cpp astrip.h astrip.cpp mstrip.h mstrip.cpp
+
+nodist_libmixer_a_SOURCES = \
+ moc_amixer.cpp \
+ moc_strip.cpp moc_astrip.cpp moc_mstrip.cpp \
+ moc_meter.cpp \
+ moc_rack.cpp \
+ moc_panknob.cpp \
+ moc_auxknob.cpp \
+ moc_routedialog.cpp
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .ui .h.gch .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/mixer/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu muse/mixer/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libmixer.a: $(libmixer_a_OBJECTS) $(libmixer_a_DEPENDENCIES)
+ -rm -f libmixer.a
+ $(libmixer_a_AR) libmixer.a $(libmixer_a_OBJECTS) $(libmixer_a_LIBADD)
+ $(RANLIB) libmixer.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amixer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/astrip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auxknob.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/meter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_amixer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_astrip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_auxknob.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_meter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_mstrip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_panknob.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_rack.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_routedialog.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_strip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mstrip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/panknob.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rack.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/routedialog.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strip.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+de:
+ @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done
+
+nde:
+ @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done
+
+.ui.o: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(CXXCOMPILE) -c $*.cpp -o $*.o
+ $(RM) $*.cpp moc_$*.cpp moc_$*.o
+
+.ui.lo: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(LTCXXCOMPILE) -c $*.cpp -o $*.lo
+ $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o
+
+moc_%.cpp: %.h
+ $(MOC) $< -o $@
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/muse2/muse/mixer/amixer.cpp b/muse2/muse/mixer/amixer.cpp
new file mode 100644
index 00000000..e6c380b4
--- /dev/null
+++ b/muse2/muse/mixer/amixer.cpp
@@ -0,0 +1,592 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: amixer.cpp,v 1.49.2.5 2009/11/16 01:55:55 terminator356 Exp $
+//
+// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <list>
+#include <cmath>
+
+#include <qapplication.h>
+#include <qmenubar.h>
+#include <qaction.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <QCloseEvent>
+#include <Q3PopupMenu>
+#include <Q3ActionGroup>
+#include <Q3Action>
+
+#include "app.h"
+#include "amixer.h"
+#include "song.h"
+
+#include "astrip.h"
+#include "mstrip.h"
+
+#include "gconfig.h"
+#include "xml.h"
+
+extern void populateAddTrack(Q3PopupMenu* addTrack);
+
+#define __WIDTH_COMPENSATION 4
+
+//typedef std::list<Strip*> StripList;
+//static StripList stripList;
+
+//---------------------------------------------------------
+// AudioMixer
+//
+// inputs | synthis | tracks | groups | master
+//---------------------------------------------------------
+
+//AudioMixerApp::AudioMixerApp(QWidget* parent)
+AudioMixerApp::AudioMixerApp(QWidget* parent, MixerConfig* c)
+ : Q3MainWindow(parent, "mixer")
+ {
+ cfg = c;
+ oldAuxsSize = 0;
+ routingDialog = 0;
+ //setCaption(tr("MusE: Mixer"));
+ //name = cfg->name;
+ //setCaption(name);
+ //printf("AudioMixerApp::AudioMixerApp setting caption:%s\n", cfg->name.latin1());
+ setCaption(cfg->name);
+
+ Q3PopupMenu* menuConfig = new Q3PopupMenu(this);
+ menuBar()->insertItem(tr("&Create"), menuConfig);
+ populateAddTrack(menuConfig);
+
+ menuView = new Q3PopupMenu(this);
+ menuBar()->insertItem(tr("&View"), menuView);
+ routingId = menuView->insertItem(tr("Routing"), this, SLOT(toggleRouteDialog()));
+
+ menuView->insertSeparator();
+
+ Q3ActionGroup* actionItems = new Q3ActionGroup(this, "actionItems", false);
+
+ /*
+ showMidiTracksId = new QAction(tr("Show Midi Tracks"), 0, menuView);
+ showDrumTracksId = new QAction(tr("Show Drum Tracks"), 0, menuView);
+ showWaveTracksId = new QAction(tr("Show Wave Tracks"), 0, menuView);
+ */
+ showMidiTracksId = new Q3Action(tr("Show Midi Tracks"), 0, actionItems);
+ showDrumTracksId = new Q3Action(tr("Show Drum Tracks"), 0, actionItems);
+ showWaveTracksId = new Q3Action(tr("Show Wave Tracks"), 0, actionItems);
+ //showMidiTracksId->addTo(menuView);
+ //showDrumTracksId->addTo(menuView);
+ //showWaveTracksId->addTo(menuView);
+
+ //menuView->insertSeparator();
+ actionItems->addSeparator();
+
+ /*
+ showInputTracksId= new QAction(tr("Show Inputs"), 0, menuView);
+ showOutputTracksId = new QAction(tr("Show Outputs"), 0, menuView);
+ showGroupTracksId = new QAction(tr("Show Groups"), 0, menuView);
+ showAuxTracksId = new QAction(tr("Show Auxs"), 0, menuView);
+ showSyntiTracksId = new QAction(tr("Show Synthesizers"), 0, menuView);
+ */
+ showInputTracksId = new Q3Action(tr("Show Inputs"), 0, actionItems);
+ showOutputTracksId = new Q3Action(tr("Show Outputs"), 0, actionItems);
+ showGroupTracksId = new Q3Action(tr("Show Groups"), 0, actionItems);
+ showAuxTracksId = new Q3Action(tr("Show Auxs"), 0, actionItems);
+ showSyntiTracksId = new Q3Action(tr("Show Synthesizers"), 0, actionItems);
+ //showInputTracksId->addTo(menuView);
+ //showOutputTracksId->addTo(menuView);
+ //showGroupTracksId->addTo(menuView);
+ //showAuxTracksId->addTo(menuView);
+ //showSyntiTracksId->addTo(menuView);
+
+ showMidiTracksId->setToggleAction(true);
+ showDrumTracksId->setToggleAction(true);
+ showWaveTracksId->setToggleAction(true);
+ showInputTracksId->setToggleAction(true);
+ showOutputTracksId->setToggleAction(true);
+ showGroupTracksId->setToggleAction(true);
+ showAuxTracksId->setToggleAction(true);
+ showSyntiTracksId->setToggleAction(true);
+
+ //connect(menuView, SIGNAL(triggered(QAction*)), SLOT(showTracksChanged(QAction*)));
+ //connect(actionItems, SIGNAL(selected(QAction*)), this, SLOT(showTracksChanged(QAction*)));
+ connect(showMidiTracksId, SIGNAL(toggled(bool)), SLOT(showMidiTracksChanged(bool)));
+ connect(showDrumTracksId, SIGNAL(toggled(bool)), SLOT(showDrumTracksChanged(bool)));
+ connect(showWaveTracksId, SIGNAL(toggled(bool)), SLOT(showWaveTracksChanged(bool)));
+ connect(showInputTracksId, SIGNAL(toggled(bool)), SLOT(showInputTracksChanged(bool)));
+ connect(showOutputTracksId, SIGNAL(toggled(bool)), SLOT(showOutputTracksChanged(bool)));
+ connect(showGroupTracksId, SIGNAL(toggled(bool)), SLOT(showGroupTracksChanged(bool)));
+ connect(showAuxTracksId, SIGNAL(toggled(bool)), SLOT(showAuxTracksChanged(bool)));
+ connect(showSyntiTracksId, SIGNAL(toggled(bool)), SLOT(showSyntiTracksChanged(bool)));
+
+ actionItems->addTo(menuView);
+ view = new Q3ScrollView(this);
+ setCentralWidget(view);
+ central = new QWidget(view);
+ view->setResizePolicy(Q3ScrollView::AutoOneFit);
+ view->setVScrollBarMode(Q3ScrollView::AlwaysOff);
+ view->addChild(central);
+ layout = new Q3HBoxLayout(central);
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ connect(muse, SIGNAL(configChanged()), SLOT(configChanged()));
+ song->update(); // calls update mixer
+ }
+
+//---------------------------------------------------------
+// addStrip
+//---------------------------------------------------------
+
+void AudioMixerApp::addStrip(Track* t, int idx)
+ {
+ StripList::iterator si = stripList.begin();
+ for (int i = 0; i < idx; ++i) {
+ if (si != stripList.end())
+ ++si;
+ }
+ if (si != stripList.end() && (*si)->getTrack() == t)
+ return;
+
+ std::list<Strip*>::iterator nsi = si;
+ ++nsi;
+ if (si != stripList.end()
+ && nsi != stripList.end()
+ && (*nsi)->getTrack() == t) {
+ layout->remove(*si);
+ delete *si;
+ stripList.erase(si);
+ }
+ else {
+ Strip* strip;
+ if (t->isMidiTrack())
+ strip = new MidiStrip(central, (MidiTrack*)t);
+ else
+ strip = new AudioStrip(central, (AudioTrack*)t);
+ layout->insertWidget(idx, strip);
+ stripList.insert(si, strip);
+ strip->show();
+ }
+ }
+
+//---------------------------------------------------------
+// clear
+//---------------------------------------------------------
+
+void AudioMixerApp::clear()
+ {
+ StripList::iterator si = stripList.begin();
+ for (; si != stripList.end(); ++si) {
+ layout->remove(*si);
+ delete *si;
+ }
+ stripList.clear();
+ oldAuxsSize = -1;
+ }
+
+//---------------------------------------------------------
+// updateMixer
+//---------------------------------------------------------
+
+void AudioMixerApp::updateMixer(UpdateAction action)
+ {
+ //printf("AudioMixerApp::updateMixer action:%d\n", action);
+
+ //name = cfg->name;
+ //setCaption(name);
+ setCaption(cfg->name);
+
+ showMidiTracksId->setOn(cfg->showMidiTracks);
+ showDrumTracksId->setOn(cfg->showDrumTracks);
+ showInputTracksId->setOn(cfg->showInputTracks);
+ showOutputTracksId->setOn(cfg->showOutputTracks);
+ showWaveTracksId->setOn(cfg->showWaveTracks);
+ showGroupTracksId->setOn(cfg->showGroupTracks);
+ showAuxTracksId->setOn(cfg->showAuxTracks);
+ showSyntiTracksId->setOn(cfg->showSyntiTracks);
+
+ int auxsSize = song->auxs()->size();
+ if ((action == UPDATE_ALL) || (auxsSize != oldAuxsSize)) {
+ clear();
+ oldAuxsSize = auxsSize;
+ }
+ else if (action == STRIP_REMOVED)
+ {
+ StripList::iterator si = stripList.begin();
+ for (; si != stripList.end();) {
+ Track* track = (*si)->getTrack();
+ TrackList* tl = song->tracks();
+ iTrack it;
+ for (it = tl->begin(); it != tl->end(); ++it) {
+ if (*it == track)
+ break;
+ }
+ StripList::iterator ssi = si;
+ ++si;
+ if (it != tl->end())
+ continue;
+ layout->remove(*ssi);
+ delete *ssi;
+ stripList.erase(ssi);
+ }
+ setMaximumWidth(STRIP_WIDTH * stripList.size() + __WIDTH_COMPENSATION);
+ // Added by Tim. p3.3.7
+ if (stripList.size() < 8)
+ view->setMinimumWidth(stripList.size() * STRIP_WIDTH + __WIDTH_COMPENSATION);
+
+ return;
+ }
+ // Added by Tim. p3.3.7
+ else if (action == UPDATE_MIDI)
+ {
+ int i = 0;
+ int idx = -1;
+ StripList::iterator si = stripList.begin();
+ for (; si != stripList.end(); ++i)
+ {
+ Track* track = (*si)->getTrack();
+ if(!track->isMidiTrack())
+ {
+ ++si;
+ continue;
+ }
+
+ if(idx == -1)
+ idx = i;
+
+ StripList::iterator ssi = si;
+ ++si;
+ layout->remove(*ssi);
+ delete *ssi;
+ stripList.erase(ssi);
+ }
+
+ if(idx == -1)
+ idx = 0;
+
+ //---------------------------------------------------
+ // generate Midi channel/port Strips
+ //---------------------------------------------------
+
+ // Changed by Tim. p3.3.21
+ /*
+ MidiTrackList* mtl = song->midis();
+ int ports[MIDI_PORTS];
+ memset(ports, 0, MIDI_PORTS * sizeof(int));
+ for (iMidiTrack i = mtl->begin(); i != mtl->end(); ++i) {
+ MidiTrack* track = *i;
+ int port = track->outPort();
+ int channel = track->outChannel();
+ if ((ports[port] & (1 << channel)) == 0) {
+ addStrip(*i, idx++);
+ ports[port] |= 1 << channel;
+ }
+ }
+ */
+ MidiTrackList* mtl = song->midis();
+ for (iMidiTrack i = mtl->begin(); i != mtl->end(); ++i)
+ {
+ MidiTrack* mt = *i;
+ if((mt->type() == Track::MIDI && cfg->showMidiTracks) || (mt->type() == Track::DRUM && cfg->showDrumTracks))
+ addStrip(*i, idx++);
+ }
+
+ setMaximumWidth(STRIP_WIDTH * stripList.size() + __WIDTH_COMPENSATION);
+ if (stripList.size() < 8)
+ view->setMinimumWidth(stripList.size() * STRIP_WIDTH + __WIDTH_COMPENSATION);
+ return;
+ }
+
+ int idx = 0;
+ //---------------------------------------------------
+ // generate Input Strips
+ //---------------------------------------------------
+
+ if(cfg->showInputTracks)
+ {
+ InputList* itl = song->inputs();
+ for (iAudioInput i = itl->begin(); i != itl->end(); ++i)
+ addStrip(*i, idx++);
+ }
+
+ //---------------------------------------------------
+ // Synthesizer Strips
+ //---------------------------------------------------
+
+ if(cfg->showSyntiTracks)
+ {
+ SynthIList* sl = song->syntis();
+ for (iSynthI i = sl->begin(); i != sl->end(); ++i)
+ addStrip(*i, idx++);
+ }
+
+ //---------------------------------------------------
+ // generate Wave Track Strips
+ //---------------------------------------------------
+
+ if(cfg->showWaveTracks)
+ {
+ WaveTrackList* wtl = song->waves();
+ for (iWaveTrack i = wtl->begin(); i != wtl->end(); ++i)
+ addStrip(*i, idx++);
+ }
+
+ //---------------------------------------------------
+ // generate Midi channel/port Strips
+ //---------------------------------------------------
+
+ // Changed by Tim. p3.3.21
+ /*
+ MidiTrackList* mtl = song->midis();
+ int ports[MIDI_PORTS];
+ memset(ports, 0, MIDI_PORTS * sizeof(int));
+ for (iMidiTrack i = mtl->begin(); i != mtl->end(); ++i) {
+ MidiTrack* track = *i;
+ int port = track->outPort();
+ int channel = track->outChannel();
+ if ((ports[port] & (1 << channel)) == 0) {
+ addStrip(*i, idx++);
+ ports[port] |= 1 << channel;
+ }
+ }
+ */
+ MidiTrackList* mtl = song->midis();
+ for (iMidiTrack i = mtl->begin(); i != mtl->end(); ++i)
+ {
+ MidiTrack* mt = *i;
+ if((mt->type() == Track::MIDI && cfg->showMidiTracks) || (mt->type() == Track::DRUM && cfg->showDrumTracks))
+ addStrip(*i, idx++);
+ }
+
+ //---------------------------------------------------
+ // Groups
+ //---------------------------------------------------
+
+ if(cfg->showGroupTracks)
+ {
+ GroupList* gtl = song->groups();
+ for (iAudioGroup i = gtl->begin(); i != gtl->end(); ++i)
+ addStrip(*i, idx++);
+ }
+
+ //---------------------------------------------------
+ // Aux
+ //---------------------------------------------------
+
+ if(cfg->showAuxTracks)
+ {
+ AuxList* al = song->auxs();
+ for (iAudioAux i = al->begin(); i != al->end(); ++i)
+ addStrip(*i, idx++);
+ }
+
+ //---------------------------------------------------
+ // Master
+ //---------------------------------------------------
+
+ if(cfg->showOutputTracks)
+ {
+ OutputList* otl = song->outputs();
+ for (iAudioOutput i = otl->begin(); i != otl->end(); ++i)
+ addStrip(*i, idx++);
+ }
+
+ //printf("AudioMixerApp::updateMixer setting maximum width:%d\n", STRIP_WIDTH * idx + __WIDTH_COMPENSATION);
+ setMaximumWidth(STRIP_WIDTH * idx + __WIDTH_COMPENSATION);
+ if (idx < 8)
+ {
+ //printf("AudioMixerApp::updateMixer setting minimum width:%d\n", idx * STRIP_WIDTH + __WIDTH_COMPENSATION);
+ view->setMinimumWidth(idx * STRIP_WIDTH + __WIDTH_COMPENSATION);
+ }
+ }
+
+//---------------------------------------------------------
+// configChanged
+//---------------------------------------------------------
+
+void AudioMixerApp::configChanged()
+{
+ //printf("AudioMixerApp::configChanged\n");
+
+ songChanged(SC_CONFIG);
+}
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void AudioMixerApp::songChanged(int flags)
+ {
+ // Is it simply a midi controller value adjustment? Forget it.
+ if(flags == SC_MIDI_CONTROLLER)
+ return;
+
+// printf(" =======AudioMixer::songChanged %x\n", flags);
+ UpdateAction action = NO_UPDATE;
+ if (flags == -1)
+ action = UPDATE_ALL;
+ else if (flags & SC_TRACK_REMOVED)
+ action = STRIP_REMOVED;
+ else if (flags & SC_TRACK_INSERTED)
+ action = STRIP_INSERTED;
+ else if (flags & SC_MIDI_CHANNEL)
+ action = UPDATE_MIDI;
+ if (action != NO_UPDATE)
+ updateMixer(action);
+ if (action != UPDATE_ALL) {
+ StripList::iterator si = stripList.begin();
+ for (; si != stripList.end(); ++si) {
+ (*si)->songChanged(flags);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void AudioMixerApp::closeEvent(QCloseEvent* e)
+ {
+ emit closed();
+ e->accept();
+ }
+
+//---------------------------------------------------------
+// toggleRouteDialog
+//---------------------------------------------------------
+
+void AudioMixerApp::toggleRouteDialog()
+ {
+ showRouteDialog(!menuView->isItemChecked(routingId));
+ }
+
+//---------------------------------------------------------
+// showRouteDialog
+//---------------------------------------------------------
+
+void AudioMixerApp::showRouteDialog(bool on)
+ {
+ if (on && routingDialog == 0) {
+ routingDialog = new RouteDialog(this);
+ connect(routingDialog, SIGNAL(closed()), SLOT(routingDialogClosed()));
+ }
+ if (routingDialog)
+ routingDialog->setShown(on);
+ menuView->setItemChecked(routingId, on);
+ }
+
+//---------------------------------------------------------
+// routingDialogClosed
+//---------------------------------------------------------
+
+void AudioMixerApp::routingDialogClosed()
+ {
+ menuView->setItemChecked(routingId, false);
+ }
+
+//---------------------------------------------------------
+// showTracksChanged
+//---------------------------------------------------------
+
+/*
+void AudioMixerApp::showTracksChanged(QAction* id)
+ {
+ bool val = id->isOn();
+ if (id == showMidiTracksId)
+ cfg->showMidiTracks = val;
+ else if (id == showDrumTracksId)
+ cfg->showDrumTracks = val;
+ else if (id == showInputTracksId)
+ cfg->showInputTracks = val;
+ else if (id == showOutputTracksId)
+ cfg->showOutputTracks = val;
+ else if (id == showWaveTracksId)
+ cfg->showWaveTracks = val;
+ else if (id == showGroupTracksId)
+ cfg->showGroupTracks = val;
+ else if (id == showAuxTracksId)
+ cfg->showAuxTracks = val;
+ else if (id == showSyntiTracksId)
+ cfg->showSyntiTracks = val;
+ updateMixer(UPDATE_ALL);
+ }
+*/
+
+void AudioMixerApp::showMidiTracksChanged(bool v)
+{
+ cfg->showMidiTracks = v;
+ updateMixer(UPDATE_ALL);
+}
+
+void AudioMixerApp::showDrumTracksChanged(bool v)
+{
+ cfg->showDrumTracks = v;
+ updateMixer(UPDATE_ALL);
+}
+
+void AudioMixerApp::showWaveTracksChanged(bool v)
+{
+ cfg->showWaveTracks = v;
+ updateMixer(UPDATE_ALL);
+}
+
+void AudioMixerApp::showInputTracksChanged(bool v)
+{
+ cfg->showInputTracks = v;
+ updateMixer(UPDATE_ALL);
+}
+
+void AudioMixerApp::showOutputTracksChanged(bool v)
+{
+ cfg->showOutputTracks = v;
+ updateMixer(UPDATE_ALL);
+}
+
+void AudioMixerApp::showGroupTracksChanged(bool v)
+{
+ cfg->showGroupTracks = v;
+ updateMixer(UPDATE_ALL);
+}
+
+void AudioMixerApp::showAuxTracksChanged(bool v)
+{
+ cfg->showAuxTracks = v;
+ updateMixer(UPDATE_ALL);
+}
+
+void AudioMixerApp::showSyntiTracksChanged(bool v)
+{
+ cfg->showSyntiTracks = v;
+ updateMixer(UPDATE_ALL);
+}
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+//void AudioMixerApp::write(Xml& xml, const char* name)
+void AudioMixerApp::write(int level, Xml& xml)
+//void AudioMixerApp::write(int level, Xml& xml, const char* name)
+ {
+ //xml.stag(QString(name));
+ //xml.tag(level++, name.latin1());
+ xml.tag(level++, "Mixer");
+
+ xml.strTag(level, "name", cfg->name);
+
+ //xml.tag("geometry", geometry());
+ xml.qrectTag(level, "geometry", geometry());
+
+ xml.intTag(level, "showMidiTracks", cfg->showMidiTracks);
+ xml.intTag(level, "showDrumTracks", cfg->showDrumTracks);
+ xml.intTag(level, "showInputTracks", cfg->showInputTracks);
+ xml.intTag(level, "showOutputTracks", cfg->showOutputTracks);
+ xml.intTag(level, "showWaveTracks", cfg->showWaveTracks);
+ xml.intTag(level, "showGroupTracks", cfg->showGroupTracks);
+ xml.intTag(level, "showAuxTracks", cfg->showAuxTracks);
+ xml.intTag(level, "showSyntiTracks", cfg->showSyntiTracks);
+
+ //xml.etag(name);
+ //xml.etag(level, name.latin1());
+ xml.etag(level, "Mixer");
+ }
+
diff --git a/muse2/muse/mixer/amixer.h b/muse2/muse/mixer/amixer.h
new file mode 100644
index 00000000..f6588ddb
--- /dev/null
+++ b/muse2/muse/mixer/amixer.h
@@ -0,0 +1,119 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: amixer.h,v 1.27.2.2 2009/10/18 06:13:00 terminator356 Exp $
+//
+// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __AMIXER_H__
+#define __AMIXER_H__
+
+#include <qlayout.h>
+#include <qpixmap.h>
+#include <q3listbox.h>
+#include <qtooltip.h>
+#include <q3frame.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <QLabel>
+#include <Q3PopupMenu>
+#include <QCloseEvent>
+#include <Q3Action>
+
+#include "cobject.h"
+#include "synth.h"
+#include "node.h"
+#include "routedialog.h"
+
+class Xml;
+class QWidget;
+class Q3HBoxLayout;
+class Q3ScrollView;
+class AudioTrack;
+class Meter;
+class Track;
+class QLabel;
+class Slider;
+class QToolButton;
+class Knob;
+class DoubleLabel;
+class ComboBox;
+class RouteDialog;
+class Q3PopupMenu;
+class Strip;
+
+struct MixerConfig;
+
+#define EFX_HEIGHT 16
+
+typedef std::list<Strip*> StripList;
+
+//---------------------------------------------------------
+// AudioMixerApp
+//---------------------------------------------------------
+
+class AudioMixerApp : public Q3MainWindow {
+ //QString name;
+ MixerConfig* cfg;
+ StripList stripList;
+ Q3ScrollView* view;
+ QWidget* central;
+ Q3HBoxLayout* lbox;
+ //Strip* master;
+ Q3HBoxLayout* layout;
+ Q3PopupMenu* menuView;
+ RouteDialog* routingDialog;
+ int routingId;
+ int oldAuxsSize;
+
+ Q3Action* showMidiTracksId;
+ Q3Action* showDrumTracksId;
+ Q3Action* showInputTracksId;
+ Q3Action* showOutputTracksId;
+ Q3Action* showWaveTracksId;
+ Q3Action* showGroupTracksId;
+ Q3Action* showAuxTracksId;
+ Q3Action* showSyntiTracksId;
+
+ Q_OBJECT
+
+ virtual void closeEvent(QCloseEvent*);
+ void addStrip(Track*, int);
+ void showRouteDialog(bool);
+
+ enum UpdateAction {
+ NO_UPDATE, UPDATE_ALL, UPDATE_MIDI, STRIP_INSERTED, STRIP_REMOVED
+ };
+ void updateMixer(UpdateAction);
+
+ signals:
+ void closed();
+
+ private slots:
+ void songChanged(int);
+ //void configChanged() { songChanged(-1); }
+ void configChanged();
+ void toggleRouteDialog();
+ void routingDialogClosed();
+ //void showTracksChanged(QAction*);
+ void showMidiTracksChanged(bool);
+ void showDrumTracksChanged(bool);
+ void showWaveTracksChanged(bool);
+ void showInputTracksChanged(bool);
+ void showOutputTracksChanged(bool);
+ void showGroupTracksChanged(bool);
+ void showAuxTracksChanged(bool);
+ void showSyntiTracksChanged(bool);
+
+ public:
+ //AudioMixerApp(QWidget* parent);
+ AudioMixerApp(QWidget* parent, MixerConfig* c);
+ //void write(Xml&, const char* name);
+ //void write(int level, Xml& xml, const char* name);
+ void write(int level, Xml& xml);
+ void clear();
+ };
+
+#endif
+
diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp
new file mode 100644
index 00000000..de7bf985
--- /dev/null
+++ b/muse2/muse/mixer/astrip.cpp
@@ -0,0 +1,2830 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: astrip.cpp,v 1.23.2.17 2009/11/16 01:55:55 terminator356 Exp $
+//
+// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <fastlog.h>
+
+#include <qlayout.h>
+#include <qapplication.h>
+#include <qdialog.h>
+#include <qtoolbutton.h>
+#include <qlabel.h>
+#include <qdialog.h>
+#include <qcombobox.h>
+#include <qtooltip.h>
+#include <qtimer.h>
+//#include <qpopupmenu.h>
+#include <qcursor.h>
+#include <qpainter.h>
+#include <qstring.h>
+#include <qpoint.h>
+#include <qevent.h>
+#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+
+#include "app.h"
+#include "globals.h"
+#include "audio.h"
+#include "driver/audiodev.h"
+#include "song.h"
+#include "slider.h"
+#include "knob.h"
+#include "combobox.h"
+#include "meter.h"
+#include "astrip.h"
+#include "track.h"
+#include "synth.h"
+//#include "route.h"
+#include "doublelabel.h"
+#include "rack.h"
+#include "node.h"
+#include "amixer.h"
+#include "icons.h"
+#include "gconfig.h"
+#include "ttoolbutton.h"
+#include "menutitleitem.h"
+#include "popupmenu.h"
+
+/*
+//---------------------------------------------------------
+// MenuTitleItem
+//---------------------------------------------------------
+
+class MenuTitleItem : public QCustomMenuItem {
+ QString s;
+ virtual bool fullSpan() const { return true; }
+ virtual bool isSeparator() const { return true; }
+ virtual void paint(QPainter* p, const QColorGroup& cg, bool act,
+ bool, int, int, int, int);
+ virtual QSize sizeHint();
+
+ public:
+ MenuTitleItem(QString s);
+ };
+*/
+
+//---------------------------------------------------------
+// MenuTitleItem
+//---------------------------------------------------------
+
+MenuTitleItem::MenuTitleItem(QString ss)
+ : s(ss)
+ {
+ }
+
+QSize MenuTitleItem::sizeHint()
+ {
+ return QSize(60, 20);
+ }
+
+//---------------------------------------------------------
+// drawItem
+//---------------------------------------------------------
+
+void MenuTitleItem::paint(QPainter* p, const QColorGroup&, bool,
+ bool, int x, int y, int w, int h)
+ {
+ p->fillRect(x, y, w, h, QBrush(Qt::lightGray));
+ p->drawText(x, y, w, h, Qt::AlignCenter, s);
+ }
+
+//---------------------------------------------------------
+// minimumSizeHint
+//---------------------------------------------------------
+
+QSize AudioStrip::minimumSizeHint () const
+{
+ // We force the width of the size hint to be what we want
+ //return QWidget::minimumSizeHint();
+ return QSize(66,QWidget::minimumSizeHint().height());
+}
+
+//---------------------------------------------------------
+// heartBeat
+//---------------------------------------------------------
+
+void AudioStrip::heartBeat()
+ {
+ for (int ch = 0; ch < track->channels(); ++ch) {
+ if (meter[ch]) {
+ //int meterVal = track->meter(ch);
+ //int peak = track->peak(ch);
+ //meter[ch]->setVal(meterVal, peak, false);
+ meter[ch]->setVal(track->meter(ch), track->peak(ch), false);
+ }
+ }
+ Strip::heartBeat();
+ updateVolume();
+ updatePan();
+ }
+
+//---------------------------------------------------------
+// configChanged
+//---------------------------------------------------------
+
+void AudioStrip::configChanged()
+{
+ songChanged(SC_CONFIG);
+}
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void AudioStrip::songChanged(int val)
+ {
+ // Is it simply a midi controller value adjustment? Forget it.
+ if (val == SC_MIDI_CONTROLLER)
+ return;
+
+ AudioTrack* src = (AudioTrack*)track;
+
+ // Do channels before config...
+ if (val & SC_CHANNELS)
+ updateChannels();
+
+ // p3.3.47
+ // Update the routing popup menu if anything relevant changed.
+ if (val & (SC_ROUTE | SC_CHANNELS | SC_CONFIG))
+ {
+ //updateRouteMenus();
+ muse->updateRouteMenus(track, this); // p3.3.50 Use this handy shared routine.
+ }
+
+ // Catch when label font, or configuration min slider and meter values change.
+ if (val & SC_CONFIG)
+ {
+ // Added by Tim. p3.3.9
+
+ // Set the strip label's font.
+ //label->setFont(config.fonts[1]);
+ setLabelFont();
+
+ // Adjust minimum volume slider and label values.
+ slider->setRange(config.minSlider-0.1, 10.0);
+ sl->setRange(config.minSlider, 10.0);
+
+ // Adjust minimum aux knob and label values.
+ int n = auxKnob.size();
+ for (int idx = 0; idx < n; ++idx)
+ {
+ auxKnob[idx]->blockSignals(true);
+ auxLabel[idx]->blockSignals(true);
+ auxKnob[idx]->setRange(config.minSlider-0.1, 10.0);
+ auxLabel[idx]->setRange(config.minSlider, 10.1);
+ auxKnob[idx]->blockSignals(false);
+ auxLabel[idx]->blockSignals(false);
+ }
+
+ // Adjust minimum meter values.
+ for(int c = 0; c < channel; ++c)
+ meter[c]->setRange(config.minMeter, 10.0);
+ }
+
+ if (mute && (val & SC_MUTE)) { // mute && off
+ mute->blockSignals(true);
+ mute->setOn(src->mute());
+ mute->blockSignals(false);
+ updateOffState();
+ }
+ if (solo && (val & SC_SOLO)) {
+ if((bool)track->internalSolo())
+ {
+ if(!useSoloIconSet2)
+ {
+ solo->setIconSet(*soloIconSet2);
+ useSoloIconSet2 = true;
+ }
+ }
+ else if(useSoloIconSet2)
+ {
+ solo->setIconSet(*soloIconSet1);
+ useSoloIconSet2 = false;
+ }
+
+ solo->blockSignals(true);
+ solo->setOn(track->solo());
+ solo->blockSignals(false);
+ }
+ if (val & SC_RECFLAG)
+ setRecordFlag(track->recordFlag());
+ if (val & SC_TRACK_MODIFIED)
+ {
+ setLabelText();
+ // Added by Tim. p3.3.9
+ setLabelFont();
+
+ }
+ //if (val & SC_CHANNELS)
+ // updateChannels();
+ if (val & SC_ROUTE) {
+ if (pre) {
+ pre->blockSignals(true);
+ pre->setOn(src->prefader());
+ pre->blockSignals(false);
+ }
+ }
+ if (val & SC_AUX) {
+ int n = auxKnob.size();
+ for (int idx = 0; idx < n; ++idx) {
+ double val = fast_log10(src->auxSend(idx)) * 20.0;
+ auxKnob[idx]->blockSignals(true);
+ auxLabel[idx]->blockSignals(true);
+ auxKnob[idx]->setValue(val);
+ auxLabel[idx]->setValue(val);
+ auxKnob[idx]->blockSignals(false);
+ auxLabel[idx]->blockSignals(false);
+ }
+ }
+ if (autoType && (val & SC_AUTOMATION)) {
+ autoType->blockSignals(true);
+ autoType->setCurrentItem(track->automationType());
+ if(track->automationType() == AUTO_TOUCH || track->automationType() == AUTO_WRITE)
+ autoType->setPaletteBackgroundColor(Qt::red);
+ else
+ autoType->setPaletteBackgroundColor(qApp->palette().active().background());
+
+ autoType->blockSignals(false);
+ }
+ }
+
+//---------------------------------------------------------
+// updateVolume
+//---------------------------------------------------------
+
+void AudioStrip::updateVolume()
+{
+ double vol = ((AudioTrack*)track)->volume();
+ if (vol != volume)
+ {
+ //printf("AudioStrip::updateVolume setting slider and label\n");
+
+ slider->blockSignals(true);
+ sl->blockSignals(true);
+ double val = fast_log10(vol) * 20.0;
+ slider->setValue(val);
+ sl->setValue(val);
+ sl->blockSignals(false);
+ slider->blockSignals(false);
+ volume = vol;
+ }
+}
+
+//---------------------------------------------------------
+// updatePan
+//---------------------------------------------------------
+
+void AudioStrip::updatePan()
+{
+ double v = ((AudioTrack*)track)->pan();
+ if (v != panVal)
+ {
+ //printf("AudioStrip::updatePan setting slider and label\n");
+
+ pan->blockSignals(true);
+ panl->blockSignals(true);
+ pan->setValue(v);
+ panl->setValue(v);
+ panl->blockSignals(false);
+ pan->blockSignals(false);
+ panVal = v;
+ }
+}
+
+//---------------------------------------------------------
+// offToggled
+//---------------------------------------------------------
+
+void AudioStrip::offToggled(bool val)
+ {
+ track->setOff(val);
+ song->update(SC_MUTE);
+ }
+
+//---------------------------------------------------------
+// updateOffState
+//---------------------------------------------------------
+
+void AudioStrip::updateOffState()
+ {
+ bool val = !track->off();
+ slider->setEnabled(val);
+ sl->setEnabled(val);
+ pan->setEnabled(val);
+ panl->setEnabled(val);
+ if (track->type() != Track::AUDIO_SOFTSYNTH)
+ stereo->setEnabled(val);
+ label->setEnabled(val);
+
+ int n = auxKnob.size();
+ for (int i = 0; i < n; ++i)
+ {
+ auxKnob[i]->setEnabled(val);
+ auxLabel[i]->setEnabled(val);
+ }
+
+ if (pre)
+ pre->setEnabled(val);
+ if (record)
+ record->setEnabled(val);
+ if (solo)
+ solo->setEnabled(val);
+ if (mute)
+ mute->setEnabled(val);
+ if (autoType)
+ autoType->setEnabled(val);
+ if (iR)
+ iR->setEnabled(val);
+ if (oR)
+ oR->setEnabled(val);
+ if (off) {
+ off->blockSignals(true);
+ off->setOn(track->off());
+ off->blockSignals(false);
+ }
+ }
+
+//---------------------------------------------------------
+// preToggled
+//---------------------------------------------------------
+
+void AudioStrip::preToggled(bool val)
+ {
+ audio->msgSetPrefader((AudioTrack*)track, val);
+ resetPeaks();
+ song->update(SC_ROUTE);
+ }
+
+//---------------------------------------------------------
+// stereoToggled
+//---------------------------------------------------------
+
+void AudioStrip::stereoToggled(bool val)
+ {
+ int oc = track->channels();
+ int nc = val ? 2 : 1;
+// stereo->setIcon(nc == 2 ? *stereoIcon : *monoIcon);
+ if (oc == nc)
+ return;
+ audio->msgSetChannels((AudioTrack*)track, nc);
+ song->update(SC_CHANNELS);
+ }
+
+//---------------------------------------------------------
+// auxChanged
+//---------------------------------------------------------
+
+void AudioStrip::auxChanged(double val, int idx)
+ {
+ double vol;
+ if (val <= config.minSlider) {
+ vol = 0.0;
+ val -= 1.0; // display special value "off"
+ }
+ else
+ vol = pow(10.0, val/20.0);
+ audio->msgSetAux((AudioTrack*)track, idx, vol);
+ song->update(SC_AUX);
+ }
+
+//---------------------------------------------------------
+// auxLabelChanged
+//---------------------------------------------------------
+
+void AudioStrip::auxLabelChanged(double val, unsigned int idx)
+ {
+ if(idx >= auxKnob.size())
+ return;
+ auxKnob[idx]->setValue(val);
+ }
+
+//---------------------------------------------------------
+// volumeChanged
+//---------------------------------------------------------
+
+void AudioStrip::volumeChanged(double val)
+ {
+ AutomationType at = ((AudioTrack*)track)->automationType();
+ if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH))
+ track->enableVolumeController(false);
+
+ double vol;
+ if (val <= config.minSlider) {
+ vol = 0.0;
+ val -= 1.0; // display special value "off"
+ }
+ else
+ vol = pow(10.0, val/20.0);
+ volume = vol;
+ audio->msgSetVolume((AudioTrack*)track, vol);
+ ((AudioTrack*)track)->recordAutomation(AC_VOLUME, vol);
+ }
+
+//---------------------------------------------------------
+// volumePressed
+//---------------------------------------------------------
+
+void AudioStrip::volumePressed()
+ {
+ AutomationType at = ((AudioTrack*)track)->automationType();
+ if(at == AUTO_WRITE || (at == AUTO_READ || at == AUTO_TOUCH))
+ track->enableVolumeController(false);
+
+ double val = slider->value();
+ double vol;
+ if (val <= config.minSlider) {
+ vol = 0.0;
+ //val -= 1.0; // display special value "off"
+ }
+ else
+ vol = pow(10.0, val/20.0);
+ volume = vol;
+ audio->msgSetVolume((AudioTrack*)track, volume);
+ ((AudioTrack*)track)->startAutoRecord(AC_VOLUME, volume);
+ }
+
+//---------------------------------------------------------
+// volumeReleased
+//---------------------------------------------------------
+
+void AudioStrip::volumeReleased()
+ {
+ if(track->automationType() != AUTO_WRITE)
+ track->enableVolumeController(true);
+
+ ((AudioTrack*)track)->stopAutoRecord(AC_VOLUME, volume);
+ }
+
+//---------------------------------------------------------
+// volumeRightClicked
+//---------------------------------------------------------
+void AudioStrip::volumeRightClicked(const QPoint &p)
+{
+ song->execAutomationCtlPopup((AudioTrack*)track, p, AC_VOLUME);
+}
+
+//---------------------------------------------------------
+// volLabelChanged
+//---------------------------------------------------------
+
+void AudioStrip::volLabelChanged(double val)
+ {
+ AutomationType at = ((AudioTrack*)track)->automationType();
+ if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH))
+ track->enableVolumeController(false);
+
+ double vol;
+ if (val <= config.minSlider) {
+ vol = 0.0;
+ val -= 1.0; // display special value "off"
+ }
+ else
+ vol = pow(10.0, val/20.0);
+ volume = vol;
+ slider->setValue(val);
+ audio->msgSetVolume((AudioTrack*)track, vol);
+ ((AudioTrack*)track)->startAutoRecord(AC_VOLUME, vol);
+ }
+
+//---------------------------------------------------------
+// panChanged
+//---------------------------------------------------------
+
+void AudioStrip::panChanged(double val)
+ {
+ AutomationType at = ((AudioTrack*)track)->automationType();
+ if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH))
+ track->enablePanController(false);
+
+ panVal = val;
+ audio->msgSetPan(((AudioTrack*)track), val);
+ ((AudioTrack*)track)->recordAutomation(AC_PAN, val);
+ }
+
+//---------------------------------------------------------
+// panPressed
+//---------------------------------------------------------
+
+void AudioStrip::panPressed()
+ {
+ AutomationType at = ((AudioTrack*)track)->automationType();
+ if(at == AUTO_WRITE || (at == AUTO_READ || at == AUTO_TOUCH))
+ track->enablePanController(false);
+
+ panVal = pan->value();
+ audio->msgSetPan(((AudioTrack*)track), panVal);
+ ((AudioTrack*)track)->startAutoRecord(AC_PAN, panVal);
+ }
+
+//---------------------------------------------------------
+// panReleased
+//---------------------------------------------------------
+
+void AudioStrip::panReleased()
+ {
+ if(track->automationType() != AUTO_WRITE)
+ track->enablePanController(true);
+ ((AudioTrack*)track)->stopAutoRecord(AC_PAN, panVal);
+ }
+
+//---------------------------------------------------------
+// panRightClicked
+//---------------------------------------------------------
+void AudioStrip::panRightClicked(const QPoint &p)
+{
+ song->execAutomationCtlPopup((AudioTrack*)track, p, AC_PAN);
+}
+
+//---------------------------------------------------------
+// panLabelChanged
+//---------------------------------------------------------
+
+void AudioStrip::panLabelChanged(double val)
+ {
+ AutomationType at = ((AudioTrack*)track)->automationType();
+ if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH))
+ track->enablePanController(false);
+
+ panVal = val;
+ pan->setValue(val);
+ audio->msgSetPan((AudioTrack*)track, val);
+ ((AudioTrack*)track)->startAutoRecord(AC_PAN, val);
+ }
+
+//---------------------------------------------------------
+// updateChannels
+//---------------------------------------------------------
+
+void AudioStrip::updateChannels()
+ {
+ AudioTrack* t = (AudioTrack*)track;
+ int c = t->channels();
+ //printf("AudioStrip::updateChannels track channels:%d current channels:%d\n", c, channel);
+
+ if (c > channel) {
+ for (int cc = channel; cc < c; ++cc) {
+ meter[cc] = new Meter(this);
+ //meter[cc]->setRange(config.minSlider, 10.0);
+ meter[cc]->setRange(config.minMeter, 10.0);
+ meter[cc]->setFixedWidth(15);
+ connect(meter[cc], SIGNAL(mousePress()), this, SLOT(resetPeaks()));
+ sliderGrid->addWidget(meter[cc], 0, cc+1, Qt::AlignHCenter);
+ sliderGrid->setColStretch(cc, 50);
+ meter[cc]->show();
+ }
+ }
+ else if (c < channel) {
+ for (int cc = channel-1; cc >= c; --cc) {
+ delete meter[cc];
+ meter[cc] = 0;
+ }
+ }
+ channel = c;
+ stereo->blockSignals(true);
+ stereo->setOn(channel == 2);
+ stereo->blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// addKnob
+// type = 0 - panorama
+// 1 - aux send
+//---------------------------------------------------------
+
+Knob* AudioStrip::addKnob(int type, int id, DoubleLabel** dlabel)
+ {
+ Knob* knob = new Knob(this);
+ knob->setFixedWidth(STRIP_WIDTH/2);
+ if (type == 0)
+ knob->setRange(-1.0, +1.0);
+ else
+ knob->setRange(config.minSlider-0.1, 10.0);
+ knob->setBackgroundMode(Qt::PaletteMid);
+
+ if (type == 0)
+ QToolTip::add(knob, tr("panorama"));
+ else
+ QToolTip::add(knob, tr("aux send level"));
+
+
+ DoubleLabel* pl;
+ if (type == 0)
+ pl = new DoubleLabel(0, -1.0, +1.0, this);
+ else
+ pl = new DoubleLabel(0.0, config.minSlider, 10.1, this);
+
+ if (dlabel)
+ *dlabel = pl;
+ pl->setSlider(knob);
+ pl->setFont(config.fonts[1]);
+ pl->setBackgroundMode(Qt::PaletteMid);
+ pl->setFrame(true);
+ if (type == 0)
+ pl->setPrecision(2);
+ else {
+ pl->setPrecision(0);
+ pl->setPrecision(0);
+ }
+ pl->setFixedWidth(STRIP_WIDTH/2);
+
+ QString label;
+ if (type == 0)
+ label = tr("Pan");
+ else
+ label.sprintf("Aux%d", id+1);
+
+ QLabel* plb = new QLabel(label, this);
+ plb->setFont(config.fonts[1]);
+ plb->setFixedWidth(STRIP_WIDTH/2);
+ plb->setAlignment(Qt::AlignCenter);
+
+ Q3GridLayout* pangrid = new Q3GridLayout(0, 2, 2, 0, 0, "pangrid");
+ pangrid->addWidget(plb, 0, 0);
+ pangrid->addWidget(pl, 1, 0);
+ pangrid->addMultiCellWidget(knob, 0, 1, 1, 1);
+ layout->addLayout(pangrid);
+
+ connect(knob, SIGNAL(valueChanged(double,int)), pl, SLOT(setValue(double)));
+ //connect(pl, SIGNAL(valueChanged(double, int)), SLOT(panChanged(double)));
+
+ if (type == 0) {
+ connect(pl, SIGNAL(valueChanged(double, int)), SLOT(panLabelChanged(double)));
+ connect(knob, SIGNAL(sliderMoved(double,int)), SLOT(panChanged(double)));
+ connect(knob, SIGNAL(sliderPressed(int)), SLOT(panPressed()));
+ connect(knob, SIGNAL(sliderReleased(int)), SLOT(panReleased()));
+ connect(knob, SIGNAL(sliderRightClicked(const QPoint &, int)), SLOT(panRightClicked(const QPoint &)));
+ }
+ else {
+ knob->setId(id);
+
+ connect(pl, SIGNAL(valueChanged(double, int)), knob, SLOT(setValue(double)));
+ // Not used yet. Switch if/when necessary.
+ //connect(pl, SIGNAL(valueChanged(double, int)), SLOT(auxLabelChanged(double, int)));
+
+ connect(knob, SIGNAL(sliderMoved(double, int)), SLOT(auxChanged(double, int)));
+ }
+ return knob;
+ }
+
+//---------------------------------------------------------
+// AudioStrip
+//---------------------------------------------------------
+
+AudioStrip::~AudioStrip()
+ {
+ }
+
+
+//---------------------------------------------------------
+// AudioStrip
+// create mixer strip
+//---------------------------------------------------------
+
+AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at)
+ : Strip(parent, at)
+ {
+ //iR = 0;
+ //oR = 0;
+
+ off = 0;
+
+ volume = -1.0;
+ panVal = 0;
+
+ record = 0;
+
+ AudioTrack* t = (AudioTrack*)track;
+ channel = at->channels();
+ setFixedWidth(STRIP_WIDTH);
+ setMinimumWidth(STRIP_WIDTH);
+
+ int ch = 0;
+ for (; ch < channel; ++ch)
+ meter[ch] = new Meter(this);
+ for (; ch < MAX_CHANNELS; ++ch)
+ meter[ch] = 0;
+
+ //---------------------------------------------------
+ // plugin rack
+ //---------------------------------------------------
+
+ EffectRack* rack = new EffectRack(this, t);
+ rack->setFixedWidth(STRIP_WIDTH);
+ rack->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
+ layout->addWidget(rack);
+
+ //---------------------------------------------------
+ // mono/stereo pre/post
+ //---------------------------------------------------
+
+ Q3HBoxLayout* ppBox = new Q3HBoxLayout(0);
+ stereo = new QToolButton(this);
+ stereo->setFont(config.fonts[1]);
+ QIcon stereoSet;
+ stereoSet.setPixmap(*monoIcon, QIcon::Automatic, QIcon::Normal, QIcon::Off);
+ stereoSet.setPixmap(*stereoIcon, QIcon::Automatic, QIcon::Normal, QIcon::On);
+ stereo->setIconSet(stereoSet);
+
+ stereo->setToggleButton(true);
+ QToolTip::add(stereo, tr("1/2 channel"));
+ stereo->setOn(channel == 2);
+ stereo->setFixedWidth(STRIP_WIDTH/2);
+ connect(stereo, SIGNAL(toggled(bool)), SLOT(stereoToggled(bool)));
+
+ // disable mono/stereo for Synthesizer-Plugins
+ if (t->type() == Track::AUDIO_SOFTSYNTH)
+ stereo->setEnabled(false);
+
+ pre = new QToolButton(this);
+ pre->setFont(config.fonts[1]);
+ pre->setToggleButton(true);
+ pre->setText(tr("Pre"));
+ QToolTip::add(pre, tr("pre fader - post fader"));
+ pre->setOn(t->prefader());
+ pre->setFixedWidth(STRIP_WIDTH/2);
+ connect(pre, SIGNAL(toggled(bool)), SLOT(preToggled(bool)));
+
+ ppBox->addWidget(stereo);
+ ppBox->addWidget(pre);
+ layout->addLayout(ppBox);
+
+ //---------------------------------------------------
+ // aux send
+ //---------------------------------------------------
+
+ int auxsSize = song->auxs()->size();
+ if (t->hasAuxSend()) {
+ for (int idx = 0; idx < auxsSize; ++idx) {
+ DoubleLabel* al;
+ Knob* ak = addKnob(1, idx, &al);
+ auxKnob.push_back(ak);
+ auxLabel.push_back(al);
+ double val = fast_log10(t->auxSend(idx))*20.0;
+ ak->setValue(val);
+ al->setValue(val);
+ }
+ }
+ else {
+ if (auxsSize)
+ layout->addSpacing((STRIP_WIDTH/2 + 2) * auxsSize);
+ }
+
+ //---------------------------------------------------
+ // slider, label, meter
+ //---------------------------------------------------
+
+ sliderGrid = new Q3GridLayout(this); // ddskrjo this
+ sliderGrid->setRowStretch(0, 100);
+
+ //slider = new Slider(this);
+ slider = new Slider(this, "vol", Qt::Vertical, Slider::None,
+ Slider::BgTrough | Slider::BgSlot);
+ slider->setCursorHoming(true);
+ slider->setRange(config.minSlider-0.1, 10.0);
+ slider->setFixedWidth(20);
+ slider->setFont(config.fonts[1]);
+ slider->setValue(fast_log10(t->volume())*20.0);
+
+ sliderGrid->addWidget(slider, 0, 0, Qt::AlignHCenter);
+
+ for (int i = 0; i < channel; ++i) {
+ //meter[i]->setRange(config.minSlider, 10.0);
+ meter[i]->setRange(config.minMeter, 10.0);
+ meter[i]->setFixedWidth(15);
+ connect(meter[i], SIGNAL(mousePress()), this, SLOT(resetPeaks()));
+ sliderGrid->addWidget(meter[i], 0, i+1, Qt::AlignHCenter);
+ sliderGrid->setColStretch(i, 50);
+ }
+ layout->addLayout(sliderGrid);
+
+ sl = new DoubleLabel(0.0, config.minSlider, 10.0, this);
+ sl->setSlider(slider);
+ sl->setFont(config.fonts[1]);
+ sl->setBackgroundMode(Qt::PaletteMid);
+ sl->setSuffix(tr("dB"));
+ sl->setFrame(true);
+ sl->setPrecision(0);
+ sl->setFixedWidth(STRIP_WIDTH);
+ sl->setValue(fast_log10(t->volume()) * 20.0);
+
+ connect(sl, SIGNAL(valueChanged(double,int)), SLOT(volLabelChanged(double)));
+ //connect(sl, SIGNAL(valueChanged(double,int)), SLOT(volumeChanged(double)));
+ connect(slider, SIGNAL(valueChanged(double,int)), sl, SLOT(setValue(double)));
+ connect(slider, SIGNAL(sliderMoved(double,int)), SLOT(volumeChanged(double)));
+ connect(slider, SIGNAL(sliderPressed(int)), SLOT(volumePressed()));
+ connect(slider, SIGNAL(sliderReleased(int)), SLOT(volumeReleased()));
+ connect(slider, SIGNAL(sliderRightClicked(const QPoint &, int)), SLOT(volumeRightClicked(const QPoint &)));
+ layout->addWidget(sl);
+
+ //---------------------------------------------------
+ // pan, balance
+ //---------------------------------------------------
+
+ pan = addKnob(0, 0, &panl);
+ pan->setValue(t->pan());
+
+ //---------------------------------------------------
+ // mute, solo, record
+ //---------------------------------------------------
+
+ if (track->canRecord()) {
+ record = new TransparentToolButton(this);
+ record->setToggleButton(true);
+ record->setFixedWidth(STRIP_WIDTH/2);
+ record->setBackgroundMode(Qt::PaletteMid);
+ QIcon iconSet;
+ iconSet.setPixmap(*record_on_Icon, QIcon::Automatic, QIcon::Normal, QIcon::On);
+ iconSet.setPixmap(*record_off_Icon, QIcon::Automatic, QIcon::Normal, QIcon::Off);
+ record->setIconSet(iconSet);
+ QToolTip::add(record, tr("record"));
+ record->setOn(t->recordFlag());
+ connect(record, SIGNAL(toggled(bool)), SLOT(recordToggled(bool)));
+ }
+
+ Track::TrackType type = t->type();
+
+ Q3HBoxLayout* smBox1 = new Q3HBoxLayout(0);
+ Q3HBoxLayout* smBox2 = new Q3HBoxLayout(0);
+
+ mute = new QToolButton(this);
+
+ QIcon muteSet;
+ muteSet.setPixmap(*muteIconOn, QIcon::Automatic, QIcon::Normal, QIcon::Off);
+ muteSet.setPixmap(*muteIconOff, QIcon::Automatic, QIcon::Normal, QIcon::On);
+ mute->setIconSet(muteSet);
+ mute->setToggleButton(true);
+ QToolTip::add(mute, tr("mute"));
+ mute->setOn(t->mute());
+ mute->setFixedWidth(STRIP_WIDTH/2-2);
+ connect(mute, SIGNAL(toggled(bool)), SLOT(muteToggled(bool)));
+ smBox2->addWidget(mute);
+
+ solo = new QToolButton(this);
+
+ if((bool)t->internalSolo())
+ {
+ solo->setIconSet(*soloIconSet2);
+ useSoloIconSet2 = true;
+ }
+ else
+ {
+ solo->setIconSet(*soloIconSet1);
+ useSoloIconSet2 = false;
+ }
+
+ solo->setToggleButton(true);
+ solo->setOn(t->solo());
+
+ solo->setFixedWidth(STRIP_WIDTH/2-2);
+ smBox2->addWidget(solo);
+ connect(solo, SIGNAL(toggled(bool)), SLOT(soloToggled(bool)));
+ if (type == Track::AUDIO_OUTPUT) {
+ QToolTip::add(record, tr("record downmix"));
+ //QToolTip::add(solo, tr("solo mode (monitor)"));
+ QToolTip::add(solo, tr("solo mode"));
+ }
+ else {
+ //QToolTip::add(solo, tr("pre fader listening"));
+ QToolTip::add(solo, tr("solo mode"));
+ }
+
+ off = new TransparentToolButton(this);
+ QIcon iconSet;
+ iconSet.setPixmap(*exit1Icon, QIcon::Automatic, QIcon::Normal, QIcon::On);
+ iconSet.setPixmap(*exitIcon, QIcon::Automatic, QIcon::Normal, QIcon::Off);
+ off->setIconSet(iconSet);
+ off->setBackgroundMode(Qt::PaletteMid);
+ off->setFixedWidth(STRIP_WIDTH/2);
+ off->setToggleButton(true);
+ QToolTip::add(off, tr("off"));
+ off->setOn(t->off());
+ connect(off, SIGNAL(toggled(bool)), SLOT(offToggled(bool)));
+
+ smBox1->addWidget(off);
+ if (track->canRecord())
+ smBox1->addWidget(record);
+ else
+ smBox1->addStretch(100);
+
+ layout->addLayout(smBox1);
+ layout->addLayout(smBox2);
+
+ //---------------------------------------------------
+ // routing
+ //---------------------------------------------------
+
+ Q3HBoxLayout* rBox = new Q3HBoxLayout(0);
+ if (type != Track::AUDIO_AUX) {
+ iR = new QToolButton(this);
+ iR->setFont(config.fonts[1]);
+ iR->setFixedWidth((STRIP_WIDTH-4)/2);
+ iR->setText(tr("iR"));
+ iR->setToggleButton(false);
+ QToolTip::add(iR, tr("input routing"));
+ rBox->addWidget(iR);
+ connect(iR, SIGNAL(pressed()), SLOT(iRoutePressed()));
+ }
+ else
+ rBox->addSpacing((STRIP_WIDTH-4)/2);
+ oR = new QToolButton(this);
+ oR->setFont(config.fonts[1]);
+ oR->setFixedWidth((STRIP_WIDTH-4)/2);
+ oR->setText(tr("oR"));
+ oR->setToggleButton(false);
+ QToolTip::add(oR, tr("output routing"));
+ rBox->addWidget(oR);
+ connect(oR, SIGNAL(pressed()), SLOT(oRoutePressed()));
+
+ layout->addLayout(rBox);
+
+ //---------------------------------------------------
+ // automation type
+ //---------------------------------------------------
+
+ autoType = new ComboBox(this);
+ autoType->setFont(config.fonts[1]);
+ autoType->setFixedWidth(STRIP_WIDTH-4);
+ autoType->insertItem(tr("Off"), AUTO_OFF);
+ autoType->insertItem(tr("Read"), AUTO_READ);
+ autoType->insertItem(tr("Touch"), AUTO_TOUCH);
+ autoType->insertItem(tr("Write"), AUTO_WRITE);
+ autoType->setCurrentItem(t->automationType());
+
+ if(t->automationType() == AUTO_TOUCH || t->automationType() == AUTO_WRITE)
+ autoType->setPaletteBackgroundColor(Qt::red);
+ else
+ autoType->setPaletteBackgroundColor(qApp->palette().active().background());
+
+ QToolTip::add(autoType, tr("automation type"));
+ connect(autoType, SIGNAL(activated(int,int)), SLOT(setAutomationType(int,int)));
+ layout->addWidget(autoType);
+
+ if (off) {
+ off->blockSignals(true);
+ updateOffState(); // init state
+ off->blockSignals(false);
+ }
+ connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat()));
+ }
+
+//---------------------------------------------------------
+// addMenuItem
+//---------------------------------------------------------
+
+static int addMenuItem(AudioTrack* track, Track* route_track, PopupMenu* lb, int id, RouteMenuMap& mm, int channel, int channels, bool isOutput)
+{
+ // totalInChannels is only used by syntis.
+ //int channels = (!isOutput || route_track->type() != Track::AUDIO_SOFTSYNTH) ? ((AudioTrack*)route_track)->totalOutChannels() : ((AudioTrack*)route_track)->totalInChannels();
+ //int channels = (!isOutput || track->type() != Track::AUDIO_SOFTSYNTH) ? ((AudioTrack*)track)->totalOutChannels() : ((AudioTrack*)track)->totalInChannels();
+ int toch = ((AudioTrack*)track)->totalOutChannels();
+ // If track channels = 1, it must be a mono synth. And synti channels cannot be changed by user.
+ if(track->channels() == 1)
+ toch = 1;
+
+ // totalInChannels is only used by syntis.
+ ///int chans = (isOutput || track->type() != Track::AUDIO_SOFTSYNTH) ? toch : ((AudioTrack*)track)->totalInChannels();
+
+ // Don't add the last stray mono route if the track is stereo.
+ //if(route_track->channels() > 1 && (channel+1 == chans))
+ // return id;
+
+ RouteList* rl = isOutput ? track->outRoutes() : track->inRoutes();
+
+ QString s(route_track->name());
+ //int trackchans = track->channels();
+ //QString ns;
+
+ //if(track->channels() > 1 && (channel+1 < channels))
+ //if(track->channels() > 1)
+ //if(route_track->type() == Track::AUDIO_SOFTSYNTH && channels > 2 && track->channels() > 1)
+ ///if(track->type() == Track::AUDIO_SOFTSYNTH && chans > 2 && route_track->channels() > 1)
+ /// s += QString(" < [%1,%2]").arg(channel+1).arg(channel+2);
+
+ //int it = lb->insertItem(s);
+ lb->insertItem(s, id);
+
+ int ach = channel;
+ int bch = -1;
+
+ Route r(route_track, isOutput ? ach : bch, channels);
+ //Route r(route_track, channel);
+
+ r.remoteChannel = isOutput ? bch : ach;
+
+ mm.insert( pRouteMenuMap(id, r) );
+
+ for(iRoute ir = rl->begin(); ir != rl->end(); ++ir)
+ {
+ //if (ir->type == 0 && ir->track == track) {
+ //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channels == channels)
+ //if(ir->type == Route::TRACK_ROUTE && ir->track == track &&
+ // (channel != -1 && ir->channel == channel) && (channels != -1 && ir->channels == channels))
+ //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == channel)
+ //printf("addMenuItem: ir->type:%d ir->track:%s track:%s ir->channel:%d channel:%d ir->channels:%d channels:%d\n",
+ // ir->type, ir->track->name().latin1(), track->name().latin1(), ir->channel, channel, ir->channels, channels);
+ //if(ir->type == Route::TRACK_ROUTE && ir->track == route_track && ir->channel == channel && ir->remoteChannel == r.remoteChannel)
+ //if(*ir == r)
+ //if(ir->type == Route::TRACK_ROUTE && ir->track == route_track && ir->channel == channel && ir->channels == channels && ir->remoteChannel == r.remoteChannel)
+
+ if(ir->type == Route::TRACK_ROUTE && ir->track == route_track && ir->remoteChannel == r.remoteChannel)
+ {
+ int tcompch = r.channel;
+ if(tcompch == -1)
+ tcompch = 0;
+ int tcompchs = r.channels;
+ if(tcompchs == -1)
+ tcompchs = isOutput ? track->channels() : route_track->channels();
+
+ int compch = ir->channel;
+ if(compch == -1)
+ compch = 0;
+ int compchs = ir->channels;
+ if(compchs == -1)
+ compchs = isOutput ? track->channels() : ir->track->channels();
+
+ //if(ir->type == Route::TRACK_ROUTE && ir->track == route_track && ir->channel == r.channel && ir->channels == r.channels && ir->remoteChannel == r.remoteChannel)
+ if(compch == tcompch && compchs == tcompchs)
+ {
+ //lb->setItemChecked(it, true);
+ lb->setItemChecked(id, true);
+ break;
+ }
+ }
+ }
+ return ++id;
+}
+
+//---------------------------------------------------------
+// addAuxPorts
+//---------------------------------------------------------
+
+static int addAuxPorts(AudioTrack* t, PopupMenu* lb, int id, RouteMenuMap& mm, int channel, int channels, bool isOutput)
+ {
+ AuxList* al = song->auxs();
+ for (iAudioAux i = al->begin(); i != al->end(); ++i) {
+ Track* track = *i;
+ if (t == track)
+ continue;
+ //id = addMenuItem(parent, t, track, lb, id, mm, channel, channels, isOutput);
+ id = addMenuItem(t, track, lb, id, mm, channel, channels, isOutput);
+
+ /*
+ QString s(track->name());
+ //int it = lb->insertItem(s);
+ lb->insertItem(s, id);
+ for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
+ //if (ir->type == 0 && ir->track == track) {
+ if (ir->type == 0 && ir->track == track && ir->channels == channels) {
+ //lb->setItemChecked(it, true);
+ lb->setItemChecked(id, true);
+ break;
+ }
+ }
+ ++id;
+ */
+
+ }
+ return id;
+ }
+
+//---------------------------------------------------------
+// addInPorts
+//---------------------------------------------------------
+
+static int addInPorts(AudioTrack* t, PopupMenu* lb, int id, RouteMenuMap& mm, int channel, int channels, bool isOutput)
+ {
+ InputList* al = song->inputs();
+ for (iAudioInput i = al->begin(); i != al->end(); ++i) {
+ Track* track = *i;
+ if (t == track)
+ continue;
+ //id = addMenuItem(parent, t, track, lb, id, mm, channel, channels, isOutput);
+ id = addMenuItem(t, track, lb, id, mm, channel, channels, isOutput);
+
+ /*
+ QString s(track->name());
+ //int it = lb->insertItem(s);
+ lb->insertItem(s, id);
+ for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
+ //if (ir->type == 0 && ir->track == track) {
+ if (ir->type == 0 && ir->track == track && ir->channels == channels) {
+ //lb->setItemChecked(it, true);
+ lb->setItemChecked(id, true);
+ break;
+ }
+ }
+ ++id;
+ */
+
+ }
+ return id;
+ }
+
+//---------------------------------------------------------
+// addOutPorts
+//---------------------------------------------------------
+
+static int addOutPorts(AudioTrack* t, PopupMenu* lb, int id, RouteMenuMap& mm, int channel, int channels, bool isOutput)
+ {
+ OutputList* al = song->outputs();
+ for (iAudioOutput i = al->begin(); i != al->end(); ++i) {
+ Track* track = *i;
+ if (t == track)
+ continue;
+ //id = addMenuItem(parent, t, track, lb, id, mm, channel, channels, isOutput);
+ id = addMenuItem(t, track, lb, id, mm, channel, channels, isOutput);
+
+ /*
+ QString s(track->name());
+ //int it = lb->insertItem(s);
+ lb->insertItem(s, id);
+ for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
+ //if (ir->type == 0 && ir->track == track) {
+ if (ir->type == 0 && ir->track == track && ir->channels == channels) {
+ //lb->setItemChecked(it, true);
+ lb->setItemChecked(id, true);
+ break;
+ }
+ }
+ ++id;
+ */
+
+ }
+ return id;
+ }
+
+//---------------------------------------------------------
+// addGroupPorts
+//---------------------------------------------------------
+
+static int addGroupPorts(AudioTrack* t, PopupMenu* lb, int id, RouteMenuMap& mm, int channel, int channels, bool isOutput)
+ {
+ GroupList* al = song->groups();
+ for (iAudioGroup i = al->begin(); i != al->end(); ++i) {
+ Track* track = *i;
+ if (t == track)
+ continue;
+ //id = addMenuItem(parent, t, track, lb, id, mm, channel, channels, isOutput);
+ id = addMenuItem(t, track, lb, id, mm, channel, channels, isOutput);
+
+ /*
+ QString s(track->name());
+ //int it = lb->insertItem(s);
+ lb->insertItem(s, id);
+ for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
+ //if (ir->type == 0 && ir->track == track) {
+ if (ir->type == 0 && ir->track == track && ir->channels == channels) {
+ //lb->setItemChecked(it, true);
+ lb->setItemChecked(id, true);
+ break;
+ }
+ }
+ ++id;
+ */
+
+ }
+ return id;
+ }
+
+//---------------------------------------------------------
+// addWavePorts
+//---------------------------------------------------------
+
+static int addWavePorts(AudioTrack* t, PopupMenu* lb, int id, RouteMenuMap& mm, int channel, int channels, bool isOutput)
+ {
+ WaveTrackList* al = song->waves();
+ for (iWaveTrack i = al->begin(); i != al->end(); ++i) {
+ Track* track = *i;
+ if (t == track)
+ continue;
+ //id = addMenuItem(parent, t, track, lb, id, mm, channel, channels, isOutput);
+ id = addMenuItem(t, track, lb, id, mm, channel, channels, isOutput);
+
+ /*
+ QString s(track->name());
+ //int it = lb->insertItem(s);
+ lb->insertItem(s, id);
+ for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
+ //if (ir->type == 0 && ir->track == track) {
+ if (ir->type == 0 && ir->track == track && ir->channels == channels) {
+ //lb->setItemChecked(it, true);
+ lb->setItemChecked(id, true);
+ break;
+ }
+ }
+ ++id;
+ */
+
+ }
+ return id;
+ }
+
+//---------------------------------------------------------
+// addSyntiPorts
+//---------------------------------------------------------
+
+static int addSyntiPorts(AudioTrack* t, PopupMenu* lb, int id,
+ RouteMenuMap& mm, int channel, int channels, bool isOutput)
+{
+ RouteList* rl = isOutput ? t->outRoutes() : t->inRoutes();
+
+ SynthIList* al = song->syntis();
+ for (iSynthI i = al->begin(); i != al->end(); ++i)
+ {
+ Track* track = *i;
+ if (t == track)
+ continue;
+ //id = addMenuItem(parent, track, lb, r, id, mm, channel, channels);
+
+ /*
+ QString s(track->name());
+ //int it = lb->insertItem(s);
+ lb->insertItem(s, id);
+ for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
+ //if (ir->type == 0 && ir->track == track) {
+ if (ir->type == 0 && ir->track == track && ir->channels == channels) {
+ //lb->setItemChecked(it, true);
+ lb->setItemChecked(id, true);
+ break;
+ }
+ }
+ ++id;
+ */
+
+ //SynthI* synti = (SynthI*)track;
+
+ int toch = ((AudioTrack*)track)->totalOutChannels();
+ // If track channels = 1, it must be a mono synth. And synti channels cannot be changed by user.
+ if(track->channels() == 1)
+ toch = 1;
+
+ //int chans = synti->totalOutChannels();
+ //int chans = (!isOutput || track->type() != Track::AUDIO_SOFTSYNTH) ? ((AudioTrack*)track)->totalOutChannels() : ((AudioTrack*)track)->totalInChannels();
+ // totalInChannels is only used by syntis.
+ int chans = (!isOutput || track->type() != Track::AUDIO_SOFTSYNTH) ? toch : ((AudioTrack*)track)->totalInChannels();
+
+ //int schans = synti->channels();
+ //if(schans < chans)
+ // chans = schans;
+ int tchans = (channels != -1) ? channels: t->channels();
+ if(tchans == 2)
+ {
+ // Ignore odd numbered left-over mono channel.
+ //chans = chans & ~1;
+ //if(chans != 0)
+ chans -= 1;
+ }
+
+ if(chans > 0)
+ {
+ //QPopupMenu* chpup = new QPopupMenu(parent);
+ //PopupMenu* chpup = new PopupMenu(parent);
+ //PopupMenu* chpup = new PopupMenu(lb->parent());
+ PopupMenu* chpup = new PopupMenu();
+ //strip->connect(chpup, SIGNAL(activated(int)), strip, SLOT(routingPopupMenuActivated(int)));
+ lb->connect(chpup, SIGNAL(activated(int)), lb, SIGNAL(activated(int)));
+ chpup->setCheckable(true);
+ for(int ch = 0; ch < chans; ++ch)
+ {
+ char buffer[128];
+ if(tchans == 2)
+ snprintf(buffer, 128, "%s %d,%d", chpup->tr("Channel").latin1(), ch+1, ch+2);
+ else
+ snprintf(buffer, 128, "%s %d", chpup->tr("Channel").latin1(), ch+1);
+ chpup->insertItem(QString(buffer), id);
+
+ int ach = (channel == -1) ? ch : channel;
+ int bch = (channel == -1) ? -1 : ch;
+
+ Route rt(track, (t->type() != Track::AUDIO_SOFTSYNTH || isOutput) ? ach : bch, tchans);
+ //Route rt(track, ch);
+ //rt.remoteChannel = -1;
+ rt.remoteChannel = (t->type() != Track::AUDIO_SOFTSYNTH || isOutput) ? bch : ach;
+
+ mm.insert( pRouteMenuMap(id, rt) );
+
+ for(iRoute ir = rl->begin(); ir != rl->end(); ++ir)
+ {
+ //if (ir->type == 0 && ir->track == track) {
+ //if(ir->type == 0 && ir->track == track && ir->channels == channels)
+ //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == channel &&
+ // ir->channels == channels && ir->remoteChannel == r.remoteChannel)
+ //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == ch &&
+ // ir->remoteChannel == rt.remoteChannel)
+ //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == rt.channel &&
+ // ir->channels == rt.channels && ir->remoteChannel == rt.remoteChannel)
+
+ if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->remoteChannel == rt.remoteChannel)
+ {
+ int tcompch = rt.channel;
+ if(tcompch == -1)
+ tcompch = 0;
+ int tcompchs = rt.channels;
+ if(tcompchs == -1)
+ tcompchs = isOutput ? t->channels() : track->channels();
+
+ int compch = ir->channel;
+ if(compch == -1)
+ compch = 0;
+ int compchs = ir->channels;
+ if(compchs == -1)
+ compchs = isOutput ? t->channels() : ir->track->channels();
+
+ if(compch == tcompch && compchs == tcompchs)
+ {
+ chpup->setItemChecked(id, true);
+ break;
+ }
+ }
+ }
+ ++id;
+ }
+
+ lb->insertItem(track->name(), chpup);
+ }
+ }
+ return id;
+}
+
+//---------------------------------------------------------
+// addMultiChannelOutPorts
+//---------------------------------------------------------
+
+static int addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, RouteMenuMap& mm, bool isOutput)
+{
+ int toch = t->totalOutChannels();
+ // If track channels = 1, it must be a mono synth. And synti channels cannot be changed by user.
+ if(t->channels() == 1)
+ toch = 1;
+
+ // Number of allocated buffers is always MAX_CHANNELS or more, even if _totalOutChannels is less.
+ //int chans = t->totalOutChannels();
+ // totalInChannels is only used by syntis.
+ //int chans = isOutput ? t->totalOutChannels() : t->totalInChannels();
+ //int chans = (isOutput || t->type() != Track::AUDIO_SOFTSYNTH) ? t->totalOutChannels() : t->totalInChannels();
+ int chans = (isOutput || t->type() != Track::AUDIO_SOFTSYNTH) ? toch : t->totalInChannels();
+
+ // If track channels = 1, it must be a mono synth. And synti channels cannot be changed by user.
+ //if(t->channels() == 1)
+ // chans = 1;
+
+ if(chans > 1)
+ {
+ // pup->insertItem(new MenuTitleItem("<Mono>")); ddskrjo
+ //pup->insertSeparator();
+ }
+
+ //
+ // If it's more than one channel, create a sub-menu. If it's just one channel, don't bother with a sub-menu...
+ //
+
+ //QPopupMenu* chpup = pup;
+ PopupMenu* chpup = pup;
+
+ for(int ch = 0; ch < chans; ++ch)
+ {
+ // If more than one channel, create the sub-menu.
+ if(chans > 1)
+ {
+ //chpup = new QPopupMenu(parent);
+ //chpup = new PopupMenu(parent);
+ //chpup = new PopupMenu(pup->parent());
+ chpup = new PopupMenu();
+ //connect(chpup, SIGNAL(activated(int)), strip, SLOT(oRouteMenuActivated(int)));
+ //strip->connect(chpup, SIGNAL(activated(int)), strip, SLOT(routingPopupMenuActivated(int)));
+ pup->connect(chpup, SIGNAL(activated(int)), pup, SIGNAL(activated(int)));
+ chpup->setCheckable(true);
+ }
+
+ if(isOutput)
+ {
+ switch(t->type())
+ {
+
+ case Track::AUDIO_INPUT:
+ //id = addWavePorts(parent, t, chpup, id, mm, ch, 1, isOutput);
+ id = addWavePorts(t, chpup, id, mm, ch, 1, isOutput);
+ case Track::WAVE:
+ case Track::AUDIO_GROUP:
+ case Track::AUDIO_SOFTSYNTH:
+ //id = addOutPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
+ //id = addGroupPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
+ id = addOutPorts(t, chpup, id, mm, ch, 1, isOutput);
+ id = addGroupPorts(t, chpup, id, mm, ch, 1, isOutput);
+ //id = addSyntiPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
+ //id = addSyntiPorts(strip, parent, t, chpup, id, mm, ch, 1, isOutput);
+ id = addSyntiPorts(t, chpup, id, mm, ch, 1, isOutput);
+ break;
+ case Track::AUDIO_AUX:
+ //id = addOutPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
+ id = addOutPorts(t, chpup, id, mm, ch, 1, isOutput);
+ break;
+ default:
+ break;
+
+ /*
+ case Track::AUDIO_INPUT:
+ id = addWavePorts(parent, t, chpup, id, mm, ch, isOutput);
+ case Track::WAVE:
+ case Track::AUDIO_GROUP:
+ case Track::AUDIO_SOFTSYNTH:
+ id = addOutPorts(parent, t, chpup, id, mm, ch, isOutput);
+ id = addGroupPorts(parent, t, chpup, id, mm, ch, isOutput);
+ id = addSyntiPorts(parent, t, chpup, id, mm, ch, isOutput);
+ break;
+ case Track::AUDIO_AUX:
+ id = addOutPorts(parent, t, chpup, id, mm, ch, isOutput);
+ break;
+ default:
+ break;
+ */
+ }
+ }
+ else
+ {
+ switch(t->type())
+ {
+
+ case Track::AUDIO_OUTPUT:
+ //id = addWavePorts(parent, t, chpup, id, mm, ch, 1, isOutput);
+ //id = addInPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
+ //id = addGroupPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
+ //id = addAuxPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
+ id = addWavePorts(t, chpup, id, mm, ch, 1, isOutput);
+ id = addInPorts(t, chpup, id, mm, ch, 1, isOutput);
+ id = addGroupPorts(t, chpup, id, mm, ch, 1, isOutput);
+ id = addAuxPorts(t, chpup, id, mm, ch, 1, isOutput);
+ //id = addSyntiPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
+ //id = addSyntiPorts(strip, parent, t, chpup, id, mm, ch, 1, isOutput);
+ id = addSyntiPorts(t, chpup, id, mm, ch, 1, isOutput);
+ break;
+ case Track::WAVE:
+ //id = addInPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
+ id = addInPorts(t, chpup, id, mm, ch, 1, isOutput);
+ break;
+ case Track::AUDIO_SOFTSYNTH:
+ case Track::AUDIO_GROUP:
+ //id = addWavePorts(parent, t, chpup, id, mm, ch, 1, isOutput);
+ //id = addInPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
+ //id = addGroupPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
+ id = addWavePorts(t, chpup, id, mm, ch, 1, isOutput);
+ id = addInPorts(t, chpup, id, mm, ch, 1, isOutput);
+ id = addGroupPorts(t, chpup, id, mm, ch, 1, isOutput);
+ //id = addSyntiPorts(parent, t, chpup, id, mm, ch, 1, isOutput);
+ //id = addSyntiPorts(strip, parent, t, chpup, id, mm, ch, 1, isOutput);
+ id = addSyntiPorts(t, chpup, id, mm, ch, 1, isOutput);
+ break;
+ default:
+ break;
+
+ /*
+ case Track::AUDIO_OUTPUT:
+ id = addWavePorts(parent, t, chpup, id, mm, ch, isOutput);
+ id = addInPorts(parent, t, chpup, id, mm, ch, isOutput);
+ id = addGroupPorts(parent, t, chpup, id, mm, ch, isOutput);
+ id = addAuxPorts(parent, t, chpup, id, mm, ch, isOutput);
+ id = addSyntiPorts(parent, t, chpup, id, mm, ch, isOutput);
+ break;
+ case Track::WAVE:
+ id = addInPorts(parent, t, chpup, id, mm, ch, isOutput);
+ break;
+ case Track::AUDIO_SOFTSYNTH:
+ case Track::AUDIO_GROUP:
+ id = addWavePorts(parent, t, chpup, id, mm, ch, isOutput);
+ id = addInPorts(parent, t, chpup, id, mm, ch, isOutput);
+ id = addGroupPorts(parent, t, chpup, id, mm, ch, isOutput);
+ id = addSyntiPorts(parent, t, chpup, id, mm, ch, isOutput);
+ break;
+ default:
+ break;
+ */
+ }
+ }
+
+ // If more than one channel, add the created sub-menu.
+ if(chans > 1)
+ {
+ char buffer[128];
+ snprintf(buffer, 128, "%s %d", pup->tr("Channel").latin1(), ch+1);
+ pup->insertItem(QString(buffer), chpup);
+ }
+ }
+
+ // For stereo listing, ignore odd numbered left-over channels.
+ chans -= 1;
+ if(chans > 0)
+ {
+ // Ignore odd numbered left-over channels.
+ //int schans = (chans & ~1) - 1;
+
+ pup->insertSeparator();
+ //pup->insertItem(new MenuTitleItem("<Stereo>")); ddskrjo
+ //pup->insertSeparator();
+
+ //
+ // If it's more than two channels, create a sub-menu. If it's just two channels, don't bother with a sub-menu...
+ //
+
+ //QPopupMenu* chpup = pup;
+ chpup = pup;
+ if(chans <= 2)
+ // Just do one iteration.
+ chans = 1;
+
+ //for(int ch = 0; ch < schans; ++ch)
+ for(int ch = 0; ch < chans; ++ch)
+ {
+ // If more than two channels, create the sub-menu.
+ if(chans > 2)
+ {
+ //chpup = new QPopupMenu(parent);
+ //chpup = new PopupMenu(parent);
+ //chpup = new PopupMenu(pup->parent());
+ chpup = new PopupMenu();
+ //strip->connect(chpup, SIGNAL(activated(int)), strip, SLOT(routingPopupMenuActivated(int)));
+ pup->connect(chpup, SIGNAL(activated(int)), pup, SIGNAL(activated(int)));
+ chpup->setCheckable(true);
+ }
+
+ if(isOutput)
+ {
+ switch(t->type())
+ {
+ case Track::AUDIO_INPUT:
+ //id = addWavePorts(parent, t, chpup, id, mm, ch, 2, isOutput);
+ id = addWavePorts(t, chpup, id, mm, ch, 2, isOutput);
+ case Track::WAVE:
+ case Track::AUDIO_GROUP:
+ case Track::AUDIO_SOFTSYNTH:
+ //id = addOutPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
+ //id = addGroupPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
+ id = addOutPorts(t, chpup, id, mm, ch, 2, isOutput);
+ id = addGroupPorts(t, chpup, id, mm, ch, 2, isOutput);
+ //id = addSyntiPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
+ //id = addSyntiPorts(strip, parent, t, chpup, id, mm, ch, 2, isOutput);
+ id = addSyntiPorts(t, chpup, id, mm, ch, 2, isOutput);
+ break;
+ case Track::AUDIO_AUX:
+ //id = addOutPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
+ id = addOutPorts(t, chpup, id, mm, ch, 2, isOutput);
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch(t->type())
+ {
+ case Track::AUDIO_OUTPUT:
+ //id = addWavePorts(parent, t, chpup, id, mm, ch, 2, isOutput);
+ //id = addInPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
+ //id = addGroupPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
+ //id = addAuxPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
+ id = addWavePorts(t, chpup, id, mm, ch, 2, isOutput);
+ id = addInPorts(t, chpup, id, mm, ch, 2, isOutput);
+ id = addGroupPorts(t, chpup, id, mm, ch, 2, isOutput);
+ id = addAuxPorts(t, chpup, id, mm, ch, 2, isOutput);
+ //id = addSyntiPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
+ //id = addSyntiPorts(strip, parent, t, chpup, id, mm, ch, 2, isOutput);
+ id = addSyntiPorts(t, chpup, id, mm, ch, 2, isOutput);
+ break;
+ case Track::WAVE:
+ //id = addInPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
+ id = addInPorts(t, chpup, id, mm, ch, 2, isOutput);
+ break;
+ case Track::AUDIO_SOFTSYNTH:
+ case Track::AUDIO_GROUP:
+ //id = addWavePorts(parent, t, chpup, id, mm, ch, 2, isOutput);
+ //id = addInPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
+ //id = addGroupPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
+ id = addWavePorts(t, chpup, id, mm, ch, 2, isOutput);
+ id = addInPorts(t, chpup, id, mm, ch, 2, isOutput);
+ id = addGroupPorts(t, chpup, id, mm, ch, 2, isOutput);
+ //id = addSyntiPorts(parent, t, chpup, id, mm, ch, 2, isOutput);
+ //id = addSyntiPorts(strip, parent, t, chpup, id, mm, ch, 2, isOutput);
+ id = addSyntiPorts(t, chpup, id, mm, ch, 2, isOutput);
+ break;
+ default:
+ break;
+ }
+ }
+
+ // If more than two channels, add the created sub-menu.
+ if(chans > 2)
+ {
+ char buffer[128];
+ snprintf(buffer, 128, "%s %d,%d", pup->tr("Channel").latin1(), ch+1, ch+2);
+ pup->insertItem(QString(buffer), chpup);
+ }
+ }
+ }
+
+ return id;
+}
+
+//---------------------------------------------------------
+// nonSyntiTrackAddSyntis
+//---------------------------------------------------------
+
+static int nonSyntiTrackAddSyntis(AudioTrack* t, PopupMenu* lb, int id, RouteMenuMap& mm, bool isOutput)
+{
+ RouteList* rl = isOutput ? t->outRoutes() : t->inRoutes();
+
+ SynthIList* al = song->syntis();
+ for (iSynthI i = al->begin(); i != al->end(); ++i)
+ {
+ Track* track = *i;
+ if (t == track)
+ continue;
+ //id = addMenuItem(parent, track, lb, r, id, mm, channel, channels);
+
+ /*
+ QString s(track->name());
+ //int it = lb->insertItem(s);
+ lb->insertItem(s, id);
+ for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
+ //if (ir->type == 0 && ir->track == track) {
+ if (ir->type == 0 && ir->track == track && ir->channels == channels) {
+ //lb->setItemChecked(it, true);
+ lb->setItemChecked(id, true);
+ break;
+ }
+ }
+ ++id;
+ */
+
+ //SynthI* synti = (SynthI*)track;
+
+ int toch = ((AudioTrack*)track)->totalOutChannels();
+ // If track channels = 1, it must be a mono synth. And synti channels cannot be changed by user.
+ if(track->channels() == 1)
+ toch = 1;
+
+ //int chans = synti->totalOutChannels();
+ //int chans = (!isOutput || track->type() != Track::AUDIO_SOFTSYNTH) ? ((AudioTrack*)track)->totalOutChannels() : ((AudioTrack*)track)->totalInChannels();
+ // totalInChannels is only used by syntis.
+ int chans = (!isOutput || track->type() != Track::AUDIO_SOFTSYNTH) ? toch : ((AudioTrack*)track)->totalInChannels();
+
+ //int schans = synti->channels();
+ //if(schans < chans)
+ // chans = schans;
+// int tchans = (channels != -1) ? channels: t->channels();
+// if(tchans == 2)
+// {
+ // Ignore odd numbered left-over mono channel.
+ //chans = chans & ~1;
+ //if(chans != 0)
+// chans -= 1;
+// }
+ //int tchans = (channels != -1) ? channels: t->channels();
+
+ if(chans > 0)
+ {
+ //QPopupMenu* chpup = new QPopupMenu(parent);
+ //PopupMenu* chpup = new PopupMenu(parent);
+ //PopupMenu* chpup = new PopupMenu(lb->parent());
+ PopupMenu* chpup = new PopupMenu();
+ //strip->connect(chpup, SIGNAL(activated(int)), strip, SLOT(routingPopupMenuActivated(int)));
+ lb->connect(chpup, SIGNAL(activated(int)), lb, SIGNAL(activated(int)));
+ chpup->setCheckable(true);
+
+ if(chans > 1)
+ {
+ //chpup->insertItem(new MenuTitleItem("<Mono>")); ddskrjo
+ //pup->insertSeparator();
+ }
+
+ for(int ch = 0; ch < chans; ++ch)
+ {
+ char buffer[128];
+ //if(tchans == 2)
+ // snprintf(buffer, 128, "%s %d,%d", chpup->tr("Channel").latin1(), ch+1, ch+2);
+ //else
+ snprintf(buffer, 128, "%s %d", chpup->tr("Channel").latin1(), ch+1);
+ chpup->insertItem(QString(buffer), id);
+
+ //int ach = (channel == -1) ? ch : channel;
+ //int bch = (channel == -1) ? -1 : ch;
+ int ach = ch;
+ int bch = -1;
+
+ //Route rt(track, (t->type() != Track::AUDIO_SOFTSYNTH || isOutput) ? ach : bch, tchans);
+ Route rt(track, isOutput ? bch : ach, 1);
+ //Route rt(track, ch);
+
+ //rt.remoteChannel = -1;
+ //rt.remoteChannel = (t->type() != Track::AUDIO_SOFTSYNTH || isOutput) ? bch : ach;
+ rt.remoteChannel = isOutput ? ach : bch;
+
+ mm.insert( pRouteMenuMap(id, rt) );
+
+ for(iRoute ir = rl->begin(); ir != rl->end(); ++ir)
+ {
+ //if (ir->type == 0 && ir->track == track) {
+ //if(ir->type == 0 && ir->track == track && ir->channels == channels)
+ //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == channel &&
+ // ir->channels == channels && ir->remoteChannel == r.remoteChannel)
+ //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == ch &&
+ // ir->remoteChannel == rt.remoteChannel)
+ //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == rt.channel &&
+ // ir->channels == rt.channels && ir->remoteChannel == rt.remoteChannel)
+
+ if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->remoteChannel == rt.remoteChannel)
+ {
+ int tcompch = rt.channel;
+ if(tcompch == -1)
+ tcompch = 0;
+ int tcompchs = rt.channels;
+ if(tcompchs == -1)
+ tcompchs = isOutput ? t->channels() : track->channels();
+
+ int compch = ir->channel;
+ if(compch == -1)
+ compch = 0;
+ int compchs = ir->channels;
+ if(compchs == -1)
+ compchs = isOutput ? t->channels() : ir->track->channels();
+
+ if(compch == tcompch && compchs == tcompchs)
+ {
+ chpup->setItemChecked(id, true);
+ break;
+ }
+ }
+ }
+ ++id;
+ }
+
+ chans -= 1;
+ if(chans > 0)
+ {
+ // Ignore odd numbered left-over channels.
+ //int schans = (chans & ~1) - 1;
+
+ chpup->insertSeparator();
+ //chpup->insertItem(new MenuTitleItem("<Stereo>")); ddskrjo
+ //pup->insertSeparator();
+
+ for(int ch = 0; ch < chans; ++ch)
+ {
+ char buffer[128];
+ //if(tchans == 2)
+ snprintf(buffer, 128, "%s %d,%d", chpup->tr("Channel").latin1(), ch+1, ch+2);
+ //else
+ // snprintf(buffer, 128, "%s %d", chpup->tr("Channel").latin1(), ch+1);
+ chpup->insertItem(QString(buffer), id);
+
+ //int ach = (channel == -1) ? ch : channel;
+ //int bch = (channel == -1) ? -1 : ch;
+ int ach = ch;
+ int bch = -1;
+
+ //Route rt(track, (t->type() != Track::AUDIO_SOFTSYNTH || isOutput) ? ach : bch, tchans);
+ Route rt(track, isOutput ? bch : ach, 2);
+ //Route rt(track, ch);
+
+ //rt.remoteChannel = -1;
+ //rt.remoteChannel = (t->type() != Track::AUDIO_SOFTSYNTH || isOutput) ? bch : ach;
+ rt.remoteChannel = isOutput ? ach : bch;
+
+ mm.insert( pRouteMenuMap(id, rt) );
+
+ for(iRoute ir = rl->begin(); ir != rl->end(); ++ir)
+ {
+ //if (ir->type == 0 && ir->track == track) {
+ //if(ir->type == 0 && ir->track == track && ir->channels == channels)
+ //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == channel &&
+ // ir->channels == channels && ir->remoteChannel == r.remoteChannel)
+ //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == ch &&
+ // ir->remoteChannel == rt.remoteChannel)
+ //if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->channel == rt.channel &&
+ // ir->channels == rt.channels && ir->remoteChannel == rt.remoteChannel)
+
+
+ if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->remoteChannel == rt.remoteChannel)
+ {
+ int tcompch = rt.channel;
+ if(tcompch == -1)
+ tcompch = 0;
+ int tcompchs = rt.channels;
+ if(tcompchs == -1)
+ tcompchs = isOutput ? t->channels() : track->channels();
+
+ int compch = ir->channel;
+ if(compch == -1)
+ compch = 0;
+ int compchs = ir->channels;
+ if(compchs == -1)
+ compchs = isOutput ? t->channels() : ir->track->channels();
+
+ if(compch == tcompch && compchs == tcompchs)
+ {
+ chpup->setItemChecked(id, true);
+ break;
+ }
+ }
+ }
+ ++id;
+ }
+ }
+
+ lb->insertItem(track->name(), chpup);
+ }
+ }
+ return id;
+}
+
+//---------------------------------------------------------
+// iRoutePressed
+//---------------------------------------------------------
+
+void AudioStrip::iRoutePressed()
+ {
+ //if(track->isMidiTrack() || (track->type() == Track::AUDIO_AUX) || (track->type() == Track::AUDIO_SOFTSYNTH))
+ if(!track || track->isMidiTrack() || track->type() == Track::AUDIO_AUX)
+ {
+ //_isRoutingPopupMenuMaster = false;
+ gRoutingPopupMenuMaster = 0;
+ return;
+ }
+
+ QPoint ppt = QCursor::pos();
+
+ //QPopupMenu* pup = new QPopupMenu(iR);
+ //PopupMenu* pup = new PopupMenu(iR);
+ //pup->setCheckable(true);
+
+ PopupMenu* pup = muse->getRoutingPopupMenu();
+ pup->disconnect();
+
+ AudioTrack* t = (AudioTrack*)track;
+ RouteList* irl = t->inRoutes();
+
+ int gid = 0;
+ //int n;
+ ///RouteMenuMap mm;
+
+ // Routes can't be re-read until the message sent from msgAddRoute1()
+ // has had time to be sent and actually affected the routes.
+ ///_redisplay:
+
+ //QPopupMenu* pup = new QPopupMenu(iR);
+ //RouteList* irl = t->inRoutes();
+
+ pup->clear();
+ gRoutingMenuMap.clear();
+ gid = 0;
+
+ switch(track->type())
+ {
+ case Track::AUDIO_INPUT:
+ {
+ pup->setCheckable(true);
+ //int gid = 0;
+ for(int i = 0; i < channel; ++i)
+ {
+ char buffer[128];
+ snprintf(buffer, 128, "%s %d", tr("Channel").latin1(), i+1);
+ MenuTitleItem* titel = new MenuTitleItem(QString(buffer));
+ //pup->insertItem(titel); ddskrjo
+
+ if(!checkAudioDevice())
+ {
+ ///delete pup;
+ gRoutingPopupMenuMaster = 0;
+ pup->clear();
+ gRoutingMenuMap.clear();
+ iR->setDown(false);
+ return;
+ }
+ std::list<QString> ol = audioDevice->outputPorts();
+ for(std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip)
+ {
+ int id = pup->insertItem(*ip, (gid * 16) + i);
+ //Route dst(*ip, true, i);
+ Route dst(*ip, true, i, Route::JACK_ROUTE);
+ gRoutingMenuMap.insert( pRouteMenuMap(id, dst) );
+ ++gid;
+ for(iRoute ir = irl->begin(); ir != irl->end(); ++ir)
+ {
+ if(*ir == dst)
+ {
+ pup->setItemChecked(id, true);
+ break;
+ }
+ }
+ }
+ if(i+1 != channel)
+ pup->insertSeparator();
+ }
+ }
+ break;
+ //case Track::AUDIO_OUTPUT:
+ //case Track::WAVE:
+ //case Track::AUDIO_GROUP:
+
+ case Track::AUDIO_OUTPUT:
+ //gid = addWavePorts( iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ //gid = addInPorts( iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ //gid = addGroupPorts(iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ //gid = addAuxPorts( iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ gid = addWavePorts( t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ gid = addInPorts( t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ gid = addGroupPorts(t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ gid = addAuxPorts( t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ //gid = addSyntiPorts(iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ //gid = nonSyntiTrackAddSyntis(iR, t, pup, gid, gRoutingMenuMap, false);
+ //gid = nonSyntiTrackAddSyntis(this, iR, t, pup, gid, gRoutingMenuMap, false);
+ gid = nonSyntiTrackAddSyntis(t, pup, gid, gRoutingMenuMap, false);
+ break;
+ case Track::WAVE:
+ //gid = addInPorts( iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ gid = addInPorts( t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ break;
+ case Track::AUDIO_GROUP:
+ //gid = addWavePorts( iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ //gid = addInPorts( iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ //gid = addGroupPorts(iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ gid = addWavePorts( t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ gid = addInPorts( t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ gid = addGroupPorts(t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ //gid = addSyntiPorts(iR, t, pup, gid, gRoutingMenuMap, -1, -1, false);
+ //gid = nonSyntiTrackAddSyntis(iR, t, pup, gid, gRoutingMenuMap, false);
+ //gid = nonSyntiTrackAddSyntis(this, iR, t, pup, gid, gRoutingMenuMap, false);
+ gid = nonSyntiTrackAddSyntis(t, pup, gid, gRoutingMenuMap, false);
+ break;
+
+ case Track::AUDIO_SOFTSYNTH:
+ //gid = addMultiChannelPorts(iR, t, pup, gid, gRoutingMenuMap, false);
+ //gid = addMultiChannelPorts(this, iR, t, pup, gid, gRoutingMenuMap, false);
+ gid = addMultiChannelPorts(t, pup, gid, gRoutingMenuMap, false);
+ break;
+ default:
+ ///delete pup;
+ gRoutingPopupMenuMaster = 0;
+ pup->clear();
+ gRoutingMenuMap.clear();
+ iR->setDown(false);
+ return;
+ }
+
+ if(pup->count() == 0)
+ {
+ ///delete pup;
+ gRoutingPopupMenuMaster = 0;
+ gRoutingMenuMap.clear();
+ iR->setDown(false);
+ return;
+ }
+
+ gIsOutRoutingPopupMenu = false;
+ gRoutingPopupMenuMaster = this;
+ connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
+ connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
+ pup->popup(ppt, 0);
+ iR->setDown(false);
+ return;
+
+
+
+ /*
+ //int n = pup->exec(QCursor::pos());
+ // For some reason, after the first display, it won't redisplay at the same point if the menu is too high.
+ n = pup->exec(ppt, 0);
+ if(n != -1)
+ {
+ QString s(pup->text(n));
+
+ if(track->type() == Track::AUDIO_INPUT)
+ {
+ ///delete pup;
+ int chan = n & 0xf;
+
+ Route srcRoute(s, false, -1, Route::JACK_ROUTE);
+ Route dstRoute(t, chan);
+
+ srcRoute.channel = chan;
+
+ iRoute iir = irl->begin();
+ for(; iir != irl->end(); ++iir)
+ {
+ if(*iir == srcRoute)
+ break;
+ }
+ if(iir != irl->end())
+ // disconnect
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ else
+ // connect
+ audio->msgAddRoute(srcRoute, dstRoute);
+
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+ iR->setDown(false); // pup->exec() catches mouse release event
+ return;
+
+ // p3.3.46
+ ///goto _redisplay;
+ }
+
+ iRouteMenuMap imm = mm.find(n);
+ if(imm == mm.end())
+ {
+ delete pup;
+ iR->setDown(false); // pup->exec() catches mouse release event
+ return;
+ }
+
+ //int chan = n >> 16;
+ //int chans = (chan >> 15) + 1; // Bit 31 MSB: Mono or stereo.
+ //chan &= 0xffff;
+ //int chan = imm->second.channel;
+ //int chans = imm->second.channels;
+
+ //Route srcRoute(s, false, -1);
+ //Route srcRoute(s, false, -1, Route::TRACK_ROUTE);
+ Route &srcRoute = imm->second;
+
+ //Route dstRoute(t, -1);
+ //Route dstRoute(t, chan, chans);
+ Route dstRoute(t, imm->second.channel, imm->second.channels);
+ //Route dstRoute(t, imm->second.channel);
+ dstRoute.remoteChannel = imm->second.remoteChannel;
+
+ iRoute iir = irl->begin();
+ for (; iir != irl->end(); ++iir) {
+ if (*iir == srcRoute)
+ break;
+ }
+ if (iir != irl->end()) {
+ // disconnect
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+
+ // p3.3.46
+ //iR->setDown(false); // pup->exec() catches mouse release event
+ ///goto _redisplay;
+
+ }
+
+ delete pup;
+ iR->setDown(false); // pup->exec() catches mouse release event
+ */
+
+ }
+
+#if 0
+//---------------------------------------------------------
+// updateRouteMenus
+//---------------------------------------------------------
+
+void AudioStrip::updateRouteMenus()
+{
+ //if(!_isRoutingPopupMenuMaster || track->isMidiTrack() || (track->type() == Track::AUDIO_AUX))
+ if(!track || gRoutingPopupMenuMaster != this || track->isMidiTrack())
+ return;
+
+ ///QPopupMenu* pup = new QPopupMenu(oR);
+ // p3.3.47
+ //if(!orpup)
+ // return;
+
+ //QPopupMenu* pup = muse->getORoutesPopup();
+ PopupMenu* pup = muse->getRoutingPopupMenu();
+
+ if(pup->count() == 0)
+ return;
+
+ //pup->setCheckable(true);
+ AudioTrack* t = (AudioTrack*)track;
+ RouteList* rl = gIsOutRoutingPopupMenu ? t->outRoutes() : t->inRoutes();
+
+ //int gid = 0;
+ //int n;
+ ///RouteMenuMap mm;
+
+ //QPoint ppt = QCursor::pos();
+
+
+ /*
+ iRoute iorl = orl->begin();
+ for(; iorl != orl->end(); ++iorl)
+ {
+ iRouteMenuMap imm = ormm->begin();
+ for(; imm != ormm->end(); ++imm)
+ {
+ if(*iorl == imm->second)
+ {
+ orpup->setItemChecked(imm->first, true);
+ break;
+ }
+ }
+ //if(imm == ormm->end())
+ //{
+ //}
+
+ }
+ //if (iorl == orl->end())
+ //{
+ //}
+ */
+
+ iRouteMenuMap imm = gRoutingMenuMap.begin();
+ for(; imm != gRoutingMenuMap.end(); ++imm)
+ {
+ bool found = false;
+ iRoute irl = rl->begin();
+ for(; irl != rl->end(); ++irl)
+ {
+ if(*irl == imm->second)
+ {
+ found = true;
+ break;
+ }
+ }
+ pup->setItemChecked(imm->first, found);
+ }
+
+ return;
+}
+#endif
+
+//---------------------------------------------------------
+// routingPopupMenuActivated
+//---------------------------------------------------------
+
+void AudioStrip::routingPopupMenuActivated(int n)
+{
+ if(!track || gRoutingPopupMenuMaster != this || track->isMidiTrack())
+ return;
+
+ PopupMenu* pup = muse->getRoutingPopupMenu();
+
+ //printf("AudioStrip::routingPopupMenuActivated n:%d count:%d\n", n, pup->count());
+
+ if(pup->count() == 0)
+ return;
+
+ AudioTrack* t = (AudioTrack*)track;
+ RouteList* rl = gIsOutRoutingPopupMenu ? t->outRoutes() : t->inRoutes();
+
+ //QPoint ppt = QCursor::pos();
+
+ // p3.3.47
+ if (n == -1)
+ {
+ //printf("AudioStrip::routingPopupMenuActivated n = -1\n");
+ ///delete pup;
+ return;
+ }
+ else
+ //if(n == 0)
+ //{
+ //printf("AudioStrip::routingPopupMenuActivated n = 0 = tearOffHandle\n");
+ //oR->setDown(false);
+ // return;
+ //}
+ //else
+ {
+ if(gIsOutRoutingPopupMenu)
+ {
+ QString s(pup->text(n));
+
+ //printf("AudioStrip::routingPopupMenuActivated text:%s\n", s.latin1());
+
+ if(track->type() == Track::AUDIO_OUTPUT)
+ {
+ ///delete orpup;
+
+ int chan = n & 0xf;
+
+ //Route srcRoute(t, -1);
+ //Route srcRoute(t, chan, chans);
+ //Route srcRoute(t, chan, 1);
+ Route srcRoute(t, chan);
+
+ //Route dstRoute(s, true, -1);
+ Route dstRoute(s, true, -1, Route::JACK_ROUTE);
+ //Route dstRoute(s, true, 0, Route::JACK_ROUTE);
+
+ //srcRoute.channel = dstRoute.channel = chan;
+ dstRoute.channel = chan;
+ //dstRoute.channels = 1;
+
+ // check if route src->dst exists:
+ iRoute irl = rl->begin();
+ for (; irl != rl->end(); ++irl) {
+ if (*irl == dstRoute)
+ break;
+ }
+ if (irl != rl->end()) {
+ // disconnect if route exists
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect if route does not exist
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+
+ // p3.3.47
+ //pup->popup(ppt, 0);
+
+ //oR->setDown(false);
+ return;
+
+ // p3.3.46
+ ///goto _redisplay;
+ }
+
+ iRouteMenuMap imm = gRoutingMenuMap.find(n);
+ if(imm == gRoutingMenuMap.end())
+ {
+ ///delete orpup;
+ //oR->setDown(false); // orpup->exec() catches mouse release event
+ return;
+ }
+
+ //int chan = n >> 16;
+ //int chans = (chan >> 15) + 1; // Bit 31 MSB: Mono or stereo.
+ //chan &= 0xffff;
+ //int chan = imm->second.channel;
+ //int chans = imm->second.channels;
+
+ //Route srcRoute(t, -1);
+ //srcRoute.remoteChannel = chan;
+ //Route srcRoute(t, chan, chans);
+ Route srcRoute(t, imm->second.channel, imm->second.channels);
+ //Route srcRoute(t, imm->second.channel);
+ srcRoute.remoteChannel = imm->second.remoteChannel;
+
+ //Route dstRoute(s, true, -1);
+ //Route dstRoute(s, true, -1, Route::TRACK_ROUTE);
+ Route &dstRoute = imm->second;
+
+ // check if route src->dst exists:
+ iRoute irl = rl->begin();
+ for (; irl != rl->end(); ++irl) {
+ if (*irl == dstRoute)
+ break;
+ }
+ if (irl != rl->end()) {
+ // disconnect if route exists
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect if route does not exist
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+
+ // p3.3.46
+ //oR->setDown(false);
+ ///goto _redisplay;
+
+ // p3.3.47
+ //pup->popup(ppt, 0);
+ }
+ else
+ {
+ QString s(pup->text(n));
+
+ if(track->type() == Track::AUDIO_INPUT)
+ {
+ ///delete pup;
+ int chan = n & 0xf;
+
+ Route srcRoute(s, false, -1, Route::JACK_ROUTE);
+ Route dstRoute(t, chan);
+
+ srcRoute.channel = chan;
+
+ iRoute irl = rl->begin();
+ for(; irl != rl->end(); ++irl)
+ {
+ if(*irl == srcRoute)
+ break;
+ }
+ if(irl != rl->end())
+ // disconnect
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ else
+ // connect
+ audio->msgAddRoute(srcRoute, dstRoute);
+
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+ //iR->setDown(false); // pup->exec() catches mouse release event
+ return;
+
+ // p3.3.46
+ ///goto _redisplay;
+ }
+
+ iRouteMenuMap imm = gRoutingMenuMap.find(n);
+ if(imm == gRoutingMenuMap.end())
+ {
+ //delete pup;
+ //iR->setDown(false); // pup->exec() catches mouse release event
+ return;
+ }
+
+ //int chan = n >> 16;
+ //int chans = (chan >> 15) + 1; // Bit 31 MSB: Mono or stereo.
+ //chan &= 0xffff;
+ //int chan = imm->second.channel;
+ //int chans = imm->second.channels;
+
+ //Route srcRoute(s, false, -1);
+ //Route srcRoute(s, false, -1, Route::TRACK_ROUTE);
+ Route &srcRoute = imm->second;
+
+ //Route dstRoute(t, -1);
+ //Route dstRoute(t, chan, chans);
+ Route dstRoute(t, imm->second.channel, imm->second.channels);
+ //Route dstRoute(t, imm->second.channel);
+ dstRoute.remoteChannel = imm->second.remoteChannel;
+
+ iRoute irl = rl->begin();
+ for (; irl != rl->end(); ++irl) {
+ if (*irl == srcRoute)
+ break;
+ }
+ if (irl != rl->end()) {
+ // disconnect
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+
+ // p3.3.46
+ //iR->setDown(false);
+ ///goto _redisplay;
+
+ }
+
+ }
+
+ ///delete pup;
+ //oR->setDown(false);
+}
+
+//---------------------------------------------------------
+// oRoutePressed
+//---------------------------------------------------------
+
+void AudioStrip::oRoutePressed()
+{
+ if(!track || track->isMidiTrack())
+ {
+ gRoutingPopupMenuMaster = 0;
+ return;
+ }
+
+ QPoint ppt = QCursor::pos();
+
+ ///QPopupMenu* pup = new QPopupMenu(oR);
+
+ PopupMenu* pup = muse->getRoutingPopupMenu();
+ pup->disconnect();
+
+ //pup->setCheckable(true);
+ AudioTrack* t = (AudioTrack*)track;
+ RouteList* orl = t->outRoutes();
+
+ int gid = 0;
+ //int n;
+ ///RouteMenuMap mm;
+
+ // Routes can't be re-read until the message sent from msgAddRoute1()
+ // has had time to be sent and actually affected the routes.
+/// _redisplay:
+
+ //QPopupMenu* pup = new QPopupMenu(oR);
+ //RouteList* orl = t->outRoutes();
+
+ pup->clear();
+ gRoutingMenuMap.clear();
+ gid = 0;
+
+ // p3.3.47
+ //orpup->insertTearOffHandle(gid);
+ //gid++;
+
+ switch(track->type())
+ {
+ case Track::AUDIO_OUTPUT:
+ {
+ pup->setCheckable(true);
+ //int gid = 0;
+ for(int i = 0; i < channel; ++i)
+ {
+ char buffer[128];
+ snprintf(buffer, 128, "%s %d", tr("Channel").latin1(), i+1);
+ MenuTitleItem* titel = new MenuTitleItem(QString(buffer));
+ //pup->insertItem(titel); ddskrjo
+
+ if(!checkAudioDevice())
+ {
+ ///delete pup;
+ gRoutingPopupMenuMaster = 0;
+ pup->clear();
+ gRoutingMenuMap.clear();
+ oR->setDown(false);
+ return;
+ }
+ std::list<QString> ol = audioDevice->inputPorts();
+ for(std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip)
+ {
+ int id = pup->insertItem(*ip, (gid * 16) + i);
+ //Route dst(*ip, true, i);
+ Route dst(*ip, true, i, Route::JACK_ROUTE);
+ gRoutingMenuMap.insert( pRouteMenuMap(id, dst) );
+ ++gid;
+ for(iRoute ir = orl->begin(); ir != orl->end(); ++ir)
+ {
+ if(*ir == dst)
+ {
+ pup->setItemChecked(id, true);
+ break;
+ }
+ }
+ }
+ if(i+1 != channel)
+ pup->insertSeparator();
+ }
+ }
+ break;
+ //case Track::AUDIO_INPUT:
+ //case Track::WAVE:
+ //case Track::AUDIO_GROUP:
+
+ case Track::AUDIO_SOFTSYNTH:
+ //addOutPorts(t, pup, orl);
+ //addGroupPorts(t, pup, orl);
+ //gid = addMultiChannelPorts(oR, t, pup, gid, gRoutingMenuMap, true);
+ //gid = addMultiChannelPorts(this, oR, t, pup, gid, gRoutingMenuMap, true);
+ gid = addMultiChannelPorts(t, pup, gid, gRoutingMenuMap, true);
+ break;
+
+ case Track::AUDIO_INPUT:
+ //gid = addWavePorts( oR, t, pup, gid, gRoutingMenuMap, -1, -1, true);
+ gid = addWavePorts( t, pup, gid, gRoutingMenuMap, -1, -1, true);
+ case Track::WAVE:
+ case Track::AUDIO_GROUP:
+ case Track::AUDIO_AUX:
+ //case Track::AUDIO_SOFTSYNTH:
+ //gid = addOutPorts( oR, t, pup, gid, gRoutingMenuMap, -1, -1, true);
+ //gid = addGroupPorts( oR, t, pup, gid, gRoutingMenuMap, -1, -1, true);
+ gid = addOutPorts( t, pup, gid, gRoutingMenuMap, -1, -1, true);
+ gid = addGroupPorts( t, pup, gid, gRoutingMenuMap, -1, -1, true);
+ //gid = addSyntiPorts( oR, t, pup, gid, gRoutingMenuMap, -1, -1, true);
+ //gid = nonSyntiTrackAddSyntis(oR, t, pup, gid, gRoutingMenuMap, true);
+ //gid = nonSyntiTrackAddSyntis(this, oR, t, pup, gid, gRoutingMenuMap, true);
+ gid = nonSyntiTrackAddSyntis(t, pup, gid, gRoutingMenuMap, true);
+ break;
+ //case Track::AUDIO_AUX:
+ //gid = addOutPorts( oR, t, pup, gid, gRoutingMenuMap, -1, -1, true);
+ // gid = addOutPorts( t, pup, gid, gRoutingMenuMap, -1, -1, true);
+ //break;
+
+ default:
+ ///delete pup;
+ gRoutingPopupMenuMaster = 0;
+ pup->clear();
+ gRoutingMenuMap.clear();
+ oR->setDown(false);
+ return;
+ }
+
+ if(pup->count() == 0)
+ {
+ ///delete pup;
+ gRoutingPopupMenuMaster = 0;
+ gRoutingMenuMap.clear();
+ oR->setDown(false);
+ return;
+ }
+
+ //int n = pup->exec(QCursor::pos());
+ ///n = pup->exec(ppt);
+ gIsOutRoutingPopupMenu = true;
+ gRoutingPopupMenuMaster = this;
+ connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
+ connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
+ pup->popup(ppt, 0);
+ oR->setDown(false);
+ return;
+
+
+ /*
+ // p3.3.47
+ if(n == 0)
+ {
+ printf("AudioStrip::oRoutePressed n = 0 = tearOffHandle\n");
+ oR->setDown(false); // orpup->exec() catches mouse release event
+ return;
+ }
+ else
+
+ if (n != -1) {
+ QString s(orpup->text(n));
+
+ if(track->type() == Track::AUDIO_OUTPUT)
+ {
+ delete orpup;
+
+ int chan = n & 0xf;
+
+ //Route srcRoute(t, -1);
+ //Route srcRoute(t, chan, chans);
+ //Route srcRoute(t, chan, 1);
+ Route srcRoute(t, chan);
+
+ //Route dstRoute(s, true, -1);
+ Route dstRoute(s, true, -1, Route::JACK_ROUTE);
+ //Route dstRoute(s, true, 0, Route::JACK_ROUTE);
+
+ //srcRoute.channel = dstRoute.channel = chan;
+ dstRoute.channel = chan;
+ //dstRoute.channels = 1;
+
+ // check if route src->dst exists:
+ iRoute iorl = orl->begin();
+ for (; iorl != orl->end(); ++iorl) {
+ if (*iorl == dstRoute)
+ break;
+ }
+ if (iorl != orl->end()) {
+ // disconnect if route exists
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect if route does not exist
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+
+ oR->setDown(false); // orpup->exec() catches mouse release event
+ return;
+
+ // p3.3.46
+ ///goto _redisplay;
+ }
+
+ iRouteMenuMap imm = ormm.find(n);
+ if(imm == ormm.end())
+ {
+ delete orpup;
+ oR->setDown(false); // orpup->exec() catches mouse release event
+ return;
+ }
+
+ //int chan = n >> 16;
+ //int chans = (chan >> 15) + 1; // Bit 31 MSB: Mono or stereo.
+ //chan &= 0xffff;
+ //int chan = imm->second.channel;
+ //int chans = imm->second.channels;
+
+ //Route srcRoute(t, -1);
+ //srcRoute.remoteChannel = chan;
+ //Route srcRoute(t, chan, chans);
+ Route srcRoute(t, imm->second.channel, imm->second.channels);
+ //Route srcRoute(t, imm->second.channel);
+ srcRoute.remoteChannel = imm->second.remoteChannel;
+
+ //Route dstRoute(s, true, -1);
+ //Route dstRoute(s, true, -1, Route::TRACK_ROUTE);
+ Route &dstRoute = imm->second;
+
+ // check if route src->dst exists:
+ iRoute iorl = orl->begin();
+ for (; iorl != orl->end(); ++iorl) {
+ if (*iorl == dstRoute)
+ break;
+ }
+ if (iorl != orl->end()) {
+ // disconnect if route exists
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect if route does not exist
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+
+ // p3.3.46
+ //oR->setDown(false); // orpup->exec() catches mouse release event
+ ///goto _redisplay;
+
+ }
+
+ delete orpup;
+ oR->setDown(false); // pup->exec() catches mouse release event
+ */
+}
+
+/*
+//---------------------------------------------------------
+// iRoutePressed
+//---------------------------------------------------------
+
+void AudioStrip::iRoutePressed()
+ {
+ QPopupMenu* pup = new QPopupMenu(iR);
+ pup->setCheckable(true);
+ AudioTrack* t = (AudioTrack*)track;
+ RouteList* irl = t->inRoutes();
+
+ switch(track->type()) {
+ case Track::MIDI:
+ case Track::DRUM:
+ case Track::AUDIO_AUX:
+ case Track::AUDIO_SOFTSYNTH:
+ delete pup;
+ return;
+ case Track::AUDIO_INPUT:
+ {
+ int gid = 0;
+ for (int i = 0; i < channel; ++i) {
+ char buffer[128];
+ snprintf(buffer, 128, "%s %d", tr("Channel").latin1(), i+1);
+ MenuTitleItem* titel = new MenuTitleItem(QString(buffer));
+ pup->insertItem(titel);
+
+ if (!checkAudioDevice()) return;
+ std::list<QString> ol = audioDevice->outputPorts();
+ for (std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip) {
+ int id = pup->insertItem(*ip, (gid * 16) + i);
+ //Route dst(*ip, true, i);
+ Route dst(*ip, true, i, Route::JACK_ROUTE);
+ ++gid;
+ for (iRoute ir = irl->begin(); ir != irl->end(); ++ir) {
+ if (*ir == dst) {
+ pup->setItemChecked(id, true);
+ break;
+ }
+ }
+ }
+ if (i+1 != channel)
+ pup->insertSeparator();
+ }
+ }
+ break;
+ case Track::AUDIO_OUTPUT:
+ addWavePorts(t, pup, irl);
+ addInPorts(t, pup, irl);
+ addGroupPorts(t, pup, irl);
+ addAuxPorts(t, pup, irl);
+ addSyntiPorts(t, pup, irl);
+ break;
+ case Track::WAVE:
+ addInPorts(t, pup, irl);
+ break;
+ case Track::AUDIO_GROUP:
+ addWavePorts(t, pup, irl);
+ addInPorts(t, pup, irl);
+ addGroupPorts(t, pup, irl);
+ addSyntiPorts(t, pup, irl);
+ break;
+ }
+ int n = pup->exec(QCursor::pos());
+ if (n != -1) {
+ QString s(pup->text(n));
+
+ //Route srcRoute(s, false, -1);
+ Route srcRoute(s, false, -1, (track->type() == Track::AUDIO_INPUT) ? Route::JACK_ROUTE : Route::TRACK_ROUTE);
+ Route dstRoute(t, -1);
+
+ if (track->type() == Track::AUDIO_INPUT)
+ srcRoute.channel = dstRoute.channel = n & 0xf;
+ iRoute iir = irl->begin();
+ for (; iir != irl->end(); ++iir) {
+ if (*iir == srcRoute)
+ break;
+ }
+ if (iir != irl->end()) {
+ // disconnect
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+ }
+ delete pup;
+ iR->setDown(false); // pup->exec() catches mouse release event
+ }
+*/
+
+/*
+//---------------------------------------------------------
+// oRoutePressed
+//---------------------------------------------------------
+
+void AudioStrip::oRoutePressed()
+ {
+ QPopupMenu* pup = new QPopupMenu(oR);
+ pup->setCheckable(true);
+ AudioTrack* t = (AudioTrack*)track;
+ RouteList* orl = t->outRoutes();
+
+ switch(track->type()) {
+ case Track::MIDI:
+ case Track::DRUM:
+ delete pup;
+ return;
+ case Track::AUDIO_OUTPUT:
+ {
+ int gid = 0;
+ for (int i = 0; i < channel; ++i) {
+ char buffer[128];
+ snprintf(buffer, 128, "%s %d", tr("Channel").latin1(), i+1);
+ MenuTitleItem* titel = new MenuTitleItem(QString(buffer));
+ pup->insertItem(titel);
+
+ if (!checkAudioDevice()) return;
+ std::list<QString> ol = audioDevice->inputPorts();
+ for (std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip) {
+ int id = pup->insertItem(*ip, (gid * 16) + i);
+ //Route dst(*ip, true, i);
+ Route dst(*ip, true, i, Route::JACK_ROUTE);
+ ++gid;
+ for (iRoute ir = orl->begin(); ir != orl->end(); ++ir) {
+ if (*ir == dst) {
+ pup->setItemChecked(id, true);
+ break;
+ }
+ }
+ }
+ if (i+1 != channel)
+ pup->insertSeparator();
+ }
+ }
+ break;
+ case Track::AUDIO_INPUT:
+ addWavePorts(t, pup, orl);
+ case Track::WAVE:
+ case Track::AUDIO_GROUP:
+ case Track::AUDIO_SOFTSYNTH:
+ addOutPorts(t, pup, orl);
+ addGroupPorts(t, pup, orl);
+ break;
+ case Track::AUDIO_AUX:
+ addOutPorts(t, pup, orl);
+ break;
+ }
+ int n = pup->exec(QCursor::pos());
+ if (n != -1) {
+ QString s(pup->text(n));
+ Route srcRoute(t, -1);
+ //Route dstRoute(s, true, -1);
+ Route dstRoute(s, true, -1, (track->type() == Track::AUDIO_OUTPUT) ? Route::JACK_ROUTE : Route::TRACK_ROUTE);
+
+ if (track->type() == Track::AUDIO_OUTPUT)
+ srcRoute.channel = dstRoute.channel = n & 0xf;
+
+ // check if route src->dst exists:
+ iRoute iorl = orl->begin();
+ for (; iorl != orl->end(); ++iorl) {
+ if (*iorl == dstRoute)
+ break;
+ }
+ if (iorl != orl->end()) {
+ // disconnect if route exists
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect if route does not exist
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+ }
+ delete pup;
+ oR->setDown(false); // pup->exec() catches mouse release event
+ }
+*/
diff --git a/muse2/muse/mixer/astrip.h b/muse2/muse/mixer/astrip.h
new file mode 100644
index 00000000..82662b2b
--- /dev/null
+++ b/muse2/muse/mixer/astrip.h
@@ -0,0 +1,97 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: astrip.h,v 1.8.2.6 2009/11/14 03:37:48 terminator356 Exp $
+//
+// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __ASTRIP_H__
+#define __ASTRIP_H__
+
+#include <vector>
+
+#include "strip.h"
+#include "route.h"
+
+class Slider;
+class Knob;
+class QDialog;
+class QToolButton;
+//class QPopupMenu;
+class PopupMenu;
+class QButton;
+class TransparentToolButton;
+class AudioTrack;
+class DoubleLabel;
+
+//---------------------------------------------------------
+// AudioStrip
+//---------------------------------------------------------
+
+class AudioStrip : public Strip {
+ Q_OBJECT
+
+ int channel;
+ Slider* slider;
+ DoubleLabel* sl;
+
+ Knob* pan;
+ DoubleLabel* panl;
+
+ std::vector<Knob*> auxKnob;
+ std::vector<DoubleLabel*> auxLabel;
+
+ QToolButton* stereo;
+ QToolButton* pre;
+ TransparentToolButton* off;
+
+ double volume;
+ double panVal;
+
+ //QToolButton* iR;
+ //QToolButton* oR;
+
+ Knob* addKnob(int, int, DoubleLabel**);
+
+ void updateOffState();
+ void updateVolume();
+ void updatePan();
+ void updateChannels();
+ //void updateRouteMenus();
+
+ private slots:
+ void stereoToggled(bool);
+ void preToggled(bool);
+ void offToggled(bool);
+ void iRoutePressed();
+ void oRoutePressed();
+ void routingPopupMenuActivated(int /*id*/);
+ void auxChanged(double, int);
+ void volumeChanged(double);
+ void volumePressed();
+ void volumeReleased();
+ void panChanged(double);
+ void panPressed();
+ void panReleased();
+ void volLabelChanged(double);
+ void panLabelChanged(double);
+ void auxLabelChanged(double, unsigned int);
+ void volumeRightClicked(const QPoint &);
+ void panRightClicked(const QPoint &);
+
+ protected slots:
+ virtual void heartBeat();
+
+ public slots:
+ virtual void configChanged();
+ virtual void songChanged(int);
+
+ public:
+ AudioStrip(QWidget* parent, AudioTrack*);
+ ~AudioStrip();
+ virtual QSize minimumSizeHint () const;
+ };
+
+#endif
+
diff --git a/muse2/muse/mixer/auxknob.cpp b/muse2/muse/mixer/auxknob.cpp
new file mode 100644
index 00000000..a64f3929
--- /dev/null
+++ b/muse2/muse/mixer/auxknob.cpp
@@ -0,0 +1,40 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: auxknob.cpp,v 1.7 2004/07/11 16:26:46 wschweer Exp $
+//
+// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <cmath>
+#include "auxknob.h"
+#include "gconfig.h"
+
+//---------------------------------------------------------
+// Aux
+//---------------------------------------------------------
+
+AuxKnob::AuxKnob(QWidget* parent, int i)
+ : Knob(parent, "aux")
+ {
+ idx = i;
+ setRange(config.minSlider-0.1, 10.0);
+ connect(this, SIGNAL(valueChanged(double,int)), SLOT(valueChanged(double)));
+ }
+
+//---------------------------------------------------------
+// panChanged
+//---------------------------------------------------------
+
+void AuxKnob::valueChanged(double val)
+ {
+ double vol;
+ if (val <= config.minSlider) {
+ vol = 0.0;
+ val -= 1.0; // display special value "off"
+ }
+ else
+ vol = pow(10.0, val/20.0);
+ emit auxChanged(idx, vol);
+ }
+
diff --git a/muse2/muse/mixer/auxknob.h b/muse2/muse/mixer/auxknob.h
new file mode 100644
index 00000000..c2b8ec7a
--- /dev/null
+++ b/muse2/muse/mixer/auxknob.h
@@ -0,0 +1,33 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: auxknob.h,v 1.3 2003/11/08 15:10:18 wschweer Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __AUXKNOB_H__
+#define __AUXKNOB_H__
+
+#include "knob.h"
+
+//---------------------------------------------------------
+// AuxKnob
+//---------------------------------------------------------
+
+class AuxKnob : public Knob {
+ Q_OBJECT
+ int idx;
+
+ private slots:
+ void valueChanged(double v);
+
+ signals:
+ void auxChanged(int, double);
+
+ public:
+ AuxKnob(QWidget* parent, int idx);
+ };
+
+#endif
+
diff --git a/muse2/muse/mixer/meter.cpp b/muse2/muse/mixer/meter.cpp
new file mode 100644
index 00000000..14b20a18
--- /dev/null
+++ b/muse2/muse/mixer/meter.cpp
@@ -0,0 +1,184 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: meter.cpp,v 1.4.2.2 2009/05/03 04:14:00 terminator356 Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <cmath>
+#include <qpainter.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <Q3Frame>
+
+#include "meter.h"
+#include "gconfig.h"
+#include "fastlog.h"
+
+//---------------------------------------------------------
+// Meter
+//---------------------------------------------------------
+
+Meter::Meter(QWidget* parent, MeterType type)
+ : Q3Frame(parent, "", Qt::WNoAutoErase)
+ {
+ mtype = type;
+ overflow = false;
+ val = 0.0;
+ maxVal = 0.0;
+ minScale = mtype == DBMeter ? config.minMeter : 0.0; // min value in dB or int
+ maxScale = mtype == DBMeter ? 10.0 : 127.0;
+ yellowScale = -10;
+ redScale = 0;
+ setLineWidth(0);
+ setMidLineWidth(0);
+ }
+
+//---------------------------------------------------------
+// setVal
+//---------------------------------------------------------
+
+//void Meter::setVal(int v, int max, bool ovl)
+void Meter::setVal(double v, double max, bool ovl)
+ {
+ overflow = ovl;
+ bool ud = false;
+
+ if(mtype == DBMeter)
+ {
+ double minScaleLin = pow(10.0, minScale/20.0);
+ if((v >= minScaleLin && val != v) || val >= minScaleLin)
+ {
+ val = v;
+ ud = true;
+ }
+ }
+ else
+ {
+ if(val != v)
+ {
+ val = v;
+ ud = true;
+ }
+ }
+
+ if(maxVal != max)
+ {
+ maxVal = max;
+ ud = true;
+ }
+
+ if(ud)
+ update();
+ }
+//---------------------------------------------------------
+// resetPeaks
+// reset peak and overflow indicator
+//---------------------------------------------------------
+
+void Meter::resetPeaks()
+ {
+ maxVal = val;
+ overflow = val > 0.0;
+ update();
+ }
+
+//---------------------------------------------------------
+// setRange
+//---------------------------------------------------------
+
+void Meter::setRange(double min, double max)
+ {
+ minScale = min;
+ maxScale = max;
+ drawVU(width(), height());
+ update();
+ }
+
+//---------------------------------------------------------
+// paintEvent
+//---------------------------------------------------------
+
+void Meter::drawContents(QPainter* p)
+ {
+ double range = maxScale - minScale;
+
+ int fw = frameWidth();
+ int h = height() - 2* fw;
+ int yv;
+ if(mtype == DBMeter)
+ yv = val == 0 ? h : int(((maxScale - (fast_log10(val) * 20.0)) * h)/range);
+ else
+ yv = val == 0 ? h : int(((maxScale - val) * h)/range);
+
+ bitBlt(this, fw, fw, &bgPm, 0, 0, -1, yv, true); // CopyROP, true); ddskrjo
+ bitBlt(this, fw, fw+yv, &fgPm, 0, yv, -1, h-yv, true); //CopyROP, true); ddskrjo
+
+ int ymax;
+ if(mtype == DBMeter)
+ ymax = maxVal == 0 ? 0 : int(((maxScale - (fast_log10(maxVal) * 20.0)) * h)/range);
+ else
+ ymax = maxVal == 0 ? 0 : int(((maxScale - maxVal) * h)/range);
+ p->setPen(Qt::white);
+ p->drawLine(0, ymax, width()-2*fw, ymax);
+ }
+
+//---------------------------------------------------------
+// drawVU
+//---------------------------------------------------------
+
+void Meter::drawVU(int w, int h)
+ {
+ double range = maxScale - minScale;
+ int fw = frameWidth();
+ w -= 2*fw;
+ h -= 2*fw;
+ bgPm.resize(w, h);
+ fgPm.resize(w, h);
+
+ QPainter p1(&fgPm);
+ QPainter p2(&bgPm);
+
+ if(mtype == LinMeter)
+ {
+ p1.fillRect(0, 0, w, h, QBrush(0x00ff00)); // green
+ p2.fillRect(0, 0, w, h, QBrush(0x007000)); // green
+ }
+ else
+ {
+ int y1 = int((maxScale - redScale) * h / range);
+ int y2 = int((maxScale - yellowScale) * h / range);
+ int y3 = h;
+ p1.fillRect(0, 0, w, y1, QBrush(0xff0000)); // red
+ p1.fillRect(0, y1, w, y2-y1, QBrush(0xffff00)); // yellow
+ p1.fillRect(0, y2, w, y3-y2, QBrush(0x00ff00)); // green
+
+ p2.fillRect(0, 0, w, y1, QBrush(0x8e0000)); // red
+ p2.fillRect(0, y1, w, y2-y1, QBrush(0x8e8e00)); // yellow
+ p2.fillRect(0, y2, w, y3-y2, QBrush(0x007000)); // green
+ }
+ }
+
+//---------------------------------------------------------
+// resizeEvent
+//---------------------------------------------------------
+
+void Meter::resizeEvent(QResizeEvent* ev)
+ {
+ int h = ev->size().height();
+ int w = ev->size().width();
+ drawVU(w, h);
+ }
+
+//---------------------------------------------------------
+// mousePressEvent
+//---------------------------------------------------------
+
+void Meter::mousePressEvent(QMouseEvent*)
+ {
+ emit mousePress();
+ }
+
diff --git a/muse2/muse/mixer/meter.h b/muse2/muse/mixer/meter.h
new file mode 100644
index 00000000..fc447147
--- /dev/null
+++ b/muse2/muse/mixer/meter.h
@@ -0,0 +1,52 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: meter.h,v 1.1.1.1.2.2 2009/05/03 04:14:00 terminator356 Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __METER_H__
+#define __METER_H__
+
+#include <q3frame.h>
+#include <qpixmap.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QMouseEvent>
+
+class Meter : public Q3Frame {
+ public:
+ enum MeterType {DBMeter, LinMeter};
+ private:
+ MeterType mtype;
+ bool overflow;
+ double val;
+ double maxVal;
+ double minScale, maxScale;
+ int yellowScale, redScale;
+
+ QPixmap bgPm;
+ QPixmap fgPm; // for double buffering
+
+ void drawVU(int w, int h);
+
+ Q_OBJECT
+ virtual void drawContents(QPainter* p);
+ virtual void resizeEvent(QResizeEvent*);
+ virtual void mousePressEvent(QMouseEvent*);
+
+ public slots:
+ void resetPeaks();
+ //void setVal(int, int, bool);
+ void setVal(double, double, bool);
+
+ signals:
+ void mousePress();
+
+ public:
+ Meter(QWidget* parent, MeterType type = DBMeter);
+ void setRange(double min, double max);
+ };
+#endif
+
diff --git a/muse2/muse/mixer/midiportroutebase.ui b/muse2/muse/mixer/midiportroutebase.ui
new file mode 100644
index 00000000..d3b411e3
--- /dev/null
+++ b/muse2/muse/mixer/midiportroutebase.ui
@@ -0,0 +1,85 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>MidiPortRouteBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MidiPortRouteBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>461</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Midi Port Routing</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>label</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>179</red>
+ <green>190</green>
+ <blue>182</blue>
+ </color>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>11</pointsize>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="frameShape">
+ <enum>Box</enum>
+ </property>
+ <property name="lineWidth">
+ <number>1</number>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
+ <property name="midLineWidth">
+ <number>1</number>
+ </property>
+ <property name="text">
+ <string>Port 2</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Output</string>
+ </property>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox4</cstring>
+ </property>
+ <property name="title">
+ <string>Input</string>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/mixer/mstrip.cpp b/muse2/muse/mixer/mstrip.cpp
new file mode 100644
index 00000000..10d9ddf4
--- /dev/null
+++ b/muse2/muse/mixer/mstrip.cpp
@@ -0,0 +1,1216 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mstrip.cpp,v 1.9.2.13 2009/11/14 03:37:48 terminator356 Exp $
+//
+// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <fastlog.h>
+
+#include <qlayout.h>
+#include <qapplication.h>
+#include <qdialog.h>
+#include <qtoolbutton.h>
+#include <qlabel.h>
+#include <qdialog.h>
+#include <qcombobox.h>
+#include <qtooltip.h>
+#include <qtimer.h>
+//#include <qpopupmenu.h>
+#include <qcursor.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+
+#include <math.h>
+#include "app.h"
+#include "midi.h"
+#include "midictrl.h"
+#include "mstrip.h"
+#include "midiport.h"
+#include "globals.h"
+#include "audio.h"
+#include "song.h"
+#include "slider.h"
+#include "knob.h"
+#include "combobox.h"
+#include "meter.h"
+#include "track.h"
+#include "doublelabel.h"
+#include "rack.h"
+#include "node.h"
+#include "amixer.h"
+#include "icons.h"
+#include "gconfig.h"
+#include "ttoolbutton.h"
+//#include "utils.h"
+#include "popupmenu.h"
+
+enum { KNOB_PAN, KNOB_VAR_SEND, KNOB_REV_SEND, KNOB_CHO_SEND };
+
+//---------------------------------------------------------
+// addKnob
+//---------------------------------------------------------
+
+void MidiStrip::addKnob(int idx, const QString& tt, const QString& label,
+ const char* slot, bool enabled)
+ {
+ int ctl = CTRL_PANPOT, mn, mx, v;
+ int chan = ((MidiTrack*)track)->outChannel();
+ switch(idx)
+ {
+ //case KNOB_PAN:
+ // ctl = CTRL_PANPOT;
+ //break;
+ case KNOB_VAR_SEND:
+ ctl = CTRL_VARIATION_SEND;
+ break;
+ case KNOB_REV_SEND:
+ ctl = CTRL_REVERB_SEND;
+ break;
+ case KNOB_CHO_SEND:
+ ctl = CTRL_CHORUS_SEND;
+ break;
+ }
+ MidiPort* mp = &midiPorts[((MidiTrack*)track)->outPort()];
+ MidiController* mc = mp->midiController(ctl);
+ mn = mc->minVal();
+ mx = mc->maxVal();
+
+ Knob* knob = new Knob(this);
+ knob->setRange(double(mn), double(mx), 1.0);
+ knob->setId(ctl);
+
+ controller[idx].knob = knob;
+ knob->setFixedWidth(STRIP_WIDTH/2-3);
+ knob->setFixedHeight(30);
+ knob->setBackgroundMode(Qt::PaletteMid);
+ QToolTip::add(knob, tt);
+ knob->setEnabled(enabled);
+
+ DoubleLabel* dl = new DoubleLabel(0.0, double(mn), double(mx), this);
+ dl->setId(idx);
+ dl->setSpecialText(tr("off"));
+ QToolTip::add(dl, tr("double click on/off"));
+ controller[idx].dl = dl;
+ dl->setFont(config.fonts[1]);
+ dl->setBackgroundMode(Qt::PaletteMid);
+ dl->setFrame(true);
+ dl->setPrecision(0);
+ dl->setFixedWidth(STRIP_WIDTH/2);
+ dl->setFixedHeight(15);
+ dl->setEnabled(enabled);
+
+ double dlv;
+ v = mp->hwCtrlState(chan, ctl);
+ if(v == CTRL_VAL_UNKNOWN)
+ {
+ //v = mc->initVal();
+ //if(v == CTRL_VAL_UNKNOWN)
+ // v = 0;
+// v = mn - 1;
+ int lastv = mp->lastValidHWCtrlState(chan, ctl);
+ if(lastv == CTRL_VAL_UNKNOWN)
+ {
+ if(mc->initVal() == CTRL_VAL_UNKNOWN)
+ v = 0;
+ else
+ v = mc->initVal();
+ }
+ else
+ v = lastv - mc->bias();
+ //dlv = mn - 1;
+ dlv = dl->off() - 1.0;
+ }
+ else
+ {
+ // Auto bias...
+ v -= mc->bias();
+ dlv = double(v);
+ }
+
+ knob->setValue(double(v));
+ dl->setValue(dlv);
+ //}
+ //else
+ // knob->setRange(0.0, 127.0);
+
+ QLabel* lb = new QLabel(label, this);
+ controller[idx].lb = lb;
+ lb->setFont(config.fonts[1]);
+ lb->setFixedWidth(STRIP_WIDTH/2-3);
+ lb->setAlignment(Qt::AlignCenter);
+ lb->setFixedHeight(15);
+ lb->setEnabled(enabled);
+
+ Q3GridLayout* grid = new Q3GridLayout(0, 2, 2, 0, 0, "grid");
+ grid->setMargin(2);
+ grid->addWidget(lb, 0, 0);
+ grid->addWidget(dl, 1, 0);
+ grid->addMultiCellWidget(knob, 0, 1, 1, 1);
+ layout->addLayout(grid);
+
+ connect(knob, SIGNAL(sliderMoved(double,int)), slot);
+ connect(knob, SIGNAL(sliderRightClicked(const QPoint &, int)), SLOT(controlRightClicked(const QPoint &, int)));
+ connect(dl, SIGNAL(valueChanged(double, int)), slot);
+ connect(dl, SIGNAL(doubleClicked(int)), SLOT(labelDoubleClicked(int)));
+ }
+
+//---------------------------------------------------------
+// MidiStrip
+//---------------------------------------------------------
+
+MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t)
+ : Strip(parent, t)
+ {
+ inHeartBeat = true;
+
+ // Clear so the meters don't start off by showing stale values.
+ t->setActivity(0);
+ t->setLastActivity(0);
+
+ volume = CTRL_VAL_UNKNOWN;
+ pan = CTRL_VAL_UNKNOWN;
+ variSend = CTRL_VAL_UNKNOWN;
+ chorusSend = CTRL_VAL_UNKNOWN;
+ reverbSend = CTRL_VAL_UNKNOWN;
+
+ addKnob(KNOB_VAR_SEND, tr("VariationSend"), tr("Var"), SLOT(setVariSend(double)), false);
+ addKnob(KNOB_REV_SEND, tr("ReverbSend"), tr("Rev"), SLOT(setReverbSend(double)), false);
+ addKnob(KNOB_CHO_SEND, tr("ChorusSend"), tr("Cho"), SLOT(setChorusSend(double)), false);
+ int auxsSize = song->auxs()->size();
+ if (auxsSize)
+ layout->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize);
+
+ //---------------------------------------------------
+ // slider, label, meter
+ //---------------------------------------------------
+
+ MidiPort* mp = &midiPorts[t->outPort()];
+ MidiController* mc = mp->midiController(CTRL_VOLUME);
+ int chan = t->outChannel();
+ int mn = mc->minVal();
+ int mx = mc->maxVal();
+
+ slider = new Slider(this, "vol", Qt::Vertical, Slider::None,
+ Slider::BgTrough | Slider::BgSlot);
+ slider->setCursorHoming(true);
+ slider->setRange(double(mn), double(mx), 1.0);
+ slider->setFixedWidth(20);
+ slider->setFont(config.fonts[1]);
+ slider->setId(CTRL_VOLUME);
+
+ meter[0] = new Meter(this, Meter::LinMeter);
+ meter[0]->setRange(0, 127.0);
+ meter[0]->setFixedWidth(15);
+ connect(meter[0], SIGNAL(mousePress()), this, SLOT(resetPeaks()));
+ sliderGrid = new Q3GridLayout(this); // ddskrjo this
+ sliderGrid->setRowStretch(0, 100);
+ sliderGrid->addWidget(slider, 0, 0, Qt::AlignRight);
+ sliderGrid->addWidget(meter[0], 0, 1, Qt::AlignLeft);
+ layout->addLayout(sliderGrid);
+
+ sl = new DoubleLabel(0.0, -98.0, 0.0, this);
+ sl->setFont(config.fonts[1]);
+ sl->setBackgroundMode(Qt::PaletteMid);
+ sl->setSpecialText(tr("off"));
+ sl->setSuffix(tr("dB"));
+ QToolTip::add(sl, tr("double click on/off"));
+ sl->setFrame(true);
+ sl->setPrecision(0);
+ sl->setFixedWidth(STRIP_WIDTH);
+ // Set the label's slider 'buddy'.
+ sl->setSlider(slider);
+
+ double dlv;
+ int v = mp->hwCtrlState(chan, CTRL_VOLUME);
+ if(v == CTRL_VAL_UNKNOWN)
+ {
+ int lastv = mp->lastValidHWCtrlState(chan, CTRL_VOLUME);
+ if(lastv == CTRL_VAL_UNKNOWN)
+ {
+ if(mc->initVal() == CTRL_VAL_UNKNOWN)
+ v = 0;
+ else
+ v = mc->initVal();
+ }
+ else
+ v = lastv - mc->bias();
+ dlv = sl->off() - 1.0;
+ }
+ else
+ {
+ if(v == 0)
+ dlv = sl->minValue() - 0.5 * (sl->minValue() - sl->off());
+ else
+ {
+ dlv = -fast_log10(float(127*127)/float(v*v))*20.0;
+ if(dlv > sl->maxValue())
+ dlv = sl->maxValue();
+ }
+ // Auto bias...
+ v -= mc->bias();
+ }
+ slider->setValue(double(v));
+ sl->setValue(dlv);
+
+
+// connect(sl, SIGNAL(valueChanged(double,int)), slider, SLOT(setValue(double)));
+// connect(slider, SIGNAL(valueChanged(double,int)), sl, SLOT(setValue(double)));
+ connect(slider, SIGNAL(sliderMoved(double,int)), SLOT(setVolume(double)));
+ connect(slider, SIGNAL(sliderRightClicked(const QPoint &, int)), SLOT(controlRightClicked(const QPoint &, int)));
+ connect(sl, SIGNAL(valueChanged(double, int)), SLOT(volLabelChanged(double)));
+ connect(sl, SIGNAL(doubleClicked(int)), SLOT(labelDoubleClicked(int)));
+
+ layout->addWidget(sl);
+
+ //---------------------------------------------------
+ // pan, balance
+ //---------------------------------------------------
+
+ addKnob(KNOB_PAN, tr("Pan/Balance"), tr("Pan"), SLOT(setPan(double)), true);
+
+ updateControls();
+
+ //---------------------------------------------------
+ // mute, solo
+ // or
+ // record, mixdownfile
+ //---------------------------------------------------
+
+ record = new TransparentToolButton(this);
+ record->setBackgroundMode(Qt::PaletteMid);
+ record->setToggleButton(true);
+
+ //record->setFixedWidth(STRIP_WIDTH/2);
+ //record->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
+ record->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
+
+ QIcon iconSet;
+ iconSet.setPixmap(*record_on_Icon, QIcon::Automatic, QIcon::Normal, QIcon::On);
+ iconSet.setPixmap(*record_off_Icon, QIcon::Automatic, QIcon::Normal, QIcon::Off);
+ record->setIconSet(iconSet);
+ QToolTip::add(record, tr("record"));
+ record->setOn(track->recordFlag());
+ connect(record, SIGNAL(toggled(bool)), SLOT(recordToggled(bool)));
+
+ mute = new QToolButton(this);
+ QIcon muteSet;
+ muteSet.setPixmap(*muteIconOn, QIcon::Automatic, QIcon::Normal, QIcon::Off);
+ muteSet.setPixmap(*muteIconOff, QIcon::Automatic, QIcon::Normal, QIcon::On);
+ mute->setIconSet(muteSet);
+ mute->setToggleButton(true);
+ QToolTip::add(mute, tr("mute"));
+ mute->setOn(track->mute());
+ mute->setFixedWidth(STRIP_WIDTH/2);
+ connect(mute, SIGNAL(toggled(bool)), SLOT(muteToggled(bool)));
+
+ solo = new QToolButton(this);
+
+ if((bool)t->internalSolo())
+ {
+ solo->setIconSet(*soloIconSet2);
+ useSoloIconSet2 = true;
+ }
+ else
+ {
+ solo->setIconSet(*soloIconSet1);
+ useSoloIconSet2 = false;
+ }
+
+ //QToolTip::add(solo, tr("pre fader listening"));
+ QToolTip::add(solo, tr("solo mode"));
+ solo->setToggleButton(true);
+ solo->setOn(t->solo());
+ solo->setFixedWidth(STRIP_WIDTH/2);
+ connect(solo, SIGNAL(toggled(bool)), SLOT(soloToggled(bool)));
+
+ Q3HBoxLayout* smBox1 = new Q3HBoxLayout(0);
+ Q3HBoxLayout* smBox2 = new Q3HBoxLayout(0);
+
+ smBox2->addWidget(mute);
+ smBox2->addWidget(solo);
+
+ // Changed by Tim. p3.3.21
+ //QToolTip::add(record, tr("record"));
+ //smBox1->addStretch(100);
+ //smBox1->addWidget(record);
+ QLabel* dev_ch_label = new QLabel(this);
+ dev_ch_label->setMinimumWidth(STRIP_WIDTH/2);
+ //dev_ch_label->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
+ dev_ch_label->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum));
+ dev_ch_label->setAlignment(Qt::AlignCenter);
+ int port = t->outPort();
+ int channel = t->outChannel();
+ QString dcs;
+ dcs.sprintf("%d-%d", port + 1, channel + 1);
+ dev_ch_label->setText(dcs);
+ //dev_ch_label->setBackgroundColor(QColor(0, 160, 255)); // Med blue
+ //dev_ch_label->setFont(config.fonts[6]);
+ dev_ch_label->setFont(config.fonts[1]);
+ // Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size.
+ //autoAdjustFontSize(dev_ch_label, dev_ch_label->text(), false, true, config.fonts[6].pointSize(), 5);
+ QToolTip::add(dev_ch_label, tr("output port and channel"));
+ smBox1->addWidget(dev_ch_label);
+ smBox1->addWidget(record);
+
+ layout->addLayout(smBox1);
+ layout->addLayout(smBox2);
+
+ //---------------------------------------------------
+ // routing
+ //---------------------------------------------------
+
+ // p3.3.38
+ //route = new QToolButton(this);
+ //route->setFont(config.fonts[1]);
+ //route->setFixedWidth(STRIP_WIDTH);
+ //route->setText(tr("Route"));
+ //QToolTip::add(route, tr("set routing"));
+ //layout->addWidget(route);
+ Q3HBoxLayout* rBox = new Q3HBoxLayout(0);
+ iR = new QToolButton(this);
+ iR->setFont(config.fonts[1]);
+ iR->setFixedWidth((STRIP_WIDTH-4)/2);
+ iR->setText(tr("iR"));
+ iR->setToggleButton(false);
+ QToolTip::add(iR, tr("input routing"));
+ rBox->addWidget(iR);
+ connect(iR, SIGNAL(pressed()), SLOT(iRoutePressed()));
+ oR = new QToolButton(this);
+ oR->setFont(config.fonts[1]);
+ oR->setFixedWidth((STRIP_WIDTH-4)/2);
+ oR->setText(tr("oR"));
+ oR->setToggleButton(false);
+ // TODO: Works OK, but disabled for now, until we figure out what to do about multiple out routes and display values...
+ oR->setEnabled(false);
+ QToolTip::add(oR, tr("output routing"));
+ rBox->addWidget(oR);
+ connect(oR, SIGNAL(pressed()), SLOT(oRoutePressed()));
+ layout->addLayout(rBox);
+
+ //---------------------------------------------------
+ // automation mode
+ //---------------------------------------------------
+
+ autoType = new ComboBox(this);
+ autoType->setFont(config.fonts[1]);
+ autoType->setFixedWidth(STRIP_WIDTH-4);
+ autoType->setEnabled(false);
+ // Removed by T356.
+ // Disabled for now. There is no midi automation mechanism yet...
+ //autoType->insertItem(tr("Off"), AUTO_OFF);
+ //autoType->insertItem(tr("Read"), AUTO_READ);
+ //autoType->insertItem(tr("Touch"), AUTO_TOUCH);
+ //autoType->insertItem(tr("Write"), AUTO_WRITE);
+ //autoType->setCurrentItem(t->automationType());
+ //QToolTip::add(autoType, tr("automation type"));
+ //connect(autoType, SIGNAL(activated(int,int)), SLOT(setAutomationType(int,int)));
+ layout->addWidget(autoType);
+ connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat()));
+ inHeartBeat = false;
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void MidiStrip::songChanged(int val)
+ {
+ if (mute && (val & SC_MUTE)) { // mute && off
+ mute->blockSignals(true);
+ mute->setOn(track->isMute());
+ updateOffState();
+ mute->blockSignals(false);
+ }
+ if (solo && (val & SC_SOLO))
+ {
+ if((bool)track->internalSolo())
+ {
+ if(!useSoloIconSet2)
+ {
+ solo->setIconSet(*soloIconSet2);
+ useSoloIconSet2 = true;
+ }
+ }
+ else if(useSoloIconSet2)
+ {
+ solo->setIconSet(*soloIconSet1);
+ useSoloIconSet2 = false;
+ }
+ solo->blockSignals(true);
+ solo->setOn(track->solo());
+ solo->blockSignals(false);
+ }
+
+ if (val & SC_RECFLAG)
+ setRecordFlag(track->recordFlag());
+ if (val & SC_TRACK_MODIFIED)
+ {
+ setLabelText();
+ // Added by Tim. p3.3.9
+ setLabelFont();
+
+ }
+ // Added by Tim. p3.3.9
+
+ // Catch when label font changes.
+ if (val & SC_CONFIG)
+ {
+ // Set the strip label's font.
+ //label->setFont(config.fonts[1]);
+ setLabelFont();
+ }
+
+ // p3.3.47 Update the routing popup menu if anything relevant changes.
+ //if(gRoutingPopupMenuMaster == this && track && (val & (SC_ROUTE | SC_CHANNELS | SC_CONFIG)))
+ if(val & (SC_ROUTE | SC_CHANNELS | SC_CONFIG)) // p3.3.50
+ // Use this handy shared routine.
+ //muse->updateRouteMenus(track);
+ muse->updateRouteMenus(track, this); // p3.3.50
+ }
+
+//---------------------------------------------------------
+// controlRightClicked
+//---------------------------------------------------------
+
+void MidiStrip::controlRightClicked(const QPoint &p, int id)
+{
+ song->execMidiAutomationCtlPopup((MidiTrack*)track, 0, p, id);
+}
+
+//---------------------------------------------------------
+// labelDoubleClicked
+//---------------------------------------------------------
+
+void MidiStrip::labelDoubleClicked(int idx)
+{
+ //int mn, mx, v;
+ //int num = CTRL_VOLUME;
+ int num;
+ switch(idx)
+ {
+ case KNOB_PAN:
+ num = CTRL_PANPOT;
+ break;
+ case KNOB_VAR_SEND:
+ num = CTRL_VARIATION_SEND;
+ break;
+ case KNOB_REV_SEND:
+ num = CTRL_REVERB_SEND;
+ break;
+ case KNOB_CHO_SEND:
+ num = CTRL_CHORUS_SEND;
+ break;
+ //case -1:
+ default:
+ num = CTRL_VOLUME;
+ break;
+ }
+ int outport = ((MidiTrack*)track)->outPort();
+ int chan = ((MidiTrack*)track)->outChannel();
+ MidiPort* mp = &midiPorts[outport];
+ MidiController* mc = mp->midiController(num);
+
+ int lastv = mp->lastValidHWCtrlState(chan, num);
+ int curv = mp->hwCtrlState(chan, num);
+
+ if(curv == CTRL_VAL_UNKNOWN)
+ {
+ // If no value has ever been set yet, use the current knob value
+ // (or the controller's initial value?) to 'turn on' the controller.
+ if(lastv == CTRL_VAL_UNKNOWN)
+ {
+ //int kiv = _ctrl->initVal());
+ int kiv;
+ if(idx == -1)
+ kiv = lrint(slider->value());
+ else
+ kiv = lrint(controller[idx].knob->value());
+ if(kiv < mc->minVal())
+ kiv = mc->minVal();
+ if(kiv > mc->maxVal())
+ kiv = mc->maxVal();
+ kiv += mc->bias();
+
+ //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, num, kiv);
+ MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, num, kiv);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ else
+ {
+ //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, num, lastv);
+ MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, num, lastv);
+ audio->msgPlayMidiEvent(&ev);
+ }
+ }
+ else
+ {
+ if(mp->hwCtrlState(chan, num) != CTRL_VAL_UNKNOWN)
+ audio->msgSetHwCtrlState(mp, chan, num, CTRL_VAL_UNKNOWN);
+ }
+ song->update(SC_MIDI_CONTROLLER);
+}
+
+
+/*
+//---------------------------------------------------------
+// routeClicked
+//---------------------------------------------------------
+
+void MidiStrip::routeClicked()
+ {
+ }
+*/
+
+//---------------------------------------------------------
+// heartBeat
+//---------------------------------------------------------
+
+void MidiStrip::heartBeat()
+ {
+ inHeartBeat = true;
+
+ int act = track->activity();
+ double dact = double(act) * (slider->value() / 127.0);
+
+ if((int)dact > track->lastActivity())
+ track->setLastActivity((int)dact);
+
+ if(meter[0])
+ //meter[0]->setVal(int(double(act) * (slider->value() / 127.0)), 0, false);
+ meter[0]->setVal(dact, track->lastActivity(), false);
+
+ // Gives reasonable decay with gui update set to 20/sec.
+ if(act)
+ track->setActivity((int)((double)act * 0.8));
+
+ Strip::heartBeat();
+ updateControls();
+
+ inHeartBeat = false;
+ }
+
+//---------------------------------------------------------
+// updateControls
+//---------------------------------------------------------
+
+void MidiStrip::updateControls()
+ {
+ bool en;
+ int channel = ((MidiTrack*)track)->outChannel();
+ MidiPort* mp = &midiPorts[((MidiTrack*)track)->outPort()];
+ MidiCtrlValListList* mc = mp->controller();
+ ciMidiCtrlValList icl;
+
+ MidiController* ctrl = mp->midiController(CTRL_VOLUME);
+ int nvolume = mp->hwCtrlState(channel, CTRL_VOLUME);
+ if(nvolume == CTRL_VAL_UNKNOWN)
+ {
+ //if(nvolume != volume)
+ //{
+ // DoubleLabel ignores the value if already set...
+ sl->setValue(sl->off() - 1.0);
+ //volume = nvolume;
+ //}
+ volume = CTRL_VAL_UNKNOWN;
+ nvolume = mp->lastValidHWCtrlState(channel, CTRL_VOLUME);
+ //if(nvolume != volume)
+ if(nvolume != CTRL_VAL_UNKNOWN)
+ {
+ nvolume -= ctrl->bias();
+ //slider->blockSignals(true);
+ if(double(nvolume) != slider->value())
+ {
+ //printf("MidiStrip::updateControls setting volume slider\n");
+
+ slider->setValue(double(nvolume));
+ }
+ }
+ }
+ else
+ {
+ int ivol = nvolume;
+ nvolume -= ctrl->bias();
+ if(nvolume != volume) {
+ //printf("MidiStrip::updateControls setting volume slider\n");
+
+ //slider->blockSignals(true);
+ slider->setValue(double(nvolume));
+ //sl->setValue(double(nvolume));
+ if(ivol == 0)
+ {
+ //printf("MidiStrip::updateControls setting volume slider label\n");
+
+ sl->setValue(sl->minValue() - 0.5 * (sl->minValue() - sl->off()));
+ }
+ else
+ {
+ double v = -fast_log10(float(127*127)/float(ivol*ivol))*20.0;
+ if(v > sl->maxValue())
+ {
+ //printf("MidiStrip::updateControls setting volume slider label\n");
+
+ sl->setValue(sl->maxValue());
+ }
+ else
+ {
+ //printf("MidiStrip::updateControls setting volume slider label\n");
+
+ sl->setValue(v);
+ }
+ }
+ //slider->blockSignals(false);
+ volume = nvolume;
+ }
+ }
+
+
+ KNOB* gcon = &controller[KNOB_PAN];
+ ctrl = mp->midiController(CTRL_PANPOT);
+ int npan = mp->hwCtrlState(channel, CTRL_PANPOT);
+ if(npan == CTRL_VAL_UNKNOWN)
+ {
+ // DoubleLabel ignores the value if already set...
+ //if(npan != pan)
+ //{
+ gcon->dl->setValue(gcon->dl->off() - 1.0);
+ //pan = npan;
+ //}
+ pan = CTRL_VAL_UNKNOWN;
+ npan = mp->lastValidHWCtrlState(channel, CTRL_PANPOT);
+ if(npan != CTRL_VAL_UNKNOWN)
+ {
+ npan -= ctrl->bias();
+ if(double(npan) != gcon->knob->value())
+ {
+ //printf("MidiStrip::updateControls setting pan knob\n");
+
+ gcon->knob->setValue(double(npan));
+ }
+ }
+ }
+ else
+ {
+ npan -= ctrl->bias();
+ if(npan != pan)
+ {
+ //printf("MidiStrip::updateControls setting pan label and knob\n");
+
+ //controller[KNOB_PAN].knob->blockSignals(true);
+ gcon->knob->setValue(double(npan));
+ gcon->dl->setValue(double(npan));
+ //controller[KNOB_PAN].knob->blockSignals(false);
+ pan = npan;
+ }
+ }
+
+
+ icl = mc->find(channel, CTRL_VARIATION_SEND);
+ en = icl != mc->end();
+
+ gcon = &controller[KNOB_VAR_SEND];
+ if(gcon->knob->isEnabled() != en)
+ gcon->knob->setEnabled(en);
+ if(gcon->lb->isEnabled() != en)
+ gcon->lb->setEnabled(en);
+ if(gcon->dl->isEnabled() != en)
+ gcon->dl->setEnabled(en);
+
+ if(en)
+ {
+ ctrl = mp->midiController(CTRL_VARIATION_SEND);
+ int nvariSend = icl->second->hwVal();
+ if(nvariSend == CTRL_VAL_UNKNOWN)
+ {
+ // DoubleLabel ignores the value if already set...
+ //if(nvariSend != variSend)
+ //{
+ gcon->dl->setValue(gcon->dl->off() - 1.0);
+ //variSend = nvariSend;
+ //}
+ variSend = CTRL_VAL_UNKNOWN;
+ nvariSend = mp->lastValidHWCtrlState(channel, CTRL_VARIATION_SEND);
+ if(nvariSend != CTRL_VAL_UNKNOWN)
+ {
+ nvariSend -= ctrl->bias();
+ if(double(nvariSend) != gcon->knob->value())
+ {
+ gcon->knob->setValue(double(nvariSend));
+ }
+ }
+ }
+ else
+ {
+ nvariSend -= ctrl->bias();
+ if(nvariSend != variSend)
+ {
+ //controller[KNOB_VAR_SEND].knob->blockSignals(true);
+ gcon->knob->setValue(double(nvariSend));
+ gcon->dl->setValue(double(nvariSend));
+ //controller[KNOB_VAR_SEND].knob->blockSignals(false);
+ variSend = nvariSend;
+ }
+ }
+ }
+
+ icl = mc->find(channel, CTRL_REVERB_SEND);
+ en = icl != mc->end();
+
+ gcon = &controller[KNOB_REV_SEND];
+ if(gcon->knob->isEnabled() != en)
+ gcon->knob->setEnabled(en);
+ if(gcon->lb->isEnabled() != en)
+ gcon->lb->setEnabled(en);
+ if(gcon->dl->isEnabled() != en)
+ gcon->dl->setEnabled(en);
+
+ if(en)
+ {
+ ctrl = mp->midiController(CTRL_REVERB_SEND);
+ int nreverbSend = icl->second->hwVal();
+ if(nreverbSend == CTRL_VAL_UNKNOWN)
+ {
+ // DoubleLabel ignores the value if already set...
+ //if(nreverbSend != reverbSend)
+ //{
+ gcon->dl->setValue(gcon->dl->off() - 1.0);
+ //reverbSend = nreverbSend;
+ //}
+ reverbSend = CTRL_VAL_UNKNOWN;
+ nreverbSend = mp->lastValidHWCtrlState(channel, CTRL_REVERB_SEND);
+ if(nreverbSend != CTRL_VAL_UNKNOWN)
+ {
+ nreverbSend -= ctrl->bias();
+ if(double(nreverbSend) != gcon->knob->value())
+ {
+ gcon->knob->setValue(double(nreverbSend));
+ }
+ }
+ }
+ else
+ {
+ nreverbSend -= ctrl->bias();
+ if(nreverbSend != reverbSend)
+ {
+ //controller[KNOB_REV_SEND].knob->blockSignals(true);
+ gcon->knob->setValue(double(nreverbSend));
+ gcon->dl->setValue(double(nreverbSend));
+ //controller[KNOB_REV_SEND].knob->blockSignals(false);
+ reverbSend = nreverbSend;
+ }
+ }
+ }
+
+ icl = mc->find(channel, CTRL_CHORUS_SEND);
+ en = icl != mc->end();
+
+ gcon = &controller[KNOB_CHO_SEND];
+ if(gcon->knob->isEnabled() != en)
+ gcon->knob->setEnabled(en);
+ if(gcon->lb->isEnabled() != en)
+ gcon->lb->setEnabled(en);
+ if(gcon->dl->isEnabled() != en)
+ gcon->dl->setEnabled(en);
+
+ if(en)
+ {
+ ctrl = mp->midiController(CTRL_CHORUS_SEND);
+ int nchorusSend = icl->second->hwVal();
+ if(nchorusSend == CTRL_VAL_UNKNOWN)
+ {
+ // DoubleLabel ignores the value if already set...
+ //if(nchorusSend != chorusSend)
+ //{
+ gcon->dl->setValue(gcon->dl->off() - 1.0);
+ //chorusSend = nchorusSend;
+ //}
+ chorusSend = CTRL_VAL_UNKNOWN;
+ nchorusSend = mp->lastValidHWCtrlState(channel, CTRL_CHORUS_SEND);
+ if(nchorusSend != CTRL_VAL_UNKNOWN)
+ {
+ nchorusSend -= ctrl->bias();
+ if(double(nchorusSend) != gcon->knob->value())
+ {
+ gcon->knob->setValue(double(nchorusSend));
+ }
+ }
+ }
+ else
+ {
+ nchorusSend -= ctrl->bias();
+ if(nchorusSend != chorusSend)
+ {
+ gcon->knob->setValue(double(nchorusSend));
+ gcon->dl->setValue(double(nchorusSend));
+ chorusSend = nchorusSend;
+ }
+ }
+ }
+ }
+//---------------------------------------------------------
+// ctrlChanged
+//---------------------------------------------------------
+
+void MidiStrip::ctrlChanged(int num, int val)
+ {
+ if (inHeartBeat)
+ return;
+
+ MidiTrack* t = (MidiTrack*) track;
+ int port = t->outPort();
+
+ int chan = t->outChannel();
+ MidiPort* mp = &midiPorts[port];
+ MidiController* mctl = mp->midiController(num);
+ if((val < mctl->minVal()) || (val > mctl->maxVal()))
+ {
+ if(mp->hwCtrlState(chan, num) != CTRL_VAL_UNKNOWN)
+ audio->msgSetHwCtrlState(mp, chan, num, CTRL_VAL_UNKNOWN);
+ }
+ else
+ {
+ val += mctl->bias();
+
+ int tick = song->cpos();
+
+ MidiPlayEvent ev(tick, port, chan, ME_CONTROLLER, num, val);
+
+ audio->msgPlayMidiEvent(&ev);
+ }
+ song->update(SC_MIDI_CONTROLLER);
+ }
+
+//---------------------------------------------------------
+// volLabelChanged
+//---------------------------------------------------------
+
+void MidiStrip::volLabelChanged(double val)
+ {
+ val = sqrt( float(127*127) / pow(10.0, -val/20.0) );
+
+ ctrlChanged(CTRL_VOLUME, lrint(val));
+
+ }
+
+//---------------------------------------------------------
+// setVolume
+//---------------------------------------------------------
+
+void MidiStrip::setVolume(double val)
+ {
+
+// printf("Vol %d\n", lrint(val));
+ ctrlChanged(CTRL_VOLUME, lrint(val));
+ }
+
+//---------------------------------------------------------
+// setPan
+//---------------------------------------------------------
+
+void MidiStrip::setPan(double val)
+ {
+
+ ctrlChanged(CTRL_PANPOT, lrint(val));
+ }
+
+//---------------------------------------------------------
+// setVariSend
+//---------------------------------------------------------
+
+void MidiStrip::setVariSend(double val)
+ {
+ ctrlChanged(CTRL_VARIATION_SEND, lrint(val));
+ }
+
+//---------------------------------------------------------
+// setChorusSend
+//---------------------------------------------------------
+
+void MidiStrip::setChorusSend(double val)
+ {
+ ctrlChanged(CTRL_CHORUS_SEND, lrint(val));
+ }
+
+//---------------------------------------------------------
+// setReverbSend
+//---------------------------------------------------------
+
+void MidiStrip::setReverbSend(double val)
+ {
+ ctrlChanged(CTRL_REVERB_SEND, lrint(val));
+ }
+
+//---------------------------------------------------------
+// updateOffState
+//---------------------------------------------------------
+
+void MidiStrip::updateOffState() // Ripped from AudioStrip, hehh(mg)
+ {
+ bool val = !track->off();
+ slider->setEnabled(val);
+ //KNOB* gcon = &controller[KNOB_PAN]; // TODO: Pan ctrl
+ //gcon->setOn(val);
+ label->setEnabled(val);
+ if (record)
+ record->setEnabled(val);
+ if (solo)
+ solo->setEnabled(val);
+ if (mute)
+ mute->setEnabled(val);
+ }
+
+//---------------------------------------------------------
+// routingPopupMenuActivated
+//---------------------------------------------------------
+
+void MidiStrip::routingPopupMenuActivated(int n)
+{
+ if(gRoutingPopupMenuMaster != this || !track || !track->isMidiTrack())
+ return;
+ muse->routingPopupMenuActivated(track, n);
+}
+
+//---------------------------------------------------------
+// iRoutePressed
+//---------------------------------------------------------
+
+void MidiStrip::iRoutePressed()
+{
+ if(!track || !track->isMidiTrack())
+ return;
+
+ //song->chooseMidiRoutes(iR, (MidiTrack*)track, false);
+ PopupMenu* pup = muse->prepareRoutingPopupMenu(track, false);
+ if(!pup)
+ return;
+
+ //pup->disconnect();
+ gRoutingPopupMenuMaster = this;
+ connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
+ connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
+ pup->popup(QCursor::pos(), 0);
+ iR->setDown(false);
+ return;
+
+ /*
+ RouteList* irl = track->inRoutes();
+ //Route dst(track, -1);
+
+ QPopupMenu* pup = new QPopupMenu(iR);
+ pup->setCheckable(true);
+
+ int gid = 0;
+
+ //MidiInPortList* tl = song->midiInPorts();
+ //for(iMidiInPort i = tl->begin();i != tl->end(); ++i)
+ for(int i = 0; i < MIDI_PORTS; ++i)
+ {
+ //MidiInPort* track = *i;
+ // NOTE: Could possibly list all devices, bypassing ports, but no, let's stick wth ports.
+ MidiPort* mp = &midiPorts[i];
+ MidiDevice* md = mp->device();
+ if(!md)
+ continue;
+
+ if(!(md->rwFlags() & 2))
+ continue;
+
+ //printf("MidiStrip::iRoutePressed adding submenu portnum:%d\n", i);
+
+ //QMenu* m = menu->addMenu(track->name());
+ QPopupMenu* subp = new QPopupMenu(iR);
+
+ for(int ch = 0; ch < MIDI_CHANNELS; ++ch)
+ {
+ //QAction* a = m->addAction(QString("Channel %1").arg(ch+1));
+ //subp->insertItem(QT_TR_NOOP(QString("Channel %1").arg(ch+1)), i * MIDI_CHANNELS + ch);
+ gid = i * MIDI_CHANNELS + ch;
+
+ //printf("MidiStrip::iRoutePressed inserting gid:%d\n", gid);
+
+ subp->insertItem(QString("Channel %1").arg(ch+1), gid);
+ //a->setCheckable(true);
+ //Route src(track, ch, RouteNode::TRACK);
+ //Route src(md, ch);
+ //Route r = Route(src, dst);
+ //a->setData(QVariant::fromValue(r));
+ //a->setChecked(rl->indexOf(r) != -1);
+ Route srcRoute(md, ch);
+ for(iRoute ir = irl->begin(); ir != irl->end(); ++ir)
+ {
+ //if(*ir == dst)
+ if(*ir == srcRoute)
+ {
+ subp->setItemChecked(gid, true);
+ break;
+ }
+ }
+ }
+ pup->insertItem(QT_TR_NOOP(md->name()), subp);
+ }
+
+ int n = pup->exec(QCursor::pos());
+ delete pup;
+ if (n != -1)
+ {
+ int mdidx = n / MIDI_CHANNELS;
+ int ch = n % MIDI_CHANNELS;
+
+ //if(debugMsg)
+ printf("MidiStrip::iRoutePressed mdidx:%d ch:%d\n", mdidx, ch);
+
+ MidiPort* mp = &midiPorts[mdidx];
+ MidiDevice* md = mp->device();
+ if(!md)
+ return;
+
+ if(!(md->rwFlags() & 2))
+ return;
+
+
+ //QString s(pup->text(n));
+ //QT_TR_NOOP(md->name())
+
+ //Route srcRoute(s, false, -1);
+ Route srcRoute(md, ch);
+ //Route srcRoute(md, -1);
+ //Route dstRoute(track, -1);
+ Route dstRoute(track, ch);
+
+ //if (track->type() == Track::AUDIO_INPUT)
+ // srcRoute.channel = dstRoute.channel = n & 0xf;
+ iRoute iir = irl->begin();
+ for (; iir != irl->end(); ++iir) {
+ if (*iir == srcRoute)
+ break;
+ }
+ if (iir != irl->end()) {
+ // disconnect
+ printf("MidiStrip::iRoutePressed removing route src device name: %s dst track name: %s\n", md->name().latin1(), track->name().latin1());
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect
+ printf("MidiStrip::iRoutePressed adding route src device name: %s dst track name: %s\n", md->name().latin1(), track->name().latin1());
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ printf("MidiStrip::iRoutePressed calling msgUpdateSoloStates\n");
+ audio->msgUpdateSoloStates();
+ printf("MidiStrip::iRoutePressed calling song->update\n");
+ song->update(SC_ROUTE);
+ }
+ //delete pup;
+ iR->setDown(false); // pup->exec() catches mouse release event
+ printf("MidiStrip::iRoutePressed end\n");
+ */
+
+}
+
+//---------------------------------------------------------
+// oRoutePressed
+//---------------------------------------------------------
+
+void MidiStrip::oRoutePressed()
+ {
+ if(!track || !track->isMidiTrack())
+ return;
+
+ //song->chooseMidiRoutes(oR, (MidiTrack*)track, true);
+ PopupMenu* pup = muse->prepareRoutingPopupMenu(track, true);
+ if(!pup)
+ return;
+
+ //pup->disconnect();
+ gRoutingPopupMenuMaster = this;
+ connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
+ connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
+ pup->popup(QCursor::pos(), 0);
+ oR->setDown(false);
+ return;
+
+ /*
+ QPopupMenu* pup = new QPopupMenu(oR);
+ pup->setCheckable(true);
+ AudioTrack* t = (AudioTrack*)track;
+ RouteList* orl = t->outRoutes();
+
+ switch(track->type()) {
+ case Track::MIDI:
+ case Track::DRUM:
+ delete pup;
+ return;
+ case Track::AUDIO_OUTPUT:
+ {
+ int gid = 0;
+ for (int i = 0; i < channel; ++i) {
+ char buffer[128];
+ snprintf(buffer, 128, "%s %d", tr("Channel").latin1(), i+1);
+ MenuTitleItem* titel = new MenuTitleItem(QString(buffer));
+ pup->insertItem(titel);
+
+ if (!checkAudioDevice()) return;
+ std::list<QString> ol = audioDevice->inputPorts();
+ for (std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip) {
+ int id = pup->insertItem(*ip, (gid * 16) + i);
+ Route dst(*ip, true, i);
+ ++gid;
+ for (iRoute ir = orl->begin(); ir != orl->end(); ++ir) {
+ if (*ir == dst) {
+ pup->setItemChecked(id, true);
+ break;
+ }
+ }
+ }
+ if (i+1 != channel)
+ pup->insertSeparator();
+ }
+ }
+ break;
+ case Track::AUDIO_INPUT:
+ addWavePorts(t, pup, orl);
+ case Track::WAVE:
+ case Track::AUDIO_GROUP:
+ case Track::AUDIO_SOFTSYNTH:
+ addOutPorts(t, pup, orl);
+ addGroupPorts(t, pup, orl);
+ break;
+ case Track::AUDIO_AUX:
+ addOutPorts(t, pup, orl);
+ break;
+ }
+ int n = pup->exec(QCursor::pos());
+ if (n != -1) {
+ QString s(pup->text(n));
+ Route srcRoute(t, -1);
+ Route dstRoute(s, true, -1);
+
+ if (track->type() == Track::AUDIO_OUTPUT)
+ srcRoute.channel = dstRoute.channel = n & 0xf;
+
+ // check if route src->dst exists:
+ iRoute iorl = orl->begin();
+ for (; iorl != orl->end(); ++iorl) {
+ if (*iorl == dstRoute)
+ break;
+ }
+ if (iorl != orl->end()) {
+ // disconnect if route exists
+ audio->msgRemoveRoute(srcRoute, dstRoute);
+ }
+ else {
+ // connect if route does not exist
+ audio->msgAddRoute(srcRoute, dstRoute);
+ }
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+ }
+ delete pup;
+ oR->setDown(false); // pup->exec() catches mouse release event
+ */
+
+
+ }
+
+
diff --git a/muse2/muse/mixer/mstrip.h b/muse2/muse/mixer/mstrip.h
new file mode 100644
index 00000000..86eb3fac
--- /dev/null
+++ b/muse2/muse/mixer/mstrip.h
@@ -0,0 +1,83 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mstrip.h,v 1.4.2.4 2009/10/25 19:26:29 lunar_shuttle Exp $
+//
+// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MSTRIP_H__
+#define __MSTRIP_H__
+
+#include "strip.h"
+//Added by qt3to4:
+#include <QLabel>
+
+class Slider;
+class DoubleLabel;
+class QDialog;
+class Knob;
+class QString;
+class MidiTrack;
+class QLabel;
+
+//---------------------------------------------------------
+// MidiStrip
+//---------------------------------------------------------
+
+class MidiStrip : public Strip {
+ Q_OBJECT
+
+ Slider* slider;
+ DoubleLabel* sl;
+ //QToolButton* route;
+ //QToolButton* iR;
+ //QToolButton* oR;
+
+ struct KNOB {
+ Knob* knob;
+ DoubleLabel* dl;
+ QLabel* lb;
+ } controller[4]; // pan variation reverb chorus
+
+ int volume;
+ int variSend;
+ int reverbSend;
+ int chorusSend;
+ int pan;
+ bool inHeartBeat;
+
+ void addKnob(int idx, const QString&, const QString&, const char*, bool);
+ void ctrlChanged(int num, int val);
+ void updateControls();
+ void updateOffState();
+
+ private slots:
+ //void routeClicked();
+ void iRoutePressed();
+ void oRoutePressed();
+ void routingPopupMenuActivated(int /*id*/);
+ void setVolume(double);
+ void setPan(double);
+ void setChorusSend(double);
+ void setVariSend(double);
+ void setReverbSend(double);
+ void labelDoubleClicked(int);
+ void volLabelChanged(double);
+ void controlRightClicked(const QPoint&, int);
+
+ protected slots:
+ virtual void heartBeat();
+
+ public slots:
+ virtual void songChanged(int);
+
+ public:
+ MidiStrip(QWidget* parent, MidiTrack*);
+ };
+
+
+#endif
+
+
+
diff --git a/muse2/muse/mixer/panknob.cpp b/muse2/muse/mixer/panknob.cpp
new file mode 100644
index 00000000..065c1bd1
--- /dev/null
+++ b/muse2/muse/mixer/panknob.cpp
@@ -0,0 +1,32 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: panknob.cpp,v 1.5 2004/01/23 08:41:38 wschweer Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "../audio.h"
+#include "panknob.h"
+
+//---------------------------------------------------------
+// PanKnob
+//---------------------------------------------------------
+
+PanKnob::PanKnob(QWidget* parent, AudioTrack* s)
+ : Knob(parent, "pan")
+ {
+ src = s;
+ connect(this, SIGNAL(valueChanged(double,int)), SLOT(valueChanged(double)));
+ }
+
+//---------------------------------------------------------
+// panChanged
+//---------------------------------------------------------
+
+void PanKnob::valueChanged(double val)
+ {
+ audio->msgSetPan(src, val);
+ }
+
+
diff --git a/muse2/muse/mixer/panknob.h b/muse2/muse/mixer/panknob.h
new file mode 100644
index 00000000..92c41b03
--- /dev/null
+++ b/muse2/muse/mixer/panknob.h
@@ -0,0 +1,32 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: panknob.h,v 1.3 2003/11/08 15:10:18 wschweer Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __PANKNOB_H__
+#define __PANKNOB_H__
+
+#include "knob.h"
+
+class AudioTrack;
+
+//---------------------------------------------------------
+// PanKnob
+//---------------------------------------------------------
+
+class PanKnob : public Knob {
+ Q_OBJECT
+ AudioTrack* src;
+
+ private slots:
+ void valueChanged(double);
+
+ public:
+ PanKnob(QWidget* parent, AudioTrack*);
+ };
+
+#endif
+
diff --git a/muse2/muse/mixer/rack.cpp b/muse2/muse/mixer/rack.cpp
new file mode 100644
index 00000000..ae5d34b7
--- /dev/null
+++ b/muse2/muse/mixer/rack.cpp
@@ -0,0 +1,531 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: rack.cpp,v 1.7.2.7 2007/01/27 14:52:43 spamatica Exp $
+//
+// (C) Copyright 2000-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qapplication.h>
+#include <qtooltip.h>
+#include <qpalette.h>
+#include <qpainter.h>
+#include <q3popupmenu.h>
+#include <q3dragobject.h>
+#include <qmessagebox.h>
+#include <q3url.h>
+//Added by qt3to4:
+#include <QDropEvent>
+#include <QMouseEvent>
+#include <QDragEnterEvent>
+#include <errno.h>
+
+#include "xml.h"
+#include "rack.h"
+#include "song.h"
+#include "audio.h"
+#include "icons.h"
+#include "gconfig.h"
+#include "plugin.h"
+#include "filedialog.h"
+#include "config.h"
+
+//---------------------------------------------------------
+// class RackSlot
+//---------------------------------------------------------
+
+class RackSlot : public Q3ListBoxItem {
+ int idx;
+ AudioTrack* node;
+
+ virtual void paint(QPainter*);
+ virtual int height(const Q3ListBox*) const { return 18; }
+
+ public:
+ RackSlot(Q3ListBox* lb, AudioTrack* t, int);
+ ~RackSlot();
+ };
+
+RackSlot::~RackSlot()
+ {
+ node = 0;
+ }
+
+//---------------------------------------------------------
+// RackSlot
+//---------------------------------------------------------
+
+RackSlot::RackSlot(Q3ListBox* b, AudioTrack* t, int i)
+ : Q3ListBoxItem(b)
+ {
+ node = t;
+ idx = i;
+ }
+
+//---------------------------------------------------------
+// paint
+//---------------------------------------------------------
+
+void RackSlot::paint(QPainter* painter)
+ {
+ if (node == 0)
+ return;
+ painter->save();
+ if (node == 0 || !node->efxPipe()->isOn(idx)) {
+ const QColorGroup& g = listBox()->colorGroup();
+ painter->fillRect(0,0,listBox()->width(),height(listBox()), g.dark());
+ painter->setPen(g.light());
+ }
+ QFontMetrics fm = painter->fontMetrics();
+ QString s(node->efxPipe()->name(idx));
+ painter->drawText(3, fm.ascent() + fm.leading()/2, s);
+ painter->restore();
+ }
+
+//---------------------------------------------------------
+// EffectRack
+//---------------------------------------------------------
+
+EffectRack::EffectRack(QWidget* parent, AudioTrack* t)
+ : Q3ListBox(parent, "Rack", Qt::WDestructiveClose)
+ {
+ track = t;
+ setFont(config.fonts[1]);
+
+ setHScrollBarMode(AlwaysOff);
+ setVScrollBarMode(AlwaysOff);
+ setSelectionMode(Single);
+ setMaximumHeight(18 * PipelineDepth);
+ for (int i = 0; i < PipelineDepth; ++i)
+ new RackSlot(this, track, i);
+ connect(this, SIGNAL(contextMenuRequested(Q3ListBoxItem*, const QPoint&)),
+ this, SLOT(menuRequested(Q3ListBoxItem*, const QPoint&)));
+ connect(this, SIGNAL(doubleClicked(Q3ListBoxItem*)),
+ this, SLOT(doubleClicked(Q3ListBoxItem*)));
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ QToolTip::add(this, tr("effect rack"));
+ setAcceptDrops(true);
+ }
+
+//---------------------------------------------------------
+// EffectRack
+//---------------------------------------------------------
+
+EffectRack::~EffectRack()
+ {
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void EffectRack::songChanged(int typ)
+ {
+ if (typ & (SC_ROUTE | SC_RACK)) {
+ for (int i = 0; i < PipelineDepth; ++i)
+ updateItem(i);
+ }
+ }
+
+//---------------------------------------------------------
+// minimumSizeHint
+//---------------------------------------------------------
+
+QSize EffectRack::minimumSizeHint() const
+ {
+ return QSize(10, 18 * PipelineDepth);
+ }
+
+//---------------------------------------------------------
+// menuRequested
+//---------------------------------------------------------
+
+void EffectRack::menuRequested(Q3ListBoxItem* it, const QPoint& pt)
+ {
+ if (it == 0 || track == 0)
+ return;
+ RackSlot* curitem = (RackSlot*)it;
+ int idx = index(curitem);
+ QString name;
+ bool mute;
+ Pipeline* pipe = track->efxPipe();
+ if (pipe) {
+ name = pipe->name(idx);
+ mute = pipe->isOn(idx);
+ }
+
+ //enum { NEW, CHANGE, UP, DOWN, REMOVE, BYPASS, SHOW, SAVE };
+ enum { NEW, CHANGE, UP, DOWN, REMOVE, BYPASS, SHOW, SHOW_NATIVE, SAVE };
+ Q3PopupMenu* menu = new Q3PopupMenu;
+ menu->insertItem(QIcon(*upIcon), tr("move up"), UP, UP);
+ menu->insertItem(QIcon(*downIcon), tr("move down"), DOWN, DOWN);
+ menu->insertItem(tr("remove"), REMOVE, REMOVE);
+ menu->insertItem(tr("bypass"), BYPASS, BYPASS);
+ menu->insertItem(tr("show gui"), SHOW, SHOW);
+ menu->insertItem(tr("show native gui"), SHOW_NATIVE, SHOW_NATIVE);
+
+ menu->setItemChecked(BYPASS, !pipe->isOn(idx));
+ menu->setItemChecked(SHOW, pipe->guiVisible(idx));
+ menu->setItemChecked(SHOW_NATIVE, pipe->nativeGuiVisible(idx));
+
+ if (pipe->empty(idx)) {
+ menu->insertItem(tr("new"), NEW, NEW);
+ menu->setItemEnabled(UP, false);
+ menu->setItemEnabled(DOWN, false);
+ menu->setItemEnabled(REMOVE, false);
+ menu->setItemEnabled(BYPASS, false);
+ menu->setItemEnabled(SHOW, false);
+ menu->setItemEnabled(SHOW_NATIVE, false);
+ menu->setItemEnabled(SAVE, false);
+ }
+ else {
+ menu->insertItem(tr("change"), CHANGE, CHANGE);
+ menu->insertItem(tr("save preset"), SAVE, SAVE);
+ if (idx == 0)
+ menu->setItemEnabled(UP, false);
+ if (idx == (PipelineDepth-1))
+ menu->setItemEnabled(DOWN, false);
+ if(!pipe->isDssiPlugin(idx))
+ menu->setItemEnabled(SHOW_NATIVE, false);
+ }
+
+ #ifndef OSC_SUPPORT
+ menu->setItemEnabled(SHOW_NATIVE, false);
+ #endif
+
+ int sel = menu->exec(pt, 1);
+ delete menu;
+ if (sel == -1)
+ return;
+
+ switch(sel) {
+ case NEW:
+ {
+ Plugin* plugin = PluginDialog::getPlugin(this);
+ if (plugin) {
+ PluginI* plugi = new PluginI();
+ if (plugi->initPluginInstance(plugin, track->channels())) {
+ printf("cannot instantiate plugin <%s>\n",
+ plugin->name().latin1());
+ delete plugi;
+ break;
+ }
+ audio->msgAddPlugin(track, idx, plugi);
+ }
+ break;
+ }
+ case CHANGE:
+ {
+ Plugin* plugin = PluginDialog::getPlugin(this);
+ if (plugin) {
+ PluginI* plugi = new PluginI();
+ if (plugi->initPluginInstance(plugin, track->channels())) {
+ printf("cannot instantiate plugin <%s>\n",
+ plugin->name().latin1());
+ delete plugi;
+ break;
+ }
+ audio->msgAddPlugin(track, idx, 0);
+ audio->msgAddPlugin(track, idx, plugi);
+ }
+ break;
+ }
+ case REMOVE:
+ audio->msgAddPlugin(track, idx, 0);
+ break;
+ case BYPASS:
+ {
+ bool flag = !pipe->isOn(idx);
+ pipe->setOn(idx, flag);
+ break;
+ }
+ case SHOW:
+ {
+ bool flag = !pipe->guiVisible(idx);
+ pipe->showGui(idx, flag);
+ break;
+ }
+ case SHOW_NATIVE:
+ {
+ bool flag = !pipe->nativeGuiVisible(idx);
+ pipe->showNativeGui(idx, flag);
+ break;
+ }
+ case UP:
+ if (idx > 0) {
+ setCurrentItem(idx-1);
+ pipe->move(idx, true);
+ }
+ break;
+ case DOWN:
+ if (idx < (PipelineDepth-1)) {
+ setCurrentItem(idx+1);
+ pipe->move(idx, false);
+ }
+ break;
+ case SAVE:
+ savePreset(idx);
+ break;
+ }
+ song->update(SC_RACK);
+ }
+
+//---------------------------------------------------------
+// doubleClicked
+// toggle gui
+//---------------------------------------------------------
+
+void EffectRack::doubleClicked(Q3ListBoxItem* it)
+ {
+ if (it == 0 || track == 0)
+ return;
+ RackSlot* item = (RackSlot*)it;
+ int idx = index(item);
+ Pipeline* pipe = track->efxPipe();
+ if (pipe) {
+ bool flag = !pipe->guiVisible(idx);
+ pipe->showGui(idx, flag);
+ }
+ }
+
+void EffectRack::savePreset(int idx)
+ {
+ //QString name = getSaveFileName(QString(""), plug_file_pattern, this,
+ QString name = getSaveFileName(QString(""), preset_file_save_pattern, this,
+ tr("MusE: Save Preset"));
+
+ if(name.isEmpty())
+ return;
+
+ //FILE* presetFp = fopen(name.ascii(),"w+");
+ bool popenFlag;
+ FILE* presetFp = fileOpen(this, name, QString(".pre"), "w", popenFlag, false, true);
+ if (presetFp == 0) {
+ //fprintf(stderr, "EffectRack::savePreset() fopen failed: %s\n",
+ // strerror(errno));
+ return;
+ }
+ Xml xml(presetFp);
+ Pipeline* pipe = track->efxPipe();
+ if (pipe) {
+ if ((*pipe)[idx] != NULL) {
+ xml.header();
+ xml.tag(0, "muse version=\"1.0\"");
+ (*pipe)[idx]->writeConfiguration(1, xml);
+ xml.tag(0, "/muse");
+ }
+ else {
+ printf("no plugin!\n");
+ //fclose(presetFp);
+ if (popenFlag)
+ pclose(presetFp);
+ else
+ fclose(presetFp);
+ return;
+ }
+ }
+ else {
+ printf("no pipe!\n");
+ //fclose(presetFp);
+ if (popenFlag)
+ pclose(presetFp);
+ else
+ fclose(presetFp);
+ return;
+ }
+ //fclose(presetFp);
+ if (popenFlag)
+ pclose(presetFp);
+ else
+ fclose(presetFp);
+ }
+
+void EffectRack::startDrag(int idx)
+ {
+ FILE* tmp = tmpfile();
+ if (tmp == 0) {
+ fprintf(stderr, "EffectRack::startDrag fopen failed: %s\n",
+ strerror(errno));
+ return;
+ }
+ Xml xml(tmp);
+ Pipeline* pipe = track->efxPipe();
+ if (pipe) {
+ if ((*pipe)[idx] != NULL) {
+ xml.header();
+ xml.tag(0, "muse version=\"1.0\"");
+ (*pipe)[idx]->writeConfiguration(1, xml);
+ xml.tag(0, "/muse");
+ }
+ else {
+ //printf("no plugin!\n");
+ return;
+ }
+ }
+ else {
+ //printf("no pipe!\n");
+ return;
+ }
+
+ QString xmlconf;
+ xml.dump(xmlconf);
+ Q3TextDrag *drag = new Q3TextDrag(xmlconf, this);
+ drag->setSubtype("x-muse-plugin");
+ drag->drag();
+ }
+
+void EffectRack::contentsDropEvent(QDropEvent * /*event*/)// prevent of compiler warning: unsued variable
+ {
+ }
+
+void EffectRack::dropEvent(QDropEvent *event)
+ {
+ QString text;
+ Q3ListBoxItem *i = itemAt( contentsToViewport(event->pos()) );
+ int idx = index(i);
+
+ Pipeline* pipe = track->efxPipe();
+ if (pipe) {
+ if ((*pipe)[idx] != NULL) {
+ QWidget *sw = event->source();
+ if(sw)
+ {
+ if(strcmp(sw->className(), "EffectRack") == 0)
+ {
+ EffectRack *ser = (EffectRack*)sw;
+ Pipeline* spipe = ser->getTrack()->efxPipe();
+ if(!spipe)
+ return;
+ Q3ListBoxItem *i = ser->itemAt(contentsToViewport(ser->getDragPos()));
+ int idx0 = ser->index(i);
+ if (!(*spipe)[idx0] ||
+ (idx == idx0 && (ser == this || ser->getTrack()->name() == track->name())))
+ return;
+ }
+ }
+ if(!QMessageBox::question(this, tr("Replace effect"),tr("Do you really want to replace the effect %1?").arg(pipe->name(idx)),
+ tr("&Yes"), tr("&No"),
+ QString::null, 0, 1 ))
+ {
+ audio->msgAddPlugin(track, idx, 0);
+ song->update(SC_RACK);
+ }
+ else {
+ return;
+ }
+ }
+ if(Q3TextDrag::decode(event, text))
+ {
+ text = text.stripWhiteSpace();
+ // Changed by T356.
+ //if (text.endsWith(".pre", false))
+ if (text.endsWith(".pre", false) || text.endsWith(".pre.gz", false) || text.endsWith(".pre.bz2", false))
+ {
+ Q3Url url(text);
+ QString newPath = url.path();
+
+ //bool popenFlag = false;
+ bool popenFlag;
+ FILE* fp = fileOpen(this, newPath, ".pre", "r", popenFlag, false, false);
+
+ if (fp) {
+ Xml xml(fp);
+ initPlugin(xml, idx);
+
+ // Added by T356.
+ if (popenFlag)
+ pclose(fp);
+ else
+ fclose(fp);
+ }
+ }
+ else if (event->provides("text/x-muse-plugin"))
+ {
+ QString outxml;
+ Q3TextDrag::decode(event, outxml);
+ Xml xml(outxml);
+ initPlugin(xml, idx);
+ }
+ }
+ }
+ }
+
+void EffectRack::dragEnterEvent(QDragEnterEvent *event)
+ {
+ event->accept(Q3TextDrag::canDecode(event));
+ }
+
+
+void EffectRack::contentsDragEnterEvent(QDragEnterEvent * /*event*/)// prevent of compiler warning: unused parameter
+ {
+ }
+
+void EffectRack::contentsMousePressEvent(QMouseEvent *event)
+ {
+ if(event->button() & Qt::LeftButton) {
+ dragPos = event->pos();
+ }
+ Q3ListBox::contentsMousePressEvent(event);
+ }
+
+void EffectRack::contentsMouseMoveEvent(QMouseEvent *event)
+ {
+ if (event->state() & Qt::LeftButton) {
+ Pipeline* pipe = track->efxPipe();
+ if(!pipe)
+ return;
+ Q3ListBoxItem *i = itemAt(contentsToViewport(dragPos));
+ int idx0 = index(i);
+ if (!(*pipe)[idx0])
+ return;
+
+ int distance = (dragPos-event->pos()).manhattanLength();
+ if (distance > QApplication::startDragDistance()) {
+ Q3ListBoxItem *i = itemAt( contentsToViewport(event->pos()) );
+ int idx = index(i);
+ startDrag(idx);
+ }
+ }
+ Q3ListBox::contentsMouseMoveEvent(event);
+ }
+
+
+void EffectRack::initPlugin(Xml xml, int idx)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ QString tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "plugin") {
+ PluginI* plugi = new PluginI();
+ if (plugi->readConfiguration(xml, false)) {
+ printf("cannot instantiate plugin\n");
+ delete plugi;
+ }
+ else {
+ //printf("instantiated!\n");
+ audio->msgAddPlugin(track, idx, plugi);
+ song->update(SC_RACK);
+ return;
+ }
+ }
+ else if (tag =="muse")
+ break;
+ else
+ xml.unknown("EffectRack");
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if (tag == "muse")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
diff --git a/muse2/muse/mixer/rack.h b/muse2/muse/mixer/rack.h
new file mode 100644
index 00000000..edacfa29
--- /dev/null
+++ b/muse2/muse/mixer/rack.h
@@ -0,0 +1,58 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: rack.h,v 1.5.2.3 2006/09/24 19:32:31 terminator356 Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __RACK_H__
+#define __RACK_H__
+
+#include <q3listbox.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QDropEvent>
+#include <QDragEnterEvent>
+#include "xml.h"
+
+class AudioTrack;
+
+//---------------------------------------------------------
+// EffectRack
+//---------------------------------------------------------
+
+class EffectRack : public Q3ListBox {
+ AudioTrack* track;
+ Q_OBJECT
+
+ virtual QSize minimumSizeHint() const;
+
+ void startDrag(int idx);
+ void initPlugin(Xml xml, int idx);
+ QPoint dragPos;
+ void savePreset(int idx);
+
+ private slots:
+ void menuRequested(Q3ListBoxItem*, const QPoint&);
+ void doubleClicked(Q3ListBoxItem*);
+ void songChanged(int);
+
+ protected:
+ void dropEvent(QDropEvent *event);
+ void dragEnterEvent(QDragEnterEvent *event);
+ void contentsDropEvent(QDropEvent *event);
+ void contentsDragEnterEvent(QDragEnterEvent *event);
+ void contentsMousePressEvent(QMouseEvent *event);
+ void contentsMouseMoveEvent(QMouseEvent *event);
+
+ public:
+ EffectRack(QWidget*, AudioTrack* t);
+ ~EffectRack();
+
+ AudioTrack* getTrack() { return track; }
+ QPoint getDragPos() { return dragPos; }
+ };
+
+#endif
+
diff --git a/muse2/muse/mixer/routedialog.cpp b/muse2/muse/mixer/routedialog.cpp
new file mode 100644
index 00000000..e56a15ba
--- /dev/null
+++ b/muse2/muse/mixer/routedialog.cpp
@@ -0,0 +1,185 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: routedialog.cpp,v 1.5.2.2 2007/01/04 00:35:17 terminator356 Exp $
+//
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <q3listbox.h>
+#include <q3listview.h>
+#include <qtoolbutton.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+#include "routedialog.h"
+#include "track.h"
+#include "song.h"
+#include "audio.h"
+#include "driver/jackaudio.h"
+
+//---------------------------------------------------------
+// RouteDialog
+//---------------------------------------------------------
+
+RouteDialog::RouteDialog(QWidget* parent)
+ : RouteDialogBase(parent)
+ {
+ connect(routeList, SIGNAL(selectionChanged()), SLOT(routeSelectionChanged()));
+ connect(newSrcList, SIGNAL(selectionChanged()), SLOT(srcSelectionChanged()));
+ connect(newDstList, SIGNAL(selectionChanged()), SLOT(dstSelectionChanged()));
+ connect(removeButton, SIGNAL(clicked()), SLOT(removeRoute()));
+ connect(connectButton, SIGNAL(clicked()), SLOT(addRoute()));
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ routingChanged();
+ }
+
+//---------------------------------------------------------
+// routingChanged
+//---------------------------------------------------------
+
+void RouteDialog::routingChanged()
+ {
+ //---------------------------------------------------
+ // populate lists
+ //---------------------------------------------------
+
+ routeList->clear();
+ newSrcList->clear();
+ newDstList->clear();
+
+ TrackList* tl = song->tracks();
+ for (ciTrack i = tl->begin(); i != tl->end(); ++i) {
+ if ((*i)->isMidiTrack())
+ continue;
+ // p3.3.38
+ //WaveTrack* track = (WaveTrack*)(*i);
+ AudioTrack* track = (AudioTrack*)(*i);
+ if (track->type() == Track::AUDIO_INPUT) {
+ for (int channel = 0; channel < track->channels(); ++channel)
+ newDstList->insertItem(Route(track, channel).name());
+ const RouteList* rl = track->inRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r) {
+ //Route dst(track->name(), true, r->channel);
+ Route dst(track->name(), true, r->channel, Route::TRACK_ROUTE);
+ new Q3ListViewItem(routeList, r->name(), dst.name());
+ }
+ }
+ else if (track->type() != Track::AUDIO_AUX)
+ newDstList->insertItem(Route(track, -1).name());
+ if (track->type() == Track::AUDIO_OUTPUT) {
+ for (int channel = 0; channel < track->channels(); ++channel) {
+ Route r(track, channel);
+ newSrcList->insertItem(r.name());
+ }
+ }
+ else
+ newSrcList->insertItem(Route(track, -1).name());
+
+ const RouteList* rl = track->outRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r) {
+ QString src(track->name());
+ if (track->type() == Track::AUDIO_OUTPUT) {
+ Route s(src, false, r->channel);
+ src = s.name();
+ }
+ new Q3ListViewItem(routeList, src, r->name());
+ }
+ }
+ if (!checkAudioDevice()) return;
+ std::list<QString> sl = audioDevice->outputPorts();
+ for (std::list<QString>::iterator i = sl.begin(); i != sl.end(); ++i)
+ newSrcList->insertItem(*i);
+ sl = audioDevice->inputPorts();
+ for (std::list<QString>::iterator i = sl.begin(); i != sl.end(); ++i)
+ newDstList->insertItem(*i);
+ routeSelectionChanged(); // init remove button
+ srcSelectionChanged(); // init select button
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void RouteDialog::songChanged(int v)
+ {
+ if (v & (SC_TRACK_INSERTED | SC_TRACK_REMOVED | SC_ROUTE)) {
+ routingChanged();
+ }
+ }
+
+//---------------------------------------------------------
+// routeSelectionChanged
+//---------------------------------------------------------
+
+void RouteDialog::routeSelectionChanged()
+ {
+ Q3ListViewItem* item = routeList->selectedItem();
+ removeButton->setEnabled(item != 0);
+ }
+
+//---------------------------------------------------------
+// removeRoute
+//---------------------------------------------------------
+
+void RouteDialog::removeRoute()
+ {
+ Q3ListViewItem* item = routeList->selectedItem();
+ if (item == 0)
+ return;
+ audio->msgRemoveRoute(Route(item->text(0), false, -1), Route(item->text(1), true, -1));
+ audio->msgUpdateSoloStates();
+ song->update(SC_SOLO);
+ delete item;
+ }
+
+//---------------------------------------------------------
+// addRoute
+//---------------------------------------------------------
+
+void RouteDialog::addRoute()
+ {
+ Q3ListBoxItem* srcItem = newSrcList->selectedItem();
+ Q3ListBoxItem* dstItem = newDstList->selectedItem();
+ if (srcItem == 0 || dstItem == 0)
+ return;
+ audio->msgAddRoute(Route(srcItem->text(), false, -1), Route(dstItem->text(), true, -1));
+ audio->msgUpdateSoloStates();
+ song->update(SC_SOLO);
+ new Q3ListViewItem(routeList, srcItem->text(), dstItem->text());
+ }
+
+//---------------------------------------------------------
+// srcSelectionChanged
+//---------------------------------------------------------
+
+void RouteDialog::srcSelectionChanged()
+ {
+ Q3ListBoxItem* srcItem = newSrcList->selectedItem();
+ Q3ListBoxItem* dstItem = newDstList->selectedItem();
+ connectButton->setEnabled((srcItem != 0)
+ && (dstItem != 0)
+ && checkRoute(srcItem->text(), dstItem->text()));
+ }
+
+//---------------------------------------------------------
+// dstSelectionChanged
+//---------------------------------------------------------
+
+void RouteDialog::dstSelectionChanged()
+ {
+ Q3ListBoxItem* dstItem = newDstList->selectedItem();
+ Q3ListBoxItem* srcItem = newSrcList->selectedItem();
+ connectButton->setEnabled((srcItem != 0)
+ && (dstItem != 0)
+ && checkRoute(srcItem->text(), dstItem->text()));
+ }
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void RouteDialog::closeEvent(QCloseEvent* e)
+ {
+ emit closed();
+ e->accept();
+ }
diff --git a/muse2/muse/mixer/routedialog.h b/muse2/muse/mixer/routedialog.h
new file mode 100644
index 00000000..d819b2a1
--- /dev/null
+++ b/muse2/muse/mixer/routedialog.h
@@ -0,0 +1,43 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: routedialog.h,v 1.2 2004/01/31 17:31:49 wschweer Exp $
+//
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __ROUTEDIALOG_H__
+#define __ROUTEDIALOG_H__
+
+#include "routedialogbase.h"
+//Added by qt3to4:
+#include <QCloseEvent>
+
+//---------------------------------------------------------
+// RouteDialog
+//---------------------------------------------------------
+
+class RouteDialog : public RouteDialogBase {
+ Q_OBJECT
+
+ virtual void closeEvent(QCloseEvent*);
+ void routingChanged();
+
+ private slots:
+ void routeSelectionChanged();
+ void removeRoute();
+ void addRoute();
+ void srcSelectionChanged();
+ void dstSelectionChanged();
+ void songChanged(int);
+
+ signals:
+ void closed();
+
+ public:
+ RouteDialog(QWidget* parent);
+ };
+
+
+#endif
+
diff --git a/muse2/muse/mixer/routedialogbase.ui b/muse2/muse/mixer/routedialogbase.ui
new file mode 100644
index 00000000..85c4f0d4
--- /dev/null
+++ b/muse2/muse/mixer/routedialogbase.ui
@@ -0,0 +1,234 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>RouteDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>RouteDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>316</width>
+ <height>383</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="caption">
+ <string>MusE: Routing</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>4</number>
+ </property>
+ <property name="spacing">
+ <number>4</number>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox4</cstring>
+ </property>
+ <property name="title">
+ <string>Add Route</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>4</number>
+ </property>
+ <property name="spacing">
+ <number>4</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="title">
+ <string>Source:</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>newSrcList</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="title">
+ <string>Destination:</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>newDstList</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>connectButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Connect</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>connect source to destination</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="lineWidth">
+ <number>1</number>
+ </property>
+ <property name="title">
+ <string>Current Routes</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>4</number>
+ </property>
+ <property name="spacing">
+ <number>4</number>
+ </property>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Source</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Destination</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>routeList</cstring>
+ </property>
+ <property name="selectionMode">
+ <enum>Single</enum>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>removeButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Remove</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>remove selected route</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/mixer/strip.cpp b/muse2/muse/mixer/strip.cpp
new file mode 100644
index 00000000..892a19b6
--- /dev/null
+++ b/muse2/muse/mixer/strip.cpp
@@ -0,0 +1,238 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: strip.cpp,v 1.6.2.5 2009/11/14 03:37:48 terminator356 Exp $
+//
+// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qtoolbutton.h>
+#include <qlabel.h>
+#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3Frame>
+
+#include "globals.h"
+#include "gconfig.h"
+#include "app.h"
+#include "audio.h"
+#include "song.h"
+#include "track.h"
+#include "strip.h"
+#include "meter.h"
+#include "utils.h"
+
+//---------------------------------------------------------
+// setRecordFlag
+//---------------------------------------------------------
+
+void Strip::setRecordFlag(bool flag)
+ {
+ if (record) {
+ record->blockSignals(true);
+ record->setOn(flag);
+ record->blockSignals(false);
+ }
+ }
+
+//---------------------------------------------------------
+// resetPeaks
+//---------------------------------------------------------
+
+void Strip::resetPeaks()
+ {
+ track->resetPeaks();
+ }
+
+//---------------------------------------------------------
+// recordToggled
+//---------------------------------------------------------
+
+void Strip::recordToggled(bool val)
+ {
+ if (track->type() == Track::AUDIO_OUTPUT) {
+ if (val && track->recordFlag() == false) {
+ muse->bounceToFile((AudioOutput*)track);
+ }
+ audio->msgSetRecord((AudioOutput*)track, val);
+ if (!((AudioOutput*)track)->recFile())
+ record->setOn(false);
+ return;
+ }
+ song->setRecordFlag(track, val);
+ }
+//---------------------------------------------------------
+// heartBeat
+//---------------------------------------------------------
+
+void Strip::heartBeat()
+ {
+ }
+
+//---------------------------------------------------------
+// setLabelFont
+//---------------------------------------------------------
+// Added by Tim. p3.3.9
+
+void Strip::setLabelFont()
+{
+ // Use the new font #6 I created just for these labels (so far).
+ // Set the label's font.
+ label->setFont(config.fonts[6]);
+ // Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size.
+ //autoAdjustFontSize(label, label->text(), false, true, config.fonts[6].pointSize(), 5); ddskrjo
+}
+
+//---------------------------------------------------------
+// setLabelText
+//---------------------------------------------------------
+
+void Strip::setLabelText()
+ {
+ //label->setText(track->name());
+ QString s;
+ switch(track->type()) {
+ case Track::AUDIO_OUTPUT:
+ label->setBackgroundColor(Qt::green);
+ s = track->name();
+ break;
+ case Track::AUDIO_GROUP:
+ label->setBackgroundColor(Qt::yellow);
+ s = track->name();
+ break;
+ case Track::AUDIO_AUX:
+ //label->setBackgroundColor(cyan);
+ label->setBackgroundColor(QColor(120, 255, 255)); // Light blue
+ s = track->name();
+ break;
+ case Track::WAVE:
+ label->setBackgroundColor(Qt::magenta);
+ s = track->name();
+ break;
+ case Track::AUDIO_INPUT:
+ label->setBackgroundColor(Qt::red);
+ s = track->name();
+ break;
+ case Track::AUDIO_SOFTSYNTH:
+ //label->setBackgroundColor(white);
+ label->setBackgroundColor(QColor(255, 130, 0)); // Med orange
+ s = track->name();
+ break;
+ case Track::MIDI:
+ case Track::DRUM:
+ {
+ // Changed by Tim. p3.3.21
+ /*
+ MidiTrack* mt = (MidiTrack*)track;
+ int port = mt->outPort();
+ int channel = mt->outChannel();
+ //QString s;
+ s.sprintf("%d-%d", port + 1, channel + 1);
+ //label->setText(s);
+ //label->setBackgroundColor(gray);
+ */
+ label->setBackgroundColor(QColor(0, 160, 255)); // Med blue
+ s = track->name();
+ }
+ break;
+ }
+ // Added by Tim. p3.3.9
+ label->setText(s);
+
+ }
+
+//---------------------------------------------------------
+// muteToggled
+//---------------------------------------------------------
+
+void Strip::muteToggled(bool val)
+ {
+ track->setMute(val);
+ song->update(SC_MUTE);
+ }
+
+//---------------------------------------------------------
+// soloToggled
+//---------------------------------------------------------
+
+void Strip::soloToggled(bool val)
+ {
+ audio->msgSetSolo(track, val);
+ song->update(SC_SOLO);
+ }
+
+//---------------------------------------------------------
+// Strip
+// create mixer strip
+//---------------------------------------------------------
+
+Strip::Strip(QWidget* parent, Track* t)
+ : Q3Frame(parent, "Strip", Qt::WDestructiveClose)
+ {
+ iR = 0;
+ oR = 0;
+
+ setBackgroundMode(Qt::PaletteMid);
+ setFrameStyle(Panel | Raised);
+ setLineWidth(2);
+ useSoloIconSet2 = false;
+
+ track = t;
+ meter[0] = 0;
+ meter[1] = 0;
+ setFixedWidth(STRIP_WIDTH);
+ layout = new Q3VBoxLayout(this);
+ layout->setMargin(3);
+
+ //---------------------------------------------
+ // label
+ //---------------------------------------------
+
+ label = new QLabel(this);
+ // Moved by Tim. p3.3.9
+ //setLabelText();
+ //label->setFont(config.fonts[1]);
+
+ //printf("Strip::Strip w:%d frw:%d layoutmarg:%d lx:%d ly:%d lw:%d lh:%d\n", STRIP_WIDTH, frameWidth(), layout->margin(), label->x(), label->y(), label->width(), label->height());
+
+ // Tested: The label's width is 100. It does not become STRIP_WIDTH - 2*layout->margin
+ // until the mixer is shown in MusE::showMixer.
+ // Therefore 'fake' set the size of the label now.
+ // Added by Tim. p3.3.9
+ //label->setGeometry(label->x(), label->y(), STRIP_WIDTH - 2*frameWidth() - 2*layout->margin(), label->height());
+ label->setGeometry(label->x(), label->y(), STRIP_WIDTH - 2*layout->margin(), label->height());
+
+ // Unfortunately for the mixer labels, QLabel doesn't support the BreakAnywhere flag.
+ // Changed by Tim. p3.3.9
+ //label->setAlignment(AlignCenter);
+ //label->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed));
+ label->setAlignment(Qt::AlignCenter | Qt::TextWordWrap);
+ //label->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum));
+ label->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
+
+ // Added by Tim. p3.3.9
+ setLabelText();
+ setLabelFont();
+
+ layout->addWidget(label);
+ }
+
+//---------------------------------------------------------
+// Strip
+//---------------------------------------------------------
+
+Strip::~Strip()
+ {
+ }
+
+//---------------------------------------------------------
+// setAutomationType
+//---------------------------------------------------------
+
+void Strip::setAutomationType(int t,int)
+ {
+ track->setAutomationType(AutomationType(t));
+ song->update(SC_AUTOMATION);
+ }
+
diff --git a/muse2/muse/mixer/strip.h b/muse2/muse/mixer/strip.h
new file mode 100644
index 00000000..a28cf5fd
--- /dev/null
+++ b/muse2/muse/mixer/strip.h
@@ -0,0 +1,77 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: strip.h,v 1.3.2.2 2009/11/14 03:37:48 terminator356 Exp $
+//
+// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __STRIP_H__
+#define __STRIP_H__
+
+#include <q3frame.h>
+#include <qicon.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3GridLayout>
+#include <QLabel>
+
+#include "globaldefs.h"
+//#include "route.h"
+
+class Track;
+class QLabel;
+class Q3VBoxLayout;
+class Meter;
+class QToolButton;
+class Q3GridLayout;
+class ComboBox;
+
+static const int STRIP_WIDTH = 65;
+
+//---------------------------------------------------------
+// Strip
+//---------------------------------------------------------
+
+class Strip : public Q3Frame {
+ Q_OBJECT
+
+ protected:
+ Track* track;
+ QLabel* label;
+ Q3VBoxLayout* layout;
+ Meter* meter[MAX_CHANNELS];
+ bool useSoloIconSet2;
+
+ QToolButton* record;
+ QToolButton* solo;
+ QToolButton* mute;
+ QToolButton* iR; // Input routing button
+ QToolButton* oR; // Output routing button
+ Q3GridLayout* sliderGrid;
+ ComboBox* autoType;
+ void setLabelText();
+
+ private slots:
+ void recordToggled(bool);
+ void soloToggled(bool);
+ void muteToggled(bool);
+
+ protected slots:
+ virtual void heartBeat();
+ void setAutomationType(int t,int);
+
+ public slots:
+ void resetPeaks();
+ virtual void songChanged(int) = 0;
+
+ public:
+ Strip(QWidget* parent, Track* t);
+ ~Strip();
+ void setRecordFlag(bool flag);
+ Track* getTrack() const { return track; }
+ void setLabelFont();
+ };
+
+#endif
+
diff --git a/muse2/muse/mpevent.cpp b/muse2/muse/mpevent.cpp
new file mode 100644
index 00000000..2b7ce5eb
--- /dev/null
+++ b/muse2/muse/mpevent.cpp
@@ -0,0 +1,160 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mpevent.cpp,v 1.6.2.2 2009/11/25 09:09:43 terminator356 Exp $
+//
+// (C) Copyright 2002-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "mpevent.h"
+
+#include "helper.h"
+#include "event.h"
+#include "midictrl.h"
+#include "midiport.h"
+#include "muse/midi.h"
+
+//---------------------------------------------------------
+// MEvent
+//---------------------------------------------------------
+
+MEvent::MEvent(unsigned t, int port, int tpe, const unsigned char* data, int len)
+ {
+ _time = t;
+ _port = port;
+ edata.setData(data, len);
+ _type = tpe;
+ _loopNum = 0;
+ }
+
+MEvent::MEvent(unsigned tick, int port, int channel, const Event& e)
+ {
+ setChannel(channel);
+ setTime(tick);
+ setPort(port);
+ setLoopNum(0);
+ switch(e.type()) {
+ case Note:
+ setType(ME_NOTEON);
+ setA(e.dataA());
+ setB(e.dataB());
+ break;
+ case Controller:
+ setType(ME_CONTROLLER);
+ setA(e.dataA()); // controller number
+ setB(e.dataB()); // controller value
+ break;
+ case PAfter:
+ setType(ME_POLYAFTER);
+ setA(e.dataA());
+ setB(e.dataB());
+ break;
+ case CAfter:
+ setType(ME_AFTERTOUCH);
+ setA(e.dataA());
+ setB(0);
+ break;
+ case Sysex:
+ setType(ME_SYSEX);
+ setData(e.eventData());
+ break;
+ default:
+ printf("MEvent::MEvent(): event type %d not implemented\n",
+ type());
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// dump
+//---------------------------------------------------------
+
+void MEvent::dump() const
+ {
+ printf("time:%d port:%d chan:%d ", _time, _port, _channel+1);
+ if (_type == 0x90) { // NoteOn
+ QString s = pitch2string(_a);
+ printf("NoteOn %s(0x%x) %d\n", s.latin1(), _a, _b);
+ }
+ else if (_type == 0xf0) {
+ printf("SysEx len %d 0x%0x ...\n", len(), data()[0]);
+ }
+ else
+ printf("type:0x%02x a=%d b=%d\n", _type, _a, _b);
+ }
+
+//---------------------------------------------------------
+// operator <
+//---------------------------------------------------------
+
+bool MEvent::operator<(const MEvent& e) const
+ {
+ if (time() != e.time())
+ return time() < e.time();
+ if (port() != e.port())
+ return port() < e.port();
+
+ // play note off events first to prevent overlapping
+ // notes
+
+ if (channel() == e.channel())
+ return type() == ME_NOTEOFF
+ || (type() == ME_NOTEON && dataB() == 0);
+
+ int map[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15 };
+ return map[channel()] < map[e.channel()];
+ }
+
+
+//---------------------------------------------------------
+// put
+// return true on fifo overflow
+//---------------------------------------------------------
+
+bool MidiFifo::put(const MidiPlayEvent& event)
+ {
+ if (size < MIDI_FIFO_SIZE) {
+ fifo[wIndex] = event;
+ wIndex = (wIndex + 1) % MIDI_FIFO_SIZE;
+ // q_atomic_increment(&size);
+ ++size;
+ return false;
+ }
+ return true;
+ }
+
+//---------------------------------------------------------
+// get
+//---------------------------------------------------------
+
+MidiPlayEvent MidiFifo::get()
+ {
+ MidiPlayEvent event(fifo[rIndex]);
+ rIndex = (rIndex + 1) % MIDI_FIFO_SIZE;
+ // q_atomic_decrement(&size);
+ --size;
+ return event;
+ }
+
+//---------------------------------------------------------
+// peek
+//---------------------------------------------------------
+
+const MidiPlayEvent& MidiFifo::peek(int n)
+ {
+ int idx = (rIndex + n) % MIDI_FIFO_SIZE;
+ return fifo[idx];
+ }
+
+//---------------------------------------------------------
+// remove
+//---------------------------------------------------------
+
+void MidiFifo::remove()
+ {
+ rIndex = (rIndex + 1) % MIDI_FIFO_SIZE;
+ // q_atomic_decrement(&size);
+ --size;
+ }
+
+
diff --git a/muse2/muse/mpevent.h b/muse2/muse/mpevent.h
new file mode 100644
index 00000000..6df7b0c0
--- /dev/null
+++ b/muse2/muse/mpevent.h
@@ -0,0 +1,183 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mpevent.h,v 1.8.2.5 2009/11/25 09:09:43 terminator356 Exp $
+//
+// (C) Copyright 1999-2002 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MPEVENT_H__
+#define __MPEVENT_H__
+
+#include <set>
+#include <list>
+#include "evdata.h"
+#include "memory.h"
+
+#define MIDI_FIFO_SIZE 512
+
+class Event;
+class EvData;
+
+//---------------------------------------------------------
+// MEvent
+// baseclass for MidiPlayEvent and MidiRecordEvent
+//---------------------------------------------------------
+
+//---------------------------------------------------------
+// MEvent
+//---------------------------------------------------------
+
+class MEvent {
+ unsigned _time;
+ EvData edata;
+ unsigned char _port, _channel, _type;
+ int _a, _b;
+ int _loopNum; // The loop count when the note was recorded.
+
+ public:
+ MEvent() { _loopNum = 0; }
+ MEvent(unsigned tm, int p, int c, int t, int a, int b)
+ : _time(tm), _port(p), _channel(c & 0xf), _type(t), _a(a), _b(b) { _loopNum = 0; }
+ MEvent(unsigned t, int p, int type, const unsigned char* data, int len);
+ MEvent(unsigned t, int p, int tpe, EvData d) : _time(t), edata(d), _port(p), _type(tpe) { _loopNum = 0; }
+ MEvent(unsigned t, int port, int channel, const Event& e);
+
+ ~MEvent() {}
+
+ MEvent& operator=(const MEvent& ed) {
+ _time = ed._time;
+ edata = ed.edata;
+ _port = ed._port;
+ _channel = ed._channel;
+ _type = ed._type;
+ _a = ed._a;
+ _b = ed._b;
+ _loopNum = ed._loopNum;
+ return *this;
+ }
+
+ int port() const { return _port; }
+ int channel() const { return _channel; }
+ int type() const { return _type; }
+ int dataA() const { return _a; }
+ int dataB() const { return _b; }
+ unsigned time() const { return _time; }
+ int loopNum() const { return _loopNum; }
+
+ void setPort(int val) { _port = val; }
+ void setChannel(int val) { _channel = val; }
+ void setType(int val) { _type = val; }
+ void setA(int val) { _a = val; }
+ void setB(int val) { _b = val; }
+ void setTime(unsigned val) { _time = val; }
+ void setLoopNum(int n) { _loopNum = n; }
+
+ const EvData& eventData() const { return edata; }
+ unsigned char* data() const { return edata.data; }
+ int len() const { return edata.dataLen; }
+ void setData(const EvData& e) { edata = e; }
+ void setData(const unsigned char* p, int len) { edata.setData(p, len); }
+ void dump() const;
+ bool isNote() const { return _type == 0x90; }
+ bool isNoteOff() const { return (_type == 0x80)||(_type == 0x90 && _b == 0); }
+ bool operator<(const MEvent&) const;
+ };
+
+//---------------------------------------------------------
+// MidiRecordEvent
+// allocated and deleted in midiseq thread context
+//---------------------------------------------------------
+
+class MidiPlayEvent;
+
+class MidiRecordEvent : public MEvent {
+ public:
+ MidiRecordEvent() : MEvent() {}
+ MidiRecordEvent(const MEvent& e) : MEvent(e) {}
+ MidiRecordEvent(unsigned tm, int p, int c, int t, int a, int b)
+ : MEvent(tm, p, c, t, a, b) {}
+ MidiRecordEvent(unsigned t, int p, int tpe, const unsigned char* data, int len)
+ : MEvent(t, p, tpe, data, len) {}
+ MidiRecordEvent(unsigned t, int p, int type, EvData data)
+ : MEvent(t, p, type, data) {}
+ ~MidiRecordEvent() {}
+ };
+
+//---------------------------------------------------------
+// MidiPlayEvent
+// allocated and deleted in audio thread context
+//---------------------------------------------------------
+
+class MidiPlayEvent : public MEvent {
+ public:
+ MidiPlayEvent() : MEvent() {}
+ MidiPlayEvent(const MEvent& e) : MEvent(e) {}
+ MidiPlayEvent(unsigned tm, int p, int c, int t, int a, int b)
+ : MEvent(tm, p, c, t, a, b) {}
+ MidiPlayEvent(unsigned t, int p, int type, const unsigned char* data, int len)
+ : MEvent(t, p, type, data, len) {}
+ MidiPlayEvent(unsigned t, int p, int type, EvData data)
+ : MEvent(t, p, type, data) {}
+ MidiPlayEvent(unsigned t, int port, int channel, const Event& e)
+ : MEvent(t, port, channel, e) {}
+ ~MidiPlayEvent() {}
+ };
+
+//---------------------------------------------------------
+// MPEventList
+// memory allocation in audio thread domain
+//---------------------------------------------------------
+
+typedef std::multiset<MidiPlayEvent, std::less<MidiPlayEvent>, audioRTalloc<MidiPlayEvent> > MPEL;
+
+struct MPEventList : public MPEL {
+ void add(const MidiPlayEvent& ev) { MPEL::insert(ev); }
+ };
+
+typedef MPEventList::iterator iMPEvent;
+typedef MPEventList::const_iterator ciMPEvent;
+
+/*
+//---------------------------------------------------------
+// MREventList
+// memory allocation in midi thread domain
+//---------------------------------------------------------
+
+// Changed by Tim. p3.3.8
+
+// audioRTalloc? Surely this must have been a mistake?
+//typedef std::list<MidiRecordEvent, audioRTalloc<MidiRecordEvent> > MREL;
+typedef std::list<MidiRecordEvent, midiRTalloc<MidiRecordEvent> > MREL;
+
+struct MREventList : public MREL {
+ void add(const MidiRecordEvent& ev) { MREL::push_back(ev); }
+ };
+
+typedef MREventList::iterator iMREvent;
+typedef MREventList::const_iterator ciMREvent;
+*/
+
+//---------------------------------------------------------
+// MidiFifo
+//---------------------------------------------------------
+
+class MidiFifo {
+ MidiPlayEvent fifo[MIDI_FIFO_SIZE];
+ volatile int size;
+ int wIndex;
+ int rIndex;
+
+ public:
+ MidiFifo() { clear(); }
+ bool put(const MidiPlayEvent& event); // returns true on fifo overflow
+ MidiPlayEvent get();
+ const MidiPlayEvent& peek(int n = 0);
+ void remove();
+ bool isEmpty() const { return size == 0; }
+ void clear() { size = 0, wIndex = 0, rIndex = 0; }
+ int getSize() const { return size; }
+ };
+
+#endif
+
diff --git a/muse2/muse/mplugins/.cvsignore b/muse2/muse/mplugins/.cvsignore
new file mode 100644
index 00000000..66e962c6
--- /dev/null
+++ b/muse2/muse/mplugins/.cvsignore
@@ -0,0 +1,2 @@
+mrconfigbase.h
+midifilter.h
diff --git a/muse2/muse/mplugins/Makefile.am b/muse2/muse/mplugins/Makefile.am
new file mode 100644
index 00000000..ef00f245
--- /dev/null
+++ b/muse2/muse/mplugins/Makefile.am
@@ -0,0 +1,26 @@
+include $(top_srcdir)/common.am
+
+noinst_LIBRARIES = libmplugins.a
+
+if PCH
+AM_CXXFLAGS += -include $(top_srcdir)/all.h
+endif
+
+dist_libmplugins_a_SOURCES = \
+ mitplugin.cpp mitplugin.h \
+ mittranspose.cpp mittranspose.h \
+ midiitransform.cpp midiitransform.h \
+ midifilterimpl.cpp midifilterimpl.h \
+ mrconfig.cpp mrconfig.h \
+ rhythm.cpp rhythm.h \
+ random.cpp random.h \
+ midifilter.ui \
+ mrconfigbase.ui \
+ rhythmbase.ui
+
+nodist_libmplugins_a_SOURCES = \
+ moc_mittranspose.cpp \
+ moc_midiitransform.cpp \
+ moc_midifilterimpl.cpp \
+ moc_mrconfig.cpp \
+ moc_rhythm.cpp
diff --git a/muse2/muse/mplugins/Makefile.in b/muse2/muse/mplugins/Makefile.in
new file mode 100644
index 00000000..47f131bb
--- /dev/null
+++ b/muse2/muse/mplugins/Makefile.in
@@ -0,0 +1,624 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/common.am
+@PCH_TRUE@am__append_1 = -include $(top_srcdir)/all.h
+subdir = muse/mplugins
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
+ $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libmplugins_a_AR = $(AR) $(ARFLAGS)
+libmplugins_a_LIBADD =
+dist_libmplugins_a_OBJECTS = mitplugin.$(OBJEXT) \
+ mittranspose.$(OBJEXT) midiitransform.$(OBJEXT) \
+ midifilterimpl.$(OBJEXT) mrconfig.$(OBJEXT) rhythm.$(OBJEXT) \
+ random.$(OBJEXT) midifilter.$(OBJEXT) mrconfigbase.$(OBJEXT) \
+ rhythmbase.$(OBJEXT)
+nodist_libmplugins_a_OBJECTS = moc_mittranspose.$(OBJEXT) \
+ moc_midiitransform.$(OBJEXT) moc_midifilterimpl.$(OBJEXT) \
+ moc_mrconfig.$(OBJEXT) moc_rhythm.$(OBJEXT)
+libmplugins_a_OBJECTS = $(dist_libmplugins_a_OBJECTS) \
+ $(nodist_libmplugins_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(dist_libmplugins_a_SOURCES) \
+ $(nodist_libmplugins_a_SOURCES)
+DIST_SOURCES = $(dist_libmplugins_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCBOOKSTYLE = @DOCBOOKSTYLE@
+DOCBOOKTARGETS = @DOCBOOKTARGETS@
+DOT = @DOT@
+DOTPATH = @DOTPATH@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@
+FST_CFLAGS = @FST_CFLAGS@
+FST_LIBS = @FST_LIBS@
+Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@
+Fluidsynth_LIBS = @Fluidsynth_LIBS@
+GIVERTCAP = @GIVERTCAP@
+GREP = @GREP@
+HAVEDOT = @HAVEDOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JADE = @JADE@
+LASH_CFLAGS = @LASH_CFLAGS@
+LASH_LIBS = @LASH_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LO_CFLAGS = @LO_CFLAGS@
+LO_LIBS = @LO_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUSECXXFLAGS = @MUSECXXFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSGMLS = @NSGMLS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCH = @PCH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIB = @PYTHON_LIB@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+QTDIR_BIN = @QTDIR_BIN@
+QTDIR_INC = @QTDIR_INC@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+SUIDBUILD = @SUIDBUILD@
+SUIDINSTALL = @SUIDINSTALL@
+USE_SSE = @USE_SSE@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+have_docbook = @have_docbook@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+synth_fluid = @synth_fluid@
+synth_fluidsynth = @synth_fluidsynth@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \
+ -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(am__append_1)
+AM_CPPFLAGS =
+MOC = $(QTDIR_BIN)/moc
+#UIC = $(QTDIR_BIN)/uic3
+UIC = /usr/bin/uic3
+UIFILES = $(wildcard *.ui)
+MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \
+ if grep -q Q_OBJECT $$h; then \
+ echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \
+ fi; \
+ done)
+
+BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+SUFFIXES = .ui .h.gch
+noinst_LIBRARIES = libmplugins.a
+dist_libmplugins_a_SOURCES = \
+ mitplugin.cpp mitplugin.h \
+ mittranspose.cpp mittranspose.h \
+ midiitransform.cpp midiitransform.h \
+ midifilterimpl.cpp midifilterimpl.h \
+ mrconfig.cpp mrconfig.h \
+ rhythm.cpp rhythm.h \
+ random.cpp random.h \
+ midifilter.ui \
+ mrconfigbase.ui \
+ rhythmbase.ui
+
+nodist_libmplugins_a_SOURCES = \
+ moc_mittranspose.cpp \
+ moc_midiitransform.cpp \
+ moc_midifilterimpl.cpp \
+ moc_mrconfig.cpp \
+ moc_rhythm.cpp
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .ui .h.gch .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/mplugins/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu muse/mplugins/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libmplugins.a: $(libmplugins_a_OBJECTS) $(libmplugins_a_DEPENDENCIES)
+ -rm -f libmplugins.a
+ $(libmplugins_a_AR) libmplugins.a $(libmplugins_a_OBJECTS) $(libmplugins_a_LIBADD)
+ $(RANLIB) libmplugins.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midifilterimpl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midiitransform.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mitplugin.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mittranspose.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_midifilterimpl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_midiitransform.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_mittranspose.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_mrconfig.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_rhythm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mrconfig.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/random.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rhythm.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+de:
+ @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done
+
+nde:
+ @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done
+
+.ui.o: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(CXXCOMPILE) -c $*.cpp -o $*.o
+ $(RM) $*.cpp moc_$*.cpp moc_$*.o
+
+.ui.lo: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(LTCXXCOMPILE) -c $*.cpp -o $*.lo
+ $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o
+
+moc_%.cpp: %.h
+ $(MOC) $< -o $@
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/muse2/muse/mplugins/midifilter.ui b/muse2/muse/mplugins/midifilter.ui
new file mode 100644
index 00000000..412e735d
--- /dev/null
+++ b/muse2/muse/mplugins/midifilter.ui
@@ -0,0 +1,879 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>MidiFilterConfigBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MidiFilterConfigBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>348</width>
+ <height>431</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="caption">
+ <string>MusE: Midi Input Filter</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>GroupBoxx</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Record Filter</string>
+ </property>
+ <property name="layoutSpacing" stdset="0">
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>rf1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Note On</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>rf2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Poly Pressure</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>rf3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Controller</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>rf4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Program Change</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>rf5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>After Touch</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>rf6</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Pitch Bend</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>rf7</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Sysex</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox" row="0" column="1">
+ <property name="name">
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Thru Filter</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>tf1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Note On</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>tf2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Poly Pressure</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>tf3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Controller</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>tf4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Program Change</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>tf5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>After Touch</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>tf6</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Pitch Bend</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>tf7</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Sysex</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox" row="1" column="1">
+ <property name="name">
+ <cstring>GroupBox4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Controller Filter</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="CtrlComboBox">
+ <property name="name">
+ <cstring>cb1</cstring>
+ </property>
+ </widget>
+ <widget class="CtrlComboBox">
+ <property name="name">
+ <cstring>cb2</cstring>
+ </property>
+ </widget>
+ <widget class="CtrlComboBox">
+ <property name="name">
+ <cstring>cb3</cstring>
+ </property>
+ </widget>
+ <widget class="CtrlComboBox">
+ <property name="name">
+ <cstring>cb4</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QButtonGroup" row="1" column="0">
+ <property name="name">
+ <cstring>ButtonGroup1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Channel Filter</string>
+ </property>
+ <property name="layoutSpacing" stdset="0">
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>3</number>
+ </property>
+ <widget class="QPushButton" row="3" column="1">
+ <property name="name">
+ <cstring>cf14</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>14</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="1">
+ <property name="name">
+ <cstring>cf10</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>10</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>cf6</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>6</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="3">
+ <property name="name">
+ <cstring>cf12</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>12</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="3">
+ <property name="name">
+ <cstring>cf4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>25</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>4</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="1">
+ <property name="name">
+ <cstring>cf2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>25</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>2</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="0">
+ <property name="name">
+ <cstring>cf9</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>9</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="3">
+ <property name="name">
+ <cstring>cf8</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>8</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="2">
+ <property name="name">
+ <cstring>cf3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>25</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>3</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="3" column="0">
+ <property name="name">
+ <cstring>cf13</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>13</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="3" column="2">
+ <property name="name">
+ <cstring>cf15</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>15</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="3" column="3">
+ <property name="name">
+ <cstring>cf16</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>16</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="2">
+ <property name="name">
+ <cstring>cf7</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>7</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="2">
+ <property name="name">
+ <cstring>cf11</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>11</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>cf5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>5</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>cf1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>25</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>CtrlComboBox</class>
+ <header location="global">ctrlcombo.h</header>
+ <sizehint>
+ <width>50</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ <signal>activated(int index)</signal>
+ <signal>activated(const QString&amp;)</signal>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
+ </image>
+</images>
+<tabstops>
+ <tabstop>rf1</tabstop>
+ <tabstop>rf2</tabstop>
+ <tabstop>rf3</tabstop>
+ <tabstop>rf4</tabstop>
+ <tabstop>rf5</tabstop>
+ <tabstop>rf6</tabstop>
+ <tabstop>rf7</tabstop>
+ <tabstop>tf1</tabstop>
+ <tabstop>tf2</tabstop>
+ <tabstop>tf3</tabstop>
+ <tabstop>tf4</tabstop>
+ <tabstop>tf5</tabstop>
+ <tabstop>tf6</tabstop>
+ <tabstop>tf7</tabstop>
+ <tabstop>cf1</tabstop>
+ <tabstop>cf2</tabstop>
+ <tabstop>cf3</tabstop>
+ <tabstop>cf4</tabstop>
+ <tabstop>cf5</tabstop>
+ <tabstop>cf6</tabstop>
+ <tabstop>cf7</tabstop>
+ <tabstop>cf8</tabstop>
+ <tabstop>cf9</tabstop>
+ <tabstop>cf10</tabstop>
+ <tabstop>cf11</tabstop>
+ <tabstop>cf12</tabstop>
+ <tabstop>cf13</tabstop>
+ <tabstop>cf14</tabstop>
+ <tabstop>cf15</tabstop>
+ <tabstop>cf16</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>ctrlcombo.h</includehint>
+</includehints>
+</UI>
diff --git a/muse2/muse/mplugins/midifilterimpl.cpp b/muse2/muse/mplugins/midifilterimpl.cpp
new file mode 100644
index 00000000..56d5caf5
--- /dev/null
+++ b/muse2/muse/mplugins/midifilterimpl.cpp
@@ -0,0 +1,131 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midifilterimpl.cpp,v 1.1.1.1 2003/10/27 18:52:49 wschweer Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "midifilterimpl.h"
+#include "ctrlcombo.h"
+
+#include <qpushbutton.h>
+#include <qcheckbox.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+
+//---------------------------------------------------------
+// setCtrl
+//---------------------------------------------------------
+
+void MidiFilterConfig::setCtrl1(int n)
+ {
+ midiFilterCtrl1 = n-1;
+ }
+void MidiFilterConfig::setCtrl2(int n)
+ {
+ midiFilterCtrl2 = n-1;
+ }
+void MidiFilterConfig::setCtrl3(int n)
+ {
+ midiFilterCtrl3 = n-1;
+ }
+void MidiFilterConfig::setCtrl4(int n)
+ {
+ midiFilterCtrl4 = n-1;
+ }
+
+
+//---------------------------------------------------------
+// MidiFilterConfig
+//---------------------------------------------------------
+
+MidiFilterConfig::MidiFilterConfig(QWidget* parent, const char* name)
+ : MidiFilterConfigBase(parent, name)
+ {
+ cb1->setCurrentItem(midiFilterCtrl1);
+ cb2->setCurrentItem(midiFilterCtrl2);
+ cb3->setCurrentItem(midiFilterCtrl3);
+ cb4->setCurrentItem(midiFilterCtrl4);
+
+ rf1->setChecked(midiRecordType & 1);
+ rf2->setChecked(midiRecordType & 2);
+ rf3->setChecked(midiRecordType & 4);
+ rf4->setChecked(midiRecordType & 8);
+ rf5->setChecked(midiRecordType & 16);
+ rf6->setChecked(midiRecordType & 32);
+ rf7->setChecked(midiRecordType & 64);
+ connect(rf1, SIGNAL(toggled(bool)), SLOT(recordChanged1(bool)));
+ connect(rf2, SIGNAL(toggled(bool)), SLOT(recordChanged2(bool)));
+ connect(rf3, SIGNAL(toggled(bool)), SLOT(recordChanged3(bool)));
+ connect(rf4, SIGNAL(toggled(bool)), SLOT(recordChanged4(bool)));
+ connect(rf5, SIGNAL(toggled(bool)), SLOT(recordChanged5(bool)));
+ connect(rf6, SIGNAL(toggled(bool)), SLOT(recordChanged6(bool)));
+ connect(rf7, SIGNAL(toggled(bool)), SLOT(recordChanged7(bool)));
+
+ tf1->setChecked(midiThruType & 1);
+ tf2->setChecked(midiThruType & 2);
+ tf3->setChecked(midiThruType & 4);
+ tf4->setChecked(midiThruType & 8);
+ tf5->setChecked(midiThruType & 16);
+ tf6->setChecked(midiThruType & 32);
+ tf7->setChecked(midiThruType & 64);
+ connect(tf1, SIGNAL(toggled(bool)), SLOT(thruChanged1(bool)));
+ connect(tf2, SIGNAL(toggled(bool)), SLOT(thruChanged2(bool)));
+ connect(tf3, SIGNAL(toggled(bool)), SLOT(thruChanged3(bool)));
+ connect(tf4, SIGNAL(toggled(bool)), SLOT(thruChanged4(bool)));
+ connect(tf5, SIGNAL(toggled(bool)), SLOT(thruChanged5(bool)));
+ connect(tf6, SIGNAL(toggled(bool)), SLOT(thruChanged6(bool)));
+ connect(tf7, SIGNAL(toggled(bool)), SLOT(thruChanged7(bool)));
+
+ cf1->setOn(midiInputChannel & 1);
+ cf2->setOn(midiInputChannel & 2);
+ cf3->setOn(midiInputChannel & 4);
+ cf4->setOn(midiInputChannel & 8);
+ cf5->setOn(midiInputChannel & 0x10);
+ cf6->setOn(midiInputChannel & 0x20);
+ cf7->setOn(midiInputChannel & 0x40);
+ cf8->setOn(midiInputChannel & 0x80);
+ cf9->setOn(midiInputChannel & 0x100);
+ cf10->setOn(midiInputChannel & 0x200);
+ cf11->setOn(midiInputChannel & 0x400);
+ cf12->setOn(midiInputChannel & 0x800);
+ cf13->setOn(midiInputChannel & 0x1000);
+ cf14->setOn(midiInputChannel & 0x2000);
+ cf15->setOn(midiInputChannel & 0x4000);
+ cf16->setOn(midiInputChannel & 0x8000);
+
+ connect(cb1, SIGNAL(activated(int)), SLOT(setCtrl1(int)));
+ connect(cb2, SIGNAL(activated(int)), SLOT(setCtrl2(int)));
+ connect(cb3, SIGNAL(activated(int)), SLOT(setCtrl3(int)));
+ connect(cb4, SIGNAL(activated(int)), SLOT(setCtrl4(int)));
+
+ connect(cf1, SIGNAL(toggled(bool)), SLOT(channelChanged1(bool)));
+ connect(cf2, SIGNAL(toggled(bool)), SLOT(channelChanged2(bool)));
+ connect(cf3, SIGNAL(toggled(bool)), SLOT(channelChanged3(bool)));
+ connect(cf4, SIGNAL(toggled(bool)), SLOT(channelChanged4(bool)));
+ connect(cf5, SIGNAL(toggled(bool)), SLOT(channelChanged5(bool)));
+ connect(cf6, SIGNAL(toggled(bool)), SLOT(channelChanged6(bool)));
+ connect(cf7, SIGNAL(toggled(bool)), SLOT(channelChanged7(bool)));
+ connect(cf8, SIGNAL(toggled(bool)), SLOT(channelChanged8(bool)));
+ connect(cf9, SIGNAL(toggled(bool)), SLOT(channelChanged9(bool)));
+ connect(cf10, SIGNAL(toggled(bool)), SLOT(channelChanged10(bool)));
+ connect(cf11, SIGNAL(toggled(bool)), SLOT(channelChanged11(bool)));
+ connect(cf12, SIGNAL(toggled(bool)), SLOT(channelChanged12(bool)));
+ connect(cf13, SIGNAL(toggled(bool)), SLOT(channelChanged13(bool)));
+ connect(cf14, SIGNAL(toggled(bool)), SLOT(channelChanged14(bool)));
+ connect(cf15, SIGNAL(toggled(bool)), SLOT(channelChanged15(bool)));
+ connect(cf16, SIGNAL(toggled(bool)), SLOT(channelChanged16(bool)));
+ }
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void MidiFilterConfig::closeEvent(QCloseEvent* ev)
+ {
+ emit hideWindow();
+ QWidget::closeEvent(ev);
+ }
+
+
diff --git a/muse2/muse/mplugins/midifilterimpl.h b/muse2/muse/mplugins/midifilterimpl.h
new file mode 100644
index 00000000..4ab722c1
--- /dev/null
+++ b/muse2/muse/mplugins/midifilterimpl.h
@@ -0,0 +1,92 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midifilterimpl.h,v 1.1.1.1 2003/10/27 18:52:40 wschweer Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MIDIFILTERIMP_H__
+#define __MIDIFILTERIMP_H__
+
+#include "globals.h"
+#include "midifilter.h"
+//Added by qt3to4:
+#include <QCloseEvent>
+
+//---------------------------------------------------------
+// MidiFilterConfig
+//---------------------------------------------------------
+
+class MidiFilterConfig : public MidiFilterConfigBase {
+ Q_OBJECT
+
+ void rChanged(bool f, int val) {
+ if (f)
+ midiRecordType |= val;
+ else
+ midiRecordType &= ~val;
+ }
+ void tChanged(bool f, int val) {
+ if (f)
+ midiThruType |= val;
+ else
+ midiThruType &= ~val;
+ }
+ void chChanged(bool f, int val) {
+ if (f)
+ midiInputChannel |= val;
+ else
+ midiInputChannel &= ~val;
+ }
+ virtual void closeEvent(QCloseEvent*);
+
+ signals:
+ void hideWindow();
+
+ private slots:
+ void channelChanged1(bool f) { chChanged(f, 0x01); }
+ void channelChanged2(bool f) { chChanged(f, 0x02); }
+ void channelChanged3(bool f) { chChanged(f, 0x04); }
+ void channelChanged4(bool f) { chChanged(f, 0x08); }
+ void channelChanged5(bool f) { chChanged(f, 0x10); }
+ void channelChanged6(bool f) { chChanged(f, 0x20); }
+ void channelChanged7(bool f) { chChanged(f, 0x40); }
+ void channelChanged8(bool f) { chChanged(f, 0x80); }
+ void channelChanged9(bool f) { chChanged(f, 0x100); }
+ void channelChanged10(bool f) { chChanged(f, 0x200); }
+ void channelChanged11(bool f) { chChanged(f, 0x400); }
+ void channelChanged12(bool f) { chChanged(f, 0x800); }
+ void channelChanged13(bool f) { chChanged(f, 0x1000); }
+ void channelChanged14(bool f) { chChanged(f, 0x2000); }
+ void channelChanged15(bool f) { chChanged(f, 0x4000); }
+ void channelChanged16(bool f) { chChanged(f, 0x8000); }
+
+ void recordChanged1(bool f) { rChanged(f, 1); }
+ void recordChanged2(bool f) { rChanged(f, 2); }
+ void recordChanged3(bool f) { rChanged(f, 4); }
+ void recordChanged4(bool f) { rChanged(f, 8); }
+ void recordChanged5(bool f) { rChanged(f, 16); }
+ void recordChanged6(bool f) { rChanged(f, 32); }
+ void recordChanged7(bool f) { rChanged(f, 64); }
+
+ void thruChanged1(bool f) { tChanged(f, 1); }
+ void thruChanged2(bool f) { tChanged(f, 2); }
+ void thruChanged3(bool f) { tChanged(f, 4); }
+ void thruChanged4(bool f) { tChanged(f, 8); }
+ void thruChanged5(bool f) { tChanged(f, 16); }
+ void thruChanged6(bool f) { tChanged(f, 32); }
+ void thruChanged7(bool f) { tChanged(f, 64); }
+
+ void setCtrl1(int);
+ void setCtrl2(int);
+ void setCtrl3(int);
+ void setCtrl4(int);
+
+ public:
+ MidiFilterConfig(QWidget* parent=0, const char* name=0);
+ };
+
+#endif
+
+
diff --git a/muse2/muse/mplugins/midiitransform.cpp b/muse2/muse/mplugins/midiitransform.cpp
new file mode 100644
index 00000000..f3eecece
--- /dev/null
+++ b/muse2/muse/mplugins/midiitransform.cpp
@@ -0,0 +1,1696 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midiitransform.cpp,v 1.2.2.2 2009/05/24 21:43:44 terminator356 Exp $
+//
+// (C) Copyright 2001-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <list>
+#include <qpushbutton.h>
+#include <q3buttongroup.h>
+#include <qlineedit.h>
+#include <qcombobox.h>
+#include <q3listbox.h>
+#include <qspinbox.h>
+#include <q3multilineedit.h>
+#include <qcheckbox.h>
+#include <qtoolbutton.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+
+#include "spinboxFP.h"
+#include "midi.h"
+#include "midictrl.h"
+#include "event.h"
+#include "mpevent.h"
+#include "midiitransform.h"
+#include "track.h"
+#include "song.h"
+#include "xml.h"
+#include "gconfig.h"
+#include "comboQuant.h"
+#include "pitchedit.h"
+
+#define MIDITRANSFORM_NOTE 0
+#define MIDITRANSFORM_POLY 1
+#define MIDITRANSFORM_CTRL 2
+#define MIDITRANSFORM_ATOUCH 3
+#define MIDITRANSFORM_PITCHBEND 4
+#define MIDITRANSFORM_NRPN 5
+#define MIDITRANSFORM_RPN 6
+
+static int selTypeTable[] = {
+ MIDITRANSFORM_NOTE, MIDITRANSFORM_POLY, MIDITRANSFORM_CTRL, MIDITRANSFORM_ATOUCH,
+ MIDITRANSFORM_PITCHBEND, MIDITRANSFORM_NRPN, MIDITRANSFORM_RPN
+ };
+
+static int procTypeTable[] = {
+ MIDITRANSFORM_POLY, MIDITRANSFORM_CTRL, MIDITRANSFORM_ATOUCH,
+ MIDITRANSFORM_PITCHBEND, MIDITRANSFORM_NRPN, MIDITRANSFORM_RPN
+ };
+
+static int procVal2Map[] = { 0, 1, 2, 3, 4, 5, 6, 7, 10, 11 };
+
+struct TDict {
+ TransformFunction id;
+ const QString text;
+ TDict(TransformFunction f, const QString& s) : id(f), text(s) {}
+ };
+
+static const TDict oplist[] = {
+ TDict(Transform, QString("Transform")),
+ TDict(Delete, QString("Filter"))
+ };
+
+//---------------------------------------------------------
+// MidiInputTransform
+//---------------------------------------------------------
+
+class MidiInputTransformation {
+ public:
+ QString name;
+ QString comment;
+
+ ValOp selEventOp;
+ int selType;
+
+ ValOp selVal1;
+ int selVal1a, selVal1b;
+ ValOp selVal2;
+ int selVal2a, selVal2b;
+ ValOp selPort;
+ int selPorta, selPortb;
+ ValOp selChannel;
+ int selChannela, selChannelb;
+
+ InputTransformProcEventOp procEvent;
+ int eventType;
+
+ TransformOperator procVal1;
+ int procVal1a, procVal1b;
+ TransformOperator procVal2;
+ int procVal2a, procVal2b;
+ TransformOperator procPort;
+ int procPorta, procPortb;
+ TransformOperator procChannel;
+ int procChannela, procChannelb;
+
+ TransformFunction funcOp;
+ int quantVal;
+
+ MidiInputTransformation(const QString& s) {
+ name = s;
+ selEventOp = All;
+ selType = MIDITRANSFORM_NOTE;
+ selVal1 = Ignore;
+ selVal1a = 0;
+ selVal1b = 0;
+ selVal2 = Ignore;
+ selVal2a = 0;
+ selVal2b = 0;
+ procEvent = KeepType;
+ eventType = MIDITRANSFORM_POLY;
+ procVal1 = Keep;
+ procVal1a = 0;
+ procVal1b = 0;
+ procVal2 = Keep;
+ procVal2a = 0;
+ procVal2b = 0;
+ funcOp = Transform;
+ quantVal = config.division;
+ selPort = Ignore;
+ selChannel = Ignore;
+ selChannela = 0;
+ selChannelb = 0;
+ procPort = Keep;
+ procChannel = Keep;
+ procPorta = 0;
+ procPortb = 0;
+ procChannela = 0;
+ procChannelb = 0;
+ }
+ void write(int level, Xml& xml) const;
+ int apply(MidiRecordEvent& ev) const;
+ bool typesMatch(MidiRecordEvent& e, int selType) const;
+ };
+
+typedef std::list<MidiInputTransformation*> MidiInputTransformationList;
+typedef std::list<MidiInputTransformation*>::iterator iMidiInputTransformation;
+typedef std::list<MidiInputTransformation*>::const_iterator ciMidiInputTransformation;
+
+// this is the list of defined transformations:
+static MidiInputTransformationList mtlist;
+
+// list of modules to apply:
+
+struct ITransModul {
+ bool valid;
+ MidiInputTransformation* transform;
+ };
+
+const int MIDI_INPUT_TRANSFORMATIONS = 4;
+static ITransModul modules[MIDI_INPUT_TRANSFORMATIONS];
+
+//---------------------------------------------------------
+// applyMidiInputTransformation
+// return false if event should be dropped
+// (filter)
+//---------------------------------------------------------
+
+bool applyMidiInputTransformation(MidiRecordEvent& event)
+ {
+ for (int i = 0; i < 4; ++i) {
+ if (modules[i].valid && modules[i].transform) {
+ int rv = modules[i].transform->apply(event);
+ if (rv == 1)
+ printf("drop input event\n");
+ if (rv)
+ return rv != 1;
+ }
+ }
+ return true;
+ }
+
+//---------------------------------------------------------
+// filterValOp
+//---------------------------------------------------------
+
+static bool filterValOp(ValOp op, int val, int val1, int val2)
+ {
+ switch (op) {
+ case Ignore:
+ break;
+ case Equal:
+ if (val != val1)
+ return true;
+ break;
+ case Unequal:
+ if (val == val1)
+ return true;
+ break;
+ case Higher:
+ if (val <= val1)
+ return true;
+ break;
+ case Lower:
+ if (val >= val1)
+ return true;
+ break;
+ case Inside:
+ if ((val < val1) || (val >= val2))
+ return true;
+ break;
+ case Outside:
+ if ((val >= val1) && (val < val2))
+ return true;
+ break;
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// apply
+// apply Select filter
+// return 0 - not applied
+// 1 - drop event
+// 2 - event changed
+//---------------------------------------------------------
+
+int MidiInputTransformation::apply(MidiRecordEvent& event) const
+ {
+ int t = event.type();
+
+ switch (selEventOp) {
+ case Equal:
+ switch(t) {
+ case ME_NOTEON:
+ case ME_NOTEOFF:
+ if (selType != MIDITRANSFORM_NOTE)
+ return 0;
+ break;
+ default:
+ if(!typesMatch(event, selType))
+ return 0;
+ break;
+ }
+ break;
+ case Unequal:
+ switch(event.type()) {
+ case ME_NOTEON:
+ case ME_NOTEOFF:
+ if (selType == MIDITRANSFORM_NOTE)
+ return 0;
+ break;
+ default:
+ if(typesMatch(event, selType))
+ return 0;
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ if (filterValOp(selVal1, event.dataA(), selVal1a, selVal1b))
+ return 0;
+ if (filterValOp(selVal2, event.dataB(), selVal2a, selVal2b))
+ return 0;
+ if (filterValOp(selPort, event.port(), selPorta, selPortb))
+ return 0;
+ if (filterValOp(selChannel, event.channel(), selChannela, selChannelb))
+ return 0;
+
+ if (funcOp == Delete)
+ return 1; // discard event
+
+ // transform event
+//printf("transform\n");
+ if (procEvent != KeepType)
+ {
+ switch(eventType)
+ {
+ case MIDITRANSFORM_POLY:
+ event.setType(ME_POLYAFTER);
+ break;
+ case MIDITRANSFORM_CTRL:
+ event.setType(ME_CONTROLLER);
+ break;
+ case MIDITRANSFORM_ATOUCH:
+ event.setType(ME_AFTERTOUCH);
+ break;
+ case MIDITRANSFORM_PITCHBEND:
+ {
+ event.setType(ME_PITCHBEND);
+ }
+ break;
+ case MIDITRANSFORM_NRPN:
+ {
+ event.setA(MidiController::NRPN);
+ event.setType(ME_CONTROLLER);
+ }
+ break;
+ case MIDITRANSFORM_RPN:
+ {
+ event.setA(MidiController::RPN);
+ event.setType(ME_CONTROLLER);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ //---------------------------------------------------
+ // transform value A
+ //---------------------------------------------------
+
+ int val = event.dataA();
+ switch (procVal1) {
+ case Keep:
+ break;
+ case Plus:
+ val += procVal1a;
+ break;
+ case Minus:
+ val -= procVal1a;
+ break;
+ case Multiply:
+ val = int(val * (procVal1a/100.0) + .5);
+ break;
+ case Divide:
+ val = int(val / (procVal1a/100.0) + .5);
+ break;
+ case Fix:
+ val = procVal1a;
+ break;
+ case Value:
+ val = procVal2a;
+ break;
+ case Invert:
+ val = 127 - val;
+ break;
+ case ScaleMap:
+ printf("scale map not implemented\n");
+ break;
+ case Flip:
+ val = procVal1a - val;
+ break;
+ case Dynamic: // "crescendo"
+ printf("transform not implemented\n");
+ break;
+ case Random:
+ {
+ int range = procVal1b - procVal1a;
+ if (range > 0)
+ val = (rand() % range) + procVal1a;
+ else if (range < 0)
+ val = (rand() % -range) + procVal1b;
+ else
+ val = procVal1a;
+ }
+ break;
+ }
+ if (val < 0)
+ val = 0;
+ if (val > 127)
+ val = 127;
+ event.setA(val);
+
+ //---------------------------------------------------
+ // transform value B
+ //---------------------------------------------------
+
+ val = event.dataB();
+ switch (procVal2) {
+ case Plus:
+ val += procVal2a;
+ break;
+ case Minus:
+ val -= procVal2a;
+ break;
+ case Multiply:
+ val = int(val * (procVal2a/100.0) + .5);
+ break;
+ case Divide:
+ val = int(val / (procVal2a/100.0) + .5);
+ break;
+ case Fix:
+ val = procVal2a;
+ break;
+ case Value:
+ val = procVal1a;
+ break;
+ case Invert:
+ val = 127 - val;
+ break;
+ case Dynamic:
+ printf("transform not implemented\n");
+ break;
+ case Random:
+ {
+ int range = procVal2b - procVal2a;
+ if (range > 0)
+ val = (rand() % range) + procVal2a;
+ else if (range < 0)
+ val = (rand() % -range) + procVal2b;
+ else
+ val = procVal2a;
+ }
+ break;
+ case ScaleMap:
+ case Keep:
+ case Flip:
+ break;
+ }
+ if (val < 0)
+ val = 0;
+ if (val > 127)
+ val = 127;
+ event.setB(val);
+
+ //---------------------------------------------------
+ // transform port
+ //---------------------------------------------------
+
+ val = event.port();
+ switch (procPort) {
+ case Plus:
+ val += procPorta;
+ break;
+ case Minus:
+ val -= procPorta;
+ break;
+ case Multiply:
+ val = int(val * (procPorta/100.0) + .5);
+ break;
+ case Divide:
+ val = int(val / (procPorta/100.0) + .5);
+ break;
+ case Fix:
+ val = procPorta;
+ break;
+ case Value:
+ val = procPorta;
+ break;
+ case Invert:
+ val = 15 - val;
+ break;
+ case Dynamic:
+ printf("transform not implemented\n");
+ break;
+ case Random:
+ {
+ int range = procPortb - procPorta;
+ if (range > 0)
+ val = (rand() % range) + procPorta;
+ else if (range < 0)
+ val = (rand() % -range) + procPortb;
+ else
+ val = procPorta;
+ }
+ break;
+ case ScaleMap:
+ case Keep:
+ case Flip:
+ break;
+ }
+ if (val < 0)
+ val = 0;
+ if (val > 15)
+ val = 15;
+ event.setPort(val);
+
+ //---------------------------------------------------
+ // transform channel
+ //---------------------------------------------------
+
+ val = event.channel();
+ switch (procChannel) {
+ case Plus:
+ val += procChannela;
+ break;
+ case Minus:
+ val -= procChannela;
+ break;
+ case Multiply:
+ val = int(val * (procChannela/100.0) + .5);
+ break;
+ case Divide:
+ val = int(val / (procChannela/100.0) + .5);
+ break;
+ case Fix:
+ val = procChannela;
+ break;
+ case Value:
+ val = procChannela;
+ break;
+ case Invert:
+ val = 16 - val;
+ break;
+ case Dynamic:
+ printf("transform not implemented\n");
+ break;
+ case Random:
+ {
+ int range = procChannelb - procChannela;
+ if (range > 0)
+ val = (rand() % range) + procChannela;
+ else if (range < 0)
+ val = (rand() % -range) + procChannelb;
+ else
+ val = procChannela;
+ }
+ break;
+ case ScaleMap:
+ case Keep:
+ case Flip:
+ break;
+ }
+ if (val < 0)
+ val = 0;
+ if (val > 15)
+ val = 15;
+ event.setChannel(val);
+
+ return 2;
+ }
+
+//---------------------------------------------------------
+// typesMatch
+//---------------------------------------------------------
+
+bool MidiInputTransformation::typesMatch(MidiRecordEvent& e, int selType) const
+ {
+ bool matched = false;
+ int t = e.type();
+ switch (selType)
+ {
+ case MIDITRANSFORM_NOTE:
+ matched = ((t == ME_NOTEON) || (t == ME_NOTEOFF));
+ break;
+ case MIDITRANSFORM_POLY:
+ matched = (t == ME_POLYAFTER);
+ break;
+ case MIDITRANSFORM_CTRL:
+ matched = (t == ME_CONTROLLER);
+ break;
+ case MIDITRANSFORM_ATOUCH:
+ matched = (t == ME_AFTERTOUCH);
+ break;
+ case MIDITRANSFORM_PITCHBEND:
+ {
+ //if (t == ME_CONTROLLER) {
+ // MidiController::ControllerType c = midiControllerType(e.dataA());
+ // matched = (c == MidiController::Pitch);
+ matched = (t = ME_PITCHBEND);
+ }
+ break;
+ case MIDITRANSFORM_NRPN:
+ {
+ if (t == ME_CONTROLLER) {
+ MidiController::ControllerType c = midiControllerType(e.dataA());
+ matched = (c == MidiController::NRPN);
+ }
+ }
+ break;
+ case MIDITRANSFORM_RPN:
+ {
+ if (t == ME_CONTROLLER) {
+ MidiController::ControllerType c = midiControllerType(e.dataA());
+ matched = (c == MidiController::RPN);
+ }
+ }
+ break;
+ default:
+ fprintf(stderr, "Error matching type in MidiTransformerDialog: unknown eventtype!\n");
+ break;
+ }
+ //printf("Event type=%d, selType =%d matched=%d\n", e.type(), selType, matched);
+ return matched;
+ }
+
+//---------------------------------------------------------
+// MidiInputTransformDialog
+// Widgets:
+// presetList nameEntry commentEntry
+// selEventOp selType
+// selVal1Op selVal1a selVal1b
+// selVal2Op selVal2a selVal2b
+//
+// procEventOp procType
+// procVal1Op procVal1a procVal1b
+// procVal2Op procVal2a procVal2b
+// funcOp funcQuantVal
+// buttonNew buttonDelete
+//
+// modulGroup
+// modul1select modul1enable
+// modul2select modul2enable
+// modul3select modul3enable
+// modul4select modul4enable
+//
+// selPortOp selPortVala selPortValb
+// selChannelOp selChannelVala selChannelValb
+//
+// procPortOp procPortVala procPortValb
+// procChannelOp procChannelVala procChannelValb
+//---------------------------------------------------------
+
+MidiInputTransformDialog::MidiInputTransformDialog(QWidget* parent,
+ const char* name, bool modal, Qt::WFlags fl)
+ : MidiInputTransformDialogBase(parent, name, modal, fl)
+ {
+ cindex = 0;
+ cmodul = 0;
+ cmt = 0;
+
+ for (unsigned i = 0; i < sizeof(oplist)/sizeof(*oplist); ++i)
+ funcOp->insertItem(oplist[i].text, i);
+
+ connect(buttonNew, SIGNAL(clicked()), SLOT(presetNew()));
+ connect(buttonDelete, SIGNAL(clicked()), SLOT(presetDelete()));
+ connect(selEventOp, SIGNAL(activated(int)), SLOT(selEventOpSel(int)));
+ connect(selType, SIGNAL(activated(int)), SLOT(selTypeSel(int)));
+ connect(selVal1Op, SIGNAL(activated(int)), SLOT(selVal1OpSel(int)));
+ connect(selVal2Op, SIGNAL(activated(int)), SLOT(selVal2OpSel(int)));
+ connect(procEventOp, SIGNAL(activated(int)), SLOT(procEventOpSel(int)));
+ connect(procType, SIGNAL(activated(int)), SLOT(procEventTypeSel(int)));
+ connect(procVal1Op, SIGNAL(activated(int)), SLOT(procVal1OpSel(int)));
+ connect(procVal2Op, SIGNAL(activated(int)), SLOT(procVal2OpSel(int)));
+ connect(funcOp, SIGNAL(activated(int)), SLOT(funcOpSel(int)));
+ connect(presetList, SIGNAL(highlighted(Q3ListBoxItem*)),
+ SLOT(presetChanged(Q3ListBoxItem*)));
+ connect(nameEntry, SIGNAL(textChanged(const QString&)),
+ SLOT(nameChanged(const QString&)));
+ connect(commentEntry, SIGNAL(textChanged()), SLOT(commentChanged()));
+
+ connect(selVal1a, SIGNAL(valueChanged(int)), SLOT(selVal1aChanged(int)));
+ connect(selVal1b, SIGNAL(valueChanged(int)), SLOT(selVal1bChanged(int)));
+ connect(selVal2a, SIGNAL(valueChanged(int)), SLOT(selVal2aChanged(int)));
+ connect(selVal2b, SIGNAL(valueChanged(int)), SLOT(selVal2bChanged(int)));
+ connect(procVal1a, SIGNAL(valueChanged(int)), SLOT(procVal1aChanged(int)));
+ connect(procVal1b, SIGNAL(valueChanged(int)), SLOT(procVal1bChanged(int)));
+ connect(procVal2a, SIGNAL(valueChanged(int)), SLOT(procVal2aChanged(int)));
+ connect(procVal2b, SIGNAL(valueChanged(int)), SLOT(procVal2bChanged(int)));
+
+ connect(modul1enable, SIGNAL(toggled(bool)), SLOT(modul1enableChanged(bool)));
+ connect(modul2enable, SIGNAL(toggled(bool)), SLOT(modul2enableChanged(bool)));
+ connect(modul3enable, SIGNAL(toggled(bool)), SLOT(modul3enableChanged(bool)));
+ connect(modul4enable, SIGNAL(toggled(bool)), SLOT(modul4enableChanged(bool)));
+ connect(modulGroup, SIGNAL(clicked(int)), SLOT(changeModul(int)));
+
+ connect(selPortOp, SIGNAL(activated(int)), SLOT(selPortOpSel(int)));
+ connect(selPortVala, SIGNAL(valueChanged(int)), SLOT(selPortValaChanged(int)));
+ connect(selPortValb, SIGNAL(valueChanged(int)), SLOT(selPortValbChanged(int)));
+
+ connect(selChannelOp, SIGNAL(activated(int)), SLOT(selChannelOpSel(int)));
+ connect(selChannelVala, SIGNAL(valueChanged(int)), SLOT(selChannelValaChanged(int)));
+ connect(selChannelValb, SIGNAL(valueChanged(int)), SLOT(selChannelValbChanged(int)));
+
+ connect(procPortOp, SIGNAL(activated(int)), SLOT(procPortOpSel(int)));
+ connect(procPortVala, SIGNAL(valueChanged(int)), SLOT(procPortValaChanged(int)));
+ connect(procPortValb, SIGNAL(valueChanged(int)), SLOT(procPortValbChanged(int)));
+
+ connect(procChannelOp, SIGNAL(activated(int)), SLOT(procChannelOpSel(int)));
+ connect(procChannelVala, SIGNAL(valueChanged(int)), SLOT(procChannelValaChanged(int)));
+ connect(procChannelValb, SIGNAL(valueChanged(int)), SLOT(procChannelValbChanged(int)));
+
+ //---------------------------------------------------
+ // populate preset list
+ //---------------------------------------------------
+
+ updatePresetList();
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::songChanged(int flags)
+{
+ // Whenever a song is loaded, flags is -1. Since transforms are part of configuration,
+ // use SC_CONFIG here, to filter unwanted song change events.
+ if(flags & SC_CONFIG)
+ updatePresetList();
+}
+
+//---------------------------------------------------------
+// updatePresetList
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::updatePresetList()
+{
+ cmt = 0;
+ presetList->clear();
+
+ modul1select->setOn(true);
+ for (iMidiInputTransformation i = mtlist.begin(); i != mtlist.end(); ++i) {
+ presetList->insertItem((*i)->name);
+ if (cmt == 0)
+ cmt = *i;
+ }
+ if (cmt == 0) {
+ // create default "New" preset
+ cmt = new MidiInputTransformation(tr("New"));
+ mtlist.push_back(cmt);
+ presetList->insertItem(tr("New"));
+ presetList->setCurrentItem(0);
+ }
+ changeModul(0);
+
+ modul1enable->setChecked(modules[0].valid);
+ modul2enable->setChecked(modules[1].valid);
+ modul3enable->setChecked(modules[2].valid);
+ modul4enable->setChecked(modules[3].valid);
+}
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::closeEvent(QCloseEvent* ev)
+ {
+ emit hideWindow();
+ QWidget::closeEvent(ev);
+ }
+
+//---------------------------------------------------------
+// writeMidiTransforms
+//---------------------------------------------------------
+
+void writeMidiInputTransforms(int level, Xml& xml)
+ {
+ for (iMidiInputTransformation i = mtlist.begin(); i != mtlist.end(); ++i) {
+ (*i)->write(level, xml);
+ }
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void MidiInputTransformation::write(int level, Xml& xml) const
+ {
+ xml.tag(level++, "midiInputTransform");
+ xml.strTag(level, "name", name);
+ xml.strTag(level, "comment", comment);
+ xml.intTag(level, "function", int(funcOp));
+
+ // apply this transformation?
+ for (int i = 0; i < MIDI_INPUT_TRANSFORMATIONS; ++i) {
+ if (modules[i].transform == this) {
+ xml.intTag(level, "apply", int(modules[i].valid));
+ break;
+ }
+ }
+ if (funcOp == Quantize) {
+ xml.intTag(level, "quantVal", quantVal);
+ }
+ if (funcOp == Transform || funcOp == Insert) {
+ if (procEvent != KeepType) {
+ xml.intTag(level, "procEventOp", int(procEvent));
+ xml.intTag(level, "eventType", int(eventType));
+ }
+ if (procVal1 != Keep) {
+ xml.intTag(level, "procVal1Op", int(procVal1));
+ xml.intTag(level, "procVal1a", procVal1a);
+ xml.intTag(level, "procVal1b", procVal1b);
+ }
+ if (procVal2 != Keep) {
+ xml.intTag(level, "procVal2Op", int(procVal2));
+ xml.intTag(level, "procVal2a", procVal2a);
+ xml.intTag(level, "procVal2b", procVal2b);
+ }
+ if (procPort != Keep) {
+ xml.intTag(level, "procPortOp", int(procPort));
+ xml.intTag(level, "procPorta", procPorta);
+ xml.intTag(level, "procPortb", procPortb);
+ }
+ if (procChannel != Keep) {
+ xml.intTag(level, "procChannelOp", int(procChannel));
+ xml.intTag(level, "procChannela", procChannela);
+ xml.intTag(level, "procChannelb", procChannelb);
+ }
+ }
+ if (selEventOp != Ignore) {
+ xml.intTag(level, "selEventOp", int(selEventOp));
+ xml.intTag(level, "selEventType", int(selType));
+ }
+ if (selVal1 != Ignore) {
+ xml.intTag(level, "selVal1Op", int(selVal1));
+ xml.intTag(level, "selVal1a", selVal1a);
+ xml.intTag(level, "selVal1b", selVal1b);
+ }
+ if (selVal2 != Ignore) {
+ xml.intTag(level, "selVal2Op", int(selVal2));
+ xml.intTag(level, "selVal2a", selVal2a);
+ xml.intTag(level, "selVal2b", selVal2b);
+ }
+ if (selPort != Ignore) {
+ xml.intTag(level, "selPortOp", int(selPort));
+ xml.intTag(level, "selPorta", selPorta);
+ xml.intTag(level, "selPortb", selPortb);
+ }
+ if (selChannel != Ignore) {
+ xml.intTag(level, "selChannelOp", int(selChannel));
+ xml.intTag(level, "selChannela", selChannela);
+ xml.intTag(level, "selChannelb", selChannelb);
+ }
+ xml.etag(level, "midiInputTransform");
+ }
+
+//---------------------------------------------------------
+// readMidiTransform
+//---------------------------------------------------------
+
+void readMidiInputTransform(Xml& xml)
+ {
+ MidiInputTransformation trans(QString("new"));
+ int apply = -1;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "name")
+ trans.name = xml.parse1();
+ else if (tag == "comment")
+ trans.comment = xml.parse1();
+ else if (tag == "function")
+ trans.funcOp = TransformFunction(xml.parseInt());
+ else if (tag == "quantVal")
+ trans.quantVal = xml.parseInt();
+ else if (tag == "procEventOp")
+ trans.procEvent = InputTransformProcEventOp(xml.parseInt());
+ else if (tag == "eventType")
+ trans.eventType = xml.parseInt();
+ else if (tag == "procVal1Op")
+ trans.procVal1 = TransformOperator(xml.parseInt());
+ else if (tag == "procVal1a")
+ trans.procVal1a = xml.parseInt();
+ else if (tag == "procVal1b")
+ trans.procVal1b = xml.parseInt();
+ else if (tag == "procVal2Op")
+ trans.procVal2 = TransformOperator(xml.parseInt());
+ else if (tag == "procVal2a")
+ trans.procVal2a = xml.parseInt();
+ else if (tag == "procVal2b")
+ trans.procVal2b = xml.parseInt();
+ else if (tag == "selEventOp")
+ trans.selEventOp = ValOp(xml.parseInt());
+ else if (tag == "selEventType")
+ trans.selType = xml.parseInt();
+ else if (tag == "selVal1Op")
+ trans.selVal1 = ValOp(xml.parseInt());
+ else if (tag == "selVal1a")
+ trans.selVal1a = xml.parseInt();
+ else if (tag == "selVal1b")
+ trans.selVal1b = xml.parseInt();
+ else if (tag == "selVal2Op")
+ trans.selVal2 = ValOp(xml.parseInt());
+ else if (tag == "selVal2a")
+ trans.selVal2a = xml.parseInt();
+ else if (tag == "selVal2b")
+ trans.selVal2b = xml.parseInt();
+
+ else if (tag == "procPortOp")
+ trans.procPort = TransformOperator(xml.parseInt());
+ else if (tag == "procPorta")
+ trans.procPorta = xml.parseInt();
+ else if (tag == "procPortb")
+ trans.procPortb = xml.parseInt();
+ else if (tag == "procChannelOp")
+ trans.procChannel = TransformOperator(xml.parseInt());
+ else if (tag == "procChannela")
+ trans.procChannela = xml.parseInt();
+ else if (tag == "procChannelb")
+ trans.procChannelb = xml.parseInt();
+
+ else if (tag == "selPortOp")
+ trans.selPort = ValOp(xml.parseInt());
+ else if (tag == "selPorta")
+ trans.selPorta = xml.parseInt();
+ else if (tag == "selPortb")
+ trans.selPortb = xml.parseInt();
+ else if (tag == "selChannelOp")
+ trans.selChannel = ValOp(xml.parseInt());
+ else if (tag == "selChannela")
+ trans.selChannela = xml.parseInt();
+ else if (tag == "selChannelb")
+ trans.selChannelb = xml.parseInt();
+
+ else if (tag == "apply")
+ apply = xml.parseInt();
+ else
+ xml.unknown("midiInputTransform");
+ break;
+ case Xml::TagEnd:
+ if (xml.s1() == "midiInputTransform") {
+// printf("midi Input transform <%s> apply %d\n",
+// trans.name.latin1(), apply);
+
+ // By T356. A previous bug caused some .med files to grow very large
+ // with duplicate transforms. Here we can eliminate those duplicates.
+ for(iMidiInputTransformation i = mtlist.begin(); i != mtlist.end(); ++i)
+ {
+ if((*i)->name == trans.name)
+ {
+ return;
+ }
+ }
+
+ MidiInputTransformation* t = new MidiInputTransformation(trans);
+ // search free slot in modules
+ if (apply != -1) {
+ for (int i = 0; i < MIDI_INPUT_TRANSFORMATIONS; ++i) {
+ if (modules[i].transform == 0) {
+ modules[i].transform = t;
+ modules[i].valid = apply;
+ break;
+ }
+ }
+ }
+ mtlist.push_back(t);
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// clearMidiInputTransforms
+//---------------------------------------------------------
+
+void clearMidiInputTransforms()
+{
+ for (int i = 0; i < MIDI_INPUT_TRANSFORMATIONS; ++i)
+ {
+ modules[i].transform = 0;
+ modules[i].valid = false;
+ }
+ for (iMidiInputTransformation i = mtlist.begin(); i != mtlist.end(); ++i)
+ {
+ MidiInputTransformation* t = *i;
+ if(t)
+ delete t;
+ }
+ mtlist.clear();
+}
+
+//---------------------------------------------------------
+// accept
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::accept()
+ {
+ reject();
+ }
+
+//---------------------------------------------------------
+// reject
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::reject()
+ {
+ close(false);
+ }
+
+//---------------------------------------------------------
+// setValOp
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::setValOp(QWidget* a, QWidget* b, ValOp op)
+ {
+ switch (op) {
+ case Ignore:
+ a->setEnabled(false);
+ b->setEnabled(false);
+ break;
+ case Equal:
+ case Unequal:
+ case Higher:
+ case Lower:
+ a->setEnabled(true);
+ b->setEnabled(false);
+ break;
+ case Inside:
+ case Outside:
+ a->setEnabled(true);
+ b->setEnabled(true);
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// selEventOpSel
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::selEventOpSel(int val)
+ {
+ selType->setEnabled(val != All);
+ cmt->selEventOp = ValOp(val);
+ selVal1aChanged(cmt->selVal1a);
+ selVal1bChanged(cmt->selVal1b);
+ }
+
+//---------------------------------------------------------
+// selTypeSel
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::selTypeSel(int val)
+ {
+ cmt->selType = selTypeTable[val];
+ selVal1aChanged(cmt->selVal1a);
+ selVal1bChanged(cmt->selVal1b);
+ }
+
+//---------------------------------------------------------
+// selVal1OpSel
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::selVal1OpSel(int val)
+ {
+ setValOp(selVal1a, selVal1b, ValOp(val));
+ cmt->selVal1 = ValOp(val);
+ }
+
+//---------------------------------------------------------
+// selVal2OpSel
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::selVal2OpSel(int val)
+ {
+ setValOp(selVal2a, selVal2b, ValOp(val));
+ cmt->selVal2 = ValOp(val);
+ }
+
+//---------------------------------------------------------
+// procEventOpSel
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::procEventOpSel(int val)
+ {
+ InputTransformProcEventOp op = val == 0 ? KeepType : FixType;
+ procType->setEnabled(op == FixType);
+ cmt->procEvent = op;
+
+ procVal1aChanged(cmt->procVal1a);
+ procVal1bChanged(cmt->procVal1b);
+ }
+
+//---------------------------------------------------------
+// procEventTypeSel
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::procEventTypeSel(int val)
+ {
+ cmt->eventType = procTypeTable[val];
+ procVal1aChanged(cmt->procVal1a);
+ procVal1bChanged(cmt->procVal1b);
+ }
+
+//---------------------------------------------------------
+// procVal1OpSel
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::procVal1OpSel(int val)
+ {
+ cmt->procVal1 = TransformOperator(val);
+ switch(TransformOperator(val)) {
+ case Keep:
+ case Invert:
+ procVal1a->setEnabled(false);
+ procVal1b->setEnabled(false);
+ break;
+ case Multiply:
+ case Divide:
+ procVal1a->setEnabled(true);
+ procVal1a->setPrecision(2);
+ procVal1b->setEnabled(false);
+ break;
+ case Plus:
+ case Minus:
+ case Fix:
+ case Value:
+ case Flip:
+ procVal1a->setPrecision(0);
+ procVal1a->setEnabled(true);
+ procVal1b->setEnabled(false);
+ break;
+ case Random:
+ case ScaleMap:
+ case Dynamic:
+ procVal1a->setPrecision(0);
+ procVal1a->setEnabled(true);
+ procVal1b->setEnabled(true);
+ break;
+ }
+ procVal1aChanged(cmt->procVal1a);
+ procVal1bChanged(cmt->procVal1b);
+ }
+
+//---------------------------------------------------------
+// procVal2OpSel
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::procVal2OpSel(int val)
+ {
+ TransformOperator op = TransformOperator(procVal2Map[val]);
+ cmt->procVal2 = op;
+
+ switch (op) {
+ case Keep:
+ case Invert:
+ procVal2a->setEnabled(false);
+ procVal2b->setEnabled(false);
+ break;
+ case Multiply:
+ case Divide:
+ procVal2a->setEnabled(true);
+ procVal2a->setPrecision(2);
+ procVal2b->setEnabled(false);
+ break;
+ case Plus:
+ case Minus:
+ case Fix:
+ case Value:
+ procVal2a->setPrecision(0);
+ procVal2a->setEnabled(true);
+ procVal2b->setEnabled(false);
+ break;
+ case Random:
+ case Dynamic:
+ procVal2a->setPrecision(0);
+ procVal2a->setEnabled(true);
+ procVal2b->setEnabled(true);
+ break;
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// funcOpSel
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::funcOpSel(int val)
+ {
+ TransformFunction op = oplist[val].id;
+
+ bool isFuncOp(op == Transform);
+
+ procEventOp->setEnabled(isFuncOp);
+ procType->setEnabled(isFuncOp);
+ procVal1Op->setEnabled(isFuncOp);
+ procVal1a->setEnabled(isFuncOp);
+ procVal1b->setEnabled(isFuncOp);
+ procVal2Op->setEnabled(isFuncOp);
+ procVal2a->setEnabled(isFuncOp);
+ procVal2b->setEnabled(isFuncOp);
+ procPortOp->setEnabled(isFuncOp);
+ procPortVala->setEnabled(isFuncOp);
+ procPortValb->setEnabled(isFuncOp);
+ procChannelOp->setEnabled(isFuncOp);
+ procChannelVala->setEnabled(isFuncOp);
+ procChannelValb->setEnabled(isFuncOp);
+ if (isFuncOp) {
+ procEventOpSel(cmt->procEvent);
+ procVal1OpSel(cmt->procVal1);
+ procVal2OpSel(cmt->procVal2);
+ procPortOpSel(cmt->procPort);
+ procChannelOpSel(cmt->procChannel);
+ }
+ cmt->funcOp = op;
+ }
+
+//---------------------------------------------------------
+// presetNew
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::presetNew()
+ {
+ QString name;
+ for (int i = 0;; ++i) {
+ name.sprintf("New-%d", i);
+ iMidiInputTransformation imt;
+ for (imt = mtlist.begin(); imt != mtlist.end(); ++imt) {
+ if (name == (*imt)->name)
+ break;
+ }
+ if (imt == mtlist.end())
+ break;
+ }
+ MidiInputTransformation* mt = new MidiInputTransformation(name);
+ Q3ListBoxText* lbi = new Q3ListBoxText(presetList, name);
+ mtlist.push_back(mt);
+ presetList->setCurrentItem(lbi);
+ }
+
+//---------------------------------------------------------
+// presetDelete
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::presetDelete()
+ {
+ if (cindex != -1) {
+ iMidiInputTransformation mt = mtlist.begin();
+ for (int i = 0; i < cindex; ++i, ++mt) {
+ mtlist.erase(mt);
+ presetList->removeItem(cindex);
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// nameChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::nameChanged(const QString& s)
+ {
+ cmt->name = s;
+ Q3ListBoxItem* item = presetList->item(cindex);
+ if (s != item->text()) {
+ disconnect(presetList, SIGNAL(highlighted(Q3ListBoxItem*)),
+ this, SLOT(presetChanged(Q3ListBoxItem*)));
+ presetList->changeItem(s, cindex);
+ connect(presetList, SIGNAL(highlighted(Q3ListBoxItem*)),
+ SLOT(presetChanged(Q3ListBoxItem*)));
+ }
+ }
+
+//---------------------------------------------------------
+// commentChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::commentChanged()
+ {
+ cmt->comment = commentEntry->text();
+ }
+
+//---------------------------------------------------------
+// selVal1aChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::selVal1aChanged(int val)
+ {
+ cmt->selVal1a = val;
+ if ((cmt->selEventOp != All)
+ && (cmt->selType == MIDITRANSFORM_NOTE)) {
+ selVal1a->setSuffix(" - " + pitch2string(val));
+ }
+ else
+ selVal1a->setSuffix(QString(""));
+ }
+
+//---------------------------------------------------------
+// selVal1bChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::selVal1bChanged(int val)
+ {
+ cmt->selVal1b = val;
+ if ((cmt->selEventOp != All)
+ && (cmt->selType == MIDITRANSFORM_NOTE)) {
+ selVal1b->setSuffix(" - " + pitch2string(val));
+ }
+ else
+ selVal1b->setSuffix(QString(""));
+ }
+
+//---------------------------------------------------------
+// selVal2aChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::selVal2aChanged(int val)
+ {
+ cmt->selVal2a = val;
+ }
+
+//---------------------------------------------------------
+// selVal2bChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::selVal2bChanged(int val)
+ {
+ cmt->selVal2b = val;
+ }
+
+//---------------------------------------------------------
+// procVal1aChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::procVal1aChanged(int val)
+ {
+ cmt->procVal1a = val;
+
+ if((cmt->procEvent == KeepType && cmt->selType == MIDITRANSFORM_NOTE) &&
+ (cmt->procVal1 == Fix || cmt->procVal1 == ScaleMap || cmt->procVal1 == Dynamic ||
+ cmt->procVal1 == Random || cmt->procVal1 == Flip))
+ {
+ procVal1a->setSuffix(" - " + pitch2string(val));
+ }
+ else
+ procVal1a->setSuffix(QString(""));
+ }
+
+//---------------------------------------------------------
+// procVal1bChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::procVal1bChanged(int val)
+ {
+ cmt->procVal1b = val;
+
+ if((cmt->procEvent == KeepType && cmt->selType == MIDITRANSFORM_NOTE) &&
+ (cmt->procVal1 == Fix || cmt->procVal1 == ScaleMap || cmt->procVal1 == Dynamic ||
+ cmt->procVal1 == Random || cmt->procVal1 == Flip))
+ {
+ procVal1b->setSuffix(" - " + pitch2string(val));
+ }
+ else
+ procVal1b->setSuffix(QString(""));
+ }
+
+//---------------------------------------------------------
+// procVal2aChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::procVal2aChanged(int val)
+ {
+ cmt->procVal2a = val;
+ }
+
+//---------------------------------------------------------
+// procVal2bChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::procVal2bChanged(int val)
+ {
+ cmt->procVal2b = val;
+ }
+
+//---------------------------------------------------------
+// modul1enableChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::modul1enableChanged(bool val)
+ {
+ modules[0].valid = val;
+ }
+
+//---------------------------------------------------------
+// modul2enableChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::modul2enableChanged(bool val)
+ {
+ modules[1].valid = val;
+ }
+
+//---------------------------------------------------------
+// modul3enableChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::modul3enableChanged(bool val)
+ {
+ modules[2].valid = val;
+ }
+
+//---------------------------------------------------------
+// modul4enableChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::modul4enableChanged(bool val)
+ {
+ modules[3].valid = val;
+ }
+
+//---------------------------------------------------------
+// selPortOpSel
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::selPortOpSel(int val)
+ {
+ setValOp(selPortVala, selPortValb, ValOp(val));
+ cmt->selPort = ValOp(val);
+ }
+
+//---------------------------------------------------------
+// selPortValaChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::selPortValaChanged(int val)
+ {
+ cmt->selPorta = val;
+ }
+
+//---------------------------------------------------------
+// selPortValbChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::selPortValbChanged(int val)
+ {
+ cmt->selPortb = val;
+ }
+
+//---------------------------------------------------------
+// selChannelOpSel
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::selChannelOpSel(int val)
+ {
+ setValOp(selChannelVala, selChannelValb, ValOp(val));
+ cmt->selChannel = ValOp(val);
+ }
+
+//---------------------------------------------------------
+// selChannelValaChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::selChannelValaChanged(int val)
+ {
+ cmt->selChannela = val;
+ }
+
+//---------------------------------------------------------
+// selChannelValbChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::selChannelValbChanged(int val)
+ {
+ cmt->selChannelb = val;
+ }
+
+//---------------------------------------------------------
+// procPortOpSel
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::procPortOpSel(int val)
+ {
+ cmt->procPort = TransformOperator(val);
+ switch(TransformOperator(val)) {
+ case Keep:
+ case Invert:
+ procPortVala->setEnabled(false);
+ procPortValb->setEnabled(false);
+ break;
+ case Multiply:
+ case Divide:
+ procPortVala->setEnabled(true);
+ procPortVala->setPrecision(2);
+ procPortValb->setEnabled(false);
+ break;
+ case Plus:
+ case Minus:
+ case Fix:
+ case Value:
+ case Flip:
+ procPortVala->setPrecision(0);
+ procPortVala->setEnabled(true);
+ procPortValb->setEnabled(false);
+ break;
+ case Random:
+ case ScaleMap:
+ case Dynamic:
+ procPortVala->setPrecision(0);
+ procPortVala->setEnabled(true);
+ procPortValb->setEnabled(true);
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// procPortValaChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::procPortValaChanged(int val)
+ {
+ cmt->procPorta = val;
+ }
+
+//---------------------------------------------------------
+// procPortValbChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::procPortValbChanged(int val)
+ {
+ cmt->procPortb = val;
+ }
+
+//---------------------------------------------------------
+// procChannelOpSel
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::procChannelOpSel(int val)
+ {
+ cmt->procChannel = TransformOperator(val);
+ switch(TransformOperator(val)) {
+ case Keep:
+ case Invert:
+ procChannelVala->setEnabled(false);
+ procChannelValb->setEnabled(false);
+ break;
+ case Multiply:
+ case Divide:
+ procChannelVala->setEnabled(true);
+ procChannelVala->setPrecision(2);
+ procChannelValb->setEnabled(false);
+ break;
+ case Plus:
+ case Minus:
+ case Fix:
+ case Value:
+ case Flip:
+ procChannelVala->setPrecision(0);
+ procChannelVala->setEnabled(true);
+ procChannelValb->setEnabled(false);
+ break;
+ case Random:
+ case ScaleMap:
+ case Dynamic:
+ procChannelVala->setPrecision(0);
+ procChannelVala->setEnabled(true);
+ procChannelValb->setEnabled(true);
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// procChannelValaChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::procChannelValaChanged(int val)
+ {
+ cmt->procChannela = val;
+ }
+
+//---------------------------------------------------------
+// procChannelValbChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::procChannelValbChanged(int val)
+ {
+ cmt->procChannelb = val;
+ }
+
+//---------------------------------------------------------
+// changeModul
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::changeModul(int k)
+ {
+printf("change modul %d\n", k);
+
+ cmodul = k; // current modul
+
+ if (modules[k].transform == 0) {
+ printf("transform %d ist null\n", k);
+ modules[k].transform = cmt;
+ }
+ else {
+ //---------------------------------------------
+ // search transformation in list
+ //---------------------------------------------
+
+ int idx = 0;
+ iMidiInputTransformation i;
+ for (i = mtlist.begin(); i != mtlist.end(); ++i, ++idx) {
+ if (*i == modules[k].transform) {
+ presetList->setCurrentItem(idx);
+ break;
+ }
+ }
+ if (i == mtlist.end())
+ printf("change to unknown transformation!\n");
+ }
+ }
+
+//---------------------------------------------------------
+// presetChanged
+//---------------------------------------------------------
+
+void MidiInputTransformDialog::presetChanged(Q3ListBoxItem* item)
+ {
+ cindex = presetList->index(item);
+
+ //---------------------------------------------------
+ // search transformation in list and set
+ // cmt
+ //---------------------------------------------------
+
+ iMidiInputTransformation i;
+ for (i = mtlist.begin(); i != mtlist.end(); ++i) {
+ if (item->text() == (*i)->name) {
+ printf("found %s\n", (*i)->name.latin1());
+ cmt = *i;
+ if (cmodul != -1) {
+ modules[cmodul].transform = *i;
+ }
+ break;
+ }
+ }
+ if (i == mtlist.end()) {
+ printf("MidiInputTransformDialog::presetChanged: not found\n");
+ return;
+ }
+ nameEntry->setText(cmt->name);
+ commentEntry->setText(cmt->comment);
+
+ selEventOp->setCurrentItem(cmt->selEventOp);
+ selEventOpSel(cmt->selEventOp);
+
+ for (unsigned i = 0; i < sizeof(selTypeTable)/sizeof(*selTypeTable); ++i) {
+ if (selTypeTable[i] == cmt->selType) {
+ selType->setCurrentItem(i);
+ break;
+ }
+ }
+
+ selVal1Op->setCurrentItem(cmt->selVal1);
+ selVal1OpSel(cmt->selVal1);
+
+ selVal2Op->setCurrentItem(cmt->selVal2);
+ selVal2OpSel(cmt->selVal2);
+
+ selPortOp->setCurrentItem(cmt->selPort);
+ selPortOpSel(cmt->selPort);
+
+ selChannelOp->setCurrentItem(cmt->selChannel);
+ selChannelOpSel(cmt->selChannel);
+
+ {
+ unsigned i;
+ for (i = 0; i < sizeof(oplist)/sizeof(*oplist); ++i) {
+ if (oplist[i].id == cmt->funcOp) {
+ funcOp->setCurrentItem(i);
+ break;
+ }
+ }
+ if (i == sizeof(oplist)/sizeof(*oplist))
+ printf("internal error: bad OpCode\n");
+ funcOpSel(i);
+ }
+
+ for (unsigned i = 0; i < sizeof(procTypeTable)/sizeof(*procTypeTable); ++i) {
+ if (procTypeTable[i] == cmt->eventType) {
+ procType->setCurrentItem(i);
+ break;
+ }
+ }
+
+ procEventOp->setCurrentItem(cmt->procEvent);
+ procEventOpSel(cmt->procEvent);
+
+ procVal1Op->setCurrentItem(cmt->procVal1);
+ procVal1OpSel(cmt->procVal1);
+
+ for (unsigned i = 0; i < sizeof(procVal2Map)/sizeof(*procVal2Map); ++i) {
+ if (procVal2Map[i] == cmt->procVal2) {
+ procVal2Op->setCurrentItem(i);
+ break;
+ }
+ }
+
+ selVal1a->setValue(cmt->selVal1a);
+ selVal1b->setValue(cmt->selVal1b);
+ selVal1aChanged(cmt->selVal1a);
+ selVal1bChanged(cmt->selVal1b);
+
+ selVal2a->setValue(cmt->selVal2a);
+ selVal2b->setValue(cmt->selVal2b);
+
+ selPortVala->setValue(cmt->selPorta);
+ selPortValb->setValue(cmt->selPortb);
+
+ selChannelVala->setValue(cmt->selChannela);
+ selChannelValb->setValue(cmt->selChannelb);
+
+ procVal1a->setValue(cmt->procVal1a);
+ procVal1b->setValue(cmt->procVal1b);
+
+ procVal2a->setValue(cmt->procVal2a);
+ procVal2b->setValue(cmt->procVal2b);
+
+ procPortVala->setValue(cmt->procPorta);
+ procPortValb->setValue(cmt->procPortb);
+
+ procChannelVala->setValue(cmt->procChannela);
+ procChannelValb->setValue(cmt->procChannelb);
+
+ procPortOp->setCurrentItem(cmt->procPort);
+ procPortOpSel(cmt->procPort);
+
+ procChannelOp->setCurrentItem(cmt->procChannel);
+ procChannelOpSel(cmt->procChannel);
+
+ }
+
diff --git a/muse2/muse/mplugins/midiitransform.h b/muse2/muse/mplugins/midiitransform.h
new file mode 100644
index 00000000..860797c5
--- /dev/null
+++ b/muse2/muse/mplugins/midiitransform.h
@@ -0,0 +1,101 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midiitransform.h,v 1.1.1.1.2.1 2009/02/02 21:38:01 terminator356 Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MIDIITRANSFORM_H__
+#define __MIDIITRANSFORM_H__
+
+#include "itransformbase.h"
+//Added by qt3to4:
+#include <QCloseEvent>
+
+class Q3ListBoxItem;
+class MidiTransformation;
+class MidiInputTransformation;
+class MidiRecordEvent;
+class MidiPart;
+class Xml;
+
+#include "miditransform.h"
+
+enum InputTransformProcEventOp { KeepType, FixType };
+//---------------------------------------------------------
+// MidiInputTransform
+//---------------------------------------------------------
+
+class MidiInputTransformDialog : public MidiInputTransformDialogBase {
+ Q_OBJECT
+ MidiInputTransformation* cmt;
+ int cindex; // current index in preset list
+ int cmodul; // current index in modules list
+
+ virtual void accept();
+ virtual void reject();
+ void setValOp(QWidget* a, QWidget* b, ValOp op);
+ virtual void closeEvent(QCloseEvent*);
+
+ void updatePresetList();
+
+ signals:
+ void hideWindow();
+
+ private slots:
+ void presetNew();
+ void presetDelete();
+
+ void changeModul(int k);
+ void selEventOpSel(int);
+ void selTypeSel(int);
+ void selVal1OpSel(int);
+ void selVal2OpSel(int);
+ void procEventOpSel(int);
+ void procEventTypeSel(int);
+ void procVal1OpSel(int);
+ void procVal2OpSel(int);
+ void funcOpSel(int);
+ void presetChanged(Q3ListBoxItem*);
+ void nameChanged(const QString&);
+ void commentChanged();
+ void selVal1aChanged(int);
+ void selVal1bChanged(int);
+ void selVal2aChanged(int);
+ void selVal2bChanged(int);
+ void procVal1aChanged(int);
+ void procVal1bChanged(int);
+ void procVal2aChanged(int);
+ void procVal2bChanged(int);
+ void modul1enableChanged(bool);
+ void modul2enableChanged(bool);
+ void modul3enableChanged(bool);
+ void modul4enableChanged(bool);
+
+ void selPortOpSel(int);
+ void selPortValaChanged(int);
+ void selPortValbChanged(int);
+ void selChannelOpSel(int);
+ void selChannelValaChanged(int);
+ void selChannelValbChanged(int);
+ void procPortOpSel(int);
+ void procPortValaChanged(int);
+ void procPortValbChanged(int);
+ void procChannelOpSel(int);
+ void procChannelValaChanged(int);
+ void procChannelValbChanged(int);
+
+ public slots:
+ void songChanged(int);
+
+ public:
+ MidiInputTransformDialog(QWidget* parent = 0, const char* name = 0,
+ bool modal = false, Qt::WFlags fl = 0);
+ };
+
+extern void writeMidiInputTransforms(int level, Xml& xml);
+extern void readMidiInputTransform(Xml&);
+extern bool applyMidiInputTransformation(MidiRecordEvent& event);
+extern void clearMidiInputTransforms();
+#endif
diff --git a/muse2/muse/mplugins/mitplugin.cpp b/muse2/muse/mplugins/mitplugin.cpp
new file mode 100644
index 00000000..d8066e2c
--- /dev/null
+++ b/muse2/muse/mplugins/mitplugin.cpp
@@ -0,0 +1,145 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mitplugin.cpp,v 1.1.1.1 2003/10/27 18:52:40 wschweer Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <q3popupmenu.h>
+
+#include "mitplugin.h"
+#include "app.h"
+#include "event.h"
+#include "xml.h"
+
+#include "midiitransform.h"
+#include "mittranspose.h"
+#include "midifilterimpl.h"
+#include "mrconfig.h"
+#include "rhythm.h"
+
+MITPluginList mitPlugins;
+
+//---------------------------------------------------------
+// startMidiInputPlugin
+//---------------------------------------------------------
+
+void MusE::startMidiInputPlugin(int id)
+ {
+ bool flag = false;
+ QWidget* w = 0;
+ if (id == 0) {
+ if (!mitPluginTranspose) {
+ mitPluginTranspose = new MITPluginTranspose();
+ mitPlugins.push_back(mitPluginTranspose);
+ connect(mitPluginTranspose, SIGNAL(hideWindow()),
+ SLOT(hideMitPluginTranspose()));
+ }
+ w = mitPluginTranspose;
+ }
+ else if (id == 1) {
+ if (!midiInputTransform) {
+ midiInputTransform = new MidiInputTransformDialog();
+ connect(midiInputTransform, SIGNAL(hideWindow()),
+ SLOT(hideMidiInputTransform()));
+ }
+ w = midiInputTransform;
+ }
+ else if (id == 2) {
+ if (!midiFilterConfig) {
+ midiFilterConfig = new MidiFilterConfig();
+ connect(midiFilterConfig, SIGNAL(hideWindow()),
+ SLOT(hideMidiFilterConfig()));
+ }
+ w = midiFilterConfig;
+ }
+ else if (id == 3) {
+ if (!midiRemoteConfig) {
+ midiRemoteConfig = new MRConfig();
+ connect(midiRemoteConfig, SIGNAL(hideWindow()),
+ SLOT(hideMidiRemoteConfig()));
+ }
+ w = midiRemoteConfig;
+ }
+ else if (id == 4) {
+ if (!midiRhythmGenerator) {
+ midiRhythmGenerator = new RhythmGen();
+ connect(midiRhythmGenerator, SIGNAL(hideWindow()),
+ SLOT(hideMidiRhythmGenerator()));
+ }
+ w = midiRhythmGenerator;
+ }
+ if (w) {
+ flag = !w->isVisible();
+ if (flag)
+ w->show();
+ else
+ w->hide();
+ }
+ midiInputPlugins->setItemChecked(id, flag);
+ }
+
+void MusE::hideMitPluginTranspose()
+ {
+ midiInputPlugins->setItemChecked(0, false);
+ }
+void MusE::hideMidiInputTransform()
+ {
+ midiInputPlugins->setItemChecked(1, false);
+ }
+void MusE::hideMidiFilterConfig()
+ {
+ midiInputPlugins->setItemChecked(2, false);
+ }
+void MusE::hideMidiRemoteConfig()
+ {
+ midiInputPlugins->setItemChecked(3, false);
+ }
+void MusE::hideMidiRhythmGenerator()
+ {
+ midiInputPlugins->setItemChecked(4, false);
+ }
+
+//---------------------------------------------------------
+// processMidiInputTransformPlugins
+//---------------------------------------------------------
+
+void processMidiInputTransformPlugins(MEvent& event)
+ {
+ for (iMITPlugin i = mitPlugins.begin(); i != mitPlugins.end(); ++i)
+ (*i)->process(event);
+ }
+
+//---------------------------------------------------------
+// startMidiTransformer
+//---------------------------------------------------------
+
+void MusE::startMidiTransformer()
+ {
+ if (midiTransformerDialog == 0)
+ midiTransformerDialog = new MidiTransformerDialog(this);
+ midiTransformerDialog->show();
+ }
+
+//---------------------------------------------------------
+// writeStatusMidiInputTransformPlugins
+//---------------------------------------------------------
+
+void writeStatusMidiInputTransformPlugins(int level, Xml& xml)
+ {
+ for (iMITPlugin i = mitPlugins.begin(); i != mitPlugins.end(); ++i) {
+ xml.tag(level++, "mplugin name=\"%d\"");
+ (*i)->writeStatus(level, xml);
+ xml.etag(level, "mplugin");
+ }
+ }
+
+//---------------------------------------------------------
+// readStatusMidiInputTransformPlugin
+//---------------------------------------------------------
+
+void readStatusMidiInputTransformPlugin(Xml&)
+ {
+ }
+
diff --git a/muse2/muse/mplugins/mitplugin.h b/muse2/muse/mplugins/mitplugin.h
new file mode 100644
index 00000000..a7ab3729
--- /dev/null
+++ b/muse2/muse/mplugins/mitplugin.h
@@ -0,0 +1,39 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mitplugin.h,v 1.1.1.1.2.1 2007/01/27 14:52:43 spamatica Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MITPLUGIN_H__
+#define __MITPLUGIN_H__
+
+#include <list>
+
+class MEvent;
+class Xml;
+
+//---------------------------------------------------------
+// MITPlugin
+// midi input transform plugin
+//---------------------------------------------------------
+
+class MITPlugin {
+ public:
+ virtual ~MITPlugin(){}
+ virtual void process(MEvent& event) = 0;
+ virtual void readStatus(Xml&) {}
+ virtual void writeStatus(int, Xml&) const {}
+ };
+
+typedef std::list<MITPlugin*> MITPluginList;
+typedef MITPluginList::iterator iMITPlugin;
+
+extern MITPluginList mitPlugins;
+extern void processMidiInputTransformPlugins(MEvent&);
+extern void writeStatusMidiInputTransformPlugins(int, Xml&);
+extern void readStatusMidiInputTransformPlugin(Xml&);
+
+#endif
+
diff --git a/muse2/muse/mplugins/mittranspose.cpp b/muse2/muse/mplugins/mittranspose.cpp
new file mode 100644
index 00000000..b9a260c9
--- /dev/null
+++ b/muse2/muse/mplugins/mittranspose.cpp
@@ -0,0 +1,181 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mittranspose.cpp,v 1.2.2.1 2009/05/03 04:14:00 terminator356 Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qcheckbox.h>
+#include <qspinbox.h>
+#include <qlabel.h>
+#include <qtimer.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+
+#include "mittranspose.h"
+#include "song.h"
+#include "mpevent.h"
+#include "pitchedit.h"
+#include "xml.h"
+#include "globals.h"
+
+MITPluginTranspose* mitPluginTranspose;
+
+//---------------------------------------------------------
+// MITPluginTranspose
+//---------------------------------------------------------
+
+MITPluginTranspose::MITPluginTranspose(QWidget* parent, const char* name, Qt::WFlags fl)
+ : MITTransposeBase(parent, name, fl)
+ {
+ on = false;
+ transpose = 0;
+ trigger = 24;
+ transposeChangedFlag = false;
+ triggerKeySpinBox->setValue(trigger);
+
+ onToggled(false);
+ connect(onCheckBox, SIGNAL(toggled(bool)), SLOT(onToggled(bool)));
+ connect(triggerKeySpinBox, SIGNAL(valueChanged(int)),
+ SLOT(triggerKeyChanged(int)));
+ connect(heartBeatTimer, SIGNAL(timeout()), SLOT(noteReceived()));
+ }
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void MITPluginTranspose::closeEvent(QCloseEvent* ev)
+ {
+ emit hideWindow();
+ QWidget::closeEvent(ev);
+ }
+
+//---------------------------------------------------------
+// noteReceived
+//---------------------------------------------------------
+
+void MITPluginTranspose::noteReceived()
+ {
+ if (transposeChangedFlag)
+ {
+ // Added by Tim. p3.3.6
+ //printf("MITPluginTranspose::noteReceived\n");
+
+ transposeChanged();
+ }
+ }
+
+//---------------------------------------------------------
+// triggerKeyChanged
+//---------------------------------------------------------
+
+void MITPluginTranspose::triggerKeyChanged(int val)
+ {
+ trigger = val;
+ }
+
+//---------------------------------------------------------
+// transposeChanged
+//---------------------------------------------------------
+
+void MITPluginTranspose::transposeChanged()
+ {
+ QString s;
+ s.sprintf("%c%d", transpose >= 0 ? '-' : ' ', transpose);
+ transposeLabel->setText(s);
+ transposeChangedFlag = false;
+ }
+
+//---------------------------------------------------------
+// onToggled
+//---------------------------------------------------------
+
+void MITPluginTranspose::onToggled(bool f)
+ {
+ on = f;
+ if (!on) {
+ transpose = 0;
+ transposeChanged();
+ keyOnList.clear();
+ }
+ transposeLabel->setEnabled(on);
+ triggerKeySpinBox->setEnabled(on);
+ }
+
+//---------------------------------------------------------
+// process
+//---------------------------------------------------------
+
+void MITPluginTranspose::process(MEvent& ev)
+ {
+ if (!on || (ev.type() != 0x90))
+ return;
+ int pitch = ev.dataA();
+ if (pitch >= trigger && pitch < (trigger+12)) {
+ // process control keys
+ int diff = transpose - (pitch-trigger);
+ transpose -= diff;
+ transposeChangedFlag = true;
+ return;
+ }
+ if (ev.dataB() == 0) {
+ // Note Off
+ for (iKeyOn i = keyOnList.begin(); i != keyOnList.end(); ++i) {
+ if (i->pitch == pitch && i->channel == ev.channel()
+ && i->port == ev.port()) {
+ pitch += i->transpose;
+ keyOnList.erase(i);
+ break;
+ }
+ }
+ }
+ else {
+ // Note On
+ keyOnList.push_back(KeyOn(pitch, ev.channel(), ev.port(), transpose));
+ pitch += transpose;
+ }
+ ev.setA(pitch);
+ }
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void MITPluginTranspose::readStatus(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::Text:
+ if (tag == "on")
+ on = xml.parseInt();
+ else if (tag == "trigger")
+ trigger = xml.parseInt();
+ else
+ xml.unknown("TransposePlugin");
+ break;
+ case Xml::TagEnd:
+ if (xml.s1() == "mplugin")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void MITPluginTranspose::writeStatus(int level, Xml& xml) const
+ {
+ xml.intTag(level, "on", on);
+ xml.intTag(level, "trigger", trigger);
+ }
+
diff --git a/muse2/muse/mplugins/mittranspose.h b/muse2/muse/mplugins/mittranspose.h
new file mode 100644
index 00000000..b942eddf
--- /dev/null
+++ b/muse2/muse/mplugins/mittranspose.h
@@ -0,0 +1,70 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mittranspose.h,v 1.1.1.1 2003/10/27 18:52:40 wschweer Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MITTRANSPOSE_H__
+#define __MITTRANSPOSE_H__
+
+#include "mitplugin.h"
+#include "mittransposebase.h"
+#include <list>
+//Added by qt3to4:
+#include <QCloseEvent>
+
+struct KeyOn {
+ unsigned char pitch;
+ unsigned char channel;
+ unsigned char port;
+ char transpose;
+ KeyOn(int a, int b, int c, int d) {
+ pitch = a;
+ transpose = d;
+ channel = b;
+ port = c;
+ }
+ };
+
+typedef std::list<KeyOn > KeyOnList;
+typedef KeyOnList::iterator iKeyOn;
+
+class Xml;
+
+//---------------------------------------------------------
+// MITPluginTranspose
+//---------------------------------------------------------
+
+class MITPluginTranspose : public MITTransposeBase, public MITPlugin {
+ Q_OBJECT
+
+ KeyOnList keyOnList;
+ int transpose; // current pitch offset
+ int trigger;
+ bool on;
+ bool transposeChangedFlag;
+
+ void transposeChanged();
+ virtual void closeEvent(QCloseEvent*);
+
+ signals:
+ void hideWindow();
+
+ private slots:
+ void onToggled(bool);
+ void triggerKeyChanged(int);
+ void noteReceived();
+
+ public:
+ MITPluginTranspose(QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0);
+ virtual void process(MEvent&);
+ virtual void readStatus(Xml&);
+ virtual void writeStatus(int, Xml&) const;
+ };
+
+extern MITPluginTranspose* mitPluginTranspose;
+
+#endif
+
diff --git a/muse2/muse/mplugins/mrconfig.cpp b/muse2/muse/mplugins/mrconfig.cpp
new file mode 100644
index 00000000..38b67de3
--- /dev/null
+++ b/muse2/muse/mplugins/mrconfig.cpp
@@ -0,0 +1,71 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mrconfig.cpp,v 1.1.1.1 2003/10/27 18:52:43 wschweer Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "pitchedit.h"
+#include "mrconfig.h"
+#include "globals.h"
+#include <qcheckbox.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+
+//---------------------------------------------------------
+// MRConfig
+// Midi Remote Control Config
+//---------------------------------------------------------
+
+MRConfig::MRConfig(QWidget* parent, const char* name, Qt::WFlags fl)
+ : MRConfigBase(parent, name, fl)
+ {
+ b1->setChecked(rcEnable);
+ sb1->setValue(rcStopNote);
+ sb2->setValue(rcRecordNote);
+ sb3->setValue(rcGotoLeftMarkNote);
+ sb4->setValue(rcPlayNote);
+
+ connect(b1, SIGNAL(toggled(bool)), SLOT(setRcEnable(bool)));
+ connect(sb1, SIGNAL(valueChanged(int)), SLOT(setRcStopNote(int)));
+ connect(sb2, SIGNAL(valueChanged(int)), SLOT(setRcRecordNote(int)));
+ connect(sb3, SIGNAL(valueChanged(int)), SLOT(setRcGotoLeftMarkNote(int)));
+ connect(sb4, SIGNAL(valueChanged(int)), SLOT(setRcPlayNote(int)));
+ }
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void MRConfig::closeEvent(QCloseEvent* ev)
+ {
+ emit hideWindow();
+ QWidget::closeEvent(ev);
+ }
+
+void MRConfig::setRcEnable(bool f)
+ {
+ rcEnable = f;
+ }
+
+void MRConfig::setRcStopNote(int val)
+ {
+ rcStopNote = val;
+ }
+
+void MRConfig::setRcRecordNote(int val)
+ {
+ rcRecordNote = val;
+ }
+
+void MRConfig::setRcGotoLeftMarkNote(int val)
+ {
+ rcGotoLeftMarkNote = val;
+ }
+
+void MRConfig::setRcPlayNote(int val)
+ {
+ rcPlayNote = val;
+ }
+
diff --git a/muse2/muse/mplugins/mrconfig.h b/muse2/muse/mplugins/mrconfig.h
new file mode 100644
index 00000000..67b1976c
--- /dev/null
+++ b/muse2/muse/mplugins/mrconfig.h
@@ -0,0 +1,40 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mrconfig.h,v 1.1.1.1 2003/10/27 18:52:43 wschweer Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MRCONFIG_H__
+#define __MRCONFIG_H__
+
+#include "mrconfigbase.h"
+//Added by qt3to4:
+#include <QCloseEvent>
+
+//---------------------------------------------------------
+// MRConfig
+//---------------------------------------------------------
+
+class MRConfig : public MRConfigBase {
+ Q_OBJECT
+
+ virtual void closeEvent(QCloseEvent*);
+
+ signals:
+ void hideWindow();
+
+ private slots:
+ void setRcEnable(bool);
+ void setRcStopNote(int);
+ void setRcRecordNote(int);
+ void setRcGotoLeftMarkNote(int);
+ void setRcPlayNote(int);
+
+ public:
+ MRConfig(QWidget* parent=0, const char* name=0, Qt::WFlags fl = 0);
+ };
+
+#endif
+
diff --git a/muse2/muse/mplugins/mrconfigbase.ui b/muse2/muse/mplugins/mrconfigbase.ui
new file mode 100644
index 00000000..299f9183
--- /dev/null
+++ b/muse2/muse/mplugins/mrconfigbase.ui
@@ -0,0 +1,200 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>MRConfigBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>MRConfigBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>298</width>
+ <height>203</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Midi Input Plugin: Remote Control</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Activate</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>b1</cstring>
+ </property>
+ <property name="text">
+ <string>On</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Actions</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Stop</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Record</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Goto Left Mark</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Play</string>
+ </property>
+ </widget>
+ <widget class="PitchEdit" row="0" column="1">
+ <property name="name">
+ <cstring>sb1</cstring>
+ </property>
+ </widget>
+ <widget class="PitchEdit" row="1" column="1">
+ <property name="name">
+ <cstring>sb2</cstring>
+ </property>
+ </widget>
+ <widget class="PitchEdit" row="2" column="1">
+ <property name="name">
+ <cstring>sb3</cstring>
+ </property>
+ </widget>
+ <widget class="PitchEdit" row="3" column="1">
+ <property name="name">
+ <cstring>sb4</cstring>
+ </property>
+ </widget>
+ <spacer row="0" column="2">
+ <property name="name" stdset="0">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="1" column="2">
+ <property name="name" stdset="0">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="2" column="2">
+ <property name="name" stdset="0">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="3" column="2">
+ <property name="name" stdset="0">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includes>
+ <include location="local" impldecl="in declaration">pitchedit.h</include>
+</includes>
+</UI>
diff --git a/muse2/muse/mplugins/random.cpp b/muse2/muse/mplugins/random.cpp
new file mode 100644
index 00000000..5360d6b8
--- /dev/null
+++ b/muse2/muse/mplugins/random.cpp
@@ -0,0 +1,758 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: random.cpp,v 1.1.1.1 2003/10/27 18:52:39 wschweer Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//
+// This code is an adaption of the random rhythm generator taken
+// from "The JAZZ++ Midi Sequencer"
+// Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all
+// rights reserved.
+// Distributed under the GNU General Public License
+//=========================================================
+
+#if 0
+#include "random.h"
+#include "util.h"
+#include <assert.h>
+
+
+#if USE_ACG
+ACG rnd(0, 55);
+#else
+#include <stdlib.h>
+double tRandomGenerator::asDouble()
+{
+ return double(rand()) / double(RAND_MAX);
+}
+tRandomGenerator rnd;
+#endif
+
+
+// Array of probabilities
+
+tRndArray::tRndArray(int nn, int mmin, int mmax)
+{
+ int i;
+ n = nn;
+ for (i = 0; i < n; i++)
+ array[i] = mmin;
+ min = mmin;
+ max = mmax;
+ nul = min > 0 ? min : 0;
+}
+
+
+void tRndArray::SetMinMax(int mi, int ma)
+{
+ min = mi;
+ max = ma;
+ nul = min > 0 ? min : 0;
+ for (int i = 0; i < array.GetSize(); i++)
+ {
+ if (array[i] < min)
+ array[i] = min;
+ else if (array[i] > max)
+ array[i] = max;
+ }
+}
+
+tRndArray::~tRndArray()
+{
+}
+
+#ifdef FOR_MSW
+double tRndArray::operator[](double f)
+#else
+double tRndArray::operator[](double f) const
+#endif
+{
+ int i = (int)f;
+ if (i < 0)
+ i = 0;
+ else if (i >= n - 2)
+ i = n - 2;
+ tMapper map(i, i+1, array[i], array[i+1]);
+ return map(f);
+}
+
+
+tRndArray & tRndArray::operator = (const tRndArray &o)
+{
+ if (this == &o)
+ return *this;
+
+ array = o.array;
+ n = o.n;
+ min = o.min;
+ max = o.max;
+ nul = o.nul;
+ return *this;
+}
+
+
+tRndArray::tRndArray(const tRndArray &o)
+ : array(o.array)
+{
+ n = o.n;
+ min = o.min;
+ max = o.max;
+ nul = o.nul;
+}
+
+
+int tRndArray::Random()
+{
+ return Random(rnd.asDouble());
+}
+
+int tRndArray::Random(double rndval)
+{
+ double sum, dec;
+ int i;
+
+ assert(n > 0);
+
+ sum = 0.0;
+ for (i = 0; i < n; i++)
+ {
+ assert(array[i] >= 0);
+ sum += array[i];
+ }
+ if (sum <= 0)
+ return 0;
+
+ dec = sum * rndval * 0.99999;
+ assert(dec < sum);
+
+ i = 0;
+ while (dec >= 0.0)
+ {
+ dec -= array[i];
+ i++;
+ }
+ i--;
+
+ assert(i >= 0 && i < n);
+ return i;
+}
+
+
+int tRndArray::Interval(int seed)
+{
+ if (seed < 0) // initial ?
+ seed = int(rnd.asDouble() * n);
+ int delta = Random();
+ if (rnd.asDouble() < 0.5)
+ delta = -delta;
+ seed = (seed + n + delta) % n;
+ return seed;
+}
+
+int tRndArray::Random(int i)
+{
+ return rnd.asDouble() * (max - min) < array[i];
+}
+
+
+void tRndArray::SetUnion(tRndArray &o, int fuzz)
+{
+ for (int i = 0; i < n; i++)
+ {
+ int val = array[i];
+ if (o.array[i] > val)
+ val = o.array[i];
+ array[i] = Fuzz(fuzz, array[i], val);
+ }
+}
+
+
+void tRndArray::SetIntersection(tRndArray &o, int fuzz)
+{
+ for (int i = 0; i < n; i++)
+ {
+ int val = array[i];
+ if (o.array[i] < val)
+ val = o.array[i];
+ array[i] = Fuzz(fuzz, array[i], val);
+ }
+}
+
+
+void tRndArray::SetDifference(tRndArray &o, int fuzz)
+{
+ tRndArray tmp(o);
+ tmp.SetInverse(tmp.Max());
+ SetIntersection(tmp, fuzz);
+}
+
+
+void tRndArray::SetInverse(int fuzz)
+{
+ for (int i = 0; i < n; i++)
+ array[i] = Fuzz(fuzz, array[i], min + max - array[i]);
+}
+
+
+int tRndArray::Fuzz(int fuz, int v1, int v2) const
+{
+ // interpolate between v1 and v2
+ return (fuz - min) * v2 / (max - min) + (max - fuz) * v1 / (max - min);
+}
+
+
+void tRndArray::Clear()
+{
+ for (int i = 0; i < n; i++)
+ array[i] = min;
+}
+
+
+ostream & operator << (ostream &os, tRndArray const &a)
+{
+ int i;
+
+ os << a.n << " " << a.min << " " << a.max << endl;
+ for (i = 0; i < a.n; i++)
+ os << a.array[i] << " ";
+ os << endl;
+ return os;
+}
+
+
+istream & operator >> (istream &is, tRndArray &a)
+{
+ int i;
+ is >> a.n >> a.min >> a.max;
+ for (i = 0; i < a.n; i++)
+ is >> a.array[i];
+ return is;
+}
+
+
+// --------------------------------- tArrayEdit -------------------------------------
+
+// length of tickmark line
+#define TICK_LINE 0
+
+tArrayEdit::tArrayEdit(wxFrame *frame, tRndArray &ar, long xx, long yy, long ww, long hh, int sty)
+ : wxCanvas(frame, xx, yy, ww, hh),
+ array(ar),
+ n(ar.n),
+ min(ar.min),
+ max(ar.max),
+ nul(ar.nul)
+{
+ draw_bars = 0;
+ enabled = 1;
+ dragging = 0;
+ index = -1;
+ label = 0;
+ style_bits = sty;
+
+ xmin = 0;
+ xmax = n;
+
+ x = 0; // draw to topleft corner of canvas
+ y = 0;
+ w = ww;
+ h = hh;
+
+ float tw, th;
+ wxDC *dc = GetDC();
+ dc->SetFont(wxSMALL_FONT);
+ dc->GetTextExtent("123", &tw, &th);
+ if (style_bits & ARED_XTICKS)
+ {
+ // leave space for bottomline
+ h -= (int)th;
+ }
+
+ if (style_bits & (ARED_MINMAX | ARED_YTICKS))
+ {
+ // leave space to display min / max
+ x = (int)(tw + TICK_LINE);
+ w -= (int)(tw + TICK_LINE);
+ }
+
+ ynul = y + h - h * (nul - min) / (max - min);
+}
+
+
+void tArrayEdit::OnSize(int ww, int hh)
+{
+ w = ww;
+ h = hh;
+ wxCanvas::OnSize(w, h);
+ float tw, th;
+ GetDC()->GetTextExtent("123", &tw, &th);
+ if (style_bits & ARED_XTICKS)
+ h -= (int)th;
+ if (style_bits & (ARED_MINMAX | ARED_YTICKS))
+ {
+ x = (int)(tw + TICK_LINE);
+ w -= (int)(tw + TICK_LINE);
+ }
+ ynul = y + h - h * (nul - min) / (max - min);
+}
+
+tArrayEdit::~tArrayEdit()
+{
+ delete [] label;
+}
+
+void tArrayEdit::DrawBar(int i, int Qt::black)
+{
+ wxDC *dc = GetDC();
+
+ if (style_bits & ARED_LINES)
+ {
+ if (!Qt::black)
+ dc->SetPen(wxWHITE_PEN);
+
+ tMapper xmap(0, n, 0, w);
+ tMapper ymap(min, max, h, 0);
+
+ float x1 = (float)xmap(i + 0.5);
+ float y1 = (float)ymap(array[i]);
+ if (i > 0)
+ {
+ // draw line to prev position
+ float x0 = (float)xmap(i - 0.5);
+ float y0 = (float)ymap(array[i-1]);
+ dc->DrawLine(x0, y0, x1, y1);
+ }
+ if (i < n-1)
+ {
+ // draw line to next position
+ float x2 = (float)xmap(i + 1.5);
+ float y2 = (float)ymap(array[i+1]);
+ dc->DrawLine(x1, y1, x2, y2);
+ }
+
+ if (!Qt::black)
+ dc->SetPen(wxBLACK_PEN);
+ return;
+ }
+
+ int gap = 0;
+ if (style_bits & ARED_GAP)
+ {
+ gap = w / n / 6;
+ if (!gap && w / n > 3)
+ gap = 1;
+ }
+ long xbar, ybar, wbar, hbar;
+
+ wbar = w / n - 2 * gap;
+ xbar = x + i * w / n + gap;
+ hbar = h * (array[i] - nul) / (max - min);
+
+ if (style_bits & ARED_BLOCKS)
+ {
+ /*
+ ybar = ynul - hbar;
+ if (hbar < 0)
+ hbar = -hbar;
+ hbar = (hbar < 2) ? hbar : 2;
+ */
+ int hblk = 12;
+
+ ybar = ynul - hbar - hblk/2;
+ hbar = hblk;
+ if (ybar < y) {
+ int d = y - ybar;
+ ybar += d;
+ hbar -= d;
+ }
+ if (ybar + hbar > y + h) {
+ int d = (ybar + hbar) - (y + h);
+ hbar -= d;
+ }
+ if (hbar < 2)
+ hbar = 2;
+ }
+ else
+
+ if (hbar < 0)
+ {
+ ybar = ynul;
+ hbar = -hbar;
+ }
+ else
+ ybar = ynul - hbar;
+
+ if (ybar == y)
+ ++ybar, --hbar;
+
+ if (!Qt::black)
+ {
+ dc->SetBrush(wxWHITE_BRUSH);
+ dc->SetPen(wxWHITE_PEN);
+ }
+ if (wbar && hbar)
+ dc->DrawRectangle(xbar, ybar, wbar, hbar);
+ if (!Qt::black)
+ {
+ dc->SetBrush(wxBLACK_BRUSH);
+ dc->SetPen(wxBLACK_PEN);
+ }
+}
+
+const char *tArrayEdit::GetXText(int xval)
+{
+ static char buf[8];
+ sprintf(buf, "%d", xval);
+ return buf;
+}
+
+const char *tArrayEdit::GetYText(int yval)
+{
+ static char buf[8];
+ sprintf(buf, "%d", yval);
+ return buf;
+}
+
+void tArrayEdit::DrawXTicks()
+{
+ float tw, th;
+
+ if (!(style_bits & ARED_XTICKS))
+ return;
+
+ wxDC *dc = GetDC();
+ dc->SetFont(wxSMALL_FONT);
+
+ // compute tickmark x-distance
+ dc->GetTextExtent("-123", &tw, &th);
+ int max_labels = (int)(w / (tw + tw/2));
+ if (max_labels > 0)
+ {
+ int step = (xmax - xmin + 1) / max_labels;
+ if (step <= 0)
+ step = 1;
+ for (int val = xmin; val <= xmax; val += step)
+ {
+ const char *buf = GetXText(val);
+ //sprintf(buf, "%d", val);
+ dc->GetTextExtent((char *)buf, &tw, &th);
+ float yy = y + h;
+ float xx = x + w * (val - xmin) / (xmax - xmin + 1);
+ xx -= tw/2; // center text
+ xx += 0.5 * w / n; // middle of bar
+ dc->DrawText(buf, xx, yy);
+ //dc->DrawLine(x - TICK_LINE, yy, x, yy);
+ }
+ }
+
+ dc->SetFont(wxNORMAL_FONT);
+}
+
+
+void tArrayEdit::DrawYTicks()
+{
+ wxDC *dc = GetDC();
+ dc->SetFont(wxSMALL_FONT);
+
+ if (style_bits & ARED_YTICKS)
+ {
+ // compute tickmark y-distance
+ float tw, th;
+ dc->GetTextExtent("-123", &tw, &th);
+ int max_labels = (int)(h / (th + th/2));
+ if (max_labels > 0)
+ {
+ int step = (max - min) / max_labels;
+ if (step <= 0)
+ step = 1;
+ for (int val = min; val < max; val += step)
+ {
+ const char *buf = GetYText(val);
+ //sprintf(buf, "%d", val);
+ dc->GetTextExtent((char *)buf, &tw, &th);
+ float yy = y + h - h * (val - min) / (max - min) - th/2;
+ dc->DrawText(buf, x - tw - TICK_LINE, yy);
+ //dc->DrawLine(x - TICK_LINE, yy, x, yy);
+ }
+ }
+ }
+
+ else if (style_bits & ARED_MINMAX)
+ {
+ // min/max
+ float tw, th;
+ char buf[20];
+ sprintf(buf, "%d", max);
+ dc->GetTextExtent(buf, &tw, &th);
+ dc->DrawText(buf, x - tw, y);
+ sprintf(buf, "%d", min);
+ dc->GetTextExtent(buf, &tw, &th);
+ dc->DrawText(buf, x - tw, y + h - th);
+
+ }
+
+ dc->SetFont(wxNORMAL_FONT);
+
+}
+
+void tArrayEdit::DrawLabel()
+{
+ wxDC *dc = GetDC();
+ dc->SetFont(wxSMALL_FONT);
+ if (label)
+ dc->DrawText(label, x + 5, y + 2);
+ dc->SetFont(wxNORMAL_FONT);
+}
+
+
+
+void tArrayEdit::OnPaint()
+{
+ int i;
+ wxDC *dc = GetDC();
+
+ // surrounding rectangle
+ dc->Clear();
+ if (enabled)
+ dc->SetBrush(wxWHITE_BRUSH);
+ else
+ dc->SetBrush(wxGREY_BRUSH);
+ dc->SetPen(wxBLACK_PEN);
+ if (w && h)
+ dc->DrawRectangle(x, y, w, h);
+
+ // sliders
+ dc->SetBrush(wxBLACK_BRUSH);
+ for (i = 0; i < n; i++)
+ DrawBar(i, 1);
+
+ DrawXTicks();
+ DrawLabel();
+ DrawYTicks();
+ DrawNull();
+ if (draw_bars)
+ draw_bars->DrawBars();
+}
+
+
+
+void tArrayEdit::DrawNull()
+{
+ wxDC *dc = GetDC();
+ dc->SetPen(wxCYAN_PEN);
+ // draw y-null line
+ if (min < nul && nul < max)
+ dc->DrawLine(x, ynul, x+w, ynul);
+ // draw x-null line
+ if (xmin < 0 && 0 < xmax)
+ {
+ float x0 = w * (0 - xmin) / (xmax - xmin);
+ dc->DrawLine(x0, y, x0, y + h);
+ }
+ dc->SetPen(wxBLACK_PEN);
+}
+
+
+
+void tArrayEdit::SetXMinMax(int xmi, int xma)
+{
+ xmin = xmi;
+ xmax = xma;
+}
+
+int tArrayEdit::Index(wxMouseEvent &e)
+{
+ float ex, ey;
+ e.Position(&ex, &ey);
+ int i = (int)( ((short)ex - x) * n / w);
+ i = i < 0 ? 0 : i;
+ i = i >= n ? n-1 : i;
+ return i;
+}
+
+int tArrayEdit::Dragging(wxMouseEvent &e)
+{
+ if (!dragging)
+ return 0;
+
+ if (index < 0)
+ index = Index(e);
+
+ int val = nul;
+ if (e.LeftIsDown())
+ {
+ float ex, ey;
+ e.Position(&ex, &ey);
+ // $blk$ val = (int)( (y + h - (short)ey) * (max - min) / h + min);
+ val = (int)( (double)(y + h - ey) * (max - min) / h + min + 0.5);
+ val = val > max ? max : val;
+ val = val < min ? min : val;
+ }
+
+#if 0
+ {
+ // in msw ex,ey are 65536 for negative values!
+ wxDC *dc = GetDC();
+ char buf[500];
+ sprintf(buf, "x %4.0f, y %4.0f, sh %d", ex, ey, e.ShiftDown());
+ dc->DrawText(buf, 50, 50);
+ }
+#endif
+
+ if (e.ShiftDown())
+ {
+ int k;
+ for (k = 0; k < n; k++)
+ {
+ DrawBar(k, 0);
+ array[k] = val;
+ DrawBar(k, 1);
+ }
+ }
+ else if (e.ControlDown())
+ {
+ DrawBar(index, 0);
+ array[index] = val;
+ DrawBar(index, 1);
+ }
+ else
+ {
+ int i = Index(e);
+ int k = i;
+ if (i < index)
+ for (; i <= index; i++)
+ {
+ DrawBar(i, 0);
+ array[i] = val;
+ DrawBar(i, 1);
+ }
+ else
+ for (; i >= index; i--)
+ {
+ DrawBar(i, 0);
+ array[i] = val;
+ DrawBar(i, 1);
+ }
+ index = k;
+ }
+
+ return 0;
+}
+
+int tArrayEdit::ButtonDown(wxMouseEvent &e)
+{
+#ifdef wx_msw
+ CaptureMouse();
+#endif
+ dragging = 1;
+ index = Index(e);
+ Dragging(e);
+ return 0;
+}
+
+int tArrayEdit::ButtonUp(wxMouseEvent &e)
+{
+#ifdef wx_msw
+ ReleaseMouse();
+#endif
+ dragging = 0;
+ index = -1;
+ DrawLabel();
+ DrawNull();
+ return 0;
+}
+
+
+void tArrayEdit::OnEvent(wxMouseEvent &e)
+{
+ if (!enabled)
+ return;
+ if (e.ButtonDown())
+ ButtonDown(e);
+ else if (e.Dragging())
+ Dragging(e);
+ else if (e.ButtonUp())
+ ButtonUp(e);
+}
+
+void tArrayEdit::Enable(int e)
+{
+ enabled = e;
+}
+
+void tArrayEdit::SetLabel(char const *llabel)
+{
+ delete label;
+ label = copystring(llabel);
+}
+
+void tArrayEdit::SetYMinMax(int mi, int ma)
+{
+ array.SetMinMax(mi, ma);
+ ynul = y + h - h * (nul - min) / (max - min);
+}
+
+void tArrayEdit::DrawBarLine (long xx)
+{
+ wxDC *dc = GetDC ();
+ // fprintf(stderr,"x: %ld, xx: %ld\n",x,xx);
+ if (xx > x && xx + 1 < x + w)
+ {
+ dc->SetPen (wxLIGHT_GREY_PEN);
+ dc->DrawLine (xx, y + 1, xx, y + h - 2);
+ dc->SetPen (wxBLACK_PEN);
+ }
+}
+
+
+
+tRhyArrayEdit::tRhyArrayEdit(wxFrame *parent, tRndArray &array, long xx, long yy, long ww, long hh, int sty)
+ : tArrayEdit(parent, array, xx, yy, ww, hh, sty)
+{
+ steps_per_count = 4;
+ count_per_bar = 4;
+ n_bars = 4;
+}
+
+void tRhyArrayEdit::SetMeter(int s, int c, int b)
+{
+ steps_per_count = s;
+ count_per_bar = c;
+ n_bars = b;
+ array.Resize(s * c * b);
+ SetXMinMax(1, s * c * b);
+}
+
+
+void tRhyArrayEdit::DrawXTicks()
+{
+ if (!(style_bits & ARED_RHYTHM))
+ {
+ tArrayEdit::DrawXTicks();
+ return;
+ }
+
+ char buf[20];
+ float tw, th;
+
+ wxDC *dc = GetDC();
+ dc->SetFont(wxSMALL_FONT);
+
+ // tick marks
+ assert(steps_per_count && count_per_bar && n_bars);
+ int i;
+ for (i = 0; i < n; i += steps_per_count)
+ {
+ int mark = (i / steps_per_count) % count_per_bar + 1;
+ sprintf(buf, "%d", mark);
+ float yy = y + h;
+ float xx = x + (i + 0.5) * w / n;
+ dc->GetTextExtent(buf, &tw, &th);
+ xx -= tw/2.0;
+ dc->DrawText(buf, xx, yy);
+ }
+ dc->SetFont(wxNORMAL_FONT);
+}
+#endif
+
diff --git a/muse2/muse/mplugins/random.h b/muse2/muse/mplugins/random.h
new file mode 100644
index 00000000..2c9dfe5b
--- /dev/null
+++ b/muse2/muse/mplugins/random.h
@@ -0,0 +1,192 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: random.h,v 1.1.1.1 2003/10/27 18:52:43 wschweer Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//
+// This code is an adaption of the random rhythm generator taken
+// from "The JAZZ++ Midi Sequencer"
+// Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all
+// rights reserved.
+// Distributed under the GNU General Public License
+//=========================================================
+
+#if 0
+#ifndef random_h
+#define random_h
+
+#ifndef wx_wxh
+#include "wx.h"
+#endif
+
+#ifndef _FSTREAM_H
+#include <fstream.h>
+#endif
+
+#ifndef dynarray_h
+#include "dynarray.h"
+#endif
+
+// gcc > 2.7.2 does not have ACG anymore?
+#define USE_ACG 0
+
+#if USE_ACG
+#include <ACG.h> // random generator from libg++
+extern ACG rnd;
+
+#else
+
+class tRandomGenerator
+{
+ public:
+ double asDouble();
+};
+extern tRandomGenerator rnd;
+
+#endif
+
+
+#undef min
+#undef max
+
+
+// array of probabilities
+
+class tRndArray
+{
+ friend class tArrayEdit;
+ protected:
+ tIntArray array;
+ int n; // number of elements in array
+ int nul, min, max;
+
+ public:
+ int Null() { return nul; }
+ void SetNull(int n) { nul = n; }
+ tRndArray(int n, int min, int max);
+ tRndArray & operator = (const tRndArray &);
+ tRndArray(tRndArray const &);
+
+ virtual ~tRndArray();
+ int &operator[] (int i) { return array[i]; }
+ int operator[] (int i) const { return array[i]; }
+#ifdef FOR_MSW
+ double operator[](double f);
+ float operator[](float f) {
+#else
+ double operator[](double f) const;
+ float operator[](float f) const {
+#endif
+ return (float)operator[]((double)f);
+ }
+ int Size() const { return n; }
+ int Min() const { return min; }
+ int Max() const { return max; }
+ void SetMinMax(int min, int max);
+ void Resize(int nn) { n = nn; }
+
+ friend ostream & operator << (ostream &, tRndArray const &);
+ friend istream & operator >> (istream &, tRndArray &);
+
+ int Random(); // returns index 0..n-1 (arrayvalues -> empiric distribution)
+ int Random(double rndval); // returns index 0..n-1 (arrayvalues -> empiric distribution)
+ int Random(int i); // return 0/1
+ int Interval(int seed);
+
+ void SetUnion(tRndArray &o, int fuzz);
+ void SetDifference(tRndArray &o, int fuzz);
+ void SetIntersection(tRndArray &o, int fuzz);
+ void SetInverse(int fuzz);
+ int Fuzz(int fuzz, int v1, int v2) const;
+ void Clear();
+};
+
+
+#define ARED_GAP 1
+#define ARED_XTICKS 2
+#define ARED_YTICKS 4
+#define ARED_MINMAX 8
+#define ARED_RHYTHM 16
+#define ARED_BLOCKS 32
+#define ARED_LINES 64
+
+
+class tArrayEditDrawBars {
+ public:
+ virtual void DrawBars() = 0;
+};
+
+
+class tArrayEdit : public wxCanvas
+{
+protected:
+ // paint position
+ long x, y, w, h, ynul;
+ void DrawBar(int i, int Qt::black);
+
+ int dragging; // Dragging-Event valid
+ int index; // ctrl down: drag this one
+
+ tRndArray &array;
+ int &n, &min, &max, &nul; // shorthand for array.n, array.min, ...
+ char *label;
+ tArrayEditDrawBars *draw_bars;
+
+ // array size is mapped to this range for x-tick marks
+ int xmin, xmax;
+
+ virtual void DrawXTicks();
+ virtual void DrawYTicks();
+ virtual void DrawLabel();
+ virtual void DrawNull();
+ int Index(wxMouseEvent &e);
+
+ int enabled;
+ int style_bits;
+
+ virtual const char *GetXText(int xval); // Text for x-tickmarks
+ virtual const char *GetYText(int yval); // Text for y-tickmarks
+
+
+public:
+ tArrayEdit(wxFrame *parent, tRndArray &array, long xx, long yy, long ww, long hh, int style_bits = (ARED_GAP | ARED_XTICKS));
+ virtual ~tArrayEdit();
+
+ virtual void OnPaint();
+ virtual void OnSize(int ww, int hh);
+ virtual void OnEvent(wxMouseEvent &e);
+ virtual int Dragging(wxMouseEvent &);
+ virtual int ButtonDown(wxMouseEvent &);
+ virtual int ButtonUp(wxMouseEvent &);
+
+ virtual void SetLabel(char const *llabel);
+ void Enable(int enable = 1);
+ void SetStyle(int style) { style_bits = style; }
+ // min and max value in array (both values inclusive)
+ void SetYMinMax(int min, int max);
+ // for display x-axis only, does not resize the array (both values inclusive)
+ void SetXMinMax(int xmin, int xmax);
+ void DrawBarLine (long xx);
+ void SetDrawBars(tArrayEditDrawBars *x) { draw_bars = x; }
+ void Init() {}
+};
+
+
+
+class tRhyArrayEdit : public tArrayEdit
+{
+ int steps_per_count;
+ int count_per_bar;
+ int n_bars;
+ protected:
+ virtual void DrawXTicks();
+ public:
+ tRhyArrayEdit(wxFrame *parent, tRndArray &array, long xx, long yy, long ww, long hh, int style_bits = (ARED_GAP | ARED_XTICKS | ARED_RHYTHM));
+ void SetMeter(int steps_per_count, int count_per_bar, int n_bars);
+};
+
+
+#endif
+#endif
+
diff --git a/muse2/muse/mplugins/rhythm.cpp b/muse2/muse/mplugins/rhythm.cpp
new file mode 100644
index 00000000..5281fb56
--- /dev/null
+++ b/muse2/muse/mplugins/rhythm.cpp
@@ -0,0 +1,516 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: rhythm.cpp,v 1.1.1.1 2003/10/27 18:52:49 wschweer Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//
+// This code is an adaption of the random rhythm generator taken
+// from "The JAZZ++ Midi Sequencer"
+// Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all
+// rights reserved.
+// Distributed under the GNU General Public License
+//=========================================================
+
+#include "rhythm.h"
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <QCloseEvent>
+#include <Q3VBoxLayout>
+
+//---------------------------------------------------------
+// RhythmGen
+//---------------------------------------------------------
+
+RhythmGen::RhythmGen(QWidget* parent, const char* name, Qt::WFlags fo)
+ : RhythmBase(parent, name, fo)
+ {
+ }
+RhythmGen::~RhythmGen()
+ {
+ }
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void RhythmGen::closeEvent(QCloseEvent* ev)
+ {
+ emit hideWindow();
+ QWidget::closeEvent(ev);
+ }
+
+
+
+#if 0
+/****************************************************************************
+** Form implementation generated from reading ui file 'rhythm.ui'
+**
+** Created: Tue Feb 26 13:43:04 2002
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#include "rhythm.h"
+
+#include <qvariant.h>
+#include <qcheckbox.h>
+#include <q3frame.h>
+#include <qlabel.h>
+#include <qlcdnumber.h>
+#include <q3listbox.h>
+#include <qpushbutton.h>
+#include <qslider.h>
+#include <qtoolbutton.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <q3whatsthis.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+static const char* const image0_data[] = {
+"16 16 56 1",
+". c None",
+"F c #000000",
+"L c #000101",
+"E c #010304",
+"C c #06101d",
+"j c #071728",
+"w c #07182a",
+"1 c #071c2c",
+"0 c #081c2d",
+"e c #081e31",
+"a c #0a121f",
+"Z c #0a1929",
+"Q c #0a263b",
+"T c #0a273b",
+"z c #0e97bf",
+"s c #0ea0c5",
+"K c #0f5d7e",
+"B c #105375",
+"G c #114760",
+"N c #1197b9",
+"x c #124c6d",
+"# c #124d6f",
+"u c #1290b5",
+"v c #135476",
+"h c #1390b4",
+"Y c #14839f",
+"b c #155474",
+"i c #155678",
+"o c #155a7a",
+"J c #159abc",
+"d c #17587a",
+"V c #178eac",
+"f c #194a6a",
+"r c #19b3ce",
+"k c #1b4b6a",
+"p c #1b4f6f",
+"A c #1ca2c3",
+"D c #20374f",
+"P c #2294b1",
+"I c #22bad1",
+"S c #2a98b3",
+"U c #2cc7d5",
+"n c #3cd7e1",
+"O c #43d5de",
+"t c #48dfe9",
+"X c #58acc5",
+"m c #59c3da",
+"q c #71d1e0",
+"W c #80c2db",
+"c c #819eba",
+"H c #9ddeee",
+"M c #cdebf6",
+"g c #ddeff8",
+"y c #e2f0f9",
+"R c #fdfafd",
+"l c #fdfcfd",
+"................",
+"................",
+".......#a.......",
+"......bcde......",
+".....fcghij.....",
+"....kclmnhoj....",
+"...pclqrstuvw...",
+"..xcymrzzsnABC..",
+".BDEFGHzIJKLFFF.",
+".....BMNOPQ.....",
+".....BRNOST.....",
+".....BMNUVT.....",
+".....BWXIYF.....",
+".....BZ01FF.....",
+"................",
+"................"};
+
+static const char* const image1_data[] = {
+"16 16 50 1",
+". c None",
+"E c #010001",
+"O c #03060c",
+"U c #050b12",
+"u c #05151e",
+"S c #060f19",
+"m c #06141d",
+"q c #06141f",
+"h c #071620",
+"D c #0b293e",
+"c c #0d324c",
+"v c #0d3652",
+"A c #0e5775",
+"J c #0e8fb6",
+"x c #0e94b9",
+"r c #0e97bf",
+"Q c #0e9ec3",
+"n c #0eadcb",
+"R c #0fa0c4",
+"N c #106589",
+"V c #10698f",
+"B c #114560",
+"# c #124d6f",
+"z c #1299bb",
+"C c #144059",
+"T c #14a5c9",
+"K c #15c1da",
+"b c #18425f",
+"y c #1bbad1",
+"M c #1ca2c3",
+"t c #1f95b2",
+"a c #254a64",
+"p c #2695b1",
+"l c #2b91ae",
+"F c #337f9e",
+"o c #40d1db",
+"s c #46dbe6",
+"L c #48dfe9",
+"I c #54bdd7",
+"j c #5fc0d8",
+"g c #64a3bd",
+"k c #8fcce2",
+"d c #a0cbdf",
+"H c #a7dcec",
+"w c #bfdfee",
+"f c #d3e5f0",
+"G c #dfeff8",
+"i c #e0f1fb",
+"e c #eff3fc",
+"P c #ffffff",
+"................",
+"................",
+".....###abc.....",
+".....#defgh.....",
+".....#ijklm.....",
+".....#enopq.....",
+".....airstu.....",
+".v##aawxyzABCDE.",
+"..vFGHIJrKLMNO..",
+"...vFPQrRLMNS...",
+"....vFPTLMNU....",
+".....vFGMNU.....",
+"......vVNS......",
+".......vO.......",
+"................",
+"................"};
+
+
+/*
+ * Constructs a RhythmGenerator which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ *
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * TRUE to construct a modal dialog.
+ */
+RhythmGenerator::RhythmGenerator( QWidget* parent, const char* name, bool modal, Qt::WFlags fl )
+ : QDialog( parent, name, modal, fl )
+{
+ QPixmap image0( ( const char** ) image0_data );
+ QPixmap image1( ( const char** ) image1_data );
+ if ( !name )
+ setName( "RhythmGenerator" );
+ resize( 500, 777 );
+ setCaption( trUtf8( "Form3" ) );
+ RhythmGeneratorLayout = new Q3VBoxLayout( this, 11, 6, "RhythmGeneratorLayout");
+
+ Frame6 = new Q3Frame( this, "Frame6" );
+ Frame6->setFrameShape( Q3Frame::StyledPanel );
+ Frame6->setFrameShadow( Q3Frame::Raised );
+ Frame6Layout = new Q3VBoxLayout( Frame6, 11, 6, "Frame6Layout");
+
+ TextLabel1 = new QLabel( Frame6, "TextLabel1" );
+ QFont TextLabel1_font( TextLabel1->font() );
+ TextLabel1_font.setBold( TRUE );
+ TextLabel1_font.setUnderline( TRUE );
+ TextLabel1->setFont( TextLabel1_font );
+ TextLabel1->setText( trUtf8( "Instrument Settings:" ) );
+ Frame6Layout->addWidget( TextLabel1 );
+
+ Layout17 = new Q3HBoxLayout( 0, 0, 15, "Layout17");
+
+ Layout16 = new Q3VBoxLayout( 0, 0, 6, "Layout16");
+
+ InstrumentListLabel = new QLabel( Frame6, "InstrumentListLabel" );
+ InstrumentListLabel->setText( trUtf8( "Instrument" ) );
+ Layout16->addWidget( InstrumentListLabel );
+
+ InstrumentList = new Q3ListBox( Frame6, "InstrumentList" );
+ InstrumentList->insertItem( trUtf8( "Hi-Hat" ) );
+ InstrumentList->setMinimumSize( QSize( 150, 70 ) );
+ Layout16->addWidget( InstrumentList );
+
+ Layout11 = new Q3HBoxLayout( 0, 0, 2, "Layout11");
+
+ InstrumentUp = new QToolButton( Frame6, "InstrumentUp" );
+ InstrumentUp->setMinimumSize( QSize( 40, 20 ) );
+ InstrumentUp->setText( trUtf8( "" ) );
+ InstrumentUp->setPixmap( image0 );
+ Layout11->addWidget( InstrumentUp );
+
+ InstrumentDown = new QToolButton( Frame6, "InstrumentDown" );
+ InstrumentDown->setMinimumSize( QSize( 40, 20 ) );
+ InstrumentDown->setText( trUtf8( "" ) );
+ InstrumentDown->setPixmap( image1 );
+ Layout11->addWidget( InstrumentDown );
+
+ InstrumentAdd = new QToolButton( Frame6, "InstrumentAdd" );
+ InstrumentAdd->setMinimumSize( QSize( 40, 20 ) );
+ InstrumentAdd->setText( trUtf8( "add" ) );
+ Layout11->addWidget( InstrumentAdd );
+
+ InstrumentDel = new QToolButton( Frame6, "InstrumentDel" );
+ InstrumentDel->setMinimumSize( QSize( 40, 20 ) );
+ InstrumentDel->setText( trUtf8( "delete" ) );
+ Layout11->addWidget( InstrumentDel );
+ Layout16->addLayout( Layout11 );
+ Layout17->addLayout( Layout16 );
+
+ Layout20 = new Q3VBoxLayout( 0, 0, 6, "Layout20");
+
+ StepsLabel = new QLabel( Frame6, "StepsLabel" );
+ StepsLabel->setText( trUtf8( "steps/count" ) );
+ Layout20->addWidget( StepsLabel );
+
+ StepsLayout = new Q3HBoxLayout( 0, 0, 6, "StepsLayout");
+
+ StepsSlider = new QSlider( Frame6, "StepsSlider" );
+ StepsSlider->setMaxValue( 16 );
+ StepsSlider->setValue( 4 );
+ StepsSlider->setOrientation( Qt::Horizontal );
+ StepsLayout->addWidget( StepsSlider );
+
+ StepsNumber = new QLCDNumber( Frame6, "StepsNumber" );
+ StepsNumber->setPaletteBackgroundColor( QColor( 212, 212, 192 ) );
+ StepsNumber->setLineWidth( 1 );
+ StepsNumber->setNumDigits( 2 );
+ StepsNumber->setSegmentStyle( QLCDNumber::Flat );
+ StepsNumber->setProperty( "value", 4 );
+ StepsLayout->addWidget( StepsNumber );
+ Layout20->addLayout( StepsLayout );
+
+ CountLabel = new QLabel( Frame6, "CountLabel" );
+ CountLabel->setText( trUtf8( "count/bar" ) );
+ Layout20->addWidget( CountLabel );
+
+ CountLayout = new Q3HBoxLayout( 0, 0, 6, "CountLayout");
+
+ CountSlider = new QSlider( Frame6, "CountSlider" );
+ CountSlider->setMaxValue( 16 );
+ CountSlider->setValue( 4 );
+ CountSlider->setOrientation( Qt::Horizontal );
+ CountLayout->addWidget( CountSlider );
+
+ CountNumber = new QLCDNumber( Frame6, "CountNumber" );
+ CountNumber->setPaletteBackgroundColor( QColor( 212, 212, 192 ) );
+ CountNumber->setNumDigits( 2 );
+ CountNumber->setSegmentStyle( QLCDNumber::Flat );
+ CountNumber->setProperty( "value", 4 );
+ CountLayout->addWidget( CountNumber );
+ Layout20->addLayout( CountLayout );
+
+ BarsLabel = new QLabel( Frame6, "BarsLabel" );
+ BarsLabel->setText( trUtf8( "# bars" ) );
+ Layout20->addWidget( BarsLabel );
+
+ BarsLayout = new Q3HBoxLayout( 0, 0, 6, "BarsLayout");
+
+ BarsSlider = new QSlider( Frame6, "BarsSlider" );
+ BarsSlider->setMaxValue( 16 );
+ BarsSlider->setValue( 1 );
+ BarsSlider->setOrientation( Qt::Horizontal );
+ BarsLayout->addWidget( BarsSlider );
+
+ BarsNumber = new QLCDNumber( Frame6, "BarsNumber" );
+ BarsNumber->setPaletteBackgroundColor( QColor( 212, 212, 192 ) );
+ BarsNumber->setNumDigits( 2 );
+ BarsNumber->setSegmentStyle( QLCDNumber::Flat );
+ BarsNumber->setProperty( "value", 1 );
+ BarsLayout->addWidget( BarsNumber );
+ Layout20->addLayout( BarsLayout );
+ Layout17->addLayout( Layout20 );
+ Frame6Layout->addLayout( Layout17 );
+ RhythmGeneratorLayout->addWidget( Frame6 );
+
+ Layout27 = new Q3HBoxLayout( 0, 0, 15, "Layout27");
+
+ Frame5 = new Q3Frame( this, "Frame5" );
+ Frame5->setFrameShape( Q3Frame::StyledPanel );
+ Frame5->setFrameShadow( Q3Frame::Raised );
+ Frame5Layout = new Q3VBoxLayout( Frame5, 11, 6, "Frame5Layout");
+
+ TextLabel2 = new QLabel( Frame5, "TextLabel2" );
+ QFont TextLabel2_font( TextLabel2->font() );
+ TextLabel2_font.setBold( TRUE );
+ TextLabel2_font.setUnderline( TRUE );
+ TextLabel2->setFont( TextLabel2_font );
+ TextLabel2->setText( trUtf8( "Group Settings:" ) );
+ Frame5Layout->addWidget( TextLabel2 );
+
+ Layout20_2 = new Q3HBoxLayout( 0, 0, 15, "Layout20_2");
+
+ GroupListLayout = new Q3VBoxLayout( 0, 0, 6, "GroupListLayout");
+
+ GroupListLabel = new QLabel( Frame5, "GroupListLabel" );
+ GroupListLabel->setText( trUtf8( "Group" ) );
+ GroupListLayout->addWidget( GroupListLabel );
+
+ GroupList = new Q3ListBox( Frame5, "GroupList" );
+ GroupList->insertItem( trUtf8( "Group 1" ) );
+ GroupList->insertItem( trUtf8( "Group 2" ) );
+ GroupList->insertItem( trUtf8( "Group 3" ) );
+ GroupList->insertItem( trUtf8( "Group 4" ) );
+ GroupList->insertItem( trUtf8( "Group 5" ) );
+ GroupList->setMinimumSize( QSize( 150, 90 ) );
+ GroupListLayout->addWidget( GroupList );
+ Layout20_2->addLayout( GroupListLayout );
+
+ Layout19 = new Q3VBoxLayout( 0, 0, 6, "Layout19");
+
+ ContribLabel = new QLabel( Frame5, "ContribLabel" );
+ ContribLabel->setText( trUtf8( "contrib" ) );
+ Layout19->addWidget( ContribLabel );
+
+ ContribLayout = new Q3HBoxLayout( 0, 0, 6, "ContribLayout");
+
+ ContribSlider = new QSlider( Frame5, "ContribSlider" );
+ ContribSlider->setMinimumSize( QSize( 100, 0 ) );
+ ContribSlider->setMaxValue( 100 );
+ ContribSlider->setOrientation( Qt::Horizontal );
+ ContribLayout->addWidget( ContribSlider );
+
+ ContribNumber = new QLCDNumber( Frame5, "ContribNumber" );
+ ContribNumber->setPaletteBackgroundColor( QColor( 212, 212, 192 ) );
+ ContribNumber->setNumDigits( 3 );
+ ContribNumber->setSegmentStyle( QLCDNumber::Flat );
+ ContribLayout->addWidget( ContribNumber );
+ Layout19->addLayout( ContribLayout );
+
+ ListenLabel = new QLabel( Frame5, "ListenLabel" );
+ ListenLabel->setText( trUtf8( "listen" ) );
+ Layout19->addWidget( ListenLabel );
+
+ ListenLayout = new Q3HBoxLayout( 0, 0, 6, "ListenLayout");
+
+ ListenSlider = new QSlider( Frame5, "ListenSlider" );
+ ListenSlider->setMinimumSize( QSize( 100, 0 ) );
+ ListenSlider->setMinValue( -99 );
+ ListenSlider->setMaxValue( 100 );
+ ListenSlider->setOrientation( Qt::Horizontal );
+ ListenLayout->addWidget( ListenSlider );
+
+ ListenNumber = new QLCDNumber( Frame5, "ListenNumber" );
+ ListenNumber->setPaletteBackgroundColor( QColor( 212, 212, 192 ) );
+ ListenNumber->setNumDigits( 3 );
+ ListenNumber->setSegmentStyle( QLCDNumber::Flat );
+ ListenLayout->addWidget( ListenNumber );
+ Layout19->addLayout( ListenLayout );
+ Layout20_2->addLayout( Layout19 );
+ Frame5Layout->addLayout( Layout20_2 );
+
+ RandomizeCheck = new QCheckBox( Frame5, "RandomizeCheck" );
+ RandomizeCheck->setText( trUtf8( "Randomize" ) );
+ Frame5Layout->addWidget( RandomizeCheck );
+ Layout27->addWidget( Frame5 );
+
+ Frame5_2 = new Q3Frame( this, "Frame5_2" );
+ Frame5_2->setFrameShape( Q3Frame::StyledPanel );
+ Frame5_2->setFrameShadow( Q3Frame::Raised );
+ Frame5_2Layout = new Q3VBoxLayout( Frame5_2, 11, 6, "Frame5_2Layout");
+
+ TextLabel3 = new QLabel( Frame5_2, "TextLabel3" );
+ QFont TextLabel3_font( TextLabel3->font() );
+ TextLabel3_font.setBold( TRUE );
+ TextLabel3_font.setUnderline( TRUE );
+ TextLabel3->setFont( TextLabel3_font );
+ TextLabel3->setText( trUtf8( "Rhythm Style:" ) );
+ Frame5_2Layout->addWidget( TextLabel3 );
+
+ Layout21 = new Q3VBoxLayout( 0, 0, 2, "Layout21");
+
+ ToolButton7 = new QToolButton( Frame5_2, "ToolButton7" );
+ ToolButton7->setText( trUtf8( "Clear" ) );
+ Layout21->addWidget( ToolButton7 );
+
+ ToolButton8 = new QToolButton( Frame5_2, "ToolButton8" );
+ ToolButton8->setText( trUtf8( "Open..." ) );
+ Layout21->addWidget( ToolButton8 );
+
+ ToolButton9 = new QToolButton( Frame5_2, "ToolButton9" );
+ ToolButton9->setText( trUtf8( "Save" ) );
+ Layout21->addWidget( ToolButton9 );
+
+ ToolButton10 = new QToolButton( Frame5_2, "ToolButton10" );
+ ToolButton10->setText( trUtf8( "Save as..." ) );
+ Layout21->addWidget( ToolButton10 );
+ Frame5_2Layout->addLayout( Layout21 );
+
+ Layout22 = new Q3VBoxLayout( 0, 0, 2, "Layout22");
+
+ ToolButton5 = new QToolButton( Frame5_2, "ToolButton5" );
+ ToolButton5->setText( trUtf8( "Generate" ) );
+ Layout22->addWidget( ToolButton5 );
+
+ ToolButton6 = new QToolButton( Frame5_2, "ToolButton6" );
+ ToolButton6->setText( trUtf8( "Close" ) );
+ Layout22->addWidget( ToolButton6 );
+ Frame5_2Layout->addLayout( Layout22 );
+ Layout27->addWidget( Frame5_2 );
+ RhythmGeneratorLayout->addLayout( Layout27 );
+
+ Layout29 = new Q3HBoxLayout( 0, 0, 6, "Layout29");
+
+ Frame6_2 = new Q3Frame( this, "Frame6_2" );
+ Frame6_2->setMinimumSize( QSize( 200, 150 ) );
+ Frame6_2->setFrameShape( Q3Frame::StyledPanel );
+ Frame6_2->setFrameShadow( Q3Frame::Raised );
+ Layout29->addWidget( Frame6_2 );
+
+ Frame7 = new Q3Frame( this, "Frame7" );
+ Frame7->setMinimumSize( QSize( 200, 150 ) );
+ Frame7->setFrameShape( Q3Frame::StyledPanel );
+ Frame7->setFrameShadow( Q3Frame::Raised );
+ Layout29->addWidget( Frame7 );
+ RhythmGeneratorLayout->addLayout( Layout29 );
+
+ Frame8 = new Q3Frame( this, "Frame8" );
+ Frame8->setMinimumSize( QSize( 400, 150 ) );
+ Frame8->setFrameShape( Q3Frame::StyledPanel );
+ Frame8->setFrameShadow( Q3Frame::Raised );
+ RhythmGeneratorLayout->addWidget( Frame8 );
+
+ // signals and slots connections
+ connect( StepsSlider, SIGNAL( valueChanged(int) ), StepsNumber, SLOT( display(int) ) );
+ connect( CountSlider, SIGNAL( valueChanged(int) ), CountNumber, SLOT( display(int) ) );
+ connect( BarsSlider, SIGNAL( valueChanged(int) ), BarsNumber, SLOT( display(int) ) );
+ connect( ContribSlider, SIGNAL( valueChanged(int) ), ContribNumber, SLOT( display(int) ) );
+ connect( ListenSlider, SIGNAL( valueChanged(int) ), ListenNumber, SLOT( display(int) ) );
+ connect( InstrumentDel, SIGNAL( pressed() ), InstrumentList, SLOT( clearSelection() ) );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+RhythmGenerator::~RhythmGenerator()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+#endif
+
diff --git a/muse2/muse/mplugins/rhythm.h b/muse2/muse/mplugins/rhythm.h
new file mode 100644
index 00000000..013fba08
--- /dev/null
+++ b/muse2/muse/mplugins/rhythm.h
@@ -0,0 +1,196 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: rhythm.h,v 1.1.1.1 2003/10/27 18:52:44 wschweer Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//
+// This code is an adaption of the random rhythm generator taken
+// from "The JAZZ++ Midi Sequencer"
+// Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all
+// rights reserved.
+// Distributed under the GNU General Public License
+//=========================================================
+
+#ifndef __RHYTHM_H__
+#define __RHYTHM_H__
+
+#include "rhythmbase.h"
+//Added by qt3to4:
+#include <QCloseEvent>
+
+class tTrack;
+class tEventWin;
+class tSong;
+class tBarInfo;
+
+#define MAX_GROUPS 5
+#define MAX_KEYS 20
+
+class Xml;
+
+#if 0
+//---------------------------------------------------------
+// tRhyGroup
+//---------------------------------------------------------
+
+struct tRhyGroup {
+ int contrib;
+ int listen;
+
+ tRhyGroup() {
+ listen = 0;
+ contrib = 0;
+ }
+// void write(int, Xml&);
+// void read(Xml&);
+ };
+
+//---------------------------------------------------------
+// tRhyGroups
+//---------------------------------------------------------
+
+struct tRhyGroups {
+ tRhyGroup g[MAX_GROUPS];
+ tRhyGroup& operator [] (int i) { return g[i]; }
+
+// void write(int, Xml&);
+// void read(Xml&);
+ };
+
+//---------------------------------------------------------
+// tRhythm
+//---------------------------------------------------------
+
+class tRhythm
+ {
+ friend class tRhythmWin;
+
+ char* label;
+
+// tRndArray rhythm;
+// tRndArray length;
+// tRndArray veloc;
+
+ int steps_per_count;
+ int count_per_bar;
+ int n_bars;
+ int keys[MAX_KEYS];
+ int n_keys;
+ int mode;
+ int parm;
+
+ int randomize;
+ tRhyGroups groups;
+// tRndArray history;
+
+ // set by GenInit()
+ long start_clock;
+ long next_clock;
+
+// void GenGroup(tRndArray& out, int grp, tBarInfo &bi, tRhythm *rhy[], int n_rhy);
+ int Clock2i(long clock, tBarInfo &bi) const;
+ int ClocksPerStep(tBarInfo &bi) const;
+
+ public:
+ tRhythm(int key);
+ tRhythm(const tRhythm &o);
+ tRhythm & operator= (const tRhythm &o);
+ virtual ~tRhythm();
+
+ char const * GetLabel() { return label; }
+ void SetLabel(char const *);
+
+ void Generate(tTrack *track, long fr_clock, long to_clock, long ticks_per_bar);
+ void Generate(tTrack *track, tBarInfo &bi, tRhythm *rhy[], int n_rhy);
+ void GenInit(long start_clock);
+ void GenerateEvent(tTrack *track, long clock, short vel, short len);
+
+ void write(int, Xml&);
+ void read(Xml&);
+ };
+#endif
+
+//---------------------------------------------------------
+// RhythmGen
+//---------------------------------------------------------
+
+class RhythmGen : public RhythmBase
+ {
+ Q_OBJECT
+#if 0
+ wxPanel *inst_panel;
+ wxText *label;
+ wxSlider *steps_per_count;
+ wxSlider *count_per_bar;
+ wxSlider *n_bars;
+ wxListBox *instrument_list;
+ wxCheckBox *rand_checkbox;
+
+ wxPanel *group_panel;
+ wxListBox *group_list;
+ wxSlider *group_contrib;
+ wxSlider *group_listen;
+ int act_group;
+
+ tArrayEdit *length_edit;
+ tArrayEdit *veloc_edit;
+ tRhyArrayEdit *rhythm_edit;
+
+ enum { MAX_INSTRUMENTS = 20 };
+ tRhythm *instruments[MAX_INSTRUMENTS];
+ int n_instruments;
+ int act_instrument; // -1 if none
+
+ // this one is edited and copied from/to instruments[i]
+ tRhythm edit;
+
+ // ignore Updates while creating the window (motif)
+ Bool in_create;
+
+ // callbacks
+ static void ItemCallback(wxItem& item, wxCommandEvent& event);
+ static void SelectInstr(wxListBox& list, wxCommandEvent& event);
+ static void SelectGroup(wxListBox& list, wxCommandEvent& event);
+ static void Add(wxButton &but, wxCommandEvent& event);
+ static void Del(wxButton &but, wxCommandEvent& event);
+ static void Generate(wxButton &but, wxCommandEvent& event);
+ static void Help();
+
+ void Instrument2Win(int i = -1); // instrument[act_instrument] -> win
+ void Win2Instrument(int i = -1); // win -> instrument[act_instrument]
+ void AddInstrumentDlg();
+ void AddInstrument(tRhythm *r);
+ void DelInstrument();
+
+ tEventWin *event_win;
+ tSong *song;
+
+ void RndEnable();
+
+ char *default_filename;
+ int has_changed;
+ wxToolBar *tool_bar;
+ float tb_width, tb_height;
+
+ void UpInstrument();
+ void DownInstrument();
+ void InitInstrumentList();
+#endif
+ virtual void closeEvent(QCloseEvent*);
+
+ signals:
+ void hideWindow();
+
+ public:
+// virtual void OnMenuCommand(int id);
+// virtual void OnSize(int w, int h);
+ RhythmGen(QWidget* parent = 0, const char* name = 0, Qt::WFlags fo = Qt::WType_TopLevel);
+ virtual ~RhythmGen();
+// void OnPaint();
+// void GenRhythm();
+// bool OnClose();
+ };
+
+#endif
+
diff --git a/muse2/muse/mplugins/rhythmbase.ui b/muse2/muse/mplugins/rhythmbase.ui
new file mode 100644
index 00000000..4d236c52
--- /dev/null
+++ b/muse2/muse/mplugins/rhythmbase.ui
@@ -0,0 +1,1004 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>RhythmBase</class>
+<widget class="QMainWindow">
+ <property name="name">
+ <cstring>RhythmBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>448</width>
+ <height>603</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Random Rhythm Generator</string>
+ </property>
+ <property name="opaqueMoving">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>6</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Instrument Properties</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout2_2</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="1" column="2">
+ <property name="name">
+ <cstring>TextLabel2_3_2</cstring>
+ </property>
+ <property name="text">
+ <string>counts/bar</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>TextLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>steps/count</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="2">
+ <property name="name">
+ <cstring>TextLabel1_2_2</cstring>
+ </property>
+ <property name="text">
+ <string># bars</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>lineInstrument_2</cstring>
+ </property>
+ <property name="text">
+ <string>test</string>
+ </property>
+ <property name="dragEnabled">
+ <bool>false</bool>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="5">
+ <property name="name">
+ <cstring>spinboxContrib_2</cstring>
+ </property>
+ <property name="maxValue">
+ <number>100</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="4">
+ <property name="name">
+ <cstring>labelContrib_2</cstring>
+ </property>
+ <property name="text">
+ <string>contrib</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>checkRandomize_2</cstring>
+ </property>
+ <property name="text">
+ <string>randomize</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="tristate">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string></string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Group 1</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Group 2</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Group 3</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Group 4</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Group 5</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>comboGroupSel_2</cstring>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="3">
+ <property name="name">
+ <cstring>spinBoxSteps_2</cstring>
+ </property>
+ <property name="maxValue">
+ <number>16</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>4</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="3">
+ <property name="name">
+ <cstring>spinboxBars_2</cstring>
+ </property>
+ <property name="maxValue">
+ <number>16</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="4">
+ <property name="name">
+ <cstring>labelListen_2</cstring>
+ </property>
+ <property name="text">
+ <string>listen</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1_4</cstring>
+ </property>
+ <property name="text">
+ <string>Instrument</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="3">
+ <property name="name">
+ <cstring>spinboxCounts_2</cstring>
+ </property>
+ <property name="maxValue">
+ <number>16</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>4</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="5">
+ <property name="name">
+ <cstring>spinboxListen_2</cstring>
+ </property>
+ <property name="maxValue">
+ <number>100</number>
+ </property>
+ <property name="minValue">
+ <number>-100</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel1_3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Group</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout65_2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonNew_2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;New</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>create new entry</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>pressing the New button you create a new entry
+in the MusE list of defined controllers</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonDelete_2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Delete</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>delete selected entry</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonUp_2</cstring>
+ </property>
+ <property name="text">
+ <string>Up</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonDown_2</cstring>
+ </property>
+ <property name="text">
+ <string>Down</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>Instrument </string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Group</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>steps/count </string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>counts/bar</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string># bars</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>contrib</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>listen</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>viewInstrument</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>150</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>150</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>list of defined controllers</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This is the MusE list of defined controllers.</string>
+ </property>
+ </widget>
+ <widget class="QSplitter" row="2" column="0">
+ <property name="name">
+ <cstring>Splitter3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>Splitter2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>Frame3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>50</width>
+ <height>50</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>Frame4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>50</width>
+ <height>50</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>Frame5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>150</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>64</x>
+ <y>26</y>
+ <width>250</width>
+ <height>90</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;Notice!&lt;/b&gt;&lt;br&gt;
+Random Rhythm Generator is not enabled yet!</string>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<menubar>
+ <property name="name">
+ <cstring>menubar</cstring>
+ </property>
+ <item text="&amp;File" name="fileMenu">
+ <action name="fileNewAction"/>
+ <action name="fileOpenAction"/>
+ <action name="fileSaveAction"/>
+ <action name="fileSaveAsAction"/>
+ <separator/>
+ <action name="filePrintAction"/>
+ <separator/>
+ <action name="fileExitAction"/>
+ </item>
+ <item text="&amp;Edit" name="editMenu">
+ <action name="editUndoAction"/>
+ <action name="editRedoAction"/>
+ <separator/>
+ <action name="editCutAction"/>
+ <action name="editCopyAction"/>
+ <action name="editPasteAction"/>
+ <separator/>
+ <action name="editFindAction"/>
+ </item>
+ <item text="&amp;Help" name="helpMenu">
+ <action name="helpContentsAction"/>
+ <action name="helpIndexAction"/>
+ <separator/>
+ <action name="helpAboutAction"/>
+ </item>
+</menubar>
+<toolbars>
+ <toolbar dock="2">
+ <property name="name">
+ <cstring>toolBar</cstring>
+ </property>
+ <property name="label">
+ <string>Tools</string>
+ </property>
+ <action name="fileNewAction"/>
+ <action name="fileOpenAction"/>
+ <action name="fileSaveAction"/>
+ </toolbar>
+</toolbars>
+<actions>
+ <action>
+ <property name="name">
+ <cstring>fileNewAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image0</iconset>
+ </property>
+ <property name="text">
+ <string>New</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;New</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+N</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileOpenAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image1</iconset>
+ </property>
+ <property name="text">
+ <string>Open</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Open...</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+O</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileSaveAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image2</iconset>
+ </property>
+ <property name="text">
+ <string>Save</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Save</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+S</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileSaveAsAction</cstring>
+ </property>
+ <property name="text">
+ <string>Save As</string>
+ </property>
+ <property name="menuText">
+ <string>Save &amp;As...</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>filePrintAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image3</iconset>
+ </property>
+ <property name="text">
+ <string>Print</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Print...</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+P</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileExitAction</cstring>
+ </property>
+ <property name="text">
+ <string>Exit</string>
+ </property>
+ <property name="menuText">
+ <string>E&amp;xit</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editUndoAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image4</iconset>
+ </property>
+ <property name="text">
+ <string>Undo</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Undo</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+Z</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editRedoAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image5</iconset>
+ </property>
+ <property name="text">
+ <string>Redo</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Redo</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+Y</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editCutAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image6</iconset>
+ </property>
+ <property name="text">
+ <string>Cut</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Cut</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+X</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editCopyAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image7</iconset>
+ </property>
+ <property name="text">
+ <string>Copy</string>
+ </property>
+ <property name="menuText">
+ <string>C&amp;opy</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+C</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editPasteAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image8</iconset>
+ </property>
+ <property name="text">
+ <string>Paste</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Paste</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+V</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editFindAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image9</iconset>
+ </property>
+ <property name="text">
+ <string>Find</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Find...</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+F</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>helpContentsAction</cstring>
+ </property>
+ <property name="text">
+ <string>Contents</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Contents...</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>helpIndexAction</cstring>
+ </property>
+ <property name="text">
+ <string>Index</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Index...</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>helpAboutAction</cstring>
+ </property>
+ <property name="text">
+ <string>About</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;About...</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+</actions>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="721">789cedd2310ac23014c6f13da778245b11ab29c114f1088aa3200eaf2f151daaa07510f1eef64553ac696fe04787fcf90dc9d03481cd7a09492aae35d647023ae0051277abaafb76b77808a93534df0ca67224e4180856e753c967d59cd5c48fb3e0d4b9269d7312a741e30c723a4e9b596333ce92930c69329cc8b9f7f3b7f42e886a1709bea70a3524142812172892325024182892f681bff2f1bf74a5bb2f19fe0f7ae439172f13a0a94f</data>
+ </image>
+ <image name="image1">
+ <data format="XPM.GZ" length="691">789cad914d0ac2301085f739c5d0d905b1b62214c423282e05713189165d5441eb42c4bb9b9fa6a67644045f0299978f3713482a61b59c834cc5a5a6faa041efe90c727badaadb7a33bb8b24cfc1ec0964c9402443d0b0381d77b64653e3c8c95a6d6d312e326fc9dad2c85b156c59ba3eacfe41d0c89defc4dfa2dd7c37fc44b025a179043c4152a4b055f4365414ad0e8901fd94c1ae5e19441da9211c68e7f44098d3074d86019e70a0210c089958df7ffb31154f9c7397a6</data>
+ </image>
+ <image name="image2">
+ <data format="XPM.GZ" length="691">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022530543251d2e253d856405bffcbc54105b19c856360003103711c4b530b63084709340dc64d364a36453103719cc4d49324b0173f5b002b08c32160095494c544e4202400e6932c9406174d39293617a807c226510f6d04e2611d9ff892832688028196554e3b0c9e076010d65b04437341d604f21b5d65c008f8da445</data>
+ </image>
+ <image name="image3">
+ <data format="XPM.GZ" length="2509">789c7d944973db381085effe152af7cd35d5a1242e604dcdc189b37a899d65e2646a0e240168b32cc992bc646afefb34ba1b509671f40c9a9fde43a349507c72d0bb3c3fed1d3cd95b6f9acda4eb75e3e6a67760b7f3f9c35f7ffff1cfdefe60d0a33f637a83fddff6f62f36bdae77b6b87601704000197f98df331bef3313186e03f7b3ccf4c5ff281cc47e9798f378ca6c22835336ea1f461e48bd93c0832c325c0907b1ff3571cdfe9cb94ebc5536cad791877d9eff4ed87bf5178187fde47f101e66c2b04ccc79fc22ecbdfa2be63afab051369a7f889c4b7e1d38ef47c685709ea93f666e7253f0e620f75f34455634ecdf28d7a5f8af853ba77e1bb86cca7ec98c4be55af93e723564fe2cecbdd6e3fb5d0d93cfd753b555bf6a99d7918df899b0f7ea737f6658d5ea6f13b30f23615308233f4fa6adea3a677f229cfcbbc8ea4f95adfa26b2f8c8cf439d478659e28ed90bd75a0f5789d9c737c25da9f32d73177d682237327fa6acf5f12cb2faaf843ba77c1cb8c9a30f9858e64f849b587f9858d607e62ee5ff148e3e5a65a73c8ddc4abd3a709b2706e1b654e6eb6b6deb5acb5c09db52997fdf5dd1955dc15c305b62f15b65a79c47b6927f11d816895f2696f7cf58d896ea3f4f2cfe85b0f7ea3f6576c9ef477625f34839d63f8aac7e19d89589bdb08bf39f2596f997c2deabff96d925df293be54f817d19c47ccecc1f79f9ee84800db6aa8ed4902c36d1ff29dfa0439fe458a35fe63b56ac2f6b748fe6813b08023dc2e3fd502d2bf552efe11c76891ff2bbba4d4aff3a0fa9aea4c3b08fe6bbef6aa72b79346fe9ae78ba7f3b8d694c48d31ff354678657d4cf98e6ec469833c76b5ce032ac13f3945ee10dae71f39db6788b77788f0ff8150f69ce44f25cfb293ec3233a3e57bdc097f80a5fe31b3ca6e409e9141fe4f78a67f816cf7fd205bec3f7345a5ae503d5ff8827f2bec04fff933ec74bfc8c5f30a3b33ef5768803cd0f69f51c0b1a63ee648425777644e715f5153c43dd0cf050debf58e394561902d2dce3f0c8e0844638030877c2400b5daa3fa7f454b2ac331e2c68c082c53bc98393f73757fc26473567922435388711b4a11f186b7dae9c52e93f555e916b6082f7d08143abf547f4cd1d4c694ce8cae46842926acff89b161c78d95f6ae62aec1fd011e6ac6b589096a41569c9e7fedbe7072ddcc09ab48125ed0d09b6b0a5f98e744bfb3bd3e7eddfdff7fe0305be5c9c</data>
+ </image>
+ <image name="image4">
+ <data format="XPM.GZ" length="661">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c8563600020b63103711c4b530b6308470f5b082019251068344848c32b23808206494a1e23015890819653db8b81e44255c0659025d460fa70c6e3d78ec814b21b90d052422fb070540f50ebaf84196a9b5e6020008a373c8</data>
+ </image>
+ <image name="image5">
+ <data format="XPM.GZ" length="661">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54103b11c8563600020b63105719c4b530b6308470f5b0027acb28278201a64c221c4084136132ca7011885c225c06c91890542256193d98a198327a386570ea49449581bb4d2f114d0624a08c230c50fd4f5cb80da04cad351700eee4866e</data>
+ </image>
+ <image name="image6">
+ <data format="XPM.GZ" length="661">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c856360003103711c6b53006abc40a90649491482ac92863955146d6822ca387474619c9301419a03842825819245bd064129513b1cb242602512216994430d44bc4904984c8c1a5e032897a3019a8144c26518f800c92715864d0ec81ab4dc4701b924fb0850e8a4cad351700fe117ccc</data>
+ </image>
+ <image name="image7">
+ <data format="XPM.GZ" length="706">789c9d92cb0ac2301045f7f98aa1d915b1da82b4889fa0b814c4c54c6ad14515b42e44fc773b79d057ace04da073399c5042a21076db358491b857589d15a813de20cc1f65f9dc1f562f11c431d47b01f36022822928d85c2f479e653dcb990e5772354db82aae4996a8a2e09a734d29cd4c45ae858e3ed69b71226d3c04757ac81036b05edf1ceca0b643364387ccd7a2c69148c625453d079d936be47350239f637ec3e318ec733aa4edd8f997633374dc4d0d9d86fce1b433f60ede4bf101a375a557</data>
+ </image>
+ <image name="image8">
+ <data format="XPM.GZ" length="736">789c7d92d10a82301486ef7d8ae1ee24321561103d42d165105dcce3465d54507611d1bbb7736cbaadd93f85fd7efb183af38cedb66b96e5c9bd93dd09181ce58d65ede37c7eee0fab57929625339760453a4bd23903b6b95e14ceb999f30505abb255545801aba844d1d3c6d69eb658a186126aac12ab36e9176b5bb5a64da37108c784841e7229251f319101b8885e8837d018c2e9a6b925585a1b6a9640030ec1e63a6302c71faee38fd051434247f51f4c2bad4247936008a2b88368c23128ea50628e9e741ce23bdfcd9cf3e1bf8e3d5fe5e5cf1ff25e261ff1b8c16c</data>
+ </image>
+ <image name="image9">
+ <data format="XPM.GZ" length="2798">789cb5d5594f23471007f0773e8545bda1e8bfbe66ecd16a1fcc7d3ab017ec46799899ee010c0603365794ef9e9afe574f2201118a14350ffcd4d555d5c7c08795d6c9e1416be5c3d2dd3c9f9f97adf22cbf6dadb8c574faf4dbef9ffe585aee765bfad369a7adeef22f4bcb47f356d91a5f5ff91a325648b75d8fe0dde0ac3bec66c17bb57b596fd8a30f6af73bfd76bf531bd3da499e64491ee66fe94127a54774e686bde0d5da6937eda4a1198ccd99c56fd1cdfa7b3af7c322783b388ff128e94167c0fcebe68cc665e3b01ec7f43031cfcd8e96473a4bacdf073af7593fc42f6a0f7ab11eeecdb1de6963e65fa787b67f0ce826bf6bccfacfb41e68193ca38b94f5e5daec398f22b868eafd4a0f63fe9c8efdcb4d63e63fa7353ff325e6385f44e75c7f4697162f4fd19cc7b0f6b017eba31f5d70fe8cce9cf57345e749cefadfcdb1de061dfb93cd689b9f9863fc9c8efdc8a5d95b7ee62bf43e78dea7d1850b163ab37e654ae7dee64b3ad6c73eadf598ffabd9ea49156dfb0ff791f5b3c4ded315dddcf722ba0cf5704117b1ff03baa997465bfe5573acd7a15d9c5f6bccfc99d9f687f0bd676596b824d8999dbd8f07bab0fc8268c6cb1d5dc67cdd68db4f9b6eea7da17dece76774c9fadf6ae77a5e8e7faff6697d2fdccf882e52cea317ede91d3ad6970bda79cb7f4737f5c27de5651ecf7b37daf27da69b7ae77419f31dd22ee69b98637d4f6b3dee37bcb742fbb5fbd9367bcb7f44bbe85bdadb7923e42b5c11cff3992ed32a0d7ea25d5a55c127b44f6dfd8d39e6ff4157b63f09e7572665dccf23edbce59fd155ea8325bcaf52ebd9feb6ccdeea5fd35565e719be67975415f31dcddf3ffe7b3c04390a943a0a38f87f8f4785539ce11c131d17b8d435f276bc464f71856b1d33dce016779863f15a0dde1feef1a071333ce209cf1861156b58c7c61bf14e3bd9d4f82d6c6347c72ef6b08f038c5ff6c4ff0738d44e8ef059f37ec157cdff0ddff5f763b857e34f71821ff8a9a38d0ebae8a18f04290618be113fd13db691a123404f447229a414f746fc3d0ec56be68e5418c9291239937399683f2f76ccbfd79aeb4263f7e552a67225d732d37123b7a85e8dd7bb923b99eb286481bedccb838ec7d76ec0ee6b03737992423b7916a7b9473a56e1644d73f957e23d0a59970dd99489769eebc94cebb344a5aba6ffecaa793f5e6b8c655df7782c5bb2cd18d9d13cbbb2a773fee57bd617ea7426977dd9f93ba3ea40d75886f7bc7fadbd90b156c9dfffbde8def774cdf6fbbf2f48bdf7fffdfbfdf3e3d25f9a24cea0</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>fileNewAction</sender>
+ <signal>activated()</signal>
+ <receiver>RhythmBase</receiver>
+ <slot>fileNew()</slot>
+ </connection>
+ <connection>
+ <sender>fileOpenAction</sender>
+ <signal>activated()</signal>
+ <receiver>RhythmBase</receiver>
+ <slot>fileOpen()</slot>
+ </connection>
+ <connection>
+ <sender>fileSaveAction</sender>
+ <signal>activated()</signal>
+ <receiver>RhythmBase</receiver>
+ <slot>fileSave()</slot>
+ </connection>
+ <connection>
+ <sender>fileSaveAsAction</sender>
+ <signal>activated()</signal>
+ <receiver>RhythmBase</receiver>
+ <slot>fileSaveAs()</slot>
+ </connection>
+ <connection>
+ <sender>filePrintAction</sender>
+ <signal>activated()</signal>
+ <receiver>RhythmBase</receiver>
+ <slot>filePrint()</slot>
+ </connection>
+ <connection>
+ <sender>fileExitAction</sender>
+ <signal>activated()</signal>
+ <receiver>RhythmBase</receiver>
+ <slot>fileExit()</slot>
+ </connection>
+ <connection>
+ <sender>editUndoAction</sender>
+ <signal>activated()</signal>
+ <receiver>RhythmBase</receiver>
+ <slot>editUndo()</slot>
+ </connection>
+ <connection>
+ <sender>editRedoAction</sender>
+ <signal>activated()</signal>
+ <receiver>RhythmBase</receiver>
+ <slot>editRedo()</slot>
+ </connection>
+ <connection>
+ <sender>editCutAction</sender>
+ <signal>activated()</signal>
+ <receiver>RhythmBase</receiver>
+ <slot>editCut()</slot>
+ </connection>
+ <connection>
+ <sender>editCopyAction</sender>
+ <signal>activated()</signal>
+ <receiver>RhythmBase</receiver>
+ <slot>editCopy()</slot>
+ </connection>
+ <connection>
+ <sender>editPasteAction</sender>
+ <signal>activated()</signal>
+ <receiver>RhythmBase</receiver>
+ <slot>editPaste()</slot>
+ </connection>
+ <connection>
+ <sender>editFindAction</sender>
+ <signal>activated()</signal>
+ <receiver>RhythmBase</receiver>
+ <slot>editFind()</slot>
+ </connection>
+ <connection>
+ <sender>helpIndexAction</sender>
+ <signal>activated()</signal>
+ <receiver>RhythmBase</receiver>
+ <slot>helpIndex()</slot>
+ </connection>
+ <connection>
+ <sender>helpContentsAction</sender>
+ <signal>activated()</signal>
+ <receiver>RhythmBase</receiver>
+ <slot>helpContents()</slot>
+ </connection>
+ <connection>
+ <sender>helpAboutAction</sender>
+ <signal>activated()</signal>
+ <receiver>RhythmBase</receiver>
+ <slot>helpAbout()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>fileNew()</slot>
+ <slot>fileOpen()</slot>
+ <slot>fileSave()</slot>
+ <slot>fileSaveAs()</slot>
+ <slot>filePrint()</slot>
+ <slot>fileExit()</slot>
+ <slot>editUndo()</slot>
+ <slot>editRedo()</slot>
+ <slot>editCut()</slot>
+ <slot>editCopy()</slot>
+ <slot>editPaste()</slot>
+ <slot>editFind()</slot>
+ <slot>helpIndex()</slot>
+ <slot>helpContents()</slot>
+ <slot>helpAbout()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/mtc.cpp b/muse2/muse/mtc.cpp
new file mode 100644
index 00000000..647d6359
--- /dev/null
+++ b/muse2/muse/mtc.cpp
@@ -0,0 +1,130 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mtc.cpp,v 1.1.1.1 2003/10/27 18:51:48 wschweer Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "mtc.h"
+#include <stdio.h>
+
+extern int mtcType;
+
+//---------------------------------------------------------
+// MTC::time
+// converts MTC Time to seconds according to
+// global mtcType
+//---------------------------------------------------------
+
+double MTC::time(int type) const
+ {
+ double time = _h * 3600 + _m * 60 + _s;
+ double ft = 0.0;
+ if(type == -1)
+ type = mtcType;
+ switch (type) {
+ case 0: // 24 frames sec
+ ft = 1.0/24.0;
+ break;
+ case 1: // 25
+ ft = 0.04;
+ break;
+ case 2: // 30 drop frame TODO
+ case 3: // 30 non drop frame
+ default:
+ ft = 1.0/30.0;
+ break;
+ }
+ return time + ft *_f + 0.01 * ft * _sf;
+ }
+
+//---------------------------------------------------------
+// MTC
+//---------------------------------------------------------
+
+MTC::MTC(double t, int type)
+ {
+ _h = int(t/3600);
+ t -= _h * 3600;
+ _m = int(t/60);
+ t -= _m * 60;
+ _s = int(t);
+ t -= _s;
+ double ft = 1.0/24.0;
+ if(type == -1)
+ type = mtcType;
+ switch (type) {
+ case 0: // 24 frames sec
+ ft = 1.0/24.0;
+ break;
+ case 1: // 25
+ ft = 0.04;
+ break;
+ case 2: // 30 drop frame
+ case 3: // 30 non drop frame
+ default:
+ ft = 1.0/30.0;
+ break;
+ }
+ double frames = t / ft;
+ _f = int(frames);
+ frames -= _f;
+ _sf = int(frames * 100);
+ }
+
+//---------------------------------------------------------
+// incQuarter
+// increment MTC time one quarter frame time
+//---------------------------------------------------------
+
+void MTC::incQuarter(int type)
+ {
+ int frames = 24;
+ if(type == -1)
+ type = mtcType;
+ switch (type) {
+ case 0:
+ frames = 24;
+ break;
+ case 1:
+ frames = 25;
+ break;
+ case 2:
+ case 3:
+ default:
+ frames = 30;
+ break;
+ }
+ _sf += 25;
+ if (_sf >= 100) {
+ ++_f;
+ _sf -= 100;
+ }
+ if (_f == frames) {
+ ++_s;
+ _f = 0;
+ }
+ if (_s == 60) {
+ ++_m;
+ _s = 0;
+ }
+ if (_m == 60) {
+ ++_h;
+ _m = 0;
+ }
+ if (_h == 24) {
+ _h = 0;
+ }
+ }
+
+//---------------------------------------------------------
+// print
+//---------------------------------------------------------
+
+void MTC::print() const
+ {
+ printf("%02d:%02d:%02d:%02d:%02d", _h, _m, _s, _f, _sf);
+ }
+
+
diff --git a/muse2/muse/mtc.h b/muse2/muse/mtc.h
new file mode 100644
index 00000000..ae2bb01e
--- /dev/null
+++ b/muse2/muse/mtc.h
@@ -0,0 +1,56 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mtc.h,v 1.1.1.1 2003/10/27 18:51:25 wschweer Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MTC_H__
+#define __MTC_H__
+
+//---------------------------------------------------------
+// MTC
+//---------------------------------------------------------
+
+class MTC {
+ unsigned char _h, _m, _s, _f, _sf;
+
+ public:
+ MTC(int h, int m, int s, int f, int sf=0) {
+ _h = h;
+ _m = m;
+ _s = s;
+ _f = f;
+ _sf = sf;
+ }
+ MTC() {
+ _h = _m = _s = _f = _sf = 0;
+ }
+ MTC(double, int type = -1);
+ void set(int h, int m, int s, int f, int sf=0) {
+ _h = h;
+ _m = m;
+ _s = s;
+ _f = f;
+ _sf = sf;
+ }
+ void incQuarter(int type = -1);
+ void setH(int val) { _h = val; }
+ void setM(int val) { _m = val; }
+ void setS(int val) { _s = val; }
+ void setF(int val) { _f = val; }
+ void setSf(int val) { _sf = val; }
+
+ int h() const { return _h; }
+ int m() const { return _m; }
+ int s() const { return _s; }
+ int f() const { return _f; }
+ int sf() const { return _sf; }
+ double time(int type = -1) const;
+ void print() const;
+ };
+
+
+#endif
+
diff --git a/muse2/muse/muse.log b/muse2/muse/muse.log
new file mode 100644
index 00000000..887f40d5
--- /dev/null
+++ b/muse2/muse/muse.log
@@ -0,0 +1,1875 @@
+
+*** Beginning merge of project muse
+
+User: ws
+Date: Mon, 11 Aug 2003 15:03:52 +0200
+Common version: 0.2
+Selected version: 0.4
+Working version: 0.2(w)
+
+*** Action on file `m4/alsa.m4'
+No prompt for file `m4/alsa.m4'
+
+*** Action on file `m4/docbook.m4'
+No prompt for file `m4/docbook.m4'
+
+*** Action on file `m4/Makefile.am'
+No prompt for file `m4/Makefile.am'
+
+*** Action on file `m4/aclocal-include.m4'
+No prompt for file `m4/aclocal-include.m4'
+
+*** Action on file `m4/qt.m4'
+No prompt for file `m4/qt.m4'
+
+*** Action on file [symlink:COPYING]
+No prompt for file [symlink:COPYING]
+
+*** Action on file [symlink:INSTALL]
+No prompt for file [symlink:INSTALL]
+
+*** Action on file [symlink:depcomp]
+No prompt for file [symlink:depcomp]
+
+*** Action on file [symlink:mkinstalldirs]
+No prompt for file [symlink:mkinstalldirs]
+
+*** Action on file [symlink:missing]
+No prompt for file [symlink:missing]
+
+*** Action on file [symlink:config.sub]
+No prompt for file [symlink:config.sub]
+
+*** Action on file [symlink:install-sh]
+No prompt for file [symlink:install-sh]
+
+*** Action on file [symlink:config.guess]
+No prompt for file [symlink:config.guess]
+
+*** Action on file [symlink:ltmain.sh]
+No prompt for file [symlink:ltmain.sh]
+
+*** Action on file `configure.ac'
+No prompt for file `configure.ac'
+
+*** Action on file `Doxyfile.in'
+No prompt for file `Doxyfile.in'
+
+*** Action on file `common.am'
+No prompt for file `common.am'
+
+*** Action on file `aclocal.m4'
+No prompt for file `aclocal.m4'
+
+*** Action on file `ChangeLog'
+No prompt for file `ChangeLog'
+
+*** Action on file `README.ladspaguis'
+No prompt for file `README.ladspaguis'
+
+*** Action on file `README.instruments'
+No prompt for file `README.instruments'
+
+*** Action on file `README.translate'
+No prompt for file `README.translate'
+
+*** Action on file `README'
+No prompt for file `README'
+
+*** Action on file `README.de'
+No prompt for file `README.de'
+
+*** Action on file `AUTHORS'
+No prompt for file `AUTHORS'
+
+*** Action on file `README.shortcuts'
+No prompt for file `README.shortcuts'
+
+*** Action on file `README.CVS'
+No prompt for file `README.CVS'
+
+*** Action on file `NEWS'
+No prompt for file `NEWS'
+
+*** Action on file `README.softsynth'
+No prompt for file `README.softsynth'
+
+*** Action on file `SECURITY'
+No prompt for file `SECURITY'
+
+*** Action on file `.cvsignore'
+No prompt for file `.cvsignore'
+
+*** Action on file `Makefile.am'
+No prompt for file `Makefile.am'
+
+*** Action on file `pos.h'
+No prompt for file `pos.h'
+
+*** Action on file `mtc.h'
+No prompt for file `mtc.h'
+
+*** Action on file `cfprint.cpp'
+No prompt for file `cfprint.cpp'
+
+*** Action on file `key.h'
+No prompt for file `key.h'
+
+*** Action on file `app.h'
+No prompt for file `app.h'
+
+*** Action on file `song.cpp'
+No prompt for file `song.cpp'
+
+*** Action on file `key.cpp'
+No prompt for file `key.cpp'
+
+*** Action on file `memory.cpp'
+No prompt for file `memory.cpp'
+
+*** Action on file `midiport.h'
+No prompt for file `midiport.h'
+
+*** Action on file `xml.cpp'
+No prompt for file `xml.cpp'
+
+*** Action on file `undo.cpp'
+No prompt for file `undo.cpp'
+
+*** Action on file `debug.h'
+No prompt for file `debug.h'
+
+*** Action on file `app.cpp'
+No prompt for file `app.cpp'
+
+*** Action on file `thread.h'
+No prompt for file `thread.h'
+
+*** Action on file `icons.h'
+No prompt for file `icons.h'
+
+*** Action on file `midithread.cpp'
+Copied working file `midithread.cpp' to `obsolete/midithread.cpp.v0'
+Merge file `midithread.cpp' by rule 2
+
+*** Action on file `device.h'
+No prompt for file `device.h'
+
+*** Action on file `icons.cpp'
+No prompt for file `icons.cpp'
+
+*** Action on file `wave.h'
+No prompt for file `wave.h'
+
+*** Action on file `ladspa.h'
+No prompt for file `ladspa.h'
+
+*** Action on file `undo.h'
+No prompt for file `undo.h'
+
+*** Action on file `sync.h'
+No prompt for file `sync.h'
+
+*** Action on file `song.h'
+No prompt for file `song.h'
+
+*** Action on file `value.cpp'
+No prompt for file `value.cpp'
+
+*** Action on file `midiport.cpp'
+No prompt for file `midiport.cpp'
+
+*** Action on file `givertcap.c'
+No prompt for file `givertcap.c'
+
+*** Action on file `value.h'
+No prompt for file `value.h'
+
+*** Action on file `part.h'
+No prompt for file `part.h'
+
+*** Action on file `node.h'
+No prompt for file `node.h'
+
+*** Action on file `cobject.cpp'
+No prompt for file `cobject.cpp'
+
+*** Action on file `midithread.h'
+No prompt for file `midithread.h'
+
+*** Action on file `tempo.cpp'
+No prompt for file `tempo.cpp'
+
+*** Action on file `memory.h'
+Copied working file `memory.h' to `obsolete/memory.h.v0'
+Merge file `memory.h' by rule 2, conflicts created
+
+*** Action on file `help.cpp'
+No prompt for file `help.cpp'
+
+*** Action on file `audiomix.h'
+No prompt for file `audiomix.h'
+
+*** Action on file `thread.cpp'
+No prompt for file `thread.cpp'
+
+*** Action on file `mrecord.cpp'
+No prompt for file `mrecord.cpp'
+
+*** Action on file `globals.cpp'
+No prompt for file `globals.cpp'
+
+*** Action on file `pos.cpp'
+No prompt for file `pos.cpp'
+
+*** Action on file `track.cpp'
+No prompt for file `track.cpp'
+
+*** Action on file `midictrl.h'
+No prompt for file `midictrl.h'
+
+*** Action on file `node.cpp'
+No prompt for file `node.cpp'
+
+*** Action on file `audiomix.cpp'
+No prompt for file `audiomix.cpp'
+
+*** Action on file `transport.h'
+No prompt for file `transport.h'
+
+*** Action on file `transpose.h'
+No prompt for file `transpose.h'
+
+*** Action on file `seqmsg.cpp'
+No prompt for file `seqmsg.cpp'
+
+*** Action on file `audionode.h'
+No prompt for file `audionode.h'
+
+*** Action on file `audio.h'
+No prompt for file `audio.h'
+
+*** Action on file `grepmidi.cpp'
+No prompt for file `grepmidi.cpp'
+
+*** Action on file `globals.h'
+No prompt for file `globals.h'
+
+*** Action on file `midieditor.cpp'
+No prompt for file `midieditor.cpp'
+
+*** Action on file `wave.cpp'
+No prompt for file `wave.cpp'
+
+*** Action on file `midi.h'
+No prompt for file `midi.h'
+
+*** Action on file `mess.h'
+No prompt for file `mess.h'
+
+*** Action on file `sync.cpp'
+No prompt for file `sync.cpp'
+
+*** Action on file `config.h.in'
+No prompt for file `config.h.in'
+
+*** Action on file `track.h'
+No prompt for file `track.h'
+
+*** Action on file `mtc.cpp'
+No prompt for file `mtc.cpp'
+
+*** Action on file `minstrument.h'
+No prompt for file `minstrument.h'
+
+*** Action on file `cobject.h'
+No prompt for file `cobject.h'
+
+*** Action on file `synth.h'
+No prompt for file `synth.h'
+
+*** Action on file `songfile.cpp'
+No prompt for file `songfile.cpp'
+
+*** Action on file `midictrl.cpp'
+No prompt for file `midictrl.cpp'
+
+*** Action on file `mpevent.h'
+No prompt for file `mpevent.h'
+
+*** Action on file `font.h'
+No prompt for file `font.h'
+
+*** Action on file `conf.cpp'
+No prompt for file `conf.cpp'
+
+*** Action on file `conf.h'
+No prompt for file `conf.h'
+
+*** Action on file `event.cpp'
+No prompt for file `event.cpp'
+
+*** Action on file `midi.cpp'
+No prompt for file `midi.cpp'
+
+*** Action on file `event.h'
+No prompt for file `event.h'
+
+*** Action on file `audioprefetch.h'
+No prompt for file `audioprefetch.h'
+
+*** Action on file `mpevent.cpp'
+No prompt for file `mpevent.cpp'
+
+*** Action on file `appearance.cpp'
+No prompt for file `appearance.cpp'
+
+*** Action on file `autogen.sh'
+No prompt for file `autogen.sh'
+
+*** Action on file `tempo.h'
+No prompt for file `tempo.h'
+
+*** Action on file `muse.pro'
+No prompt for file `muse.pro'
+
+*** Action on file `part.cpp'
+No prompt for file `part.cpp'
+
+*** Action on file `make.inc'
+No prompt for file `make.inc'
+
+*** Action on file `confmport.h'
+No prompt for file `confmport.h'
+
+*** Action on file `audio.cpp'
+No prompt for file `audio.cpp'
+
+*** Action on file `confmport.cpp'
+No prompt for file `confmport.cpp'
+
+*** Action on file `cfprint.h'
+No prompt for file `cfprint.h'
+
+*** Action on file `sig.cpp'
+No prompt for file `sig.cpp'
+
+*** Action on file `font.cpp'
+No prompt for file `font.cpp'
+
+*** Action on file `midieditor.h'
+No prompt for file `midieditor.h'
+
+*** Action on file `appearance.h'
+No prompt for file `appearance.h'
+
+*** Action on file `globaldefs.h'
+No prompt for file `globaldefs.h'
+
+*** Action on file `seq.cpp'
+No prompt for file `seq.cpp'
+
+*** Action on file `miditransform.cpp'
+No prompt for file `miditransform.cpp'
+
+*** Action on file `miditransform.h'
+No prompt for file `miditransform.h'
+
+*** Action on file `minstrument.cpp'
+Copied working file `minstrument.cpp' to `obsolete/minstrument.cpp.v0'
+Merge file `minstrument.cpp' by rule 2
+
+*** Action on file `audioprefetch.cpp'
+No prompt for file `audioprefetch.cpp'
+
+*** Action on file `transport.cpp'
+No prompt for file `transport.cpp'
+
+*** Action on file `transpose.cpp'
+No prompt for file `transpose.cpp'
+
+*** Action on file `xml.h'
+No prompt for file `xml.h'
+
+*** Action on file `sig.h'
+No prompt for file `sig.h'
+
+*** Action on file `seq.h'
+No prompt for file `seq.h'
+
+*** Action on file `demos/Makefile.am'
+No prompt for file `demos/Makefile.am'
+
+*** Action on file `demos/rasen.med'
+No prompt for file `demos/rasen.med'
+
+*** Action on file `widgets/.cvsignore'
+No prompt for file `widgets/.cvsignore'
+
+*** Action on file `widgets/mmath.cpp'
+No prompt for file `widgets/mmath.cpp'
+
+*** Action on file `widgets/dimap.cpp'
+No prompt for file `widgets/dimap.cpp'
+
+*** Action on file `widgets/utils.cpp'
+No prompt for file `widgets/utils.cpp'
+
+*** Action on file `widgets/sclif.cpp'
+No prompt for file `widgets/sclif.cpp'
+
+*** Action on file `widgets/filedialog.cpp'
+No prompt for file `widgets/filedialog.cpp'
+
+*** Action on file `widgets/citem.h'
+No prompt for file `widgets/citem.h'
+
+*** Action on file `widgets/bigtime.cpp'
+No prompt for file `widgets/bigtime.cpp'
+
+*** Action on file `widgets/view.cpp'
+No prompt for file `widgets/view.cpp'
+
+*** Action on file `widgets/scldraw.h'
+No prompt for file `widgets/scldraw.h'
+
+*** Action on file `widgets/sliderbase.h'
+No prompt for file `widgets/sliderbase.h'
+
+*** Action on file `widgets/hitscale.cpp'
+No prompt for file `widgets/hitscale.cpp'
+
+*** Action on file `widgets/itransformbase.ui'
+No prompt for file `widgets/itransformbase.ui'
+
+*** Action on file `widgets/header.cpp'
+No prompt for file `widgets/header.cpp'
+
+*** Action on file `widgets/tempolabel.h'
+No prompt for file `widgets/tempolabel.h'
+
+*** Action on file `widgets/velocity.cpp'
+No prompt for file `widgets/velocity.cpp'
+
+*** Action on file `widgets/midirawbase.ui'
+No prompt for file `widgets/midirawbase.ui'
+
+*** Action on file `widgets/drange.cpp'
+No prompt for file `widgets/drange.cpp'
+
+*** Action on file `widgets/header.h'
+No prompt for file `widgets/header.h'
+
+*** Action on file `widgets/mlabel.h'
+No prompt for file `widgets/mlabel.h'
+
+*** Action on file `widgets/spinboxFP.cpp'
+No prompt for file `widgets/spinboxFP.cpp'
+
+*** Action on file `widgets/mlabel.cpp'
+No prompt for file `widgets/mlabel.cpp'
+
+*** Action on file `widgets/metronome.cpp'
+No prompt for file `widgets/metronome.cpp'
+
+*** Action on file `widgets/ctrlcombo.cw'
+No prompt for file `widgets/ctrlcombo.cw'
+
+*** Action on file `widgets/sigedit.h'
+No prompt for file `widgets/sigedit.h'
+
+*** Action on file `widgets/intlabel.h'
+No prompt for file `widgets/intlabel.h'
+
+*** Action on file `widgets/comment.cpp'
+No prompt for file `widgets/comment.cpp'
+
+*** Action on file `widgets/ctrlcombo.cpp'
+No prompt for file `widgets/ctrlcombo.cpp'
+
+*** Action on file `widgets/mixdowndialog.cpp'
+No prompt for file `widgets/mixdowndialog.cpp'
+
+*** Action on file `widgets/fontsel.cpp'
+No prompt for file `widgets/fontsel.cpp'
+
+*** Action on file `widgets/hitscale.h'
+No prompt for file `widgets/hitscale.h'
+
+*** Action on file `widgets/posedit.cpp'
+No prompt for file `widgets/posedit.cpp'
+
+*** Action on file `widgets/audioconfbase.ui'
+No prompt for file `widgets/audioconfbase.ui'
+
+*** Action on file `widgets/utils.h'
+No prompt for file `widgets/utils.h'
+
+*** Action on file `widgets/splitter.cpp'
+No prompt for file `widgets/splitter.cpp'
+
+*** Action on file `widgets/editctrl7dialogbase.ui'
+No prompt for file `widgets/editctrl7dialogbase.ui'
+
+*** Action on file `widgets/doublelabel.h'
+No prompt for file `widgets/doublelabel.h'
+
+*** Action on file `widgets/noteinfo.h'
+No prompt for file `widgets/noteinfo.h'
+
+*** Action on file `widgets/sigscale.h'
+No prompt for file `widgets/sigscale.h'
+
+*** Action on file `widgets/canvas.cpp'
+No prompt for file `widgets/canvas.cpp'
+
+*** Action on file `widgets/view.h'
+No prompt for file `widgets/view.h'
+
+*** Action on file `widgets/audioconf.h'
+No prompt for file `widgets/audioconf.h'
+
+*** Action on file `widgets/ccontrolbase.ui'
+No prompt for file `widgets/ccontrolbase.ui'
+
+*** Action on file `widgets/transposebase.ui'
+No prompt for file `widgets/transposebase.ui'
+
+*** Action on file `widgets/spinboxFP.h'
+No prompt for file `widgets/spinboxFP.h'
+
+*** Action on file `widgets/mtscale.h'
+No prompt for file `widgets/mtscale.h'
+
+*** Action on file `widgets/nentry.cpp'
+No prompt for file `widgets/nentry.cpp'
+
+*** Action on file `widgets/siglabel.h'
+No prompt for file `widgets/siglabel.h'
+
+*** Action on file `widgets/transformbase.ui'
+No prompt for file `widgets/transformbase.ui'
+
+*** Action on file `widgets/mittransposebase.ui'
+No prompt for file `widgets/mittransposebase.ui'
+
+*** Action on file `widgets/dentry.h'
+No prompt for file `widgets/dentry.h'
+
+*** Action on file `widgets/slider.h'
+No prompt for file `widgets/slider.h'
+
+*** Action on file `widgets/wtscale.cpp'
+No prompt for file `widgets/wtscale.cpp'
+
+*** Action on file `widgets/action.h'
+No prompt for file `widgets/action.h'
+
+*** Action on file `widgets/nentry.h'
+No prompt for file `widgets/nentry.h'
+
+*** Action on file `widgets/ttoolbar.h'
+No prompt for file `widgets/ttoolbar.h'
+
+*** Action on file `widgets/comboQuant.cpp'
+No prompt for file `widgets/comboQuant.cpp'
+
+*** Action on file `widgets/midisyncimpl.h'
+No prompt for file `widgets/midisyncimpl.h'
+
+*** Action on file `widgets/sliderbase.cpp'
+No prompt for file `widgets/sliderbase.cpp'
+
+*** Action on file `widgets/genset.cpp'
+No prompt for file `widgets/genset.cpp'
+
+*** Action on file `widgets/velocity.h'
+No prompt for file `widgets/velocity.h'
+
+*** Action on file `widgets/poslabel.h'
+No prompt for file `widgets/poslabel.h'
+
+*** Action on file `widgets/knob.h'
+No prompt for file `widgets/knob.h'
+
+*** Action on file `widgets/cliplisteditorbase.ui'
+No prompt for file `widgets/cliplisteditorbase.ui'
+
+*** Action on file `widgets/splitter.h'
+No prompt for file `widgets/splitter.h'
+
+*** Action on file `widgets/sigedit.cpp'
+No prompt for file `widgets/sigedit.cpp'
+
+*** Action on file `widgets/audioconf.cpp'
+No prompt for file `widgets/audioconf.cpp'
+
+*** Action on file `widgets/swidget.h'
+No prompt for file `widgets/swidget.h'
+
+*** Action on file `widgets/tools.h'
+No prompt for file `widgets/tools.h'
+
+*** Action on file `widgets/pitchlabel.h'
+No prompt for file `widgets/pitchlabel.h'
+
+*** Action on file `widgets/Makefile.am'
+No prompt for file `widgets/Makefile.am'
+
+*** Action on file `widgets/moc_ttoolbar.cpp'
+No prompt for file `widgets/moc_ttoolbar.cpp'
+
+*** Action on file `widgets/intlabel.cpp'
+No prompt for file `widgets/intlabel.cpp'
+
+*** Action on file `widgets/citem.cpp'
+No prompt for file `widgets/citem.cpp'
+
+*** Action on file `widgets/canvas.h'
+No prompt for file `widgets/canvas.h'
+
+*** Action on file `widgets/doublelabel.cpp'
+No prompt for file `widgets/doublelabel.cpp'
+
+*** Action on file `widgets/slider.cpp'
+No prompt for file `widgets/slider.cpp'
+
+*** Action on file `widgets/mmath.h'
+No prompt for file `widgets/mmath.h'
+
+*** Action on file `widgets/wtscale.h'
+No prompt for file `widgets/wtscale.h'
+
+*** Action on file `widgets/genset.h'
+No prompt for file `widgets/genset.h'
+
+*** Action on file `widgets/posedit.h'
+No prompt for file `widgets/posedit.h'
+
+*** Action on file `widgets/velocitybase.ui'
+No prompt for file `widgets/velocitybase.ui'
+
+*** Action on file `widgets/ttoolbar.cpp'
+No prompt for file `widgets/ttoolbar.cpp'
+
+*** Action on file `widgets/scrollscale.cpp'
+No prompt for file `widgets/scrollscale.cpp'
+
+*** Action on file `widgets/mtscale.cpp'
+No prompt for file `widgets/mtscale.cpp'
+
+*** Action on file `widgets/noteinfo.cpp'
+No prompt for file `widgets/noteinfo.cpp'
+
+*** Action on file `widgets/lcombo.cpp'
+No prompt for file `widgets/lcombo.cpp'
+
+*** Action on file `widgets/appearancebase.ui'
+No prompt for file `widgets/appearancebase.ui'
+
+*** Action on file `widgets/vscale.h'
+No prompt for file `widgets/vscale.h'
+
+*** Action on file `widgets/scldiv.h'
+No prompt for file `widgets/scldiv.h'
+
+*** Action on file `widgets/drange.h'
+No prompt for file `widgets/drange.h'
+
+*** Action on file `widgets/midisync.ui'
+No prompt for file `widgets/midisync.ui'
+
+*** Action on file `widgets/wtrackinfobase.ui'
+No prompt for file `widgets/wtrackinfobase.ui'
+
+*** Action on file `widgets/vscale.cpp'
+No prompt for file `widgets/vscale.cpp'
+
+*** Action on file `widgets/editsysexdialogbase.ui'
+No prompt for file `widgets/editsysexdialogbase.ui'
+
+*** Action on file `widgets/gatetimebase.ui'
+No prompt for file `widgets/gatetimebase.ui'
+
+*** Action on file `widgets/editmetadialogbase.ui'
+No prompt for file `widgets/editmetadialogbase.ui'
+
+*** Action on file `widgets/sigscale.cpp'
+No prompt for file `widgets/sigscale.cpp'
+
+*** Action on file `widgets/mtrackinfobase.ui'
+No prompt for file `widgets/mtrackinfobase.ui'
+
+*** Action on file `widgets/metronome.h'
+No prompt for file `widgets/metronome.h'
+
+*** Action on file `widgets/gatetime.cpp'
+No prompt for file `widgets/gatetime.cpp'
+
+*** Action on file `widgets/tb1.cpp'
+No prompt for file `widgets/tb1.cpp'
+
+*** Action on file `widgets/gensetbase.ui'
+No prompt for file `widgets/gensetbase.ui'
+
+*** Action on file `widgets/scldraw.cpp'
+No prompt for file `widgets/scldraw.cpp'
+
+*** Action on file `widgets/bigtime.h'
+No prompt for file `widgets/bigtime.h'
+
+*** Action on file `widgets/poslabel.cpp'
+No prompt for file `widgets/poslabel.cpp'
+
+*** Action on file `widgets/metronomebase.ui'
+No prompt for file `widgets/metronomebase.ui'
+
+*** Action on file `widgets/scrollscale.h'
+No prompt for file `widgets/scrollscale.h'
+
+*** Action on file `widgets/fdialogbuttons.ui'
+No prompt for file `widgets/fdialogbuttons.ui'
+
+*** Action on file `widgets/sclif.h'
+No prompt for file `widgets/sclif.h'
+
+*** Action on file `widgets/tools.cpp'
+No prompt for file `widgets/tools.cpp'
+
+*** Action on file `widgets/filedialog.h'
+No prompt for file `widgets/filedialog.h'
+
+*** Action on file `widgets/pitchlabel.cpp'
+No prompt for file `widgets/pitchlabel.cpp'
+
+*** Action on file `widgets/scldiv.cpp'
+No prompt for file `widgets/scldiv.cpp'
+
+*** Action on file `widgets/musewidgetsplug.cpp'
+No prompt for file `widgets/musewidgetsplug.cpp'
+
+*** Action on file `widgets/midisyncimpl.cpp'
+No prompt for file `widgets/midisyncimpl.cpp'
+
+*** Action on file `widgets/commentbase.ui'
+No prompt for file `widgets/commentbase.ui'
+
+*** Action on file `widgets/dentry.cpp'
+No prompt for file `widgets/dentry.cpp'
+
+*** Action on file `widgets/comment.h'
+No prompt for file `widgets/comment.h'
+
+*** Action on file `widgets/ctrlcombo.h'
+No prompt for file `widgets/ctrlcombo.h'
+
+*** Action on file `widgets/comboQuant.h'
+No prompt for file `widgets/comboQuant.h'
+
+*** Action on file `widgets/gatetime.h'
+No prompt for file `widgets/gatetime.h'
+
+*** Action on file `widgets/tb1.h'
+No prompt for file `widgets/tb1.h'
+
+*** Action on file `widgets/editnotedialogbase.ui'
+No prompt for file `widgets/editnotedialogbase.ui'
+
+*** Action on file `widgets/pitchedit.h'
+No prompt for file `widgets/pitchedit.h'
+
+*** Action on file `widgets/lcombo.h'
+No prompt for file `widgets/lcombo.h'
+
+*** Action on file `widgets/fontsel.h'
+No prompt for file `widgets/fontsel.h'
+
+*** Action on file `widgets/tempolabel.cpp'
+No prompt for file `widgets/tempolabel.cpp'
+
+*** Action on file `widgets/knob.cpp'
+No prompt for file `widgets/knob.cpp'
+
+*** Action on file `widgets/dimap.h'
+No prompt for file `widgets/dimap.h'
+
+*** Action on file `widgets/pitchedit.cpp'
+No prompt for file `widgets/pitchedit.cpp'
+
+*** Action on file `widgets/siglabel.cpp'
+No prompt for file `widgets/siglabel.cpp'
+
+*** Action on file `widgets/mixdowndialog.h'
+No prompt for file `widgets/mixdowndialog.h'
+
+*** Action on file `widgets/mixdowndialogbase.ui'
+No prompt for file `widgets/mixdowndialogbase.ui'
+
+*** Action on file `widgets/synthconfigbase.ui'
+No prompt for file `widgets/synthconfigbase.ui'
+
+*** Action on file `widgets/swidget.cpp'
+No prompt for file `widgets/swidget.cpp'
+
+*** Action on file `widgets/section.h'
+No prompt for file `widgets/section.h'
+
+*** Action on file `arranger/pcanvas.h'
+No prompt for file `arranger/pcanvas.h'
+
+*** Action on file `arranger/alayout.h'
+No prompt for file `arranger/alayout.h'
+
+*** Action on file `arranger/tlist.cpp'
+No prompt for file `arranger/tlist.cpp'
+
+*** Action on file `arranger/arranger.h'
+No prompt for file `arranger/arranger.h'
+
+*** Action on file `arranger/alayout.cpp'
+No prompt for file `arranger/alayout.cpp'
+
+*** Action on file `arranger/Makefile.am'
+No prompt for file `arranger/Makefile.am'
+
+*** Action on file `arranger/tlist.h'
+No prompt for file `arranger/tlist.h'
+
+*** Action on file `arranger/pcanvas.cpp'
+No prompt for file `arranger/pcanvas.cpp'
+
+*** Action on file `arranger/arranger.cpp'
+No prompt for file `arranger/arranger.cpp'
+
+*** Action on file `mplugins/Makefile.am'
+No prompt for file `mplugins/Makefile.am'
+
+*** Action on file `mplugins/.cvsignore'
+No prompt for file `mplugins/.cvsignore'
+
+*** Action on file `mplugins/midifilterimpl.cpp'
+No prompt for file `mplugins/midifilterimpl.cpp'
+
+*** Action on file `mplugins/rhythm.cpp'
+No prompt for file `mplugins/rhythm.cpp'
+
+*** Action on file `mplugins/rhythmbase.ui'
+No prompt for file `mplugins/rhythmbase.ui'
+
+*** Action on file `mplugins/midifilter.ui'
+No prompt for file `mplugins/midifilter.ui'
+
+*** Action on file `mplugins/mitplugin.h'
+No prompt for file `mplugins/mitplugin.h'
+
+*** Action on file `mplugins/rhythm.h'
+No prompt for file `mplugins/rhythm.h'
+
+*** Action on file `mplugins/midiitransform.h'
+No prompt for file `mplugins/midiitransform.h'
+
+*** Action on file `mplugins/mittranspose.cpp'
+No prompt for file `mplugins/mittranspose.cpp'
+
+*** Action on file `mplugins/mrconfigbase.ui'
+No prompt for file `mplugins/mrconfigbase.ui'
+
+*** Action on file `mplugins/mrconfig.cpp'
+No prompt for file `mplugins/mrconfig.cpp'
+
+*** Action on file `mplugins/mrconfig.h'
+No prompt for file `mplugins/mrconfig.h'
+
+*** Action on file `mplugins/random.h'
+No prompt for file `mplugins/random.h'
+
+*** Action on file `mplugins/midiitransform.cpp'
+No prompt for file `mplugins/midiitransform.cpp'
+
+*** Action on file `mplugins/mittranspose.h'
+No prompt for file `mplugins/mittranspose.h'
+
+*** Action on file `mplugins/mitplugin.cpp'
+No prompt for file `mplugins/mitplugin.cpp'
+
+*** Action on file `mplugins/midifilterimpl.h'
+No prompt for file `mplugins/midifilterimpl.h'
+
+*** Action on file `mplugins/random.cpp'
+No prompt for file `mplugins/random.cpp'
+
+*** Action on file `waveedit/Makefile.am'
+No prompt for file `waveedit/Makefile.am'
+
+*** Action on file `waveedit/waveview.h'
+No prompt for file `waveedit/waveview.h'
+
+*** Action on file `waveedit/waveedit.cpp'
+No prompt for file `waveedit/waveedit.cpp'
+
+*** Action on file `waveedit/waveedit.h'
+No prompt for file `waveedit/waveedit.h'
+
+*** Action on file `waveedit/waveview.cpp'
+No prompt for file `waveedit/waveview.cpp'
+
+*** Action on file `master/masteredit.cpp'
+No prompt for file `master/masteredit.cpp'
+
+*** Action on file `master/lmaster.cpp'
+No prompt for file `master/lmaster.cpp'
+
+*** Action on file `master/tscale.cpp'
+No prompt for file `master/tscale.cpp'
+
+*** Action on file `master/Makefile.am'
+No prompt for file `master/Makefile.am'
+
+*** Action on file `master/master.h'
+No prompt for file `master/master.h'
+
+*** Action on file `master/masteredit.h'
+No prompt for file `master/masteredit.h'
+
+*** Action on file `master/lmaster.h'
+No prompt for file `master/lmaster.h'
+
+*** Action on file `master/tscale.h'
+No prompt for file `master/tscale.h'
+
+*** Action on file `master/master.cpp'
+No prompt for file `master/master.cpp'
+
+*** Action on file `marker/Makefile.am'
+No prompt for file `marker/Makefile.am'
+
+*** Action on file `marker/marker.h'
+No prompt for file `marker/marker.h'
+
+*** Action on file `marker/markerview.cpp'
+No prompt for file `marker/markerview.cpp'
+
+*** Action on file `marker/markerview.h'
+No prompt for file `marker/markerview.h'
+
+*** Action on file `marker/marker.cpp'
+No prompt for file `marker/marker.cpp'
+
+*** Action on file `driver/audiodev.h'
+No prompt for file `driver/audiodev.h'
+
+*** Action on file `driver/midiserial.h'
+No prompt for file `driver/midiserial.h'
+
+*** Action on file `driver/mididev.h'
+No prompt for file `driver/mididev.h'
+
+*** Action on file `driver/mididev.cpp'
+No prompt for file `driver/mididev.cpp'
+
+*** Action on file `driver/midirawin.h'
+No prompt for file `driver/midirawin.h'
+
+*** Action on file `driver/midirawdev.h'
+No prompt for file `driver/midirawdev.h'
+
+*** Action on file `driver/alsamidi.cpp'
+No prompt for file `driver/alsamidi.cpp'
+
+*** Action on file `driver/alsamidi.h'
+No prompt for file `driver/alsamidi.h'
+
+*** Action on file `driver/Makefile.am'
+No prompt for file `driver/Makefile.am'
+
+*** Action on file `driver/jack.cpp'
+No prompt for file `driver/jack.cpp'
+
+*** Action on file `driver/midirawin.cpp'
+No prompt for file `driver/midirawin.cpp'
+
+*** Action on file `driver/alsaaudio.h'
+No prompt for file `driver/alsaaudio.h'
+
+*** Action on file `driver/midiserial.cpp'
+No prompt for file `driver/midiserial.cpp'
+
+*** Action on file `driver/alsaaudio.cpp'
+No prompt for file `driver/alsaaudio.cpp'
+
+*** Action on file `driver/midirawdev.cpp'
+No prompt for file `driver/midirawdev.cpp'
+
+*** Action on file `driver/jackaudio.h'
+No prompt for file `driver/jackaudio.h'
+
+*** Action on file `driver/mess.cpp'
+No prompt for file `driver/mess.cpp'
+
+*** Action on file `midiedit/drummap.cpp'
+No prompt for file `midiedit/drummap.cpp'
+
+*** Action on file `midiedit/dcanvas.h'
+No prompt for file `midiedit/dcanvas.h'
+
+*** Action on file `midiedit/piano.h'
+No prompt for file `midiedit/piano.h'
+
+*** Action on file `midiedit/drummap.h'
+No prompt for file `midiedit/drummap.h'
+
+*** Action on file `midiedit/drumedit.h'
+No prompt for file `midiedit/drumedit.h'
+
+*** Action on file `midiedit/prcanvas.cpp'
+No prompt for file `midiedit/prcanvas.cpp'
+
+*** Action on file `midiedit/dcanvas.cpp'
+No prompt for file `midiedit/dcanvas.cpp'
+
+*** Action on file `midiedit/Makefile.am'
+No prompt for file `midiedit/Makefile.am'
+
+*** Action on file `midiedit/dlist.cpp'
+No prompt for file `midiedit/dlist.cpp'
+
+*** Action on file `midiedit/pianoroll.cpp'
+No prompt for file `midiedit/pianoroll.cpp'
+
+*** Action on file `midiedit/ecanvas.h'
+No prompt for file `midiedit/ecanvas.h'
+
+*** Action on file `midiedit/quantconfig.h'
+No prompt for file `midiedit/quantconfig.h'
+
+*** Action on file `midiedit/quantconfig.cpp'
+No prompt for file `midiedit/quantconfig.cpp'
+
+*** Action on file `midiedit/ecanvas.cpp'
+No prompt for file `midiedit/ecanvas.cpp'
+
+*** Action on file `midiedit/piano.cpp'
+No prompt for file `midiedit/piano.cpp'
+
+*** Action on file `midiedit/prcanvas.h'
+No prompt for file `midiedit/prcanvas.h'
+
+*** Action on file `midiedit/drumedit.cpp'
+No prompt for file `midiedit/drumedit.cpp'
+
+*** Action on file `midiedit/dlist.h'
+No prompt for file `midiedit/dlist.h'
+
+*** Action on file `midiedit/cmd.h'
+No prompt for file `midiedit/cmd.h'
+
+*** Action on file `midiedit/pianoroll.h'
+No prompt for file `midiedit/pianoroll.h'
+
+*** Action on file `patchbay/Makefile.am'
+No prompt for file `patchbay/Makefile.am'
+
+*** Action on file `patchbay/patchbay.cpp'
+No prompt for file `patchbay/patchbay.cpp'
+
+*** Action on file `patchbay/patchbaybase.ui'
+No prompt for file `patchbay/patchbaybase.ui'
+
+*** Action on file `patchbay/patchbay.h'
+No prompt for file `patchbay/patchbay.h'
+
+*** Action on file `synti/synth.cpp'
+No prompt for file `synti/synth.cpp'
+
+*** Action on file `synti/synthconfig.h'
+No prompt for file `synti/synthconfig.h'
+
+*** Action on file `synti/Makefile.am'
+No prompt for file `synti/Makefile.am'
+
+*** Action on file `synti/synti-install.am'
+No prompt for file `synti/synti-install.am'
+
+*** Action on file `synti/synthconfig.cpp'
+No prompt for file `synti/synthconfig.cpp'
+
+*** Action on file `synti/organ/.cvsignore'
+No prompt for file `synti/organ/.cvsignore'
+
+*** Action on file `synti/organ/organ.cpp'
+No prompt for file `synti/organ/organ.cpp'
+
+*** Action on file `synti/organ/organ.h'
+No prompt for file `synti/organ/organ.h'
+
+*** Action on file `synti/organ/organguibase.ui'
+No prompt for file `synti/organ/organguibase.ui'
+
+*** Action on file `synti/organ/Makefile.am'
+No prompt for file `synti/organ/Makefile.am'
+
+*** Action on file `synti/organ/organgui.h'
+No prompt for file `synti/organ/organgui.h'
+
+*** Action on file `synti/organ/fdialogbuttons.ui'
+No prompt for file `synti/organ/fdialogbuttons.ui'
+
+*** Action on file `synti/organ/organgui.cpp'
+No prompt for file `synti/organ/organgui.cpp'
+
+*** Action on file `synti/fluid/fluidgui.cpp'
+No prompt for file `synti/fluid/fluidgui.cpp'
+
+*** Action on file `synti/fluid/fluidguibase.ui'
+No prompt for file `synti/fluid/fluidguibase.ui'
+
+*** Action on file `synti/fluid/synth.cpp'
+No prompt for file `synti/fluid/synth.cpp'
+
+*** Action on file `synti/fluid/Makefile.am'
+No prompt for file `synti/fluid/Makefile.am'
+
+*** Action on file `synti/fluid/synth.h'
+No prompt for file `synti/fluid/synth.h'
+
+*** Action on file `synti/fluid/fluid.cpp'
+No prompt for file `synti/fluid/fluid.cpp'
+
+*** Action on file `synti/fluid/fluidgui.h'
+No prompt for file `synti/fluid/fluidgui.h'
+
+*** Action on file `synti/fluidsynth/fluidsynthgui.h'
+No prompt for file `synti/fluidsynth/fluidsynthgui.h'
+
+*** Action on file `synti/fluidsynth/fluidsynti.h'
+No prompt for file `synti/fluidsynth/fluidsynti.h'
+
+*** Action on file `synti/fluidsynth/fluidsynti.cpp'
+No prompt for file `synti/fluidsynth/fluidsynti.cpp'
+
+*** Action on file `synti/fluidsynth/fluidsynthguibase.ui'
+No prompt for file `synti/fluidsynth/fluidsynthguibase.ui'
+
+*** Action on file `synti/fluidsynth/Makefile.am'
+No prompt for file `synti/fluidsynth/Makefile.am'
+
+*** Action on file `synti/fluidsynth/fluidsynthgui.cpp'
+No prompt for file `synti/fluidsynth/fluidsynthgui.cpp'
+
+*** Action on file `synti/fluidsynth/TODO'
+No prompt for file `synti/fluidsynth/TODO'
+
+*** Action on file `synti/vam/vamgui.cpp'
+No prompt for file `synti/vam/vamgui.cpp'
+
+*** Action on file `synti/vam/COPYING'
+No prompt for file `synti/vam/COPYING'
+
+*** Action on file `synti/vam/ChangeLog'
+No prompt for file `synti/vam/ChangeLog'
+
+*** Action on file `synti/vam/vamgui.h'
+No prompt for file `synti/vam/vamgui.h'
+
+*** Action on file `synti/vam/vam.cpp'
+No prompt for file `synti/vam/vam.cpp'
+
+*** Action on file `synti/vam/Makefile.am'
+No prompt for file `synti/vam/Makefile.am'
+
+*** Action on file `synti/vam/fdialogbuttons.ui'
+No prompt for file `synti/vam/fdialogbuttons.ui'
+
+*** Action on file `synti/vam/README'
+No prompt for file `synti/vam/README'
+
+*** Action on file `synti/vam/vam.h'
+No prompt for file `synti/vam/vam.h'
+
+*** Action on file `synti/vam/vamguibase.ui'
+No prompt for file `synti/vam/vamguibase.ui'
+
+*** Action on file `synti/vam/TODO'
+No prompt for file `synti/vam/TODO'
+
+*** Action on file `synti/s1/s1.cpp'
+No prompt for file `synti/s1/s1.cpp'
+
+*** Action on file `synti/s1/Makefile.am'
+No prompt for file `synti/s1/Makefile.am'
+
+*** Action on file `share/Makefile.am'
+No prompt for file `share/Makefile.am'
+
+*** Action on file `share/plugins/1050.ui'
+No prompt for file `share/plugins/1050.ui'
+
+*** Action on file `share/plugins/Makefile.am'
+No prompt for file `share/plugins/Makefile.am'
+
+*** Action on file `share/instruments/Yamaha-P50m.idf'
+No prompt for file `share/instruments/Yamaha-P50m.idf'
+
+*** Action on file `share/instruments/ns5r.idf'
+No prompt for file `share/instruments/ns5r.idf'
+
+*** Action on file `share/instruments/Roland-XP30.idf'
+No prompt for file `share/instruments/Roland-XP30.idf'
+
+*** Action on file `share/instruments/MC303.idf'
+No prompt for file `share/instruments/MC303.idf'
+
+*** Action on file `share/instruments/Makefile.am'
+No prompt for file `share/instruments/Makefile.am'
+
+*** Action on file `share/instruments/gm.idf'
+No prompt for file `share/instruments/gm.idf'
+
+*** Action on file `share/instruments/Yamaha-S90.idf'
+No prompt for file `share/instruments/Yamaha-S90.idf'
+
+*** Action on file `share/instruments/AlesisQS6.idf'
+No prompt for file `share/instruments/AlesisQS6.idf'
+
+*** Action on file `share/drummaps/Makefile.am'
+No prompt for file `share/drummaps/Makefile.am'
+
+*** Action on file `share/drummaps/sc88-pc1.map'
+No prompt for file `share/drummaps/sc88-pc1.map'
+
+*** Action on file `share/locale/Makefile.am'
+No prompt for file `share/locale/Makefile.am'
+
+*** Action on file `share/locale/muse_sv_SE.ts'
+No prompt for file `share/locale/muse_sv_SE.ts'
+
+*** Action on file `share/locale/muse_ru.ts'
+No prompt for file `share/locale/muse_ru.ts'
+
+*** Action on file `share/locale/muse_fr.ts'
+No prompt for file `share/locale/muse_fr.ts'
+
+*** Action on file `share/locale/muse_es.ts'
+No prompt for file `share/locale/muse_es.ts'
+
+*** Action on file `share/locale/muse_de.ts'
+No prompt for file `share/locale/muse_de.ts'
+
+*** Action on file `share/locale/muse_sv_SE.qm'
+No prompt for file `share/locale/muse_sv_SE.qm'
+
+*** Action on file `share/locale/muse_ru.qm'
+No prompt for file `share/locale/muse_ru.qm'
+
+*** Action on file `share/locale/muse_fr.qm'
+No prompt for file `share/locale/muse_fr.qm'
+
+*** Action on file `share/locale/muse_es.qm'
+No prompt for file `share/locale/muse_es.qm'
+
+*** Action on file `share/locale/muse_de.qm'
+No prompt for file `share/locale/muse_de.qm'
+
+*** Action on file `share/wallpapers/paper1.jpg'
+No prompt for file `share/wallpapers/paper1.jpg'
+
+*** Action on file `share/wallpapers/Makefile.am'
+No prompt for file `share/wallpapers/Makefile.am'
+
+*** Action on file `share/wallpapers/gray_rock.gif'
+No prompt for file `share/wallpapers/gray_rock.gif'
+
+*** Action on file `share/wallpapers/gray.gif'
+No prompt for file `share/wallpapers/gray.gif'
+
+*** Action on file `share/wallpapers/gray_stucco.gif'
+No prompt for file `share/wallpapers/gray_stucco.gif'
+
+*** Action on file `share/wallpapers/stone1.gif'
+No prompt for file `share/wallpapers/stone1.gif'
+
+*** Action on file `share/html/invocation.html'
+No prompt for file `share/html/invocation.html'
+
+*** Action on file `share/html/left_pane.jpg'
+No prompt for file `share/html/left_pane.jpg'
+
+*** Action on file `share/html/styles.css'
+No prompt for file `share/html/styles.css'
+
+*** Action on file `share/html/button_bar.jpg'
+No prompt for file `share/html/button_bar.jpg'
+
+*** Action on file `share/html/COPYING.html'
+No prompt for file `share/html/COPYING.html'
+
+*** Action on file `share/html/main_window.jpg'
+No prompt for file `share/html/main_window.jpg'
+
+*** Action on file `share/html/toc_.txt'
+No prompt for file `share/html/toc_.txt'
+
+*** Action on file `share/html/Makefile.am'
+No prompt for file `share/html/Makefile.am'
+
+*** Action on file `share/html/track_info.jpg'
+No prompt for file `share/html/track_info.jpg'
+
+*** Action on file `share/html/getting_started.html'
+No prompt for file `share/html/getting_started.html'
+
+*** Action on file `share/html/index.html'
+No prompt for file `share/html/index.html'
+
+*** Action on file `share/html/window_ref.html'
+No prompt for file `share/html/window_ref.html'
+
+*** Action on file `share/html/installation.html'
+No prompt for file `share/html/installation.html'
+
+*** Action on file `share/html/main_window_track_info.jpg'
+No prompt for file `share/html/main_window_track_info.jpg'
+
+*** Action on file `share/html/right_pane.jpg'
+No prompt for file `share/html/right_pane.jpg'
+
+*** Action on file `score/Makefile.am'
+No prompt for file `score/Makefile.am'
+
+*** Action on file `score/ncanvas.cpp'
+No prompt for file `score/ncanvas.cpp'
+
+*** Action on file `score/print.cpp'
+No prompt for file `score/print.cpp'
+
+*** Action on file `score/print.h'
+No prompt for file `score/print.h'
+
+*** Action on file `score/layout.h'
+No prompt for file `score/layout.h'
+
+*** Action on file `score/items.h'
+No prompt for file `score/items.h'
+
+*** Action on file `score/papersize.cpp'
+No prompt for file `score/papersize.cpp'
+
+*** Action on file `score/symbols.cpp'
+No prompt for file `score/symbols.cpp'
+
+*** Action on file `score/layout.cpp'
+No prompt for file `score/layout.cpp'
+
+*** Action on file `score/glyphs.cpp'
+No prompt for file `score/glyphs.cpp'
+
+*** Action on file `score/papersize.h'
+No prompt for file `score/papersize.h'
+
+*** Action on file `score/palettes.h'
+No prompt for file `score/palettes.h'
+
+*** Action on file `score/glyphs.h'
+No prompt for file `score/glyphs.h'
+
+*** Action on file `score/ncanvas.h'
+No prompt for file `score/ncanvas.h'
+
+*** Action on file `score/score.doc'
+No prompt for file `score/score.doc'
+
+*** Action on file `score/score.cpp'
+No prompt for file `score/score.cpp'
+
+*** Action on file `score/items.cpp'
+No prompt for file `score/items.cpp'
+
+*** Action on file `score/sconfig.h'
+No prompt for file `score/sconfig.h'
+
+*** Action on file `score/symbols.h'
+No prompt for file `score/symbols.h'
+
+*** Action on file `score/font.cpp'
+No prompt for file `score/font.cpp'
+
+*** Action on file `score/sconfig.cpp'
+No prompt for file `score/sconfig.cpp'
+
+*** Action on file `score/score.h'
+No prompt for file `score/score.h'
+
+*** Action on file `score/palettes.cpp'
+No prompt for file `score/palettes.cpp'
+
+*** Action on file `score/quant.cpp'
+No prompt for file `score/quant.cpp'
+
+*** Action on file `score/quant.h'
+No prompt for file `score/quant.h'
+
+*** Action on file `score/note.cpp'
+No prompt for file `score/note.cpp'
+
+*** Action on file `mixer/Makefile.am'
+No prompt for file `mixer/Makefile.am'
+
+*** Action on file `mixer/amixer.h'
+No prompt for file `mixer/amixer.h'
+
+*** Action on file `mixer/meter.cpp'
+No prompt for file `mixer/meter.cpp'
+
+*** Action on file `mixer/mixer.cpp'
+No prompt for file `mixer/mixer.cpp'
+
+*** Action on file `mixer/routecombo.cpp'
+No prompt for file `mixer/routecombo.cpp'
+
+*** Action on file `mixer/volslider.h'
+No prompt for file `mixer/volslider.h'
+
+*** Action on file `mixer/rack.h'
+No prompt for file `mixer/rack.h'
+
+*** Action on file `mixer/mixer.h'
+No prompt for file `mixer/mixer.h'
+
+*** Action on file `mixer/panknob.h'
+No prompt for file `mixer/panknob.h'
+
+*** Action on file `mixer/panknob.cpp'
+No prompt for file `mixer/panknob.cpp'
+
+*** Action on file `mixer/amixer.cpp'
+No prompt for file `mixer/amixer.cpp'
+
+*** Action on file `mixer/meter.h'
+No prompt for file `mixer/meter.h'
+
+*** Action on file `mixer/rack.cpp'
+No prompt for file `mixer/rack.cpp'
+
+*** Action on file `mixer/routecombo.h'
+No prompt for file `mixer/routecombo.h'
+
+*** Action on file `mixer/audionodebutton.h'
+No prompt for file `mixer/audionodebutton.h'
+
+*** Action on file `mixer/dot.xpm'
+No prompt for file `mixer/dot.xpm'
+
+*** Action on file `mixer/volslider.cpp'
+No prompt for file `mixer/volslider.cpp'
+
+*** Action on file `mixer/audionodebutton.cpp'
+No prompt for file `mixer/audionodebutton.cpp'
+
+*** Action on file `liste/editevent.cpp'
+No prompt for file `liste/editevent.cpp'
+
+*** Action on file `liste/editevent.h'
+No prompt for file `liste/editevent.h'
+
+*** Action on file `liste/Makefile.am'
+No prompt for file `liste/Makefile.am'
+
+*** Action on file `liste/listedit.h'
+No prompt for file `liste/listedit.h'
+
+*** Action on file `liste/listedit.cpp'
+No prompt for file `liste/listedit.cpp'
+
+*** Action on file `ctrl/Makefile.am'
+No prompt for file `ctrl/Makefile.am'
+
+*** Action on file `ctrl/ctrlcanvas.cpp'
+No prompt for file `ctrl/ctrlcanvas.cpp'
+
+*** Action on file `ctrl/ctrlpanel.h'
+No prompt for file `ctrl/ctrlpanel.h'
+
+*** Action on file `ctrl/ctrlcanvas.h'
+No prompt for file `ctrl/ctrlcanvas.h'
+
+*** Action on file `ctrl/ctrledit.h'
+No prompt for file `ctrl/ctrledit.h'
+
+*** Action on file `ctrl/ctrledit.cpp'
+No prompt for file `ctrl/ctrledit.cpp'
+
+*** Action on file `ctrl/ctrlpanel.cpp'
+No prompt for file `ctrl/ctrlpanel.cpp'
+
+*** Action on file `xpm/darkreddot.xpm'
+No prompt for file `xpm/darkreddot.xpm'
+
+*** Action on file `xpm/editmuteS.xpm'
+No prompt for file `xpm/editmuteS.xpm'
+
+*** Action on file `xpm/midiin.xpm'
+No prompt for file `xpm/midiin.xpm'
+
+*** Action on file `xpm/editpasteS.xpm'
+No prompt for file `xpm/editpasteS.xpm'
+
+*** Action on file `xpm/pitch.xpm'
+No prompt for file `xpm/pitch.xpm'
+
+*** Action on file `xpm/italic.xpm'
+No prompt for file `xpm/italic.xpm'
+
+*** Action on file `xpm/redo.xpm'
+No prompt for file `xpm/redo.xpm'
+
+*** Action on file `xpm/filesaveS.xpm'
+No prompt for file `xpm/filesaveS.xpm'
+
+*** Action on file `xpm/scoreS.xpm'
+No prompt for file `xpm/scoreS.xpm'
+
+*** Action on file `xpm/exit.xpm'
+No prompt for file `xpm/exit.xpm'
+
+*** Action on file `xpm/rmark.xpm'
+No prompt for file `xpm/rmark.xpm'
+
+*** Action on file `xpm/frewind.xpm'
+No prompt for file `xpm/frewind.xpm'
+
+*** Action on file `xpm/stop.xpm'
+No prompt for file `xpm/stop.xpm'
+
+*** Action on file `xpm/graydot.xpm'
+No prompt for file `xpm/graydot.xpm'
+
+*** Action on file `xpm/loop.xpm'
+No prompt for file `xpm/loop.xpm'
+
+*** Action on file `xpm/steprec.xpm'
+No prompt for file `xpm/steprec.xpm'
+
+*** Action on file `xpm/recordoffbutton.xpm'
+No prompt for file `xpm/recordoffbutton.xpm'
+
+*** Action on file `xpm/filenewS.xpm'
+No prompt for file `xpm/filenewS.xpm'
+
+*** Action on file `xpm/bold.xpm'
+No prompt for file `xpm/bold.xpm'
+
+*** Action on file `xpm/fileopen.xpm'
+No prompt for file `xpm/fileopen.xpm'
+
+*** Action on file `xpm/editpaste.xpm'
+No prompt for file `xpm/editpaste.xpm'
+
+*** Action on file `xpm/speaker.xpm'
+No prompt for file `xpm/speaker.xpm'
+
+*** Action on file `xpm/delete.xpm'
+No prompt for file `xpm/delete.xpm'
+
+*** Action on file `xpm/pianoS.xpm'
+No prompt for file `xpm/pianoS.xpm'
+
+*** Action on file `xpm/start.xpm'
+No prompt for file `xpm/start.xpm'
+
+*** Action on file `xpm/punchin.xpm'
+No prompt for file `xpm/punchin.xpm'
+
+*** Action on file `xpm/fileprint.xpm'
+No prompt for file `xpm/fileprint.xpm'
+
+*** Action on file `xpm/editcopy.xpm'
+No prompt for file `xpm/editcopy.xpm'
+
+*** Action on file `xpm/play.xpm'
+No prompt for file `xpm/play.xpm'
+
+*** Action on file `xpm/filesaveasS.xpm'
+No prompt for file `xpm/filesaveasS.xpm'
+
+*** Action on file `xpm/stick.xpm'
+No prompt for file `xpm/stick.xpm'
+
+*** Action on file `xpm/fforward.xpm'
+No prompt for file `xpm/fforward.xpm'
+
+*** Action on file `xpm/lock.xpm'
+No prompt for file `xpm/lock.xpm'
+
+*** Action on file `xpm/back.xpm'
+No prompt for file `xpm/back.xpm'
+
+*** Action on file `xpm/up.xpm'
+No prompt for file `xpm/up.xpm'
+
+*** Action on file `xpm/cafter.xpm'
+No prompt for file `xpm/cafter.xpm'
+
+*** Action on file `xpm/recordonbutton.xpm'
+No prompt for file `xpm/recordonbutton.xpm'
+
+*** Action on file `xpm/flag.xpm'
+No prompt for file `xpm/flag.xpm'
+
+*** Action on file `xpm/off.xpm'
+No prompt for file `xpm/off.xpm'
+
+*** Action on file `xpm/editcutS.xpm'
+No prompt for file `xpm/editcutS.xpm'
+
+*** Action on file `xpm/editmute.xpm'
+No prompt for file `xpm/editmute.xpm'
+
+*** Action on file `xpm/pencil.xpm'
+No prompt for file `xpm/pencil.xpm'
+
+*** Action on file `xpm/pointer.xpm'
+No prompt for file `xpm/pointer.xpm'
+
+*** Action on file `xpm/wave.xpm'
+No prompt for file `xpm/wave.xpm'
+
+*** Action on file `xpm/undoS.xpm'
+No prompt for file `xpm/undoS.xpm'
+
+*** Action on file `xpm/loop1.xpm'
+No prompt for file `xpm/loop1.xpm'
+
+*** Action on file `xpm/score.xpm'
+No prompt for file `xpm/score.xpm'
+
+*** Action on file `xpm/glue.xpm'
+No prompt for file `xpm/glue.xpm'
+
+*** Action on file `xpm/Makefile.am'
+No prompt for file `xpm/Makefile.am'
+
+*** Action on file `xpm/gv.xpm'
+No prompt for file `xpm/gv.xpm'
+
+*** Action on file `xpm/redoS.xpm'
+No prompt for file `xpm/redoS.xpm'
+
+*** Action on file `xpm/toc.xpm'
+No prompt for file `xpm/toc.xpm'
+
+*** Action on file `xpm/greendot.xpm'
+No prompt for file `xpm/greendot.xpm'
+
+*** Action on file `xpm/configure.xpm'
+No prompt for file `xpm/configure.xpm'
+
+*** Action on file `xpm/forward.xpm'
+No prompt for file `xpm/forward.xpm'
+
+*** Action on file `xpm/underlined.xpm'
+No prompt for file `xpm/underlined.xpm'
+
+*** Action on file `xpm/home.xpm'
+No prompt for file `xpm/home.xpm'
+
+*** Action on file `xpm/record1.xpm'
+No prompt for file `xpm/record1.xpm'
+
+*** Action on file `xpm/lmark.xpm'
+No prompt for file `xpm/lmark.xpm'
+
+*** Action on file `xpm/record.xpm'
+No prompt for file `xpm/record.xpm'
+
+*** Action on file `xpm/mute.xpm'
+No prompt for file `xpm/mute.xpm'
+
+*** Action on file `xpm/darkgreendot.xpm'
+No prompt for file `xpm/darkgreendot.xpm'
+
+*** Action on file `xpm/find.xpm'
+No prompt for file `xpm/find.xpm'
+
+*** Action on file `xpm/reddot.xpm'
+No prompt for file `xpm/reddot.xpm'
+
+*** Action on file `xpm/punchout.xpm'
+No prompt for file `xpm/punchout.xpm'
+
+*** Action on file `xpm/panic.xpm'
+No prompt for file `xpm/panic.xpm'
+
+*** Action on file `xpm/fileprintS.xpm'
+No prompt for file `xpm/fileprintS.xpm'
+
+*** Action on file `xpm/draw.xpm'
+No prompt for file `xpm/draw.xpm'
+
+*** Action on file `xpm/filesave.xpm'
+No prompt for file `xpm/filesave.xpm'
+
+*** Action on file `xpm/filenew.xpm'
+No prompt for file `xpm/filenew.xpm'
+
+*** Action on file `xpm/piano.xpm'
+No prompt for file `xpm/piano.xpm'
+
+*** Action on file `xpm/solobutton.xpm'
+No prompt for file `xpm/solobutton.xpm'
+
+*** Action on file `xpm/punchin1.xpm'
+No prompt for file `xpm/punchin1.xpm'
+
+*** Action on file `xpm/idea.xpm'
+No prompt for file `xpm/idea.xpm'
+
+*** Action on file `xpm/editcut.xpm'
+No prompt for file `xpm/editcut.xpm'
+
+*** Action on file `xpm/editcopyS.xpm'
+No prompt for file `xpm/editcopyS.xpm'
+
+*** Action on file `xpm/cmark.xpm'
+No prompt for file `xpm/cmark.xpm'
+
+*** Action on file `xpm/fileopenS.xpm'
+No prompt for file `xpm/fileopenS.xpm'
+
+*** Action on file `xpm/ctrl.xpm'
+No prompt for file `xpm/ctrl.xpm'
+
+*** Action on file `xpm/note1.xpm'
+No prompt for file `xpm/note1.xpm'
+
+*** Action on file `xpm/context_help.xpm'
+No prompt for file `xpm/context_help.xpm'
+
+*** Action on file `xpm/exitS.xpm'
+No prompt for file `xpm/exitS.xpm'
+
+*** Action on file `xpm/flagS.xpm'
+No prompt for file `xpm/flagS.xpm'
+
+*** Action on file `xpm/iiwusynth.xpm'
+No prompt for file `xpm/iiwusynth.xpm'
+
+*** Action on file `xpm/sysex.xpm'
+No prompt for file `xpm/sysex.xpm'
+
+*** Action on file `xpm/down.xpm'
+No prompt for file `xpm/down.xpm'
+
+*** Action on file `xpm/dot.xpm'
+No prompt for file `xpm/dot.xpm'
+
+*** Action on file `xpm/quant.xpm'
+No prompt for file `xpm/quant.xpm'
+
+*** Action on file `xpm/doth.xpm'
+No prompt for file `xpm/doth.xpm'
+
+*** Action on file `xpm/punchout1.xpm'
+No prompt for file `xpm/punchout1.xpm'
+
+*** Action on file `xpm/cut.xpm'
+No prompt for file `xpm/cut.xpm'
+
+*** Action on file `xpm/note.xpm'
+No prompt for file `xpm/note.xpm'
+
+*** Action on file `xpm/buttondown.xpm'
+No prompt for file `xpm/buttondown.xpm'
+
+*** Action on file `xpm/dot1.xpm'
+No prompt for file `xpm/dot1.xpm'
+
+*** Action on file `xpm/meta.xpm'
+No prompt for file `xpm/meta.xpm'
+
+*** Action on file `xpm/undo.xpm'
+No prompt for file `xpm/undo.xpm'
+
+*** Action on file `xpm/master.xpm'
+No prompt for file `xpm/master.xpm'
+
+*** Action on file `xpm/bluedot.xpm'
+No prompt for file `xpm/bluedot.xpm'
+
+*** Action on file `xpm/newmutebutton.xpm'
+No prompt for file `xpm/newmutebutton.xpm'
+
+*** Action on file `xpm/pafter.xpm'
+No prompt for file `xpm/pafter.xpm'
+
+*** Action on file `lib/plugins/Makefile.am'
+No prompt for file `lib/plugins/Makefile.am'
+
+*** Action on file `lib/synthi/Makefile.am'
+No prompt for file `lib/synthi/Makefile.am'
+
+*** Action on file `lib/Makefile.am'
+No prompt for file `lib/Makefile.am'
+
+*** Action on file `cliplist/cliplist.cpp'
+No prompt for file `cliplist/cliplist.cpp'
+
+*** Action on file `cliplist/Makefile.am'
+No prompt for file `cliplist/Makefile.am'
+
+*** Action on file `cliplist/cliplist.h'
+No prompt for file `cliplist/cliplist.h'
+
+*** Action on file `doc/midieditfunctions.png'
+No prompt for file `doc/midieditfunctions.png'
+
+*** Action on file `doc/Makefile.am'
+No prompt for file `doc/Makefile.am'
+
+*** Action on file `doc/muse.sgm'
+No prompt for file `doc/muse.sgm'
+
+*** Action on file `plugins/Makefile.am'
+No prompt for file `plugins/Makefile.am'
+
+*** Action on file `plugins/plugin.h'
+No prompt for file `plugins/plugin.h'
+
+*** Action on file `plugins/plugin.cpp'
+No prompt for file `plugins/plugin.cpp'
+
+*** Action on file `plugins/plugins-install.am'
+No prompt for file `plugins/plugins-install.am'
+
+*** Action on file `plugins/freeverb/denormals.h'
+No prompt for file `plugins/freeverb/denormals.h'
+
+*** Action on file `plugins/freeverb/tuning.h'
+No prompt for file `plugins/freeverb/tuning.h'
+
+*** Action on file `plugins/freeverb/readme.txt'
+No prompt for file `plugins/freeverb/readme.txt'
+
+*** Action on file `plugins/freeverb/revmodel.h'
+No prompt for file `plugins/freeverb/revmodel.h'
+
+*** Action on file `plugins/freeverb/Makefile.am'
+No prompt for file `plugins/freeverb/Makefile.am'
+
+*** Action on file `plugins/freeverb/comb.h'
+No prompt for file `plugins/freeverb/comb.h'
+
+*** Action on file `plugins/freeverb/freeverb.cpp'
+No prompt for file `plugins/freeverb/freeverb.cpp'
+
+*** Action on file `plugins/freeverb/allpass.h'
+No prompt for file `plugins/freeverb/allpass.h'
+
+*** Action on file `plugins/freeverb/revmodel.cpp'
+No prompt for file `plugins/freeverb/revmodel.cpp'
+
+*** Action on file `midictrledit.h'
+No prompt for file `midictrledit.h'
+
+
+*** Merge complete
+
diff --git a/muse2/muse/muse.pro b/muse2/muse/muse.pro
new file mode 100644
index 00000000..183ac3a8
--- /dev/null
+++ b/muse2/muse/muse.pro
@@ -0,0 +1,369 @@
+HEADERS = \
+ ./ctrl/ctrledit.h \
+ ./ctrl/ctrlcanvas.h \
+ ./ctrl/ctrlpanel.h \
+ ./debug.h \
+ ./midiport.h \
+ ./app.h \
+ ./eventbase.h \
+ ./key.h \
+ ./liste/listedit.h \
+ ./liste/editevent.h \
+ ./mixer/mstrip.h \
+ ./mixer/auxknob.h \
+ ./mixer/meter.h \
+ ./mixer/panknob.h \
+ ./mixer/strip.h \
+ ./mixer/rack.h \
+ ./mixer/routedialog.h \
+ ./mixer/amixer.h \
+ ./mixer/astrip.h \
+ ./mtc.h \
+ ./pos.h \
+ ./sig.h \
+ ./xml.h \
+ ./miditransform.h \
+ ./route.h \
+ ./globaldefs.h \
+ ./appearance.h \
+ ./midievent.h \
+ ./midieditor.h \
+ ./confmport.h \
+ ./patchbay/patchbay.h \
+ ./tempo.h \
+ ./audioprefetch.h \
+ ./event.h \
+ ./waveevent.h \
+ ./midiedit/pianoroll.h \
+ ./midiedit/cmd.h \
+ ./midiedit/dlist.h \
+ ./midiedit/prcanvas.h \
+ ./midiedit/quantconfig.h \
+ ./midiedit/ecanvas.h \
+ ./midiedit/drumedit.h \
+ ./midiedit/drummap.h \
+ ./midiedit/piano.h \
+ ./midiedit/dcanvas.h \
+ ./conf.h \
+ ./ctrl.h \
+ ./driver/jackaudio.h \
+ ./driver/alsamidi.h \
+ ./driver/audiodev.h \
+ ./fastlog.h \
+ ./mpevent.h \
+ ./synth.h \
+ ./cobject.h \
+ ./track.h \
+ ./evdata.h \
+ ./marker/markerview.h \
+ ./marker/marker.h \
+ ./master/tscale.h \
+ ./master/lmaster.h \
+ ./master/masteredit.h \
+ ./master/master.h \
+ ./gconfig.h \
+ ./midi.h \
+ ./waveedit/waveedit.h \
+ ./waveedit/waveview.h \
+ ./mplugins/midifilterimpl.h \
+ ./mplugins/mittranspose.h \
+ ./mplugins/random.h \
+ ./mplugins/mrconfig.h \
+ ./mplugins/midiitransform.h \
+ ./mplugins/rhythm.h \
+ ./mplugins/mitplugin.h \
+ ./node.h \
+ ./part.h \
+ ./value.h \
+ ./song.h \
+ ./sync.h \
+ ./undo.h \
+ ./ladspa.h \
+ ./wave.h \
+ ./device.h \
+ ./instruments/midictrledit.h \
+ ./instruments/minstrument.h \
+ ./instruments/editinstrument.h \
+ ./icons.h \
+ ./thread.h \
+ ./arranger/tlist.h \
+ ./arranger/arranger.h \
+ ./arranger/alayout.h \
+ ./arranger/pcanvas.h \
+ ./globals.h \
+ ./audio.h \
+ ./transpose.h \
+ ./transport.h \
+ ./widgets/section.h \
+ ./widgets/mixdowndialog.h \
+ ./widgets/dimap.h \
+ ./widgets/fontsel.h \
+ ./widgets/lcombo.h \
+ ./widgets/pitchedit.h \
+ ./widgets/tb1.h \
+ ./widgets/gatetime.h \
+ ./widgets/comboQuant.h \
+ ./widgets/ctrlcombo.h \
+ ./widgets/comment.h \
+ ./widgets/filedialog.h \
+ ./widgets/sclif.h \
+ ./widgets/scrollscale.h \
+ ./widgets/bigtime.h \
+ ./widgets/metronome.h \
+ ./widgets/combobox.h \
+ ./widgets/ttoolbutton.h \
+ ./widgets/drange.h \
+ ./widgets/scldiv.h \
+ ./widgets/vscale.h \
+ ./widgets/posedit.h \
+ ./widgets/genset.h \
+ ./widgets/shortcutcapturedialog.h \
+ ./widgets/wtscale.h \
+ ./widgets/mmath.h \
+ ./widgets/canvas.h \
+ ./widgets/shortcutconfig.h \
+ ./widgets/pitchlabel.h \
+ ./widgets/tools.h \
+ ./widgets/swidget.h \
+ ./widgets/splitter.h \
+ ./widgets/knob.h \
+ ./widgets/poslabel.h \
+ ./widgets/velocity.h \
+ ./widgets/midisyncimpl.h \
+ ./widgets/ttoolbar.h \
+ ./widgets/nentry.h \
+ ./widgets/action.h \
+ ./widgets/slider.h \
+ ./widgets/dentry.h \
+ ./widgets/siglabel.h \
+ ./widgets/checkbox.h \
+ ./widgets/mtscale.h \
+ ./widgets/spinboxFP.h \
+ ./widgets/view.h \
+ ./widgets/sigscale.h \
+ ./widgets/noteinfo.h \
+ ./widgets/doublelabel.h \
+ ./widgets/utils.h \
+ ./widgets/hitscale.h \
+ ./widgets/intlabel.h \
+ ./widgets/sigedit.h \
+ ./widgets/mlabel.h \
+ ./widgets/header.h \
+ ./widgets/tempolabel.h \
+ ./widgets/sliderbase.h \
+ ./widgets/scldraw.h \
+ ./widgets/citem.h \
+ ./mididev.h \
+ ./midictrl.h \
+ ./midiseq.h \
+ ./midifile.h \
+ ./shortcuts.h \
+ ./memory.h \
+ ./helper.h \
+ ./plugin.h
+
+SOURCES = \
+ ./ctrl/ctrlpanel.cpp \
+ ./ctrl/ctrledit.cpp \
+ ./ctrl/ctrlcanvas.cpp \
+ ./route.cpp \
+ ./undo.cpp \
+ ./midievent.cpp \
+ ./xml.cpp \
+ ./memory.cpp \
+ ./key.cpp \
+ ./midiseq.cpp \
+ ./song.cpp \
+ ./liste/listedit.cpp \
+ ./liste/editevent.cpp \
+ ./mixer/strip.cpp \
+ ./mixer/auxknob.cpp \
+ ./mixer/rack.cpp \
+ ./mixer/amixer.cpp \
+ ./mixer/routedialog.cpp \
+ ./mixer/panknob.cpp \
+ ./mixer/mstrip.cpp \
+ ./mixer/astrip.cpp \
+ ./mixer/meter.cpp \
+ ./transpose.cpp \
+ ./eventlist.cpp \
+ ./transport.cpp \
+ ./wavetrack.cpp \
+ ./audioprefetch.cpp \
+ ./helper.cpp \
+ ./miditransform.cpp \
+ ./ctrl.cpp \
+ ./sig.cpp \
+ ./confmport.cpp \
+ ./shortcuts.cpp \
+ ./audio.cpp \
+ ./part.cpp \
+ ./patchbay/patchbay.cpp \
+ ./appearance.cpp \
+ ./mpevent.cpp \
+ ./midi.cpp \
+ ./event.cpp \
+ ./midiedit/drumedit.cpp \
+ ./midiedit/piano.cpp \
+ ./midiedit/ecanvas.cpp \
+ ./midiedit/quantconfig.cpp \
+ ./midiedit/pianoroll.cpp \
+ ./midiedit/dlist.cpp \
+ ./midiedit/dcanvas.cpp \
+ ./midiedit/prcanvas.cpp \
+ ./midiedit/drummap.cpp \
+ ./plugin.cpp \
+ ./conf.cpp \
+ ./driver/jack.cpp \
+ ./driver/alsamidi.cpp \
+ ./driver/dummyaudio.cpp \
+ ./midictrl.cpp \
+ ./songfile.cpp \
+ ./gconfig.cpp \
+ ./mtc.cpp \
+ ./marker/marker.cpp \
+ ./marker/markerview.cpp \
+ ./master/master.cpp \
+ ./master/tscale.cpp \
+ ./master/lmaster.cpp \
+ ./master/masteredit.cpp \
+ ./sync.cpp \
+ ./wave.cpp \
+ ./midieditor.cpp \
+ ./waveedit/waveview.cpp \
+ ./waveedit/waveedit.cpp \
+ ./mplugins/mitplugin.cpp \
+ ./mplugins/midiitransform.cpp \
+ ./mplugins/mrconfig.cpp \
+ ./mplugins/mittranspose.cpp \
+ ./mplugins/midifilterimpl.cpp \
+ ./cobject.cpp \
+ ./midifile.cpp \
+ ./midiport.cpp \
+ ./exportmidi.cpp \
+ ./value.cpp \
+ ./synth.cpp \
+ ./waveevent.cpp \
+ ./icons.cpp \
+ ./instruments/minstrument.cpp \
+ ./instruments/editinstrument.cpp \
+ ./instruments/midictrledit.cpp \
+ ./app.cpp \
+ ./arranger/arranger.cpp \
+ ./arranger/trackinfo.cpp \
+ ./arranger/pcanvas.cpp \
+ ./arranger/alayout.cpp \
+ ./arranger/tlist.cpp \
+ ./audiotrack.cpp \
+ ./seqmsg.cpp \
+ ./widgets/swidget.cpp \
+ ./widgets/ttoolbutton.cpp \
+ ./widgets/siglabel.cpp \
+ ./widgets/pitchedit.cpp \
+ ./widgets/knob.cpp \
+ ./widgets/tempolabel.cpp \
+ ./widgets/dentry.cpp \
+ ./widgets/midisyncimpl.cpp \
+ ./widgets/musewidgetsplug.cpp \
+ ./widgets/scldiv.cpp \
+ ./widgets/pitchlabel.cpp \
+ ./widgets/tools.cpp \
+ ./widgets/poslabel.cpp \
+ ./widgets/scldraw.cpp \
+ ./widgets/tb1.cpp \
+ ./widgets/gatetime.cpp \
+ ./widgets/sigscale.cpp \
+ ./widgets/vscale.cpp \
+ ./widgets/lcombo.cpp \
+ ./widgets/noteinfo.cpp \
+ ./widgets/mtscale.cpp \
+ ./widgets/scrollscale.cpp \
+ ./widgets/ttoolbar.cpp \
+ ./widgets/slider.cpp \
+ ./widgets/doublelabel.cpp \
+ ./widgets/citem.cpp \
+ ./widgets/intlabel.cpp \
+ ./widgets/sigedit.cpp \
+ ./widgets/combobox.cpp \
+ ./widgets/genset.cpp \
+ ./widgets/checkbox.cpp \
+ ./widgets/sliderbase.cpp \
+ ./widgets/comboQuant.cpp \
+ ./widgets/wtscale.cpp \
+ ./widgets/nentry.cpp \
+ ./widgets/canvas.cpp \
+ ./widgets/splitter.cpp \
+ ./widgets/posedit.cpp \
+ ./widgets/fontsel.cpp \
+ ./widgets/mixdowndialog.cpp \
+ ./widgets/ctrlcombo.cpp \
+ ./widgets/comment.cpp \
+ ./widgets/metronome.cpp \
+ ./widgets/mlabel.cpp \
+ ./widgets/spinboxFP.cpp \
+ ./widgets/drange.cpp \
+ ./widgets/velocity.cpp \
+ ./widgets/shortcutconfig.cpp \
+ ./widgets/header.cpp \
+ ./widgets/hitscale.cpp \
+ ./widgets/view.cpp \
+ ./widgets/bigtime.cpp \
+ ./widgets/filedialog.cpp \
+ ./widgets/sclif.cpp \
+ ./widgets/utils.cpp \
+ ./widgets/dimap.cpp \
+ ./widgets/mmath.cpp \
+ ./mididev.cpp \
+ ./node.cpp \
+ ./track.cpp \
+ ./pos.cpp \
+ ./globals.cpp \
+ ./importmidi.cpp \
+ ./thread.cpp \
+ ./help.cpp \
+ ./tempo.cpp
+
+FORMS = \
+ ./liste/editctrlbase.ui \
+ ./mixer/midiportroutebase.ui \
+ ./mixer/routedialogbase.ui \
+ ./patchbay/patchbaybase.ui \
+ ./mplugins/mrconfigbase.ui \
+ ./mplugins/midifilter.ui \
+ ./mplugins/rhythmbase.ui \
+ ./instruments/editinstrumentbase.ui \
+ ./instruments/ccontrolbase.ui \
+ ./widgets/synthconfigbase.ui \
+ ./widgets/mixdowndialogbase.ui \
+ ./widgets/aboutbox.ui \
+ ./widgets/editnotedialogbase.ui \
+ ./widgets/commentbase.ui \
+ ./widgets/fdialogbuttons.ui \
+ ./widgets/metronomebase.ui \
+ ./widgets/gensetbase.ui \
+ ./widgets/shortcutcapturedialogbase.ui \
+ ./widgets/mtrackinfobase.ui \
+ ./widgets/editmetadialogbase.ui \
+ ./widgets/gatetimebase.ui \
+ ./widgets/configmidifilebase.ui \
+ ./widgets/editsysexdialogbase.ui \
+ ./widgets/wtrackinfobase.ui \
+ ./widgets/midisync.ui \
+ ./widgets/appearancebase.ui \
+ ./widgets/velocitybase.ui \
+ ./widgets/cliplisteditorbase.ui \
+ ./widgets/mittransposebase.ui \
+ ./widgets/transformbase.ui \
+ ./widgets/transposebase.ui \
+ ./widgets/editctrl7dialogbase.ui \
+ ./widgets/shortcutconfigbase.ui \
+ ./widgets/itransformbase.ui
+
+TRANSLATIONS = \
+ ../share/locale/muse_de.ts \
+ ../share/locale/muse_fr.ts \
+ ../share/locale/muse_sv_SE.ts \
+ ../share/locale/muse_es.ts \
+ ../share/locale/muse_ru.ts \
+ ../share/locale/muse_pl.ts
+
diff --git a/muse2/muse/node.cpp b/muse2/muse/node.cpp
new file mode 100644
index 00000000..47fbf1f2
--- /dev/null
+++ b/muse2/muse/node.cpp
@@ -0,0 +1,1911 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: node.cpp,v 1.36.2.25 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <cmath>
+#include <assert.h>
+#include <sndfile.h>
+#include <stdlib.h>
+
+#include "node.h"
+#include "globals.h"
+#include "gconfig.h"
+#include "song.h"
+#include "xml.h"
+#include "plugin.h"
+#include "synth.h"
+#include "audiodev.h"
+#include "audio.h"
+#include "wave.h"
+#include "utils.h" //debug
+#include "ticksynth.h" // metronome
+#include "al/dsp.h"
+
+// Uncomment this (and make sure to set Jack buffer size high like 2048)
+// to see process flow messages.
+//#define NODE_DEBUG
+//#define FIFO_DEBUG
+
+// Added by Tim. p3.3.18
+//#define METRONOME_DEBUG
+
+//---------------------------------------------------------
+// isMute
+//---------------------------------------------------------
+
+bool MidiTrack::isMute() const
+ {
+ if (_solo || (_internalSolo && !_mute))
+ return false;
+
+ if (_soloRefCnt)
+ return true;
+
+ return _mute;
+ }
+
+bool AudioTrack::isMute() const
+ {
+ if (_solo || (_internalSolo && !_mute))
+ return false;
+
+ if (_soloRefCnt)
+ return true;
+
+ return _mute;
+ }
+
+//---------------------------------------------------------
+// setSolo
+//---------------------------------------------------------
+
+void MidiTrack::setSolo(bool val)
+{
+ if(_solo != val)
+ {
+ _solo = val;
+ updateSoloStates(false);
+ }
+}
+
+void AudioTrack::setSolo(bool val)
+{
+ if(_solo != val)
+ {
+ _solo = val;
+ updateSoloStates(false);
+ }
+
+ if (isMute())
+ resetMeter();
+}
+
+//---------------------------------------------------------
+// setInternalSolo
+//---------------------------------------------------------
+
+void Track::setInternalSolo(unsigned int val)
+{
+ _internalSolo = val;
+}
+
+//---------------------------------------------------------
+// clearSoloRefCounts
+// This is a static member function. Required for outside access.
+// Clears the internal static reference counts.
+//---------------------------------------------------------
+
+void Track::clearSoloRefCounts()
+{
+ _soloRefCnt = 0;
+}
+
+//---------------------------------------------------------
+// updateSoloState
+//---------------------------------------------------------
+
+void Track::updateSoloState()
+{
+ if(_solo)
+ _soloRefCnt++;
+ else
+ if(_soloRefCnt && !_tmpSoloChainNoDec)
+ _soloRefCnt--;
+}
+
+//---------------------------------------------------------
+// updateInternalSoloStates
+//---------------------------------------------------------
+
+void Track::updateInternalSoloStates()
+{
+ if(_tmpSoloChainTrack->solo())
+ {
+ _internalSolo++;
+ _soloRefCnt++;
+ }
+ else
+ if(!_tmpSoloChainNoDec)
+ {
+ if(_internalSolo)
+ _internalSolo--;
+ if(_soloRefCnt)
+ _soloRefCnt--;
+ }
+}
+
+//---------------------------------------------------------
+// updateInternalSoloStates
+//---------------------------------------------------------
+
+void MidiTrack::updateInternalSoloStates()
+{
+ if(this == _tmpSoloChainTrack)
+ return;
+
+ Track::updateInternalSoloStates();
+}
+
+//---------------------------------------------------------
+// updateInternalSoloStates
+//---------------------------------------------------------
+
+void AudioTrack::updateInternalSoloStates()
+{
+ if(this == _tmpSoloChainTrack)
+ return;
+
+ Track::updateInternalSoloStates();
+
+ if(_tmpSoloChainDoIns)
+ {
+ if(type() == AUDIO_SOFTSYNTH)
+ {
+ const MidiTrackList* ml = song->midis();
+ for(ciMidiTrack im = ml->begin(); im != ml->end(); ++im)
+ {
+ MidiTrack* mt = *im;
+ if(mt->outPort() >= 0 && mt->outPort() == ((SynthI*)this)->midiPort())
+ mt->updateInternalSoloStates();
+ }
+ }
+
+ const RouteList* rl = inRoutes();
+ for(ciRoute ir = rl->begin(); ir != rl->end(); ++ir)
+ {
+ if(ir->type == Route::TRACK_ROUTE)
+ ir->track->updateInternalSoloStates();
+ }
+ }
+ else
+ {
+ const RouteList* rl = outRoutes();
+ for(ciRoute ir = rl->begin(); ir != rl->end(); ++ir)
+ {
+ if(ir->type == Route::TRACK_ROUTE)
+ ir->track->updateInternalSoloStates();
+ }
+ }
+}
+
+//---------------------------------------------------------
+// updateSoloStates
+//---------------------------------------------------------
+
+void MidiTrack::updateSoloStates(bool noDec)
+{
+ if(noDec && !_solo)
+ return;
+
+ _tmpSoloChainTrack = this;
+ _tmpSoloChainDoIns = false;
+ _tmpSoloChainNoDec = noDec;
+ updateSoloState();
+
+ if(outPort() >= 0)
+ {
+ MidiDevice *md = midiPorts[outPort()].device();
+ if(md && md->isSynti())
+ ((SynthI*)md)->updateInternalSoloStates();
+ }
+}
+
+//---------------------------------------------------------
+// updateSoloStates
+//---------------------------------------------------------
+
+void AudioTrack::updateSoloStates(bool noDec)
+{
+ if(noDec && !_solo)
+ return;
+
+ _tmpSoloChainTrack = this;
+ _tmpSoloChainNoDec = noDec;
+ updateSoloState();
+
+ _tmpSoloChainDoIns = true;
+ if(type() == AUDIO_SOFTSYNTH)
+ {
+ const MidiTrackList* ml = song->midis();
+ for(ciMidiTrack im = ml->begin(); im != ml->end(); ++im)
+ {
+ MidiTrack* mt = *im;
+ if(mt->outPort() >= 0 && mt->outPort() == ((SynthI*)this)->midiPort())
+ mt->updateInternalSoloStates();
+ }
+ }
+
+ {
+ const RouteList* rl = inRoutes();
+ for(ciRoute ir = rl->begin(); ir != rl->end(); ++ir)
+ {
+ if(ir->type == Route::TRACK_ROUTE)
+ ir->track->updateInternalSoloStates();
+ }
+ }
+ _tmpSoloChainDoIns = false;
+ {
+ const RouteList* rl = outRoutes();
+ for(ciRoute ir = rl->begin(); ir != rl->end(); ++ir)
+ {
+ if(ir->type == Route::TRACK_ROUTE)
+ ir->track->updateInternalSoloStates();
+ }
+ }
+}
+
+//---------------------------------------------------------
+// setMute
+//---------------------------------------------------------
+
+void Track::setMute(bool val)
+ {
+ _mute = val;
+ }
+
+//---------------------------------------------------------
+// setOff
+//---------------------------------------------------------
+
+void Track::setOff(bool val)
+ {
+ _off = val;
+ }
+
+//---------------------------------------------------------
+// copyData
+//---------------------------------------------------------
+
+//void AudioTrack::copyData(unsigned pos, int dstChannels, unsigned nframes, float** dstBuffer)
+void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int srcChannels, unsigned nframes, float** dstBuffer)
+{
+ //Changed by T356. 12/12/09.
+ // Overhaul and streamline to eliminate multiple processing during one process loop.
+ // Was causing ticking sound with synths + multiple out routes because synths were being processed multiple times.
+ // Make better use of AudioTrack::outBuffers as a post-effect pre-volume cache system for multiple calls here during processing.
+ // Previously only WaveTrack used them. (Changed WaveTrack as well).
+
+ if(srcStartChan == -1)
+ srcStartChan = 0;
+
+ int srcChans = (srcChannels == -1) ? channels() : srcChannels;
+ int srcTotalOutChans = totalOutChannels();
+ if(channels() == 1)
+ srcTotalOutChans = 1;
+
+ #ifdef NODE_DEBUG
+ printf("MusE: AudioTrack::copyData name:%s processed:%d\n", name().latin1(), processed());
+ #endif
+
+ // Special consideration for metronome: It is not part of the track list,
+ // and it has no in or out routes, yet multiple output tracks may call addData on it !
+ // We can't tell how many output tracks call it, so we can only assume there might be more than one.
+ // Not strictly necessary here because only addData is ever called, but just to be consistent...
+ //bool usedirectbuf = (outRoutes()->size() <= 1) || (type() == AUDIO_OUTPUT);
+ bool usedirectbuf = ((outRoutes()->size() <= 1) || (type() == AUDIO_OUTPUT)) && (this != metronome);
+
+ int i;
+
+ // p3.3.38
+ //float* buffer[srcChannels];
+ float* buffer[srcTotalOutChans];
+
+
+ //float data[nframes * srcChannels];
+ //for(i = 0; i < srcChannels; ++i)
+ // buffer[i] = data + i * nframes;
+
+ // precalculate stereo volume
+ double vol[2];
+ double _volume = volume();
+ double _pan = pan();
+ vol[0] = _volume * (1.0 - _pan);
+ vol[1] = _volume * (1.0 + _pan);
+ float meter[srcChans];
+
+ // Have we been here already during this process cycle?
+ if(processed())
+ {
+ // If there is only one (or no) output routes, it's an error - we've been called more than once per process cycle!
+ #ifdef NODE_DEBUG
+ if(usedirectbuf)
+ printf("MusE: AudioTrack::copyData Error! One or no out routes, but already processed! Copying local buffers anyway...\n");
+ #endif
+
+ // Is there already some data gathered from a previous call during this process cycle?
+ if(_haveData)
+ {
+ // Point the input buffers at our local cached 'pre-volume' buffers. They need processing, so continue on after.
+ //for(i = 0; i < srcChannels; ++i)
+ // buffer[i] = outBuffers[i];
+ // p3.3.38
+ for(i = 0; i < srcTotalOutChans; ++i)
+ buffer[i] = outBuffers[i];
+ }
+ else
+ {
+ // No data was available from a previous call during this process cycle. Zero the supplied buffers and just return.
+ for(i = 0; i < dstChannels; ++i)
+ {
+ if(config.useDenormalBias)
+ {
+ for(unsigned int q = 0; q < nframes; ++q)
+ dstBuffer[i][q] = denormalBias;
+ }
+ else
+ memset(dstBuffer[i], 0, sizeof(float) * nframes);
+ }
+ return;
+ }
+ }
+ else
+ {
+ // First time here during this process cycle.
+
+ // Point the input buffers at a temporary stack buffer.
+ //float data[nframes * srcChannels];
+ //for(i = 0; i < srcChannels; ++i)
+ // buffer[i] = data + i * nframes;
+ // p3.3.38
+ float data[nframes * srcTotalOutChans];
+ for(i = 0; i < srcTotalOutChans; ++i)
+ buffer[i] = data + i * nframes;
+
+ // getData can use the supplied buffers, or change buffer to point to its own local buffers or Jack buffers etc.
+ // For ex. if this is an audio input, Jack will set the pointers for us in AudioInput::getData!
+ // p3.3.29 1/27/10 Don't do any processing at all if off. Whereas, mute needs to be ready for action at all times,
+ // so still call getData before it. Off is NOT meant to be toggled rapidly, but mute is !
+ //if(!getData(pos, srcChannels, nframes, buffer) || off() || (isMute() && !_prefader))
+ //if(off() || !getData(pos, srcChannels, nframes, buffer) || (isMute() && !_prefader))
+ // p3.3.38
+ if(off() || !getData(pos, srcTotalOutChans, nframes, buffer) || (isMute() && !_prefader))
+ {
+ #ifdef NODE_DEBUG
+ printf("MusE: AudioTrack::copyData name:%s dstChannels:%d zeroing buffers\n", name().latin1(), dstChannels);
+ #endif
+
+ // No data was available. Zero the supplied buffers.
+ unsigned int q;
+ for(i = 0; i < dstChannels; ++i)
+ {
+ if(config.useDenormalBias)
+ {
+ for(q = 0; q < nframes; ++q)
+ dstBuffer[i][q] = denormalBias;
+ }
+ else
+ memset(dstBuffer[i], 0, sizeof(float) * nframes);
+ }
+
+ for(i = 0; i < srcChans; ++i)
+ {
+ //_meter[i] = 0;
+ _meter[i] = 0.0;
+
+ /*
+ if(!usedirectbuf)
+ {
+ if(config.useDenormalBias)
+ {
+ for(q = 0; q < nframes; ++q)
+ outBuffers[i][q] = denormalBias;
+ }
+ else
+ memset(outBuffers[i], 0, sizeof(float) * nframes);
+ }
+ */
+ }
+
+ _haveData = false;
+ _processed = true;
+ return;
+ }
+
+ //---------------------------------------------------
+ // apply plugin chain
+ //---------------------------------------------------
+
+ // p3.3.41
+ //fprintf(stderr, "AudioTrack::copyData %s efx apply srcChans:%d\n", name().latin1(), srcChans);
+ _efxPipe->apply(srcChans, nframes, buffer);
+
+ //---------------------------------------------------
+ // aux sends
+ //---------------------------------------------------
+
+ if(hasAuxSend() && !isMute())
+ {
+ AuxList* al = song->auxs();
+ unsigned naux = al->size();
+ for(unsigned k = 0; k < naux; ++k)
+ {
+ float m = _auxSend[k];
+ if(m <= 0.0001) // optimize
+ continue;
+ AudioAux* a = (AudioAux*)((*al)[k]);
+ float** dst = a->sendBuffer();
+ int auxChannels = a->channels();
+ if((srcChans ==1 && auxChannels==1) || srcChans == 2)
+ {
+ for(int ch = 0; ch < srcChans; ++ch)
+ {
+ float* db = dst[ch % a->channels()]; // no matter whether there's one or two dst buffers
+ float* sb = buffer[ch];
+ for(unsigned f = 0; f < nframes; ++f)
+ *db++ += (*sb++ * m * vol[ch]); // add to mix
+ }
+ }
+ else if(srcChans==1 && auxChannels==2) // copy mono to both channels
+ {
+ for(int ch = 0; ch < auxChannels; ++ch)
+ {
+ float* db = dst[ch % a->channels()];
+ float* sb = buffer[0];
+ for(unsigned f = 0; f < nframes; ++f)
+ *db++ += (*sb++ * m * vol[ch]); // add to mix
+ }
+ }
+ }
+ }
+
+ //---------------------------------------------------
+ // prefader metering
+ //---------------------------------------------------
+
+ if(_prefader)
+ {
+ for(i = 0; i < srcChans; ++i)
+ {
+ float* p = buffer[i];
+ meter[i] = 0.0;
+ for(unsigned k = 0; k < nframes; ++k)
+ {
+ double f = fabs(*p);
+ if(f > meter[i])
+ meter[i] = f;
+ ++p;
+ }
+ //_meter[i] = lrint(meter[i] * 32767.0);
+ _meter[i] = meter[i];
+ if(_meter[i] > _peak[i])
+ _peak[i] = _meter[i];
+ }
+ }
+
+ if(isMute())
+ {
+ unsigned int q;
+ for(i = 0; i < dstChannels; ++i)
+ {
+ if(config.useDenormalBias)
+ {
+ for(q = 0; q < nframes; q++)
+ dstBuffer[i][q] = denormalBias;
+ }
+ else
+ memset(dstBuffer[i], 0, sizeof(float) * nframes);
+ }
+
+ /*
+ if(!usedirectbuf)
+ {
+ for(i = 0; i < srcChannels; ++i)
+ {
+ if(config.useDenormalBias)
+ {
+ for(q = 0; q < nframes; ++q)
+ outBuffers[i][q] = denormalBias;
+ }
+ else
+ memset(outBuffers[i], 0, sizeof(float) * nframes);
+ }
+ }
+ */
+
+ _haveData = false;
+ _processed = true;
+ return;
+ }
+
+ // If we're using local cached 'pre-volume' buffers, copy the input buffers (as they are right now: post-effect pre-volume) back to them.
+ if(!usedirectbuf)
+ {
+ //for(i = 0; i < srcChannels; ++i)
+ // AL::dsp->cpy(outBuffers[i], buffer[i], nframes);
+ // p3.3.38
+ for(i = 0; i < srcTotalOutChans; ++i)
+ AL::dsp->cpy(outBuffers[i], buffer[i], nframes);
+ }
+
+ // We have some data! Set to true.
+ _haveData = true;
+ }
+
+ // Sanity check. Is source starting channel out of range? Just zero and return.
+ if(srcStartChan >= srcTotalOutChans)
+ {
+ unsigned int q;
+ for(i = 0; i < dstChannels; ++i)
+ {
+ if(config.useDenormalBias)
+ {
+ for(q = 0; q < nframes; q++)
+ dstBuffer[i][q] = denormalBias;
+ }
+ else
+ memset(dstBuffer[i], 0, sizeof(float) * nframes);
+ }
+ _processed = true;
+ return;
+ }
+ // Force a source range to fit actual available total out channels.
+ if((srcStartChan + srcChans) > srcTotalOutChans)
+ srcChans = srcTotalOutChans - srcStartChan;
+
+ //---------------------------------------------------
+ // apply volume
+ // postfader metering
+ //---------------------------------------------------
+
+
+ if(srcChans == dstChannels)
+ {
+ if(_prefader)
+ {
+ for(int c = 0; c < dstChannels; ++c)
+ {
+ // p3.3.38
+ //float* sp = buffer[c];
+ float* sp = buffer[c + srcStartChan];
+
+ float* dp = dstBuffer[c];
+ for(unsigned k = 0; k < nframes; ++k)
+ *dp++ = (*sp++ * vol[c]);
+ }
+ }
+ else
+ {
+ for(int c = 0; c < dstChannels; ++c)
+ {
+ meter[c] = 0.0;
+
+ // p3.3.38
+ //float* sp = buffer[c];
+ float* sp = buffer[c + srcStartChan];
+
+ float* dp = dstBuffer[c];
+ //printf("2 dstBuffer[c]=%d\n",long(dstBuffer[c]));
+ for(unsigned k = 0; k < nframes; ++k)
+ {
+ float val = *sp++ * vol[c];
+ *dp++ = val;
+ double f = fabs(val);
+ if(f > meter[c])
+ meter[c] = f;
+ }
+ //_meter[c] = lrint(meter[c] * 32767.0);
+ _meter[c] = meter[c];
+ if(_meter[c] > _peak[c])
+ _peak[c] = _meter[c];
+ }
+ }
+ }
+ else if(srcChans == 1 && dstChannels == 2)
+ {
+ // p3.3.38
+ //float* sp = buffer[0];
+ float* sp = buffer[srcStartChan];
+
+ if(_prefader)
+ {
+ for(int c = 0; c < dstChannels; ++c)
+ {
+ float* dp = dstBuffer[c];
+ for(unsigned k = 0; k < nframes; ++k)
+ *dp++ = (*sp++ * vol[c]);
+ }
+ }
+ else
+ {
+ meter[0] = 0.0;
+ for(unsigned k = 0; k < nframes; ++k)
+ {
+ float val = *sp++;
+ double f = fabs(val) * _volume;
+ if(f > meter[0])
+ meter[0] = f;
+ *(dstBuffer[0] + k) = val * vol[0];
+ *(dstBuffer[1] + k) = val * vol[1];
+ }
+ //_meter[0] = lrint(meter[0] * 32767.0);
+ _meter[0] = meter[0];
+ if(_meter[0] > _peak[0])
+ _peak[0] = _meter[0];
+ }
+ }
+ else if(srcChans == 2 && dstChannels == 1)
+ {
+ // p3.3.38
+ //float* sp1 = buffer[0];
+ //float* sp2 = buffer[1];
+ float* sp1 = buffer[srcStartChan];
+ float* sp2 = buffer[srcStartChan + 1];
+
+ if(_prefader)
+ {
+ float* dp = dstBuffer[0];
+ for(unsigned k = 0; k < nframes; ++k)
+ *dp++ = (*sp1++ * vol[0] + *sp2++ * vol[1]);
+ }
+ else
+ {
+ float* dp = dstBuffer[0];
+ meter[0] = 0.0;
+ meter[1] = 0.0;
+ for(unsigned k = 0; k < nframes; ++k)
+ {
+ float val1 = *sp1++ * vol[0];
+ float val2 = *sp2++ * vol[1];
+ double f1 = fabs(val1);
+ if(f1 > meter[0])
+ meter[0] = f1;
+ double f2 = fabs(val2);
+ if(f2 > meter[1])
+ meter[1] = f2;
+ *dp++ = (val1 + val2);
+ }
+ //_meter[0] = lrint(meter[0] * 32767.0);
+ _meter[0] = meter[0];
+ if(_meter[0] > _peak[0])
+ _peak[0] = _meter[0];
+ //_meter[1] = lrint(meter[1] * 32767.0);
+ _meter[1] = meter[1];
+ if(_meter[1] > _peak[1])
+ _peak[1] = _meter[1];
+ }
+ }
+
+ _processed = true;
+}
+
+//---------------------------------------------------------
+// addData
+//---------------------------------------------------------
+
+//void AudioTrack::addData(unsigned pos, int dstChannels, unsigned nframes, float** dstBuffer)
+void AudioTrack::addData(unsigned pos, int dstChannels, int srcStartChan, int srcChannels, unsigned nframes, float** dstBuffer)
+{
+ //Changed by T356. 12/12/09.
+ // Overhaul and streamline to eliminate multiple processing during one process loop.
+ // Was causing ticking sound with synths + multiple out routes because synths were being processed multiple times.
+ // Make better use of AudioTrack::outBuffers as a post-effect pre-volume cache system for multiple calls here during processing.
+ // Previously only WaveTrack used them. (Changed WaveTrack as well).
+
+ //Added by Tim. p3.3.16
+ #ifdef NODE_DEBUG
+ printf("MusE: AudioTrack::addData name:%s processed:%d\n", name().latin1(), processed());
+ #endif
+
+ if (off())
+ {
+ _processed = true;
+ return;
+ }
+
+ if(srcStartChan == -1)
+ srcStartChan = 0;
+
+ int srcChans = (srcChannels == -1) ? channels() : srcChannels;
+ int srcTotalOutChans = totalOutChannels();
+ if(channels() == 1)
+ srcTotalOutChans = 1;
+
+ // Special consideration for metronome: It is not part of the track list,
+ // and it has no in or out routes, yet multiple output tracks may call addData on it !
+ // We can't tell how many output tracks call it, so we can only assume there might be more than one.
+ //bool usedirectbuf = (outRoutes()->size() <= 1) || (type() == AUDIO_OUTPUT);
+ bool usedirectbuf = ((outRoutes()->size() <= 1) || (type() == AUDIO_OUTPUT)) && (this != metronome);
+
+ int i;
+
+ // p3.3.38
+ //float* buffer[srcChannels];
+ float* buffer[srcTotalOutChans];
+
+ //float data[nframes * srcChannels];
+ //for (i = 0; i < srcChannels; ++i)
+ // buffer[i] = data + i * nframes;
+
+ // precalculate stereo volume
+ double vol[2];
+ double _volume = volume();
+ double _pan = pan();
+ vol[0] = _volume * (1.0 - _pan);
+ vol[1] = _volume * (1.0 + _pan);
+ float meter[srcChans];
+
+ // Have we been here already during this process cycle?
+ if(processed())
+ {
+ // If there is only one (or no) output routes, it's an error - we've been called more than once per process cycle!
+ #ifdef NODE_DEBUG
+ if(usedirectbuf)
+ printf("MusE: AudioTrack::addData Error! One or no out routes, but already processed! Copying local buffers anyway...\n");
+ #endif
+
+ // Is there already some data gathered from a previous call during this process cycle?
+ if(_haveData)
+ {
+ // Point the input buffers at our local cached 'pre-volume' buffers. They need processing, so continue on after.
+ //for(i = 0; i < srcChannels; ++i)
+ // buffer[i] = outBuffers[i];
+ // p3.3.38
+ for(i = 0; i < srcTotalOutChans; ++i)
+ buffer[i] = outBuffers[i];
+ }
+ else
+ // No data was available from a previous call during this process cycle. Nothing to add, just return.
+ return;
+ }
+ else
+ {
+ // First time here during this process cycle.
+
+ // Point the input buffers at a temporary stack buffer.
+ //float data[nframes * srcChannels];
+ //for(i = 0; i < srcChannels; ++i)
+ // buffer[i] = data + i * nframes;
+ // p3.3.38
+ float data[nframes * srcTotalOutChans];
+ for(i = 0; i < srcTotalOutChans; ++i)
+ buffer[i] = data + i * nframes;
+
+
+ // getData can use the supplied buffers, or change buffer to point to its own local buffers or Jack buffers etc.
+ // For ex. if this is an audio input, Jack will set the pointers for us.
+ //if(!getData(pos, srcChannels, nframes, buffer))
+ // p3.3.38
+ if(!getData(pos, srcTotalOutChans, nframes, buffer))
+ {
+ // No data was available. Nothing to add, but zero our local buffers and the meters.
+ for(i = 0; i < srcChans; ++i)
+ {
+ // If we're using local buffers, we must zero them so that the next thing requiring them
+ // during this process cycle will see zeros.
+ /*
+ if(!usedirectbuf)
+ {
+ if(config.useDenormalBias)
+ {
+ for(unsigned int q = 0; q < nframes; ++q)
+ outBuffers[i][q] = denormalBias;
+ }
+ else
+ memset(outBuffers[i], 0, sizeof(float) * nframes);
+ }
+ */
+
+ //_meter[i] = 0;
+ _meter[i] = 0.0;
+ }
+
+ _haveData = false;
+ _processed = true;
+ return;
+ }
+
+ /*
+ // p3.3.41 Added.
+ unsigned int q;
+ for(i = 0; i < srcChans; ++i)
+ {
+ if(config.useDenormalBias)
+ {
+ for(q = 0; q < nframes; ++q)
+ {
+ if(q & 1)
+ buffer[i][q] -= denormalBias;
+ else
+ buffer[i][q] += denormalBias;
+ }
+ }
+ }
+ */
+
+ //---------------------------------------------------
+ // apply plugin chain
+ //---------------------------------------------------
+
+ // p3.3.41
+ //fprintf(stderr, "AudioTrack::addData %s efx apply srcChans:%d nframes:%ld %e %e %e %e\n",
+ // name().latin1(), srcChans, nframes, buffer[0][0], buffer[0][1], buffer[0][2], buffer[0][3]);
+ _efxPipe->apply(srcChans, nframes, buffer);
+ // p3.3.41
+ //fprintf(stderr, "AudioTrack::addData after efx: %e %e %e %e\n",
+ // buffer[0][0], buffer[0][1], buffer[0][2], buffer[0][3]);
+
+ //---------------------------------------------------
+ // aux sends
+ //---------------------------------------------------
+
+ if(hasAuxSend() && !isMute())
+ {
+ AuxList* al = song->auxs();
+ unsigned naux = al->size();
+ for(unsigned k = 0; k < naux; ++k)
+ {
+ float m = _auxSend[k];
+ if(m <= 0.0001) // optimize
+ continue;
+ AudioAux* a = (AudioAux*)((*al)[k]);
+ float** dst = a->sendBuffer();
+ int auxChannels = a->channels();
+ if((srcChans ==1 && auxChannels==1) || srcChans==2)
+ {
+ for(int ch = 0; ch < srcChans; ++ch)
+ {
+ float* db = dst[ch % a->channels()];
+ float* sb = buffer[ch];
+ for(unsigned f = 0; f < nframes; ++f)
+ *db++ += (*sb++ * m * vol[ch]); // add to mix
+ }
+ }
+ else if(srcChans == 1 && auxChannels == 2)
+ {
+ for(int ch = 0; ch < auxChannels; ++ch)
+ {
+ float* db = dst[ch % a->channels()];
+ float* sb = buffer[0];
+ for(unsigned f = 0; f < nframes; ++f)
+ *db++ += (*sb++ * m * vol[ch]); // add to mix
+ }
+ }
+ }
+ }
+
+ //---------------------------------------------------
+ // prefader metering
+ //---------------------------------------------------
+
+ if(_prefader)
+ {
+ for(i = 0; i < srcChans; ++i)
+ {
+ float* p = buffer[i];
+ meter[i] = 0.0;
+ for(unsigned k = 0; k < nframes; ++k)
+ {
+ double f = fabs(*p);
+ if(f > meter[i])
+ meter[i] = f;
+ ++p;
+ }
+ //_meter[i] = lrint(meter[i] * 32767.0);
+ _meter[i] = meter[i];
+ if(_meter[i] > _peak[i])
+ _peak[i] = _meter[i];
+ }
+ }
+
+ if(isMute())
+ {
+ // If we're using local buffers, we must zero them.
+ /*
+ if(!usedirectbuf)
+ {
+ for(i = 0; i < srcChannels; ++i)
+ {
+ if(config.useDenormalBias)
+ {
+ for(unsigned int q = 0; q < nframes; ++q)
+ outBuffers[i][q] = denormalBias;
+ }
+ else
+ memset(outBuffers[i], 0, sizeof(float) * nframes);
+ }
+ }
+ */
+
+ _haveData = false;
+ _processed = true;
+ return;
+ }
+
+ // If we're using local cached 'pre-volume' buffers, copy the input buffers (as they are right now: post-effect pre-volume) back to them.
+ if(!usedirectbuf)
+ {
+ //for(i = 0; i < srcChannels; ++i)
+ // AL::dsp->cpy(outBuffers[i], buffer[i], nframes);
+ // p3.3.38
+ for(i = 0; i < srcTotalOutChans; ++i)
+ AL::dsp->cpy(outBuffers[i], buffer[i], nframes);
+ }
+
+ // We have some data! Set to true.
+ _haveData = true;
+ }
+
+ // Sanity check. Is source starting channel out of range? Just zero and return.
+ if(srcStartChan >= srcTotalOutChans)
+ {
+ unsigned int q;
+ for(i = 0; i < dstChannels; ++i)
+ {
+ if(config.useDenormalBias)
+ {
+ for(q = 0; q < nframes; q++)
+ dstBuffer[i][q] = denormalBias;
+ }
+ else
+ memset(dstBuffer[i], 0, sizeof(float) * nframes);
+ }
+ _processed = true;
+ return;
+ }
+ // Force a source range to fit actual available total out channels.
+ if((srcStartChan + srcChans) > srcTotalOutChans)
+ srcChans = srcTotalOutChans - srcStartChan;
+
+ //---------------------------------------------------
+ // apply volume
+ // postfader metering
+ //---------------------------------------------------
+
+ if(srcChans == dstChannels)
+ {
+ if(_prefader)
+ {
+ for(int c = 0; c < dstChannels; ++c)
+ {
+ // p3.3.38
+ //float* sp = buffer[c];
+ float* sp = buffer[c + srcStartChan];
+
+ float* dp = dstBuffer[c];
+ for(unsigned k = 0; k < nframes; ++k)
+ *dp++ += (*sp++ * vol[c]);
+ }
+ }
+ else
+ {
+ for(int c = 0; c < dstChannels; ++c)
+ {
+ meter[c] = 0.0;
+ // p3.3.38
+ //float* sp = buffer[c];
+ float* sp = buffer[c + srcStartChan];
+
+ float* dp = dstBuffer[c];
+ for(unsigned k = 0; k < nframes; ++k)
+ {
+ float val = *sp++ * vol[c];
+ *dp++ += val;
+ double f = fabs(val);
+ if (f > meter[c])
+ meter[c] = f;
+ }
+ //_meter[c] = lrint(meter[c] * 32767.0);
+ _meter[c] = meter[c];
+ if(_meter[c] > _peak[c])
+ _peak[c] = _meter[c];
+ }
+ }
+ }
+ else if(srcChans == 1 && dstChannels == 2)
+ {
+ // p3.3.38
+ float* sp = buffer[srcStartChan];
+
+ if(_prefader)
+ {
+ for(int c = 0; c < dstChannels; ++c)
+ {
+ float* dp = dstBuffer[c];
+ //float* sp = buffer[0];
+ for(unsigned k = 0; k < nframes; ++k)
+ *dp++ += (*sp++ * vol[c]);
+ }
+ }
+ else
+ {
+ //float* sp = buffer[0];
+ meter[0] = 0.0;
+ for(unsigned k = 0; k < nframes; ++k)
+ {
+ float val = *sp++;
+ double f = fabs(val) * _volume;
+ if(f > meter[0])
+ meter[0] = f;
+ *(dstBuffer[0] + k) += val * vol[0];
+ *(dstBuffer[1] + k) += val * vol[1];
+ }
+ //_meter[0] = lrint(meter[0] * 32767.0);
+ _meter[0] = meter[0];
+ if(_meter[0] > _peak[0])
+ _peak[0] = _meter[0];
+ }
+ }
+ else if(srcChans == 2 && dstChannels == 1)
+ {
+ // p3.3.38
+ //float* sp1 = buffer[0];
+ //float* sp2 = buffer[1];
+ float* sp1 = buffer[srcStartChan];
+ float* sp2 = buffer[srcStartChan + 1];
+
+ if(_prefader)
+ {
+ float* dp = dstBuffer[0];
+ for(unsigned k = 0; k < nframes; ++k)
+ *dp++ += (*sp1++ * vol[0] + *sp2++ * vol[1]);
+ }
+ else
+ {
+ float* dp = dstBuffer[0];
+ meter[0] = 0.0;
+ meter[1] = 0.0;
+ for(unsigned k = 0; k < nframes; ++k)
+ {
+ float val1 = *sp1++ * vol[0];
+ float val2 = *sp2++ * vol[1];
+ double f1 = fabs(val1);
+ if(f1 > meter[0])
+ meter[0] = f1;
+ double f2 = fabs(val2);
+ if(f2 > meter[1])
+ meter[1] = f2;
+ *dp++ += (val1 + val2);
+ }
+ //_meter[0] = lrint(meter[0] * 32767.0);
+ _meter[0] = meter[0];
+ if(_meter[0] > _peak[0])
+ _peak[0] = _meter[0];
+ //_meter[1] = lrint(meter[1] * 32767.0);
+ _meter[1] = meter[1];
+ if(_meter[1] > _peak[1])
+ _peak[1] = _meter[1];
+ }
+ }
+
+ _processed = true;
+}
+
+//---------------------------------------------------------
+// readVolume
+//---------------------------------------------------------
+
+void AudioTrack::readVolume(Xml& xml)
+ {
+ int ch = 0;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ xml.unknown("readVolume");
+ break;
+ case Xml::Text:
+ setVolume(xml.s1().toDouble());
+ break;
+ case Xml::Attribut:
+ if (xml.s1() == "ch")
+ ch = xml.s2().toInt();
+ break;
+ case Xml::TagEnd:
+ if (xml.s1() == "volume")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+// Removed by T356
+// "recfile" tag not saved anymore
+/*
+//---------------------------------------------------------
+// readRecfile
+//---------------------------------------------------------
+
+void AudioTrack::readRecfile(Xml& xml)
+ {
+ QString path;
+ int channels = 2;
+ int format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::TagStart:
+ if (tag == "path")
+ path = xml.parse1();
+ else if (tag == "channels")
+ channels = xml.parseInt();
+ else if (tag == "format")
+ format = xml.parseInt();
+ else if (tag == "samplebits")
+ ;
+ else
+ xml.unknown("recfile");
+ break;
+ case Xml::TagEnd:
+ if (tag == "recfile") {
+ if (QFile::exists(path)) {
+ setRecFile(getWave(path, true));
+ }
+ else {
+ setRecFile(new SndFile(path));
+ recFile()->setFormat(format, channels, sampleRate);
+ if (recFile()->openWrite()) {
+ fprintf(stderr, "create wave file(%s) failed: %s\n",
+ path.latin1(), recFile()->strerror().latin1());
+ delete _recFile;
+ _recFile = 0;
+ }
+ }
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+*/
+
+//---------------------------------------------------------
+// setChannels
+//---------------------------------------------------------
+
+void Track::setChannels(int n)
+ {
+ if(n > MAX_CHANNELS)
+ _channels = MAX_CHANNELS;
+ else
+ _channels = n;
+ for (int i = 0; i < _channels; ++i) {
+ //_meter[i] = 0;
+ _meter[i] = 0.0;
+ //_peak[i] = 0;
+ _peak[i] = 0.0;
+ }
+ }
+
+void AudioInput::setChannels(int n)
+ {
+ if (n == _channels)
+ return;
+//was ist mit: void* jackPorts[MAX_CHANNELS];
+ AudioTrack::setChannels(n);
+ }
+
+void AudioOutput::setChannels(int n)
+ {
+ if (n == _channels)
+ return;
+ AudioTrack::setChannels(n);
+ }
+
+//---------------------------------------------------------
+// putFifo
+//---------------------------------------------------------
+
+void AudioTrack::putFifo(int channels, unsigned long n, float** bp)
+ {
+ if (fifo.put(channels, n, bp, audio->pos().frame())) {
+ printf(" overrun ???\n");
+ }
+ }
+
+//---------------------------------------------------------
+// getData
+// return false if no data available
+//---------------------------------------------------------
+
+bool AudioTrack::getData(unsigned pos, int channels, unsigned nframes, float** buffer)
+ {
+ // use supplied buffers
+
+ RouteList* rl = inRoutes();
+
+ #ifdef NODE_DEBUG
+ printf("AudioTrack::getData name:%s inRoutes:%d\n", name().latin1(), rl->size());
+ #endif
+
+ iRoute ir = rl->begin();
+ if (ir == rl->end())
+ return false;
+
+ if(ir->track->isMidiTrack())
+ return false;
+
+ #ifdef NODE_DEBUG
+ printf(" calling copyData on %s...\n", ir->track->name().latin1());
+ #endif
+
+ // p3.3.38
+ //((AudioTrack*)ir->track)->copyData(pos, channels, nframes, buffer);
+ ((AudioTrack*)ir->track)->copyData(pos, channels,
+ //(ir->track->type() == Track::AUDIO_SOFTSYNTH && ir->channel != -1) ? ir->channel : 0,
+ ir->channel,
+ ir->channels,
+ nframes, buffer);
+
+ // p3.3.41
+ //fprintf(stderr, "AudioTrack::getData %s data: nframes:%ld %e %e %e %e\n", name().latin1(), nframes, buffer[0][0], buffer[0][1], buffer[0][2], buffer[0][3]);
+
+ ++ir;
+ for (; ir != rl->end(); ++ir) {
+ #ifdef NODE_DEBUG
+ printf(" calling addData on %s...\n", ir->track->name().latin1());
+ #endif
+
+ if(ir->track->isMidiTrack())
+ continue;
+
+ // p3.3.38
+ //((AudioTrack*)ir->track)->addData(pos, channels, nframes, buffer);
+ ((AudioTrack*)ir->track)->addData(pos, channels,
+ //(ir->track->type() == Track::AUDIO_SOFTSYNTH && ir->channel != -1) ? ir->channel : 0,
+ ir->channel,
+ ir->channels,
+ nframes, buffer);
+ }
+ return true;
+ }
+
+//---------------------------------------------------------
+// getData
+// return true if data
+//---------------------------------------------------------
+
+bool AudioInput::getData(unsigned, int channels, unsigned nframes, float** buffer)
+ {
+ if (!checkAudioDevice()) return false;
+ for (int ch = 0; ch < channels; ++ch)
+ {
+ void* jackPort = jackPorts[ch];
+ //float* jackbuf = 0;
+
+ //if (jackPort) {
+ // p3.3.41 Do not get buffers of unconnected client ports. Causes repeating leftover data, can be loud, or DC !
+ if (jackPort && audioDevice->connections(jackPort))
+ {
+ //buffer[ch] = audioDevice->getBuffer(jackPort, nframes);
+ // p3.3.41 If the client port buffer is also used by another channel (connected to the same jack port),
+ // don't directly set pointer, copy the data instead.
+ // Otherwise the next channel will interfere - it will overwrite the buffer !
+ // Verified symptoms: Can't use a splitter. Mono noise source on a stereo track sounds in mono. Etc...
+ // TODO: Problem: What if other Audio Input tracks share the same jack ports as this Audio Input track?
+ // Users will expect that Audio Inputs just work even if the input routes originate from the same jack port.
+ // Solution: Rather than having to iterate all other channels, and all other Audio Input tracks and check
+ // their channel port buffers (if that's even possible) in order to determine if the buffer is shared,
+ // let's just copy always, for now shall we ?
+ float* jackbuf = audioDevice->getBuffer(jackPort, nframes);
+ //memcpy(buffer[ch], jackbuf, nframes* sizeof(float));
+ AL::dsp->cpy(buffer[ch], jackbuf, nframes);
+
+ if (config.useDenormalBias)
+ {
+ for (unsigned int i=0; i < nframes; i++)
+ buffer[ch][i] += denormalBias;
+
+ // p3.3.41
+ //fprintf(stderr, "AudioInput::getData %s Jack port %p efx apply channels:%d nframes:%ld %e %e %e %e\n",
+ // name().latin1(), jackPort, channels, nframes, buffer[0][0], buffer[0][1], buffer[0][2], buffer[0][3]);
+ }
+ }
+ else
+ {
+ if (config.useDenormalBias)
+ {
+ for (unsigned int i=0; i < nframes; i++)
+ buffer[ch][i] = denormalBias;
+ }
+ else
+ {
+ memset(buffer[ch], 0, nframes * sizeof(float));
+ }
+
+ // p3.3.41
+ //fprintf(stderr, "AudioInput::getData %s No Jack port efx apply channels:%d nframes:%ld %e %e %e %e\n",
+ // name().latin1(), channels, nframes, buffer[0][0], buffer[0][1], buffer[0][2], buffer[0][3]);
+ }
+ }
+ return true;
+}
+
+//---------------------------------------------------------
+// setName
+//---------------------------------------------------------
+
+void AudioInput::setName(const QString& s)
+ {
+ _name = s;
+ if (!checkAudioDevice()) return;
+ for (int i = 0; i < channels(); ++i) {
+ char buffer[128];
+ snprintf(buffer, 128, "%s-%d", _name.latin1(), i);
+ if (jackPorts[i])
+ audioDevice->setPortName(jackPorts[i], buffer);
+ else {
+ //jackPorts[i] = audioDevice->registerInPort(buffer);
+ jackPorts[i] = audioDevice->registerInPort(buffer, false);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// resetMeter
+//---------------------------------------------------------
+
+void Track::resetMeter()
+ {
+ for (int i = 0; i < _channels; ++i)
+ //_meter[i] = 0;
+ _meter[i] = 0.0;
+ }
+
+//---------------------------------------------------------
+// resetPeaks
+//---------------------------------------------------------
+
+void Track::resetPeaks()
+ {
+ for (int i = 0; i < _channels; ++i)
+ //_peak[i] = 0;
+ _peak[i] = 0.0;
+ _lastActivity = 0;
+ }
+
+//---------------------------------------------------------
+// resetAllMeter
+//---------------------------------------------------------
+
+void Track::resetAllMeter()
+ {
+ TrackList* tl = song->tracks();
+ for (iTrack i = tl->begin(); i != tl->end(); ++i)
+ (*i)->resetMeter();
+ }
+
+//---------------------------------------------------------
+// setRecordFlag2
+// real time part (executed in audio thread)
+//---------------------------------------------------------
+
+void AudioTrack::setRecordFlag2(bool f)
+ {
+ if (f == _recordFlag)
+ return;
+ _recordFlag = f;
+ if (!_recordFlag)
+ resetMeter();
+ }
+
+//---------------------------------------------------------
+// setMute
+//---------------------------------------------------------
+
+void AudioTrack::setMute(bool f)
+ {
+ _mute = f;
+ if (_mute)
+ resetAllMeter();
+ }
+
+//---------------------------------------------------------
+// setOff
+//---------------------------------------------------------
+
+void AudioTrack::setOff(bool val)
+ {
+ _off = val;
+ if (val)
+ resetAllMeter();
+ }
+
+//---------------------------------------------------------
+// setPrefader
+//---------------------------------------------------------
+
+void AudioTrack::setPrefader(bool val)
+ {
+ _prefader = val;
+ if (!_prefader && isMute())
+ resetAllMeter();
+ }
+
+//---------------------------------------------------------
+// canEnableRecord
+//---------------------------------------------------------
+
+bool WaveTrack::canEnableRecord() const
+ {
+ return (!noInRoute() || (this == song->bounceTrack));
+ }
+
+//---------------------------------------------------------
+// record
+//---------------------------------------------------------
+
+void AudioTrack::record()
+ {
+ unsigned pos = 0;
+ float* buffer[_channels];
+
+ //printf("AudioTrack: record() fifo %p, count=%d\n", &fifo, fifo.getCount());
+
+ while(fifo.getCount()) {
+
+ if (fifo.get(_channels, segmentSize, buffer, &pos)) {
+ printf("AudioTrack::record(): empty fifo\n");
+ return;
+ }
+ if (_recFile) {
+ // Line removed by Tim. p3.3.8 Oct 28, 2009
+ //_recFile->seek(pos, 0);
+ //
+ // Fix for recorded waves being shifted ahead by an amount
+ // equal to start record position.
+ //
+ // From libsndfile ChangeLog:
+ // 2008-05-11 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+ // * src/sndfile.c
+ // Allow seeking past end of file during write.
+ //
+ // I don't know why this line would even be called, because the FIFOs'
+ // 'pos' members operate in absolute frames, which at this point
+ // would be shifted ahead by the start of the wave part.
+ // So if you begin recording a new wave part at bar 4, for example, then
+ // this line is seeking the record file to frame 288000 even before any audio is written!
+ // Therefore, just let the write do its thing and progress naturally,
+ // it should work OK since everything was OK before the libsndfile change...
+ //
+ // Tested: With the line, audio record looping sort of works, albiet with the start offset added to
+ // the wave file. And it overwrites existing audio. (Check transport window 'overwrite' function. Tie in somehow...)
+ // With the line, looping does NOT work with libsndfile from around early 2007 (my distro's version until now).
+ // Therefore it seems sometime between libsndfile ~2007 and today, libsndfile must have allowed
+ // "seek (behind) on write", as well as the "seek past end" change of 2008...
+ //
+ // Ok, so removing that line breaks *possible* record audio 'looping' functionality, revealed with
+ // later libsndfile.
+ // Try this... And while we're at it, honour the punchin/punchout, and loop functions !
+ //
+ // If punchin is on, or we have looped at least once, use left marker as offset.
+ // Note that audio::startRecordPos is reset to (roughly) the left marker pos upon loop !
+ // (Not any more! I changed Audio::Process)
+ // Since it is possible to start loop recording before the left marker (with punchin off), we must
+ // use startRecordPos or loopFrame or left marker, depending on punchin and whether we have looped yet.
+ unsigned fr;
+ if(song->punchin() && (audio->loopCount() == 0))
+ fr = song->lPos().frame();
+ else
+ if((audio->loopCount() > 0) && (audio->getStartRecordPos().frame() > audio->loopFrame()))
+ fr = audio->loopFrame();
+ else
+ fr = audio->getStartRecordPos().frame();
+ // Now seek and write. If we are looping and punchout is on, don't let punchout point interfere with looping point.
+ if( (pos >= fr) && (!song->punchout() || (!song->loop() && pos < song->rPos().frame())) )
+ {
+ pos -= fr;
+ // Added by Tim. p3.3.8
+ //int position = _recFile->seek(0, SEEK_CUR);
+ //printf("AudioTrack::record loopcnt:%d lframe:%d newpos:%d curpos:%d start:%d end:%d\n", audio->loopCount(), audio->loopFrame(), pos, position, audio->getStartRecordPos().frame(), audio->getEndRecordPos().frame());
+
+ _recFile->seek(pos, 0);
+ _recFile->write(_channels, buffer, segmentSize);
+ }
+
+ }
+ else {
+ printf("AudioNode::record(): no recFile\n");
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// processInit
+//---------------------------------------------------------
+
+void AudioOutput::processInit(unsigned nframes)
+ {
+ _nframes = nframes;
+ if (!checkAudioDevice()) return;
+ for (int i = 0; i < channels(); ++i) {
+ if (jackPorts[i]) {
+ buffer[i] = audioDevice->getBuffer(jackPorts[i], nframes);
+ if (config.useDenormalBias) {
+ for (unsigned int j=0; j < nframes; j++)
+ buffer[i][j] += denormalBias;
+ }
+ }
+ else
+ printf("PANIC: processInit: no buffer from audio driver\n");
+ }
+ }
+
+//---------------------------------------------------------
+// process
+// synthesize "n" frames at buffer offset "offset"
+// current frame position is "pos"
+//---------------------------------------------------------
+
+void AudioOutput::process(unsigned pos, unsigned offset, unsigned n)
+{
+ //Added by Tim. p3.3.16
+ #ifdef NODE_DEBUG
+ printf("MusE: AudioOutput::process name:%s processed:%d\n", name().latin1(), processed());
+ #endif
+
+ for (int i = 0; i < _channels; ++i) {
+ buffer1[i] = buffer[i] + offset;
+ }
+
+ // p3.3.38
+ //copyData(pos, _channels, n, buffer1);
+ copyData(pos, _channels, -1, -1, n, buffer1);
+}
+
+//---------------------------------------------------------
+// silence
+//---------------------------------------------------------
+
+void AudioOutput::silence(unsigned n)
+ {
+ processInit(n);
+ for (int i = 0; i < channels(); ++i)
+ if (config.useDenormalBias) {
+ for (unsigned int j=0; j < n; j++)
+ buffer[i][j] = denormalBias;
+ } else {
+ memset(buffer[i], 0, n * sizeof(float));
+ }
+ }
+
+//---------------------------------------------------------
+// processWrite
+//---------------------------------------------------------
+
+void AudioOutput::processWrite()
+ {
+ if (audio->isRecording() && song->bounceOutput == this) {
+ if (audio->freewheel()) {
+ WaveTrack* track = song->bounceTrack;
+ if (track && track->recordFlag() && track->recFile())
+ track->recFile()->write(_channels, buffer, _nframes);
+ if (recordFlag() && recFile())
+ _recFile->write(_channels, buffer, _nframes);
+ }
+ else {
+ WaveTrack* track = song->bounceTrack;
+ if (track && track->recordFlag() && track->recFile())
+ track->putFifo(_channels, _nframes, buffer);
+ if (recordFlag() && recFile())
+ putFifo(_channels, _nframes, buffer);
+ }
+ }
+ // Changed by Tim. p3.3.18
+ //if (audioClickFlag && song->click()) {
+ if (sendMetronome() && audioClickFlag && song->click()) {
+
+ // Added by Tim. p3.3.18
+ #ifdef METRONOME_DEBUG
+ printf("MusE: AudioOutput::processWrite Calling metronome->addData frame:%u channels:%d frames:%lu\n", audio->pos().frame(), _channels, _nframes);
+ #endif
+
+ // p3.3.38
+ //metronome->addData(audio->pos().frame(), _channels, _nframes, buffer);
+ metronome->addData(audio->pos().frame(), _channels, -1, -1, _nframes, buffer);
+ }
+ }
+//---------------------------------------------------------
+// setName
+//---------------------------------------------------------
+
+void AudioOutput::setName(const QString& s)
+ {
+ _name = s;
+ if (!checkAudioDevice()) return;
+ for (int i = 0; i < channels(); ++i) {
+ char buffer[128];
+ snprintf(buffer, 128, "%s-%d", _name.latin1(), i);
+ if (jackPorts[i]) {
+ audioDevice->setPortName(jackPorts[i], buffer);
+ }
+ else {
+ //jackPorts[i] = audioDevice->registerOutPort(buffer);
+ jackPorts[i] = audioDevice->registerOutPort(buffer, false);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// Fifo
+//---------------------------------------------------------
+
+Fifo::Fifo()
+ {
+ muse_atomic_init(&count);
+ //nbuffer = FIFO_BUFFER;
+ nbuffer = fifoLength;
+ buffer = new FifoBuffer*[nbuffer];
+ for (int i = 0; i < nbuffer; ++i)
+ buffer[i] = new FifoBuffer;
+ clear();
+ }
+
+Fifo::~Fifo()
+ {
+ for (int i = 0; i < nbuffer; ++i)
+ {
+ // p3.3.45
+ if(buffer[i]->buffer)
+ {
+ //printf("Fifo::~Fifo freeing buffer\n");
+ free(buffer[i]->buffer);
+ }
+
+ delete buffer[i];
+ }
+
+ delete[] buffer;
+ muse_atomic_destroy(&count);
+ }
+
+//---------------------------------------------------------
+// put
+// return true if fifo full
+//---------------------------------------------------------
+
+bool Fifo::put(int segs, unsigned long samples, float** src, unsigned pos)
+ {
+ // Added by Tim. p3.3.17
+ #ifdef FIFO_DEBUG
+ printf("FIFO::put segs:%d samples:%lu pos:%u\n", segs, samples, pos);
+ #endif
+
+ if (muse_atomic_read(&count) == nbuffer) {
+ printf("FIFO %p overrun... %d\n", this, count.counter);
+ return true;
+ }
+ FifoBuffer* b = buffer[widx];
+ int n = segs * samples;
+ if (b->maxSize < n) {
+ if (b->buffer)
+ {
+ // Changed by Tim. p3.3.15
+ //delete[] b->buffer;
+ free(b->buffer);
+ // p3.3.45
+ b->buffer = 0;
+ }
+ // Changed by Tim. p3.3.15
+ //b->buffer = new float[n];
+ posix_memalign((void**)&(b->buffer), 16, sizeof(float) * n);
+ // p3.3.45
+ if(!b->buffer)
+ {
+ printf("Fifo::put could not allocate buffer segs:%d samples:%lu pos:%u\n", segs, samples, pos);
+ return true;
+ }
+
+ b->maxSize = n;
+ }
+ // p3.3.45
+ if(!b->buffer)
+ {
+ printf("Fifo::put no buffer! segs:%d samples:%lu pos:%u\n", segs, samples, pos);
+ return true;
+ }
+
+ b->size = samples;
+ b->segs = segs;
+ b->pos = pos;
+ for (int i = 0; i < segs; ++i)
+ //memcpy(b->buffer + i * samples, src[i], samples * sizeof(float));
+ AL::dsp->cpy(b->buffer + i * samples, src[i], samples);
+ add();
+ return false;
+ }
+
+//---------------------------------------------------------
+// get
+// return true if fifo empty
+//---------------------------------------------------------
+
+bool Fifo::get(int segs, unsigned long samples, float** dst, unsigned* pos)
+ {
+ // Added by Tim. p3.3.17
+ #ifdef FIFO_DEBUG
+ printf("FIFO::get segs:%d samples:%lu\n", segs, samples);
+ #endif
+
+ if (muse_atomic_read(&count) == 0) {
+ printf("FIFO %p underrun... %d\n", this,count.counter); //by willyfoobar: added count to output //see Fifo::put()
+ return true;
+ }
+ FifoBuffer* b = buffer[ridx];
+ // p3.3.45
+ if(!b->buffer)
+ {
+ printf("Fifo::get no buffer! segs:%d samples:%lu b->pos:%u\n", segs, samples, b->pos);
+ return true;
+ }
+
+ if (pos)
+ *pos = b->pos;
+
+ for (int i = 0; i < segs; ++i)
+ dst[i] = b->buffer + samples * (i % b->segs);
+ remove();
+ return false;
+ }
+
+int Fifo::getCount()
+ {
+ return muse_atomic_read(&count);
+ }
+//---------------------------------------------------------
+// remove
+//---------------------------------------------------------
+
+void Fifo::remove()
+ {
+ ridx = (ridx + 1) % nbuffer;
+ muse_atomic_dec(&count);
+ }
+
+//---------------------------------------------------------
+// getWriteBuffer
+//---------------------------------------------------------
+
+bool Fifo::getWriteBuffer(int segs, unsigned long samples, float** buf, unsigned pos)
+ {
+ // Added by Tim. p3.3.17
+ #ifdef FIFO_DEBUG
+ printf("Fifo::getWriteBuffer segs:%d samples:%lu pos:%u\n", segs, samples, pos);
+ #endif
+
+ if (muse_atomic_read(&count) == nbuffer)
+ return true;
+ FifoBuffer* b = buffer[widx];
+ int n = segs * samples;
+ if (b->maxSize < n) {
+ if (b->buffer)
+ {
+ // Changed by Tim. p3.3.15
+ //delete[] b->buffer;
+ free(b->buffer);
+ // p3.3.45
+ b->buffer = 0;
+ }
+
+ // Changed by Tim. p3.3.15
+ //b->buffer = new float[n];
+ posix_memalign((void**)&(b->buffer), 16, sizeof(float) * n);
+ // p3.3.45
+ if(!b->buffer)
+ {
+ printf("Fifo::getWriteBuffer could not allocate buffer segs:%d samples:%lu pos:%u\n", segs, samples, pos);
+ return true;
+ }
+
+ b->maxSize = n;
+ }
+
+ // p3.3.45
+ if(!b->buffer)
+ {
+ printf("Fifo::getWriteBuffer no buffer! segs:%d samples:%lu pos:%u\n", segs, samples, pos);
+ return true;
+ }
+
+ for (int i = 0; i < segs; ++i)
+ buf[i] = b->buffer + i * samples;
+
+ b->size = samples;
+ b->segs = segs;
+ b->pos = pos;
+ return false;
+ }
+
+//---------------------------------------------------------
+// add
+//---------------------------------------------------------
+
+void Fifo::add()
+ {
+ widx = (widx + 1) % nbuffer;
+ muse_atomic_inc(&count);
+ }
+
+//---------------------------------------------------------
+// setChannels
+//---------------------------------------------------------
+
+void AudioTrack::setChannels(int n)
+ {
+ Track::setChannels(n);
+ if (_efxPipe)
+ _efxPipe->setChannels(n);
+ }
+
+//---------------------------------------------------------
+// setTotalOutChannels
+//---------------------------------------------------------
+
+void AudioTrack::setTotalOutChannels(int num)
+{
+ if(num == _totalOutChannels)
+ return;
+
+ int chans = _totalOutChannels;
+ // Number of allocated buffers is always MAX_CHANNELS or more, even if _totalOutChannels is less.
+ if(chans < MAX_CHANNELS)
+ chans = MAX_CHANNELS;
+ for(int i = 0; i < chans; ++i)
+ {
+ if(outBuffers[i])
+ free(outBuffers[i]);
+ }
+ delete[] outBuffers;
+
+ _totalOutChannels = num;
+ chans = num;
+ // Number of allocated buffers is always MAX_CHANNELS or more, even if _totalOutChannels is less.
+ if(chans < MAX_CHANNELS)
+ chans = MAX_CHANNELS;
+
+ outBuffers = new float*[chans];
+ for (int i = 0; i < chans; ++i)
+ posix_memalign((void**)&outBuffers[i], 16, sizeof(float) * segmentSize);
+
+ chans = num;
+ // Limit the actual track (meters, copying etc, all 'normal' operation) to two-channel stereo.
+ if(chans > MAX_CHANNELS)
+ chans = MAX_CHANNELS;
+
+ setChannels(chans);
+}
+
+//---------------------------------------------------------
+// setTotalInChannels
+//---------------------------------------------------------
+
+void AudioTrack::setTotalInChannels(int num)
+{
+ if(num == _totalInChannels)
+ return;
+
+ _totalInChannels = num;
+}
+
diff --git a/muse2/muse/node.h b/muse2/muse/node.h
new file mode 100644
index 00000000..eaeacfbd
--- /dev/null
+++ b/muse2/muse/node.h
@@ -0,0 +1,132 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: node.h,v 1.8.2.2 2006/04/13 19:09:48 spamatica Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __AUDIONODE_H__
+#define __AUDIONODE_H__
+
+#include <list>
+#include <qstring.h>
+
+#ifndef i386
+#include <pthread.h>
+typedef struct { pthread_mutex_t lock; int counter; } muse_atomic_t;
+#else
+typedef struct { int counter; } muse_atomic_t;
+#endif
+
+static inline int muse_atomic_read(muse_atomic_t *v) {
+#ifndef i386
+ int ret;
+ pthread_mutex_lock(&v->lock);
+ ret = v->counter;
+ pthread_mutex_unlock(&v->lock);
+ return ret;
+#else
+ return v->counter;
+#endif
+}
+
+static inline void muse_atomic_set(muse_atomic_t *v, int i) {
+#ifndef i386
+ pthread_mutex_lock(&v->lock);
+ v->counter = i;
+ pthread_mutex_unlock(&v->lock);
+#else
+ v->counter = i;
+#endif
+}
+static inline void muse_atomic_inc(muse_atomic_t *v) {
+#ifndef i386
+ pthread_mutex_lock(&v->lock);
+ v->counter++;
+ pthread_mutex_unlock(&v->lock);
+#else
+ __asm__ __volatile__(
+ "lock ; " "incl %0"
+ :"=m" (v->counter)
+ :"m" (v->counter));
+#endif
+}
+static inline void muse_atomic_dec(muse_atomic_t *v) {
+#ifndef i386
+ pthread_mutex_lock(&v->lock);
+ v->counter--;
+ pthread_mutex_unlock(&v->lock);
+#else
+ __asm__ __volatile__(
+ "lock ; " "decl %0"
+ :"=m" (v->counter)
+ :"m" (v->counter));
+#endif
+}
+#ifndef i386
+static inline void muse_atomic_init(muse_atomic_t *v) {
+ pthread_mutex_init(&v->lock, NULL);
+ }
+#else
+static inline void muse_atomic_init(muse_atomic_t*) {}
+#endif
+
+#ifndef i386
+static inline void muse_atomic_destroy(muse_atomic_t *v) {
+ pthread_mutex_destroy(&v->lock);
+ }
+#else
+static inline void muse_atomic_destroy(muse_atomic_t*) {}
+#endif
+
+class Xml;
+class Pipeline;
+class SndFile;
+
+// superceeded by dynamic allocation of fifoLength
+//const int FIFO_BUFFER = 4096;//64;
+
+//---------------------------------------------------------
+// Fifo
+//---------------------------------------------------------
+
+struct FifoBuffer {
+ float* buffer;
+ int size;
+ int maxSize;
+ unsigned pos;
+ int segs;
+
+ FifoBuffer() {
+ buffer = 0;
+ size = 0;
+ maxSize = 0;
+ }
+ };
+
+class Fifo {
+ int nbuffer;
+ int ridx; // read index; only touched by reader
+ int widx; // write index; only touched by writer
+ muse_atomic_t count; // buffer count; writer increments, reader decrements
+ FifoBuffer** buffer;
+
+ public:
+ Fifo();
+ ~Fifo();
+ void clear() {
+ ridx = 0;
+ widx = 0;
+ muse_atomic_set(&count, 0);
+ }
+ bool put(int, unsigned long, float** buffer, unsigned pos);
+ bool getWriteBuffer(int, unsigned long, float** buffer, unsigned pos);
+ void add();
+ bool get(int, unsigned long, float** buffer, unsigned* pos);
+ void remove();
+ int getCount();
+ };
+
+#endif
+
diff --git a/muse2/muse/osc.cpp b/muse2/muse/osc.cpp
new file mode 100644
index 00000000..74b703c3
--- /dev/null
+++ b/muse2/muse/osc.cpp
@@ -0,0 +1,1386 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// $Id: osc.cpp,v 1.0.0.0 2010/04/22 03:39:58 terminator356 Exp $
+//
+// Copyright (C) 1999-2010 by Werner Schweer and others
+// OSC module added by Tim.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//=============================================================================
+
+#include "config.h"
+
+#ifdef OSC_SUPPORT
+
+// Turn on debugging messages
+//#define OSC_DEBUG
+
+#include <string.h>
+//#include <signal.h>
+//#include <dlfcn.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <errno.h>
+//#include <dssi.h>
+//#include <alsa/asoundlib.h>
+//#include <qt.h>
+#include <qdir.h>
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qfileinfo.h>
+//#include <qpopupmenu.h>
+#include <q3process.h>
+#include <qtimer.h>
+#include <lo/lo.h>
+
+#ifdef DSSI_SUPPORT
+#include "dssihost.h"
+#endif
+
+#include "stringparam.h"
+#include "plugin.h"
+#include "track.h"
+#include "song.h"
+#include "synth.h"
+//#include "audio.h"
+//#include "jackaudio.h"
+//#include "midi.h"
+//#include "midiport.h"
+//#include "al/al.h"
+//#include "al/xml.h"
+//#include "xml.h"
+//#include "midictrl.h"
+//#include "ladspaplugin.h"
+
+#include "app.h"
+#include "globals.h"
+#include "globaldefs.h"
+//#include "al/dsp.h"
+
+static lo_server_thread serverThread = 0;
+///static char osc_path_tmp[1024];
+static char* url = 0;
+static bool oscServerRunning = false;
+
+//---------------------------------------------------------
+// oscError
+//---------------------------------------------------------
+
+static void oscError(int num, const char *msg, const char *path)
+ {
+ fprintf(stderr, "MusE: liblo server error %d in path %s: %s\n",
+ num, path, msg);
+ }
+
+//---------------------------------------------------------
+// oscDebugHandler
+//---------------------------------------------------------
+
+static int oscDebugHandler(const char* path, const char* types, lo_arg** argv,
+ int argc, void*, void*)
+ {
+ printf("MusE: got unhandled OSC message:\n path: <%s>\n", path);
+ for (int i = 0; i < argc; i++) {
+ printf(" arg %d '%c' ", i, types[i]);
+ lo_arg_pp(lo_type(types[i]), argv[i]);
+ printf("\n");
+ }
+ return 1;
+ }
+
+//---------------------------------------------------------
+// oscMessageHandler
+//---------------------------------------------------------
+
+int oscMessageHandler(const char* path, const char* types, lo_arg** argv,
+ int argc, void* data, void* user_data)
+{
+ const char* p = path;
+
+ #ifdef OSC_DEBUG
+ if(argc)
+ {
+ printf("oscMessageHandler: path:%s argc:%d\n", path, argc);
+ for(int i = 0; i < argc; ++i)
+ {
+ printf(" ");
+ lo_arg_pp((lo_type)types[i], argv[i]);
+ }
+ printf("\n");
+ }
+ else
+ {
+ printf("%s\n", path);
+ printf("oscMessageHandler: no args, path:%s\n", path);
+ }
+ #endif
+
+ bool isSynth = false;
+
+ #ifdef DSSI_SUPPORT
+ if(strncmp(p, "/dssi_synth/", 12) == 0)
+ {
+ isSynth = true;
+ p += 12;
+ }
+ else
+ #endif
+ if(strncmp(p, "/ladspa_efx/", 12) == 0)
+ {
+ p += 12;
+ }
+ else
+ return oscDebugHandler(path, types, argv, argc, data, user_data);
+
+ TrackList* tl = song->tracks();
+
+
+ #ifdef OSC_DEBUG
+ if(isSynth)
+ fprintf(stderr, "oscMessageHandler: got message for dssi synth...\n");
+ else
+ fprintf(stderr, "oscMessageHandler: got message for ladspa effect...\n");
+ #endif
+
+ // FIXME: Slowdowns: Shouldn't need these retries but they are needed, only upon creation of the synth.
+ // Need to fix the real source of the problem! The instance is taking too long to appear after creation.
+ //
+ ///for(int retry = 0; retry < 5000; ++retry)
+ {
+ ///#ifdef OSC_DEBUG
+ ///fprintf(stderr, "oscMessageHandler: search retry number:%d ...\n", retry);
+ ///#endif
+
+ //if(_uiOscPath)
+ // break;
+
+ #ifdef DSSI_SUPPORT
+ if(isSynth)
+ {
+ // Message is meant for a dssi synth. Check dssi synth instances...
+ SynthIList* sl = song->syntis();
+ for(iSynthI si = sl->begin(); si != sl->end(); ++si)
+ {
+ SynthI* synti = *si;
+
+ #ifdef OSC_DEBUG
+ fprintf(stderr, "oscMessageHandler: searching for:%s checking synth instance:%s\n", p, synti->name().latin1());
+ #endif
+
+ const char* sub = strstr(p, synti->name().latin1());
+ if(sub == NULL)
+ continue;
+
+ //DssiSynthIF* instance = (DssiSynthIF*)synti->sif();
+ DssiSynthIF* instance = dynamic_cast<DssiSynthIF*>(synti->sif());
+ if(!instance)
+ break;
+
+ p = sub + strlen(synti->name().latin1());
+
+ if (*p != '/' || *(p + 1) == 0)
+ {
+ fprintf(stderr, "oscMessageHandler error: synth: end of path or no /\n");
+ return oscDebugHandler(path, types, argv, argc, data, user_data);
+ }
+
+ ++p;
+
+ #ifdef OSC_DEBUG
+ fprintf(stderr, "oscMessageHandler: synth track:%s method:%s\n", synti->name().latin1(), p);
+ #endif
+
+ OscIF& oscif = instance->oscIF();
+
+ if (!strcmp(p, "configure") && argc == 2 && !strcmp(types, "ss"))
+ return oscif.oscConfigure(argv);
+ else if (!strcmp(p, "control") && argc == 2 && !strcmp(types, "if"))
+ return oscif.oscControl(argv);
+ else if (!strcmp(p, "midi") && argc == 1 && !strcmp(types, "m"))
+ return oscif.oscMidi(argv);
+ else if (!strcmp(p, "program") && argc == 2 && !strcmp(types, "ii"))
+ return oscif.oscProgram(argv);
+ else if (!strcmp(p, "update") && argc == 1 && !strcmp(types, "s"))
+ return oscif.oscUpdate(argv);
+ else if (!strcmp(p, "exiting") && argc == 0)
+ return oscif.oscExiting(argv);
+ return oscDebugHandler(path, types, argv, argc, data, user_data);
+ }
+ }
+ else
+ #endif //DSSI_SUPPORT
+ // Message is meant for a ladspa effect. Check all ladspa effect instances...
+ for(ciTrack it = tl->begin(); it != tl->end(); ++it)
+ {
+ if((*it)->isMidiTrack())
+ continue;
+
+ Pipeline* efxPipe = ((AudioTrack*)*it)->efxPipe();
+ if(efxPipe)
+ {
+ for(ciPluginI ip = efxPipe->begin(); ip != efxPipe->end(); ++ip)
+ {
+ PluginI* instance = *ip;
+ if(!instance)
+ continue;
+
+ #ifdef OSC_DEBUG
+ fprintf(stderr, "oscMessageHandler: searching for:%s checking effect instance:%s label:%s lib:%s\n",
+ p, instance->name().latin1(), instance->label().latin1(), instance->lib().latin1());
+ #endif
+
+ //const char* sub = strstr(p, instance->name().latin1());
+ const char* sub = strstr(p, instance->label().latin1());
+ if(sub == NULL)
+ continue;
+
+ Plugin* plugin = instance->plugin();
+ if(!plugin)
+ break;
+
+ //p = sub + strlen(instance->name().latin1());
+ p = sub + strlen(instance->label().latin1());
+
+ if (*p != '/' || *(p + 1) == 0)
+ {
+ fprintf(stderr, "oscMessageHandler: error: effect: end of path or no /\n");
+ return oscDebugHandler(path, types, argv, argc, data, user_data);
+ }
+
+ ++p;
+
+ #ifdef OSC_DEBUG
+ //fprintf(stderr, "oscMessageHandler: effect:%s method:%s\n", instance->name().latin1(), p);
+ fprintf(stderr, "oscMessageHandler: effect:%s method:%s\n", instance->label().latin1(), p);
+ #endif
+
+ OscIF& oscif = instance->oscIF();
+
+ if (!strcmp(p, "configure") && argc == 2 && !strcmp(types, "ss"))
+ return oscif.oscConfigure(argv);
+ else if (!strcmp(p, "control") && argc == 2 && !strcmp(types, "if"))
+ return oscif.oscControl(argv);
+ else if (!strcmp(p, "midi") && argc == 1 && !strcmp(types, "m"))
+ return oscif.oscMidi(argv);
+ else if (!strcmp(p, "program") && argc == 2 && !strcmp(types, "ii"))
+ return oscif.oscProgram(argv);
+ else if (!strcmp(p, "update") && argc == 1 && !strcmp(types, "s"))
+ return oscif.oscUpdate(argv);
+ else if (!strcmp(p, "exiting") && argc == 0)
+ return oscif.oscExiting(argv);
+ return oscDebugHandler(path, types, argv, argc, data, user_data);
+ }
+ }
+ }
+
+ ///usleep(1000);
+ }
+
+ fprintf(stderr, "oscMessageHandler: timeout error: no synth or effect instance found for given path\n");
+ return oscDebugHandler(path, types, argv, argc, data, user_data);
+}
+
+
+//---------------------------------------------------------
+// initOSC
+//---------------------------------------------------------
+
+void initOSC()
+{
+ if(url)
+ free(url);
+ url = 0;
+
+ // Create OSC thread
+ // Only if not created yet.
+ if(!serverThread)
+ {
+ serverThread = lo_server_thread_new(0, oscError);
+ if(!serverThread)
+ {
+ printf("initOSC() Failed to create OSC server!\n");
+ return;
+ }
+ }
+
+ ///snprintf(osc_path_tmp, 31, "/dssi");
+ // Test: Clear the temp path:
+ //snprintf(osc_path_tmp, 31, "");
+
+ ///char* tmp = lo_server_thread_get_url(serverThread);
+
+ url = lo_server_thread_get_url(serverThread);
+ if(!url)
+ {
+ lo_server_thread_free(serverThread);
+ printf("initOSC() Failed to get OSC server thread url !\n");
+ return;
+ }
+
+ ///url = (char *)malloc(strlen(tmp) + strlen(osc_path_tmp));
+ //url = (char *)malloc(strlen(tmp));
+
+ ///sprintf(url, "%s%s", tmp, osc_path_tmp + 1);
+ //sprintf(url, "%s", tmp, osc_path_tmp + 1);
+
+ ///free(tmp);
+
+ lo_method meth = 0;
+ meth = lo_server_thread_add_method(serverThread, 0, 0, oscMessageHandler, 0);
+ if(!meth)
+ {
+ printf("initOSC() Failed to add oscMessageHandler method to OSC server!\n");
+ // Does not return a value.
+ lo_server_thread_free(serverThread);
+ serverThread = 0;
+ free(url);
+ url = 0;
+ return;
+ }
+
+ // Does not return a value.
+ lo_server_thread_start(serverThread);
+}
+
+//---------------------------------------------------------
+// exitOSC
+//---------------------------------------------------------
+
+void exitOSC()
+{
+ oscServerRunning = false;
+ if(serverThread)
+ {
+ // Does not return a value.
+ lo_server_thread_stop(serverThread);
+ lo_server_thread_free(serverThread);
+ }
+ serverThread = 0;
+}
+
+//---------------------------------------------------------
+// startOSC
+//---------------------------------------------------------
+
+void startOSC()
+{
+ if(serverThread)
+ // Does not return a value.
+ lo_server_thread_start(serverThread);
+ oscServerRunning = true;
+}
+
+//---------------------------------------------------------
+// stopOSC
+//---------------------------------------------------------
+
+void stopOSC()
+{
+ if(serverThread)
+ // Does not return a value.
+ lo_server_thread_stop(serverThread);
+ oscServerRunning = false;
+}
+
+
+
+//---------------------------------------------------------
+// OscControlFifo
+// put
+// return true on fifo overflow
+//---------------------------------------------------------
+
+bool OscControlFifo::put(const OscControlValue& event)
+ {
+ if (size < OSC_FIFO_SIZE) {
+ fifo[wIndex] = event;
+ wIndex = (wIndex + 1) % OSC_FIFO_SIZE;
+ // q_atomic_increment(&size);
+ ++size;
+ return false;
+ }
+ return true;
+ }
+
+//---------------------------------------------------------
+// get
+//---------------------------------------------------------
+
+OscControlValue OscControlFifo::get()
+ {
+ OscControlValue event(fifo[rIndex]);
+ rIndex = (rIndex + 1) % OSC_FIFO_SIZE;
+ // q_atomic_decrement(&size);
+ --size;
+ return event;
+ }
+
+//---------------------------------------------------------
+// peek
+//---------------------------------------------------------
+
+const OscControlValue& OscControlFifo::peek(int n)
+ {
+ int idx = (rIndex + n) % OSC_FIFO_SIZE;
+ return fifo[idx];
+ }
+
+//---------------------------------------------------------
+// remove
+//---------------------------------------------------------
+
+void OscControlFifo::remove()
+ {
+ rIndex = (rIndex + 1) % OSC_FIFO_SIZE;
+ // q_atomic_decrement(&size);
+ --size;
+ }
+
+
+
+//---------------------------------------------------------
+// OscIF
+// Open Sound Control Interface
+//---------------------------------------------------------
+
+OscIF::OscIF()
+{
+ //_oscPluginI = 0;
+
+ //#ifdef DSSI_SUPPORT
+ //_oscSynthIF = 0;
+ //#endif
+
+ _uiOscTarget = 0;
+ _uiOscSampleRatePath = 0;
+ _uiOscShowPath = 0;
+ _uiOscControlPath = 0;
+ _uiOscConfigurePath = 0;
+ _uiOscProgramPath = 0;
+ _uiOscPath = 0;
+ //guiPid = -1;
+ _oscGuiQProc = 0;
+ _oscGuiVisible = false;
+
+ _oscControlFifos = 0;
+}
+
+OscIF::~OscIF()
+{
+ //if (guiPid != -1)
+ // kill(guiPid, SIGHUP);
+ if(_oscGuiQProc)
+ {
+ if(_oscGuiQProc->isRunning())
+ {
+ #ifdef OSC_DEBUG
+ printf("OscIF::~OscIF terminating _oscGuiQProc\n");
+ #endif
+
+ //_oscGuiQProc->kill();
+ // "This tries to terminate the process the nice way. If the process is still running after 5 seconds,
+ // it terminates the process the hard way. The timeout should be chosen depending on the time the
+ // process needs to do all its cleanup: use a higher value if the process is likely to do a lot of
+ // computation or I/O on cleanup."
+ _oscGuiQProc->tryTerminate();
+ QTimer::singleShot( 5000, _oscGuiQProc, SLOT( kill() ) );
+ }
+ //delete _oscGuiQProc;
+ }
+
+ if(_uiOscTarget)
+ lo_address_free(_uiOscTarget);
+ if(_uiOscSampleRatePath)
+ free(_uiOscSampleRatePath);
+ if(_uiOscShowPath)
+ free(_uiOscShowPath);
+ if(_uiOscControlPath)
+ free(_uiOscControlPath);
+ if(_uiOscConfigurePath)
+ free(_uiOscConfigurePath);
+ if(_uiOscProgramPath)
+ free(_uiOscProgramPath);
+ if(_uiOscPath)
+ free(_uiOscPath);
+
+ if(_oscControlFifos)
+ delete[] _oscControlFifos;
+}
+
+//---------------------------------------------------------
+// oscFifo
+//---------------------------------------------------------
+
+OscControlFifo* OscIF::oscFifo(unsigned long i) const
+{
+ if(!_oscControlFifos)
+ return 0;
+ return &_oscControlFifos[i];
+}
+
+//---------------------------------------------------------
+// oscUpdate
+//---------------------------------------------------------
+
+int OscIF::oscUpdate(lo_arg **argv)
+{
+ const char *purl = (char *)&argv[0]->s;
+
+ if(_uiOscTarget)
+ lo_address_free(_uiOscTarget);
+ _uiOscTarget = 0;
+ char* host = lo_url_get_hostname(purl);
+ char* port = lo_url_get_port(purl);
+ _uiOscTarget = lo_address_new(host, port);
+ free(host);
+ free(port);
+ if(!_uiOscTarget)
+ return 0;
+
+ if (_uiOscPath)
+ free(_uiOscPath);
+ _uiOscPath = lo_url_get_path(purl);
+ int pl = strlen(_uiOscPath);
+
+ if(_uiOscSampleRatePath)
+ free(_uiOscSampleRatePath);
+ _uiOscSampleRatePath = (char *)malloc(pl + 14);
+ sprintf(_uiOscSampleRatePath, "%s/sample-rate", _uiOscPath);
+
+ if (_uiOscControlPath)
+ free(_uiOscControlPath);
+ _uiOscControlPath = (char *)malloc(pl + 10);
+ sprintf(_uiOscControlPath, "%s/control", _uiOscPath);
+
+ if (_uiOscConfigurePath)
+ free(_uiOscConfigurePath);
+ _uiOscConfigurePath = (char *)malloc(pl + 12);
+ sprintf(_uiOscConfigurePath, "%s/configure", _uiOscPath);
+
+ if (_uiOscProgramPath)
+ free(_uiOscProgramPath);
+ _uiOscProgramPath = (char *)malloc(pl + 10);
+ sprintf(_uiOscProgramPath, "%s/program", _uiOscPath);
+
+ if (_uiOscShowPath)
+ free(_uiOscShowPath);
+ _uiOscShowPath = (char *)malloc(pl + 10);
+ sprintf(_uiOscShowPath, "%s/show", _uiOscPath);
+
+ /* At this point a more substantial host might also call
+ * configure() on the UI to set any state that it had remembered
+ * for the plugin instance. But we don't remember state for
+ * plugin instances (see our own configure() implementation in
+ * osc_configure_handler), and so we have nothing to send except
+ * the optional project directory.
+ */
+
+ #ifdef OSC_DEBUG
+ printf("OscIF::oscUpdate: _uiOscTarget:%p\n", _uiOscTarget);
+ if(url)
+ printf(" server url:%s\n", url);
+ else
+ printf(" no server url!\n");
+ printf(" update path:%s\n", purl);
+ printf(" _uiOscPath:%s\n", _uiOscPath);
+ printf(" _uiOscSampleRatePath:%s\n", _uiOscSampleRatePath);
+ printf(" _uiOscConfigurePath:%s\n", _uiOscConfigurePath);
+ printf(" _uiOscProgramPath:%s\n", _uiOscProgramPath);
+ printf(" _uiOscControlPath:%s\n",_uiOscControlPath);
+ printf(" _uiOscShowPath:%s\n", _uiOscShowPath);
+ printf(" museProject:%s\n", museProject.latin1());
+ #endif
+
+ // Send sample rate.
+ lo_send(_uiOscTarget, _uiOscSampleRatePath, "i", sampleRate);
+
+ // Send project directory.
+ //lo_send(_uiOscTarget, _uiOscConfigurePath, "ss",
+ // DSSI_PROJECT_DIRECTORY_KEY, museProject.latin1()); // song->projectPath()
+
+ // Done in sub-classes.
+ /*
+ #ifdef DSSI_SUPPORT
+ //lo_send(_uiOscTarget, _uiOscConfigurePath, "ss",
+ //DSSI_PROJECT_DIRECTORY_KEY, song->projectPath().toAscii().data());
+ lo_send(_uiOscTarget, _uiOscConfigurePath, "ss",
+ DSSI_PROJECT_DIRECTORY_KEY, museProject.latin1());
+
+ if(_oscSynthIF)
+ {
+ for(ciStringParamMap r = _oscSynthIF->synthI->_stringParamMap.begin(); r != synti->_stringParamMap.end(); ++r)
+ {
+ rv = 0;
+ rv = dssi->configure(handle, r->first.c_str(), r->second.c_str());
+ if(rv)
+ {
+ fprintf(stderr, "MusE: Warning: plugin config key: %s value: %s \"%s\"\n", r->first.c_str(), r->second.c_str(), rv);
+ free(rv);
+ }
+ }
+ }
+ #endif
+ */
+
+ /*
+ char uiOscGuiPath[strlen(_uiOscPath)+6];
+ sprintf(uiOscGuiPath, "%s/%s", _uiOscPath, "show");
+
+ #ifdef OSC_DEBUG
+ printf("OscIF::oscUpdate Sending show uiOscGuiPath:%s\n", uiOscGuiPath);
+ #endif
+
+ lo_send(_uiOscTarget, uiOscGuiPath, "");
+
+ sprintf(uiOscGuiPath, "%s/%s", _uiOscPath, "hide");
+
+ #ifdef OSC_DEBUG
+ printf("OscIF::oscUpdate Sending hide uiOscGuiPath:%s\n", uiOscGuiPath);
+ #endif
+
+ lo_send(_uiOscTarget, uiOscGuiPath, "");
+ */
+
+#if 0
+ /* Send current bank/program (-FIX- another race...) */
+ if (instance->pendingProgramChange < 0) {
+ unsigned long bank = instance->currentBank;
+ unsigned long program = instance->currentProgram;
+ instance->uiNeedsProgramUpdate = 0;
+ if (instance->uiTarget) {
+ lo_send(instance->uiTarget, instance->ui_osc_program_path, "ii", bank, program);
+ }
+ }
+
+ /* Send control ports */
+ for (i = 0; i < instance->plugin->controlIns; i++) {
+ int in = i + instance->firstControlIn;
+ int port = pluginControlInPortNumbers[in];
+ lo_send(instance->uiTarget, instance->ui_osc_control_path, "if", port,
+ pluginControlIns[in]);
+ /* Avoid overloading the GUI if there are lots and lots of ports */
+ if ((i+1) % 50 == 0)
+ usleep(300000);
+ }
+#endif
+ return 0;
+}
+
+//---------------------------------------------------------
+// oscExiting
+//---------------------------------------------------------
+
+int OscIF::oscExiting(lo_arg**)
+{
+ // The gui is gone now, right?
+ _oscGuiVisible = false;
+
+ if(_oscGuiQProc)
+ {
+ if(_oscGuiQProc->isRunning())
+ {
+ #ifdef OSC_DEBUG
+ printf("OscIF::oscExiting terminating _oscGuiQProc\n");
+ #endif
+
+ //_oscGuiQProc->kill();
+ // "This tries to terminate the process the nice way. If the process is still running after 5 seconds,
+ // it terminates the process the hard way. The timeout should be chosen depending on the time the
+ // process needs to do all its cleanup: use a higher value if the process is likely to do a lot of
+ // computation or I/O on cleanup."
+ _oscGuiQProc->tryTerminate();
+ QTimer::singleShot( 5000, _oscGuiQProc, SLOT( kill() ) );
+ }
+ //delete _oscGuiQProc;
+ }
+
+ if(_uiOscTarget)
+ lo_address_free(_uiOscTarget);
+ _uiOscTarget = 0;
+ if(_uiOscSampleRatePath)
+ free(_uiOscSampleRatePath);
+ _uiOscSampleRatePath = 0;
+ if(_uiOscShowPath)
+ free(_uiOscShowPath);
+ _uiOscShowPath = 0;
+ if(_uiOscControlPath)
+ free(_uiOscControlPath);
+ _uiOscControlPath = 0;
+ if(_uiOscConfigurePath)
+ free(_uiOscConfigurePath);
+ _uiOscConfigurePath = 0;
+ if(_uiOscProgramPath)
+ free(_uiOscProgramPath);
+ _uiOscProgramPath = 0;
+ if(_uiOscPath)
+ free(_uiOscPath);
+ _uiOscPath = 0;
+
+ //if(_oscControlFifos)
+ // delete[] _oscControlFifos;
+
+ //const DSSI_Descriptor* dssi = synth->dssi;
+ //const LADSPA_Descriptor* ld = dssi->LADSPA_Plugin;
+ //if(ld->deactivate)
+ // ld->deactivate(handle);
+
+ /*
+ if (_uiOscPath == 0) {
+ printf("OscIF::oscExiting(): no _uiOscPath\n");
+ return 1;
+ }
+ char uiOscGuiPath[strlen(_uiOscPath)+6];
+
+ sprintf(uiOscGuiPath, "%s/%s", _uiOscPath, "quit");
+ #ifdef OSC_DEBUG
+ printf("OscIF::oscExiting(): sending quit to uiOscGuiPath:%s\n", uiOscGuiPath);
+ #endif
+
+ lo_send(_uiOscTarget, uiOscGuiPath, "");
+ */
+
+#if 0
+ int i;
+
+ if (verbose) {
+ printf("MusE: OSC: got exiting notification for instance %d\n",
+ instance->number);
+ }
+
+ if (instance->plugin) {
+
+ /*!!! No, this isn't safe -- plugins deactivated in this way
+ would still be included in a run_multiple_synths call unless
+ we re-jigged the instance array at the same time -- leave it
+ for now
+ if (instance->plugin->descriptor->LADSPA_Plugin->deactivate) {
+ instance->plugin->descriptor->LADSPA_Plugin->deactivate
+ (instanceHandles[instance->number]);
+ }
+ */
+ /* Leave this flag though, as we need it to determine when to exit */
+ instance->inactive = 1;
+ }
+
+ /* Do we have any plugins left running? */
+
+ for (i = 0; i < instance_count; ++i) {
+ if (!instances[i].inactive)
+ return 0;
+ }
+
+ if (verbose) {
+ printf("MusE: That was the last remaining plugin, exiting...\n");
+ }
+ exiting = 1;
+#endif
+ return 0;
+}
+
+//---------------------------------------------------------
+// oscSendProgram
+//---------------------------------------------------------
+
+void OscIF::oscSendProgram(unsigned long prog, unsigned long bank)
+{
+ if(_uiOscTarget && _uiOscProgramPath)
+ lo_send(_uiOscTarget, _uiOscProgramPath, "ii", bank, prog);
+}
+
+//---------------------------------------------------------
+// oscSendControl
+//---------------------------------------------------------
+
+void OscIF::oscSendControl(unsigned long dssiPort, float v)
+{
+ if(_uiOscTarget && _uiOscControlPath)
+ lo_send(_uiOscTarget, _uiOscControlPath, "if", dssiPort, v);
+}
+
+//---------------------------------------------------------
+// oscSendConfigure
+//---------------------------------------------------------
+
+void OscIF::oscSendConfigure(const char *key, const char *val)
+{
+ if(_uiOscTarget && _uiOscConfigurePath)
+ lo_send(_uiOscTarget, _uiOscConfigurePath, "ss", key, val);
+}
+
+//---------------------------------------------------------
+// oscInitGui
+//---------------------------------------------------------
+
+//bool OscIF::oscInitGui()
+bool OscIF::oscInitGui(const QString& typ, const QString& baseName, const QString& name,
+ const QString& label, const QString& filePath, const QString& dirPath)
+{
+ // Are we already running? We don't want to allow another process do we...
+ if((_oscGuiQProc != 0) && (_oscGuiQProc->isRunning()))
+ return true;
+
+ if(!url)
+ {
+ fprintf(stderr, "OscIF::oscInitGui no server url!\n");
+ return false;
+ }
+
+ //
+ // start gui
+ //
+ //static char oscUrl[1024];
+ //char oscUrl[1024];
+ QString oscUrl;
+
+ /*
+ QString typ;
+ QString baseName;
+ QString name;
+ QString label;
+ QString filePath;
+ QString dirPath;
+ #ifdef DSSI_SUPPORT
+ if(_oscSynthIF)
+ {
+ //snprintf(oscUrl, 1024, "%s/%s", url, synti->name().toAscii().data());
+ //snprintf(oscUrl, 1024, "%s/%s", url, synti->name().ascii());
+ //snprintf(oscUrl, 1024, "%s/%s/%s", url, synth->info.baseName().ascii(), synti->name().ascii());
+ typ = QT_TR_NOOP("dssi_synth");
+ baseName = _oscSynthIF->dssiSynth()->baseName(false);
+ label = _oscSynthIF->dssiSynthI()->name();
+ name = _oscSynthIF->dssiSynth()->name();
+
+ dirPath = _oscSynthIF->dssiSynth()->dirPath(false);
+ filePath = _oscSynthIF->dssiSynth()->filePath();
+ }
+ else
+ #endif
+ if(_oscPluginI)
+ {
+ typ = QT_TR_NOOP("ladspa_efx");
+ baseName = _oscPluginI->plugin()->lib(false);
+ //name = _oscPluginI->name();
+ name = _oscPluginI->plugin()->label();
+ label = _oscPluginI->label();
+
+ dirPath = _oscPluginI->plugin()->dirPath(false);
+ //dirPath.replace("ladspa", "dssi", true);
+
+ filePath = _oscPluginI->plugin()->filePath();
+ //filePath.replace("ladspa", "dssi", true);
+ }
+ else
+ return false;
+ */
+
+ //snprintf(oscUrl, 1024, "%s/%s/%s", url, baseName.ascii(), name.ascii());
+ //snprintf(oscUrl, 1024, "%s%s/%s/%s", url, typ.latin1(), baseName.latin1(), name.latin1());
+ //oscUrl = QString("%1%2/%3/%4").arg(QString(QT_TR_NOOP(url))).arg(typ).arg(baseName).arg(name);
+ oscUrl = QString("%1%2/%3/%4").arg(QString(QT_TR_NOOP(url))).arg(typ).arg(baseName).arg(label);
+
+ //QString guiPath(info.path() + "/" + info.baseName());
+ //QString guiPath(synth->info.dirPath() + "/" + synth->info.baseName());
+ QString guiPath(dirPath + "/" + baseName);
+
+ #ifdef OSC_DEBUG
+ fprintf(stderr, "OscIF::oscInitGui guiPath:%s\n", guiPath.latin1());
+ #endif
+
+ QDir guiDir(guiPath, "*", QDir::Unsorted, QDir::Files);
+ if (guiDir.exists())
+ {
+ //const QFileInfoList list = guiDir.entryInfoList();
+ QStringList list = guiDir.entryList();
+
+ //for (int i = 0; i < list.size(); ++i) {
+ for (unsigned int i = 0; i < list.count(); ++i)
+ {
+
+ //QFileInfo fi = list.at(i);
+ QFileInfo fi(guiPath + QString("/") + list[i]);
+
+ QString gui(fi.filePath());
+ if (gui.contains('_') == 0)
+ continue;
+ struct stat buf;
+
+ //if (stat(gui.toAscii().data(), &buf)) {
+ if (stat(gui.latin1(), &buf)) {
+
+ perror("stat failed");
+ continue;
+ }
+
+ #ifdef OSC_DEBUG
+ fprintf(stderr, "OscIF::oscInitGui %s %s %s %s\n",
+ //fi.filePath().toAscii().data(),
+ //fi.fileName().toAscii().data(),
+ fi.filePath().latin1(),
+ //fi.fileName().ascii(),
+
+ oscUrl.latin1(),
+
+ //synth->info.filePath().ascii(),
+ filePath.latin1(),
+
+ //name().toAscii().data(),
+ //synth->name().ascii());
+ name.latin1());
+ #endif
+
+ if ((S_ISREG(buf.st_mode) || S_ISLNK(buf.st_mode)) &&
+ (buf.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+ {
+ // Changed by T356.
+ // fork + execlp were causing the processes to remain after closing gui, requiring manual kill.
+ // Changed to QProcess, works OK now.
+ //if((guiPid = fork()) == 0)
+ {
+ // No QProcess created yet? Do it now. Only once per SynthIF instance. Exists until parent destroyed.
+ if(_oscGuiQProc == 0)
+ _oscGuiQProc = new Q3Process(muse);
+
+ // Don't forget this, he he...
+ _oscGuiQProc->clearArguments();
+
+ _oscGuiQProc->addArgument(fi.filePath());
+ //_oscGuiQProc->addArgument(fi.fileName()); // No conventional 'Arg0' here.
+ //_oscGuiQProc->addArgument(QString(oscUrl));
+ _oscGuiQProc->addArgument(oscUrl);
+ //_oscGuiQProc->addArgument(synth->info.filePath());
+ _oscGuiQProc->addArgument(filePath);
+ //_oscGuiQProc->addArgument(synth->name());
+ _oscGuiQProc->addArgument(name);
+ _oscGuiQProc->addArgument(QString("channel-1"));
+
+ #ifdef OSC_DEBUG
+ fprintf(stderr, "OscIF::oscInitGui starting QProcess\n");
+ #endif
+
+ if(_oscGuiQProc->start() == TRUE)
+ {
+ #ifdef OSC_DEBUG
+ fprintf(stderr, "OscIF::oscInitGui started QProcess\n");
+ #endif
+
+ //guiPid = _oscGuiQProc->processIdentifier();
+ }
+ else
+ {
+
+ /*
+ execlp(
+ //fi.filePath().toAscii().data(),
+ //fi.fileName().toAscii().data(),
+ fi.filePath().ascii(),
+ fi.fileName().ascii(),
+
+ oscUrl,
+
+ //info.filePath().toAscii().data(),
+ //name().toAscii().data(),
+ synth->info.filePath().ascii(),
+ synth->name().ascii(),
+
+ "channel 1", (void*)0);
+ */
+
+ fprintf(stderr, "exec %s %s %s %s failed: %s\n",
+ //fi.filePath().toAscii().data(),
+ //fi.fileName().toAscii().data(),
+ fi.filePath().latin1(),
+ fi.fileName().latin1(),
+
+ oscUrl.latin1(),
+
+ //name().toAscii().data(),
+ //synth->name().ascii(),
+ name.latin1(),
+
+ strerror(errno));
+
+ // It's Ok, Keep going. So nothing happens. So what. The timeout in showGui will just leave.
+ // Maybe it's a 'busy' issue somewhere - allow to try again later + save work now.
+ //exit(1);
+
+ }
+
+ #ifdef OSC_DEBUG
+ fprintf(stderr, "OscIF::oscInitGui after QProcess\n");
+ #endif
+ }
+ }
+ }
+ //synth->_hasGui = true;
+ }
+ else {
+ printf("OscIF::oscInitGui %s: no dir for gui found: %s\n",
+ //name().toAscii().data(), guiPath.toAscii().data());
+ //synth->name().ascii(), guiPath.ascii());
+ name.latin1(), guiPath.latin1());
+
+ //synth->_hasGui = false;
+ }
+
+ return true;
+}
+
+
+//---------------------------------------------------------
+// oscShowGui
+//---------------------------------------------------------
+
+void OscIF::oscShowGui(bool v)
+{
+ #ifdef OSC_DEBUG
+ printf("OscIF::oscShowGui(): v:%d visible:%d\n", v, oscGuiVisible());
+ #endif
+
+ if (v == oscGuiVisible())
+ return;
+
+ //if(guiPid == -1)
+ if((_oscGuiQProc == 0) || (!_oscGuiQProc->isRunning()))
+ {
+ // We need an indicator that update was called - update must have been called to get new path etc...
+ // If the process is not running this path is invalid, right?
+ if(_uiOscPath)
+ free(_uiOscPath);
+ _uiOscPath = 0;
+
+ #ifdef OSC_DEBUG
+ printf("OscIF::oscShowGui(): No QProcess or process not running. Starting gui...\n");
+ #endif
+
+ if(!oscInitGui())
+ {
+ printf("OscIF::oscShowGui(): failed to initialize gui on oscInitGui()\n");
+ return;
+ }
+ }
+
+ //for (int i = 0; i < 5; ++i) {
+ for (int i = 0; i < 10; ++i) { // Give it a wee bit more time?
+ if (_uiOscPath)
+ break;
+ sleep(1);
+ }
+ if (_uiOscPath == 0) {
+ printf("OscIF::oscShowGui(): no _uiOscPath. Error: Timeout - synth gui did not start within 10 seconds.\n");
+ return;
+ }
+
+ char uiOscGuiPath[strlen(_uiOscPath)+6];
+ sprintf(uiOscGuiPath, "%s/%s", _uiOscPath, v ? "show" : "hide");
+
+ #ifdef OSC_DEBUG
+ printf("OscIF::oscShowGui(): Sending show/hide uiOscGuiPath:%s\n", uiOscGuiPath);
+ #endif
+
+ lo_send(_uiOscTarget, uiOscGuiPath, "");
+ _oscGuiVisible = v;
+}
+
+//---------------------------------------------------------
+// oscGuiVisible
+//---------------------------------------------------------
+
+bool OscIF::oscGuiVisible() const
+{
+ return _oscGuiVisible;
+}
+
+#ifdef DSSI_SUPPORT
+
+//---------------------------------------------------------
+// OscDssiIF::
+// oscSetSynthIF
+//---------------------------------------------------------
+
+//void OscIF::oscSetSynthIF(DssiSynthIF* s)
+void OscDssiIF::oscSetSynthIF(DssiSynthIF* s)
+{
+ _oscSynthIF = s;
+ if(_oscControlFifos)
+ delete[] _oscControlFifos;
+ _oscControlFifos = 0;
+
+ if(_oscSynthIF && _oscSynthIF->dssiSynth())
+ {
+ unsigned long ports = _oscSynthIF->dssiSynth()->inControls();
+ _oscControlFifos = new OscControlFifo[ports];
+ }
+}
+
+//---------------------------------------------------------
+// oscUpdate
+//---------------------------------------------------------
+
+int OscDssiIF::oscUpdate(lo_arg **argv)
+{
+ // Make sure to call base method.
+ OscIF::oscUpdate(argv);
+
+ // Send sample rate. No, done in base class.
+ //lo_send(_uiOscTarget, _uiOscSampleRatePath, "i", sampleRate);
+
+ // Send project directory. No, done in DssiSynthIF.
+ //lo_send(_uiOscTarget, _uiOscConfigurePath, "ss",
+ // DSSI_PROJECT_DIRECTORY_KEY, museProject.latin1()); // song->projectPath()
+
+ if(_oscSynthIF)
+ _oscSynthIF->oscUpdate();
+
+ /*
+ if(_oscSynthIF)
+ {
+ // Send current string configuration parameters.
+ StringParamMap& map = _oscSynthIF->dssiSynthI()->stringParameters();
+ int i = 0;
+ for(ciStringParamMap r = map.begin(); r != map.end(); ++r)
+ {
+ lo_send(_uiOscTarget, _uiOscConfigurePath, "ss", r->first.c_str(), r->second.c_str());
+ // Avoid overloading the GUI if there are lots and lots of params.
+ if((i+1) % 50 == 0)
+ usleep(300000);
+ ++i;
+ }
+
+ // Send current bank and program.
+ unsigned long bank, prog;
+ _oscSynthIF->dssiSynthI()->currentProg(&prog, &bank, 0);
+ lo_send(_uiOscTarget, _uiOscProgramPath, "ii", bank, prog);
+
+ // Send current control values.
+ unsigned long ports = _oscSynthIF->dssiSynth()->inControls();
+ for(unsigned long i = 0; i < ports; ++i)
+ {
+ unsigned long k = _oscSynthIF->dssiSynth()->inControlPortIdx(i);
+ lo_send(_uiOscTarget, _uiOscControlPath, "if", k, _oscSynthIF->getParameter(i));
+ // Avoid overloading the GUI if there are lots and lots of ports.
+ if((i+1) % 50 == 0)
+ usleep(300000);
+ }
+ }
+ */
+
+ /*
+ char uiOscGuiPath[strlen(_uiOscPath)+6];
+ sprintf(uiOscGuiPath, "%s/%s", _uiOscPath, "show");
+
+ #ifdef OSC_DEBUG
+ printf("OscIF::oscUpdate Sending show uiOscGuiPath:%s\n", uiOscGuiPath);
+ #endif
+
+ lo_send(_uiOscTarget, uiOscGuiPath, "");
+
+ sprintf(uiOscGuiPath, "%s/%s", _uiOscPath, "hide");
+
+ #ifdef OSC_DEBUG
+ printf("OscIF::oscUpdate Sending hide uiOscGuiPath:%s\n", uiOscGuiPath);
+ #endif
+
+ lo_send(_uiOscTarget, uiOscGuiPath, "");
+ */
+
+#if 0
+ /* Send current bank/program (-FIX- another race...) */
+ if (instance->pendingProgramChange < 0) {
+ unsigned long bank = instance->currentBank;
+ unsigned long program = instance->currentProgram;
+ instance->uiNeedsProgramUpdate = 0;
+ if (instance->uiTarget) {
+ lo_send(instance->uiTarget, instance->ui_osc_program_path, "ii", bank, program);
+ }
+ }
+
+ /* Send control ports */
+ for (i = 0; i < instance->plugin->controlIns; i++) {
+ int in = i + instance->firstControlIn;
+ int port = pluginControlInPortNumbers[in];
+ lo_send(instance->uiTarget, instance->ui_osc_control_path, "if", port,
+ pluginControlIns[in]);
+ /* Avoid overloading the GUI if there are lots and lots of ports */
+ if ((i+1) % 50 == 0)
+ usleep(300000);
+ }
+#endif
+ return 0;
+}
+
+
+//---------------------------------------------------------
+// oscConfigure
+//---------------------------------------------------------
+
+int OscDssiIF::oscConfigure(lo_arg** argv)
+{
+ //OscIF::oscConfigure(argv);
+
+ if(_oscSynthIF)
+ _oscSynthIF->oscConfigure((const char*)&argv[0]->s, (const char*)&argv[1]->s);
+ return 0;
+}
+
+//---------------------------------------------------------
+// oscMidi
+//---------------------------------------------------------
+
+int OscDssiIF::oscMidi(lo_arg** argv)
+{
+ //OscIF::oscMidi(argv);
+
+ if(_oscSynthIF)
+ _oscSynthIF->oscMidi(argv[0]->m[1], argv[0]->m[2], argv[0]->m[3]);
+
+ return 0;
+}
+
+//---------------------------------------------------------
+// oscProgram
+//---------------------------------------------------------
+
+int OscDssiIF::oscProgram(lo_arg** argv)
+{
+ //OscIF::oscProgram(argv);
+
+ if(_oscSynthIF)
+ _oscSynthIF->oscProgram(argv[1]->i, argv[0]->i);
+
+ return 0;
+}
+
+//---------------------------------------------------------
+// oscControl
+//---------------------------------------------------------
+
+int OscDssiIF::oscControl(lo_arg** argv)
+{
+ //OscIF::oscControl(argv);
+
+ int port = argv[0]->i;
+ if(port < 0)
+ return 0;
+
+ if(_oscSynthIF)
+ _oscSynthIF->oscControl(argv[0]->i, argv[1]->f);
+
+ return 0;
+}
+
+//---------------------------------------------------------
+// oscInitGui
+//---------------------------------------------------------
+bool OscDssiIF::oscInitGui()
+{
+ if(!_oscSynthIF)
+ return false;
+
+ return OscIF::oscInitGui(QT_TR_NOOP("dssi_synth"), _oscSynthIF->dssiSynth()->baseName(false),
+ _oscSynthIF->dssiSynth()->name(), _oscSynthIF->dssiSynthI()->name(),
+ _oscSynthIF->dssiSynth()->filePath(), _oscSynthIF->dssiSynth()->dirPath(false));
+}
+
+#endif // DSSI_SUPPORT
+
+
+//---------------------------------------------------------
+// OscEffectIF::
+// oscSetPluginI
+//---------------------------------------------------------
+
+void OscEffectIF::oscSetPluginI(PluginI* s)
+{
+ _oscPluginI = s;
+ if(_oscControlFifos)
+ delete[] _oscControlFifos;
+ _oscControlFifos = 0;
+
+ if(_oscPluginI && _oscPluginI->plugin())
+ {
+ unsigned long ports = _oscPluginI->plugin()->controlInPorts();
+ _oscControlFifos = new OscControlFifo[ports];
+ }
+}
+
+//---------------------------------------------------------
+// oscUpdate
+//---------------------------------------------------------
+
+int OscEffectIF::oscUpdate(lo_arg** argv)
+{
+ // Make sure to call base method.
+ OscIF::oscUpdate(argv);
+
+ // Send project directory. No, done in PluginI.
+ //lo_send(_uiOscTarget, _uiOscConfigurePath, "ss",
+ // DSSI_PROJECT_DIRECTORY_KEY, museProject.latin1()); // song->projectPath()
+
+ if(_oscPluginI)
+ _oscPluginI->oscUpdate();
+
+ return 0;
+}
+
+//---------------------------------------------------------
+// oscConfigure
+//---------------------------------------------------------
+
+int OscEffectIF::oscConfigure(lo_arg** argv)
+{
+ //OscIF::oscConfigure(argv);
+
+ if(_oscPluginI)
+ _oscPluginI->oscConfigure((const char*)&argv[0]->s, (const char*)&argv[1]->s);
+
+ return 0;
+}
+
+//---------------------------------------------------------
+// oscControl
+//---------------------------------------------------------
+
+int OscEffectIF::oscControl(lo_arg** argv)
+{
+ //OscIF::oscControl(argv);
+
+ int port = argv[0]->i;
+ if(port < 0)
+ return 0;
+
+ if(_oscPluginI)
+ _oscPluginI->oscControl(argv[0]->i, argv[1]->f);
+
+ return 0;
+}
+
+//---------------------------------------------------------
+// oscInitGui
+//---------------------------------------------------------
+bool OscEffectIF::oscInitGui()
+{
+ if(!_oscPluginI)
+ return false;
+
+ return OscIF::oscInitGui(QT_TR_NOOP("ladspa_efx"), _oscPluginI->plugin()->lib(false),
+ _oscPluginI->plugin()->label(), _oscPluginI->label(),
+ _oscPluginI->plugin()->filePath(), _oscPluginI->plugin()->dirPath(false));
+}
+
+
+#else //OSC_SUPPORT
+void initOSC() {}
+void exitOSC() {}
+
+#endif
diff --git a/muse2/muse/osc.h b/muse2/muse/osc.h
new file mode 100644
index 00000000..dbd8294a
--- /dev/null
+++ b/muse2/muse/osc.h
@@ -0,0 +1,212 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// $Id: osc.h,v 1.0.0.0 2010/04/22 10:05:00 terminator356 Exp $
+//
+// Copyright (C) 1999-2010 by Werner Schweer and others
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//=============================================================================
+
+#ifndef __OSC_H__
+#define __OSC_H__
+
+#include <lo/lo.h>
+
+#include "config.h"
+
+#ifdef DSSI_SUPPORT
+class DssiSynthIF;
+#endif
+
+class Q3Process;
+class PluginI;
+class OscIF;
+
+// Keep the OSC fifo small. There may be thousands of controls, and each control needs a fifo.
+// Oops, no, if the user keeps adjusting a slider without releasing the mouse button, then all of the
+// events are sent at once upon releasing the button, meaning there might be thousands of events at once.
+#define OSC_FIFO_SIZE 512
+
+//---------------------------------------------------------
+// OscControlValue
+// Item struct for OscGuiControlFifo.
+//---------------------------------------------------------
+
+struct OscControlValue
+{
+ //int idx;
+ float value;
+ // maybe timestamp, too ?
+};
+
+//---------------------------------------------------------
+// OscControlFifo
+// A fifo for each of the OSC controls.
+//---------------------------------------------------------
+
+class OscControlFifo
+{
+ OscControlValue fifo[OSC_FIFO_SIZE];
+ volatile int size;
+ int wIndex;
+ int rIndex;
+
+ public:
+ OscControlFifo() { clear(); }
+ bool put(const OscControlValue& event); // returns true on fifo overflow
+ OscControlValue get();
+ const OscControlValue& peek(int n = 0);
+ void remove();
+ bool isEmpty() const { return size == 0; }
+ void clear() { size = 0, wIndex = 0, rIndex = 0; }
+ int getSize() const { return size; }
+};
+
+//---------------------------------------------------------
+// OscIF
+// Open Sound Control Interface
+//---------------------------------------------------------
+
+/*
+class OscIF
+{
+ private:
+ PluginI* _oscPluginI;
+
+ #ifdef DSSI_SUPPORT
+ DssiSynthIF* _oscSynthIF;
+ #endif
+
+ QProcess* _oscGuiQProc;
+ void* _uiOscTarget;
+ char* _uiOscShowPath;
+ char* _uiOscControlPath;
+ char* _uiOscConfigurePath;
+ char* _uiOscProgramPath;
+ char* _uiOscPath;
+ bool _oscGuiVisible;
+
+ OscControlFifo* _oscControlFifos;
+
+ public:
+ OscIF();
+ ~OscIF();
+
+ void oscSetPluginI(PluginI*);
+
+ #ifdef DSSI_SUPPORT
+ void oscSetSynthIF(DssiSynthIF*);
+ #endif
+
+ int oscUpdate(lo_arg**);
+ int oscProgram(lo_arg**);
+ int oscControl(lo_arg**);
+ int oscExiting(lo_arg**);
+ int oscMidi(lo_arg**);
+ int oscConfigure(lo_arg**);
+
+ bool oscInitGui();
+ void oscShowGui(bool);
+ bool oscGuiVisible() const;
+ OscControlFifo* oscFifo(unsigned long) const;
+};
+*/
+
+class OscIF
+{
+ protected:
+ Q3Process* _oscGuiQProc;
+ void* _uiOscTarget;
+ char* _uiOscPath;
+ char* _uiOscSampleRatePath;
+ char* _uiOscConfigurePath;
+ char* _uiOscProgramPath;
+ char* _uiOscControlPath;
+ char* _uiOscShowPath;
+ bool _oscGuiVisible;
+
+ OscControlFifo* _oscControlFifos;
+
+ virtual bool oscInitGui(const QString& /*typ*/, const QString& /*baseName*/, const QString& /*name*/,
+ const QString& /*label*/, const QString& /*filePath*/, const QString& /*dirPath*/);
+
+ public:
+ OscIF();
+ virtual ~OscIF();
+
+ OscControlFifo* oscFifo(unsigned long) const;
+
+ virtual int oscUpdate(lo_arg**);
+ virtual int oscProgram(lo_arg**) { return 0; }
+ virtual int oscControl(lo_arg**) { return 0; }
+ virtual int oscExiting(lo_arg**);
+ virtual int oscMidi(lo_arg**) { return 0; }
+ virtual int oscConfigure(lo_arg**) { return 0; }
+
+ virtual void oscSendProgram(unsigned long /*prog*/, unsigned long /*bank*/);
+ virtual void oscSendControl(unsigned long /*dssiPort*/, float /*val*/);
+ virtual void oscSendConfigure(const char */*key*/, const char */*val*/);
+
+ virtual bool oscInitGui() { return false; }
+ virtual void oscShowGui(bool);
+ virtual bool oscGuiVisible() const;
+};
+
+class OscEffectIF : public OscIF
+{
+ protected:
+ PluginI* _oscPluginI;
+
+ public:
+ OscEffectIF() {}
+ //~OscEffectIF();
+
+ void oscSetPluginI(PluginI*);
+
+ virtual int oscUpdate(lo_arg**);
+ //virtual int oscProgram(lo_arg**);
+ virtual int oscControl(lo_arg**);
+ //virtual int oscExiting(lo_arg**);
+ //virtual int oscMidi(lo_arg**);
+ virtual int oscConfigure(lo_arg**);
+
+ virtual bool oscInitGui();
+};
+
+#ifdef DSSI_SUPPORT
+class OscDssiIF : public OscIF
+{
+ protected:
+ DssiSynthIF* _oscSynthIF;
+
+ public:
+ OscDssiIF() {}
+ //~OscDssiIF();
+
+ void oscSetSynthIF(DssiSynthIF*);
+
+ virtual int oscUpdate(lo_arg**);
+ virtual int oscProgram(lo_arg**);
+ virtual int oscControl(lo_arg**);
+ //virtual int oscExiting(lo_arg**);
+ virtual int oscMidi(lo_arg**);
+ virtual int oscConfigure(lo_arg**);
+
+ virtual bool oscInitGui();
+};
+#endif // DSSI_SUPPORT
+
+extern void initOSC();
+
+#endif
diff --git a/muse2/muse/part.cpp b/muse2/muse/part.cpp
new file mode 100644
index 00000000..250cf3ea
--- /dev/null
+++ b/muse2/muse/part.cpp
@@ -0,0 +1,1432 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: part.cpp,v 1.12.2.17 2009/06/25 05:13:02 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <assert.h>
+#include <cmath>
+
+#include "song.h"
+#include "part.h"
+#include "track.h"
+#include "globals.h"
+#include "event.h"
+#include "audio.h"
+#include "wave.h"
+#include "midiport.h"
+#include "drummap.h"
+
+int Part::snGen;
+
+//---------------------------------------------------------
+// unchainClone
+//---------------------------------------------------------
+
+void unchainClone(Part* p)
+{
+ chainCheckErr(p);
+
+ // Unchain the part.
+ p->prevClone()->setNextClone(p->nextClone());
+ p->nextClone()->setPrevClone(p->prevClone());
+
+ // Isolate the part.
+ p->setPrevClone(p);
+ p->setNextClone(p);
+}
+
+//---------------------------------------------------------
+// chainClone
+// The quick way - if part to chain to is known...
+//---------------------------------------------------------
+
+void chainClone(Part* p1, Part* p2)
+{
+ chainCheckErr(p1);
+
+ // Make sure the part to be chained is unchained first.
+ p2->prevClone()->setNextClone(p2->nextClone());
+ p2->nextClone()->setPrevClone(p2->prevClone());
+
+ // Link the part to be chained.
+ p2->setPrevClone(p1);
+ p2->setNextClone(p1->nextClone());
+
+ // Re-link the existing part.
+ p1->nextClone()->setPrevClone(p2);
+ p1->setNextClone(p2);
+}
+
+//---------------------------------------------------------
+// chainCloneInternal
+// No error check, so it can be called by replaceClone()
+//---------------------------------------------------------
+
+void chainCloneInternal(Part* p)
+{
+ Track* t = p->track();
+ Part* p1 = 0;
+
+ // Look for a part with the same event list, that we can chain to.
+ // It's faster if track type is known...
+
+ if(!t || (t && t->isMidiTrack()))
+ {
+ MidiTrack* mt = 0;
+ MidiTrackList* mtl = song->midis();
+ for(ciMidiTrack imt = mtl->begin(); imt != mtl->end(); ++imt)
+ {
+ mt = *imt;
+ const PartList* pl = mt->cparts();
+ for(ciPart ip = pl->begin(); ip != pl->end(); ++ip)
+ {
+ // Added by Tim. p3.3.6
+ //printf("chainCloneInternal track %p %s part %p %s evlist %p\n", (*imt), (*imt)->name().latin1(), ip->second, ip->second->name().latin1(), ip->second->cevents());
+
+ if(ip->second != p && ip->second->cevents() == p->cevents())
+ {
+ p1 = ip->second;
+ break;
+ }
+ }
+ // If a suitable part was found on a different track, we're done. We will chain to it.
+ // Otherwise keep looking for parts on another track. If no others found, then we
+ // chain to any suitable part which was found on the same given track t.
+ if(p1 && mt != t)
+ break;
+ }
+ }
+ if((!p1 && !t) || (t && t->type() == Track::WAVE))
+ {
+ WaveTrack* wt = 0;
+ WaveTrackList* wtl = song->waves();
+ for(ciWaveTrack iwt = wtl->begin(); iwt != wtl->end(); ++iwt)
+ {
+ wt = *iwt;
+ const PartList* pl = wt->cparts();
+ for(ciPart ip = pl->begin(); ip != pl->end(); ++ip)
+ {
+ if(ip->second != p && ip->second->cevents() == p->cevents())
+ {
+ p1 = ip->second;
+ break;
+ }
+ }
+ if(p1 && wt != t)
+ break;
+ }
+ }
+
+ // No part found with same event list? Done.
+ if(!p1)
+ return;
+
+ // Make sure the part to be chained is unchained first.
+ p->prevClone()->setNextClone(p->nextClone());
+ p->nextClone()->setPrevClone(p->prevClone());
+
+ // Link the part to be chained.
+ p->setPrevClone(p1);
+ p->setNextClone(p1->nextClone());
+
+ // Re-link the existing part.
+ p1->nextClone()->setPrevClone(p);
+ p1->setNextClone(p);
+}
+
+//---------------------------------------------------------
+// chainClone
+// The slow way - if part to chain to is not known...
+//---------------------------------------------------------
+
+void chainClone(Part* p)
+{
+ chainCheckErr(p);
+ chainCloneInternal(p);
+}
+
+//---------------------------------------------------------
+// replaceClone
+//---------------------------------------------------------
+
+void replaceClone(Part* p1, Part* p2)
+{
+ chainCheckErr(p1);
+
+ // Make sure the replacement part is unchained first.
+ p2->prevClone()->setNextClone(p2->nextClone());
+ p2->nextClone()->setPrevClone(p2->prevClone());
+
+ // If the two parts share the same event list, then this MUST
+ // be a straight forward replacement operation. Continue on.
+ // If not, and either part has more than one ref count, then do this...
+ if(p1->cevents() != p2->cevents())
+ {
+ bool ret = false;
+ // If the part to be replaced is a single uncloned part,
+ // and the replacement part is not, then this operation
+ // MUST be an undo of a de-cloning of a cloned part.
+ //if(p1->cevents()->refCount() <= 1 && p2->cevents()->refCount() > 1)
+ if(p2->cevents()->refCount() > 1)
+ {
+ // Chain the replacement part. We don't know the chain it came from,
+ // so we use the slow method.
+ chainCloneInternal(p2);
+ //return;
+ ret = true;
+ }
+
+ // If the replacement part is a single uncloned part,
+ // and the part to be replaced is not, then this operation
+ // MUST be a de-cloning of a cloned part.
+ //if(p1->cevents()->refCount() > 1 && p2->cevents()->refCount() <= 1)
+ if(p1->cevents()->refCount() > 1)
+ {
+ // Unchain the part to be replaced.
+ p1->prevClone()->setNextClone(p1->nextClone());
+ p1->nextClone()->setPrevClone(p1->prevClone());
+ // Isolate the part.
+ p1->setPrevClone(p1);
+ p1->setNextClone(p1);
+ //return;
+ ret = true;
+ }
+
+ // Was the operation handled?
+ if(ret)
+ return;
+ // Note that two parts here with different event lists, each with more than one
+ // reference count, would be an error. It's not done anywhere in muse. But just
+ // to be sure, four lines above were changed to allow that condition.
+ // If each of the two different event lists, has only one ref count, we
+ // handle it like a regular replacement, below...
+ }
+
+ // If the part to be replaced is a clone not a single lone part, re-link its neighbours to the replacement part...
+ if(p1->prevClone() != p1)
+ {
+ p1->prevClone()->setNextClone(p2);
+ p2->setPrevClone(p1->prevClone());
+ }
+ else
+ p2->setPrevClone(p2);
+
+ if(p1->nextClone() != p1)
+ {
+ p1->nextClone()->setPrevClone(p2);
+ p2->setNextClone(p1->nextClone());
+ }
+ else
+ p2->setNextClone(p2);
+
+ // Link the replacement...
+ //p2->setPrevClone(p1->prevClone());
+ //p2->setNextClone(p1->nextClone());
+
+ // Isolate the replaced part.
+ p1->setNextClone(p1);
+ p1->setPrevClone(p1);
+ // Added by Tim. p3.3.6
+ //printf("replaceClone p1: %s %p arefs:%d p2: %s %p arefs:%d\n", p1->name().latin1(), p1, );
+
+}
+
+//---------------------------------------------------------
+// unchainTrackParts
+//---------------------------------------------------------
+
+void unchainTrackParts(Track* t, bool decRefCount)
+{
+ PartList* pl = t->parts();
+ for(iPart ip = pl->begin(); ip != pl->end(); ++ip)
+ {
+ Part* p = ip->second;
+ chainCheckErr(p);
+
+ // Do we want to decrease the reference count?
+ if(decRefCount)
+ p->events()->incARef(-1);
+
+ // Unchain the part.
+ p->prevClone()->setNextClone(p->nextClone());
+ p->nextClone()->setPrevClone(p->prevClone());
+
+ // Isolate the part.
+ p->setPrevClone(p);
+ p->setNextClone(p);
+ }
+}
+
+//---------------------------------------------------------
+// chainTrackParts
+//---------------------------------------------------------
+
+void chainTrackParts(Track* t, bool incRefCount)
+{
+ PartList* pl = t->parts();
+ for(iPart ip = pl->begin(); ip != pl->end(); ++ip)
+ {
+ Part* p = ip->second;
+ chainCheckErr(p);
+
+ // Do we want to increase the reference count?
+ if(incRefCount)
+ p->events()->incARef(1);
+
+ // Added by Tim. p3.3.6
+ //printf("chainTrackParts track %p %s part %p %s evlist %p\n", t, t->name().latin1(), p, p->name().latin1(), p->cevents());
+
+ Part* p1 = 0;
+
+ // Look for a part with the same event list, that we can chain to.
+ // It's faster if track type is known...
+
+ if(!t || (t && t->isMidiTrack()))
+ {
+ MidiTrack* mt = 0;
+ MidiTrackList* mtl = song->midis();
+ for(ciMidiTrack imt = mtl->begin(); imt != mtl->end(); ++imt)
+ {
+ mt = *imt;
+ const PartList* pl = mt->cparts();
+ for(ciPart ip = pl->begin(); ip != pl->end(); ++ip)
+ {
+ // Added by Tim. p3.3.6
+ //printf("chainTrackParts track %p %s part %p %s evlist %p\n", mt, mt->name().latin1(), ip->second, ip->second->name().latin1(), ip->second->cevents());
+
+ if(ip->second != p && ip->second->cevents() == p->cevents())
+ {
+ p1 = ip->second;
+ break;
+ }
+ }
+ // If a suitable part was found on a different track, we're done. We will chain to it.
+ // Otherwise keep looking for parts on another track. If no others found, then we
+ // chain to any suitable part which was found on the same given track t.
+ if(p1 && mt != t)
+ break;
+ }
+ }
+ if((!p1 && !t) || (t && t->type() == Track::WAVE))
+ {
+ WaveTrack* wt = 0;
+ WaveTrackList* wtl = song->waves();
+ for(ciWaveTrack iwt = wtl->begin(); iwt != wtl->end(); ++iwt)
+ {
+ wt = *iwt;
+ const PartList* pl = wt->cparts();
+ for(ciPart ip = pl->begin(); ip != pl->end(); ++ip)
+ {
+ if(ip->second != p && ip->second->cevents() == p->cevents())
+ {
+ p1 = ip->second;
+ break;
+ }
+ }
+ if(p1 && wt != t)
+ break;
+ }
+ }
+
+ // No part found with same event list? Done.
+ if(!p1)
+ continue;
+
+ // Make sure the part to be chained is unchained first.
+ p->prevClone()->setNextClone(p->nextClone());
+ p->nextClone()->setPrevClone(p->prevClone());
+
+ // Link the part to be chained.
+ p->setPrevClone(p1);
+ p->setNextClone(p1->nextClone());
+
+ // Re-link the existing part.
+ p1->nextClone()->setPrevClone(p);
+ p1->setNextClone(p);
+ }
+}
+
+//---------------------------------------------------------
+// chainCheckErr
+//---------------------------------------------------------
+
+void chainCheckErr(Part* p)
+{
+ // At all times these must be true...
+ if(p->nextClone()->prevClone() != p)
+ printf("chainCheckErr: Next clone:%s %p prev clone:%s %p != %s %p\n", p->nextClone()->name().latin1(), p->nextClone(), p->nextClone()->prevClone()->name().latin1(), p->nextClone()->prevClone(), p->name().latin1(), p);
+ if(p->prevClone()->nextClone() != p)
+ printf("chainCheckErr: Prev clone:%s %p next clone:%s %p != %s %p\n", p->prevClone()->name().latin1(), p->prevClone(), p->prevClone()->nextClone()->name().latin1(), p->prevClone()->nextClone(), p->name().latin1(), p);
+}
+
+//---------------------------------------------------------
+// addPortCtrlEvents
+//---------------------------------------------------------
+
+void addPortCtrlEvents(Event& event, Part* part, bool doClones)
+{
+ // Traverse and process the clone chain ring until we arrive at the same part again.
+ // The loop is a safety net.
+ // Update: Due to the varying calls, and order of, incARefcount, (msg)ChangePart, replaceClone, and remove/addPortCtrlEvents,
+ // we can not rely on the reference count as a safety net in these routines. We will just have to trust the clone chain.
+ Part* p = part;
+ //int j = doClones ? p->cevents()->arefCount() : 1;
+ //if(j > 0)
+ {
+ //for(int i = 0; i < j; ++i)
+ while(1)
+ {
+ // Added by Tim. p3.3.6
+ //printf("addPortCtrlEvents i:%d %s %p events %p refs:%d arefs:%d\n", i, p->name().latin1(), p, part->cevents(), part->cevents()->refCount(), j);
+
+ Track* t = p->track();
+ if(t && t->isMidiTrack())
+ {
+ MidiTrack* mt = (MidiTrack*)t;
+ int port = mt->outPort();
+ //const EventList* el = p->cevents();
+ unsigned len = p->lenTick();
+ //for(ciEvent ie = el->begin(); ie != el->end(); ++ie)
+ //{
+ //const Event& ev = ie->second;
+ // Added by Tim. p3.3.6
+ //printf("addPortCtrlEvents %s len:%d end:%d etick:%d\n", p->name().latin1(), p->lenTick(), p->endTick(), event.tick());
+
+ // Do not add events which are past the end of the part.
+ if(event.tick() >= len)
+ break;
+
+ if(event.type() == Controller)
+ {
+ int ch = mt->outChannel();
+ int tck = event.tick() + p->tick();
+ int cntrl = event.dataA();
+ int val = event.dataB();
+ MidiPort* mp = &midiPorts[port];
+
+ // Is it a drum controller event, according to the track port's instrument?
+ if(mt->type() == Track::DRUM)
+ {
+ MidiController* mc = mp->drumController(cntrl);
+ if(mc)
+ {
+ int note = cntrl & 0x7f;
+ cntrl &= ~0xff;
+ ch = drumMap[note].channel;
+ mp = &midiPorts[drumMap[note].port];
+ cntrl |= drumMap[note].anote;
+ }
+ }
+
+ mp->setControllerVal(ch, tck, cntrl, val, p);
+ }
+ //}
+ }
+
+ if(!doClones)
+ break;
+ // Get the next clone in the chain ring.
+ p = p->nextClone();
+ // Same as original part? Finished.
+ if(p == part)
+ break;
+ }
+ }
+}
+
+//---------------------------------------------------------
+// addPortCtrlEvents
+//---------------------------------------------------------
+
+void addPortCtrlEvents(Part* part, bool doClones)
+{
+ // Traverse and process the clone chain ring until we arrive at the same part again.
+ // The loop is a safety net.
+ // Update: Due to the varying calls, and order of, incARefcount, (msg)ChangePart, replaceClone, and remove/addPortCtrlEvents,
+ // we can not rely on the reference count as a safety net in these routines. We will just have to trust the clone chain.
+ Part* p = part;
+ //int j = doClones ? p->cevents()->arefCount() : 1;
+ //if(j > 0)
+ {
+ //for(int i = 0; i < j; ++i)
+ while(1)
+ {
+ // Added by Tim. p3.3.6
+ //printf("addPortCtrlEvents i:%d %s %p events %p refs:%d arefs:%d\n", i, p->name().latin1(), p, part->cevents(), part->cevents()->refCount(), j);
+
+ Track* t = p->track();
+ if(t && t->isMidiTrack())
+ {
+ MidiTrack* mt = (MidiTrack*)t;
+ int port = mt->outPort();
+ const EventList* el = p->cevents();
+ unsigned len = p->lenTick();
+ for(ciEvent ie = el->begin(); ie != el->end(); ++ie)
+ {
+ const Event& ev = ie->second;
+ // Added by T356. Do not add events which are past the end of the part.
+ if(ev.tick() >= len)
+ break;
+
+ if(ev.type() == Controller)
+ {
+ int ch = mt->outChannel();
+ int tck = ev.tick() + p->tick();
+ int cntrl = ev.dataA();
+ int val = ev.dataB();
+ MidiPort* mp = &midiPorts[port];
+
+ // Is it a drum controller event, according to the track port's instrument?
+ if(mt->type() == Track::DRUM)
+ {
+ MidiController* mc = mp->drumController(cntrl);
+ if(mc)
+ {
+ int note = cntrl & 0x7f;
+ cntrl &= ~0xff;
+ ch = drumMap[note].channel;
+ mp = &midiPorts[drumMap[note].port];
+ cntrl |= drumMap[note].anote;
+ }
+ }
+
+ mp->setControllerVal(ch, tck, cntrl, val, p);
+ }
+ }
+ }
+ if(!doClones)
+ break;
+ // Get the next clone in the chain ring.
+ p = p->nextClone();
+ // Same as original part? Finished.
+ if(p == part)
+ break;
+ }
+ }
+}
+
+//---------------------------------------------------------
+// removePortCtrlEvents
+//---------------------------------------------------------
+
+void removePortCtrlEvents(Event& event, Part* part, bool doClones)
+{
+ // Traverse and process the clone chain ring until we arrive at the same part again.
+ // The loop is a safety net.
+ // Update: Due to the varying calls, and order of, incARefcount, (msg)ChangePart, replaceClone, and remove/addPortCtrlEvents,
+ // we can not rely on the reference count as a safety net in these routines. We will just have to trust the clone chain.
+ Part* p = part;
+ //int j = doClones ? p->cevents()->arefCount() : 1;
+ //if(j > 0)
+ {
+ //for(int i = 0; i < j; ++i)
+ while(1)
+ {
+ Track* t = p->track();
+ if(t && t->isMidiTrack())
+ {
+ MidiTrack* mt = (MidiTrack*)t;
+ int port = mt->outPort();
+ //const EventList* el = p->cevents();
+ //unsigned len = p->lenTick();
+ //for(ciEvent ie = el->begin(); ie != el->end(); ++ie)
+ //{
+ //const Event& ev = ie->second;
+ // Added by T356. Do not remove events which are past the end of the part.
+ // No, actually, do remove ALL of them belonging to the part.
+ // Just in case there are stray values left after the part end.
+ //if(ev.tick() >= len)
+ // break;
+
+ if(event.type() == Controller)
+ {
+ int ch = mt->outChannel();
+ int tck = event.tick() + p->tick();
+ int cntrl = event.dataA();
+ MidiPort* mp = &midiPorts[port];
+
+ // Is it a drum controller event, according to the track port's instrument?
+ if(mt->type() == Track::DRUM)
+ {
+ MidiController* mc = mp->drumController(cntrl);
+ if(mc)
+ {
+ int note = cntrl & 0x7f;
+ cntrl &= ~0xff;
+ ch = drumMap[note].channel;
+ mp = &midiPorts[drumMap[note].port];
+ cntrl |= drumMap[note].anote;
+ }
+ }
+
+ mp->deleteController(ch, tck, cntrl, p);
+ }
+ //}
+ }
+
+ if(!doClones)
+ break;
+ // Get the next clone in the chain ring.
+ p = p->nextClone();
+ // Same as original part? Finished.
+ if(p == part)
+ break;
+ }
+ }
+}
+
+//---------------------------------------------------------
+// removePortCtrlEvents
+//---------------------------------------------------------
+
+void removePortCtrlEvents(Part* part, bool doClones)
+{
+ // Traverse and process the clone chain ring until we arrive at the same part again.
+ // The loop is a safety net.
+ // Update: Due to the varying calls, and order of, incARefcount, (msg)ChangePart, replaceClone, and remove/addPortCtrlEvents,
+ // we can not rely on the reference count as a safety net in these routines. We will just have to trust the clone chain.
+ Part* p = part;
+ //int j = doClones ? p->cevents()->arefCount() : 1;
+ //if(j > 0)
+ {
+ //for(int i = 0; i < j; ++i)
+ while(1)
+ {
+ Track* t = p->track();
+ if(t && t->isMidiTrack())
+ {
+ MidiTrack* mt = (MidiTrack*)t;
+ int port = mt->outPort();
+ const EventList* el = p->cevents();
+ //unsigned len = p->lenTick();
+ for(ciEvent ie = el->begin(); ie != el->end(); ++ie)
+ {
+ const Event& ev = ie->second;
+ // Added by T356. Do not remove events which are past the end of the part.
+ // No, actually, do remove ALL of them belonging to the part.
+ // Just in case there are stray values left after the part end.
+ //if(ev.tick() >= len)
+ // break;
+
+ if(ev.type() == Controller)
+ {
+ int ch = mt->outChannel();
+ int tck = ev.tick() + p->tick();
+ int cntrl = ev.dataA();
+ MidiPort* mp = &midiPorts[port];
+
+ // Is it a drum controller event, according to the track port's instrument?
+ if(mt->type() == Track::DRUM)
+ {
+ MidiController* mc = mp->drumController(cntrl);
+ if(mc)
+ {
+ int note = cntrl & 0x7f;
+ cntrl &= ~0xff;
+ ch = drumMap[note].channel;
+ mp = &midiPorts[drumMap[note].port];
+ cntrl |= drumMap[note].anote;
+ }
+ }
+
+ mp->deleteController(ch, tck, cntrl, p);
+ }
+ }
+ }
+
+ if(!doClones)
+ break;
+ // Get the next clone in the chain ring.
+ p = p->nextClone();
+ // Same as original part? Finished.
+ if(p == part)
+ break;
+ }
+ }
+}
+
+//---------------------------------------------------------
+// addEvent
+//---------------------------------------------------------
+
+iEvent Part::addEvent(Event& p)
+ {
+ return _events->add(p);
+ }
+
+//---------------------------------------------------------
+// index
+//---------------------------------------------------------
+
+int PartList::index(Part* part)
+ {
+ int index = 0;
+ for (iPart i = begin(); i != end(); ++i, ++index)
+ if (i->second == part) {
+ return index;
+ }
+ if(debugMsg)
+ printf("PartList::index(): not found!\n");
+ //return 0;
+ return -1;
+ }
+
+//---------------------------------------------------------
+// find
+//---------------------------------------------------------
+
+Part* PartList::find(int idx)
+ {
+ int index = 0;
+ for (iPart i = begin(); i != end(); ++i, ++index)
+ if (index == idx)
+ return i->second;
+ return 0;
+ }
+
+//---------------------------------------------------------
+// Part
+//---------------------------------------------------------
+
+Part::Part(Track* t)
+ {
+ _prevClone = this;
+ _nextClone = this;
+ setSn(newSn());
+ _track = t;
+ _selected = false;
+ _mute = false;
+ _colorIndex = 0;
+ _events = new EventList;
+ _events->incRef(1);
+ _events->incARef(1);
+ }
+
+//---------------------------------------------------------
+// Part
+//---------------------------------------------------------
+
+Part::Part(Track* t, EventList* ev)
+ {
+ _prevClone = this;
+ _nextClone = this;
+ setSn(newSn());
+ _track = t;
+ _selected = false;
+ _mute = false;
+ _colorIndex = 0;
+ _events = ev;
+ _events->incRef(1);
+ _events->incARef(1);
+ }
+
+//---------------------------------------------------------
+// MidiPart
+// copy constructor
+//---------------------------------------------------------
+
+MidiPart::MidiPart(const MidiPart& p) : Part(p)
+{
+ _prevClone = this;
+ _nextClone = this;
+ //setSn(newSn());
+ //_sn = p._sn;
+ //_name = p._name;
+ //_selected = p._selected;
+ //_mute = p._mute;
+ //_colorIndex = p._colorIndex;
+ //_track = p._track;
+ //_events = p._events;
+}
+
+//---------------------------------------------------------
+// WavePart
+//---------------------------------------------------------
+
+WavePart::WavePart(WaveTrack* t)
+ : Part(t)
+ {
+ setType(FRAMES);
+ }
+
+WavePart::WavePart(WaveTrack* t, EventList* ev)
+ : Part(t, ev)
+ {
+ setType(FRAMES);
+ }
+
+//---------------------------------------------------------
+// WavePart
+// copy constructor
+//---------------------------------------------------------
+
+WavePart::WavePart(const WavePart& p) : Part(p)
+{
+ _prevClone = this;
+ _nextClone = this;
+ //setSn(newSn());
+ //_sn = p._sn;
+ //_name = p._name;
+ //_selected = p._selected;
+ //_mute = p._mute;
+ //_colorIndex = p._colorIndex;
+ //_track = p._track;
+ //_events = p._events;
+}
+
+//---------------------------------------------------------
+// Part
+//---------------------------------------------------------
+
+Part::~Part()
+ {
+ _events->incRef(-1);
+ if (_events->refCount() <= 0)
+ delete _events;
+ }
+
+/*
+//---------------------------------------------------------
+// unchainClone
+//---------------------------------------------------------
+
+void Part::unchainClone()
+{
+ chainCheckErr();
+
+ _prevClone->setNextClone(_nextClone);
+ _nextClone->setPrevClone(_prevClone);
+
+ _prevClone = this;
+ _nextClone = this;
+}
+
+//---------------------------------------------------------
+// chainClone
+// The quick way - if part to chain to is known...
+//---------------------------------------------------------
+
+void Part::chainClone(const Part* p)
+{
+ chainCheckErr();
+
+ // Make sure the part is unchained first.
+ p->prevClone()->setNextClone(p->nextClone());
+ p->nextClone()->setPrevClone(p->prevClone());
+
+ p->setPrevClone(this);
+ p->setNextClone(_nextClone->prevClone());
+
+ _nextClone->setPrevClone(p);
+ _nextClone = (Part*)p;
+}
+
+//---------------------------------------------------------
+// chainClone
+// The slow way - if part to chain to is not known...
+//---------------------------------------------------------
+
+void Part::chainClone()
+{
+ chainCheckErr();
+
+ // Look for a part with the same event list, that we can chain to...
+ Part* p = 0;
+ if(!_track || (_track && _track->isMidiTrack()))
+ {
+ MidiTrackList* mtl = song->midis();
+ for(ciMidiTrack imt = mtl->begin(); imt != mtl->end(); ++imt)
+ {
+ const PartList* pl = (*imt)->cparts();
+ for(ciPart ip = pl->begin(); ip != pl->end(); ++ip)
+ {
+ if(ip->second != this && ip->second->events() == _events)
+ {
+ p = ip->second;
+ break;
+ }
+ }
+ }
+ }
+
+ if((!p && !_track) || (_track && _track->type() == Track::WAVE))
+ {
+ WaveTrackList* wtl = song->waves();
+ for(ciWaveTrack iwt = wtl->begin(); iwt != wtl->end(); ++iwt)
+ {
+ const PartList* pl = (*iwt)->cparts();
+ for(ciPart ip = pl->begin(); ip != pl->end(); ++ip)
+ {
+ if(ip->second != this && ip->second->events() == _events)
+ {
+ p = ip->second;
+ break;
+ }
+ }
+ }
+ }
+
+ // No part found with same event list? Done.
+ if(!p)
+ return;
+
+ // Make sure this part is unchained first.
+ _prevClone->setNextClone(_nextClone);
+ _nextClone->setPrevClone(_prevClone);
+
+ _prevClone = p;
+ _nextClone = p->nextClone();
+
+ p->nextClone()->setPrevClone(this);
+ p->setNextClone(this);
+}
+
+//---------------------------------------------------------
+// replaceClone
+//---------------------------------------------------------
+
+void Part::replaceClone(const Part* p)
+{
+ chainCheckErr();
+
+ // Make sure the part is unchained first.
+ p->prevClone()->setNextClone(p->nextClone());
+ p->nextClone()->setPrevClone(p->prevClone());
+
+ // If this part is a clone, not a single lone part...
+ if(_prevClone != this)
+ _prevClone->setNextClone(p);
+ if(_nextClone != this)
+ _nextClone->setPrevClone(p);
+
+ p->setPrevClone(_prevClone);
+ p->setNextClone(_nextClone);
+
+ _nextClone = this;
+ _prevClone = this;
+}
+
+//---------------------------------------------------------
+// chainCheckErr
+//---------------------------------------------------------
+
+void Part::chainCheckErr()
+{
+ if(_nextClone->prevClone() != this)
+ printf("Part::chainCheckErr Error! Next clone:%s %x prev clone:%s %x != this:%s %x\n", _nextClone->name().latin1(), _nextClone, _nextClone->prevClone()->name().latin1(), _nextClone->prevClone(), name().latin1(), this);
+ if(_prevClone->nextClone() != this)
+ printf("Part::chainCheckErr Error! Prev clone:%s %x next clone:%s %x != this:%s %x\n", _prevClone->name().latin1(), _prevClone, _prevClone->nextClone()->name().latin1(), _prevClone->nextClone(), name().latin1(), this);
+}
+*/
+
+//---------------------------------------------------------
+// findPart
+//---------------------------------------------------------
+
+iPart PartList::findPart(unsigned tick)
+ {
+ iPart i;
+ for (i = begin(); i != end(); ++i)
+ if (i->second->tick() == tick)
+ break;
+ return i;
+ }
+
+//---------------------------------------------------------
+// add
+//---------------------------------------------------------
+
+iPart PartList::add(Part* part)
+ {
+ // Added by T356. A part list containing wave parts should be sorted by
+ // frames. WaveTrack::fetchData() relies on the sorting order, and
+ // there was a bug that waveparts were sometimes muted because of
+ // incorrect sorting order (by ticks).
+ // Also, when the tempo map is changed, every wavepart would have to be
+ // re-added to the part list so that the proper sorting order (by ticks)
+ // could be achieved.
+ // Note that in a med file, the tempo list is loaded AFTER all the tracks.
+ // There was a bug that all the wave parts' tick values were not correct,
+ // since they were computed BEFORE the tempo map was loaded.
+ if(part->type() == Pos::FRAMES)
+ return insert(std::pair<const int, Part*> (part->frame(), part));
+ else
+ return insert(std::pair<const int, Part*> (part->tick(), part));
+ }
+
+//---------------------------------------------------------
+// remove
+//---------------------------------------------------------
+
+void PartList::remove(Part* part)
+ {
+ iPart i;
+ for (i = begin(); i != end(); ++i) {
+ if (i->second == part) {
+ erase(i);
+ break;
+ }
+ }
+ assert(i != end());
+ }
+
+//---------------------------------------------------------
+// addPart
+//---------------------------------------------------------
+
+void Song::addPart(Part* part)
+ {
+ // adjust song len:
+ unsigned epos = part->tick() + part->lenTick();
+
+ if (epos > len())
+ _len = epos;
+ part->track()->addPart(part);
+
+ //part->addPortCtrlEvents();
+ // Indicate do not do clones.
+ addPortCtrlEvents(part, false);
+ }
+
+//---------------------------------------------------------
+// removePart
+//---------------------------------------------------------
+
+void Song::removePart(Part* part)
+ {
+ //part->removePortCtrlEvents();
+ // Indicate do not do clones.
+ //removePortCtrlEvents(part);
+ removePortCtrlEvents(part, false);
+ Track* track = part->track();
+ track->parts()->remove(part);
+ }
+
+//---------------------------------------------------------
+// cmdResizePart
+//---------------------------------------------------------
+
+void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len)
+ {
+ switch(track->type()) {
+ case Track::WAVE:
+ {
+ WavePart* nPart = new WavePart(*(WavePart*)oPart);
+ EventList* el = nPart->events();
+ unsigned new_partlength = tempomap.deltaTick2frame(oPart->tick(), oPart->tick() + len);
+ //printf("new partlength in frames: %d\n", new_partlength);
+
+ // If new nr of frames is less than previous what can happen is:
+ // - 0 or more events are beginning after the new final position. Those are removed from the part
+ // - The last event begins before new final position and ends after it. If so, it will be resized to end at new part length
+ if (new_partlength < oPart->lenFrame()) {
+ startUndo();
+
+ for (iEvent i = el->begin(); i != el->end(); i++) {
+ Event e = i->second;
+ unsigned event_startframe = e.frame();
+ unsigned event_endframe = event_startframe + e.lenFrame();
+ //printf("Event frame=%d, length=%d\n", event_startframe, event_length);
+ if (event_endframe < new_partlength)
+ continue;
+ if (event_startframe > new_partlength) { // If event start was after the new length, remove it from part
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgDeleteEvent(e, nPart, false);
+ audio->msgDeleteEvent(e, nPart, false, false, false);
+ continue;
+ }
+ if (event_endframe > new_partlength) { // If this event starts before new length and ends after, shrink it
+ Event newEvent = e.clone();
+ newEvent.setLenFrame(new_partlength - event_startframe);
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(e, newEvent, nPart, false);
+ audio->msgChangeEvent(e, newEvent, nPart, false, false, false);
+ }
+ }
+ nPart->setLenFrame(new_partlength);
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangePart(oPart, nPart, false);
+ audio->msgChangePart(oPart, nPart, false, false, false);
+
+ endUndo(SC_PART_MODIFIED);
+ }
+ // If the part is expanded there can be no additional events beginning after the previous final position
+ // since those are removed if the part has been shrunk at some time (see above)
+ // The only thing we need to check is the final event: If it has data after the previous final position,
+ // we'll expand that event
+ else {
+ if(!el->empty())
+ {
+ iEvent i = el->end();
+ i--;
+ Event last = i->second;
+ unsigned last_start = last.frame();
+ SndFileR file = last.sndFile();
+ if (file.isNull())
+ return;
+
+ unsigned clipframes = (file.samples() - last.spos());// / file.channels();
+ Event newEvent = last.clone();
+ //printf("SndFileR samples=%d channels=%d event samplepos=%d clipframes=%d\n", file.samples(), file.channels(), last.spos(), clipframes);
+
+ unsigned new_eventlength = new_partlength - last_start;
+ if (new_eventlength > clipframes) // Shrink event length if new partlength exceeds last clip
+ new_eventlength = clipframes;
+
+ newEvent.setLenFrame(new_eventlength);
+ startUndo();
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(last, newEvent, nPart, false);
+ audio->msgChangeEvent(last, newEvent, nPart, false, false, false);
+ }
+ else
+ {
+ startUndo();
+ }
+
+ nPart->setLenFrame(new_partlength);
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangePart(oPart, nPart, false);
+ audio->msgChangePart(oPart, nPart, false, false, false);
+ endUndo(SC_PART_MODIFIED);
+ }
+ }
+ break;
+ case Track::MIDI:
+ case Track::DRUM:
+ {
+ startUndo();
+
+ MidiPart* nPart = new MidiPart(*(MidiPart*)oPart);
+ nPart->setLenTick(len);
+ // Indicate no undo, and do port controller values but not clone parts.
+ audio->msgChangePart(oPart, nPart, false, true, false);
+
+ // cut Events in nPart
+ // Changed by T356. Don't delete events if this is a clone part.
+ // The other clones might be longer than this one and need these events.
+ if(nPart->cevents()->arefCount() <= 1)
+ {
+ if(oPart->lenTick() > len) {
+ EventList* el = nPart->events();
+ iEvent ie = el->lower_bound(len);
+ for (; ie != el->end();) {
+ iEvent i = ie;
+ ++ie;
+ // Indicate no undo, and do port controller values and clone parts.
+ audio->msgDeleteEvent(i->second, nPart, false, true, true);
+ }
+ }
+ }
+
+ /*
+ // cut Events in nPart
+ // Changed by T356. Don't delete events if this is a clone part.
+ // The other clones might be longer than this one and need these events.
+ if(oPart->cevents()->arefCount() <= 1)
+ {
+ if (oPart->lenTick() > len) {
+ EventList* el = nPart->events();
+ iEvent ie = el->lower_bound(len);
+ for (; ie != el->end();) {
+ iEvent i = ie;
+ ++ie;
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgDeleteEvent(i->second, nPart, false);
+ audio->msgDeleteEvent(i->second, nPart, false, false, false);
+ }
+ }
+ }
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(oPart, nPart, false);
+ audio->msgChangePart(oPart, nPart, false, true, false);
+ */
+
+ endUndo(SC_PART_MODIFIED);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// splitPart
+// split part "part" at "tick" position
+// create two new parts p1 and p2
+//---------------------------------------------------------
+
+void Track::splitPart(Part* part, int tickpos, Part*& p1, Part*& p2)
+ {
+ int l1 = 0; // len of first new part (ticks or samples)
+ int l2 = 0; // len of second new part
+
+ int samplepos = tempomap.tick2frame(tickpos);
+
+ switch (type()) {
+ case WAVE:
+ l1 = samplepos - part->frame();
+ l2 = part->lenFrame() - l1;
+ break;
+ case MIDI:
+ case DRUM:
+ l1 = tickpos - part->tick();
+ l2 = part->lenTick() - l1;
+ break;
+ default:
+ return;
+ }
+
+ if (l1 <= 0 || l2 <= 0)
+ return;
+
+ p1 = newPart(part); // new left part
+ p2 = newPart(part); // new right part
+
+ // Added by Tim. p3.3.6
+ //printf("Track::splitPart part ev %p sz:%d ref:%d p1 %p sz:%d ref:%d p2 %p sz:%d ref:%d\n", part->events(), part->events()->size(), part->events()->arefCount(), p1->events(), p1->events()->size(), p1->events()->arefCount(), p2->events(), p2->events()->size(), p2->events()->arefCount());
+
+ switch (type()) {
+ case WAVE:
+ p1->setLenFrame(l1);
+ p2->setFrame(samplepos);
+ p2->setLenFrame(l2);
+ break;
+ case MIDI:
+ case DRUM:
+ p1->setLenTick(l1);
+ p2->setTick(tickpos);
+ p2->setLenTick(l2);
+ break;
+ default:
+ break;
+ }
+
+ p2->setSn(p2->newSn());
+
+ EventList* se = part->events();
+ EventList* de1 = p1->events();
+ EventList* de2 = p2->events();
+
+ if (type() == WAVE) {
+ int ps = part->frame();
+ int d1p1 = p1->frame();
+ int d2p1 = p1->endFrame();
+ int d1p2 = p2->frame();
+ int d2p2 = p2->endFrame();
+ for (iEvent ie = se->begin(); ie != se->end(); ++ie) {
+ Event event = ie->second;
+ int s1 = event.frame() + ps;
+ int s2 = event.endFrame() + ps;
+
+ if ((s2 > d1p1) && (s1 < d2p1)) {
+ Event si = event.mid(d1p1 - ps, d2p1 - ps);
+ de1->add(si);
+ }
+ if ((s2 > d1p2) && (s1 < d2p2)) {
+ Event si = event.mid(d1p2 - ps, d2p2 - ps);
+ de2->add(si);
+ }
+ }
+ }
+ else {
+ for (iEvent ie = se->begin(); ie != se->end(); ++ie) {
+ Event event = ie->second.clone();
+ int t = event.tick();
+ if (t >= l1) {
+ event.move(-l1);
+ de2->add(event);
+ }
+ else
+ de1->add(event);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// cmdSplitPart
+//---------------------------------------------------------
+
+void Song::cmdSplitPart(Track* track, Part* part, int tick)
+ {
+ int l1 = tick - part->tick();
+ int l2 = part->lenTick() - l1;
+ if (l1 <= 0 || l2 <= 0)
+ return;
+ Part* p1;
+ Part* p2;
+ track->splitPart(part, tick, p1, p2);
+
+ startUndo();
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(part, p1, false);
+ audio->msgChangePart(part, p1, false, true, false);
+ audio->msgAddPart(p2, false);
+ endUndo(SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_INSERTED);
+ }
+
+//---------------------------------------------------------
+// changePart
+//---------------------------------------------------------
+
+void Song::changePart(Part* oPart, Part* nPart)
+ {
+ nPart->setSn(oPart->sn());
+
+ Track* oTrack = oPart->track();
+ Track* nTrack = nPart->track();
+
+ // Added by Tim. p3.3.6
+ //printf("Song::changePart before oPart->removePortCtrlEvents oldPart refs:%d Arefs:%d newPart refs:%d Arefs:%d\n", oPart->events()->refCount(), oPart->events()->arefCount(), nPart->events()->refCount(), nPart->events()->arefCount());
+
+ // Removed. Port controller events will have to be add/removed separately from this routine.
+ //oPart->removePortCtrlEvents();
+ //removePortCtrlEvents(oPart);
+
+ // Added by Tim. p3.3.6
+ //printf("Song::changePart after oPart->removePortCtrlEvents oldPart refs:%d Arefs:%d newPart refs:%d Arefs:%d\n", oPart->events()->refCount(), oPart->events()->arefCount(), nPart->events()->refCount(), nPart->events()->arefCount());
+
+ oTrack->parts()->remove(oPart);
+ nTrack->parts()->add(nPart);
+
+ // Added by Tim. p3.3.6
+ //printf("Song::changePart after add(nPart) oldPart refs:%d Arefs:%d newPart refs:%d Arefs:%d\n", oPart->events()->refCount(), oPart->events()->arefCount(), nPart->events()->refCount(), nPart->events()->arefCount());
+
+ //nPart->addPortCtrlEvents();
+ //addPortCtrlEvents(nPart);
+
+ // Added by Tim. p3.3.6
+ //printf("Song::changePart after nPart->addPortCtrlEvents() oldPart refs:%d Arefs:%d newPart refs:%d Arefs:%d\n", oPart->events()->refCount(), oPart->events()->arefCount(), nPart->events()->refCount(), nPart->events()->arefCount());
+
+ // Added by T356.
+ // adjust song len:
+ unsigned epos = nPart->tick() + nPart->lenTick();
+ if (epos > len())
+ _len = epos;
+
+ // Added by Tim. p3.3.6
+ //printf("Song::changePart after len adjust oldPart refs:%d Arefs:%d newPart refs:%d Arefs:%d\n", oPart->events()->refCount(), oPart->events()->arefCount(), nPart->events()->refCount(), nPart->events()->arefCount());
+
+ }
+
+//---------------------------------------------------------
+// cmdGluePart
+//---------------------------------------------------------
+
+void Song::cmdGluePart(Track* track, Part* oPart)
+ {
+ // p3.3.54
+ if(track->type() != Track::WAVE && !track->isMidiTrack())
+ return;
+
+ PartList* pl = track->parts();
+ Part* nextPart = 0;
+
+ for (iPart ip = pl->begin(); ip != pl->end(); ++ip) {
+ if (ip->second == oPart) {
+ ++ip;
+ if (ip == pl->end())
+ return;
+ nextPart = ip->second;
+ break;
+ }
+ }
+
+ Part* nPart = track->newPart(oPart);
+ nPart->setLenTick(nextPart->tick() + nextPart->lenTick() - oPart->tick());
+
+ // populate nPart with Events from oPart and nextPart
+
+ EventList* sl1 = oPart->events();
+ EventList* dl = nPart->events();
+
+ for (iEvent ie = sl1->begin(); ie != sl1->end(); ++ie)
+ dl->add(ie->second);
+
+ EventList* sl2 = nextPart->events();
+
+ //int frameOffset = nextPart->frame() - oPart->frame();
+ //for (iEvent ie = sl2->begin(); ie != sl2->end(); ++ie) {
+ // Event event = ie->second.clone();
+ // event.setFrame(event.frame() + frameOffset);
+ // dl->add(event);
+ // }
+ // p3.3.54 Changed.
+ if(track->type() == Track::WAVE)
+ {
+ int frameOffset = nextPart->frame() - oPart->frame();
+ for (iEvent ie = sl2->begin(); ie != sl2->end(); ++ie)
+ {
+ Event event = ie->second.clone();
+ event.setFrame(event.frame() + frameOffset);
+ dl->add(event);
+ }
+ }
+ else
+ if(track->isMidiTrack())
+ {
+ int tickOffset = nextPart->tick() - oPart->tick();
+ for (iEvent ie = sl2->begin(); ie != sl2->end(); ++ie)
+ {
+ Event event = ie->second.clone();
+ event.setTick(event.tick() + tickOffset);
+ dl->add(event);
+ }
+ }
+
+ startUndo();
+ audio->msgRemovePart(nextPart, false);
+ // Indicate no undo, and do port controller values but not clone parts.
+ //audio->msgChangePart(oPart, nPart, false);
+ audio->msgChangePart(oPart, nPart, false, true, false);
+ endUndo(SC_PART_MODIFIED | SC_PART_REMOVED);
+ }
+
+//---------------------------------------------------------
+// dump
+//---------------------------------------------------------
+
+void Part::dump(int n) const
+ {
+ for (int i = 0; i < n; ++i)
+ putchar(' ');
+ printf("Part: <%s> ", _name.latin1());
+ for (int i = 0; i < n; ++i)
+ putchar(' ');
+ PosLen::dump();
+ }
+
+void WavePart::dump(int n) const
+ {
+ Part::dump(n);
+ for (int i = 0; i < n; ++i)
+ putchar(' ');
+ printf("WavePart\n");
+ }
+
+void MidiPart::dump(int n) const
+ {
+ Part::dump(n);
+ for (int i = 0; i < n; ++i)
+ putchar(' ');
+ printf("MidiPart\n");
+ }
+
+//---------------------------------------------------------
+// clone
+//---------------------------------------------------------
+
+MidiPart* MidiPart::clone() const
+ {
+ return new MidiPart(*this);
+ }
+
+WavePart* WavePart::clone() const
+ {
+ return new WavePart(*this);
+ }
+
diff --git a/muse2/muse/part.h b/muse2/muse/part.h
new file mode 100644
index 00000000..b2a18851
--- /dev/null
+++ b/muse2/muse/part.h
@@ -0,0 +1,175 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: part.h,v 1.5.2.4 2009/05/24 21:43:44 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __PART_H__
+#define __PART_H__
+
+#include <map>
+
+#include <qstring.h>
+#include <qcolor.h>
+// Added by T356.
+#include <uuid/uuid.h>
+
+#include "event.h"
+#include "audioconvert.h"
+
+class Track;
+class MidiTrack;
+class WaveTrack;
+class Xml;
+class Part;
+//class AudioConvertMap;
+
+// typedef std::multimap<unsigned, Event*, std::less<unsigned> >::iterator iEvent;
+
+struct ClonePart {
+ //const EventList* el;
+ const Part* cp;
+ int id;
+ uuid_t uuid;
+ //ClonePart(const EventList* e, int i) : el(e), id(i) {}
+ //ClonePart(const Part* p, int i) : cp(p), id(i) {}
+ ClonePart(const Part*, int i = -1);
+ };
+
+typedef std::list<ClonePart> CloneList;
+typedef CloneList::iterator iClone;
+
+//---------------------------------------------------------
+// Part
+//---------------------------------------------------------
+
+class Part : public PosLen {
+ static int snGen;
+ int _sn;
+
+ QString _name;
+ bool _selected;
+ bool _mute;
+ int _colorIndex;
+
+ protected:
+ Track* _track;
+ EventList* _events;
+ Part* _prevClone;
+ Part* _nextClone;
+
+ public:
+ Part(Track*);
+ Part(Track*, EventList*);
+ virtual ~Part();
+ int sn() { return _sn; }
+ void setSn(int n) { _sn = n; }
+ int newSn() { return snGen++; }
+
+ virtual Part* clone() const = 0;
+
+ const QString& name() const { return _name; }
+ void setName(const QString& s) { _name = s; }
+ bool selected() const { return _selected; }
+ void setSelected(bool f) { _selected = f; }
+ bool mute() const { return _mute; }
+ void setMute(bool b) { _mute = b; }
+ Track* track() const { return _track; }
+ void setTrack(Track*t) { _track = t; }
+ EventList* events() const { return _events; }
+ const EventList* cevents() const { return _events; }
+ int colorIndex() const { return _colorIndex; }
+ void setColorIndex(int idx) { _colorIndex = idx; }
+
+ Part* prevClone() { return _prevClone; }
+ Part* nextClone() { return _nextClone; }
+ void setPrevClone(Part* p) { _prevClone = p; }
+ void setNextClone(Part* p) { _nextClone = p; }
+
+ iEvent addEvent(Event& p);
+
+ //virtual void read(Xml&, int newPartOffset=0, bool toTrack = true);
+ //virtual void write(int, Xml&) const;
+ //virtual void write(int, Xml&, bool isCopy = false) const;
+ virtual void write(int, Xml&, bool isCopy = false, bool forceWavePaths = false) const;
+
+// virtual Event* newEvent() const = 0;
+ virtual void dump(int n = 0) const;
+ };
+
+//---------------------------------------------------------
+// MidiPart
+//---------------------------------------------------------
+
+class MidiPart : public Part {
+
+ public:
+ MidiPart(MidiTrack* t) : Part((Track*)t) {}
+ MidiPart(MidiTrack* t, EventList* ev) : Part((Track*)t, ev) {}
+ MidiPart(const MidiPart& p);
+ virtual ~MidiPart() {}
+ virtual MidiPart* clone() const;
+ MidiTrack* track() const { return (MidiTrack*)Part::track(); }
+
+// virtual Event* newEvent() const;
+ virtual void dump(int n = 0) const;
+ };
+
+//---------------------------------------------------------
+// WavePart
+//---------------------------------------------------------
+
+class WavePart : public Part {
+
+ // p3.3.31
+ AudioConvertMap _converters;
+
+ public:
+ WavePart(WaveTrack* t);
+ WavePart(WaveTrack* t, EventList* ev);
+ WavePart(const WavePart& p);
+ virtual ~WavePart() {}
+ virtual WavePart* clone() const;
+ WaveTrack* track() const { return (WaveTrack*)Part::track(); }
+
+// virtual Event* newEvent() const;
+ virtual void dump(int n = 0) const;
+ };
+
+//---------------------------------------------------------
+// PartList
+//---------------------------------------------------------
+
+typedef std::multimap<int, Part*, std::less<unsigned> >::iterator iPart;
+typedef std::multimap<int, Part*, std::less<unsigned> >::const_iterator ciPart;
+
+class PartList : public std::multimap<int, Part*, std::less<unsigned> > {
+ public:
+ iPart findPart(unsigned tick);
+ iPart add(Part*);
+ void remove(Part* part);
+ int index(Part*);
+ Part* find(int idx);
+ };
+
+extern void chainClone(Part* p);
+extern void chainClone(Part* p1, Part* p2);
+extern void unchainClone(Part* p);
+extern void replaceClone(Part* p1, Part* p2);
+extern void chainCheckErr(Part* p);
+extern void unchainTrackParts(Track* t, bool decRefCount);
+extern void chainTrackParts(Track* t, bool incRefCount);
+extern void addPortCtrlEvents(Part* part, bool doClones);
+extern void addPortCtrlEvents(Event& event, Part* part, bool doClones);
+extern void removePortCtrlEvents(Part* part, bool doClones);
+extern void removePortCtrlEvents(Event& event, Part* part, bool doClones);
+extern CloneList cloneList;
+//extern CloneList copyCloneList;
+//extern void updateCloneList(Part* oPart, Part* nPart);
+//extern void clearClipboardAndCloneList();
+extern Part* readXmlPart(Xml&, Track*, bool doClone = false, bool toTrack = true);
+
+#endif
+
diff --git a/muse2/muse/patchbay/Makefile.am b/muse2/muse/patchbay/Makefile.am
new file mode 100644
index 00000000..7588de85
--- /dev/null
+++ b/muse2/muse/patchbay/Makefile.am
@@ -0,0 +1,9 @@
+include $(top_srcdir)/common.am
+
+noinst_LTLIBRARIES = libpatchbay.la
+
+dist_libpatchbay_la_SOURCES = \
+ patchbay.cpp patchbay.h
+
+nodist_libpatchbay_la_SOURCES = \
+ moc_patchbay.cpp
diff --git a/muse2/muse/patchbay/patchbay.cpp b/muse2/muse/patchbay/patchbay.cpp
new file mode 100644
index 00000000..a03804e5
--- /dev/null
+++ b/muse2/muse/patchbay/patchbay.cpp
@@ -0,0 +1,10 @@
+#include "patchbay.h"
+
+PatchBay::PatchBay (void) {
+ _patchbay = new PatchBayBase (this, "patchbay");
+ setCaption(tr("MusE: ALSA MIDI Patch Bay"));
+}
+
+PatchBay::~PatchBay (void) {
+ if (_patchbay) delete _patchbay;
+}
diff --git a/muse2/muse/patchbay/patchbay.h b/muse2/muse/patchbay/patchbay.h
new file mode 100644
index 00000000..14f51a82
--- /dev/null
+++ b/muse2/muse/patchbay/patchbay.h
@@ -0,0 +1,16 @@
+#ifndef __MUSE_PATCHBAY_H__
+#define __MUSE_PATCHBAY_H__
+
+#include "cobject.h"
+#include "patchbaybase.h"
+
+class PatchBay : public TopWin {
+ Q_OBJECT
+ PatchBayBase * _patchbay;
+
+public:
+ PatchBay (void);
+ ~PatchBay (void);
+};
+
+#endif /* __MUSE_PATCHBAY_H__ */ \ No newline at end of file
diff --git a/muse2/muse/patchbay/patchbaybase.ui b/muse2/muse/patchbay/patchbaybase.ui
new file mode 100644
index 00000000..7138982f
--- /dev/null
+++ b/muse2/muse/patchbay/patchbaybase.ui
@@ -0,0 +1,36 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>PatchBayBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>PatchBayBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>401</width>
+ <height>315</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>ALSA Patch Bay</string>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>alsaPatchbay</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>315</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>ALSA Patch Bay</string>
+ </property>
+ </widget>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp
new file mode 100644
index 00000000..0b2911ca
--- /dev/null
+++ b/muse2/muse/plugin.cpp
@@ -0,0 +1,3871 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: plugin.cpp,v 1.21.2.23 2009/12/15 22:07:12 spamatica Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qdir.h>
+//Added by qt3to4:
+#include <Q3BoxLayout>
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
+#include <Qt3Support>
+#include <stdio.h>
+#include <stdlib.h>
+#include <dlfcn.h>
+#include <cmath>
+#include <math.h>
+
+#include <qwidget.h>
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qsignalmapper.h>
+#include <qpushbutton.h>
+#include <q3scrollview.h>
+#include <q3listview.h>
+#include <q3toolbar.h>
+#include <qtoolbutton.h>
+#include <q3whatsthis.h>
+#include <qcheckbox.h>
+#include <qtooltip.h>
+//#include <qwidgetfactory.h>
+#include <qfile.h>
+#include <qobject.h>
+#include <qcombobox.h>
+#include <q3buttongroup.h>
+#include <qradiobutton.h>
+#include <qmessagebox.h>
+#include <qtimer.h>
+
+#include "globals.h"
+#include "gconfig.h"
+#include "filedialog.h"
+#include "slider.h"
+#include "midictrl.h"
+#include "plugin.h"
+#include "xml.h"
+#include "icons.h"
+#include "song.h"
+#include "doublelabel.h"
+#include "fastlog.h"
+#include "checkbox.h"
+
+#include "audio.h"
+#include "al/dsp.h"
+
+#include "config.h"
+
+// Turn on debugging messages.
+//#define PLUGIN_DEBUGIN
+
+PluginList plugins;
+
+/*
+static const char* preset_file_pattern[] = {
+ QT_TR_NOOP("Presets (*.pre *.pre.gz *.pre.bz2)"),
+ QT_TR_NOOP("All Files (*)"),
+ 0
+ };
+
+static const char* preset_file_save_pattern[] = {
+ QT_TR_NOOP("Presets (*.pre)"),
+ QT_TR_NOOP("gzip compressed presets (*.pre.gz)"),
+ QT_TR_NOOP("bzip2 compressed presets (*.pre.bz2)"),
+ QT_TR_NOOP("All Files (*)"),
+ 0
+ };
+*/
+
+int PluginDialog::selectedPlugType = 0;
+QStringList PluginDialog::sortItems = QStringList();
+
+//---------------------------------------------------------
+// ladspa2MidiControlValues
+//---------------------------------------------------------
+
+bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, int port, int ctlnum, int* min, int* max, int* def)
+{
+ LADSPA_PortRangeHint range = plugin->PortRangeHints[port];
+ LADSPA_PortRangeHintDescriptor desc = range.HintDescriptor;
+
+ float fmin, fmax, fdef;
+ int imin, imax;
+ float frng;
+ //int idef;
+
+ //ladspaControlRange(plugin, port, &fmin, &fmax);
+
+ bool hasdef = ladspaDefaultValue(plugin, port, &fdef);
+ //bool isint = desc & LADSPA_HINT_INTEGER;
+ MidiController::ControllerType t = midiControllerType(ctlnum);
+
+ #ifdef PLUGIN_DEBUGIN
+ printf("ladspa2MidiControlValues: ctlnum:%d ladspa port:%d has default?:%d default:%f\n", ctlnum, port, hasdef, fdef);
+ #endif
+
+ if(desc & LADSPA_HINT_TOGGLED)
+ {
+ #ifdef PLUGIN_DEBUGIN
+ printf("ladspa2MidiControlValues: has LADSPA_HINT_TOGGLED\n");
+ #endif
+
+ *min = 0;
+ *max = 1;
+ *def = (int)lrint(fdef);
+ return hasdef;
+ }
+
+ float m = 1.0;
+ if(desc & LADSPA_HINT_SAMPLE_RATE)
+ {
+ #ifdef PLUGIN_DEBUGIN
+ printf("ladspa2MidiControlValues: has LADSPA_HINT_SAMPLE_RATE\n");
+ #endif
+
+ m = float(sampleRate);
+ }
+
+ if(desc & LADSPA_HINT_BOUNDED_BELOW)
+ {
+ #ifdef PLUGIN_DEBUGIN
+ printf("ladspa2MidiControlValues: has LADSPA_HINT_BOUNDED_BELOW\n");
+ #endif
+
+ fmin = range.LowerBound * m;
+ }
+ else
+ fmin = 0.0;
+
+ if(desc & LADSPA_HINT_BOUNDED_ABOVE)
+ {
+ #ifdef PLUGIN_DEBUGIN
+ printf("ladspa2MidiControlValues: has LADSPA_HINT_BOUNDED_ABOVE\n");
+ #endif
+
+ fmax = range.UpperBound * m;
+ }
+ else
+ fmax = 1.0;
+
+ frng = fmax - fmin;
+ imin = lrint(fmin);
+ imax = lrint(fmax);
+ //irng = imax - imin;
+
+ int ctlmn = 0;
+ int ctlmx = 127;
+
+ #ifdef PLUGIN_DEBUGIN
+ printf("ladspa2MidiControlValues: port min:%f max:%f \n", fmin, fmax);
+ #endif
+
+ //bool isneg = (fmin < 0.0);
+ bool isneg = (imin < 0);
+ int bias = 0;
+ switch(t)
+ {
+ case MidiController::RPN:
+ case MidiController::NRPN:
+ case MidiController::Controller7:
+ if(isneg)
+ {
+ ctlmn = -64;
+ ctlmx = 63;
+ bias = -64;
+ }
+ else
+ {
+ ctlmn = 0;
+ ctlmx = 127;
+ }
+ break;
+ case MidiController::Controller14:
+ case MidiController::RPN14:
+ case MidiController::NRPN14:
+ if(isneg)
+ {
+ ctlmn = -8192;
+ ctlmx = 8191;
+ bias = -8192;
+ }
+ else
+ {
+ ctlmn = 0;
+ ctlmx = 16383;
+ }
+ break;
+ case MidiController::Program:
+ ctlmn = 0;
+ //ctlmx = 0xffffff;
+ ctlmx = 0x3fff; // FIXME: Really should not happen or be allowed. What to do here...
+ break;
+ case MidiController::Pitch:
+ ctlmn = -8192;
+ ctlmx = 8191;
+ break;
+ case MidiController::Velo: // cannot happen
+ default:
+ break;
+ }
+ //int ctlrng = ctlmx - ctlmn;
+ float fctlrng = float(ctlmx - ctlmn);
+
+ // Is it an integer control?
+ if(desc & LADSPA_HINT_INTEGER)
+ {
+ #ifdef PLUGIN_DEBUGIN
+ printf("ladspa2MidiControlValues: has LADSPA_HINT_INTEGER\n");
+ #endif
+
+ // If the upper or lower limit is beyond the controller limits, just scale the whole range to fit.
+ // We could get fancy by scaling only the negative or positive domain, or each one separately, but no...
+ //if((imin < ctlmn) || (imax > ctlmx))
+ //{
+ // float scl = float(irng) / float(fctlrng);
+ // if((ctlmn - imin) > (ctlmx - imax))
+ // scl = float(ctlmn - imin);
+ // else
+ // scl = float(ctlmx - imax);
+ //}
+ // No, instead just clip the limits. ie fit the range into clipped space.
+ if(imin < ctlmn)
+ imin = ctlmn;
+ if(imax > ctlmx)
+ imax = ctlmx;
+
+ *min = imin;
+ *max = imax;
+
+ //int idef = (int)lrint(fdef);
+ //if(idef < ctlmn)
+ // idef = ctlmn;
+ //if(idef > ctlmx)
+ // idef = ctlmx;
+ //*def = idef;
+
+ *def = (int)lrint(fdef);
+
+ return hasdef;
+ }
+
+ // It's a floating point control, just use wide open maximum range.
+ *min = ctlmn;
+ *max = ctlmx;
+
+ float fbias = (fmin + fmax) / 2.0;
+ float normbias = fbias / frng;
+ float normdef = fdef / frng;
+ fdef = normdef * fctlrng;
+
+ // FIXME: TODO: Incorrect... Fix this somewhat more trivial stuff later....
+
+ *def = (int)lrint(fdef) + bias;
+
+ #ifdef PLUGIN_DEBUGIN
+ printf("ladspa2MidiControlValues: setting default:%d\n", *def);
+ #endif
+
+ return hasdef;
+}
+
+//---------------------------------------------------------
+// midi2LadspaValue
+//---------------------------------------------------------
+
+float midi2LadspaValue(const LADSPA_Descriptor* plugin, int port, int ctlnum, int val)
+{
+ LADSPA_PortRangeHint range = plugin->PortRangeHints[port];
+ LADSPA_PortRangeHintDescriptor desc = range.HintDescriptor;
+
+ float fmin, fmax;
+ int imin;
+ //int imax;
+ float frng;
+ //int idef;
+
+ //ladspaControlRange(plugin, port, &fmin, &fmax);
+
+ //bool hasdef = ladspaDefaultValue(plugin, port, &fdef);
+ //bool isint = desc & LADSPA_HINT_INTEGER;
+ MidiController::ControllerType t = midiControllerType(ctlnum);
+
+ #ifdef PLUGIN_DEBUGIN
+ printf("midi2LadspaValue: ctlnum:%d ladspa port:%d val:%d\n", ctlnum, port, val);
+ #endif
+
+ float m = 1.0;
+ if(desc & LADSPA_HINT_SAMPLE_RATE)
+ {
+ #ifdef PLUGIN_DEBUGIN
+ printf("midi2LadspaValue: has LADSPA_HINT_SAMPLE_RATE\n");
+ #endif
+
+ m = float(sampleRate);
+ }
+
+ if(desc & LADSPA_HINT_BOUNDED_BELOW)
+ {
+ #ifdef PLUGIN_DEBUGIN
+ printf("midi2LadspaValue: has LADSPA_HINT_BOUNDED_BELOW\n");
+ #endif
+
+ fmin = range.LowerBound * m;
+ }
+ else
+ fmin = 0.0;
+
+ if(desc & LADSPA_HINT_BOUNDED_ABOVE)
+ {
+ #ifdef PLUGIN_DEBUGIN
+ printf("midi2LadspaValue: has LADSPA_HINT_BOUNDED_ABOVE\n");
+ #endif
+
+ fmax = range.UpperBound * m;
+ }
+ else
+ fmax = 1.0;
+
+ frng = fmax - fmin;
+ imin = lrint(fmin);
+ //imax = lrint(fmax);
+ //irng = imax - imin;
+
+ if(desc & LADSPA_HINT_TOGGLED)
+ {
+ #ifdef PLUGIN_DEBUGIN
+ printf("midi2LadspaValue: has LADSPA_HINT_TOGGLED\n");
+ #endif
+
+ if(val > 0)
+ return fmax;
+ else
+ return fmin;
+ }
+
+ int ctlmn = 0;
+ int ctlmx = 127;
+
+ #ifdef PLUGIN_DEBUGIN
+ printf("midi2LadspaValue: port min:%f max:%f \n", fmin, fmax);
+ #endif
+
+ //bool isneg = (fmin < 0.0);
+ bool isneg = (imin < 0);
+ int bval = val;
+ int cval = val;
+ switch(t)
+ {
+ case MidiController::RPN:
+ case MidiController::NRPN:
+ case MidiController::Controller7:
+ if(isneg)
+ {
+ ctlmn = -64;
+ ctlmx = 63;
+ bval -= 64;
+ cval -= 64;
+ }
+ else
+ {
+ ctlmn = 0;
+ ctlmx = 127;
+ cval -= 64;
+ }
+ break;
+ case MidiController::Controller14:
+ case MidiController::RPN14:
+ case MidiController::NRPN14:
+ if(isneg)
+ {
+ ctlmn = -8192;
+ ctlmx = 8191;
+ bval -= 8192;
+ cval -= 8192;
+ }
+ else
+ {
+ ctlmn = 0;
+ ctlmx = 16383;
+ cval -= 8192;
+ }
+ break;
+ case MidiController::Program:
+ ctlmn = 0;
+ ctlmx = 0xffffff;
+ break;
+ case MidiController::Pitch:
+ ctlmn = -8192;
+ ctlmx = 8191;
+ break;
+ case MidiController::Velo: // cannot happen
+ default:
+ break;
+ }
+ int ctlrng = ctlmx - ctlmn;
+ float fctlrng = float(ctlmx - ctlmn);
+
+ // Is it an integer control?
+ if(desc & LADSPA_HINT_INTEGER)
+ {
+ float ret = float(cval);
+ if(ret < fmin)
+ ret = fmin;
+ if(ret > fmax)
+ ret = fmax;
+ #ifdef PLUGIN_DEBUGIN
+ printf("midi2LadspaValue: has LADSPA_HINT_INTEGER returning:%f\n", ret);
+ #endif
+
+ return ret;
+ }
+
+ // Avoid divide-by-zero error below.
+ if(ctlrng == 0)
+ return 0.0;
+
+ // It's a floating point control, just use wide open maximum range.
+ float normval = float(bval) / fctlrng;
+ //float fbias = (fmin + fmax) / 2.0;
+ //float normfbias = fbias / frng;
+ //float ret = (normdef + normbias) * fctlrng;
+ //float normdef = fdef / frng;
+
+ float ret = normval * frng + fmin;
+
+ #ifdef PLUGIN_DEBUGIN
+ printf("midi2LadspaValue: float returning:%f\n", ret);
+ #endif
+
+ return ret;
+}
+
+
+// Works but not needed.
+/*
+//---------------------------------------------------------
+// ladspa2MidiController
+//---------------------------------------------------------
+
+MidiController* ladspa2MidiController(const LADSPA_Descriptor* plugin, int port, int ctlnum)
+{
+ int min, max, def;
+
+ if(!ladspa2MidiControlValues(plugin, port, ctlnum, &min, &max, &def))
+ return 0;
+
+ MidiController* mc = new MidiController(QString(plugin->PortNames[port]), ctlnum, min, max, def);
+
+ return mc;
+}
+*/
+
+//----------------------------------------------------------------------------------
+// defaultValue
+// If no default ladspa value found, still sets *def to 1.0, but returns false.
+//---------------------------------------------------------------------------------
+
+//float ladspaDefaultValue(const LADSPA_Descriptor* plugin, int k)
+bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, int port, float* val)
+{
+ LADSPA_PortRangeHint range = plugin->PortRangeHints[port];
+ LADSPA_PortRangeHintDescriptor rh = range.HintDescriptor;
+// bool isLog = LADSPA_IS_HINT_LOGARITHMIC(rh);
+ //double val = 1.0;
+ float m = (rh & LADSPA_HINT_SAMPLE_RATE) ? float(sampleRate) : 1.0f;
+ if (LADSPA_IS_HINT_DEFAULT_MINIMUM(rh))
+ {
+ *val = range.LowerBound * m;
+ return true;
+ }
+ else if (LADSPA_IS_HINT_DEFAULT_LOW(rh))
+ {
+ if (LADSPA_IS_HINT_LOGARITHMIC(rh))
+ {
+ *val = exp(fast_log10(range.LowerBound * m) * .75 +
+ log(range.UpperBound * m) * .25);
+ return true;
+ }
+ else
+ {
+ *val = range.LowerBound*.75*m + range.UpperBound*.25*m;
+ return true;
+ }
+ }
+ else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(rh))
+ {
+ if (LADSPA_IS_HINT_LOGARITHMIC(rh))
+ {
+ *val = exp(log(range.LowerBound * m) * .5 +
+ log10(range.UpperBound * m) * .5);
+ return true;
+ }
+ else
+ {
+ *val = range.LowerBound*.5*m + range.UpperBound*.5*m;
+ return true;
+ }
+ }
+ else if (LADSPA_IS_HINT_DEFAULT_HIGH(rh))
+ {
+ if (LADSPA_IS_HINT_LOGARITHMIC(rh))
+ {
+ *val = exp(log(range.LowerBound * m) * .25 +
+ log(range.UpperBound * m) * .75);
+ return true;
+ }
+ else
+ {
+ *val = range.LowerBound*.25*m + range.UpperBound*.75*m;
+ return true;
+ }
+ }
+ else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(rh))
+ {
+ *val = range.UpperBound*m;
+ return true;
+ }
+ else if (LADSPA_IS_HINT_DEFAULT_0(rh))
+ {
+ *val = 0.0;
+ return true;
+ }
+ else if (LADSPA_IS_HINT_DEFAULT_1(rh))
+ {
+ *val = 1.0;
+ return true;
+ }
+ else if (LADSPA_IS_HINT_DEFAULT_100(rh))
+ {
+ *val = 100.0;
+ return true;
+ }
+ else if (LADSPA_IS_HINT_DEFAULT_440(rh))
+ {
+ *val = 440.0;
+ return true;
+ }
+
+ // No default found. Set return value to 1.0, but return false.
+ *val = 1.0;
+ return false;
+}
+
+//---------------------------------------------------------
+// ladspaControlRange
+//---------------------------------------------------------
+
+void ladspaControlRange(const LADSPA_Descriptor* plugin, int i, float* min, float* max)
+ {
+ LADSPA_PortRangeHint range = plugin->PortRangeHints[i];
+ LADSPA_PortRangeHintDescriptor desc = range.HintDescriptor;
+ if (desc & LADSPA_HINT_TOGGLED) {
+ *min = 0.0;
+ *max = 1.0;
+ return;
+ }
+ float m = 1.0;
+ if (desc & LADSPA_HINT_SAMPLE_RATE)
+ m = float(sampleRate);
+
+ if (desc & LADSPA_HINT_BOUNDED_BELOW)
+ *min = range.LowerBound * m;
+ else
+ *min = 0.0;
+ if (desc & LADSPA_HINT_BOUNDED_ABOVE)
+ *max = range.UpperBound * m;
+ else
+ *max = 1.0;
+ }
+
+//---------------------------------------------------------
+// Plugin
+//---------------------------------------------------------
+
+Plugin::Plugin(QFileInfo* f, const LADSPA_Descriptor* d, bool isDssi)
+{
+ _isDssi = isDssi;
+ #ifdef DSSI_SUPPORT
+ dssi_descr = NULL;
+ #endif
+
+ fi = *f;
+ plugin = NULL;
+ ladspa = NULL;
+ _handle = 0;
+ _references = 0;
+ _instNo = 0;
+ _label = QString(d->Label);
+ _name = QString(d->Name);
+ _uniqueID = d->UniqueID;
+ _maker = QString(d->Maker);
+ _copyright = QString(d->Copyright);
+
+ _portCount = d->PortCount;
+ //_portDescriptors = 0;
+ //if(_portCount)
+ // _portDescriptors = new LADSPA_PortDescriptor[_portCount];
+
+
+ _inports = 0;
+ _outports = 0;
+ _controlInPorts = 0;
+ _controlOutPorts = 0;
+ for(unsigned long k = 0; k < _portCount; ++k)
+ {
+ LADSPA_PortDescriptor pd = d->PortDescriptors[k];
+ //_portDescriptors[k] = pd;
+ if(pd & LADSPA_PORT_AUDIO)
+ {
+ if(pd & LADSPA_PORT_INPUT)
+ ++_inports;
+ else
+ if(pd & LADSPA_PORT_OUTPUT)
+ ++_outports;
+ }
+ else
+ if(pd & LADSPA_PORT_CONTROL)
+ {
+ if(pd & LADSPA_PORT_INPUT)
+ ++_controlInPorts;
+ else
+ if(pd & LADSPA_PORT_OUTPUT)
+ ++_controlOutPorts;
+ }
+ }
+
+ _inPlaceCapable = !LADSPA_IS_INPLACE_BROKEN(d->Properties);
+
+ // By T356. Blacklist vst plugins in-place configurable for now. At one point they
+ // were working with in-place here, but not now, and RJ also reported they weren't working.
+ // Fixes problem with vst plugins not working or feeding back loudly.
+ // I can only think of two things that made them stop working:
+ // 1): I switched back from Jack-2 to Jack-1
+ // 2): I changed winecfg audio to use Jack instead of ALSA.
+ // Will test later...
+ // Possibly the first one because under Mandriva2007.1 (Jack-1), no matter how hard I tried,
+ // the same problem existed. It may have been when using Jack-2 with Mandriva2009 that they worked.
+ // Apparently the plugins are lying about their in-place capability.
+ // Quote:
+ /* Property LADSPA_PROPERTY_INPLACE_BROKEN indicates that the plugin
+ may cease to work correctly if the host elects to use the same data
+ location for both input and output (see connect_port()). This
+ should be avoided as enabling this flag makes it impossible for
+ hosts to use the plugin to process audio `in-place.' */
+ // Examination of all my ladspa and vst synths and effects plugins showed only one -
+ // EnsembleLite (EnsLite VST) has the flag set, but it is a vst synth and is not involved here!
+ // Yet many (all?) ladspa vst effect plugins exhibit this problem.
+ // Changed by Tim. p3.3.14
+ if ((_inports != _outports) || (fi.baseName(true) == QString("dssi-vst") && !config.vstInPlace))
+ _inPlaceCapable = false;
+}
+
+Plugin::~Plugin()
+{
+ //if(_portDescriptors)
+ // delete[] _portDescriptors;
+}
+
+//---------------------------------------------------------
+// incReferences
+//---------------------------------------------------------
+
+int Plugin::incReferences(int val)
+{
+ #ifdef PLUGIN_DEBUGIN
+ fprintf(stderr, "Plugin::incReferences _references:%d val:%d\n", _references, val);
+ #endif
+
+ int newref = _references + val;
+
+ if(newref == 0)
+ {
+ _references = 0;
+ if(_handle)
+ {
+ #ifdef PLUGIN_DEBUGIN
+ fprintf(stderr, "Plugin::incReferences no more instances, closing library\n");
+ #endif
+
+ dlclose(_handle);
+ }
+
+ _handle = 0;
+ ladspa = NULL;
+ plugin = NULL;
+ rpIdx.clear();
+
+ #ifdef DSSI_SUPPORT
+ dssi_descr = NULL;
+ #endif
+
+ return 0;
+ }
+
+ //if(_references == 0)
+ if(_handle == 0)
+ {
+ //_references = 0;
+ _handle = dlopen(fi.filePath().latin1(), RTLD_NOW);
+ //handle = dlopen(fi.absFilePath().latin1(), RTLD_NOW);
+
+ if(_handle == 0)
+ {
+ fprintf(stderr, "Plugin::incReferences dlopen(%s) failed: %s\n",
+ fi.filePath().latin1(), dlerror());
+ //fi.absFilePath().latin1(), dlerror());
+ return 0;
+ }
+
+ #ifdef DSSI_SUPPORT
+ DSSI_Descriptor_Function dssi = (DSSI_Descriptor_Function)dlsym(_handle, "dssi_descriptor");
+ if(dssi)
+ {
+ const DSSI_Descriptor* descr;
+ for(int i = 0;; ++i)
+ {
+ descr = dssi(i);
+ if(descr == NULL)
+ break;
+
+ QString label(descr->LADSPA_Plugin->Label);
+ // Listing effect plugins only while excluding synths:
+ // Do exactly what dssi-vst.cpp does for listing ladspa plugins.
+ //if(label == _name &&
+ if(label == _label &&
+ !descr->run_synth &&
+ !descr->run_synth_adding &&
+ !descr->run_multiple_synths &&
+ !descr->run_multiple_synths_adding)
+ {
+ _isDssi = true;
+ ladspa = NULL;
+ dssi_descr = descr;
+ plugin = descr->LADSPA_Plugin;
+ break;
+ }
+ }
+ }
+ else
+ #endif // DSSI_SUPPORT
+ {
+ LADSPA_Descriptor_Function ladspadf = (LADSPA_Descriptor_Function)dlsym(_handle, "ladspa_descriptor");
+ if(ladspadf)
+ {
+ const LADSPA_Descriptor* descr;
+ for(int i = 0;; ++i)
+ {
+ descr = ladspadf(i);
+ if(descr == NULL)
+ break;
+
+ QString label(descr->Label);
+ //if(label == _name)
+ if(label == _label)
+ {
+ _isDssi = false;
+ ladspa = ladspadf;
+ plugin = descr;
+
+ #ifdef DSSI_SUPPORT
+ dssi_descr = NULL;
+ #endif
+
+ break;
+ }
+ }
+ }
+ }
+
+ if(plugin != NULL)
+ {
+ //_instNo = 0;
+ _name = QString(plugin->Name);
+ _uniqueID = plugin->UniqueID;
+ _maker = QString(plugin->Maker);
+ _copyright = QString(plugin->Copyright);
+
+ //if(_portDescriptors)
+ // delete[] _portDescriptors;
+ //_portDescriptors = 0;
+ _portCount = plugin->PortCount;
+ //if(_portCount)
+ // _portDescriptors = new LADSPA_PortDescriptor[_portCount];
+
+ _inports = 0;
+ _outports = 0;
+ _controlInPorts = 0;
+ _controlOutPorts = 0;
+ for(unsigned long k = 0; k < _portCount; ++k)
+ {
+ LADSPA_PortDescriptor pd = plugin->PortDescriptors[k];
+ //_portDescriptors[k] = pd;
+ if(pd & LADSPA_PORT_AUDIO)
+ {
+ if(pd & LADSPA_PORT_INPUT)
+ ++_inports;
+ else
+ if(pd & LADSPA_PORT_OUTPUT)
+ ++_outports;
+
+ rpIdx.push_back((unsigned long)-1);
+ }
+ else
+ if(pd & LADSPA_PORT_CONTROL)
+ {
+ if(pd & LADSPA_PORT_INPUT)
+ {
+ rpIdx.push_back(_controlInPorts);
+ ++_controlInPorts;
+ }
+ else
+ if(pd & LADSPA_PORT_OUTPUT)
+ {
+ rpIdx.push_back((unsigned long)-1);
+ ++_controlOutPorts;
+ }
+ }
+ }
+
+ _inPlaceCapable = !LADSPA_IS_INPLACE_BROKEN(plugin->Properties);
+
+ // Blacklist vst plugins in-place configurable for now.
+ if ((_inports != _outports) || (fi.baseName(true) == QString("dssi-vst") && !config.vstInPlace))
+ _inPlaceCapable = false;
+ }
+ }
+
+ if(plugin == NULL)
+ {
+ dlclose(_handle);
+ _handle = 0;
+ _references = 0;
+ fprintf(stderr, "Plugin::incReferences Error: %s no plugin!\n", fi.filePath().latin1());
+ return 0;
+ }
+
+ _references = newref;
+
+ //QString guiPath(info.dirPath() + "/" + info.baseName());
+ //QDir guiDir(guiPath, "*", QDir::Unsorted, QDir::Files);
+ //_hasGui = guiDir.exists();
+
+ return _references;
+}
+
+//---------------------------------------------------------
+// range
+//---------------------------------------------------------
+
+void Plugin::range(unsigned long i, float* min, float* max) const
+ {
+ LADSPA_PortRangeHint range = plugin->PortRangeHints[i];
+ LADSPA_PortRangeHintDescriptor desc = range.HintDescriptor;
+ if (desc & LADSPA_HINT_TOGGLED) {
+ *min = 0.0;
+ *max = 1.0;
+ return;
+ }
+ float m = 1.0;
+ if (desc & LADSPA_HINT_SAMPLE_RATE)
+ m = float(sampleRate);
+
+ if (desc & LADSPA_HINT_BOUNDED_BELOW)
+ *min = range.LowerBound * m;
+ else
+ *min = 0.0;
+ if (desc & LADSPA_HINT_BOUNDED_ABOVE)
+ *max = range.UpperBound * m;
+ else
+ *max = 1.0;
+ }
+
+//---------------------------------------------------------
+// defaultValue
+//---------------------------------------------------------
+
+double Plugin::defaultValue(unsigned long port) const
+{
+ if(port >= plugin->PortCount)
+ return 0.0;
+
+ LADSPA_PortRangeHint range = plugin->PortRangeHints[port];
+ LADSPA_PortRangeHintDescriptor rh = range.HintDescriptor;
+ double val = 1.0;
+ if (LADSPA_IS_HINT_DEFAULT_MINIMUM(rh))
+ val = range.LowerBound;
+ else if (LADSPA_IS_HINT_DEFAULT_LOW(rh))
+ if (LADSPA_IS_HINT_LOGARITHMIC(range.HintDescriptor))
+ val = exp(fast_log10(range.LowerBound) * .75 +
+ log(range.UpperBound) * .25);
+ else
+ val = range.LowerBound*.75 + range.UpperBound*.25;
+ else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(rh))
+ if (LADSPA_IS_HINT_LOGARITHMIC(range.HintDescriptor))
+ val = exp(log(range.LowerBound) * .5 +
+ log(range.UpperBound) * .5);
+ else
+ val = range.LowerBound*.5 + range.UpperBound*.5;
+ else if (LADSPA_IS_HINT_DEFAULT_HIGH(rh))
+ if (LADSPA_IS_HINT_LOGARITHMIC(range.HintDescriptor))
+ val = exp(log(range.LowerBound) * .25 +
+ log(range.UpperBound) * .75);
+ else
+ val = range.LowerBound*.25 + range.UpperBound*.75;
+ else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(rh))
+ val = range.UpperBound;
+ else if (LADSPA_IS_HINT_DEFAULT_0(rh))
+ val = 0.0;
+ else if (LADSPA_IS_HINT_DEFAULT_1(rh))
+ val = 1.0;
+ else if (LADSPA_IS_HINT_DEFAULT_100(rh))
+ val = 100.0;
+ else if (LADSPA_IS_HINT_DEFAULT_440(rh))
+ val = 440.0;
+
+ return val;
+}
+
+//---------------------------------------------------------
+// loadPluginLib
+//---------------------------------------------------------
+
+static void loadPluginLib(QFileInfo* fi)
+{
+ void* handle = dlopen(fi->filePath().ascii(), RTLD_NOW);
+ if (handle == 0) {
+ fprintf(stderr, "dlopen(%s) failed: %s\n",
+ fi->filePath().ascii(), dlerror());
+ return;
+ }
+
+ #ifdef DSSI_SUPPORT
+ DSSI_Descriptor_Function dssi = (DSSI_Descriptor_Function)dlsym(handle, "dssi_descriptor");
+ if(dssi)
+ {
+ const DSSI_Descriptor* descr;
+ for (int i = 0;; ++i)
+ {
+ descr = dssi(i);
+ if (descr == 0)
+ break;
+
+ // Listing effect plugins only while excluding synths:
+ // Do exactly what dssi-vst.cpp does for listing ladspa plugins.
+ if(!descr->run_synth &&
+ !descr->run_synth_adding &&
+ !descr->run_multiple_synths &&
+ !descr->run_multiple_synths_adding)
+ {
+ // Make sure it doesn't already exist.
+ if(plugins.find(fi->baseName(true), QString(descr->LADSPA_Plugin->Label)) != 0)
+ continue;
+
+ #ifdef PLUGIN_DEBUGIN
+ fprintf(stderr, "loadPluginLib: dssi effect name:%s inPlaceBroken:%d\n", descr->LADSPA_Plugin->Name, LADSPA_IS_INPLACE_BROKEN(descr->LADSPA_Plugin->Properties));
+ #endif
+
+ //LADSPA_Properties properties = descr->LADSPA_Plugin->Properties;
+ //bool inPlaceBroken = LADSPA_IS_INPLACE_BROKEN(properties);
+ //plugins.add(fi, descr, !inPlaceBroken);
+ plugins.add(fi, descr->LADSPA_Plugin, true);
+ }
+ }
+ }
+ else
+ #endif
+ {
+ LADSPA_Descriptor_Function ladspa = (LADSPA_Descriptor_Function)dlsym(handle, "ladspa_descriptor");
+ if(!ladspa)
+ {
+ const char *txt = dlerror();
+ if(txt)
+ {
+ fprintf(stderr,
+ "Unable to find ladspa_descriptor() function in plugin "
+ "library file \"%s\": %s.\n"
+ "Are you sure this is a LADSPA plugin file?\n",
+ fi->filePath().ascii(),
+ txt);
+ }
+ dlclose(handle);
+ return;
+ }
+
+ const LADSPA_Descriptor* descr;
+ for (int i = 0;; ++i)
+ {
+ descr = ladspa(i);
+ if (descr == NULL)
+ break;
+
+ // Make sure it doesn't already exist.
+ if(plugins.find(fi->baseName(true), QString(descr->Label)) != 0)
+ continue;
+
+ #ifdef PLUGIN_DEBUGIN
+ fprintf(stderr, "loadPluginLib: ladspa effect name:%s inPlaceBroken:%d\n", descr->Name, LADSPA_IS_INPLACE_BROKEN(descr->Properties));
+ #endif
+
+ //LADSPA_Properties properties = descr->Properties;
+ //bool inPlaceBroken = LADSPA_IS_INPLACE_BROKEN(properties);
+ //plugins.add(fi, ladspa, descr, !inPlaceBroken);
+ plugins.add(fi, descr);
+ }
+ }
+
+ dlclose(handle);
+}
+
+//---------------------------------------------------------
+// loadPluginDir
+//---------------------------------------------------------
+
+static void loadPluginDir(const QString& s)
+ {
+ if (debugMsg)
+ printf("scan ladspa plugin dir <%s>\n", s.latin1());
+ QDir pluginDir(s, QString("*.so")); // ddskrjo
+ if (pluginDir.exists()) {
+ QFileInfoList list = pluginDir.entryInfoList();
+ QFileInfoListIterator it=list.begin();
+ while(it != list.end()) {
+ loadPluginLib(&*it);
+ ++it;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// initPlugins
+//---------------------------------------------------------
+
+void initPlugins()
+ {
+ loadPluginDir(museGlobalLib + QString("/plugins"));
+
+ const char* p = 0;
+
+ // Take care of DSSI plugins first...
+ #ifdef DSSI_SUPPORT
+ const char* dssiPath = getenv("DSSI_PATH");
+ if (dssiPath == 0)
+ dssiPath = "/usr/local/lib64/dssi:/usr/lib64/dssi:/usr/local/lib/dssi:/usr/lib/dssi";
+ p = dssiPath;
+ while (*p != '\0') {
+ const char* pe = p;
+ while (*pe != ':' && *pe != '\0')
+ pe++;
+
+ int n = pe - p;
+ if (n) {
+ char* buffer = new char[n + 1];
+ strncpy(buffer, p, n);
+ buffer[n] = '\0';
+ loadPluginDir(QString(buffer));
+ delete[] buffer;
+ }
+ p = pe;
+ if (*p == ':')
+ p++;
+ }
+ #endif
+
+ // Now do LADSPA plugins...
+ const char* ladspaPath = getenv("LADSPA_PATH");
+ if (ladspaPath == 0)
+ ladspaPath = "/usr/local/lib64/ladspa:/usr/lib64/ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa";
+ p = ladspaPath;
+
+ if(debugMsg)
+ fprintf(stderr, "loadPluginLib: ladspa path:%s\n", ladspaPath);
+
+ while (*p != '\0') {
+ const char* pe = p;
+ while (*pe != ':' && *pe != '\0')
+ pe++;
+
+ int n = pe - p;
+ if (n) {
+ char* buffer = new char[n + 1];
+ strncpy(buffer, p, n);
+ buffer[n] = '\0';
+ if(debugMsg)
+ fprintf(stderr, "loadPluginLib: loading ladspa dir:%s\n", buffer);
+
+ loadPluginDir(QString(buffer));
+ delete[] buffer;
+ }
+ p = pe;
+ if (*p == ':')
+ p++;
+ }
+ }
+
+//---------------------------------------------------------
+// find
+//---------------------------------------------------------
+
+Plugin* PluginList::find(const QString& file, const QString& name)
+ {
+ for (iPlugin i = begin(); i != end(); ++i) {
+ if ((file == i->lib()) && (name == i->label()))
+ return &*i;
+ }
+ //printf("Plugin <%s> not found\n", name.ascii());
+ return 0;
+ }
+
+//---------------------------------------------------------
+// Pipeline
+//---------------------------------------------------------
+
+Pipeline::Pipeline()
+ : std::vector<PluginI*>()
+ {
+ // Added by Tim. p3.3.15
+ for (int i = 0; i < MAX_CHANNELS; ++i)
+ posix_memalign((void**)(buffer + i), 16, sizeof(float) * segmentSize);
+
+ for (int i = 0; i < PipelineDepth; ++i)
+ push_back(0);
+ }
+
+//---------------------------------------------------------
+// ~Pipeline
+//---------------------------------------------------------
+
+Pipeline::~Pipeline()
+ {
+ removeAll();
+ for (int i = 0; i < MAX_CHANNELS; ++i)
+ ::free(buffer[i]);
+ }
+
+//---------------------------------------------------------
+// setChannels
+//---------------------------------------------------------
+
+void Pipeline::setChannels(int n)
+ {
+ for (int i = 0; i < PipelineDepth; ++i)
+ if ((*this)[i])
+ (*this)[i]->setChannels(n);
+ }
+
+//---------------------------------------------------------
+// insert
+// give ownership of object plugin to Pipeline
+//---------------------------------------------------------
+
+void Pipeline::insert(PluginI* plugin, int index)
+ {
+ remove(index);
+ (*this)[index] = plugin;
+ }
+
+//---------------------------------------------------------
+// remove
+//---------------------------------------------------------
+
+void Pipeline::remove(int index)
+ {
+ PluginI* plugin = (*this)[index];
+ if (plugin)
+ delete plugin;
+ (*this)[index] = 0;
+ }
+
+//---------------------------------------------------------
+// removeAll
+//---------------------------------------------------------
+
+void Pipeline::removeAll()
+ {
+ for (int i = 0; i < PipelineDepth; ++i)
+ remove(i);
+ }
+
+//---------------------------------------------------------
+// isOn
+//---------------------------------------------------------
+
+bool Pipeline::isOn(int idx) const
+ {
+ PluginI* p = (*this)[idx];
+ if (p)
+ return p->on();
+ return false;
+ }
+
+//---------------------------------------------------------
+// setOn
+//---------------------------------------------------------
+
+void Pipeline::setOn(int idx, bool flag)
+ {
+ PluginI* p = (*this)[idx];
+ if (p) {
+ p->setOn(flag);
+ if (p->gui())
+ p->gui()->setOn(flag);
+ }
+ }
+
+//---------------------------------------------------------
+// label
+//---------------------------------------------------------
+
+QString Pipeline::label(int idx) const
+ {
+ PluginI* p = (*this)[idx];
+ if (p)
+ return p->label();
+ return QString("");
+ }
+
+//---------------------------------------------------------
+// name
+//---------------------------------------------------------
+
+QString Pipeline::name(int idx) const
+ {
+ PluginI* p = (*this)[idx];
+ if (p)
+ return p->name();
+ return QString("empty");
+ }
+
+//---------------------------------------------------------
+// empty
+//---------------------------------------------------------
+
+bool Pipeline::empty(int idx) const
+ {
+ PluginI* p = (*this)[idx];
+ return p == 0;
+ }
+
+//---------------------------------------------------------
+// move
+//---------------------------------------------------------
+
+void Pipeline::move(int idx, bool up)
+{
+ PluginI* p1 = (*this)[idx];
+ if (up)
+ {
+ (*this)[idx] = (*this)[idx-1];
+
+ if((*this)[idx])
+ (*this)[idx]->setID(idx);
+
+ (*this)[idx-1] = p1;
+
+ if(p1)
+ {
+ p1->setID(idx - 1);
+ if(p1->track())
+ audio->msgSwapControllerIDX(p1->track(), idx, idx - 1);
+ }
+ }
+ else
+ {
+ (*this)[idx] = (*this)[idx+1];
+
+ if((*this)[idx])
+ (*this)[idx]->setID(idx);
+
+ (*this)[idx+1] = p1;
+
+ if(p1)
+ {
+ p1->setID(idx + 1);
+ if(p1->track())
+ audio->msgSwapControllerIDX(p1->track(), idx, idx + 1);
+ }
+ }
+}
+
+//---------------------------------------------------------
+// isDssiPlugin
+//---------------------------------------------------------
+
+bool Pipeline::isDssiPlugin(int idx) const
+{
+ PluginI* p = (*this)[idx];
+ if(p)
+ return p->isDssiPlugin();
+
+ return false;
+}
+
+//---------------------------------------------------------
+// showGui
+//---------------------------------------------------------
+
+void Pipeline::showGui(int idx, bool flag)
+ {
+ PluginI* p = (*this)[idx];
+ if (p)
+ p->showGui(flag);
+ }
+
+//---------------------------------------------------------
+// showNativeGui
+//---------------------------------------------------------
+
+void Pipeline::showNativeGui(int idx, bool flag)
+ {
+ #ifdef OSC_SUPPORT
+ PluginI* p = (*this)[idx];
+ if (p)
+ p->oscIF().oscShowGui(flag);
+ #endif
+ }
+
+//---------------------------------------------------------
+// deleteGui
+//---------------------------------------------------------
+
+void Pipeline::deleteGui(int idx)
+{
+ if(idx >= PipelineDepth)
+ return;
+ PluginI* p = (*this)[idx];
+ if(p)
+ p->deleteGui();
+}
+
+//---------------------------------------------------------
+// deleteAllGuis
+//---------------------------------------------------------
+
+void Pipeline::deleteAllGuis()
+{
+ for(int i = 0; i < PipelineDepth; i++)
+ deleteGui(i);
+}
+
+//---------------------------------------------------------
+// guiVisible
+//---------------------------------------------------------
+
+bool Pipeline::guiVisible(int idx)
+ {
+ PluginI* p = (*this)[idx];
+ if (p)
+ return p->guiVisible();
+ return false;
+ }
+
+//---------------------------------------------------------
+// nativeGuiVisible
+//---------------------------------------------------------
+
+bool Pipeline::nativeGuiVisible(int idx)
+ {
+ PluginI* p = (*this)[idx];
+ if (p)
+ return p->nativeGuiVisible();
+ return false;
+ }
+
+//---------------------------------------------------------
+// apply
+//---------------------------------------------------------
+
+void Pipeline::apply(int ports, unsigned long nframes, float** buffer1)
+{
+ // prepare a second set of buffers in case a plugin is not
+ // capable of inPlace processing
+
+ // Removed by Tim. p3.3.15
+ //float* buffer2[ports];
+ //float data[nframes * ports];
+ //for (int i = 0; i < ports; ++i)
+ // buffer2[i] = data + i * nframes;
+
+ // p3.3.41
+ //fprintf(stderr, "Pipeline::apply data: nframes:%ld %e %e %e %e\n", nframes, buffer1[0][0], buffer1[0][1], buffer1[0][2], buffer1[0][3]);
+
+ bool swap = false;
+
+ for (iPluginI ip = begin(); ip != end(); ++ip) {
+ PluginI* p = *ip;
+ if (p && p->on()) {
+ if (p->inPlaceCapable())
+ {
+ if (swap)
+ //p->connect(ports, buffer2, buffer2);
+ p->connect(ports, buffer, buffer);
+ else
+ p->connect(ports, buffer1, buffer1);
+ }
+ else
+ {
+ if (swap)
+ //p->connect(ports, buffer2, buffer1);
+ p->connect(ports, buffer, buffer1);
+ else
+ //p->connect(ports, buffer1, buffer2);
+ p->connect(ports, buffer1, buffer);
+ swap = !swap;
+ }
+ p->apply(nframes);
+ }
+ }
+ if (swap)
+ {
+ for (int i = 0; i < ports; ++i)
+ //memcpy(buffer1[i], buffer2[i], sizeof(float) * nframes);
+ //memcpy(buffer1[i], buffer[i], sizeof(float) * nframes);
+ AL::dsp->cpy(buffer1[i], buffer[i], nframes);
+ }
+
+ // p3.3.41
+ //fprintf(stderr, "Pipeline::apply after data: nframes:%ld %e %e %e %e\n", nframes, buffer1[0][0], buffer1[0][1], buffer1[0][2], buffer1[0][3]);
+
+}
+
+//---------------------------------------------------------
+// PluginI
+//---------------------------------------------------------
+
+void PluginI::init()
+ {
+ _plugin = 0;
+ instances = 0;
+ handle = 0;
+ controls = 0;
+ controlsOut = 0;
+ controlPorts = 0;
+ controlOutPorts = 0;
+ _gui = 0;
+ _on = true;
+ initControlValues = false;
+ _showNativeGuiPending = false;
+ }
+
+PluginI::PluginI()
+ {
+ _id = -1;
+ _track = 0;
+
+ init();
+ }
+
+//---------------------------------------------------------
+// PluginI
+//---------------------------------------------------------
+
+PluginI::~PluginI()
+ {
+ if (_plugin) {
+ deactivate();
+ _plugin->incReferences(-1);
+ }
+ if (_gui)
+ delete _gui;
+ if (controlsOut)
+ delete[] controlsOut;
+ if (controls)
+ delete[] controls;
+ if (handle)
+ delete[] handle;
+ }
+
+//---------------------------------------------------------
+// setID
+//---------------------------------------------------------
+
+void PluginI::setID(int i)
+{
+ _id = i;
+}
+
+//---------------------------------------------------------
+// updateControllers
+//---------------------------------------------------------
+
+void PluginI::updateControllers()
+{
+ if(!_track)
+ return;
+
+ for(int i = 0; i < controlPorts; ++i)
+ //audio->msgSetPluginCtrlVal(this, genACnum(_id, i), controls[i].val);
+ // p3.3.43
+ audio->msgSetPluginCtrlVal(_track, genACnum(_id, i), controls[i].val);
+}
+
+//---------------------------------------------------------
+// valueType
+//---------------------------------------------------------
+
+CtrlValueType PluginI::valueType() const
+ {
+ return VAL_LINEAR;
+ }
+
+//---------------------------------------------------------
+// setChannel
+//---------------------------------------------------------
+
+void PluginI::setChannels(int c)
+{
+ // p3.3.41 Removed
+ //if (channel == c)
+ // return;
+
+ // p3.3.41
+ channel = c;
+
+ //int ni = c / _plugin->outports();
+ //if (ni == 0)
+ // ni = 1;
+ // p3.3.41 Some plugins have zero out ports, causing exception with the above line.
+ // Also, pick the least number of ins or outs, and base the number of instances on that.
+ unsigned long ins = _plugin->inports();
+ unsigned long outs = _plugin->outports();
+ /*
+ unsigned long minports = ~0ul;
+ if(outs && outs < minports)
+ minports = outs;
+ if(ins && ins < minports)
+ minports = ins;
+ if(minports == ~0ul)
+ minports = 1;
+ int ni = c / minports;
+ */
+ int ni = 1;
+ if(outs)
+ ni = c / outs;
+ else
+ if(ins)
+ ni = c / ins;
+
+ if(ni < 1)
+ ni = 1;
+
+ if (ni == instances)
+ return;
+
+ // p3.3.41 Moved above.
+ //channel = c;
+
+ // remove old instances:
+ deactivate();
+ delete[] handle;
+ instances = ni;
+ handle = new LADSPA_Handle[instances];
+ for (int i = 0; i < instances; ++i) {
+ handle[i] = _plugin->instantiate();
+ if (handle[i] == NULL) {
+ printf("cannot instantiate instance %d\n", i);
+ return;
+ }
+ }
+
+ int curPort = 0;
+ int curOutPort = 0;
+ unsigned long ports = _plugin->ports();
+ for (unsigned long k = 0; k < ports; ++k)
+ {
+ LADSPA_PortDescriptor pd = _plugin->portd(k);
+ if (pd & LADSPA_PORT_CONTROL)
+ {
+ if(pd & LADSPA_PORT_INPUT)
+ {
+ for (int i = 0; i < instances; ++i)
+ _plugin->connectPort(handle[i], k, &controls[curPort].val);
+ controls[curPort].idx = k;
+ ++curPort;
+ }
+ else
+ if(pd & LADSPA_PORT_OUTPUT)
+ {
+ for (int i = 0; i < instances; ++i)
+ _plugin->connectPort(handle[i], k, &controlsOut[curOutPort].val);
+ controlsOut[curOutPort].idx = k;
+ ++curOutPort;
+ }
+ }
+ }
+
+ activate();
+}
+
+//---------------------------------------------------------
+// defaultValue
+//---------------------------------------------------------
+
+double PluginI::defaultValue(unsigned int param) const
+{
+//#warning controlPorts should really be unsigned
+ if(param >= (unsigned)controlPorts)
+ return 0.0;
+
+ return _plugin->defaultValue(controls[param].idx);
+}
+
+LADSPA_Handle Plugin::instantiate()
+{
+ LADSPA_Handle h = plugin->instantiate(plugin, sampleRate);
+ if(h == NULL)
+ {
+ fprintf(stderr, "Plugin::instantiate() Error: plugin:%s instantiate failed!\n", plugin->Label);
+ return NULL;
+ }
+
+ //QString guiPath(info.dirPath() + "/" + info.baseName());
+ //QDir guiDir(guiPath, "*", QDir::Unsorted, QDir::Files);
+ //_hasGui = guiDir.exists();
+
+ return h;
+}
+
+//---------------------------------------------------------
+// initPluginInstance
+// return true on error
+//---------------------------------------------------------
+
+bool PluginI::initPluginInstance(Plugin* plug, int c)
+ {
+ channel = c;
+ if(plug == 0)
+ {
+ printf("initPluginInstance: zero plugin\n");
+ return true;
+ }
+ _plugin = plug;
+
+ _plugin->incReferences(1);
+
+ #ifdef OSC_SUPPORT
+ _oscif.oscSetPluginI(this);
+ #endif
+
+ QString inst("-" + QString::number(_plugin->instNo()));
+ _name = _plugin->name() + inst;
+ _label = _plugin->label() + inst;
+
+ //instances = channel/plug->outports();
+ // p3.3.41 Some plugins have zero out ports, causing exception with the above line.
+ // Also, pick the least number of ins or outs, and base the number of instances on that.
+ unsigned long ins = plug->inports();
+ unsigned long outs = plug->outports();
+ /*
+ unsigned long minports = ~0ul;
+ if(outs && outs < minports)
+ minports = outs;
+ if(ins && ins < minports)
+ minports = ins;
+ if(minports == ~0ul)
+ minports = 1;
+ instances = channel / minports;
+ if(instances < 1)
+ instances = 1;
+ */
+ if(outs)
+ {
+ instances = channel / outs;
+ if(instances < 1)
+ instances = 1;
+ }
+ else
+ if(ins)
+ {
+ instances = channel / ins;
+ if(instances < 1)
+ instances = 1;
+ }
+ else
+ instances = 1;
+
+ handle = new LADSPA_Handle[instances];
+ for(int i = 0; i < instances; ++i)
+ {
+ #ifdef PLUGIN_DEBUGIN
+ fprintf(stderr, "PluginI::initPluginInstance instance:%d\n", i);
+ #endif
+
+ handle[i] = _plugin->instantiate();
+ //if (handle[i] == 0)
+ if(handle[i] == NULL)
+ return true;
+ }
+
+ unsigned long ports = _plugin->ports();
+
+ controlPorts = 0;
+ controlOutPorts = 0;
+
+ for(unsigned long k = 0; k < ports; ++k)
+ {
+ LADSPA_PortDescriptor pd = _plugin->portd(k);
+ if(pd & LADSPA_PORT_CONTROL)
+ {
+ if(pd & LADSPA_PORT_INPUT)
+ ++controlPorts;
+ else
+ if(pd & LADSPA_PORT_OUTPUT)
+ ++controlOutPorts;
+ }
+ }
+
+ controls = new Port[controlPorts];
+ controlsOut = new Port[controlOutPorts];
+
+ int i = 0;
+ int ii = 0;
+ for(unsigned long k = 0; k < ports; ++k)
+ {
+ LADSPA_PortDescriptor pd = _plugin->portd(k);
+ if(pd & LADSPA_PORT_CONTROL)
+ {
+ if(pd & LADSPA_PORT_INPUT)
+ {
+ double val = _plugin->defaultValue(k);
+ controls[i].val = val;
+ controls[i].tmpVal = val;
+ controls[i].enCtrl = true;
+ controls[i].en2Ctrl = true;
+ ++i;
+ }
+ else
+ if(pd & LADSPA_PORT_OUTPUT)
+ {
+ //double val = _plugin->defaultValue(k);
+ controlsOut[ii].val = 0.0;
+ controlsOut[ii].tmpVal = 0.0;
+ controlsOut[ii].enCtrl = false;
+ controlsOut[ii].en2Ctrl = false;
+ ++ii;
+ }
+ }
+ }
+ unsigned long curPort = 0;
+ unsigned long curOutPort = 0;
+ for(unsigned long k = 0; k < ports; ++k)
+ {
+ LADSPA_PortDescriptor pd = _plugin->portd(k);
+ if(pd & LADSPA_PORT_CONTROL)
+ {
+ if(pd & LADSPA_PORT_INPUT)
+ {
+ for(int i = 0; i < instances; ++i)
+ _plugin->connectPort(handle[i], k, &controls[curPort].val);
+ controls[curPort].idx = k;
+ ++curPort;
+ }
+ else
+ if(pd & LADSPA_PORT_OUTPUT)
+ {
+ for(int i = 0; i < instances; ++i)
+ _plugin->connectPort(handle[i], k, &controlsOut[curOutPort].val);
+ controlsOut[curOutPort].idx = k;
+ ++curOutPort;
+ }
+ }
+ }
+ activate();
+ return false;
+ }
+
+//---------------------------------------------------------
+// connect
+//---------------------------------------------------------
+
+void PluginI::connect(int ports, float** src, float** dst)
+ {
+ int port = 0;
+ for (int i = 0; i < instances; ++i) {
+ for (unsigned long k = 0; k < _plugin->ports(); ++k) {
+ if (isAudioIn(k)) {
+ _plugin->connectPort(handle[i], k, src[port]);
+ port = (port + 1) % ports;
+ }
+ }
+ }
+ port = 0;
+ for (int i = 0; i < instances; ++i) {
+ for (unsigned long k = 0; k < _plugin->ports(); ++k) {
+ if (isAudioOut(k)) {
+ _plugin->connectPort(handle[i], k, dst[port]);
+ port = (port + 1) % ports; // overwrite output?
+// ++port;
+// if (port >= ports) {
+// return;
+// }
+ }
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// deactivate
+//---------------------------------------------------------
+
+void PluginI::deactivate()
+ {
+ for (int i = 0; i < instances; ++i) {
+ _plugin->deactivate(handle[i]);
+ _plugin->cleanup(handle[i]);
+ }
+ }
+
+//---------------------------------------------------------
+// activate
+//---------------------------------------------------------
+
+void PluginI::activate()
+ {
+ for (int i = 0; i < instances; ++i)
+ _plugin->activate(handle[i]);
+ if (initControlValues) {
+ for (int i = 0; i < controlPorts; ++i) {
+ controls[i].val = controls[i].tmpVal;
+ }
+ }
+ else {
+ //
+ // get initial control values from plugin
+ //
+ for (int i = 0; i < controlPorts; ++i) {
+ controls[i].tmpVal = controls[i].val;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// setControl
+// set plugin instance controller value by name
+//---------------------------------------------------------
+
+bool PluginI::setControl(const QString& s, double val)
+ {
+ for (int i = 0; i < controlPorts; ++i) {
+ if (_plugin->portName(controls[i].idx) == s) {
+ controls[i].val = controls[i].tmpVal = val;
+ return false;
+ }
+ }
+ printf("PluginI:setControl(%s, %f) controller not found\n",
+ s.latin1(), val);
+ return true;
+ }
+
+//---------------------------------------------------------
+// saveConfiguration
+//---------------------------------------------------------
+
+void PluginI::writeConfiguration(int level, Xml& xml)
+ {
+ xml.tag(level++, "plugin file=\"%s\" label=\"%s\" channel=\"%d\"",
+ //_plugin->lib().latin1(), _plugin->label().latin1(), instances * _plugin->inports());
+ // p3.3.41
+ //_plugin->lib().latin1(), _plugin->label().latin1(), channel);
+ Xml::xmlString(_plugin->lib()).latin1(), Xml::xmlString(_plugin->label()).latin1(), channel);
+
+ for (int i = 0; i < controlPorts; ++i) {
+ int idx = controls[i].idx;
+ QString s("control name=\"%1\" val=\"%2\" /");
+ //xml.tag(level, s.arg(_plugin->portName(idx)).arg(controls[i].tmpVal).latin1());
+ xml.tag(level, s.arg(Xml::xmlString(_plugin->portName(idx)).latin1()).arg(controls[i].tmpVal).latin1());
+ }
+ if (_on == false)
+ xml.intTag(level, "on", _on);
+ if (guiVisible()) {
+ xml.intTag(level, "gui", 1);
+ xml.geometryTag(level, "geometry", _gui);
+ }
+ if (nativeGuiVisible()) {
+ xml.intTag(level, "nativegui", 1);
+ // TODO:
+ //xml.geometryTag(level, "nativegeometry", ?);
+ }
+ xml.tag(level--, "/plugin");
+ }
+
+//---------------------------------------------------------
+// loadControl
+//---------------------------------------------------------
+
+bool PluginI::loadControl(Xml& xml)
+ {
+ QString file;
+ QString label;
+ QString name("mops");
+ double val = 0.0;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return true;
+ case Xml::TagStart:
+ xml.unknown("PluginI-Control");
+ break;
+ case Xml::Attribut:
+ if (tag == "name")
+ name = xml.s2();
+ else if (tag == "val")
+ val = xml.s2().toDouble();
+ break;
+ case Xml::TagEnd:
+ if (tag == "control") {
+ if (setControl(name, val)) {
+ return false;
+ }
+ initControlValues = true;
+ }
+ return true;
+ default:
+ break;
+ }
+ }
+ return true;
+ }
+
+//---------------------------------------------------------
+// readConfiguration
+// return true on error
+//---------------------------------------------------------
+
+bool PluginI::readConfiguration(Xml& xml, bool readPreset)
+ {
+ QString file;
+ QString label;
+ if (!readPreset)
+ //instances = 1;
+ // p3.3.41
+ channel = 1;
+
+ for (;;) {
+ Xml::Token token(xml.parse());
+ const QString& tag(xml.s1());
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return true;
+ case Xml::TagStart:
+ if (!readPreset && _plugin == 0) {
+ _plugin = plugins.find(file, label);
+
+ //if (_plugin && initPluginInstance(_plugin, instances)) {
+ // p3.3.41
+ if (_plugin && initPluginInstance(_plugin, channel)) {
+ _plugin = 0;
+ xml.parse1();
+ break;
+ }
+ }
+ if (tag == "control")
+ loadControl(xml);
+ else if (tag == "on") {
+ bool flag = xml.parseInt();
+ if (!readPreset)
+ _on = flag;
+ }
+ else if (tag == "gui") {
+ bool flag = xml.parseInt();
+ showGui(flag);
+ }
+ else if (tag == "nativegui") {
+ // We can't tell OSC to show the native plugin gui
+ // until the parent track is added to the lists.
+ // OSC needs to find the plugin in the track lists.
+ // Use this 'pending' flag so it gets done later.
+ _showNativeGuiPending = xml.parseInt();
+ }
+ else if (tag == "geometry") {
+ QRect r(readGeometry(xml, tag));
+ if (_gui) {
+ _gui->resize(r.size());
+ _gui->move(r.topLeft());
+ }
+ }
+ else
+ xml.unknown("PluginI");
+ break;
+ case Xml::Attribut:
+ if (tag == "file") {
+ QString s = xml.s2();
+ if (readPreset) {
+ if (s != plugin()->lib()) {
+ printf("Error: Wrong preset type %s. Type must be a %s\n",
+ s.latin1(), plugin()->lib().latin1());
+ return true;
+ }
+ }
+ else {
+ file = s;
+ }
+ }
+ else if (tag == "label") {
+ if (!readPreset)
+ label = xml.s2();
+ }
+ else if (tag == "channel") {
+ if (!readPreset)
+ //instances = xml.s2().toInt();
+ // p3.3.41
+ channel = xml.s2().toInt();
+ }
+ break;
+ case Xml::TagEnd:
+ if (tag == "plugin") {
+ if (!readPreset && _plugin == 0) {
+ _plugin = plugins.find(file, label);
+ if (_plugin == 0)
+ return true;
+
+ //if (initPluginInstance(_plugin, instances))
+ // p3.3.41
+ if (initPluginInstance(_plugin, channel))
+ return true;
+ }
+ if (_gui)
+ _gui->updateValues();
+ return false;
+ }
+ return true;
+ default:
+ break;
+ }
+ }
+ return true;
+ }
+
+//---------------------------------------------------------
+// showGui
+//---------------------------------------------------------
+
+void PluginI::showGui()
+ {
+ if (_plugin) {
+ if (_gui == 0)
+ makeGui();
+ if (_gui->isVisible())
+ _gui->hide();
+ else
+ _gui->show();
+ }
+ }
+
+void PluginI::showGui(bool flag)
+ {
+ if (_plugin) {
+ if (flag) {
+ if (_gui == 0)
+ makeGui();
+ _gui->show();
+ }
+ else {
+ if (_gui)
+ _gui->hide();
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// guiVisible
+//---------------------------------------------------------
+
+bool PluginI::guiVisible()
+ {
+ return _gui && _gui->isVisible();
+ }
+
+//---------------------------------------------------------
+// showNativeGui
+//---------------------------------------------------------
+
+void PluginI::showNativeGui()
+{
+ #ifdef OSC_SUPPORT
+ if (_plugin)
+ {
+ if (_oscif.oscGuiVisible())
+ _oscif.oscShowGui(false);
+ else
+ _oscif.oscShowGui(true);
+ }
+ #endif
+ _showNativeGuiPending = false;
+}
+
+void PluginI::showNativeGui(bool flag)
+{
+ #ifdef OSC_SUPPORT
+ if(_plugin)
+ {
+ _oscif.oscShowGui(flag);
+ }
+ #endif
+ _showNativeGuiPending = false;
+}
+
+//---------------------------------------------------------
+// nativeGuiVisible
+//---------------------------------------------------------
+
+bool PluginI::nativeGuiVisible()
+{
+ #ifdef OSC_SUPPORT
+ return _oscif.oscGuiVisible();
+ #endif
+
+ return false;
+}
+
+//---------------------------------------------------------
+// makeGui
+//---------------------------------------------------------
+
+void PluginI::makeGui()
+ {
+ _gui = new PluginGui(this);
+ }
+
+//---------------------------------------------------------
+// deleteGui
+//---------------------------------------------------------
+void PluginI::deleteGui()
+{
+ if(_gui)
+ {
+ delete _gui;
+ _gui = 0;
+ }
+}
+
+//---------------------------------------------------------
+// enableAllControllers
+//---------------------------------------------------------
+
+void PluginI::enableAllControllers(bool v)
+{
+ for(int i = 0; i < controlPorts; ++i)
+ controls[i].enCtrl = v;
+}
+
+//---------------------------------------------------------
+// enable2AllControllers
+//---------------------------------------------------------
+
+void PluginI::enable2AllControllers(bool v)
+{
+ for(int i = 0; i < controlPorts; ++i)
+ controls[i].en2Ctrl = v;
+}
+
+//---------------------------------------------------------
+// apply
+//---------------------------------------------------------
+
+void PluginI::apply(int n)
+{
+ // Process control value changes.
+ //if(automation && _track && _track->automationType() != AUTO_OFF && _id != -1)
+ //{
+ // for(int i = 0; i < controlPorts; ++i)
+ // {
+ // if( controls[i].enCtrl && controls[i].en2Ctrl )
+ // controls[i].tmpVal = _track->pluginCtrlVal(genACnum(_id, i));
+ // }
+ //}
+
+ unsigned long ctls = controlPorts;
+ for(unsigned long k = 0; k < ctls; ++k)
+ {
+ // First, update the temporary value if needed...
+
+ #ifdef OSC_SUPPORT
+ // Process OSC gui input control fifo events.
+ // It is probably more important that these are processed so that they take precedence over all other
+ // events because OSC + DSSI/DSSI-VST are fussy about receiving feedback via these control ports, from GUI changes.
+
+ OscControlFifo* cfifo = _oscif.oscFifo(k);
+ //if(!cfifo)
+ // continue;
+
+ // If there are 'events' in the fifo, get exactly one 'event' per control per process cycle...
+ //if(!cfifo->isEmpty())
+ if(cfifo && !cfifo->isEmpty())
+ {
+ OscControlValue v = cfifo->get();
+
+ #ifdef PLUGIN_DEBUGIN
+ fprintf(stderr, "PluginI::apply OscControlFifo event input control number:%ld value:%f\n", k, v.value);
+ #endif
+
+ // Set the ladspa control port value.
+ controls[k].tmpVal = v.value;
+
+ // Need to update the automation value, otherwise it overwrites later with the last automation value.
+ if(_track && _id != -1)
+ {
+ // Since we are now in the audio thread context, there's no need to send a message,
+ // just modify directly.
+ //audio->msgSetPluginCtrlVal(this, genACnum(_id, k), controls[k].val);
+ // p3.3.43
+ //audio->msgSetPluginCtrlVal(_track, genACnum(_id, k), controls[k].val);
+ _track->setPluginCtrlVal(genACnum(_id, k), v.value);
+
+ // Record automation.
+ // NO! Take care of this immediately in the OSC control handler, because we don't want
+ // the silly delay associated with processing the fifo one-at-a-time here.
+
+ //AutomationType at = _track->automationType();
+ // TODO: Taken from our native gui control handlers.
+ // This may need modification or may cause problems -
+ // we don't have the luxury of access to the dssi gui controls !
+ //if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH))
+ // enableController(k, false);
+ //_track->recordAutomation(id, v.value);
+ }
+ }
+ else
+ #endif // OSC_SUPPORT
+ {
+ // Process automation control value.
+ if(automation && _track && _track->automationType() != AUTO_OFF && _id != -1)
+ {
+ if(controls[k].enCtrl && controls[k].en2Ctrl )
+ controls[k].tmpVal = _track->pluginCtrlVal(genACnum(_id, k));
+ }
+ }
+
+ // Now update the actual value from the temporary value...
+ controls[k].val = controls[k].tmpVal;
+ }
+
+ //for (int i = 0; i < controlPorts; ++i)
+ // controls[i].val = controls[i].tmpVal;
+
+ for (int i = 0; i < instances; ++i)
+ {
+ // p3.3.41
+ //fprintf(stderr, "PluginI::apply handle %d\n", i);
+ _plugin->apply(handle[i], n);
+ }
+ }
+
+//---------------------------------------------------------
+// oscConfigure
+//---------------------------------------------------------
+
+#ifdef OSC_SUPPORT
+int Plugin::oscConfigure(LADSPA_Handle handle, const char* key, const char* value)
+ {
+ #ifdef PLUGIN_DEBUGIN
+ printf("Plugin::oscConfigure effect plugin label:%s key:%s value:%s\n", plugin->Label, key, value);
+ #endif
+
+ #ifdef DSSI_SUPPORT
+ if(!dssi_descr || !dssi_descr->configure)
+ return 0;
+
+ if (!strncmp(key, DSSI_RESERVED_CONFIGURE_PREFIX,
+ strlen(DSSI_RESERVED_CONFIGURE_PREFIX))) {
+ fprintf(stderr, "Plugin::oscConfigure OSC: UI for plugin '%s' attempted to use reserved configure key \"%s\", ignoring\n",
+ plugin->Label, key);
+
+ return 0;
+ }
+
+ char* message = dssi_descr->configure(handle, key, value);
+ if (message) {
+ printf("Plugin::oscConfigure on configure '%s' '%s', plugin '%s' returned error '%s'\n",
+ //key, value, synti->name().toAscii().data(), message);
+ key, value, plugin->Label, message);
+
+ free(message);
+ }
+
+ // also call back on UIs for plugins other than the one
+ // that requested this:
+ // if (n != instance->number && instances[n].uiTarget) {
+ // lo_send(instances[n].uiTarget,
+ // instances[n].ui_osc_configure_path, "ss", key, value);
+ // }
+
+ // configure invalidates bank and program information, so
+ // we should do this again now:
+ //queryPrograms();
+
+ #endif // DSSI_SUPPORT
+
+ return 0;
+}
+
+//---------------------------------------------------------
+// oscConfigure
+//---------------------------------------------------------
+
+int PluginI::oscConfigure(const char *key, const char *value)
+ {
+ if(!_plugin)
+ return 0;
+
+ // This is pretty much the simplest legal implementation of
+ // configure in a DSSI host.
+
+ // The host has the option to remember the set of (key,value)
+ // pairs associated with a particular instance, so that if it
+ // wants to restore the "same" instance on another occasion it can
+ // just call configure() on it for each of those pairs and so
+ // restore state without any input from a GUI. Any real-world GUI
+ // host will probably want to do that. This host doesn't have any
+ // concept of restoring an instance from one run to the next, so
+ // we don't bother remembering these at all.
+
+ //const char *key = (const char *)&argv[0]->s;
+ //const char *value = (const char *)&argv[1]->s;
+
+ #ifdef PLUGIN_DEBUGIN
+ printf("PluginI::oscConfigure effect plugin name:%s label:%s key:%s value:%s\n", _name.latin1(), _label.latin1(), key, value);
+ #endif
+
+ #ifdef DSSI_SUPPORT
+ // FIXME: Don't think this is right, should probably do as example shows below.
+ for(int i = 0; i < instances; ++i)
+ _plugin->oscConfigure(handle[i], key, value);
+
+ // also call back on UIs for plugins other than the one
+ // that requested this:
+ // if (n != instance->number && instances[n].uiTarget) {
+ // lo_send(instances[n].uiTarget,
+ // instances[n].ui_osc_configure_path, "ss", key, value);
+ // }
+
+ // configure invalidates bank and program information, so
+ // we should do this again now:
+ //queryPrograms();
+ #endif // DSSI_SUPPORT
+
+ return 0;
+}
+
+//---------------------------------------------------------
+// oscUpdate
+//---------------------------------------------------------
+
+int PluginI::oscUpdate()
+{
+ #ifdef DSSI_SUPPORT
+ // Send project directory.
+ _oscif.oscSendConfigure(DSSI_PROJECT_DIRECTORY_KEY, museProject.latin1()); // song->projectPath()
+ #endif
+
+ /*
+ // Send current string configuration parameters.
+ StringParamMap& map = synti->stringParameters();
+ int i = 0;
+ for(ciStringParamMap r = map.begin(); r != map.end(); ++r)
+ {
+ _oscIF.oscSendConfigure(r->first.c_str(), r->second.c_str());
+ // Avoid overloading the GUI if there are lots and lots of params.
+ if((i+1) % 50 == 0)
+ usleep(300000);
+ ++i;
+ }
+
+ // Send current bank and program.
+ unsigned long bank, prog;
+ synti->currentProg(&prog, &bank, 0);
+ _oscIF.oscSendProgram(prog, bank);
+
+ // Send current control values.
+ unsigned long ports = synth->_controlInPorts;
+ for(unsigned long i = 0; i < ports; ++i)
+ {
+ unsigned long k = synth->pIdx(i);
+ _oscIF.oscSendControl(k, controls[i]);
+ // Avoid overloading the GUI if there are lots and lots of ports.
+ if((i+1) % 50 == 0)
+ usleep(300000);
+ }
+
+ */
+
+ return 0;
+}
+
+//---------------------------------------------------------
+// oscControl
+//---------------------------------------------------------
+
+int PluginI::oscControl(unsigned long port, float value)
+{
+ //int port = argv[0]->i;
+ //LADSPA_Data value = argv[1]->f;
+
+ #ifdef PLUGIN_DEBUGIN
+ printf("PluginI::oscControl received oscControl port:%ld val:%f\n", port, value);
+ #endif
+
+ //int controlPorts = synth->_controller;
+
+ //if(port >= controlPorts)
+ //if(port < 0 || port >= _plugin->rpIdx.size())
+ //{
+ //fprintf(stderr, "DssiSynthIF::oscControl: port number:%d is out of range of number of ports:%d\n", port, controlPorts);
+ // fprintf(stderr, "PluginI::oscControl: port number:%d is out of range of index list size:%d\n", port, _plugin->rpIdx.size());
+ // return 0;
+ //}
+
+ // Convert from DSSI port number to control input port index.
+ //unsigned long cport = _plugin->rpIdx[port];
+ unsigned long cport = _plugin->port2InCtrl(port);
+
+ if((int)cport == -1)
+ {
+ fprintf(stderr, "PluginI::oscControl: port number:%ld is not a control input\n", port);
+ return 0;
+ }
+
+ // (From DSSI module).
+ // p3.3.39 Set the DSSI control input port's value.
+ // Observations: With a native DSSI synth like LessTrivialSynth, the native GUI's controls do not change the sound at all
+ // ie. they don't update the DSSI control port values themselves.
+ // Hence in response to the call to this oscControl, sent by the native GUI, it is required to that here.
+/// controls[cport].val = value;
+ // DSSI-VST synths however, unlike DSSI synths, DO change their OWN sound in response to their gui controls.
+ // AND this function is called !
+ // Despite the descrepency we are STILL required to update the DSSI control port values here
+ // because dssi-vst is WAITING FOR A RESPONSE! (A CHANGE in the control port value).
+ // It will output something like "...4 events expected..." and count that number down as 4 actual control port value CHANGES
+ // are done here in response. Normally it says "...0 events expected..." when MusE is the one doing the DSSI control changes.
+ // TODO: May need FIFOs on each control(!) so that the control changes get sent one per process cycle!
+ // Observed countdown not actually going to zero upon string of changes.
+ // Try this ...
+ OscControlFifo* cfifo = _oscif.oscFifo(cport);
+ if(cfifo)
+ {
+ OscControlValue cv;
+ //cv.idx = cport;
+ cv.value = value;
+ if(cfifo->put(cv))
+ {
+ fprintf(stderr, "PluginI::oscControl: fifo overflow: in control number:%ld\n", cport);
+ }
+ }
+
+ // Record automation:
+ // Take care of this immediately, because we don't want the silly delay associated with
+ // processing the fifo one-at-a-time in the apply().
+ // NOTE: Ahh crap! We don't receive control events until the user RELEASES a control !
+ // So the events all arrive at once when the user releases a control.
+ // That makes this pretty useless... But what the heck...
+ if(_track && _id != -1)
+ {
+ int id = genACnum(_id, cport);
+ AutomationType at = _track->automationType();
+
+ // TODO: Taken from our native gui control handlers.
+ // This may need modification or may cause problems -
+ // we don't have the luxury of access to the dssi gui controls !
+ if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH))
+ enableController(cport, false);
+
+ _track->recordAutomation(id, value);
+ }
+
+ /*
+ const DSSI_Descriptor* dssi = synth->dssi;
+ const LADSPA_Descriptor* ld = dssi->LADSPA_Plugin;
+
+ ciMidiCtl2LadspaPort ip = synth->port2MidiCtlMap.find(cport);
+ if(ip != synth->port2MidiCtlMap.end())
+ {
+ // TODO: TODO: Update midi MusE's midi controller knobs, sliders, boxes etc with a call to the midi port's setHwCtrlState() etc.
+ // But first we need a ladspa2MidiValue() function! ...
+ //
+ //
+ //float val = ladspa2MidiValue(ld, i, ?, ?);
+
+ }
+ */
+
+#if 0
+ int port = argv[0]->i;
+ LADSPA_Data value = argv[1]->f;
+
+ if (port < 0 || port > instance->plugin->descriptor->LADSPA_Plugin->PortCount) {
+ fprintf(stderr, "MusE: OSC: %s port number (%d) is out of range\n",
+ instance->friendly_name, port);
+ return 0;
+ }
+ if (instance->pluginPortControlInNumbers[port] == -1) {
+ fprintf(stderr, "MusE: OSC: %s port %d is not a control in\n",
+ instance->friendly_name, port);
+ return 0;
+ }
+ pluginControlIns[instance->pluginPortControlInNumbers[port]] = value;
+ if (verbose) {
+ printf("MusE: OSC: %s port %d = %f\n",
+ instance->friendly_name, port, value);
+ }
+#endif
+ return 0;
+ }
+
+#endif // OSC_SUPPORT
+
+
+//---------------------------------------------------------
+// PluginDialog
+// select Plugin dialog
+//---------------------------------------------------------
+
+PluginDialog::PluginDialog(QWidget* parent, const char* name, bool modal)
+ : QDialog(parent, name, modal)
+ {
+ setCaption(tr("MusE: select plugin"));
+ Q3VBoxLayout* layout = new Q3VBoxLayout(this);
+
+ pList = new Q3ListView(this);
+ pList->setAllColumnsShowFocus(true);
+ pList->addColumn(tr("Lib"), 110);
+ pList->addColumn(tr("Label"), 110);
+ pList->addColumn(tr("Name"), 200);
+ pList->addColumn(tr("AI"), 30);
+ pList->addColumn(tr("AO"), 30);
+ pList->addColumn(tr("CI"), 30);
+ pList->addColumn(tr("CO"), 30);
+ pList->addColumn(tr("IP"), 30);
+ pList->addColumn(tr("id"), 40);
+ pList->addColumn(tr("Maker"), 110);
+ pList->addColumn(tr("Copyright"), 110);
+ pList->setColumnWidthMode(1, Q3ListView::Maximum);
+
+ layout->addWidget(pList);
+
+ //---------------------------------------------------
+ // Ok/Cancel Buttons
+ //---------------------------------------------------
+
+ Q3BoxLayout* w5 = new Q3HBoxLayout;
+ layout->addLayout(w5);
+
+ QPushButton* okB = new QPushButton(tr("Ok"), this);
+ okB->setDefault(true);
+ QPushButton* cancelB = new QPushButton(tr("Cancel"), this);
+ okB->setFixedWidth(80);
+ cancelB->setFixedWidth(80);
+ w5->addWidget(okB);
+ w5->addSpacing(12);
+ w5->addWidget(cancelB);
+
+ Q3ButtonGroup* plugSel = new Q3ButtonGroup(4, Qt::Horizontal, this, "Show plugs:");
+ plugSel->setTitle("Show plugs:");
+ QRadioButton* onlySM = new QRadioButton(plugSel, "Mono and Stereo");
+ onlySM->setText( "Mono and Stereo");
+ QRadioButton* onlyS = new QRadioButton(plugSel, "Stereo");
+ onlyS->setText( "Stereo");
+ QRadioButton* onlyM = new QRadioButton(plugSel, "Mono");
+ onlyM->setText( "Mono");
+ QRadioButton* allPlug = new QRadioButton(plugSel, "Show all");
+ allPlug->setText( "Show All");
+
+ plugSel->setRadioButtonExclusive(true);
+ plugSel->setButton(selectedPlugType);
+
+ QToolTip::add(plugSel, tr("Select which types of plugins should be visible in the list.<br>"
+ "Note that using mono plugins on stereo tracks is not a problem, two will be used in parallel.<br>"
+ "Also beware that the 'all' alternative includes plugins that probably are not usable by MusE."));
+
+ onlySM->setCaption(tr("Stereo and Mono"));
+ onlyS->setCaption(tr("Stereo"));
+ onlyM->setCaption(tr("Mono"));
+ allPlug->setCaption(tr("All"));
+
+ w5->addSpacing(12);
+ w5->addWidget(plugSel);
+ w5->addSpacing(12);
+
+ QLabel *sortLabel = new QLabel( this, "Search in 'Label' and 'Name':" );
+ sortLabel->setText( "Search in 'Label' and 'Name':" );
+ w5->addWidget(sortLabel);
+ w5->addSpacing(2);
+
+ sortBox = new QComboBox( true, this, "sort" );
+ if (!sortItems.empty())
+ sortBox->insertStringList(sortItems);
+
+ sortBox->setMinimumSize( 100, 10);
+ w5->addWidget(sortBox);
+ w5->addStretch(-1);
+
+ if (sortBox->currentText().length() > 0)
+ fillPlugs(sortBox->currentText());
+ else
+ fillPlugs(selectedPlugType);
+
+
+ connect(pList, SIGNAL(doubleClicked(Q3ListViewItem*)), SLOT(accept()));
+ connect(cancelB, SIGNAL(clicked()), SLOT(reject()));
+ connect(okB, SIGNAL(clicked()), SLOT(accept()));
+ connect(plugSel, SIGNAL(clicked(int)), SLOT(fillPlugs(int)));
+ connect(sortBox, SIGNAL(textChanged(const QString&)),SLOT(fillPlugs(const QString&)));
+ sortBox->setFocus();
+ }
+
+//---------------------------------------------------------
+// value
+//---------------------------------------------------------
+
+Plugin* PluginDialog::value()
+ {
+ Q3ListViewItem* item = pList->selectedItem();
+ if (item)
+ return plugins.find(item->text(0), item->text(1));
+ return 0;
+ }
+
+//---------------------------------------------------------
+// accept
+//---------------------------------------------------------
+
+void PluginDialog::accept()
+ {
+ if (!sortBox->currentText().isEmpty()) {
+ if (sortItems.find(sortBox->currentText()) == sortItems.end())
+ sortItems.push_front(sortBox->currentText());
+ }
+ QDialog::accept();
+ }
+
+//---------------------------------------------------------
+// fillPlugs
+//---------------------------------------------------------
+
+void PluginDialog::fillPlugs(int nbr)
+{
+ pList->clear();
+ for(iPlugin i = plugins.begin(); i != plugins.end(); ++i)
+ {
+ /*
+ int ai = 0;
+ int ao = 0;
+ int ci = 0;
+ int co = 0;
+ for(unsigned long k = 0; k < i->ports(); ++k)
+ {
+ LADSPA_PortDescriptor pd = i->portd(k);
+ if(pd & LADSPA_PORT_CONTROL)
+ {
+ if(pd & LADSPA_PORT_INPUT)
+ ++ci;
+ else
+ if(pd & LADSPA_PORT_OUTPUT)
+ ++co;
+ }
+ else
+ if(pd & LADSPA_PORT_AUDIO)
+ {
+ if(pd & LADSPA_PORT_INPUT)
+ ++ai;
+ else
+ if(pd & LADSPA_PORT_OUTPUT)
+ ++ao;
+ }
+ }
+ */
+ int ai = i->inports();
+ int ao = i->outports();
+ int ci = i->controlInPorts();
+ int co = i->controlOutPorts();
+
+ bool addFlag = false;
+ switch(nbr)
+ {
+ case 0: // stereo & mono
+ if ((ai == 1 || ai == 2) && (ao == 1 || ao ==2))
+ {
+ addFlag = true;
+ }
+ break;
+ case 1: // stereo
+ if ((ai == 1 || ai == 2) && ao ==2)
+ {
+ addFlag = true;
+ }
+ break;
+ case 2: // mono
+ if (ai == 1 && ao == 1)
+ {
+ addFlag = true;
+ }
+ break;
+ case 3: // all
+ addFlag = true;
+ break;
+ }
+ if(addFlag)
+ {
+ Q3ListViewItem* item = new Q3ListViewItem(pList,
+ i->lib(),
+ i->label(),
+ i->name(),
+ QString().setNum(ai),
+ QString().setNum(ao),
+ QString().setNum(ci),
+ QString().setNum(co),
+ QString().setNum(i->inPlaceCapable())
+ );
+ item->setText(8, QString().setNum(i->id()));
+ item->setText(9, i->maker());
+ item->setText(10, i->copyright());
+ }
+ }
+ selectedPlugType = nbr;
+}
+
+void PluginDialog::fillPlugs(const QString &sortValue)
+{
+ pList->clear();
+ for(iPlugin i = plugins.begin(); i != plugins.end(); ++i)
+ {
+ /*
+ int ai = 0;
+ int ao = 0;
+ int ci = 0;
+ int co = 0;
+ for(unsigned long k = 0; k < i->ports(); ++k)
+ {
+ LADSPA_PortDescriptor pd = i->portd(k);
+ if(pd & LADSPA_PORT_CONTROL)
+ {
+ if(pd & LADSPA_PORT_INPUT)
+ ++ci;
+ else
+ if(pd & LADSPA_PORT_OUTPUT)
+ ++co;
+ }
+ else
+ if(pd & LADSPA_PORT_AUDIO)
+ {
+ if(pd & LADSPA_PORT_INPUT)
+ ++ai;
+ else
+ if(pd & LADSPA_PORT_OUTPUT)
+ ++ao;
+ }
+ }
+ */
+ int ai = i->inports();
+ int ao = i->outports();
+ int ci = i->controlInPorts();
+ int co = i->controlOutPorts();
+
+ bool addFlag = false;
+
+ if(i->label().lower().contains(sortValue.lower()))
+ addFlag = true;
+ else
+ if(i->name().lower().contains(sortValue.lower()))
+ addFlag = true;
+ if(addFlag)
+ {
+ Q3ListViewItem* item = new Q3ListViewItem(pList,
+ i->lib(),
+ i->label(),
+ i->name(),
+ QString().setNum(ai),
+ QString().setNum(ao),
+ QString().setNum(ci),
+ QString().setNum(co),
+ QString().setNum(i->inPlaceCapable())
+ );
+ item->setText(8, QString().setNum(i->id()));
+ item->setText(9, i->maker());
+ item->setText(10, i->copyright());
+ }
+ }
+}
+
+//---------------------------------------------------------
+// getPlugin
+//---------------------------------------------------------
+
+Plugin* PluginDialog::getPlugin(QWidget* parent)
+ {
+ PluginDialog* dialog = new PluginDialog(parent);
+ if (dialog->exec())
+ return dialog->value();
+ return 0;
+ }
+
+const char* presetOpenText = "<img source=\"fileopen\"> "
+ "Click this button to load a saved <em>preset</em>.";
+const char* presetSaveText = "Click this button to save curent parameter "
+ "settings as a <em>preset</em>. You will be prompted for a file name.";
+const char* presetBypassText = "Click this button to bypass effect unit";
+
+//---------------------------------------------------------
+// PluginGui
+//---------------------------------------------------------
+
+//PluginGui::PluginGui(PluginI* p)
+// p3.3.43
+PluginGui::PluginGui(PluginIBase* p)
+ : Q3MainWindow(0)
+ {
+ gw = 0;
+ params = 0;
+ plugin = p;
+ setCaption(plugin->name());
+
+ Q3ToolBar* tools = new Q3ToolBar(tr("File Buttons"), this);
+ QToolButton* fileOpen = new QToolButton(
+ QIcon(*openIconS), // ddskrjo
+ tr("Load Preset"),
+ QString::null, this, SLOT(load()),
+ tools, "load preset" );
+
+ QToolButton* fileSave = new QToolButton(
+ QIcon(*saveIconS), // ddskrjo
+ tr("Save Preset"),
+ QString::null,
+ this, SLOT(save()),
+ tools, "save preset");
+
+ Q3WhatsThis::whatsThisButton(tools);
+
+ onOff = new QToolButton(tools, "bypass");
+ onOff->setIconSet(*exitIconS);
+ onOff->setToggleButton(true);
+ onOff->setOn(plugin->on());
+ QToolTip::add(onOff, tr("bypass plugin"));
+ connect(onOff, SIGNAL(toggled(bool)), SLOT(bypassToggled(bool)));
+
+ Q3WhatsThis::add(fileOpen, tr(presetOpenText));
+ Q3WhatsThis::add(onOff, tr(presetBypassText));
+ Q3MimeSourceFactory::defaultFactory()->setPixmap(QString("fileopen"), *openIcon );
+ Q3WhatsThis::add(fileSave, tr(presetSaveText));
+
+ QString id;
+ //id.setNum(plugin->plugin()->id());
+ id.setNum(plugin->pluginID());
+ QString name(museGlobalShare + QString("/plugins/") + id + QString(".ui"));
+ QFile uifile(name);
+ if (uifile.exists()) {
+ //
+ // construct GUI from *.ui file
+ //
+#if 0 // ddskrjo
+ mw = QWidgetFactory::create(uifile.name(), 0, this);
+ setCentralWidget(mw);
+
+ const QObjectList* l = mw->children();
+ QObject *obj;
+
+ nobj = 0;
+ QObjectListIt it(*l);
+ while ((obj = it.current()) != 0) {
+ ++it;
+ const char* name = obj->name();
+ if (*name !='P')
+ continue;
+ int parameter = -1;
+ sscanf(name, "P%d", &parameter);
+ if (parameter == -1)
+ continue;
+ ++nobj;
+ }
+ it.toFirst();
+ gw = new GuiWidgets[nobj];
+ nobj = 0;
+ QSignalMapper* mapper = new QSignalMapper(this, "pluginGuiMapper");
+ connect(mapper, SIGNAL(mapped(int)), SLOT(guiParamChanged(int)));
+
+ QSignalMapper* mapperPressed = new QSignalMapper(this, "pluginGuiMapperPressed");
+ QSignalMapper* mapperReleased = new QSignalMapper(this, "pluginGuiMapperReleased");
+ connect(mapperPressed, SIGNAL(mapped(int)), SLOT(guiParamPressed(int)));
+ connect(mapperReleased, SIGNAL(mapped(int)), SLOT(guiParamReleased(int)));
+
+ while ((obj = it.current()) != 0) {
+ ++it;
+ const char* name = obj->name();
+ if (*name !='P')
+ continue;
+ int parameter = -1;
+ sscanf(name, "P%d", &parameter);
+ if (parameter == -1)
+ continue;
+
+ mapper->setMapping(obj, nobj);
+ mapperPressed->setMapping(obj, nobj);
+ mapperReleased->setMapping(obj, nobj);
+
+ gw[nobj].widget = (QWidget*)obj;
+ gw[nobj].param = parameter;
+ gw[nobj].type = -1;
+
+ if (strcmp(obj->className(), "Slider") == 0) {
+ gw[nobj].type = GuiWidgets::SLIDER;
+ ((Slider*)obj)->setId(nobj);
+ ((Slider*)obj)->setCursorHoming(true);
+ for(int i = 0; i < nobj; i++)
+ {
+ if(gw[i].type == GuiWidgets::DOUBLE_LABEL && gw[i].param == parameter)
+ ((DoubleLabel*)gw[i].widget)->setSlider((Slider*)obj);
+ }
+ connect(obj, SIGNAL(sliderMoved(double,int)), mapper, SLOT(map()));
+ connect(obj, SIGNAL(sliderPressed(int)), SLOT(guiSliderPressed(int)));
+ connect(obj, SIGNAL(sliderReleased(int)), SLOT(guiSliderReleased(int)));
+ connect(obj, SIGNAL(sliderRightClicked(const QPoint &, int)), SLOT(guiSliderRightClicked(const QPoint &, int)));
+ }
+ else if (strcmp(obj->className(), "DoubleLabel") == 0) {
+ gw[nobj].type = GuiWidgets::DOUBLE_LABEL;
+ ((DoubleLabel*)obj)->setId(nobj);
+ for(int i = 0; i < nobj; i++)
+ {
+ if(gw[i].type == GuiWidgets::SLIDER && gw[i].param == parameter)
+ {
+ ((DoubleLabel*)obj)->setSlider((Slider*)gw[i].widget);
+ break;
+ }
+ }
+ connect(obj, SIGNAL(valueChanged(double,int)), mapper, SLOT(map()));
+ }
+ else if (strcmp(obj->className(), "QCheckBox") == 0) {
+ gw[nobj].type = GuiWidgets::QCHECKBOX;
+ connect(obj, SIGNAL(toggled(bool)), mapper, SLOT(map()));
+ connect(obj, SIGNAL(pressed()), mapperPressed, SLOT(map()));
+ connect(obj, SIGNAL(released()), mapperReleased, SLOT(map()));
+ }
+ else if (strcmp(obj->className(), "QComboBox") == 0) {
+ gw[nobj].type = GuiWidgets::QCOMBOBOX;
+ connect(obj, SIGNAL(activated(int)), mapper, SLOT(map()));
+ }
+ else {
+ printf("unknown widget class %s\n", obj->className());
+ continue;
+ }
+ ++nobj;
+ }
+ updateValues(); // otherwise the GUI won't have valid data
+#endif
+ }
+ else {
+ //mw = new QWidget(this);
+ //setCentralWidget(mw);
+ // p3.4.43
+ view = new Q3ScrollView(this);
+ setCentralWidget(view);
+ mw = new QWidget(view);
+ view->setResizePolicy(Q3ScrollView::AutoOneFit);
+ //view->setVScrollBarMode(QScrollView::AlwaysOff);
+ view->addChild(mw);
+
+ Q3GridLayout* grid = new Q3GridLayout(mw);
+ grid->setSpacing(2);
+
+ int n = plugin->parameters();
+ params = new GuiParam[n];
+
+ // Changed p3.3.43
+ //resize(280, n*20+30);
+ //int nh = n*20+40;
+ //if(nh > 760)
+ // nh = 760;
+ //resize(280, nh);
+
+ //int style = Slider::BgTrough | Slider::BgSlot;
+ QFontMetrics fm = fontMetrics();
+ int h = fm.height() + 4;
+
+ for (int i = 0; i < n; ++i) {
+ QLabel* label = 0;
+ LADSPA_PortRangeHint range = plugin->range(i);
+ double lower = 0.0; // default values
+ double upper = 1.0;
+ double dlower = lower;
+ double dupper = upper;
+ double val = plugin->param(i);
+ double dval = val;
+ params[i].hint = range.HintDescriptor;
+
+ if (LADSPA_IS_HINT_BOUNDED_BELOW(range.HintDescriptor)) {
+ dlower = lower = range.LowerBound;
+ }
+ if (LADSPA_IS_HINT_BOUNDED_ABOVE(range.HintDescriptor)) {
+ dupper = upper = range.UpperBound;
+ }
+ if (LADSPA_IS_HINT_SAMPLE_RATE(range.HintDescriptor)) {
+ lower *= sampleRate;
+ upper *= sampleRate;
+ dlower = lower;
+ dupper = upper;
+ }
+ if (LADSPA_IS_HINT_LOGARITHMIC(range.HintDescriptor)) {
+ if (lower == 0.0)
+ lower = 0.001;
+ dlower = fast_log10(lower)*20.0;
+ dupper = fast_log10(upper)*20.0;
+ dval = fast_log10(val) * 20.0;
+ }
+ if (LADSPA_IS_HINT_TOGGLED(range.HintDescriptor)) {
+ params[i].type = GuiParam::GUI_SWITCH;
+ CheckBox* cb = new CheckBox(mw, i, "param");
+ cb->setId(i);
+ cb->setText(QString(plugin->paramName(i)));
+ cb->setChecked(plugin->param(i) != 0.0);
+ cb->setFixedHeight(h);
+ params[i].actuator = cb;
+ }
+ else {
+ label = new QLabel(QString(plugin->paramName(i)), mw);
+ params[i].type = GuiParam::GUI_SLIDER;
+ params[i].label = new DoubleLabel(val, lower, upper, mw);
+ params[i].label->setFrame(true);
+ params[i].label->setPrecision(2);
+ params[i].label->setId(i);
+
+ //params[i].label->setMargin(2);
+ //params[i].label->setFixedHeight(h);
+
+ Slider* s = new Slider(mw, "param", Qt::Horizontal,
+ Slider::None); //, style);
+
+ s->setCursorHoming(true);
+ s->setId(i);
+ //s->setFixedHeight(h);
+ s->setRange(dlower, dupper);
+ if(LADSPA_IS_HINT_INTEGER(range.HintDescriptor))
+ s->setStep(1.0);
+ s->setValue(dval);
+ params[i].actuator = s;
+ params[i].label->setSlider((Slider*)params[i].actuator);
+ }
+ //params[i].actuator->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum));
+ params[i].actuator->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
+ if (params[i].type == GuiParam::GUI_SLIDER) {
+ //label->setFixedHeight(20);
+ //label->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum));
+ label->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
+ //params[i].label->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum));
+ params[i].label->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
+ grid->addWidget(label, i, 0);
+ grid->addWidget(params[i].label, i, 1);
+ grid->addWidget(params[i].actuator, i, 2);
+ }
+ else if (params[i].type == GuiParam::GUI_SWITCH) {
+ grid->addMultiCellWidget(params[i].actuator, i, i, 0, 2);
+ }
+ if (params[i].type == GuiParam::GUI_SLIDER) {
+ connect(params[i].actuator, SIGNAL(sliderMoved(double,int)), SLOT(sliderChanged(double,int)));
+ connect(params[i].label, SIGNAL(valueChanged(double,int)), SLOT(labelChanged(double,int)));
+ connect(params[i].actuator, SIGNAL(sliderPressed(int)), SLOT(ctrlPressed(int)));
+ connect(params[i].actuator, SIGNAL(sliderReleased(int)), SLOT(ctrlReleased(int)));
+ connect(params[i].actuator, SIGNAL(sliderRightClicked(const QPoint &, int)), SLOT(ctrlRightClicked(const QPoint &, int)));
+ }
+ else if (params[i].type == GuiParam::GUI_SWITCH){
+ connect(params[i].actuator, SIGNAL(checkboxPressed(int)), SLOT(ctrlPressed(int)));
+ connect(params[i].actuator, SIGNAL(checkboxReleased(int)), SLOT(ctrlReleased(int)));
+ connect(params[i].actuator, SIGNAL(checkboxRightClicked(const QPoint &, int)), SLOT(ctrlRightClicked(const QPoint &, int)));
+ }
+ }
+ // p3.3.43
+ resize(280, height());
+
+ grid->setColStretch(2, 10);
+ }
+ connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat()));
+ }
+
+//---------------------------------------------------------
+// PluginGui
+//---------------------------------------------------------
+
+PluginGui::~PluginGui()
+ {
+ if (gw)
+ delete[] gw;
+ if (params)
+ delete[] params;
+ }
+
+//---------------------------------------------------------
+// heartBeat
+//---------------------------------------------------------
+
+void PluginGui::heartBeat()
+{
+ updateControls();
+}
+
+//---------------------------------------------------------
+// ctrlPressed
+//---------------------------------------------------------
+
+void PluginGui::ctrlPressed(int param)
+{
+ AutomationType at = AUTO_OFF;
+ AudioTrack* track = plugin->track();
+ if(track)
+ at = track->automationType();
+
+ if(at != AUTO_OFF)
+ plugin->enableController(param, false);
+
+ int id = plugin->id();
+
+ if(id == -1)
+ return;
+
+ id = genACnum(id, param);
+
+ if(params[param].type == GuiParam::GUI_SLIDER)
+ {
+ double val = ((Slider*)params[param].actuator)->value();
+ if (LADSPA_IS_HINT_LOGARITHMIC(params[param].hint))
+ val = pow(10.0, val/20.0);
+ else if (LADSPA_IS_HINT_INTEGER(params[param].hint))
+ val = rint(val);
+ plugin->setParam(param, val);
+ ((DoubleLabel*)params[param].label)->setValue(val);
+
+ // p3.3.43
+ //audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val);
+
+ if(track)
+ {
+ // p3.3.43
+ audio->msgSetPluginCtrlVal(track, id, val);
+
+ track->startAutoRecord(id, val);
+ }
+ }
+ else if(params[param].type == GuiParam::GUI_SWITCH)
+ {
+ double val = (double)((CheckBox*)params[param].actuator)->isChecked();
+ plugin->setParam(param, val);
+
+ // p3.3.43
+ //audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val);
+
+ if(track)
+ {
+ // p3.3.43
+ audio->msgSetPluginCtrlVal(track, id, val);
+
+ track->startAutoRecord(id, val);
+ }
+ }
+}
+
+//---------------------------------------------------------
+// ctrlReleased
+//---------------------------------------------------------
+
+void PluginGui::ctrlReleased(int param)
+{
+ AutomationType at = AUTO_OFF;
+ AudioTrack* track = plugin->track();
+ if(track)
+ at = track->automationType();
+
+ // Special for switch - don't enable controller until transport stopped.
+ if(at != AUTO_WRITE && ((params[param].type != GuiParam::GUI_SWITCH
+ || !audio->isPlaying()
+ || at != AUTO_TOUCH) || (!audio->isPlaying() && at == AUTO_TOUCH)) )
+ plugin->enableController(param, true);
+
+ int id = plugin->id();
+ if(!track || id == -1)
+ return;
+ id = genACnum(id, param);
+
+ if(params[param].type == GuiParam::GUI_SLIDER)
+ {
+ double val = ((Slider*)params[param].actuator)->value();
+ if (LADSPA_IS_HINT_LOGARITHMIC(params[param].hint))
+ val = pow(10.0, val/20.0);
+ else if (LADSPA_IS_HINT_INTEGER(params[param].hint))
+ val = rint(val);
+ track->stopAutoRecord(id, val);
+ }
+ //else if(params[param].type == GuiParam::GUI_SWITCH)
+ //{
+ //double val = (double)((CheckBox*)params[param].actuator)->isChecked();
+ // No concept of 'untouching' a checkbox. Remain 'touched' until stop.
+ //plugin->track()->stopAutoRecord(genACnum(plugin->id(), param), val);
+ //}
+}
+
+//---------------------------------------------------------
+// ctrlRightClicked
+//---------------------------------------------------------
+
+void PluginGui::ctrlRightClicked(const QPoint &p, int param)
+{
+ int id = plugin->id();
+ if(id != -1)
+ //song->execAutomationCtlPopup((AudioTrack*)plugin->track(), p, genACnum(id, param));
+ song->execAutomationCtlPopup(plugin->track(), p, genACnum(id, param));
+}
+
+//---------------------------------------------------------
+// sliderChanged
+//---------------------------------------------------------
+
+void PluginGui::sliderChanged(double val, int param)
+{
+ AutomationType at = AUTO_OFF;
+ AudioTrack* track = plugin->track();
+ if(track)
+ at = track->automationType();
+
+ if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH))
+ plugin->enableController(param, false);
+
+ if (LADSPA_IS_HINT_LOGARITHMIC(params[param].hint))
+ val = pow(10.0, val/20.0);
+ else if (LADSPA_IS_HINT_INTEGER(params[param].hint))
+ val = rint(val);
+ if (plugin->param(param) != val) {
+ plugin->setParam(param, val);
+ ((DoubleLabel*)params[param].label)->setValue(val);
+ }
+
+ int id = plugin->id();
+ if(id == -1)
+ return;
+ id = genACnum(id, param);
+
+ // p3.3.43
+ //audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val);
+
+ if(track)
+ {
+ // p3.3.43
+ audio->msgSetPluginCtrlVal(track, id, val);
+
+ track->recordAutomation(id, val);
+ }
+}
+
+//---------------------------------------------------------
+// labelChanged
+//---------------------------------------------------------
+
+void PluginGui::labelChanged(double val, int param)
+{
+ AutomationType at = AUTO_OFF;
+ AudioTrack* track = plugin->track();
+ if(track)
+ at = track->automationType();
+
+ if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH))
+ plugin->enableController(param, false);
+
+ double dval = val;
+ if (LADSPA_IS_HINT_LOGARITHMIC(params[param].hint))
+ dval = fast_log10(val) * 20.0;
+ else if (LADSPA_IS_HINT_INTEGER(params[param].hint))
+ dval = rint(val);
+ if (plugin->param(param) != val) {
+ plugin->setParam(param, val);
+ ((Slider*)params[param].actuator)->setValue(dval);
+ }
+
+ int id = plugin->id();
+ if(id == -1)
+ return;
+
+ id = genACnum(id, param);
+
+ // p3.3.43
+ //audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val);
+
+ if(track)
+ {
+ // p3.3.43
+ audio->msgSetPluginCtrlVal(track, id, val);
+
+ track->startAutoRecord(id, val);
+ }
+}
+
+//---------------------------------------------------------
+// load
+//---------------------------------------------------------
+
+void PluginGui::load()
+ {
+ QString s("presets/plugins/");
+ //s += plugin->plugin()->label();
+ s += plugin->pluginLabel();
+ s += "/";
+
+ QString fn = getOpenFileName(s, preset_file_pattern,
+ this, tr("MusE: load preset"), 0);
+ if (fn.isEmpty())
+ return;
+ bool popenFlag;
+ FILE* f = fileOpen(this, fn, QString(".pre"), "r", popenFlag, true);
+ if (f == 0)
+ return;
+
+ Xml xml(f);
+ int mode = 0;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ QString tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (mode == 0 && tag == "muse")
+ mode = 1;
+ else if (mode == 1 && tag == "plugin") {
+
+ if(plugin->readConfiguration(xml, true))
+ {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("Error reading preset. Might not be right type for this plugin"));
+ goto ende;
+ }
+
+ mode = 0;
+ }
+ else
+ xml.unknown("PluginGui");
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if (!mode && tag == "muse")
+ {
+ plugin->updateControllers();
+ goto ende;
+ }
+ default:
+ break;
+ }
+ }
+ende:
+ if (popenFlag)
+ pclose(f);
+ else
+ fclose(f);
+ }
+
+//---------------------------------------------------------
+// save
+//---------------------------------------------------------
+
+void PluginGui::save()
+ {
+ QString s("presets/plugins/");
+ //s += plugin->plugin()->label();
+ s += plugin->pluginLabel();
+ s += "/";
+
+ //QString fn = getSaveFileName(s, preset_file_pattern, this,
+ QString fn = getSaveFileName(s, preset_file_save_pattern, this,
+ tr("MusE: save preset"));
+ if (fn.isEmpty())
+ return;
+ bool popenFlag;
+ FILE* f = fileOpen(this, fn, QString(".pre"), "w", popenFlag, false, true);
+ if (f == 0)
+ return;
+ Xml xml(f);
+ xml.header();
+ xml.tag(0, "muse version=\"1.0\"");
+ plugin->writeConfiguration(1, xml);
+ xml.tag(1, "/muse");
+
+ if (popenFlag)
+ pclose(f);
+ else
+ fclose(f);
+ }
+
+//---------------------------------------------------------
+// bypassToggled
+//---------------------------------------------------------
+
+void PluginGui::bypassToggled(bool val)
+ {
+ plugin->setOn(val);
+ song->update(SC_ROUTE);
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void PluginGui::setOn(bool val)
+ {
+ onOff->blockSignals(true);
+ onOff->setOn(val);
+ onOff->blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// updateValues
+//---------------------------------------------------------
+
+void PluginGui::updateValues()
+ {
+ if (params) {
+ for (int i = 0; i < plugin->parameters(); ++i) {
+ GuiParam* gp = &params[i];
+ if (gp->type == GuiParam::GUI_SLIDER) {
+ double lv = plugin->param(i);
+ double sv = lv;
+ if (LADSPA_IS_HINT_LOGARITHMIC(params[i].hint))
+ sv = fast_log10(lv) * 20.0;
+ else if (LADSPA_IS_HINT_INTEGER(params[i].hint))
+ {
+ sv = rint(lv);
+ lv = sv;
+ }
+ gp->label->setValue(lv);
+ ((Slider*)(gp->actuator))->setValue(sv);
+ }
+ else if (gp->type == GuiParam::GUI_SWITCH) {
+ ((CheckBox*)(gp->actuator))->setChecked(int(plugin->param(i)));
+ }
+ }
+ }
+ else if (gw) {
+ for (int i = 0; i < nobj; ++i) {
+ QWidget* widget = gw[i].widget;
+ int type = gw[i].type;
+ int param = gw[i].param;
+ double val = plugin->param(param);
+ switch(type) {
+ case GuiWidgets::SLIDER:
+ ((Slider*)widget)->setValue(val);
+ break;
+ case GuiWidgets::DOUBLE_LABEL:
+ ((DoubleLabel*)widget)->setValue(val);
+ break;
+ case GuiWidgets::QCHECKBOX:
+ ((QCheckBox*)widget)->setChecked(int(val));
+ break;
+ case GuiWidgets::QCOMBOBOX:
+ ((QComboBox*)widget)->setCurrentItem(int(val));
+ break;
+ }
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// updateControls
+//---------------------------------------------------------
+
+void PluginGui::updateControls()
+ {
+ if(!automation || !plugin->track() || plugin->id() == -1)
+ return;
+ AutomationType at = plugin->track()->automationType();
+ if(at == AUTO_OFF)
+ return;
+ if (params) {
+ for (int i = 0; i < plugin->parameters(); ++i) {
+ GuiParam* gp = &params[i];
+ if (gp->type == GuiParam::GUI_SLIDER) {
+ if( plugin->controllerEnabled(i) && plugin->controllerEnabled2(i) )
+ {
+ double lv = plugin->track()->pluginCtrlVal(genACnum(plugin->id(), i));
+ double sv = lv;
+ if (LADSPA_IS_HINT_LOGARITHMIC(params[i].hint))
+ sv = fast_log10(lv) * 20.0;
+ else
+ if (LADSPA_IS_HINT_INTEGER(params[i].hint))
+ {
+ sv = rint(lv);
+ lv = sv;
+ }
+ if(((Slider*)(gp->actuator))->value() != sv)
+ {
+ //printf("PluginGui::updateControls slider\n");
+
+ gp->label->blockSignals(true);
+ ((Slider*)(gp->actuator))->blockSignals(true);
+ ((Slider*)(gp->actuator))->setValue(sv);
+ gp->label->setValue(lv);
+ ((Slider*)(gp->actuator))->blockSignals(false);
+ gp->label->blockSignals(false);
+ }
+ }
+
+ }
+ else if (gp->type == GuiParam::GUI_SWITCH) {
+ if( plugin->controllerEnabled(i) && plugin->controllerEnabled2(i) )
+ {
+ bool v = (int)plugin->track()->pluginCtrlVal(genACnum(plugin->id(), i));
+ if(((CheckBox*)(gp->actuator))->isChecked() != v)
+ {
+ //printf("PluginGui::updateControls switch\n");
+
+ ((CheckBox*)(gp->actuator))->blockSignals(true);
+ ((CheckBox*)(gp->actuator))->setChecked(v);
+ ((CheckBox*)(gp->actuator))->blockSignals(false);
+ }
+ }
+ }
+ }
+ }
+ else if (gw) {
+ for (int i = 0; i < nobj; ++i) {
+ QWidget* widget = gw[i].widget;
+ int type = gw[i].type;
+ int param = gw[i].param;
+ switch(type) {
+ case GuiWidgets::SLIDER:
+ if( plugin->controllerEnabled(param) && plugin->controllerEnabled2(param) )
+ {
+ double v = plugin->track()->pluginCtrlVal(genACnum(plugin->id(), param));
+ if(((Slider*)widget)->value() != v)
+ {
+ //printf("PluginGui::updateControls slider\n");
+
+ ((Slider*)widget)->blockSignals(true);
+ ((Slider*)widget)->setValue(v);
+ ((Slider*)widget)->blockSignals(false);
+ }
+ }
+ break;
+ case GuiWidgets::DOUBLE_LABEL:
+ if( plugin->controllerEnabled(param) && plugin->controllerEnabled2(param) )
+ {
+ double v = plugin->track()->pluginCtrlVal(genACnum(plugin->id(), param));
+ if(((DoubleLabel*)widget)->value() != v)
+ {
+ //printf("PluginGui::updateControls label\n");
+
+ ((DoubleLabel*)widget)->blockSignals(true);
+ ((DoubleLabel*)widget)->setValue(v);
+ ((DoubleLabel*)widget)->blockSignals(false);
+ }
+ }
+ break;
+ case GuiWidgets::QCHECKBOX:
+ if( plugin->controllerEnabled(param) && plugin->controllerEnabled2(param) )
+ {
+ bool b = (bool) plugin->track()->pluginCtrlVal(genACnum(plugin->id(), param));
+ if(((QCheckBox*)widget)->isChecked() != b)
+ {
+ //printf("PluginGui::updateControls checkbox\n");
+
+ ((QCheckBox*)widget)->blockSignals(true);
+ ((QCheckBox*)widget)->setChecked(b);
+ ((QCheckBox*)widget)->blockSignals(false);
+ }
+ }
+ break;
+ case GuiWidgets::QCOMBOBOX:
+ if( plugin->controllerEnabled(param) && plugin->controllerEnabled2(param) )
+ {
+ int n = (int) plugin->track()->pluginCtrlVal(genACnum(plugin->id(), param));
+ if(((QComboBox*)widget)->currentItem() != n)
+ {
+ //printf("PluginGui::updateControls combobox\n");
+
+ ((QComboBox*)widget)->blockSignals(true);
+ ((QComboBox*)widget)->setCurrentItem(n);
+ ((QComboBox*)widget)->blockSignals(false);
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// guiParamChanged
+//---------------------------------------------------------
+
+void PluginGui::guiParamChanged(int idx)
+{
+ QWidget* w = gw[idx].widget;
+ int param = gw[idx].param;
+ int type = gw[idx].type;
+
+ AutomationType at = AUTO_OFF;
+ AudioTrack* track = plugin->track();
+ if(track)
+ at = track->automationType();
+
+ if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH))
+ plugin->enableController(param, false);
+
+ double val = 0.0;
+ switch(type) {
+ case GuiWidgets::SLIDER:
+ val = ((Slider*)w)->value();
+ break;
+ case GuiWidgets::DOUBLE_LABEL:
+ val = ((DoubleLabel*)w)->value();
+ break;
+ case GuiWidgets::QCHECKBOX:
+ val = double(((QCheckBox*)w)->isChecked());
+ break;
+ case GuiWidgets::QCOMBOBOX:
+ val = double(((QComboBox*)w)->currentItem());
+ break;
+ }
+
+ for (int i = 0; i < nobj; ++i) {
+ QWidget* widget = gw[i].widget;
+ if (widget == w || param != gw[i].param)
+ continue;
+ int type = gw[i].type;
+ switch(type) {
+ case GuiWidgets::SLIDER:
+ ((Slider*)widget)->setValue(val);
+ break;
+ case GuiWidgets::DOUBLE_LABEL:
+ ((DoubleLabel*)widget)->setValue(val);
+ break;
+ case GuiWidgets::QCHECKBOX:
+ ((QCheckBox*)widget)->setChecked(int(val));
+ break;
+ case GuiWidgets::QCOMBOBOX:
+ ((QComboBox*)widget)->setCurrentItem(int(val));
+ break;
+ }
+ }
+
+ int id = plugin->id();
+ if(track && id != -1)
+ {
+ id = genACnum(id, param);
+
+ // p3.3.43
+ //audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val);
+
+ //if(track)
+ //{
+ // p3.3.43
+ audio->msgSetPluginCtrlVal(track, id, val);
+
+ switch(type)
+ {
+ case GuiWidgets::DOUBLE_LABEL:
+ case GuiWidgets::QCHECKBOX:
+ track->startAutoRecord(id, val);
+ break;
+ default:
+ track->recordAutomation(id, val);
+ break;
+ }
+ //}
+ }
+ plugin->setParam(param, val);
+}
+
+//---------------------------------------------------------
+// guiParamPressed
+//---------------------------------------------------------
+
+void PluginGui::guiParamPressed(int idx)
+ {
+ int param = gw[idx].param;
+
+ AutomationType at = AUTO_OFF;
+ AudioTrack* track = plugin->track();
+ if(track)
+ at = track->automationType();
+
+ if(at != AUTO_OFF)
+ plugin->enableController(param, false);
+
+ int id = plugin->id();
+ if(!track || id == -1)
+ return;
+
+ id = genACnum(id, param);
+
+ // NOTE: For this to be of any use, the freeverb gui 2142.ui
+ // would have to be used, and changed to use CheckBox and ComboBox
+ // instead of QCheckBox and QComboBox, since both of those would
+ // need customization (Ex. QCheckBox doesn't check on click).
+ /*
+ switch(type) {
+ case GuiWidgets::QCHECKBOX:
+ double val = (double)((CheckBox*)w)->isChecked();
+ track->startAutoRecord(id, val);
+ break;
+ case GuiWidgets::QCOMBOBOX:
+ double val = (double)((ComboBox*)w)->currentItem();
+ track->startAutoRecord(id, val);
+ break;
+ }
+ */
+ }
+
+//---------------------------------------------------------
+// guiParamReleased
+//---------------------------------------------------------
+
+void PluginGui::guiParamReleased(int idx)
+ {
+ int param = gw[idx].param;
+ int type = gw[idx].type;
+
+ AutomationType at = AUTO_OFF;
+ AudioTrack* track = plugin->track();
+ if(track)
+ at = track->automationType();
+
+ // Special for switch - don't enable controller until transport stopped.
+ if(at != AUTO_WRITE && (type != GuiWidgets::QCHECKBOX
+ || !audio->isPlaying()
+ || at != AUTO_TOUCH))
+ plugin->enableController(param, true);
+
+ int id = plugin->id();
+
+ if(!track || id == -1)
+ return;
+
+ id = genACnum(id, param);
+
+ // NOTE: For this to be of any use, the freeverb gui 2142.ui
+ // would have to be used, and changed to use CheckBox and ComboBox
+ // instead of QCheckBox and QComboBox, since both of those would
+ // need customization (Ex. QCheckBox doesn't check on click).
+ /*
+ switch(type) {
+ case GuiWidgets::QCHECKBOX:
+ double val = (double)((CheckBox*)w)->isChecked();
+ track->stopAutoRecord(id, param);
+ break;
+ case GuiWidgets::QCOMBOBOX:
+ double val = (double)((ComboBox*)w)->currentItem();
+ track->stopAutoRecord(id, param);
+ break;
+ }
+ */
+ }
+
+//---------------------------------------------------------
+// guiSliderPressed
+//---------------------------------------------------------
+
+void PluginGui::guiSliderPressed(int idx)
+ {
+ int param = gw[idx].param;
+ QWidget *w = gw[idx].widget;
+
+ AutomationType at = AUTO_OFF;
+ AudioTrack* track = plugin->track();
+ if(track)
+ at = track->automationType();
+
+ int id = plugin->id();
+
+ if(at == AUTO_WRITE || (at == AUTO_READ || at == AUTO_TOUCH))
+ plugin->enableController(param, false);
+
+ if(!track || id == -1)
+ return;
+
+ id = genACnum(id, param);
+
+ double val = ((Slider*)w)->value();
+ plugin->setParam(param, val);
+
+ //audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val);
+ // p3.3.43
+ audio->msgSetPluginCtrlVal(track, id, val);
+
+ track->startAutoRecord(id, val);
+
+ // Needed so that paging a slider updates a label or other buddy control.
+ for (int i = 0; i < nobj; ++i) {
+ QWidget* widget = gw[i].widget;
+ if (widget == w || param != gw[i].param)
+ continue;
+ int type = gw[i].type;
+ switch(type) {
+ case GuiWidgets::SLIDER:
+ ((Slider*)widget)->setValue(val);
+ break;
+ case GuiWidgets::DOUBLE_LABEL:
+ ((DoubleLabel*)widget)->setValue(val);
+ break;
+ case GuiWidgets::QCHECKBOX:
+ ((QCheckBox*)widget)->setChecked(int(val));
+ break;
+ case GuiWidgets::QCOMBOBOX:
+ ((QComboBox*)widget)->setCurrentItem(int(val));
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// guiSliderReleased
+//---------------------------------------------------------
+
+void PluginGui::guiSliderReleased(int idx)
+ {
+ int param = gw[idx].param;
+ QWidget *w = gw[idx].widget;
+
+ AutomationType at = AUTO_OFF;
+ AudioTrack* track = plugin->track();
+ if(track)
+ at = track->automationType();
+
+ if(at != AUTO_WRITE || (!audio->isPlaying() && at == AUTO_TOUCH))
+ plugin->enableController(param, true);
+
+ int id = plugin->id();
+
+ if(!track || id == -1)
+ return;
+
+ id = genACnum(id, param);
+
+ double val = ((Slider*)w)->value();
+ track->stopAutoRecord(id, val);
+ }
+
+//---------------------------------------------------------
+// guiSliderRightClicked
+//---------------------------------------------------------
+
+void PluginGui::guiSliderRightClicked(const QPoint &p, int idx)
+{
+ int param = gw[idx].param;
+ int id = plugin->id();
+ if(id != -1)
+ //song->execAutomationCtlPopup((AudioTrack*)plugin->track(), p, genACnum(id, param));
+ song->execAutomationCtlPopup(plugin->track(), p, genACnum(id, param));
+}
+
+//---------------------------------------------------------
+// PluginWidgetFactory
+//---------------------------------------------------------
+#if 0 // ddskrjo
+QWidget* PluginWidgetFactory::createWidget(const QString& className, QWidget* parent, const char* name) const
+{
+ if(className == "DoubleLabel")
+ return new DoubleLabel(parent, name);
+ if(className == "Slider")
+ return new Slider(parent, name);
+ return 0;
+};
+#endif
diff --git a/muse2/muse/plugin.h b/muse2/muse/plugin.h
new file mode 100644
index 00000000..70573796
--- /dev/null
+++ b/muse2/muse/plugin.h
@@ -0,0 +1,536 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: plugin.h,v 1.9.2.13 2009/12/06 01:25:21 terminator356 Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __PLUGIN_H__
+#define __PLUGIN_H__
+
+#include <list>
+#include <vector>
+
+#include <q3mainwindow.h>
+#include <qstring.h>
+#include <qwidget.h>
+//#include <qwidgetfactory.h>
+#include <qdialog.h>
+#include <qfileinfo.h>
+#include <qcombobox.h>
+
+#include "ladspa.h"
+#include "globals.h"
+#include "globaldefs.h"
+#include "ctrl.h"
+
+//#include "stringparam.h"
+
+#include "config.h"
+
+#ifdef OSC_SUPPORT
+//class OscIF;
+#include "osc.h"
+#endif
+
+#ifdef DSSI_SUPPORT
+#include <dssi.h>
+#endif
+
+class Xml;
+class QWidget;
+// class QLabel;
+class Slider;
+class Q3ListView;
+class Q3ScrollView;
+class QToolButton;
+class DoubleLabel;
+class AudioTrack;
+class MidiController;
+
+//---------------------------------------------------------
+// PluginWidgetFactory
+//---------------------------------------------------------
+#if 0
+class PluginWidgetFactory : public QWidgetFactory
+{
+ public:
+ virtual QWidget* createWidget(const QString& className, QWidget* parent, const char* name) const;
+};
+#endif
+//---------------------------------------------------------
+// Plugin
+//---------------------------------------------------------
+
+class Plugin {
+ protected:
+ void* _handle;
+ int _references;
+ int _instNo;
+ QFileInfo fi;
+ LADSPA_Descriptor_Function ladspa;
+ const LADSPA_Descriptor *plugin;
+ unsigned long _uniqueID;
+ QString _label;
+ QString _name;
+ QString _maker;
+ QString _copyright;
+
+ bool _isDssi;
+ #ifdef DSSI_SUPPORT
+ const DSSI_Descriptor* dssi_descr;
+ #endif
+
+ //LADSPA_PortDescriptor* _portDescriptors;
+ unsigned long _portCount;
+ unsigned long _inports;
+ unsigned long _outports;
+ unsigned long _controlInPorts;
+ unsigned long _controlOutPorts;
+ std::vector<unsigned long> rpIdx; // Port number to control input index. Item is -1 if it's not a control input.
+
+ bool _inPlaceCapable;
+
+ public:
+ Plugin(QFileInfo* f, const LADSPA_Descriptor* d, bool isDssi = false);
+ ~Plugin();
+
+ QString label() const { return _label; }
+ QString name() const { return _name; }
+ unsigned long id() const { return _uniqueID; }
+ QString maker() const { return _maker; }
+ QString copyright() const { return _copyright; }
+ QString lib(bool complete = true) /*const*/ { return fi.baseName(complete); } // ddskrjo const
+ QString dirPath(bool complete = true) const { return fi.dirPath(complete); }
+ QString filePath() const { return fi.filePath(); }
+ int references() const { return _references; }
+ int incReferences(int);
+ int instNo() { return _instNo++; }
+
+ bool isDssiPlugin() const { return _isDssi; }
+
+ LADSPA_Handle instantiate();
+ void activate(LADSPA_Handle handle) {
+ if (plugin && plugin->activate)
+ plugin->activate(handle);
+ }
+ void deactivate(LADSPA_Handle handle) {
+ if (plugin && plugin->deactivate)
+ plugin->deactivate(handle);
+ }
+ void cleanup(LADSPA_Handle handle) {
+ if (plugin && plugin->cleanup)
+ plugin->cleanup(handle);
+ }
+ void connectPort(LADSPA_Handle handle, int port, float* value) {
+ if(plugin)
+ plugin->connect_port(handle, port, value);
+ }
+ void apply(LADSPA_Handle handle, int n) {
+ if(plugin)
+ plugin->run(handle, n);
+ }
+
+ #ifdef OSC_SUPPORT
+ int oscConfigure(LADSPA_Handle /*handle*/, const char* /*key*/, const char* /*value*/);
+ #endif
+
+ //int ports() { return plugin ? plugin->PortCount : 0; }
+ unsigned long ports() { return _portCount; }
+
+ LADSPA_PortDescriptor portd(unsigned long k) const {
+ return plugin ? plugin->PortDescriptors[k] : 0;
+ //return _portDescriptors[k];
+ }
+
+ LADSPA_PortRangeHint range(unsigned long i) {
+ // FIXME:
+ //return plugin ? plugin->PortRangeHints[i] : 0;
+ return plugin->PortRangeHints[i];
+ }
+
+ double defaultValue(unsigned long port) const;
+ void range(unsigned long i, float*, float*) const;
+
+ const char* portName(unsigned long i) {
+ return plugin ? plugin->PortNames[i] : 0;
+ }
+
+ // Returns (int)-1 if not an input control.
+ unsigned long port2InCtrl(unsigned long p) { return p >= rpIdx.size() ? (unsigned long)-1 : rpIdx[p]; }
+
+ unsigned long inports() const { return _inports; }
+ unsigned long outports() const { return _outports; }
+ unsigned long controlInPorts() const { return _controlInPorts; }
+ unsigned long controlOutPorts() const { return _controlOutPorts; }
+ bool inPlaceCapable() const { return _inPlaceCapable; }
+ };
+
+typedef std::list<Plugin>::iterator iPlugin;
+
+//---------------------------------------------------------
+// PluginList
+//---------------------------------------------------------
+
+class PluginList : public std::list<Plugin> {
+ public:
+ void add(QFileInfo* fi, const LADSPA_Descriptor* d, bool isDssi = false)
+ {
+ push_back(Plugin(fi, d, isDssi));
+ }
+
+ Plugin* find(const QString&, const QString&);
+ PluginList() {}
+ };
+
+//---------------------------------------------------------
+// Port
+//---------------------------------------------------------
+
+struct Port {
+ int idx;
+ float val;
+ float tmpVal;
+
+ bool enCtrl; // Enable controller stream.
+ bool en2Ctrl; // Second enable controller stream (and'ed with enCtrl).
+ };
+
+//---------------------------------------------------------
+// GuiParam
+//---------------------------------------------------------
+
+struct GuiParam {
+ enum {
+ GUI_SLIDER, GUI_SWITCH
+ };
+ int type;
+ int hint;
+
+ DoubleLabel* label;
+ QWidget* actuator; // Slider or Toggle Button (SWITCH)
+ };
+
+//---------------------------------------------------------
+// GuiWidgets
+//---------------------------------------------------------
+
+struct GuiWidgets {
+ enum {
+ SLIDER, DOUBLE_LABEL, QCHECKBOX, QCOMBOBOX
+ };
+ QWidget* widget;
+ int type;
+ int param;
+ };
+
+class PluginI;
+
+/*
+class PluginBase
+{
+ public:
+ bool on() const { return _on; }
+ void setOn(bool val) { _on = val; }
+ int pluginID() { return plugin()->id(); }
+ int id() { return _id; }
+ QString pluginLabel() const { return _plugin->label(); }
+ QString name() const { return _name; }
+
+ AudioTrack* track() { return _track; }
+
+ void enableController(int i, bool v = true) { controls[i].enCtrl = v; }
+ bool controllerEnabled(int i) const { return controls[i].enCtrl; }
+ bool controllerEnabled2(int i) const { return controls[i].en2Ctrl; }
+ void updateControllers();
+
+ void writeConfiguration(int level, Xml& xml);
+ bool readConfiguration(Xml& xml, bool readPreset=false);
+
+ int parameters() const { return controlPorts; }
+ void setParam(int i, double val) { controls[i].tmpVal = val; }
+ double param(int i) const { return controls[i].val; }
+ const char* paramName(int i) { return _plugin->portName(controls[i].idx); }
+ LADSPA_PortRangeHint range(int i)
+ {
+ return _plugin->range(controls[i].idx);
+ }
+};
+*/
+
+//---------------------------------------------------------
+// PluginIBase
+//---------------------------------------------------------
+
+class PluginIBase
+{
+ public:
+ virtual bool on() const = 0;
+ virtual void setOn(bool /*val*/) = 0;
+ virtual int pluginID() = 0;
+ virtual int id() = 0;
+ virtual QString pluginLabel() const = 0;
+ virtual QString name() const = 0;
+
+ virtual AudioTrack* track() = 0;
+
+ virtual void enableController(int /*i*/, bool v = true) = 0;
+ virtual bool controllerEnabled(int /*i*/) const = 0;
+ virtual bool controllerEnabled2(int /*i*/) const = 0;
+ virtual void updateControllers() = 0;
+
+ virtual void writeConfiguration(int /*level*/, Xml& /*xml*/) = 0;
+ virtual bool readConfiguration(Xml& /*xml*/, bool readPreset=false) = 0;
+
+ virtual int parameters() const = 0;
+ virtual void setParam(int /*i*/, double /*val*/) = 0;
+ virtual double param(int /*i*/) const = 0;
+ virtual const char* paramName(int /*i*/) = 0;
+ virtual LADSPA_PortRangeHint range(int /*i*/) = 0;
+};
+
+//---------------------------------------------------------
+// PluginGui
+//---------------------------------------------------------
+
+class PluginGui : public Q3MainWindow {
+ Q_OBJECT
+
+ //PluginI* plugin; // plugin instance
+ PluginIBase* plugin; // plugin instance
+
+ GuiParam* params;
+ int nobj; // number of widgets in gw
+ GuiWidgets* gw;
+
+ QToolButton* onOff;
+ QWidget* mw; // main widget
+ Q3ScrollView* view;
+
+ void updateControls();
+
+ private slots:
+ void load();
+ void save();
+ void bypassToggled(bool);
+ void sliderChanged(double, int);
+ void labelChanged(double, int);
+ void guiParamChanged(int);
+ void ctrlPressed(int);
+ void ctrlReleased(int);
+ void guiParamPressed(int);
+ void guiParamReleased(int);
+ void guiSliderPressed(int);
+ void guiSliderReleased(int);
+ void ctrlRightClicked(const QPoint &, int);
+ void guiSliderRightClicked(const QPoint &, int);
+
+ protected slots:
+ void heartBeat();
+
+ public:
+ //PluginGui(PluginI*);
+ PluginGui(PluginIBase*);
+
+ ~PluginGui();
+ void setOn(bool);
+ void updateValues();
+ };
+
+//---------------------------------------------------------
+// PluginI
+// plugin instance
+//---------------------------------------------------------
+
+#define AUDIO_IN (LADSPA_PORT_AUDIO | LADSPA_PORT_INPUT)
+#define AUDIO_OUT (LADSPA_PORT_AUDIO | LADSPA_PORT_OUTPUT)
+
+//class PluginI {
+class PluginI : public PluginIBase {
+ Plugin* _plugin;
+ int channel;
+ int instances;
+ AudioTrack* _track;
+ int _id;
+
+ LADSPA_Handle* handle; // per instance
+ Port* controls;
+ Port* controlsOut;
+
+ int controlPorts;
+ int controlOutPorts;
+ PluginGui* _gui;
+ bool _on;
+ bool initControlValues;
+ QString _name;
+ QString _label;
+
+ //#ifdef DSSI_SUPPORT
+ //StringParamMap _stringParamMap;
+ //#endif
+
+ #ifdef OSC_SUPPORT
+ OscEffectIF _oscif;
+ #endif
+ bool _showNativeGuiPending;
+
+ void init();
+ void makeGui();
+
+ public:
+ PluginI();
+ ~PluginI();
+
+ Plugin* plugin() const { return _plugin; }
+ bool on() const { return _on; }
+ void setOn(bool val) { _on = val; }
+ PluginGui* gui() const { return _gui; }
+ void deleteGui();
+
+ void setTrack(AudioTrack* t) { _track = t; }
+ AudioTrack* track() { return _track; }
+ int pluginID() { return _plugin->id(); }
+ void setID(int i);
+ int id() { return _id; }
+ void updateControllers();
+
+ bool initPluginInstance(Plugin*, int channels);
+ void setChannels(int);
+ void connect(int ports, float** src, float** dst);
+ void apply(int n);
+
+ void enableController(int i, bool v = true) { controls[i].enCtrl = v; }
+ bool controllerEnabled(int i) const { return controls[i].enCtrl; }
+ void enable2Controller(int i, bool v = true) { controls[i].en2Ctrl = v; }
+ bool controllerEnabled2(int i) const { return controls[i].en2Ctrl; }
+ void enableAllControllers(bool v = true);
+ void enable2AllControllers(bool v = true);
+
+ void activate();
+ void deactivate();
+ QString pluginLabel() const { return _plugin->label(); }
+ QString label() const { return _label; }
+ QString name() const { return _name; }
+ CtrlValueType valueType() const;
+ QString lib() const { return _plugin->lib(); }
+
+ #ifdef OSC_SUPPORT
+ OscEffectIF& oscIF() { return _oscif; }
+ /*
+ int oscConfigure(lo_arg**);
+ int oscControl(lo_arg**);
+ //int oscUpdate(lo_arg**);
+ //int oscExiting(lo_arg**);
+ */
+
+ int oscControl(unsigned long /*dssiPort*/, float /*val*/);
+ int oscConfigure(const char */*key*/, const char */*val*/);
+ int oscUpdate();
+ //int oscExiting();
+ #endif
+
+ void writeConfiguration(int level, Xml& xml);
+ bool readConfiguration(Xml& xml, bool readPreset=false);
+ bool loadControl(Xml& xml);
+ bool setControl(const QString& s, double val);
+ void showGui();
+ void showGui(bool);
+ bool isDssiPlugin() const { return _plugin->isDssiPlugin(); }
+ void showNativeGui();
+ void showNativeGui(bool);
+ bool isShowNativeGuiPending() { return _showNativeGuiPending; }
+ bool guiVisible();
+ bool nativeGuiVisible();
+ int parameters() const { return controlPorts; }
+ void setParam(int i, double val) { controls[i].tmpVal = val; }
+ double param(int i) const { return controls[i].val; }
+ double defaultValue(unsigned int param) const;
+ const char* paramName(int i) { return _plugin->portName(controls[i].idx); }
+ LADSPA_PortDescriptor portd(int i) const { return _plugin->portd(controls[i].idx); }
+ void range(int i, float* min, float* max) const {
+ _plugin->range(controls[i].idx, min, max);
+ }
+ bool isAudioIn(int k) {
+ return (_plugin->portd(k) & AUDIO_IN) == AUDIO_IN;
+ }
+ bool isAudioOut(int k) {
+ return (_plugin->portd(k) & AUDIO_OUT) == AUDIO_OUT;
+ }
+ bool inPlaceCapable() const { return _plugin->inPlaceCapable(); }
+ LADSPA_PortRangeHint range(int i) {
+ return _plugin->range(controls[i].idx);
+ }
+ };
+
+//---------------------------------------------------------
+// Pipeline
+// chain of connected efx inserts
+//---------------------------------------------------------
+
+const int PipelineDepth = 4;
+
+class Pipeline : public std::vector<PluginI*> {
+ float* buffer[MAX_CHANNELS];
+
+ public:
+ Pipeline();
+ ~Pipeline();
+
+ void insert(PluginI* p, int index);
+ void remove(int index);
+ void removeAll();
+ bool isOn(int idx) const;
+ void setOn(int, bool);
+ QString label(int idx) const;
+ QString name(int idx) const;
+ void showGui(int, bool);
+ bool isDssiPlugin(int) const;
+ void showNativeGui(int, bool);
+ void deleteGui(int idx);
+ void deleteAllGuis();
+ bool guiVisible(int);
+ bool nativeGuiVisible(int);
+ void apply(int ports, unsigned long nframes, float** buffer);
+ void move(int idx, bool up);
+ bool empty(int idx) const;
+ void setChannels(int);
+ };
+
+typedef Pipeline::iterator iPluginI;
+typedef Pipeline::const_iterator ciPluginI;
+
+//---------------------------------------------------------
+// PluginDialog
+//---------------------------------------------------------
+
+class PluginDialog : public QDialog {
+ Q3ListView* pList;
+
+ Q_OBJECT
+
+ public:
+ PluginDialog(QWidget* parent=0, const char* name=0, bool modal=true);
+ static Plugin* getPlugin(QWidget* parent);
+ Plugin* value();
+ void accept();
+public slots:
+ void fillPlugs(int i);
+ void fillPlugs(const QString& sortValue);
+ private:
+ QComboBox *sortBox;
+ static int selectedPlugType;
+ static QStringList sortItems;
+ };
+
+extern void initPlugins();
+extern PluginList plugins;
+
+extern bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, int port, float* val);
+extern void ladspaControlRange(const LADSPA_Descriptor* plugin, int i, float* min, float* max);
+extern bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, int port, int ctlnum, int* min, int* max, int* def);
+//extern MidiController* ladspa2MidiController(const LADSPA_Descriptor* plugin, int port, int ctlnum);
+extern float midi2LadspaValue(const LADSPA_Descriptor* plugin, int port, int ctlnum, int val);
+
+#endif
+
diff --git a/muse2/muse/pos.cpp b/muse2/muse/pos.cpp
new file mode 100644
index 00000000..aa9538ca
--- /dev/null
+++ b/muse2/muse/pos.cpp
@@ -0,0 +1,567 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: pos.cpp,v 1.11.2.1 2006/09/19 19:07:08 spamatica Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <cmath>
+
+#include "pos.h"
+#include "xml.h"
+#include "tempo.h"
+#include "globals.h"
+#include "sig.h"
+
+extern int mtcType;
+
+//---------------------------------------------------------
+// Pos
+//---------------------------------------------------------
+
+Pos::Pos()
+ {
+ _type = TICKS;
+ _tick = 0;
+ _frame = 0;
+ sn = -1;
+ }
+
+Pos::Pos(const Pos& p)
+ {
+ _type = p._type;
+ sn = p.sn;
+ _tick = p._tick;
+ _frame = p._frame;
+ }
+
+Pos::Pos(unsigned t, bool ticks)
+ {
+ if (ticks) {
+ _type = TICKS;
+ _tick = t;
+ }
+ else {
+ _type = FRAMES;
+ _frame = t;
+ }
+ sn = -1;
+ }
+
+Pos::Pos(const QString& s)
+ {
+ int m, b, t;
+ sscanf(s.latin1(), "%04d.%02d.%03d", &m, &b, &t);
+ _tick = sigmap.bar2tick(m, b, t);
+ _type = TICKS;
+ sn = -1;
+ }
+
+Pos::Pos(int measure, int beat, int tick)
+ {
+ _tick = sigmap.bar2tick(measure, beat, tick);
+ _type = TICKS;
+ sn = -1;
+ }
+
+Pos::Pos(int min, int sec, int frame, int subframe)
+ {
+ double time = min * 60.0 + sec;
+
+ double f = frame + subframe/100.0;
+ switch(mtcType) {
+ case 0: // 24 frames sec
+ time += f * 1.0/24.0;
+ break;
+ case 1: // 25
+ time += f * 1.0/25.0;
+ break;
+ case 2: // 30 drop frame
+ time += f * 1.0/30.0;
+ break;
+ case 3: // 30 non drop frame
+ time += f * 1.0/30.0;
+ break;
+ }
+ _type = FRAMES;
+ _frame = lrint(time * sampleRate);
+ sn = -1;
+ }
+
+//---------------------------------------------------------
+// setType
+//---------------------------------------------------------
+
+void Pos::setType(TType t)
+ {
+ if (t == _type)
+ return;
+
+ if (_type == TICKS) {
+ // convert from ticks to frames
+ _frame = tempomap.tick2frame(_tick, _frame, &sn);
+ }
+ else {
+ // convert from frames to ticks
+ _tick = tempomap.frame2tick(_frame, _tick, &sn);
+ }
+ _type = t;
+ }
+
+//---------------------------------------------------------
+// operator+=
+//---------------------------------------------------------
+
+Pos& Pos::operator+=(Pos a)
+ {
+ switch(_type) {
+ case FRAMES:
+ _frame += a.frame();
+ break;
+ case TICKS:
+ _tick += a.tick();
+ break;
+ }
+ sn = -1; // invalidate cached values
+ return *this;
+ }
+
+//---------------------------------------------------------
+// operator+=
+//---------------------------------------------------------
+
+Pos& Pos::operator+=(int a)
+ {
+ switch(_type) {
+ case FRAMES:
+ _frame += a;
+ break;
+ case TICKS:
+ _tick += a;
+ break;
+ }
+ sn = -1; // invalidate cached values
+ return *this;
+ }
+
+Pos operator+(Pos a, int b)
+ {
+ Pos c;
+ c.setType(a.type());
+ return c += b;
+ }
+
+Pos operator+(Pos a, Pos b)
+ {
+ Pos c = a;
+ return c += b;
+ }
+
+bool Pos::operator>=(const Pos& s) const
+ {
+ if (_type == FRAMES)
+ return _frame >= s.frame();
+ else
+ return _tick >= s.tick();
+ }
+
+bool Pos::operator>(const Pos& s) const
+ {
+ if (_type == FRAMES)
+ return _frame > s.frame();
+ else
+ return _tick > s.tick();
+ }
+
+bool Pos::operator<(const Pos& s) const
+ {
+ if (_type == FRAMES)
+ return _frame < s.frame();
+ else
+ return _tick < s.tick();
+ }
+
+bool Pos::operator<=(const Pos& s) const
+ {
+ if (_type == FRAMES)
+ return _frame <= s.frame();
+ else
+ return _tick <= s.tick();
+ }
+
+bool Pos::operator==(const Pos& s) const
+ {
+ if (_type == FRAMES)
+ return _frame == s.frame();
+ else
+ return _tick == s.tick();
+ }
+
+//---------------------------------------------------------
+// tick
+//---------------------------------------------------------
+
+unsigned Pos::tick() const
+ {
+ if (_type == FRAMES)
+ _tick = tempomap.frame2tick(_frame, _tick, &sn);
+ return _tick;
+ }
+
+//---------------------------------------------------------
+// frame
+//---------------------------------------------------------
+
+unsigned Pos::frame() const
+ {
+ if (_type == TICKS)
+ _frame = tempomap.tick2frame(_tick, _frame, &sn);
+ return _frame;
+ }
+
+//---------------------------------------------------------
+// setTick
+//---------------------------------------------------------
+
+void Pos::setTick(unsigned pos)
+ {
+ _tick = pos;
+ sn = -1;
+ if (_type == FRAMES)
+ _frame = tempomap.tick2frame(pos, &sn);
+ }
+
+//---------------------------------------------------------
+// setFrame
+//---------------------------------------------------------
+
+void Pos::setFrame(unsigned pos)
+ {
+ _frame = pos;
+ sn = -1;
+ if (_type == TICKS)
+ _tick = tempomap.frame2tick(pos, &sn);
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void Pos::write(int level, Xml& xml, const char* name) const
+ {
+ xml.nput(level++, "<%s ", name);
+
+ switch(_type) {
+ case TICKS:
+ xml.nput("tick=\"%d\"", _tick);
+ break;
+ case FRAMES:
+ xml.nput("frame=\"%d\"", _frame);
+ break;
+ }
+ xml.put(" />", name);
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void Pos::read(Xml& xml, const char* name)
+ {
+ sn = -1;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+
+ case Xml::TagStart:
+ xml.unknown(name);
+ break;
+
+ case Xml::Attribut:
+ if (tag == "tick") {
+ _tick = xml.s2().toInt();
+ _type = TICKS;
+ }
+ else if (tag == "frame") {
+ _frame = xml.s2().toInt();
+ _type = FRAMES;
+ }
+ else if (tag == "sample") { // obsolete
+ _frame = xml.s2().toInt();
+ _type = FRAMES;
+ }
+ else
+ xml.unknown(name);
+ break;
+
+ case Xml::TagEnd:
+ if (tag == name)
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// PosLen
+//---------------------------------------------------------
+
+PosLen::PosLen()
+ {
+ _lenTick = 0;
+ _lenFrame = 0;
+ sn = -1;
+ }
+
+PosLen::PosLen(const PosLen& p)
+ : Pos(p)
+ {
+ _lenTick = p._lenTick;
+ _lenFrame = p._lenFrame;
+ sn = -1;
+ }
+
+//---------------------------------------------------------
+// dump
+//---------------------------------------------------------
+
+void PosLen::dump(int n) const
+ {
+ Pos::dump(n);
+ printf(" Len(");
+ switch(type()) {
+ case FRAMES:
+ printf("samples=%d)\n", _lenFrame);
+ break;
+ case TICKS:
+ printf("ticks=%d)\n", _lenTick);
+ break;
+ }
+ }
+
+void Pos::dump(int /*n*/) const
+ {
+ printf("Pos(%s, sn=%d, ", type() == FRAMES ? "Frames" : "Ticks", sn);
+ switch(type()) {
+ case FRAMES:
+ printf("samples=%d)", _frame);
+ break;
+ case TICKS:
+ printf("ticks=%d)", _tick);
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void PosLen::write(int level, Xml& xml, const char* name) const
+ {
+ xml.nput(level++, "<%s ", name);
+
+ switch(type()) {
+ case TICKS:
+ xml.nput("tick=\"%d\" len=\"%d\"", tick(), _lenTick);
+ break;
+ case FRAMES:
+ xml.nput("sample=\"%d\" len=\"%d\"", frame(), _lenFrame);
+ break;
+ }
+ xml.put(" />", name);
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void PosLen::read(Xml& xml, const char* name)
+ {
+ sn = -1;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+
+ case Xml::TagStart:
+ xml.unknown(name);
+ break;
+
+ case Xml::Attribut:
+ if (tag == "tick") {
+ setType(TICKS);
+ setTick(xml.s2().toInt());
+ }
+ else if (tag == "sample") {
+ setType(FRAMES);
+ setFrame(xml.s2().toInt());
+ }
+ else if (tag == "len") {
+ int n = xml.s2().toInt();
+ switch(type()) {
+ case TICKS:
+ setLenTick(n);
+ break;
+ case FRAMES:
+ setLenFrame(n);
+ break;
+ }
+ }
+ else
+ xml.unknown(name);
+ break;
+
+ case Xml::TagEnd:
+ if (tag == name)
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// setLenTick
+//---------------------------------------------------------
+
+void PosLen::setLenTick(unsigned len)
+ {
+ _lenTick = len;
+ sn = -1;
+// if (type() == FRAMES)
+ _lenFrame = tempomap.deltaTick2frame(tick(), tick() + len, &sn);
+ }
+
+//---------------------------------------------------------
+// setLenFrame
+//---------------------------------------------------------
+
+void PosLen::setLenFrame(unsigned len)
+ {
+ _lenFrame = len;
+ sn = -1;
+// if (type() == TICKS)
+ _lenTick = tempomap.deltaFrame2tick(frame(), frame() + len, &sn);
+ }
+
+//---------------------------------------------------------
+// lenTick
+//---------------------------------------------------------
+
+unsigned PosLen::lenTick() const
+ {
+ if (type() == FRAMES)
+ _lenTick = tempomap.deltaFrame2tick(frame(), frame() + _lenFrame, &sn);
+ return _lenTick;
+ }
+
+//---------------------------------------------------------
+// lenFrame
+//---------------------------------------------------------
+
+unsigned PosLen::lenFrame() const
+ {
+ if (type() == TICKS)
+ _lenFrame = tempomap.deltaTick2frame(tick(), tick() + _lenTick, &sn);
+ return _lenFrame;
+ }
+
+//---------------------------------------------------------
+// end
+//---------------------------------------------------------
+
+Pos PosLen::end() const
+ {
+ Pos pos(*this);
+ pos.invalidSn();
+ switch(type()) {
+ case FRAMES:
+ pos.setFrame(pos.frame() + _lenFrame);
+ break;
+ case TICKS:
+ pos.setTick(pos.tick() + _lenTick);
+ break;
+ }
+ return pos;
+ }
+
+//---------------------------------------------------------
+// setPos
+//---------------------------------------------------------
+
+void PosLen::setPos(const Pos& pos)
+ {
+ switch(pos.type()) {
+ case FRAMES:
+ setFrame(pos.frame());
+ break;
+ case TICKS:
+ setTick(pos.tick());
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// mbt
+//---------------------------------------------------------
+
+void Pos::mbt(int* bar, int* beat, int* tk) const
+ {
+ sigmap.tickValues(tick(), bar, beat, (unsigned*)tk);
+ }
+
+//---------------------------------------------------------
+// msf
+//---------------------------------------------------------
+
+void Pos::msf(int* min, int* sec, int* fr, int* subFrame) const
+ {
+ double time = double(frame()) / double(sampleRate);
+ *min = int(time) / 60;
+ *sec = int(time) % 60;
+ double rest = time - (*min * 60 + *sec);
+ switch(mtcType) {
+ case 0: // 24 frames sec
+ rest *= 24;
+ break;
+ case 1: // 25
+ rest *= 25;
+ break;
+ case 2: // 30 drop frame
+ rest *= 30;
+ break;
+ case 3: // 30 non drop frame
+ rest *= 30;
+ break;
+ }
+ *fr = int(rest);
+ *subFrame = int((rest- *fr)*100);
+ }
+
+//---------------------------------------------------------
+// isValid
+//---------------------------------------------------------
+
+bool Pos::isValid(int,int,int)
+ {
+ return true;
+ }
+
+//---------------------------------------------------------
+// isValid
+//---------------------------------------------------------
+
+bool Pos::isValid(int,int,int,int)
+ {
+ return true;
+ }
+
diff --git a/muse2/muse/pos.h b/muse2/muse/pos.h
new file mode 100644
index 00000000..33c08f6b
--- /dev/null
+++ b/muse2/muse/pos.h
@@ -0,0 +1,99 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: pos.h,v 1.8 2004/07/14 15:27:26 wschweer Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __POS_H__
+#define __POS_H__
+
+class Xml;
+class QString;
+
+//---------------------------------------------------------
+// Pos
+// depending on type _tick or _frame is a cached
+// value. When the tempomap changes, all cached values
+// are invalid. Sn is used to check for tempomap
+// changes.
+//---------------------------------------------------------
+
+class Pos {
+ public:
+ enum TType { TICKS, FRAMES };
+
+ private:
+ TType _type;
+ mutable int sn;
+ mutable unsigned _tick;
+ mutable unsigned _frame;
+
+ public:
+ Pos();
+ Pos(const Pos&);
+ Pos(int,int,int);
+ Pos(int,int,int,int);
+ Pos(unsigned, bool ticks=true);
+ Pos(const QString&);
+ void dump(int n = 0) const;
+ void mbt(int*, int*, int*) const;
+ void msf(int*, int*, int*, int*) const;
+
+ void invalidSn() { sn = -1; }
+
+ TType type() const { return _type; }
+ void setType(TType t);
+
+ Pos& operator+=(Pos a);
+ Pos& operator+=(int a);
+
+ bool operator>=(const Pos& s) const;
+ bool operator>(const Pos& s) const;
+ bool operator<(const Pos& s) const;
+ bool operator<=(const Pos& s) const;
+ bool operator==(const Pos& s) const;
+
+ friend Pos operator+(Pos a, Pos b);
+ friend Pos operator+(Pos a, int b);
+
+ unsigned tick() const;
+ unsigned frame() const;
+ void setTick(unsigned);
+ void setFrame(unsigned);
+
+ void write(int level, Xml&, const char*) const;
+ void read(Xml& xml, const char*);
+ bool isValid() const { return true; }
+ static bool isValid(int m, int b, int t);
+ static bool isValid(int, int, int, int);
+ };
+
+//---------------------------------------------------------
+// PosLen
+//---------------------------------------------------------
+
+class PosLen : public Pos {
+ mutable unsigned _lenTick;
+ mutable unsigned _lenFrame;
+ mutable int sn;
+
+ public:
+ PosLen();
+ PosLen(const PosLen&);
+ void dump(int n = 0) const;
+
+ void write(int level, Xml&, const char*) const;
+ void read(Xml& xml, const char*);
+ void setLenTick(unsigned);
+ void setLenFrame(unsigned);
+ unsigned lenTick() const;
+ unsigned lenFrame() const;
+ Pos end() const;
+ unsigned endTick() const { return end().tick(); }
+ unsigned endFrame() const { return end().frame(); }
+ void setPos(const Pos&);
+ };
+
+#endif
diff --git a/muse2/muse/remote/Makefile.am b/muse2/muse/remote/Makefile.am
new file mode 100644
index 00000000..a1335682
--- /dev/null
+++ b/muse2/muse/remote/Makefile.am
@@ -0,0 +1,15 @@
+include $(top_srcdir)/common.am
+
+noinst_LIBRARIES = libremote.a
+
+if PCH
+AM_CXXFLAGS += -include $(top_srcdir)/all.h
+else
+AM_CXXFLAGS += -DINSTPREFIX=\"$(prefix)\"
+endif
+
+AM_CPPFLAGS += -I$(PYTHON_INCLUDES) -DENABLE_PYTHON
+
+dist_libremote_a_SOURCES = \
+ pyapi.cpp pyapi.h
+
diff --git a/muse2/muse/remote/Makefile.in b/muse2/muse/remote/Makefile.in
new file mode 100644
index 00000000..ecae5271
--- /dev/null
+++ b/muse2/muse/remote/Makefile.in
@@ -0,0 +1,590 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/common.am
+@PCH_TRUE@am__append_1 = -include $(top_srcdir)/all.h
+@PCH_FALSE@am__append_2 = -DINSTPREFIX=\"$(prefix)\"
+subdir = muse/remote
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
+ $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libremote_a_AR = $(AR) $(ARFLAGS)
+libremote_a_LIBADD =
+dist_libremote_a_OBJECTS = pyapi.$(OBJEXT)
+libremote_a_OBJECTS = $(dist_libremote_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(dist_libremote_a_SOURCES)
+DIST_SOURCES = $(dist_libremote_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCBOOKSTYLE = @DOCBOOKSTYLE@
+DOCBOOKTARGETS = @DOCBOOKTARGETS@
+DOT = @DOT@
+DOTPATH = @DOTPATH@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@
+FST_CFLAGS = @FST_CFLAGS@
+FST_LIBS = @FST_LIBS@
+Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@
+Fluidsynth_LIBS = @Fluidsynth_LIBS@
+GIVERTCAP = @GIVERTCAP@
+GREP = @GREP@
+HAVEDOT = @HAVEDOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JADE = @JADE@
+LASH_CFLAGS = @LASH_CFLAGS@
+LASH_LIBS = @LASH_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LO_CFLAGS = @LO_CFLAGS@
+LO_LIBS = @LO_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUSECXXFLAGS = @MUSECXXFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSGMLS = @NSGMLS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCH = @PCH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIB = @PYTHON_LIB@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+QTDIR_BIN = @QTDIR_BIN@
+QTDIR_INC = @QTDIR_INC@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+SUIDBUILD = @SUIDBUILD@
+SUIDINSTALL = @SUIDINSTALL@
+USE_SSE = @USE_SSE@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+have_docbook = @have_docbook@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+synth_fluid = @synth_fluid@
+synth_fluidsynth = @synth_fluidsynth@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \
+ -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(am__append_1) \
+ $(am__append_2)
+AM_CPPFLAGS = -I$(PYTHON_INCLUDES) -DENABLE_PYTHON
+MOC = $(QTDIR_BIN)/moc
+#UIC = $(QTDIR_BIN)/uic3
+UIC = /usr/bin/uic3
+UIFILES = $(wildcard *.ui)
+MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \
+ if grep -q Q_OBJECT $$h; then \
+ echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \
+ fi; \
+ done)
+
+BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+SUFFIXES = .ui .h.gch
+noinst_LIBRARIES = libremote.a
+dist_libremote_a_SOURCES = \
+ pyapi.cpp pyapi.h
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .ui .h.gch .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/remote/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu muse/remote/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libremote.a: $(libremote_a_OBJECTS) $(libremote_a_DEPENDENCIES)
+ -rm -f libremote.a
+ $(libremote_a_AR) libremote.a $(libremote_a_OBJECTS) $(libremote_a_LIBADD)
+ $(RANLIB) libremote.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pyapi.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+de:
+ @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done
+
+nde:
+ @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done
+
+.ui.o: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(CXXCOMPILE) -c $*.cpp -o $*.o
+ $(RM) $*.cpp moc_$*.cpp moc_$*.o
+
+.ui.lo: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(LTCXXCOMPILE) -c $*.cpp -o $*.lo
+ $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o
+
+moc_%.cpp: %.h
+ $(MOC) $< -o $@
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/muse2/muse/remote/pyapi.cpp b/muse2/muse/remote/pyapi.cpp
new file mode 100644
index 00000000..e71b8a18
--- /dev/null
+++ b/muse2/muse/remote/pyapi.cpp
@@ -0,0 +1,1142 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// (C) Copyright 2009 Mathias Gyllengahm (lunar_shuttle@users.sf.net)
+//=========================================================
+#include <Python.h>
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <pthread.h>
+
+#include <qobject.h>
+#include <qapplication.h>
+#include <qevent.h>
+
+#include "pyapi.h"
+#include "song.h"
+#include "tempo.h"
+#include "track.h"
+#include "audio.h"
+#include "gconfig.h"
+#include "midictrl.h"
+#include "midiport.h"
+#include "plugin.h"
+#include "midi.h"
+#include "app.h"
+
+// Steals ref: PyList_SetItem, PyTuple_SetItem
+using namespace std;
+
+static pthread_t pyapiThread;
+//------------------------------------------------------------
+QPybridgeEvent::QPybridgeEvent(QPybridgeEvent::EventType _type, int _p1, int _p2)
+ :QEvent(QEvent::User),
+ type(_type),
+ p1(_p1),
+ p2(_p2)
+{
+}
+//------------------------------------------------------------
+// Get current position
+//------------------------------------------------------------
+PyObject* getCPos(PyObject*, PyObject*)
+{
+ return Py_BuildValue("i", song->cpos());
+}
+//------------------------------------------------------------
+// Get position of left locator
+//------------------------------------------------------------
+PyObject* getLPos(PyObject*, PyObject*)
+{
+ return Py_BuildValue("i", song->lpos());
+}
+//------------------------------------------------------------
+// Get position of right locator
+//------------------------------------------------------------
+PyObject* getRPos(PyObject*, PyObject*)
+{
+ return Py_BuildValue("i", song->rpos());
+}
+//------------------------------------------------------------
+// Start playing from current position
+//------------------------------------------------------------
+PyObject* startPlay(PyObject*, PyObject*)
+{
+ //song->setPlay(true);
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETPLAY);
+ QApplication::postEvent(song, pyevent);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+//------------------------------------------------------------
+// Stop playing
+//------------------------------------------------------------
+PyObject* stopPlay(PyObject*, PyObject*)
+{
+ //song->setStop(true);
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETSTOP);
+ QApplication::postEvent(song, pyevent);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+//------------------------------------------------------------
+// Rewind to start
+//------------------------------------------------------------
+PyObject* rewindStart(PyObject*, PyObject*)
+{
+ //song->rewindStart();
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_REWIND);
+ QApplication::postEvent(song, pyevent);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+//------------------------------------------------------------
+// Get tempo at specific position
+//------------------------------------------------------------
+PyObject* getTempo(PyObject*, PyObject* args)
+{
+ int tick;
+ if (!PyArg_ParseTuple(args, "i", &tick)) {
+ return Py_BuildValue("i", 1000);
+ }
+
+ int tempovalue = tempomap.tempo(tick);
+ return Py_BuildValue("i", tempovalue);
+}
+//------------------------------------------------------------
+// Get track names
+//------------------------------------------------------------
+PyObject* getTrackNames(PyObject*, PyObject*)
+{
+ TrackList* tracks = song->tracks();
+ PyObject* res = Py_BuildValue("[]");
+ for (ciTrack t = tracks->begin(); t != tracks->end(); ++t) {
+ Track* track = *t;
+ PyObject* ptrackname = Py_BuildValue("s", track->name().latin1());
+ PyList_Append(res, ptrackname);
+ Py_DECREF(ptrackname);
+ }
+
+ return res;
+}
+//------------------------------------------------------------
+// Find part by serial nr
+//------------------------------------------------------------
+Part* findPartBySerial(int sn)
+{
+ TrackList* tracks = song->tracks();
+ for (ciTrack t = tracks->begin(); t != tracks->end(); ++t) {
+ Track* track = *t;
+ PartList* parts = track->parts();
+ for (ciPart p = parts->begin(); p != parts->end(); p++) {
+ Part* part = p->second;
+ if (part->sn() == sn)
+ return part;
+ }
+ }
+
+ return NULL;
+}
+//------------------------------------------------------------
+// Get parts from track
+//------------------------------------------------------------
+PyObject* getParts(PyObject*, PyObject* args)
+{
+ TrackList* tracks = song->tracks();
+ const char* trackname;
+ if (!PyArg_ParseTuple(args, "s", &trackname)) {
+ return NULL;
+ }
+
+ PyObject* pyparts = Py_BuildValue("[]");
+ for (ciTrack t = tracks->begin(); t != tracks->end(); ++t) {
+ Track* track = *t;
+ if (track->name() != trackname)
+ continue;
+
+ PartList* parts = track->parts();
+ for (ciPart p = parts->begin(); p != parts->end(); p++) {
+ Part* part = p->second;
+
+ MidiPart* mpart = (MidiPart*) part;
+ PyObject* pypart = PyDict_New();
+ int tick = mpart->tick();
+ int lentick = mpart->lenTick();
+ int serialnr = mpart->sn();
+ PyObject* pstrtick = Py_BuildValue("s","tick");
+ PyObject* pitick = Py_BuildValue("i", tick);
+ PyObject* pstrid = Py_BuildValue("s","id");
+ PyObject* pstrserial = Py_BuildValue("i", serialnr);
+ PyObject* pstrlen = Py_BuildValue("s","len");
+ PyObject* pstrtick2 = Py_BuildValue("i", lentick);
+
+ PyDict_SetItem(pypart, pstrtick, pitick);
+ PyDict_SetItem(pypart, pstrid, pstrserial);
+ PyDict_SetItem(pypart, pstrlen, pstrtick2);
+
+ Py_DECREF(pstrtick);
+ Py_DECREF(pitick);
+ Py_DECREF(pstrid);
+ Py_DECREF(pstrserial);
+ Py_DECREF(pstrlen);
+ Py_DECREF(pstrtick2);
+
+ // Pack midi events into list before wrapping it all up
+ EventList* events = mpart->events();
+ PyObject* pyevents = Py_BuildValue("[]");
+ for (ciEvent e = events->begin(); e != events->end(); e++) {
+ PyObject* pyevent = PyDict_New(); // The event structure - a dictionary with keys 'type','tick','data'
+
+ const Event& event = e->second;
+ unsigned tick = e->first;
+ PyObject* eventdata = Py_BuildValue("[i,i,i]", event.dataA(), event.dataB(), event.dataC());
+ PyObject* pstrdata = Py_BuildValue("s", "data");
+ pstrtick = Py_BuildValue("s", "tick");
+ PyObject* pitickval = Py_BuildValue("i", tick);
+ PyDict_SetItem(pyevent, pstrdata, eventdata);
+ PyDict_SetItem(pyevent, pstrtick, pitickval);
+ Py_DECREF(eventdata);
+ Py_DECREF(pstrdata);
+ Py_DECREF(pstrtick);
+ Py_DECREF(pitickval);
+
+ switch(event.type()) {
+ case Note: {
+ PyObject* pstrtype = Py_BuildValue("s", "type");
+ PyObject* pstrnote = Py_BuildValue("s", "note");
+ PyObject* pstrlen = Py_BuildValue("s", "len");
+ PyObject* pilentick = Py_BuildValue("i", event.lenTick());
+ PyDict_SetItem(pyevent, pstrtype, pstrnote);
+ PyDict_SetItem(pyevent, pstrlen, pilentick);
+ Py_DECREF(pstrtype);
+ Py_DECREF(pstrnote);
+ Py_DECREF(pstrlen);
+ Py_DECREF(pilentick);
+ break;
+ }
+ case Controller: {
+ PyObject* pstrtype = Py_BuildValue("s", "type");
+ PyObject* pstrctrl = Py_BuildValue("s", "ctrl");
+ PyDict_SetItem(pyevent, pstrtype, pstrctrl);
+ Py_DECREF(pstrtype);
+ Py_DECREF(pstrctrl);
+ break;
+ }
+ default:
+ printf("Event type not supported yet: %d\n", event.type());
+ break;
+ }
+ PyList_Append(pyevents, pyevent);
+ Py_DECREF(pyevent);
+ }
+ Py_DECREF(pyevents);
+ // Add the event list to the pypart dictionary
+ PyObject* pystrevents = Py_BuildValue("s", "events");
+ PyDict_SetItem(pypart, pystrevents, pyevents);
+ Py_DECREF(pystrevents);
+ PyList_Append(pyparts, pypart);
+ Py_DECREF(pypart);
+ }
+
+ return pyparts;
+ }
+
+ return NULL;
+}
+
+//------------------------------------------------------------
+// parsePythonPart
+// get part id/serialno from python part structure
+//------------------------------------------------------------
+int getPythonPartId(PyObject* part)
+{
+ PyObject* pyid = PyDict_GetItemString(part, "id");
+ int id = PyInt_AsLong(pyid);
+ return id;
+}
+
+//------------------------------------------------------------
+// addPyPartEventsToMusePart
+// parse events from python part structure into muse part
+//------------------------------------------------------------
+bool addPyPartEventsToMusePart(MidiPart* npart, PyObject* part)
+{
+ PyObject* events;
+
+ if (PyDict_Check(part) == false) {
+ printf("Not a dict!\n");
+ return false;
+ }
+ PyObject* pstrevents = Py_BuildValue("s","events");
+ if (PyDict_Contains(part, pstrevents) == false) {
+ Py_DECREF(pstrevents);
+ printf("No events in part data...\n");
+ return false;
+ }
+ Py_DECREF(pstrevents);
+
+ events = PyDict_GetItemString(part, "events");
+
+ if (PyList_Check(events) == false) {
+ printf("Events not a list!\n");
+ return false;
+ }
+
+ //
+ // Go through event list, create MusE events of them and add to new part
+ //
+ Py_ssize_t len = PyList_Size(events);
+ for (Py_ssize_t i=0; i<len; i++) {
+ PyObject* pevent = PyList_GetItem(events, i);
+ if (PyDict_Check(pevent) == false) {
+ printf("Event is not a dictionary!\n");
+ return false;
+ }
+ PyObject* p_etick = PyDict_GetItemString(pevent, "tick");
+ PyObject* p_type = PyDict_GetItemString(pevent, "type");
+ PyObject* p_len = PyDict_GetItemString(pevent, "len");
+ PyObject* p_data = PyDict_GetItemString(pevent, "data"); // list
+
+ int etick = PyInt_AsLong(p_etick);
+ int elen = PyInt_AsLong(p_len);
+ string type = string(PyString_AsString(p_type));
+ int data[3];
+
+ // Traverse data list:
+ for (int j=0; j<3; j++) {
+ PyObject* plItem = PyList_GetItem(p_data, j);
+ data[j] = PyInt_AsLong(plItem);
+ }
+ if (type == "note" || type == "ctrl") {
+ Event event(Note);
+ event.setA(data[0]);
+ event.setB(data[1]);
+ event.setC(data[2]);
+ event.setTick(etick);
+ event.setLenTick(elen);
+ npart->events()->add(event);
+ }
+ else
+ printf("Unhandled event type from python: %s\n", type.c_str());
+ }
+
+ return true;
+}
+//------------------------------------------------------------
+// Create a new part at a particular tick and track
+//------------------------------------------------------------
+PyObject* createPart(PyObject*, PyObject* args)
+{
+ const char* trackname;
+ unsigned tick, tickLen;
+ PyObject* part;
+
+ if (!PyArg_ParseTuple(args, "siiO", &trackname, &tick, &tickLen, &part)) {
+ return NULL;
+ }
+
+ QString qtrackname(trackname);
+ MidiTrack* track = (MidiTrack*) song->findTrack(trackname);
+ if (track == NULL)
+ return NULL;
+
+ MidiPart* npart = new MidiPart(track);
+ npart->setTick(tick);
+ npart->setLenTick(tickLen);
+ addPyPartEventsToMusePart(npart, part);
+
+ song->addPart(npart);
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_UPDATE, SC_TRACK_MODIFIED);
+ QApplication::postEvent(song, pyevent);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+//------------------------------------------------------------
+// Modify a particular part:
+// args: new part data, old part data is used from the part with the same id as the one sent here
+// TODO: Lots and lots of refcount stuff
+//------------------------------------------------------------
+PyObject* modifyPart(PyObject*, PyObject* part)
+{
+ int id = getPythonPartId(part);
+
+ Part* opart = NULL;
+ // Verify a part with that id actually exists, then get it
+ TrackList* tracks = song->tracks();
+ for (ciTrack t = tracks->begin(); t != tracks->end(); ++t) {
+ Track* track = *t;
+ for (ciPart p = track->parts()->begin(); p != track->parts()->end(); p++) {
+ if (p->second->sn() == id) {
+ opart = p->second;
+ break;
+ }
+ }
+ }
+
+ if (opart == NULL) {
+ printf("Part doesn't exist!\n");
+ return NULL;
+ }
+
+ // Remove all note and controller events from current part eventlist
+ std::list< std::pair<const unsigned, Event> > elist;
+ MidiPart* npart = new MidiPart((MidiTrack*)opart->track());
+ npart->setTick(opart->tick());
+ npart->setLenTick(opart->lenTick());
+ npart->setSn(opart->sn());
+
+ for (iEvent e = opart->events()->begin(); e != opart->events()->end(); e++) {
+ Event& event = e->second;
+ if (event.type() == Note || event.type() == Controller)
+ continue;
+
+ npart->events()->add(event);
+ }
+
+ addPyPartEventsToMusePart(npart, part);
+
+ //song->startUndo();
+ song->changePart(opart, npart);
+ //song->endUndo(SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_INSERTED); // Crash! Probably since the call ends up in Qt GUI thread from this thread
+
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_UPDATE, SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_INSERTED);
+ QApplication::postEvent(song, pyevent);
+
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+//------------------------------------------------------------
+// deletePart
+// delete part by serial nr
+//------------------------------------------------------------
+PyObject* deletePart(PyObject*, PyObject* args)
+{
+ int id;
+ if (!PyArg_ParseTuple(args, "i", &id)) {
+ return NULL;
+ }
+
+ Part* part = findPartBySerial(id);
+ if (part == NULL)
+ return NULL;
+
+ song->removePart(part);
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_UPDATE, SC_TRACK_MODIFIED | SC_PART_REMOVED);
+ QApplication::postEvent(song, pyevent);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+//------------------------------------------------------------
+// setPos
+//------------------------------------------------------------
+PyObject* setPos(PyObject*, PyObject* args)
+{
+ int index;
+ int ticks;
+ if (!PyArg_ParseTuple(args, "ii", &index, &ticks)) {
+ return NULL;
+ }
+
+ //song->setPos(index, ticks);
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_POSCHANGE, index, ticks);
+ QApplication::postEvent(song, pyevent);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+
+//------------------------------------------------------------
+// setLen
+//------------------------------------------------------------
+PyObject* setSongLen(PyObject*, PyObject* args)
+{
+ unsigned len;
+
+ if (!PyArg_ParseTuple(args, "i", &len)) {
+ return NULL;
+ }
+ //song->setLen(len);// Appears to not be ok to call from python thread, we do it with event instead
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONGLEN_CHANGE, len);
+ QApplication::postEvent(song, pyevent);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+//------------------------------------------------------------
+// getLen
+//------------------------------------------------------------
+PyObject* getSongLen(PyObject*, PyObject*)
+{
+ PyObject* pylen = Py_BuildValue("i", song->len());
+
+ return pylen;
+}
+//------------------------------------------------------------
+// getDivision
+//------------------------------------------------------------
+PyObject* getDivision(PyObject*, PyObject*)
+{
+ return Py_BuildValue("i", config.division);
+}
+//------------------------------------------------------------
+// setTrackParameter
+//------------------------------------------------------------
+PyObject* setMidiTrackParameter(PyObject*, PyObject* args)
+{
+ const char* trackname;
+ const char* paramname;
+ int value;
+ if(!PyArg_ParseTuple(args, "ssi", &trackname, &paramname, &value))
+ return NULL;
+
+ Track* track = song->findTrack(QString(trackname));
+ if (track == NULL)
+ return NULL;
+
+ MidiTrack* mt = (MidiTrack*) track;
+
+ QString qparamname(paramname);
+ bool changed = false;
+ if (qparamname == "velocity") {
+ changed = true;
+ mt->velocity = value;
+ }
+ else if (qparamname == "compression") {
+ changed = true;
+ mt->compression = value;
+ }
+ else if (qparamname == "transposition") {
+ changed = true;
+ mt->transposition = value;
+ }
+ else if (qparamname == "delay") {
+ changed = true;
+ mt->delay = value;
+ }
+
+ if (changed) {
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_UPDATE, SC_TRACK_MODIFIED);
+ QApplication::postEvent(song, pyevent);
+ }
+
+ return Py_BuildValue("b", changed); // true/false depending on whether anythin was changed
+}
+//------------------------------------------------------------
+// Set loop
+//------------------------------------------------------------
+PyObject* setLoop(PyObject*, PyObject* args)
+{
+ bool loopFlag;
+ if(!PyArg_ParseTuple(args, "b", &loopFlag))
+ return NULL;
+
+ song->setLoop(loopFlag);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+//------------------------------------------------------------
+// Get loop value
+//------------------------------------------------------------
+PyObject* getLoop(PyObject*, PyObject*)
+{
+ return Py_BuildValue("b", song->getLoop());
+}
+//------------------------------------------------------------
+// getMute trackname
+//------------------------------------------------------------
+PyObject* getMute(PyObject*, PyObject* args)
+{
+ const char* trackname;
+ if (!PyArg_ParseTuple(args, "s", &trackname)) {
+ return NULL;
+ }
+
+ Track* track = song->findTrack(QString(trackname));
+ if (track == NULL)
+ return NULL;
+
+ return Py_BuildValue("b", track->isMute());
+}
+//------------------------------------------------------------
+// setMute (trackname, boolean)
+//------------------------------------------------------------
+PyObject* setMute(PyObject*, PyObject* args)
+{
+ const char* trackname;
+ bool muted;
+
+ if (!PyArg_ParseTuple(args, "sb", &trackname, &muted)) {
+ return NULL;
+ }
+
+ Track* track = song->findTrack(QString(trackname));
+ if (track == NULL)
+ return NULL;
+
+ int mutedint = 1;
+ if (muted == false)
+ mutedint = 0;
+
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETMUTE, mutedint);
+ pyevent->setS1(trackname);
+ QApplication::postEvent(song, pyevent);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+//------------------------------------------------------------
+// setController
+//------------------------------------------------------------
+void setController(const char* trackname, int ctrltype, int ctrlval)
+{
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETCTRL, ctrltype, ctrlval);
+ pyevent->setS1(trackname);
+ QApplication::postEvent(song, pyevent);
+}
+
+//------------------------------------------------------------
+// setMidiControllerValue
+//------------------------------------------------------------
+PyObject* setMidiControllerValue(PyObject*, PyObject* args)
+{
+ const char* trackname;
+ int ctrltype;
+ int value;
+
+ if (!PyArg_ParseTuple(args, "sii", &trackname, &ctrltype, &value)) {
+ return NULL;
+ }
+
+ setController(trackname, ctrltype, value);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+//------------------------------------------------------------
+// getMidiControllerValue
+//------------------------------------------------------------
+PyObject* getMidiControllerValue(PyObject*, PyObject* args)
+{
+ const char* trackname;
+ int ctrltype;
+
+ if (!PyArg_ParseTuple(args, "si", &trackname, &ctrltype)) {
+ return NULL;
+ }
+
+ Track* t = song->findTrack(QString(trackname));
+ if (t == NULL)
+ return NULL;
+
+ if (t->isMidiTrack() == false) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+
+ MidiTrack* track = (MidiTrack*) t;
+ int channel = track->outChannel();
+ int outport = track->outPort();
+ MidiPort* mp = &midiPorts[outport];
+ if (mp == NULL)
+ return Py_BuildValue("i", -1);
+
+ int value = mp->hwCtrlState(channel, ctrltype);
+ return Py_BuildValue("i", value);
+}
+//------------------------------------------------------------
+// setAudioTrackVolume
+//------------------------------------------------------------
+PyObject* setAudioTrackVolume(PyObject*, PyObject* args)
+{
+ const char* trackname;
+ double volume = 0.0f;
+
+ if (!PyArg_ParseTuple(args, "sd", &trackname, &volume)) {
+ return NULL;
+ }
+
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETAUDIOVOL);
+ pyevent->setD1(volume);
+ pyevent->setS1(trackname);
+ QApplication::postEvent(song, pyevent);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+//------------------------------------------------------------
+// getAudioTrackVolume
+//------------------------------------------------------------
+PyObject* getAudioTrackVolume(PyObject*, PyObject* args)
+{
+ const char* trackname;
+
+ if (!PyArg_ParseTuple(args, "s", &trackname)) {
+ return NULL;
+ }
+
+ Track* t = song->findTrack(QString(trackname));
+ if (t == NULL)
+ return NULL;
+
+ if (t->type() == Track::DRUM || t->type() == Track::MIDI)
+ return NULL;
+
+ AudioTrack* track = (AudioTrack*) t;
+ return Py_BuildValue("d", track->volume());
+}
+
+//------------------------------------------------------------
+// getSelectedTrack
+//------------------------------------------------------------
+PyObject* getSelectedTrack(PyObject*, PyObject*)
+{
+ TrackList* tracks = song->tracks();
+ for (ciTrack t = tracks->begin(); t != tracks->end(); ++t) {
+ Track* track = *t;
+ if (track->selected())
+ return Py_BuildValue("s", track->name().latin1());
+ }
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+//------------------------------------------------------------
+// importPart
+//------------------------------------------------------------
+PyObject* importPart(PyObject*, PyObject* args)
+{
+ const char* trackname;
+ const char* filename;
+ int tick;
+
+ if (!PyArg_ParseTuple(args, "ssi", &trackname, &filename, &tick)) {
+ return NULL;
+ }
+
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_IMPORT_PART, tick);
+ pyevent->setS1(trackname);
+ pyevent->setS2(filename);
+ QApplication::postEvent(song, pyevent);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+//------------------------------------------------------------
+// getTrackEffects
+//------------------------------------------------------------
+PyObject* getTrackEffects(PyObject*, PyObject* args)
+{
+ const char* trackname;
+ if (!PyArg_ParseTuple(args, "s", &trackname)) {
+ return NULL;
+ }
+
+ Track* t = song->findTrack(QString(trackname));
+ if (t == NULL)
+ return NULL;
+
+ if (t->type() != Track::WAVE)
+ return NULL;
+
+ AudioTrack* track = (AudioTrack*) t;
+ PyObject* pyfxnames = Py_BuildValue("[]");
+ const Pipeline* pipeline = track->efxPipe();
+ for (int i = 0; i < PipelineDepth; i++) {
+ QString name = pipeline->name(i);
+ printf("fx %d name: %s\n", i, name.latin1());
+ PyObject* pyname = Py_BuildValue("s", name.latin1());
+ PyList_Append(pyfxnames, pyname);
+ Py_DECREF(pyname);
+ }
+
+ return pyfxnames;
+}
+//------------------------------------------------------------
+// toggleTrackEffect
+//------------------------------------------------------------
+PyObject* toggleTrackEffect(PyObject*, PyObject* args)
+{
+ const char* trackname;
+ int fxid;
+ bool onoff;
+
+ if (!PyArg_ParseTuple(args, "sib", &trackname, &fxid, &onoff))
+ return NULL;
+
+ Track* t = song->findTrack(QString(trackname));
+ if (t == NULL)
+ return NULL;
+
+ if (t->type() != Track::WAVE)
+ return NULL;
+
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_TOGGLE_EFFECT, fxid, onoff);
+ pyevent->setS1(trackname);
+
+ QApplication::postEvent(song, pyevent);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+//------------------------------------------------------------
+// changeTrackName
+//------------------------------------------------------------
+PyObject* changeTrackName(PyObject*, PyObject* args)
+{
+ const char* trackname;
+ const char* newname;
+
+ if (!PyArg_ParseTuple(args, "ss", &trackname, &newname))
+ return NULL;
+
+ Track* t = song->findTrack(QString(trackname));
+ if (t == NULL)
+ return Py_BuildValue("b", false);
+
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_CHANGE_TRACKNAME);
+ pyevent->setS1(trackname);
+ pyevent->setS2(newname);
+ QApplication::postEvent(song, pyevent);
+ QPybridgeEvent* pyevent2 = new QPybridgeEvent(QPybridgeEvent::SONG_UPDATE, SC_TRACK_MODIFIED);
+ QApplication::postEvent(song, pyevent2);
+ return Py_BuildValue("b", true);
+}
+//------------------------------------------------------------
+// addMidiTrack
+//------------------------------------------------------------
+PyObject* addMidiTrack(PyObject*, PyObject*)
+{
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_ADD_TRACK, Track::MIDI);
+ QApplication::postEvent(song, pyevent);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+//------------------------------------------------------------
+// addWaveTrack
+//------------------------------------------------------------
+PyObject* addWaveTrack(PyObject*, PyObject*)
+{
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_ADD_TRACK, Track::WAVE);
+ QApplication::postEvent(song, pyevent);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+//------------------------------------------------------------
+// addInput
+//------------------------------------------------------------
+PyObject* addInput(PyObject*, PyObject*)
+{
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_ADD_TRACK, Track::AUDIO_INPUT);
+ QApplication::postEvent(song, pyevent);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+//------------------------------------------------------------
+// addOutput
+//------------------------------------------------------------
+PyObject* addOutput(PyObject*, PyObject*)
+{
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_ADD_TRACK, Track::AUDIO_OUTPUT);
+ QApplication::postEvent(song, pyevent);
+ return Py_None;
+}
+//------------------------------------------------------------
+// addGroup
+//------------------------------------------------------------
+PyObject* addGroup(PyObject*, PyObject*)
+{
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_ADD_TRACK, Track::AUDIO_GROUP);
+ QApplication::postEvent(song, pyevent);
+ return Py_None;
+}
+//------------------------------------------------------------
+// deleteTrack
+//------------------------------------------------------------
+PyObject* deleteTrack(PyObject*, PyObject* args)
+{
+ const char* trackname;
+
+ if (!PyArg_ParseTuple(args, "s", &trackname))
+ return NULL;
+
+ QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_DELETE_TRACK);
+ pyevent->setS1(trackname);
+ QApplication::postEvent(song, pyevent);
+ return Py_None;
+}
+//------------------------------------------------------------
+// getOutputRoute
+//------------------------------------------------------------
+/*
+PyObject* getOutputRoute(PyObject*, PyObject* args)
+{
+ const char* trackname;
+
+ if (!PyArg_ParseTuple(args, "s", &trackname))
+ return NULL;
+
+ Track* tt = song->findTrack(QString(trackname));
+ if (tt == NULL)
+ return Py_BuildValue("b", false);
+
+ PyObject* routes = Py_BuildValue("[]");
+ if (tt->type() == Track::WAVE && tt->type() == Track::AUDIO_AUX) {
+ AudioTrack* t = (AudioTrack*)tt;
+ RouteList* r = t->outRoutes();
+
+ OutputList* al = song->outputs();
+ for (iAudioOutput i = al->begin(); i != al->end(); ++i) {
+ Track* track = *i;
+ if (t == track)
+ continue;
+
+ QString s(track->name());
+
+ // for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
+ // if (ir->type == 0 && ir->track == track) {
+ // s += "*";
+ // PyList_Append(routes, Py_BuildValue("s", s.latin1()));
+ // break;
+ // }
+ // }
+ //
+ }
+ }
+ else if (tt->type() == Track::AUDIO_OUTPUT) {
+ }
+
+
+
+ return routes;
+}
+*/
+//------------------------------------------------------------
+// Global method definitions for MusE:s Python API
+//
+// This is where global functions in Python is linked to their equivalent C/C++ functions
+//------------------------------------------------------------
+PyMethodDef g_methodDefinitions[] =
+{
+ { "startPlay", startPlay, METH_VARARGS, "Starts playing the song from current position" },
+ { "stopPlay", stopPlay, METH_VARARGS, "Stops playback if currently playing" },
+ { "rewindStart", rewindStart, METH_VARARGS, "Set current position to beginning of song" },
+ { "getCPos", getCPos, METH_NOARGS, "Get current position (in ticks)" },
+ { "getLPos", getLPos, METH_NOARGS, "Get position of left locator (in ticks)" },
+ { "getRPos", getRPos, METH_NOARGS, "Get position of right locator (in ticks)" },
+ { "setPos", setPos, METH_VARARGS, "Set position of locators or current position" },
+ { "getTempo", getTempo, METH_VARARGS, "Get tempo of the song at a particular tick" },
+ { "setLoop", setLoop, METH_VARARGS, "Set loop mode on/off" },
+ { "getLoop", getLoop, METH_NOARGS, "Get loop value" },
+
+ { "getTrackNames", getTrackNames, METH_VARARGS, "Get track names (which are unique)" },
+ { "getParts", getParts, METH_VARARGS, "Get part data from a track" },
+ { "createPart", createPart, METH_VARARGS, "Create a part" },
+ { "modifyPart", modifyPart, METH_O, "Modify a particular part" },
+ { "deletePart", deletePart, METH_VARARGS, "Remove part with a particular serial nr" },
+ { "getSelectedTrack", getSelectedTrack, METH_NOARGS, "Get first selected track" },
+ { "importPart", importPart, METH_VARARGS, "Import part file to a track at a particular position" },
+ { "changeTrackName", changeTrackName, METH_VARARGS, "Change track name" },
+ { "addMidiTrack", addMidiTrack, METH_NOARGS, "Add a midi track" },
+ { "addWaveTrack", addWaveTrack, METH_NOARGS, "Add a wave track" },
+ { "addInput", addInput, METH_NOARGS, "Add audio input" },
+ { "addOutput", addOutput, METH_NOARGS, "Add audio output" },
+ { "addGroup", addGroup, METH_NOARGS, "Add audio group" },
+ { "deleteTrack", deleteTrack, METH_VARARGS, "Delete a track" },
+
+ { "getTrackEffects", getTrackEffects, METH_VARARGS, "Get names of LADSPA effects on a track" },
+ { "toggleTrackEffect", toggleTrackEffect, METH_VARARGS, "Toggle LADSPA effect on/off" },
+ //{ "getOutputRoute", getOutputRoute, METH_VARARGS, "Get route for an audio output" },
+
+ { "setSongLen", setSongLen, METH_VARARGS, "Set length of song (in ticks)" },
+ { "getSongLen", getSongLen, METH_VARARGS, "Get length of song (in ticks)" },
+
+ { "getMute", getMute, METH_VARARGS, "Get track mute property (if track is played or not)" },
+ { "setMute", setMute, METH_VARARGS, "Set track mute property (if track should be played or not)" },
+ { "setMidiControllerValue", setMidiControllerValue, METH_VARARGS, "Set midi controller value for a track" },
+ { "getMidiControllerValue", getMidiControllerValue, METH_VARARGS, "Get midi controller value for a track" },
+ { "setAudioTrackVolume", setAudioTrackVolume, METH_VARARGS, "Set volume on audio track/aux/output/input" },
+ { "getAudioTrackVolume", getAudioTrackVolume, METH_VARARGS, "Get audio track/aux/output/input volume" },
+
+ { "setMidiTrackParameter", setMidiTrackParameter, METH_VARARGS, "Set transposition, velocity, compression or delay on track level" },
+
+ { "getDivision", getDivision, METH_VARARGS, "Number of ticks per 1/4 (?)" },
+
+ {NULL, NULL, NULL, NULL}
+};
+
+/**
+ * This function launches the Pyro name service, which blocks execution
+ * Thus it needs its own thread
+ **/
+static void* pyapithreadfunc(void*)
+{
+ Py_Initialize();
+ PyImport_AddModule("muse");
+ Py_InitModule( "muse", g_methodDefinitions );
+
+ //
+ // Access the "__main__" module and its name-space dictionary.
+ //
+
+ PyObject *pMainModule = PyImport_AddModule( "__main__" );
+ PyObject *pMainDictionary = PyModule_GetDict( pMainModule );
+ string launcherfilename = string(INSTPREFIX) + string("/share/muse/pybridge/museplauncher.py");
+ printf("Initiating MusE Pybridge launcher from %s\n", launcherfilename.c_str());
+ FILE* fp = fopen(launcherfilename.c_str(),"r");
+ PyRun_File(fp, launcherfilename.c_str(), Py_file_input, pMainDictionary, pMainDictionary);
+ fclose(fp);
+
+ return NULL;
+}
+
+/**
+ * This function currently only launches the thread. There should be some kind of check that
+ * things are up and running as they are supposed to
+ */
+bool initPythonBridge()
+{
+ if (pthread_create(&pyapiThread, NULL, ::pyapithreadfunc, 0)) {
+ return false;
+ }
+ return true; // TODO: Verify that things are up and running!
+}
+
+//---------------------------------------------------------
+// event
+//
+// Function in Song class, run in the Qt event thread context.
+// Handles events sent from the Python bridge subsystem
+//
+// This is part of Qt:s event handling and events are fed
+// here via QApplication::postEvent since gui updates should
+// be done by Qt:s GUI thread. QApplication::postEvent is
+// a static method, which is threadsafe. Using the song object
+// from the Python thread is dangerous when it comes to
+// operations that manipulate the gui itself (read is ok)
+//---------------------------------------------------------
+bool Song::event(QEvent* _e)
+{
+ if (_e->type() != QEvent::User)
+ return false; //ignore all events except user events, which are events from Python bridge subsystem
+
+ QPybridgeEvent* e = (QPybridgeEvent*) _e;
+ switch (e->getType()) {
+ case QPybridgeEvent::SONG_UPDATE:
+ this->update(e->getP1());
+ break;
+ case QPybridgeEvent::SONGLEN_CHANGE:
+ this->setLen(e->getP1());
+ break;
+ case QPybridgeEvent::SONG_POSCHANGE:
+ this->setPos(e->getP1(), e->getP2());
+ break;
+ case QPybridgeEvent::SONG_SETPLAY:
+ this->setPlay(true);
+ break;
+ case QPybridgeEvent::SONG_SETSTOP:
+ this->setStop(true);
+ break;
+ case QPybridgeEvent::SONG_REWIND:
+ this->rewindStart();
+ break;
+ case QPybridgeEvent::SONG_SETMUTE: {
+ Track* track = this->findTrack(e->getS1());
+ if (track == NULL)
+ return false;
+
+ bool muted = e->getP1() == 1;
+ track->setMute(muted);
+ this->update(SC_MUTE | SC_TRACK_MODIFIED);
+ break;
+ }
+ case QPybridgeEvent::SONG_SETCTRL: {
+ Track* t = this->findTrack(e->getS1());
+ if (t == NULL)
+ return false;
+
+ if (t->isMidiTrack() == false)
+ return false;
+
+ MidiTrack* track = (MidiTrack*) t;
+ int chan = track->outChannel();
+
+ int num = e->getP1();
+ int val = e->getP2();
+ int tick = song->cpos();
+ MidiPlayEvent ev(tick, track->outPort(), chan, ME_CONTROLLER, num, val);
+ audio->msgPlayMidiEvent(&ev);
+ song->update(SC_MIDI_CONTROLLER);
+ break;
+ }
+ case QPybridgeEvent::SONG_SETAUDIOVOL: {
+ Track* t = this->findTrack(e->getS1());
+ if (t == NULL)
+ return false;
+
+ if (t->type() == Track::DRUM || t->type() == Track::MIDI)
+ return false;
+
+ AudioTrack* track = (AudioTrack*) t;
+ track->setVolume(e->getD1());
+ break;
+ }
+ case QPybridgeEvent::SONG_IMPORT_PART: {
+ Track* track = this->findTrack(e->getS1());
+ QString filename = e->getS2();
+ unsigned int tick = e->getP1();
+ if (track == NULL)
+ return false;
+
+ muse->importPartToTrack(filename, tick, track);
+ break;
+ }
+ case QPybridgeEvent::SONG_TOGGLE_EFFECT: {
+ Track* t = this->findTrack(e->getS1());
+ if (t == NULL)
+ return false;
+
+ if (t->type() != Track::WAVE)
+ return false;
+
+ int fxid = e->getP1();
+
+ if (fxid > PipelineDepth)
+ return false;
+
+ int onoff = (e->getP2() == 1);
+
+ AudioTrack* track = (AudioTrack*) t;
+ Pipeline* pipeline = track->efxPipe();
+ pipeline->setOn(fxid, onoff);
+ break;
+ }
+ case QPybridgeEvent::SONG_ADD_TRACK:
+ song->addTrack(e->getP1());
+ break;
+ case QPybridgeEvent::SONG_CHANGE_TRACKNAME: {
+ Track* t = this->findTrack(e->getS1());
+ if (t == NULL)
+ return false;
+ t->setName(e->getS2());
+ break;
+ }
+ case QPybridgeEvent::SONG_DELETE_TRACK: {
+ Track* t = this->findTrack(e->getS1());
+ if (t == NULL)
+ return false;
+
+ audio->msgRemoveTrack(t);
+ break;
+ }
+ default:
+ printf("Unknown pythonthread event received: %d\n", e->getType());
+ break;
+ }
+
+
+ return true;
+}
+
+
diff --git a/muse2/muse/remote/pyapi.h b/muse2/muse/remote/pyapi.h
new file mode 100644
index 00000000..582f8b34
--- /dev/null
+++ b/muse2/muse/remote/pyapi.h
@@ -0,0 +1,40 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// (C) Copyright 2009 Mathias Gyllengahm (lunar_shuttle@users.sf.net)
+//=========================================================
+#ifndef PYAPI_H
+#define PYAPI_H
+
+#include <qevent.h>
+
+class QPybridgeEvent : public QEvent
+{
+public:
+ enum EventType { SONG_UPDATE=0, SONGLEN_CHANGE, SONG_POSCHANGE, SONG_SETPLAY, SONG_SETSTOP, SONG_REWIND, SONG_SETMUTE,
+ SONG_SETCTRL, SONG_SETAUDIOVOL, SONG_IMPORT_PART, SONG_TOGGLE_EFFECT, SONG_ADD_TRACK, SONG_CHANGE_TRACKNAME,
+ SONG_DELETE_TRACK };
+ QPybridgeEvent( QPybridgeEvent::EventType _type, int _p1=0, int _p2=0);
+ EventType getType() { return type; }
+ int getP1() { return p1; }
+ int getP2() { return p2; }
+ void setS1(QString in) { s1 = in; }
+ void setS2(QString in) { s2 = in; }
+ const QString& getS1() { return s1; }
+ const QString& getS2() { return s2; }
+ double getD1() { return d1; }
+ void setD1(double _d1) { d1 = _d1; }
+
+private:
+ EventType type;
+ int p1, p2;
+ double d1;
+ QString s1;
+ QString s2;
+
+};
+
+bool initPythonBridge();
+
+#endif
+
diff --git a/muse2/muse/route.cpp b/muse2/muse/route.cpp
new file mode 100644
index 00000000..090134ec
--- /dev/null
+++ b/muse2/muse/route.cpp
@@ -0,0 +1,1633 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: route.cpp,v 1.18.2.3 2008/05/21 00:28:52 terminator356 Exp $
+//
+// (C) Copyright 2003-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qwidget.h>
+
+#include "song.h"
+#include "route.h"
+#include "node.h"
+#include "audio.h"
+#include "track.h"
+#include "synth.h"
+#include "audiodev.h"
+#include "xml.h"
+#include "midiport.h"
+#include "driver/jackmidi.h"
+#include "driver/alsamidi.h"
+
+//#define ROUTE_DEBUG
+
+//#define ROUTE_MIDIPORT_NAME_PREFIX "MusE MidiPort "
+const QString ROUTE_MIDIPORT_NAME_PREFIX = "MusE MidiPort ";
+
+//---------------------------------------------------------
+// Route
+//---------------------------------------------------------
+
+Route::Route(void* t, int ch)
+ {
+ jackPort = t;
+ midiPort = -1;
+ channel = ch;
+ channels = -1;
+ remoteChannel = -1;
+ type = JACK_ROUTE;
+ }
+
+//Route::Route(AudioTrack* t, int ch)
+Route::Route(Track* t, int ch, int chans)
+//Route::Route(Track* t, int ch)
+ {
+ track = t;
+ midiPort = -1;
+ channel = ch;
+ channels = chans;
+ remoteChannel = -1;
+ type = TRACK_ROUTE;
+ }
+
+//Route::Route(MidiJackDevice* d)
+Route::Route(MidiDevice* d, int ch)
+{
+ device = d;
+ midiPort = -1;
+ channel = ch;
+ channels = -1;
+ remoteChannel = -1;
+ /*
+ //if(dynamic_cast<MidiJackDevice*>(d))
+ if(d->deviceType() == MidiDevice::JACK_MIDI)
+ type = JACK_MIDI_ROUTE;
+ else
+ //if(dynamic_cast<MidiAlsaDevice*>(d))
+ if(d->deviceType() == MidiDevice::ALSA_MIDI)
+ type = ALSA_MIDI_ROUTE;
+ */
+ type = MIDI_DEVICE_ROUTE;
+}
+
+Route::Route(int port, int ch) // p3.3.49
+{
+ track = 0;
+ midiPort = port;
+ channel = ch;
+ channels = -1;
+ remoteChannel = -1;
+ type = MIDI_PORT_ROUTE;
+}
+
+//Route::Route(const QString& s, bool dst, int ch)
+Route::Route(const QString& s, bool dst, int ch, int rtype)
+ {
+ //Route node(name2route(s, dst));
+ Route node(name2route(s, dst, rtype));
+ channel = node.channel;
+ if(channel == -1)
+ channel = ch;
+ //if(channels == -1)
+ // channels = chans;
+ channels = node.channels;
+ remoteChannel = node.remoteChannel;
+ type = node.type;
+ if(type == TRACK_ROUTE)
+ {
+ track = node.track;
+ midiPort = -1;
+ }
+ else
+ if(type == JACK_ROUTE)
+ {
+ jackPort = node.jackPort;
+ midiPort = -1;
+ }
+ /*
+ else
+ if (type == JACK_MIDI_ROUTE)
+ device = node.device;
+ else
+ if (type == ALSA_MIDI_ROUTE)
+ device = node.device;
+ */
+ else
+ if(type == MIDI_DEVICE_ROUTE)
+ {
+ device = node.device;
+ midiPort = -1;
+ }
+ else
+ if(type == MIDI_PORT_ROUTE) // p3.3.49
+ {
+ track = 0;
+ midiPort = node.midiPort; //
+ }
+ }
+
+Route::Route()
+ {
+ track = 0;
+ midiPort = -1;
+ channel = -1;
+ channels = -1;
+ remoteChannel = -1;
+ type = TRACK_ROUTE;
+ }
+
+//---------------------------------------------------------
+// addRoute
+//---------------------------------------------------------
+
+void addRoute(Route src, Route dst)
+{
+ #ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute:\n");
+ #endif
+
+ if (!src.isValid() || !dst.isValid())
+ {
+ if(!src.isValid())
+ fprintf(stderr, "addRoute: invalid src\n");
+ if(!dst.isValid())
+ fprintf(stderr, "addRoute: invalid dst\n");
+ return;
+ }
+
+// printf("addRoute %d.%d:<%s> %d.%d:<%s>\n",
+// src.type, src.channel, src.name().latin1(),
+// dst.type, dst.channel, dst.name().latin1());
+ if (src.type == Route::JACK_ROUTE)
+ {
+ //if (dst.type != TRACK_ROUTE)
+ //{
+ // fprintf(stderr, "addRoute: bad route 1\n");
+ // exit(-1);
+ // return;
+ //}
+
+ if (dst.type == Route::TRACK_ROUTE)
+ {
+ if (dst.track->type() != Track::AUDIO_INPUT)
+ {
+ fprintf(stderr, "addRoute: source is jack, dest:%s is track but not audio input\n", dst.track->name().latin1());
+ //exit(-1);
+ return;
+ }
+ if (dst.channel < 0)
+ {
+ fprintf(stderr, "addRoute: source is jack, dest:%s is track but invalid channel:%d\n", dst.track->name().latin1(), dst.channel);
+ //exit(-1);
+ return;
+ }
+
+ //src.channel = src.dstChannel = dst.channel;
+ src.channel = dst.channel;
+ //src.channels = dst.channels = 1;
+ RouteList* inRoutes = dst.track->inRoutes();
+ for (iRoute i = inRoutes->begin(); i != inRoutes->end(); ++i)
+ {
+ if (*i == src) // route already there
+ {
+ //#ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute: src track route already exists.\n");
+ //#endif
+ return;
+ }
+ }
+ #ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute: src Jack dst track name: %s pushing source route\n", dst.track->name().latin1());
+ #endif
+ inRoutes->push_back(src);
+ }
+ else
+ //if (dst.type == Route::JACK_MIDI_ROUTE)
+ if (dst.type == Route::MIDI_DEVICE_ROUTE)
+ //if (dst.type == Route::MIDI_PORT_ROUTE) // p3.3.49
+ {
+ //MidiDevice *md = midiPorts[dst.midiPort].device();
+ //if(dst.device->deviceType() == MidiDevice::JACK_MIDI)
+ //if(!md)
+ //{
+ // fprintf(stderr, "addRoute: source is Jack, but no destination port device\n");
+ // return;
+ //}
+
+ if(dst.device->deviceType() == MidiDevice::JACK_MIDI)
+ //if(md->deviceType() == MidiDevice::JACK_MIDI)
+ {
+ src.channel = dst.channel;
+ //src.channel = -1;
+ //src.channel = 0;
+ //src.channel = src.dstChannel = dst.channel;
+ //src.channels = dst.channels = 1;
+ //dst.channel = -1;
+
+ RouteList* routes = dst.device->inRoutes();
+ for (iRoute i = routes->begin(); i != routes->end(); ++i)
+ {
+ if (*i == src) // route already there
+ {
+ //#ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute: src Jack midi route already exists.\n");
+ //#endif
+ return;
+ }
+ }
+ #ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute: src Jack dst Jack midi name: %s pushing source route\n", dst.device->name().latin1());
+ #endif
+ routes->push_back(src);
+ }
+ else
+ {
+ fprintf(stderr, "addRoute: source is Jack, but destination is not jack midi - type:%d\n", dst.device->deviceType());
+ // exit(-1);
+ return;
+ }
+ }
+ else
+ {
+ fprintf(stderr, "addRoute: source is Jack, but destination is not track or midi - type:%d \n", dst.type);
+ // exit(-1);
+ return;
+ }
+ }
+ else if (dst.type == Route::JACK_ROUTE)
+ {
+ //if (src.type != TRACK_ROUTE)
+ //{
+ // fprintf(stderr, "addRoute: bad route 3\n");
+ // exit(-1);
+ // return;
+ //}
+
+ if (src.type == Route::TRACK_ROUTE)
+ {
+ if (src.track->type() != Track::AUDIO_OUTPUT)
+ {
+ fprintf(stderr, "addRoute: destination is jack, source is track but not audio output\n");
+ // exit(-1);
+ return;
+ }
+ if (src.channel < 0)
+ {
+ fprintf(stderr, "addRoute: destination is jack, source:%s is track but invalid channel:%d\n", src.track->name().latin1(), src.channel);
+ // exit(-1);
+ return;
+ }
+
+ RouteList* outRoutes = src.track->outRoutes();
+ //dst.channel = dst.dstChannel = src.channel;
+ dst.channel = src.channel;
+ //dst.channels = src.channels = 1;
+
+ for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i)
+ {
+ if (*i == dst) // route already there
+ {
+ #ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute: dst track route already exists.\n");
+ #endif
+ return;
+ }
+ }
+ #ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute: dst Jack src track name: %s pushing destination route\n", src.track->name().latin1());
+ #endif
+ outRoutes->push_back(dst);
+ }
+ else
+ //if (src.type == Route::JACK_MIDI_ROUTE)
+ if (src.type == Route::MIDI_DEVICE_ROUTE)
+ {
+ if(src.device->deviceType() == MidiDevice::JACK_MIDI)
+ {
+ dst.channel = src.channel;
+ //dst.channel = -1;
+ //src.channel = -1;
+ //dst.channel = dst.dstChannel = src.channel;
+ //dst.channels = src.channels = 1;
+
+ RouteList* routes = src.device->outRoutes();
+ for (iRoute i = routes->begin(); i != routes->end(); ++i)
+ {
+ if (*i == dst) // route already there
+ {
+ //#ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute: dst Jack midi route already exists.\n");
+ //#endif
+ return;
+ }
+ }
+ #ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute: dst Jack src Jack midi name: %s pushing destination route\n", src.device->name().latin1());
+ #endif
+ routes->push_back(dst);
+ }
+ else
+ {
+ fprintf(stderr, "addRoute: destination is Jack, but source is not jack midi - type:%d\n", src.device->deviceType());
+ // exit(-1);
+ return;
+ }
+ }
+ else
+ {
+ fprintf(stderr, "addRoute: destination is Jack, but source is not track or midi - type:%d \n", src.type);
+ // exit(-1);
+ return;
+ }
+ }
+ else if(src.type == Route::MIDI_PORT_ROUTE) // p3.3.49
+ {
+ if(dst.type != Route::TRACK_ROUTE)
+ {
+ fprintf(stderr, "addRoute: source is midi port:%d, but destination is not track\n", src.midiPort);
+ return;
+ }
+ if(dst.channel < 1 || dst.channel >= (1 << MIDI_CHANNELS))
+ {
+ fprintf(stderr, "addRoute: source is midi port:%d, but destination channel mask:%d out of range\n", src.midiPort, dst.channel);
+ return;
+ }
+
+ //MidiDevice *md = midiPorts[src.midiPort].device();
+ //if(!md)
+ //{
+ // fprintf(stderr, "addRoute: source is midi port, but no destination port device\n");
+ // return;
+ //}
+
+ MidiPort *mp = &midiPorts[src.midiPort];
+
+ src.channel = dst.channel;
+ RouteList* outRoutes = mp->outRoutes();
+ //for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i)
+ iRoute ir = outRoutes->begin(); // p3.3.50
+ for ( ; ir != outRoutes->end(); ++ir)
+ {
+ //if (*i == dst) // route already there
+ if (ir->type == Route::TRACK_ROUTE && ir->track == dst.track) // p3.3.50 Does a route to the track exist?
+ {
+ //#ifdef ROUTE_DEBUG
+ //fprintf(stderr, "addRoute: src midi port:%d dst track:%s route already exists.\n", src.midiPort, dst.track->name().latin1());
+ //#endif
+ ir->channel |= dst.channel; // p3.3.50 Bitwise OR the desired channel bit with the existing bit mask.
+ break;
+
+ //return;
+ }
+ }
+ #ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute: src midi port:%d dst track name:%s pushing dst and src routes\n", src.midiPort, dst.track->name().latin1());
+ #endif
+
+ if(ir == outRoutes->end()) // p3.3.50 Only if route not found, add the route, with the requested channel bits as mask to start with.
+ outRoutes->push_back(dst);
+
+ RouteList* inRoutes = dst.track->inRoutes();
+
+ // p3.3.50 Make sure only one single route, with a channel mask, can ever exist.
+ ir = inRoutes->begin();
+ for ( ; ir != inRoutes->end(); ++ir)
+ {
+ if (ir->type == Route::MIDI_PORT_ROUTE && ir->midiPort == src.midiPort) // p3.3.50 Does a route to the midi port exist?
+ {
+ ir->channel |= src.channel; // p3.3.50 Bitwise OR the desired channel bit with the existing bit mask.
+ break;
+ }
+ }
+
+ if(ir == inRoutes->end()) // p3.3.50 Only if route not found, add the route, with the requested channel bits as mask to start with.
+ inRoutes->push_back(src);
+ }
+ else if(dst.type == Route::MIDI_PORT_ROUTE) // p3.3.49
+ {
+ if(src.type != Route::TRACK_ROUTE)
+ {
+ fprintf(stderr, "addRoute: destination is midi port:%d, but source is not track\n", dst.midiPort);
+ return;
+ }
+ if(src.channel < 1 || src.channel >= (1 << MIDI_CHANNELS))
+ {
+ fprintf(stderr, "addRoute: destination is midi port:%d, but source channel mask:%d out of range\n", dst.midiPort, src.channel);
+ return;
+ }
+
+
+ //MidiDevice *md = midiPorts[dst.midiPort].device();
+ //if(!md)
+ //{
+ // fprintf(stderr, "addRoute: dst is midi port, but no destination port device\n");
+ // return;
+ //}
+
+ dst.channel = src.channel;
+ RouteList* outRoutes = src.track->outRoutes();
+
+ //for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i)
+ iRoute ir = outRoutes->begin(); // p3.3.50
+ for ( ; ir != outRoutes->end(); ++ir)
+ {
+ //if (*i == dst) // route already there
+ if (ir->type == Route::MIDI_PORT_ROUTE && ir->midiPort == dst.midiPort) // p3.3.50 Does a route to the midi port exist?
+ {
+ //#ifdef ROUTE_DEBUG
+ //fprintf(stderr, "addRoute: dst midi port:%d src track:%s route already exists.\n", dst.midiPort, src.track->name().latin1());
+ //#endif
+ //return;
+
+ ir->channel |= dst.channel; // p3.3.50 Bitwise OR the desired channel bit with the existing bit mask.
+ break;
+ }
+ }
+
+ if(ir == outRoutes->end()) // p3.3.50 Only if route not found, add the route, with the requested channel bits as mask to start with.
+ outRoutes->push_back(dst);
+
+ MidiPort *mp = &midiPorts[dst.midiPort];
+
+ #ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute: src track:%s dst midi port:%d pushing dst and src routes\n", src.track->name().latin1(), dst.midiPort);
+ #endif
+ RouteList* inRoutes = mp->inRoutes();
+
+ // p3.3.50 Make sure only one single route, with a channel mask, can ever exist.
+ ir = inRoutes->begin();
+ for ( ; ir != inRoutes->end(); ++ir)
+ {
+ if (ir->type == Route::TRACK_ROUTE && ir->track == src.track) // p3.3.50 Does a route to the track exist?
+ {
+ ir->channel |= src.channel; // p3.3.50 Bitwise OR the desired channel bit with the existing bit mask.
+ break;
+ }
+ }
+
+ if(ir == inRoutes->end()) // p3.3.50 Only if route not found, add the route, with the requested channel bits as mask to start with.
+ inRoutes->push_back(src);
+ //inRoutes->insert(inRoutes->begin(), src);
+ }
+ else
+ {
+ if(src.type != Route::TRACK_ROUTE || dst.type != Route::TRACK_ROUTE) // p3.3.49
+ {
+ fprintf(stderr, "addRoute: source and destination are not track routes\n");
+ return;
+ }
+
+ // Removed p3.3.49
+ /*
+ //if ((src.type == Route::JACK_MIDI_ROUTE) || (src.type == Route::ALSA_MIDI_ROUTE))
+ if(src.type == Route::MIDI_DEVICE_ROUTE)
+ {
+ //src.channel = src.dstChannel = dst.dstChannel = dst.channel;
+ src.channel = dst.channel;
+ //src.channels = dst.channels = 1;
+ RouteList* outRoutes = src.device->outRoutes();
+ #ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute: src name: %s looking for existing dest in out routes...\n", src.device->name().latin1());
+ #endif
+ for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i)
+ {
+ if (*i == dst) // route already there
+ {
+ //#ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute: src Jack or ALSA midi route already exists.\n");
+ //#endif
+ return;
+ }
+ }
+ #ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute: src midi dst name: %s pushing destination and source routes\n", dst.track->name().latin1());
+ #endif
+
+ outRoutes->push_back(dst);
+ RouteList* inRoutes = dst.track->inRoutes();
+ inRoutes->push_back(src);
+ }
+ else
+ */
+
+ {
+ ///if(dst.type == Route::MIDI_DEVICE_ROUTE) // Removed p3.3.49
+ //{
+ /// dst.channel = src.channel;
+ //src.channel = src.dstChannel = dst.dstChannel = dst.channel;
+ //src.channels = dst.channels = 1;
+ //}
+ //else
+ //{
+ //src.channel = src.dstChannel = dst.dstChannel = dst.channel;
+ //src.channels = dst.channels = 1;
+ //}
+
+ RouteList* outRoutes = src.track->outRoutes();
+
+ //
+ // Must enforce to ensure channel and channels are valid if defaults of -1 passed.
+ //
+ if(src.track->type() == Track::AUDIO_SOFTSYNTH)
+ {
+ if(src.channel == -1)
+ src.channel = 0;
+ if(src.channels == -1)
+ src.channels = src.track->channels();
+ //if(dst.type == Route::TRACK_ROUTE) // p3.3.49 Removed
+ //{
+ //if(dst.channel == -1)
+ // dst.channel = 0;
+ //if(dst.channels == -1)
+ // Yes, that's correct: dst channels = src track channels.
+ // dst.channels = src.track->channels();
+ dst.channel = src.channel;
+ dst.channels = src.channels;
+ dst.remoteChannel = src.remoteChannel;
+ //}
+ }
+ //if(dst.type == Route::TRACK_ROUTE && dst.track->type() == Track::AUDIO_SOFTSYNTH)
+ //{
+ // if(dst.channel == -1)
+ // dst.channel = 0;
+ // if(dst.channels == -1)
+ // Yes, that's correct: dst channels = src track channels.
+ // dst.channels = src.track->channels();
+ //}
+
+ for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i)
+ {
+ if (*i == dst) // route already there
+ // TODO:
+ //if (i->type == dst.type && i->channel == dst.channel)
+ {
+ //if(i->type == Route::TRACK_ROUTE)
+ {
+ //if(i->track == dst.track)
+ {
+ //if(i->channels == dst.channels)
+ {
+ //#ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute: src track route already exists.\n");
+ //#endif
+ return;
+ }
+ //else
+ //{
+
+ //}
+ }
+ }
+ }
+ }
+ outRoutes->push_back(dst);
+ RouteList* inRoutes;
+
+ // Removed p3.3.49
+ /*
+ //if ((dst.type == Route::JACK_MIDI_ROUTE) || (dst.type == Route::ALSA_MIDI_ROUTE))
+ if(dst.type == Route::MIDI_DEVICE_ROUTE)
+ {
+ #ifdef ROUTE_DEBUG
+ fprintf(stderr, "addRoute: src track dst midi name: %s pushing destination and source routes\n", dst.device->name().latin1());
+ #endif
+ inRoutes = dst.device->inRoutes();
+ }
+ else
+ */
+
+ {
+ #ifdef ROUTE_DEBUG
+ //fprintf(stderr, "addRoute: src track ch:%d chs:%d dst track ch:%d chs:%d name: %s pushing destination and source routes\n", src.channel, src.channels, dst.channel, dst.channels, dst.track->name().latin1());
+ fprintf(stderr, "addRoute: src track ch:%d chs:%d remch:%d dst track ch:%d chs:%d remch:%d name: %s pushing dest and source routes\n",
+ src.channel, src.channels, src.remoteChannel, dst.channel, dst.channels, dst.remoteChannel, dst.track->name().latin1());
+ //fprintf(stderr, "addRoute: src track ch:%d dst track ch:%d name: %s pushing destination and source routes\n", src.channel, dst.channel, dst.track->name().latin1());
+ #endif
+ inRoutes = dst.track->inRoutes();
+ }
+
+
+ //
+ // make sure AUDIO_AUX is processed last
+ //
+ if (src.track->type() == Track::AUDIO_AUX)
+ inRoutes->push_back(src);
+ else
+ inRoutes->insert(inRoutes->begin(), src);
+ }
+ }
+}
+
+//---------------------------------------------------------
+// removeRoute
+//---------------------------------------------------------
+
+void removeRoute(Route src, Route dst)
+{
+ //printf("removeRoute %d.%d:<%s> %d.%d:<%s>\n",
+ // src.type, src.channel, src.name().latin1(),
+ // dst.type, dst.channel, dst.name().latin1());
+
+ if (src.type == Route::JACK_ROUTE)
+ {
+ //if (dst.type != TRACK_ROUTE)
+ //{
+ // fprintf(stderr, "removeRoute: bad route 1\n");
+ // exit(-1);
+ // return;
+ //}
+ if(!dst.isValid())
+ {
+ printf("removeRoute: source is jack, invalid destination\n");
+ return;
+ }
+
+ if (dst.type == Route::TRACK_ROUTE)
+ {
+ if (dst.track->type() != Track::AUDIO_INPUT)
+ {
+ fprintf(stderr, "removeRoute: source is jack, destination is track but not audio input\n");
+ // exit(-1);
+ return;
+ }
+ RouteList* inRoutes = dst.track->inRoutes();
+ iRoute i;
+ for (i = inRoutes->begin(); i != inRoutes->end(); ++i)
+ {
+ if (*i == src)
+ {
+ inRoutes->erase(i);
+ break;
+ }
+ }
+ }
+ else
+ //if (dst.type == Route::JACK_MIDI_ROUTE)
+ if (dst.type == Route::MIDI_DEVICE_ROUTE)
+ {
+ RouteList* routes = dst.device->inRoutes();
+ iRoute i;
+ for (i = routes->begin(); i != routes->end(); ++i)
+ {
+ if (*i == src)
+ {
+ routes->erase(i);
+ break;
+ }
+ }
+ }
+ else
+ {
+ fprintf(stderr, "removeRoute: source is jack, destination unknown\n");
+ // exit(-1);
+ return;
+ }
+ }
+ else if (dst.type == Route::JACK_ROUTE)
+ {
+ //if (src.type != TRACK_ROUTE)
+ //{
+ // fprintf(stderr, "removeRoute: bad route 3\n");
+ // exit(-1);
+ // return;
+ //}
+ if(!src.isValid())
+ {
+ printf("removeRoute: destination is jack, invalid source\n");
+ return;
+ }
+
+ if (src.type == Route::TRACK_ROUTE)
+ {
+ if (src.track->type() != Track::AUDIO_OUTPUT)
+ {
+ fprintf(stderr, "removeRoute: destination is jack, source is track but not audio output\n");
+ // exit(-1);
+ return;
+ }
+ RouteList* outRoutes = src.track->outRoutes();
+ iRoute i;
+ for (i = outRoutes->begin(); i != outRoutes->end(); ++i)
+ {
+ if (*i == dst) {
+ outRoutes->erase(i);
+ break;
+ }
+ }
+ }
+ else
+ //if (src.type == Route::JACK_MIDI_ROUTE)
+ if (src.type == Route::MIDI_DEVICE_ROUTE)
+ {
+ RouteList* routes = src.device->outRoutes();
+ iRoute i;
+ for (i = routes->begin(); i != routes->end(); ++i)
+ {
+ if (*i == dst) {
+ routes->erase(i);
+ break;
+ }
+ }
+ }
+ else
+ {
+ fprintf(stderr, "removeRoute: destination is jack, source unknown\n");
+ // exit(-1);
+ return;
+ }
+ }
+ else if(src.type == Route::MIDI_PORT_ROUTE) // p3.3.49
+ {
+ if(dst.type != Route::TRACK_ROUTE)
+ {
+ fprintf(stderr, "removeRoute: source is midi port:%d, but destination is not track\n", src.midiPort);
+ return;
+ }
+
+ if(src.isValid())
+ {
+ MidiPort *mp = &midiPorts[src.midiPort];
+ RouteList* outRoutes = mp->outRoutes();
+ for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i)
+ {
+ //if (*i == dst)
+ if (i->type == Route::TRACK_ROUTE && i->track == dst.track) // p3.3.50 Is there a route to the track?
+ {
+ i->channel &= ~dst.channel; // p3.3.50 Unset the desired channel bits.
+ if(i->channel == 0) // Only if there are no channel bits set, erase the route.
+ outRoutes->erase(i);
+
+ break; // For safety, keep looking and remove any more found.
+ // No, must break, else crash. There should only be one route anyway...
+ }
+ }
+ }
+ else
+ printf("removeRoute: source is midi port:%d but invalid\n", src.midiPort);
+
+ if(dst.isValid())
+ {
+ RouteList* inRoutes = dst.track->inRoutes();
+ for (iRoute i = inRoutes->begin(); i != inRoutes->end(); ++i)
+ {
+ //if (*i == src)
+ if (i->type == Route::MIDI_PORT_ROUTE && i->midiPort == src.midiPort) // p3.3.50 Is there a route to the midi port?
+ {
+ i->channel &= ~src.channel; // p3.3.50 Unset the desired channel bits.
+ if(i->channel == 0) // Only if there are no channel bits set, erase the route.
+ inRoutes->erase(i);
+
+ break; // For safety, keep looking and remove any more found.
+ // No, must break, else crash. There should only be one route anyway...
+ }
+ }
+ }
+ else
+ printf("removeRoute: source is midi port:%d but destination track invalid\n", src.midiPort);
+ }
+ else if(dst.type == Route::MIDI_PORT_ROUTE) // p3.3.49
+ {
+ if(src.type != Route::TRACK_ROUTE)
+ {
+ fprintf(stderr, "removeRoute: destination is midi port:%d, but source is not track\n", dst.midiPort);
+ return;
+ }
+
+ if(src.isValid())
+ {
+ RouteList* outRoutes = src.track->outRoutes();
+ for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i)
+ {
+ //if (*i == dst)
+ if (i->type == Route::MIDI_PORT_ROUTE && i->midiPort == dst.midiPort) // p3.3.50 Is there a route to the midi port?
+ {
+ i->channel &= ~dst.channel; // p3.3.50 Unset the desired channel bits.
+ if(i->channel == 0) // Only if there are no channel bits set, erase the route.
+ outRoutes->erase(i);
+
+ break; // For safety, keep looking and remove any more found.
+ // No, must break, else crash. There should only be one route anyway...
+ }
+ }
+ }
+ else
+ printf("removeRoute: destination is midi port:%d but source track is invalid\n", dst.midiPort);
+
+ if(dst.isValid())
+ {
+ MidiPort *mp = &midiPorts[src.midiPort];
+ RouteList* inRoutes = mp->inRoutes();
+ for (iRoute i = inRoutes->begin(); i != inRoutes->end(); ++i)
+ {
+ //if (*i == src)
+ if (i->type == Route::TRACK_ROUTE && i->track == src.track) // p3.3.50 Is there a route to the track?
+ {
+ i->channel &= ~src.channel; // p3.3.50 Unset the desired channel bits.
+ if(i->channel == 0) // Only if there are no channel bits set, erase the route.
+ inRoutes->erase(i);
+
+ break; // For safety, keep looking and remove any more found.
+ // No, must break, else crash. There should only be one route anyway...
+ }
+ }
+ }
+ else
+ printf("removeRoute: destination is midi port:%d but invalid\n", dst.midiPort);
+ }
+ else
+ {
+ if(src.type != Route::TRACK_ROUTE || dst.type != Route::TRACK_ROUTE) // p3.3.49
+ {
+ fprintf(stderr, "removeRoute: source and destination are not tracks\n");
+ return;
+ }
+
+ // Removed p3.3.49
+ /*
+ //if((src.type == Route::JACK_MIDI_ROUTE) || (src.type == Route::ALSA_MIDI_ROUTE))
+ if(src.type == Route::MIDI_DEVICE_ROUTE)
+ {
+ if(src.isValid())
+ {
+ RouteList* outRoutes = src.device->outRoutes();
+ for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i)
+ {
+ if (*i == dst) {
+ outRoutes->erase(i);
+ break;
+ }
+ }
+ }
+ else
+ printf("removeRoute: source is midi but invalid\n");
+
+ if(dst.isValid())
+ {
+ RouteList* inRoutes = dst.track->inRoutes();
+ for (iRoute i = inRoutes->begin(); i != inRoutes->end(); ++i)
+ {
+ if (*i == src) {
+ inRoutes->erase(i);
+ break;
+ }
+ }
+ }
+ else
+ printf("removeRoute: source is midi but destination invalid\n");
+ }
+ else
+ */
+
+ {
+ if(src.isValid())
+ {
+ RouteList* outRoutes = src.track->outRoutes();
+ for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i)
+ {
+ if (*i == dst) {
+ outRoutes->erase(i);
+ break;
+ }
+ }
+ }
+ else
+ printf("removeRoute: source is track but invalid\n");
+
+ if(dst.isValid())
+ {
+ RouteList* inRoutes;
+
+ //if ((dst.type == Route::JACK_MIDI_ROUTE) || (dst.type == Route::ALSA_MIDI_ROUTE))
+ // Removed p3.3.49
+ /*
+ if (dst.type == Route::MIDI_DEVICE_ROUTE)
+ inRoutes = dst.device->inRoutes();
+ else
+ */
+
+ inRoutes = dst.track->inRoutes();
+ for (iRoute i = inRoutes->begin(); i != inRoutes->end(); ++i)
+ {
+ if (*i == src) {
+ inRoutes->erase(i);
+ break;
+ }
+ }
+ }
+ else
+ printf("removeRoute: source is track but destination invalid\n");
+ }
+ }
+}
+
+//---------------------------------------------------------
+// track2name
+// create string name representation for audio node
+//---------------------------------------------------------
+
+static QString track2name(const Track* n)
+ {
+ if (n == 0)
+ return QWidget::tr("None");
+ return n->name();
+ }
+
+//---------------------------------------------------------
+// name
+// create string name representation for audio node
+//---------------------------------------------------------
+
+QString Route::name() const
+{
+ // p3.3.38 Removed
+ /*
+ QString s;
+ if ((type == TRACK_ROUTE) && (channel != -1)) {
+// if (channel != -1) {
+ QString c;
+ c.setNum(channel+1);
+ s = c + ":";
+ }
+ */
+
+ if(type == MIDI_DEVICE_ROUTE)
+ {
+ if(device)
+ {
+ if(device->deviceType() == MidiDevice::JACK_MIDI)
+ return audioDevice->portName(device->clientPort());
+ else
+ //if(device->deviceType() == MidiDevice::ALSA_MIDI)
+ return device->name();
+ }
+ return QWidget::tr("None");
+ }
+ else
+ if(type == JACK_ROUTE)
+ {
+ if (!checkAudioDevice()) return "";
+ //return s + audioDevice->portName(jackPort);
+ return audioDevice->portName(jackPort);
+ }
+ else
+ if(type == MIDI_PORT_ROUTE) // p3.3.49
+ {
+ return ROUTE_MIDIPORT_NAME_PREFIX + QString().setNum(midiPort);
+ }
+ else
+ //return s + track2name(track);
+ return track2name(track);
+}
+
+//---------------------------------------------------------
+// name2route
+//---------------------------------------------------------
+
+//Route name2route(const QString& rn, bool dst)
+Route name2route(const QString& rn, bool /*dst*/, int rtype)
+{
+// printf("name2route %s\n", rn.latin1());
+ int channel = -1;
+ //int channel = 0;
+ QString s(rn);
+ // Support old route style in med files. Obsolete.
+ if (rn[0].isNumber() && rn[1]==':')
+ {
+ channel = rn[0].toAscii() - int('1');
+ s = rn.mid(2);
+ }
+
+ if(rtype == -1)
+ {
+ //if(dst)
+ //{
+ if(checkAudioDevice())
+ {
+ void* p = audioDevice->findPort(s.latin1());
+ if(p)
+ return Route(p, channel);
+ }
+
+ TrackList* tl = song->tracks();
+ for(iTrack i = tl->begin(); i != tl->end(); ++i)
+ {
+ if((*i)->isMidiTrack())
+ {
+ MidiTrack* track = (MidiTrack*)*i;
+ if(track->name() == s)
+ return Route(track, channel);
+ }
+ else
+ {
+ AudioTrack* track = (AudioTrack*)*i;
+ if(track->name() == s)
+ return Route(track, channel);
+ }
+ }
+
+ for(iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i)
+ {
+ if((*i)->name() == s)
+ return Route(*i, channel);
+ }
+
+ // p3.3.49
+ if(s.left(ROUTE_MIDIPORT_NAME_PREFIX.length()) == ROUTE_MIDIPORT_NAME_PREFIX)
+ {
+ bool ok = false;
+ int port = s.mid(ROUTE_MIDIPORT_NAME_PREFIX.length()).toInt(&ok);
+ if(ok)
+ return Route(port, channel);
+ }
+ }
+ else
+ {
+ //if(dst)
+ //{
+ if(rtype == Route::TRACK_ROUTE)
+ {
+ TrackList* tl = song->tracks();
+ for(iTrack i = tl->begin(); i != tl->end(); ++i)
+ {
+ if((*i)->isMidiTrack())
+ {
+ MidiTrack* track = (MidiTrack*)*i;
+ if(track->name() == s)
+ return Route(track, channel);
+ }
+ else
+ {
+ AudioTrack* track = (AudioTrack*)*i;
+ if(track->name() == s)
+ return Route(track, channel);
+ //return Route(track, channel, 1);
+ //return Route(track, channel, track->channels());
+ }
+ }
+ }
+ else
+ //if((rtype == Route::JACK_MIDI_ROUTE) || (rtype == Route::ALSA_MIDI_ROUTE))
+ // TODO Distinguish the device types
+ if(rtype == Route::MIDI_DEVICE_ROUTE)
+ {
+ for(iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i)
+ {
+ if((*i)->name() == s)
+ //if (jmd->name() == rn)
+ return Route(*i, channel);
+
+ /*
+ MidiJackDevice* jmd = dynamic_cast<MidiJackDevice*>(*i);
+ if(jmd)
+ {
+ if(jmd->name() == s)
+ //if (jmd->name() == rn)
+ return Route(jmd);
+ }
+ MidiAlsaDevice* amd = dynamic_cast<MidiAlsaDevice*>(*i);
+ if(amd)
+ {
+ // TODO
+ if(amd->name() == s)
+ //if (amd->name() == rn)
+ return Route(amd);
+ }
+ */
+ }
+ }
+ else
+ if(rtype == Route::JACK_ROUTE)
+ {
+ if(checkAudioDevice())
+ {
+ void* p = audioDevice->findPort(s.latin1());
+ if(p)
+ return Route(p, channel);
+ }
+ }
+ else
+ if(rtype == Route::MIDI_PORT_ROUTE) // p3.3.49
+ {
+ if(s.left(ROUTE_MIDIPORT_NAME_PREFIX.length()) == ROUTE_MIDIPORT_NAME_PREFIX)
+ {
+ bool ok = false;
+ int port = s.mid(ROUTE_MIDIPORT_NAME_PREFIX.length()).toInt(&ok);
+ if(ok)
+ return Route(port, channel);
+ }
+ }
+ }
+
+ printf(" name2route: <%s> not found\n", rn.latin1());
+ return Route((Track*) 0, channel);
+ //return Route((Track*) 0, channel, 1);
+}
+
+//---------------------------------------------------------
+// checkRoute
+// return true if route is valid
+//---------------------------------------------------------
+
+bool checkRoute(const QString& s, const QString& d)
+ {
+ Route src(s, false, -1);
+ Route dst(d, true, -1);
+
+ if (!(src.isValid() && dst.isValid()) || (src == dst))
+ return false;
+ if (src.type == Route::JACK_ROUTE)
+ {
+ //if (dst.type != TRACK_ROUTE) {
+ // return false;
+ // }
+
+ if (dst.type == Route::TRACK_ROUTE)
+ {
+ if (dst.track->type() != Track::AUDIO_INPUT) {
+ return false;
+ }
+ src.channel = dst.channel;
+ RouteList* inRoutes = dst.track->inRoutes();
+ for (iRoute i = inRoutes->begin(); i != inRoutes->end(); ++i)
+ {
+ if (*i == src) { // route already there
+ return false;
+ }
+ }
+ }
+ else
+ //if (dst.type == Route::JACK_MIDI_ROUTE)
+ if (dst.type == Route::MIDI_DEVICE_ROUTE)
+ {
+ //src.channel = dst.channel;
+ src.channel = -1;
+ //dst.channel = -1;
+ RouteList* routes = dst.device->inRoutes();
+ for (iRoute i = routes->begin(); i != routes->end(); ++i)
+ {
+ if (*i == src) { // route already there
+ return false;
+ }
+ }
+ }
+ else
+ return false;
+ }
+ else if (dst.type == Route::JACK_ROUTE)
+ {
+ //if (src.type != TRACK_ROUTE) {
+ // return false;
+ // }
+
+ if (src.type == Route::TRACK_ROUTE)
+ {
+ if (src.track->type() != Track::AUDIO_OUTPUT) {
+ return false;
+ }
+ RouteList* outRoutes = src.track->outRoutes();
+ dst.channel = src.channel;
+ for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i)
+ {
+ if (*i == dst) { // route already there
+ return false;
+ }
+ }
+ }
+ else
+ //if (src.type == Route::JACK_MIDI_ROUTE)
+ if (src.type == Route::MIDI_DEVICE_ROUTE)
+ {
+ RouteList* routes = src.device->outRoutes();
+ //dst.channel = src.channel;
+ dst.channel = -1;
+ //src.channel = -1;
+ for (iRoute i = routes->begin(); i != routes->end(); ++i)
+ {
+ if (*i == dst) { // route already there
+ return false;
+ }
+ }
+ }
+ else
+ return false;
+ }
+ else if (src.type == Route::MIDI_PORT_ROUTE) // p3.3.49
+ {
+ RouteList* outRoutes = midiPorts[src.midiPort].outRoutes();
+ for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i)
+ {
+ if (*i == dst) { // route already there
+ return false;
+ }
+ }
+ }
+ //else if (dst.type == Route::MIDI_PORT_ROUTE) // p3.3.49
+ //{
+ //}
+ else
+ {
+ //RouteList* outRoutes = ((src.type == Route::JACK_MIDI_ROUTE) || (src.type == Route::ALSA_MIDI_ROUTE)) ?
+ // src.device->outRoutes() : src.track->outRoutes();
+ RouteList* outRoutes = (src.type == Route::MIDI_DEVICE_ROUTE) ? src.device->outRoutes() : src.track->outRoutes();
+
+ for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i)
+ {
+ if (*i == dst) { // route already there
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void Route::read(Xml& xml)
+{
+ QString s;
+ int dtype = MidiDevice::ALSA_MIDI;
+ int port = -1; // p3.3.49
+ unsigned char rtype = Route::TRACK_ROUTE;
+
+ for (;;)
+ {
+ const QString& tag = xml.s1();
+ Xml::Token token = xml.parse();
+ switch (token)
+ {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ //case Xml::TagStart:
+ // xml.unknown("Route");
+ // break;
+ case Xml::Attribut:
+ #ifdef ROUTE_DEBUG
+ printf("Route::read(): attribute:%s\n", tag.latin1());
+ #endif
+ if(tag == "type")
+ rtype = xml.s2().toInt();
+ else
+ if(tag == "devtype")
+ {
+ dtype = xml.s2().toInt();
+ rtype = Route::MIDI_DEVICE_ROUTE;
+ }
+ else
+ if(tag == "name")
+ s = xml.s2();
+ else
+ if(tag == "mport") // p3.3.49
+ {
+ port = xml.s2().toInt();
+ rtype = Route::MIDI_PORT_ROUTE;
+ }
+ else
+ printf("Route::read(): unknown attribute:%s\n", tag.latin1());
+ break;
+ case Xml::TagEnd:
+ #ifdef ROUTE_DEBUG
+ printf("Route::read(): tag end type:%d channel:%d name:%s\n", rtype, channel, s.latin1());
+ #endif
+ if(rtype == MIDI_PORT_ROUTE) // p3.3.49
+ {
+ if(port >= 0 && port < MIDI_PORTS)
+ {
+ type = rtype;
+ midiPort = port;
+ }
+ else
+ printf("Route::read(): midi port <%d> out of range\n", port);
+ }
+ else
+ if(!s.isEmpty())
+ {
+ if(rtype == TRACK_ROUTE)
+ {
+ TrackList* tl = song->tracks();
+ iTrack i = tl->begin();
+ for ( ; i != tl->end(); ++i)
+ {
+ Track* t = *i;
+ if (t->name() == s)
+ {
+ track = t;
+ type = rtype;
+ break;
+ }
+ }
+ if(i == tl->end())
+ printf("Route::read(): track <%s> not found\n", s.latin1());
+ }
+ else
+ if(rtype == JACK_ROUTE)
+ {
+ void* jport = audioDevice->findPort(s);
+ if(jport == 0)
+ printf("Route::read(): jack port <%s> not found\n", s.latin1());
+ else
+ {
+ jackPort = jport;
+ type = rtype;
+ }
+ }
+ else
+ if(rtype == MIDI_DEVICE_ROUTE)
+ {
+ iMidiDevice imd = midiDevices.begin();
+ for( ; imd != midiDevices.end(); ++imd)
+ {
+ MidiDevice* md = *imd;
+ if(md->name() == s && md->deviceType() == dtype)
+ {
+ // p3.3.45
+ // We found a device, but if it is not in use by the song (port is -1), ignore it.
+ // This prevents loading and propagation of bogus routes in the med file.
+ if(md->midiPort() == -1)
+ break;
+
+ device = md;
+ type = rtype;
+ break;
+ }
+ }
+ if(imd == midiDevices.end())
+ printf("Route::read(): midi device <%s> not found\n", s.latin1());
+ }
+ }
+ return;
+ default:
+ break;
+ }
+ }
+}
+
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void Song::readRoute(Xml& xml)
+{
+ QString src;
+ QString dst;
+ int ch = -1;
+ int chs = -1;
+ int remch = -1;
+
+ Route sroute, droute;
+
+ for (;;)
+ {
+ const QString& tag = xml.s1();
+ Xml::Token token = xml.parse();
+ switch (token)
+ {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ // p3.3.38 2010/02/03 Support old routes in med files. Now obsolete!
+ if (tag == "srcNode")
+ src = xml.parse1();
+ else if (tag == "dstNode")
+ dst = xml.parse1();
+ // Support new routes.
+ else if (tag == "source")
+ {
+ sroute.read(xml);
+ sroute.channel = ch;
+ sroute.channels = chs;
+ sroute.remoteChannel = remch;
+ }
+ else if (tag == "dest")
+ {
+ droute.read(xml);
+ droute.channel = ch;
+ droute.channels = chs;
+ droute.remoteChannel = remch;
+ }
+ else
+ xml.unknown("readRoute");
+ break;
+ case Xml::Attribut:
+ #ifdef ROUTE_DEBUG
+ printf("Song::readRoute(): attribute:%s\n", tag.latin1());
+ #endif
+ if(tag == "channel")
+ ch = xml.s2().toInt();
+ else
+ if(tag == "channels")
+ chs = xml.s2().toInt();
+ else
+ if(tag == "remch")
+ remch = xml.s2().toInt();
+ else
+ if(tag == "channelMask") // p3.3.50 New channel mask for midi port-track routes.
+ ch = xml.s2().toInt();
+ else
+ printf("Song::readRoute(): unknown attribute:%s\n", tag.latin1());
+ break;
+ case Xml::TagEnd:
+ if (xml.s1() == "Route")
+ {
+ // Support old routes in med files. Now obsolete!
+ if(!src.isEmpty() && !dst.isEmpty())
+ {
+ Route s = name2route(src, false);
+ Route d = name2route(dst, true);
+ addRoute(s, d);
+ }
+ else
+ // Support new routes.
+ if(sroute.isValid() && droute.isValid())
+ {
+ // p3.3.49 Support pre- 1.1-RC2 midi-device-to-track routes. Obsolete. Replaced with midi port routes.
+ if(sroute.type == Route::MIDI_DEVICE_ROUTE && droute.type == Route::TRACK_ROUTE)
+ {
+ if(sroute.device->midiPort() >= 0 && sroute.device->midiPort() < MIDI_PORTS
+ && ch >= 0 && ch < MIDI_CHANNELS) // p3.3.50
+ {
+ sroute.midiPort = sroute.device->midiPort();
+ sroute.device = 0;
+ sroute.type = Route::MIDI_PORT_ROUTE;
+
+ sroute.channel = 1 << ch; // p3.3.50 Convert to new bit-wise channel mask.
+ droute.channel = sroute.channel;
+
+ addRoute(sroute, droute);
+ }
+ else
+ printf(" Warning - device:%s to track route, no device midi port or chan:%d out of range. Ignoring route!\n",
+ sroute.device->name().latin1(), ch);
+ }
+ else if(sroute.type == Route::TRACK_ROUTE && droute.type == Route::MIDI_DEVICE_ROUTE)
+ {
+ if(droute.device->midiPort() >= 0 && droute.device->midiPort() < MIDI_PORTS
+ && ch >= 0 && ch < MIDI_CHANNELS) // p3.3.50
+ {
+ droute.midiPort = droute.device->midiPort();
+ droute.device = 0;
+ droute.type = Route::MIDI_PORT_ROUTE;
+
+ droute.channel = 1 << ch; // p3.3.50 Convert to new bit-wise channel mask.
+ sroute.channel = droute.channel;
+
+ addRoute(sroute, droute);
+ }
+ else
+ printf(" Warning - track to device:%s route, no device midi port or chan:%d out of range. Ignoring route!\n",
+ droute.device->name().latin1(), ch);
+ }
+ else
+ {
+ //printf("adding new route...\n");
+ addRoute(sroute, droute);
+ }
+ }
+ else
+ printf(" Warning - route invalid. Ignoring route!\n");
+
+ return;
+ }
+ default:
+ break;
+ }
+ }
+}
+
+//---------------------------------------------------------
+// removeRoute
+//---------------------------------------------------------
+
+void RouteList::removeRoute(const Route& r)
+ {
+ //printf("RouteList::removeRoute:\n");
+ //r.dump();
+ //printf("Searching routes:\n");
+
+ for (iRoute i = begin(); i != end(); ++i) {
+ //i->dump();
+ if (r == *i) {
+ erase(i);
+ return;
+ }
+ }
+ printf("internal error: cannot remove Route\n");
+ }
+
+//---------------------------------------------------------
+// dump
+//---------------------------------------------------------
+
+void Route::dump() const
+{
+ if (type == TRACK_ROUTE)
+ {
+ if(track)
+ printf("Route dump: track <%s> channel %d channels %d\n", track->name().latin1(), channel, channels);
+ //printf("Route dump: track <%s> channel %d\n", track->name().latin1(), channel);
+ //else
+ // printf("Route dump: invalid track, channel %d\n", channel);
+ }
+ else
+ if (type == JACK_ROUTE)
+ {
+ if(checkAudioDevice())
+ printf("Route dump: jack audio port <%s> channel %d\n", audioDevice->portName(jackPort).latin1(), channel);
+ }
+ else
+ if (type == MIDI_PORT_ROUTE) // p3.3.49
+ {
+ printf("Route dump: midi port <%d> channel mask %d\n", midiPort, channel);
+ }
+ else
+ if (type == MIDI_DEVICE_ROUTE)
+ {
+ printf("Route dump: ");
+ if(device)
+ {
+ if(device->deviceType() == MidiDevice::JACK_MIDI)
+ {
+ if(checkAudioDevice())
+ printf("jack midi port device <%s> ", audioDevice->portName(device->clientPort()).latin1());
+ }
+ else
+ if(device->deviceType() == MidiDevice::ALSA_MIDI)
+ printf("alsa midi device <%s> ", device->name().latin1());
+ else
+ if(device->deviceType() == MidiDevice::SYNTH_MIDI)
+ printf("synth midi device <%s> ", device->name().latin1());
+ else
+ printf("is midi but unknown device type:%d, ", device->deviceType());
+ }
+ else
+ printf("is midi but invalid device, ");
+
+ printf("channel:%d\n", channel);
+ }
+ else
+ printf("Route dump: unknown route type:%d\n", type);
+}
+
+//---------------------------------------------------------
+// operator==
+//---------------------------------------------------------
+
+bool Route::operator==(const Route& a) const
+{
+ //if (type == MIDI_PORT_ROUTE) // p3.3.50
+ //{
+ // Use new channel mask. True if all the bits in a.channel are contained in this route's channel.
+ // Hmm, not commutative... Two such routes are equal if _____ what? ... Code-specific for now.
+ // return midiPort == a.midiPort && (channel & a.channel) == a.channel;
+ //}
+ //else
+
+ if ((type == a.type) && (channel == a.channel))
+ //if (type == a.type)
+ {
+ if (type == TRACK_ROUTE)
+ {
+ return track == a.track && channels == a.channels && remoteChannel == a.remoteChannel;
+ }
+ else
+ if(channel == a.channel)
+ {
+ if (type == JACK_ROUTE)
+ {
+ if (!checkAudioDevice()) return false;
+ return audioDevice->portName(jackPort) == audioDevice->portName(a.jackPort);
+ }
+ else
+ if (type == MIDI_PORT_ROUTE) // p3.3.49
+ {
+ return midiPort == a.midiPort;
+ }
+ else
+ if (type == MIDI_DEVICE_ROUTE)
+ {
+ if(device && a.device && device->deviceType() == a.device->deviceType())
+ {
+ if(device->deviceType() == MidiDevice::JACK_MIDI)
+ {
+ if (!checkAudioDevice()) return false;
+ return audioDevice->portName(device->clientPort()) == audioDevice->portName(a.device->clientPort());
+ }
+ else
+ if(device->deviceType() == MidiDevice::ALSA_MIDI)
+ // TODO: OK ??
+ return device->clientPort() == a.device->clientPort() && (channel == a.channel);
+ else
+ if(device->deviceType() == MidiDevice::SYNTH_MIDI)
+ return device->name() == a.device->name();
+ }
+ }
+ }
+ }
+ return false;
+}
+
diff --git a/muse2/muse/route.h b/muse2/muse/route.h
new file mode 100644
index 00000000..4cacac88
--- /dev/null
+++ b/muse2/muse/route.h
@@ -0,0 +1,102 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: route.h,v 1.5.2.1 2008/05/21 00:28:52 terminator356 Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __ROUTE_H__
+#define __ROUTE_H__
+
+#include <vector>
+#include <map>
+
+#include "globaldefs.h"
+
+class QString;
+class Track;
+class MidiDevice;
+class Xml;
+
+//---------------------------------------------------------
+// Route
+//---------------------------------------------------------
+
+struct Route {
+ enum { TRACK_ROUTE=0, JACK_ROUTE=1, MIDI_DEVICE_ROUTE=2, MIDI_PORT_ROUTE=3 }; // p3.3.49
+
+ union {
+ //AudioTrack* track;
+ Track* track;
+ //MidiJackDevice* device;
+ MidiDevice* device;
+ void* jackPort;
+ };
+
+ int midiPort; // p3.3.49 Midi port number. Best not to put this in the union to avoid problems?
+
+ //snd_seq_addr_t alsaAdr;
+
+ // Starting source channel (of the owner of this route). Normally zero for mono or stereo tracks, higher for multi-channel tracks.
+ // p3.3.50 NOTICE: channel is now a bit-wise channel mask, for MidiPort <-> MidiTrack routes.
+ // This saves many routes: Instead of one route per channel as before, there can now be only one single route with a channel mask,
+ // for each MidiPort <-> MidiTrack combination.
+ int channel;
+ // Number of (audio) channels being routed.
+ int channels;
+
+ // Allow for multi-channel syntis to feed to/from regular tracks, and to feed one to another.
+ // If a synti is feeding to/from a regular track, remoteChannel is the 'starting' channel of this multi-channel synti.
+ // If a synti is feeding to/from another synti, this is not used and individual channels are routed using channel instead.
+ int remoteChannel;
+
+ unsigned char type; // 0 - track, 1 - jackPort, 2 - midi device, 3 - midi port
+
+ Route(void* t, int ch=-1);
+ Route(Track* t, int ch = -1, int chans = -1);
+ Route(MidiDevice* d, int ch);
+ Route(int port, int ch); // p3.3.49
+ Route(const QString&, bool dst, int ch, int rtype = -1);
+ Route();
+
+ QString name() const;
+ bool operator==(const Route& a) const;
+ bool isValid() const {
+ return ((type == TRACK_ROUTE) && (track != 0)) || ((type == JACK_ROUTE) && (jackPort != 0)) ||
+ ((type == MIDI_DEVICE_ROUTE) && (device != 0)) ||
+ ((type == MIDI_PORT_ROUTE) && (midiPort >= 0) && (midiPort < MIDI_PORTS)); // p3.3.49
+ }
+ void read(Xml& xml);
+ void dump() const;
+ };
+
+
+//---------------------------------------------------------
+// RouteList
+//---------------------------------------------------------
+
+struct RouteList : public std::vector<Route> {
+ void removeRoute(const Route& r);
+ };
+
+typedef RouteList::iterator iRoute;
+typedef RouteList::const_iterator ciRoute;
+
+extern void addRoute(Route, Route);
+extern void removeRoute(Route, Route);
+extern Route name2route(const QString&, bool dst, int rtype = -1);
+extern bool checkRoute(const QString&, const QString&);
+
+//---------------------------------------------------------
+// RouteMenuMap
+//---------------------------------------------------------
+
+typedef std::map<int, Route, std::less<int> >::iterator iRouteMenuMap;
+typedef std::map<int, Route, std::less<int> >::const_iterator ciRouteMenuMap;
+typedef std::map<int, Route, std::less<int> > RouteMenuMap;
+typedef std::pair<int, Route> pRouteMenuMap;
+typedef std::pair<iRouteMenuMap, bool > rpRouteMenuMap;
+
+#endif
+
diff --git a/muse2/muse/seqmsg.cpp b/muse2/muse/seqmsg.cpp
new file mode 100644
index 00000000..58944552
--- /dev/null
+++ b/muse2/muse/seqmsg.cpp
@@ -0,0 +1,1184 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: seqmsg.cpp,v 1.32.2.17 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+
+#include "song.h"
+#include "midiport.h"
+#include "minstrument.h"
+#include "app.h"
+#include "amixer.h"
+#include "tempo.h"
+#include "sig.h"
+#include "audio.h"
+#include "mididev.h"
+#include "audiodev.h"
+#include "alsamidi.h"
+#include "audio.h"
+#include "arranger.h"
+#include "plugin.h"
+#include "driver/jackmidi.h"
+
+//---------------------------------------------------------
+// sendMsg
+//---------------------------------------------------------
+
+void Audio::sendMsg(AudioMsg* m)
+ {
+ static int sno = 0;
+
+ if (_running) {
+ m->serialNo = sno++;
+ //DEBUG:
+ msg = m;
+ // wait for next audio "process" call to finish operation
+ int no = -1;
+ int rv = read(fromThreadFdr, &no, sizeof(int));
+ if (rv != sizeof(int))
+ perror("Audio: read pipe failed");
+ else if (no != (sno-1)) {
+ fprintf(stderr, "audio: bad serial number, read %d expected %d\n",
+ no, sno-1);
+ }
+ }
+ else {
+ // if audio is not running (during initialization)
+ // process commands immediatly
+ processMsg(m);
+ }
+ }
+
+//---------------------------------------------------------
+// sendMessage
+// send request from gui to sequencer
+// wait until request is processed
+//---------------------------------------------------------
+
+bool Audio::sendMessage(AudioMsg* m, bool doUndo)
+ {
+ if (doUndo)
+ song->startUndo();
+ sendMsg(m);
+ if (doUndo)
+ song->endUndo(0); // song->endMsgCmd();
+ return false;
+ }
+
+//---------------------------------------------------------
+// msgRemoveRoute
+//---------------------------------------------------------
+
+void Audio::msgRemoveRoute(Route src, Route dst)
+{
+ msgRemoveRoute1(src, dst);
+ //if (!checkAudioDevice()) return;
+ if (src.type == Route::JACK_ROUTE)
+ {
+ if (!checkAudioDevice()) return;
+
+ //if(dst.type == Route::JACK_MIDI_ROUTE)
+ if(dst.type == Route::MIDI_DEVICE_ROUTE)
+ {
+ //MidiJackDevice* jmd = dynamic_cast<MidiJackDevice*>(dst.device);
+ //if(jmd)
+ if(dst.device)
+ {
+ if(dst.device->deviceType() == MidiDevice::JACK_MIDI)
+ audioDevice->disconnect(src.jackPort, dst.device->clientPort());
+ //else
+ //{
+ // TODO...
+ //MidiAlsaDevice* amd = dynamic_cast<MidiAlsaDevice*>(dst.device);
+ //if(amd)
+ //}
+ }
+ }
+ else
+ audioDevice->disconnect(src.jackPort, ((AudioInput*)dst.track)->jackPort(dst.channel));
+ }
+ else if (dst.type == Route::JACK_ROUTE)
+ {
+ if (!checkAudioDevice()) return;
+
+ //if(src.type == Route::JACK_MIDI_ROUTE)
+ if(src.type == Route::MIDI_DEVICE_ROUTE)
+ {
+ //MidiJackDevice* jmd = dynamic_cast<MidiJackDevice*>(src.device);
+ //if(jmd)
+ if(src.device)
+ {
+ if(src.device->deviceType() == MidiDevice::JACK_MIDI)
+ audioDevice->disconnect(src.device->clientPort(), dst.jackPort);
+ //else
+ //{
+ // TODO...
+ //MidiAlsaDevice* amd = dynamic_cast<MidiAlsaDevice*>(src.device);
+ //if(amd)
+ //}
+ }
+ }
+ else
+ audioDevice->disconnect(((AudioOutput*)src.track)->jackPort(src.channel), dst.jackPort);
+ }
+}
+
+//---------------------------------------------------------
+// msgRemoveRoute1
+//---------------------------------------------------------
+
+void Audio::msgRemoveRoute1(Route src, Route dst)
+ {
+ AudioMsg msg;
+ msg.id = AUDIO_ROUTEREMOVE;
+ msg.sroute = src;
+ msg.droute = dst;
+ sendMsg(&msg);
+ }
+
+//---------------------------------------------------------
+// msgAddRoute
+//---------------------------------------------------------
+
+void Audio::msgAddRoute(Route src, Route dst)
+ {
+ if (src.type == Route::JACK_ROUTE)
+ {
+ if (!checkAudioDevice()) return;
+ if (isRunning())
+ {
+ //if(dst.type == Route::JACK_MIDI_ROUTE)
+ if(dst.type == Route::MIDI_DEVICE_ROUTE)
+ {
+ //MidiJackDevice* jmd = dynamic_cast<MidiJackDevice*>(dst.device);
+ //if(jmd)
+ if(dst.device)
+ {
+ if(dst.device->deviceType() == MidiDevice::JACK_MIDI)
+ audioDevice->connect(src.jackPort, dst.device->clientPort());
+ //else
+ //{
+ // TODO...
+ //MidiAlsaDevice* amd = dynamic_cast<MidiAlsaDevice*>(dst.device);
+ //if(amd)
+ //}
+ }
+ }
+ else
+ audioDevice->connect(src.jackPort, ((AudioInput*)dst.track)->jackPort(dst.channel));
+ }
+ }
+ else if (dst.type == Route::JACK_ROUTE)
+ {
+ if (!checkAudioDevice()) return;
+ if (audio->isRunning())
+ {
+ //if(src.type == Route::JACK_MIDI_ROUTE)
+ if(src.type == Route::MIDI_DEVICE_ROUTE)
+ {
+ //MidiJackDevice* jmd = dynamic_cast<MidiJackDevice*>(src.device);
+ //if(jmd)
+ if(src.device)
+ {
+ if(src.device->deviceType() == MidiDevice::JACK_MIDI)
+ audioDevice->connect(src.device->clientPort(), dst.jackPort);
+ //else
+ //{
+ // TODO...
+ //MidiAlsaDevice* amd = dynamic_cast<MidiAlsaDevice*>(src.device);
+ //if(amd)
+ //}
+ }
+ }
+ else
+ audioDevice->connect(((AudioOutput*)src.track)->jackPort(dst.channel), dst.jackPort);
+ }
+ }
+ msgAddRoute1(src, dst);
+ }
+
+//---------------------------------------------------------
+// msgAddRoute1
+//---------------------------------------------------------
+
+void Audio::msgAddRoute1(Route src, Route dst)
+ {
+ AudioMsg msg;
+ msg.id = AUDIO_ROUTEADD;
+ msg.sroute = src;
+ msg.droute = dst;
+ sendMsg(&msg);
+ }
+
+//---------------------------------------------------------
+// msgAddPlugin
+//---------------------------------------------------------
+
+void Audio::msgAddPlugin(AudioTrack* node, int idx, PluginI* plugin)
+ {
+ AudioMsg msg;
+ msg.id = AUDIO_ADDPLUGIN;
+ msg.snode = node;
+ msg.ival = idx;
+ msg.plugin = plugin;
+ sendMsg(&msg);
+ }
+
+//---------------------------------------------------------
+// msgSetRecord
+//---------------------------------------------------------
+
+void Audio::msgSetRecord(AudioTrack* node, bool val)
+ {
+ AudioMsg msg;
+ msg.id = AUDIO_RECORD;
+ msg.snode = node;
+ msg.ival = int(val);
+ sendMsg(&msg);
+ }
+
+//---------------------------------------------------------
+// msgSetVolume
+//---------------------------------------------------------
+
+void Audio::msgSetVolume(AudioTrack* src, double val)
+ {
+ AudioMsg msg;
+ msg.id = AUDIO_VOL;
+ msg.snode = src;
+ msg.dval = val;
+ sendMsg(&msg);
+ //muse->arranger->controllerChanged(src);
+ }
+
+//---------------------------------------------------------
+// msgSetPan
+//---------------------------------------------------------
+
+void Audio::msgSetPan(AudioTrack* node, double val)
+ {
+ AudioMsg msg;
+ msg.id = AUDIO_PAN;
+ msg.snode = node;
+ msg.dval = val;
+ sendMsg(&msg);
+ //muse->arranger->controllerChanged(node);
+ }
+
+//---------------------------------------------------------
+// msgSetPrefader
+//---------------------------------------------------------
+
+void Audio::msgSetPrefader(AudioTrack* node, int val)
+ {
+ AudioMsg msg;
+ msg.id = AUDIO_SET_PREFADER;
+ msg.snode = node;
+ msg.ival = val;
+ sendMsg(&msg);
+ }
+
+//---------------------------------------------------------
+// msgSetChannels
+//---------------------------------------------------------
+
+void Audio::msgSetChannels(AudioTrack* node, int n)
+ {
+ if (n == node->channels())
+ return;
+ QString name = node->name();
+ int mc = std::max(n, node->channels());
+
+ if (!name.isEmpty())
+ {
+ if (node->type() == Track::AUDIO_INPUT)
+ {
+ if (!checkAudioDevice()) return;
+ AudioInput* ai = (AudioInput*)node;
+ for (int i = 0; i < mc; ++i)
+ {
+ if (i < n && ai->jackPort(i) == 0)
+ {
+ char buffer[128];
+ snprintf(buffer, 128, "%s-%d", name.latin1(), i);
+ //ai->setJackPort(i, audioDevice->registerInPort(buffer));
+ ai->setJackPort(i, audioDevice->registerInPort(buffer, false));
+ }
+ else if ((i >= n) && ai->jackPort(i))
+ {
+ RouteList* ir = node->inRoutes();
+ for (iRoute ii = ir->begin(); ii != ir->end(); ++ii)
+ {
+ Route r = *ii;
+ if ((r.type == Route::JACK_ROUTE) && (r.channel == i))
+ {
+ msgRemoveRoute(r, Route(node,i));
+ break;
+ }
+ }
+ audioDevice->unregisterPort(ai->jackPort(i));
+ ai->setJackPort(i, 0);
+ }
+ }
+ }
+ else if (node->type() == Track::AUDIO_OUTPUT)
+ {
+ if (!checkAudioDevice()) return;
+ AudioOutput* ao = (AudioOutput*)node;
+ for (int i = 0; i < mc; ++i)
+ {
+ void* jp = ao->jackPort(i);
+ if (i < n && jp == 0)
+ {
+ char buffer[128];
+ snprintf(buffer, 128, "%s-%d", name.latin1(), i);
+ //ao->setJackPort(i, audioDevice->registerOutPort(buffer));
+ ao->setJackPort(i, audioDevice->registerOutPort(buffer, false));
+ }
+ else if (i >= n && jp)
+ {
+ RouteList* ir = node->outRoutes();
+ for (iRoute ii = ir->begin(); ii != ir->end(); ++ii)
+ {
+ Route r = *ii;
+ if ((r.type == Route::JACK_ROUTE) && (r.channel == i))
+ {
+ msgRemoveRoute(Route(node,i), r);
+ break;
+ }
+ }
+ audioDevice->unregisterPort(jp);
+ ao->setJackPort(i, 0);
+ }
+ }
+ }
+ }
+
+ /* TODO TODO: Change all stereo routes to mono.
+ // If we are going from stereo to mono we need to disconnect any stray synti 'mono last channel'...
+ if(n == 1 && node->channels() > 1)
+ {
+ // This should always happen - syntis are fixed channels, user cannot change them. But to be safe...
+ if(node->type() != Track::AUDIO_SOFTSYNTH)
+ {
+ if(node->type() != Track::AUDIO_INPUT)
+ {
+ RouteList* rl = node->inRoutes();
+ for(iRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ // Only interested in synth tracks.
+ if(r->type != Route::TRACK_ROUTE || r->track->type() != Track::AUDIO_SOFTSYNTH)
+ continue;
+ // If it's the last channel...
+ if(r->channel + 1 == ((AudioTrack*)r->track)->totalOutChannels())
+ {
+ msgRemoveRoute(*r, Route(node, r->channel));
+ //msgRemoveRoute(r, Route(node, r->remoteChannel));
+ break;
+ }
+ }
+ }
+
+ if(node->type() != Track::AUDIO_OUTPUT)
+ {
+ RouteList* rl = node->outRoutes();
+ for(iRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ // Only interested in synth tracks.
+ if(r->type != Route::TRACK_ROUTE || r->track->type() != Track::AUDIO_SOFTSYNTH)
+ continue;
+ // If it's the last channel...
+ if(r->channel + 1 == ((AudioTrack*)r->track)->totalOutChannels())
+ {
+ msgRemoveRoute(Route(node, r->channel), *r);
+ //msgRemoveRoute(Route(node, r->remoteChannel), r);
+ break;
+ }
+ }
+ }
+ }
+ }
+ */
+
+ AudioMsg msg;
+ msg.id = AUDIO_SET_CHANNELS;
+ msg.snode = node;
+ msg.ival = n;
+ sendMsg(&msg);
+ }
+
+//---------------------------------------------------------
+// msgSetPluginCtrlVal
+//---------------------------------------------------------
+
+//void Audio::msgSetPluginCtrlVal(PluginI* plugin, int param, double val)
+// p3.3.43
+void Audio::msgSetPluginCtrlVal(AudioTrack* track, int param, double val)
+{
+ AudioMsg msg;
+
+ msg.id = AUDIO_SET_PLUGIN_CTRL_VAL;
+ msg.ival = param;
+ msg.dval = val;
+ //msg.plugin = plugin;
+ msg.snode = track;
+ sendMsg(&msg);
+ //muse->arranger->controllerChanged(track);
+}
+
+//---------------------------------------------------------
+// msgSwapControllerIDX
+//---------------------------------------------------------
+
+void Audio::msgSwapControllerIDX(AudioTrack* node, int idx1, int idx2)
+{
+ AudioMsg msg;
+
+ msg.id = AUDIO_SWAP_CONTROLLER_IDX;
+ msg.snode = node;
+ msg.a = idx1;
+ msg.b = idx2;
+ sendMsg(&msg);
+ //muse->arranger->controllerChanged(node);
+}
+
+//---------------------------------------------------------
+// msgClearControllerEvents
+//---------------------------------------------------------
+
+void Audio::msgClearControllerEvents(AudioTrack* node, int acid)
+{
+ AudioMsg msg;
+
+ msg.id = AUDIO_CLEAR_CONTROLLER_EVENTS;
+ msg.snode = node;
+ msg.ival = acid;
+ sendMsg(&msg);
+ //muse->arranger->controllerChanged(node);
+}
+
+//---------------------------------------------------------
+// msgSeekPrevACEvent
+//---------------------------------------------------------
+
+void Audio::msgSeekPrevACEvent(AudioTrack* node, int acid)
+{
+ AudioMsg msg;
+
+ msg.id = AUDIO_SEEK_PREV_AC_EVENT;
+ msg.snode = node;
+ msg.ival = acid;
+ sendMsg(&msg);
+}
+
+//---------------------------------------------------------
+// msgSeekNextACEvent
+//---------------------------------------------------------
+
+void Audio::msgSeekNextACEvent(AudioTrack* node, int acid)
+{
+ AudioMsg msg;
+
+ msg.id = AUDIO_SEEK_NEXT_AC_EVENT;
+ msg.snode = node;
+ msg.ival = acid;
+ sendMsg(&msg);
+}
+
+//---------------------------------------------------------
+// msgEraseACEvent
+//---------------------------------------------------------
+
+void Audio::msgEraseACEvent(AudioTrack* node, int acid, int frame)
+{
+ AudioMsg msg;
+
+ msg.id = AUDIO_ERASE_AC_EVENT;
+ msg.snode = node;
+ msg.ival = acid;
+ msg.a = frame;
+ sendMsg(&msg);
+ //muse->arranger->controllerChanged(node);
+}
+
+//---------------------------------------------------------
+// msgEraseRangeACEvents
+//---------------------------------------------------------
+
+void Audio::msgEraseRangeACEvents(AudioTrack* node, int acid, int frame1, int frame2)
+{
+ AudioMsg msg;
+
+ msg.id = AUDIO_ERASE_RANGE_AC_EVENTS;
+ msg.snode = node;
+ msg.ival = acid;
+ msg.a = frame1;
+ msg.b = frame2;
+ sendMsg(&msg);
+ //muse->arranger->controllerChanged(node);
+}
+
+//---------------------------------------------------------
+// msgAddACEvent
+//---------------------------------------------------------
+
+void Audio::msgAddACEvent(AudioTrack* node, int acid, int frame, double val)
+{
+ AudioMsg msg;
+
+ msg.id = AUDIO_ADD_AC_EVENT;
+ msg.snode = node;
+ msg.ival = acid;
+ msg.a = frame;
+ msg.dval = val;
+ sendMsg(&msg);
+ //muse->arranger->controllerChanged(node);
+}
+
+//---------------------------------------------------------
+// msgSetSolo
+//---------------------------------------------------------
+
+void Audio::msgSetSolo(Track* track, bool val)
+{
+ AudioMsg msg;
+ msg.id = AUDIO_SET_SOLO;
+ msg.track = track;
+ msg.ival = int(val);
+ sendMsg(&msg);
+}
+
+//---------------------------------------------------------
+// msgSetSegSize
+//---------------------------------------------------------
+
+void Audio::msgSetSegSize(int bs, int sr)
+ {
+ AudioMsg msg;
+ msg.id = AUDIO_SET_SEG_SIZE;
+ msg.ival = bs;
+ msg.iival = sr;
+ sendMsg(&msg);
+ }
+
+//---------------------------------------------------------
+// msgSeek
+//---------------------------------------------------------
+
+void Audio::msgSeek(const Pos& pos)
+ {
+ if (!checkAudioDevice()) return;
+ //audioDevice->seekTransport(pos.frame());
+ // p3.3.23
+ //printf("Audio::msgSeek before audioDevice->seekTransport frame:%d\n", pos.frame());
+ audioDevice->seekTransport(pos);
+ // p3.3.23
+ //printf("Audio::msgSeek after audioDevice->seekTransport frame:%d\n", pos.frame());
+ }
+
+//---------------------------------------------------------
+// msgUndo
+//---------------------------------------------------------
+
+void Audio::msgUndo()
+ {
+ AudioMsg msg;
+ msg.id = SEQM_UNDO;
+ sendMsg(&msg);
+ }
+
+//---------------------------------------------------------
+// msgRedo
+//---------------------------------------------------------
+
+void Audio::msgRedo()
+ {
+ AudioMsg msg;
+ msg.id = SEQM_REDO;
+ sendMsg(&msg);
+ }
+
+//---------------------------------------------------------
+// msgPlay
+//---------------------------------------------------------
+
+void Audio::msgPlay(bool val)
+ {
+ if (val) {
+ if (audioDevice)
+ {
+ unsigned sfr = song->cPos().frame();
+ unsigned dcfr = audioDevice->getCurFrame();
+ if(dcfr != sfr)
+ //audioDevice->seekTransport(sfr);
+ audioDevice->seekTransport(song->cPos());
+ audioDevice->startTransport();
+ }
+
+ }else {
+ if (audioDevice)
+ audioDevice->stopTransport();
+ _bounce = false;
+ }
+ }
+
+//---------------------------------------------------------
+// msgShowInstrumentGui
+//---------------------------------------------------------
+
+void Audio::msgShowInstrumentGui(MidiInstrument* instr, bool val)
+ {
+ instr->showGui(val);
+ AudioMsg msg;
+ msg.id = MIDI_SHOW_INSTR_GUI;
+ msg.p1 = instr;
+ msg.a = val;
+ sendMessage(&msg, false);
+ }
+
+//---------------------------------------------------------
+// msgAddTrack
+//---------------------------------------------------------
+
+void Song::msgInsertTrack(Track* track, int idx, bool doUndoFlag)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_ADD_TRACK;
+ msg.track = track;
+ msg.ival = idx;
+ if (doUndoFlag) {
+ song->startUndo();
+ undoOp(UndoOp::AddTrack, idx, track);
+ }
+ audio->sendMsg(&msg);
+ if (doUndoFlag)
+ endUndo(SC_TRACK_INSERTED);
+ }
+
+//---------------------------------------------------------
+// msgRemoveTrack
+//---------------------------------------------------------
+
+void Audio::msgRemoveTrack(Track* track, bool doUndoFlag)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_REMOVE_TRACK;
+ msg.track = track;
+ sendMessage(&msg, doUndoFlag);
+ }
+
+//---------------------------------------------------------
+// msgRemoveTracks
+// remove all selected tracks
+//---------------------------------------------------------
+
+void Audio::msgRemoveTracks()
+{
+ bool loop;
+ do
+ {
+ loop = false;
+ TrackList* tl = song->tracks();
+ for (iTrack t = tl->begin(); t != tl->end(); ++t)
+ {
+ Track* tr = *t;
+ if (tr->selected())
+ {
+ song->removeTrack1(tr);
+ msgRemoveTrack(tr, false);
+ song->removeTrack3(tr);
+ loop = true;
+ break;
+ }
+ }
+ }
+ while (loop);
+
+ /*
+ // TESTED: DIDN'T WORK: It still skipped some selected tracks !
+ // Quote from SGI STL: "Erasing an element from a map also does not invalidate any iterators,
+ // except, of course, for iterators that actually point to the element
+ // that is being erased."
+ // Well that doesn't seem true here...
+
+ TrackList* tl = song->tracks();
+ for(ciTrack t = tl->begin(); t != tl->end() ; )
+ {
+ if((*t)->selected())
+ {
+ // Changed 20070102: - Iterator t becomes invalid after msgRemoveTrack.
+ ciTrack tt = t;
+ ++t;
+ Track* tr = *tt;
+
+ song->removeTrack1(tr);
+ msgRemoveTrack(tr, false);
+ song->removeTrack3(tr);
+
+ }
+ else
+ ++t;
+
+ }
+ */
+
+}
+
+//---------------------------------------------------------
+// msgChangeTrack
+// oldTrack - copy of the original track befor modification
+// newTrack - modified original track
+//---------------------------------------------------------
+
+void Audio::msgChangeTrack(Track* oldTrack, Track* newTrack, bool doUndoFlag)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_CHANGE_TRACK;
+ msg.p1 = oldTrack;
+ msg.p2 = newTrack;
+ sendMessage(&msg, doUndoFlag);
+ }
+
+//---------------------------------------------------------
+// msgMoveTrack
+// move track idx1 to slot idx2
+//---------------------------------------------------------
+
+void Audio::msgMoveTrack(int idx1, int idx2, bool doUndoFlag)
+ {
+ if (idx1 < 0 || idx2 < 0) // sanity check
+ return;
+ int n = song->tracks()->size();
+ if (idx1 >= n || idx2 >= n) // sanity check
+ return;
+ AudioMsg msg;
+ msg.id = SEQM_MOVE_TRACK;
+ msg.a = idx1;
+ msg.b = idx2;
+ sendMessage(&msg, doUndoFlag);
+ }
+
+//---------------------------------------------------------
+// msgAddPart
+//---------------------------------------------------------
+
+void Audio::msgAddPart(Part* part, bool doUndoFlag)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_ADD_PART;
+ msg.p1 = part;
+ sendMessage(&msg, doUndoFlag);
+ }
+
+//---------------------------------------------------------
+// msgRemovePart
+//---------------------------------------------------------
+
+void Audio::msgRemovePart(Part* part, bool doUndoFlag)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_REMOVE_PART;
+ msg.p1 = part;
+ sendMessage(&msg, doUndoFlag);
+ }
+
+//---------------------------------------------------------
+// msgRemoveParts
+// remove selected parts; return true if any part was
+// removed
+//---------------------------------------------------------
+
+bool Song::msgRemoveParts()
+ {
+ bool loop;
+ bool partSelected = false;
+ do {
+ loop = false;
+ TrackList* tl = song->tracks();
+
+ for (iTrack it = tl->begin(); it != tl->end(); ++it) {
+ PartList* pl = (*it)->parts();
+ for (iPart ip = pl->begin(); ip != pl->end(); ++ip) {
+ if (ip->second->selected()) {
+ if ((*it)->type() == Track::WAVE) {
+ audio->msgRemovePart((WavePart*)(ip->second));
+ }
+ else {
+ audio->msgRemovePart(ip->second, false);
+ }
+ loop = true;
+ partSelected = true;
+ break;
+ }
+ }
+ if (loop)
+ break;
+ }
+ } while (loop);
+ return partSelected;
+ }
+
+//---------------------------------------------------------
+// msgChangePart
+//---------------------------------------------------------
+
+//void Audio::msgChangePart(Part* oldPart, Part* newPart, bool doUndoFlag)
+void Audio::msgChangePart(Part* oldPart, Part* newPart, bool doUndoFlag, bool doCtrls, bool doClones)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_CHANGE_PART;
+ msg.p1 = oldPart;
+ msg.p2 = newPart;
+ msg.a = doCtrls;
+ msg.b = doClones;
+ sendMessage(&msg, doUndoFlag);
+ }
+
+//---------------------------------------------------------
+// msgAddEvent
+//---------------------------------------------------------
+
+//void Audio::msgAddEvent(Event& event, Part* part, bool doUndoFlag)
+void Audio::msgAddEvent(Event& event, Part* part, bool doUndoFlag, bool doCtrls, bool doClones)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_ADD_EVENT;
+ msg.ev1 = event;
+ msg.p2 = part;
+ msg.a = doCtrls;
+ msg.b = doClones;
+ sendMessage(&msg, doUndoFlag);
+ }
+
+//---------------------------------------------------------
+// msgDeleteEvent
+//---------------------------------------------------------
+
+//void Audio::msgDeleteEvent(Event& event, Part* part, bool doUndoFlag)
+void Audio::msgDeleteEvent(Event& event, Part* part, bool doUndoFlag, bool doCtrls, bool doClones)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_REMOVE_EVENT;
+ msg.ev1 = event;
+ msg.p2 = part;
+ msg.a = doCtrls;
+ msg.b = doClones;
+ sendMessage(&msg, doUndoFlag);
+ }
+
+//---------------------------------------------------------
+// msgChangeEvent
+//---------------------------------------------------------
+
+//void Audio::msgChangeEvent(Event& oe, Event& ne, Part* part, bool doUndoFlag)
+void Audio::msgChangeEvent(Event& oe, Event& ne, Part* part, bool doUndoFlag, bool doCtrls, bool doClones)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_CHANGE_EVENT;
+ msg.ev1 = oe;
+ msg.ev2 = ne;
+ msg.p3 = part;
+ msg.a = doCtrls;
+ msg.b = doClones;
+ sendMessage(&msg, doUndoFlag);
+ }
+
+//---------------------------------------------------------
+// msgAddTempo
+//---------------------------------------------------------
+
+void Audio::msgAddTempo(int tick, int tempo, bool doUndoFlag)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_ADD_TEMPO;
+ msg.a = tick;
+ msg.b = tempo;
+ sendMessage(&msg, doUndoFlag);
+ }
+
+//---------------------------------------------------------
+// msgSetTempo
+//---------------------------------------------------------
+
+void Audio::msgSetTempo(int tick, int tempo, bool doUndoFlag)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_SET_TEMPO;
+ msg.a = tick;
+ msg.b = tempo;
+ sendMessage(&msg, doUndoFlag);
+ }
+
+//---------------------------------------------------------
+// msgSetGlobalTempo
+//---------------------------------------------------------
+
+void Audio::msgSetGlobalTempo(int val)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_SET_GLOBAL_TEMPO;
+ msg.a = val;
+ sendMessage(&msg, false);
+ }
+
+//---------------------------------------------------------
+// msgDeleteTempo
+//---------------------------------------------------------
+
+void Audio::msgDeleteTempo(int tick, int tempo, bool doUndoFlag)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_REMOVE_TEMPO;
+ msg.a = tick;
+ msg.b = tempo;
+ sendMessage(&msg, doUndoFlag);
+ }
+
+//---------------------------------------------------------
+// msgAddSig
+//---------------------------------------------------------
+
+void Audio::msgAddSig(int tick, int z, int n, bool doUndoFlag)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_ADD_SIG;
+ msg.a = tick;
+ msg.b = z;
+ msg.c = n;
+ sendMessage(&msg, doUndoFlag);
+ }
+
+//---------------------------------------------------------
+// msgRemoveSig
+//! sends remove tempo signature message
+//---------------------------------------------------------
+
+void Audio::msgRemoveSig(int tick, int z, int n, bool doUndoFlag)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_REMOVE_SIG;
+ msg.a = tick;
+ msg.b = z;
+ msg.c = n;
+ sendMessage(&msg, doUndoFlag);
+ }
+
+//---------------------------------------------------------
+// msgScanAlsaMidiPorts
+//---------------------------------------------------------
+
+void Audio::msgScanAlsaMidiPorts()
+ {
+ AudioMsg msg;
+ msg.id = SEQM_SCAN_ALSA_MIDI_PORTS;
+ sendMessage(&msg, false);
+ }
+
+//---------------------------------------------------------
+// msgResetMidiDevices
+//---------------------------------------------------------
+
+void Audio::msgResetMidiDevices()
+ {
+ AudioMsg msg;
+ msg.id = SEQM_RESET_DEVICES;
+ sendMessage(&msg, false);
+ }
+
+//---------------------------------------------------------
+// msgInitMidiDevices
+//---------------------------------------------------------
+
+void Audio::msgInitMidiDevices()
+ {
+ AudioMsg msg;
+ msg.id = SEQM_INIT_DEVICES;
+ sendMessage(&msg, false);
+ }
+
+//---------------------------------------------------------
+// panic
+//---------------------------------------------------------
+
+void Audio::msgPanic()
+ {
+ AudioMsg msg;
+ msg.id = SEQM_PANIC;
+ sendMessage(&msg, false);
+ }
+
+//---------------------------------------------------------
+// localOff
+//---------------------------------------------------------
+
+void Audio::msgLocalOff()
+ {
+ AudioMsg msg;
+ msg.id = SEQM_MIDI_LOCAL_OFF;
+ sendMessage(&msg, false);
+ }
+
+//---------------------------------------------------------
+// msgUpdateSoloStates
+//---------------------------------------------------------
+
+void Audio::msgUpdateSoloStates()
+ {
+ AudioMsg msg;
+ msg.id = SEQM_UPDATE_SOLO_STATES;
+ sendMsg(&msg);
+ }
+
+//---------------------------------------------------------
+// msgSetAux
+//---------------------------------------------------------
+
+void Audio::msgSetAux(AudioTrack* track, int idx, double val)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_SET_AUX;
+ msg.snode = track;
+ msg.ival = idx;
+ msg.dval = val;
+ sendMessage(&msg, false);
+ }
+
+//---------------------------------------------------------
+// msgPlayMidiEvent
+//---------------------------------------------------------
+
+void Audio::msgPlayMidiEvent(const MidiPlayEvent* event)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_PLAY_MIDI_EVENT;
+ msg.p1 = event;
+ sendMessage(&msg, false);
+ }
+
+//---------------------------------------------------------
+// msgSetHwCtrlState
+//---------------------------------------------------------
+
+void Audio::msgSetHwCtrlState(MidiPort* port, int ch, int ctrl, int val)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_SET_HW_CTRL_STATE;
+ msg.p1 = port;
+ msg.a = ch;
+ msg.b = ctrl;
+ msg.c = val;
+ sendMessage(&msg, false);
+ }
+
+//---------------------------------------------------------
+// msgSetHwCtrlState
+//---------------------------------------------------------
+
+void Audio::msgSetHwCtrlStates(MidiPort* port, int ch, int ctrl, int val, int lastval)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_SET_HW_CTRL_STATE;
+ msg.p1 = port;
+ msg.a = ch;
+ msg.b = ctrl;
+ msg.c = val;
+ msg.ival = lastval;
+ sendMessage(&msg, false);
+ }
+
+//---------------------------------------------------------
+// msgSetTrackOutChannel
+//---------------------------------------------------------
+
+void Audio::msgSetTrackOutChannel(MidiTrack* track, int ch)
+{
+ AudioMsg msg;
+ msg.id = SEQM_SET_TRACK_OUT_CHAN;
+ msg.p1 = track;
+ msg.a = ch;
+ sendMessage(&msg, false);
+}
+
+//---------------------------------------------------------
+// msgSetTrackOutPort
+//---------------------------------------------------------
+
+void Audio::msgSetTrackOutPort(MidiTrack* track, int port)
+{
+ AudioMsg msg;
+ msg.id = SEQM_SET_TRACK_OUT_PORT;
+ msg.p1 = track;
+ msg.a = port;
+ sendMessage(&msg, false);
+}
+
+//---------------------------------------------------------
+// msgRemapPortDrumCtlEvents
+//---------------------------------------------------------
+
+void Audio::msgRemapPortDrumCtlEvents(int mapidx, int newnote, int newchan, int newport)
+{
+ AudioMsg msg;
+ msg.id = SEQM_REMAP_PORT_DRUM_CTL_EVS;
+ msg.ival = mapidx;
+ msg.a = newnote;
+ msg.b = newchan;
+ msg.c = newport;
+ sendMessage(&msg, false);
+}
+
+//---------------------------------------------------------
+// msgChangeAllPortDrumCtlEvents
+//---------------------------------------------------------
+
+void Audio::msgChangeAllPortDrumCtrlEvents(bool add, bool drumonly)
+{
+ AudioMsg msg;
+ msg.id = SEQM_CHANGE_ALL_PORT_DRUM_CTL_EVS;
+ msg.a = (int)add;
+ msg.b = (int)drumonly;
+ sendMessage(&msg, false);
+}
+
+//---------------------------------------------------------
+// msgSetSendMetronome
+//---------------------------------------------------------
+
+void Audio::msgSetSendMetronome(AudioTrack* track, bool b)
+{
+ AudioMsg msg;
+ msg.id = AUDIO_SET_SEND_METRONOME;
+ msg.snode = track;
+ msg.ival = (int)b;
+ sendMessage(&msg, false);
+}
+
+//---------------------------------------------------------
+// msgBounce
+// start bounce operation
+//---------------------------------------------------------
+
+void Audio::msgBounce()
+ {
+ _bounce = true;
+ if (!checkAudioDevice()) return;
+ //audioDevice->seekTransport(song->lPos().frame());
+ audioDevice->seekTransport(song->lPos());
+ }
+
+//---------------------------------------------------------
+// msgIdle
+//---------------------------------------------------------
+
+void Audio::msgIdle(bool on)
+ {
+ AudioMsg msg;
+ msg.id = SEQM_IDLE;
+ msg.a = on;
+ sendMessage(&msg, false);
+ }
+
diff --git a/muse2/muse/shortcuts.cpp b/muse2/muse/shortcuts.cpp
new file mode 100644
index 00000000..61f950eb
--- /dev/null
+++ b/muse2/muse/shortcuts.cpp
@@ -0,0 +1,312 @@
+//
+// C++ Implementation: shortcuts
+//
+// Description:
+// Definition of shortcuts used in the application
+//
+// Author: Mathias Lundgren <lunar_shuttle@users.sourceforge.net>, (C) 2003
+//
+// Copyright: Mathias Lundgren (lunar_shuttle@users.sourceforge.net) (C) 2003
+//
+//
+#include "shortcuts.h"
+#include <qtranslator.h>
+
+
+ShortCut shortcuts[SHRT_NUM_OF_ELEMENTS];
+void defShrt(int shrt, int key, const char* descr, int type, const char* xml)
+{
+ shortcuts[shrt].key = key;
+ shortcuts[shrt].descr = QT_TR_NOOP(descr);
+ shortcuts[shrt].type = type;
+ shortcuts[shrt].xml = xml;
+}
+
+
+void initShortCuts()
+ {
+ //Global:
+ defShrt(SHRT_PLAY_SONG, Qt::Key_Enter, "Transport: Start playback from current location", GLOBAL_SHRT, "play");
+ defShrt(SHRT_TOGGLE_METRO, Qt::Key_C, "Transport: Toggle metronome", GLOBAL_SHRT,"toggle_metro");
+ defShrt(SHRT_STOP, Qt::Key_Insert,"Transport: Stop Playback", GLOBAL_SHRT, "stop");
+ defShrt(SHRT_GOTO_START, Qt::Key_W, "Transport: Goto Start", GLOBAL_SHRT, "goto_start");
+ defShrt(SHRT_PLAY_TOGGLE, Qt::Key_Space, "Transport: Play, Stop, Rewind", GLOBAL_SHRT, "play_toggle");
+ defShrt(SHRT_GOTO_LEFT, Qt::Key_End, "Transport: Goto left marker" , GLOBAL_SHRT, "goto_left");
+ defShrt(SHRT_GOTO_RIGHT, Qt::Key_PageDown, "Transport: Goto right marker" , GLOBAL_SHRT, "goto_right");
+ defShrt(SHRT_TOGGLE_LOOP, Qt::Key_Slash, "Transport: Toggle Loop section", GLOBAL_SHRT, "toggle_loop");
+ defShrt(SHRT_START_REC, Qt::Key_Asterisk, "Transport: Toggle Record", GLOBAL_SHRT, "toggle_rec");
+ defShrt(SHRT_REC_CLEAR, Qt::Key_Backspace, "Transport: Clear all rec enabled tracks", GLOBAL_SHRT, "rec_clear");
+ defShrt(SHRT_COPY, Qt::CTRL + Qt::Key_C, "Edit: Copy", INVIS_SHRT, "copy");
+ defShrt(SHRT_UNDO, Qt::CTRL + Qt::Key_Z, "Edit: Undo", INVIS_SHRT, "undo");
+ defShrt(SHRT_REDO, Qt::CTRL + Qt::Key_Y, "Edit: Redo", INVIS_SHRT, "redo");
+ defShrt(SHRT_CUT, Qt::CTRL + Qt::Key_X, "Edit: Cut", INVIS_SHRT, "cut");
+ defShrt(SHRT_PASTE, Qt::CTRL + Qt::Key_V, "Edit: Paste,", INVIS_SHRT, "paste");
+ defShrt(SHRT_DELETE, Qt::Key_Delete, "Edit: Delete", INVIS_SHRT, "delete");
+
+ //-----------------------------------------------------------
+ // Arranger:
+ defShrt(SHRT_NEW, Qt::CTRL + Qt::Key_N, "File: New project", ARRANG_SHRT + DEDIT_SHRT, "new_project");
+ defShrt(SHRT_OPEN, Qt::CTRL + Qt::Key_O, "File: Open from disk", ARRANG_SHRT + DEDIT_SHRT, "open_project");
+ defShrt(SHRT_SAVE, Qt::CTRL + Qt::Key_S, "File: Save project", ARRANG_SHRT + DEDIT_SHRT, "save_project");
+ //-----------------------------------------------------------
+
+ defShrt(SHRT_OPEN_RECENT, Qt::CTRL + Qt::Key_1, "File: Open recent file", ARRANG_SHRT, "open_recent");
+ defShrt(SHRT_SAVE_AS, 0 , "File: Save as", ARRANG_SHRT, "save_project_as");
+ defShrt(SHRT_LOAD_TEMPLATE, 0 , "File: Load template", ARRANG_SHRT, "load_template");
+// defShrt(SHRT_CONFIG_PRINTER, Qt::CTRL + Qt::Key_P, "Configure printer", ARRANG_SHRT, "config_printer");
+ defShrt(SHRT_IMPORT_MIDI, 0 , "File: Import midi file", ARRANG_SHRT, "import_midi");
+ defShrt(SHRT_EXPORT_MIDI, 0 , "File: Export midi file", ARRANG_SHRT, "export_midi");
+ defShrt(SHRT_IMPORT_PART, 0 , "File: Import midi part", ARRANG_SHRT, "import_part");
+ defShrt(SHRT_IMPORT_AUDIO, 0 , "File: Import audio file", ARRANG_SHRT, "import_audio");
+ defShrt(SHRT_QUIT, Qt::CTRL + Qt::Key_Q, "File: Quit MusE", ARRANG_SHRT, "quit");
+// defShrt(SHRT_DESEL_PARTS, Qt::CTRL + Qt::Key_B, "Deselect all parts", ARRANG_SHRT, "deselect_parts");
+ defShrt(SHRT_SELECT_PRTSTRACK, Qt::CTRL+ Qt::ALT + Qt::Key_P, "Edit: Select parts on track", ARRANG_SHRT, "select_parts_on_track");
+ defShrt(SHRT_OPEN_PIANO, Qt::CTRL + Qt::Key_E, "Open pianoroll", ARRANG_SHRT, "open_pianoroll");
+ defShrt(SHRT_OPEN_DRUMS, Qt::CTRL + Qt::Key_D, "Open drumeditor", ARRANG_SHRT, "open_drumedit");
+ defShrt(SHRT_OPEN_LIST, Qt::CTRL + Qt::Key_L, "Open listeditor", ARRANG_SHRT, "open_listedit");
+ defShrt(SHRT_OPEN_WAVE, Qt::CTRL + Qt::Key_W, "Open waveeditor", ARRANG_SHRT, "open_waveedit");
+ defShrt(SHRT_OPEN_GRAPHIC_MASTER, Qt::CTRL + Qt::Key_M, "Open graphical mastertrack editor", ARRANG_SHRT, "open_graph_master");
+ defShrt(SHRT_OPEN_LIST_MASTER, Qt::CTRL + Qt::SHIFT + Qt::Key_M, "Open list mastertrack editor", ARRANG_SHRT, "open_list_master");
+ defShrt(SHRT_OPEN_MIDI_TRANSFORM, Qt::CTRL + Qt::Key_T, "Open midi transformer", ARRANG_SHRT, "open_midi_transform");
+ defShrt(SHRT_ADD_MIDI_TRACK, Qt::CTRL + Qt::Key_J, "Add midi track", ARRANG_SHRT, "add_midi_track");
+ defShrt(SHRT_ADD_DRUM_TRACK, 0, "Add drum track", ARRANG_SHRT, "add_drum_track");
+ defShrt(SHRT_ADD_WAVE_TRACK, 0, "Add wave track", ARRANG_SHRT, "add_wave_track");
+ defShrt(SHRT_ADD_AUDIO_OUTPUT, 0, "Add audio output", ARRANG_SHRT, "add_audio_output");
+ defShrt(SHRT_ADD_AUDIO_GROUP, 0, "Add audio group", ARRANG_SHRT, "add_audio_group");
+ defShrt(SHRT_ADD_AUDIO_INPUT, 0, "Add audio input", ARRANG_SHRT, "add_audio_input");
+ defShrt(SHRT_ADD_AUDIO_AUX , 0, "Add audio aux", ARRANG_SHRT, "add_audio_aux");
+ defShrt(SHRT_GLOBAL_CUT, 0, "Structure: Global cut", ARRANG_SHRT, "global_cut");
+ defShrt(SHRT_GLOBAL_INSERT, 0, "Structure: Global insert", ARRANG_SHRT, "global_insert");
+ defShrt(SHRT_GLOBAL_SPLIT, 0, "Structure: Global split", ARRANG_SHRT, "global_split");
+ defShrt(SHRT_COPY_RANGE, 0, "Structure: Copy range", ARRANG_SHRT, "copy_range");
+ defShrt(SHRT_CUT_EVENTS, 0, "Structure: Cut events", ARRANG_SHRT, "cut_events");
+ //defShrt(SHRT_OPEN_MIXER, Qt::Key_F10, "View: Open mixer window", ARRANG_SHRT, "toggle_mixer");
+ defShrt(SHRT_OPEN_MIXER, Qt::Key_F10, "View: Open mixer #1 window", ARRANG_SHRT, "toggle_mixer");
+ defShrt(SHRT_OPEN_MIXER2, Qt::CTRL + Qt::Key_F10, "View: Open mixer #2 window", ARRANG_SHRT, "toggle_mixer2");
+ defShrt(SHRT_OPEN_TRANSPORT, Qt::Key_F11, "View: Toggle transport window", ARRANG_SHRT, "toggle_transport");
+ defShrt(SHRT_OPEN_BIGTIME, Qt::Key_F12, "View: Toggle bigtime window", ARRANG_SHRT, "toggle_bigtime");
+ defShrt(SHRT_OPEN_MARKER, Qt::Key_F9, "View: Open marker window", ARRANG_SHRT, "marker_window");
+
+ defShrt(SHRT_FOLLOW_JUMP, 0, "Settings: Follow song by page", ARRANG_SHRT, "follow_jump");
+ defShrt(SHRT_FOLLOW_NO, 0, "Settings: Follow song off", ARRANG_SHRT, "follow_no");
+ defShrt(SHRT_FOLLOW_CONTINUOUS, 0, "Settings: Follow song continuous", ARRANG_SHRT, "follow_continuous");
+
+ defShrt(SHRT_GLOBAL_CONFIG, 0, "Settings: Global configuration", ARRANG_SHRT, "configure_global");
+ defShrt(SHRT_CONFIG_SHORTCUTS, 0, "Settings: Configure shortcuts", ARRANG_SHRT, "configure_shortcuts");
+ defShrt(SHRT_CONFIG_METRONOME, 0, "Settings: Configure metronome", ARRANG_SHRT, "configure_metronome");
+ defShrt(SHRT_CONFIG_MIDISYNC, 0, "Settings: Midi sync configuration", ARRANG_SHRT, "configure_midi_sync");
+ defShrt(SHRT_MIDI_FILE_CONFIG, 0, "Settings: Midi file import/export configuration", ARRANG_SHRT, "configure_midi_file");
+ defShrt(SHRT_APPEARANCE_SETTINGS, 0, "Settings: Appearance settings", ARRANG_SHRT, "configure_appearance_settings");
+ defShrt(SHRT_CONFIG_MIDI_PORTS, 0, "Settings: Midi ports / Soft Synth", ARRANG_SHRT, "configure_midi_ports");
+ defShrt(SHRT_CONFIG_AUDIO_PORTS, 0, "Settings: Audio subsystem configuration", ARRANG_SHRT, "configure_audio_ports");
+ //defShrt(SHRT_SAVE_GLOBAL_CONFIG, 0, "Save global configuration", ARRANG_SHRT, "configure_save_global");
+
+ defShrt(SHRT_MIDI_EDIT_INSTRUMENTS, 0, "Midi: Edit midi instruments", ARRANG_SHRT, "midi_edit_instruments");
+ defShrt(SHRT_MIDI_INPUT_TRANSFORM, 0, "Midi: Open midi input transform", ARRANG_SHRT, "midi_open_input_transform");
+ defShrt(SHRT_MIDI_INPUT_FILTER, 0, "Midi: Open midi input filter", ARRANG_SHRT, "midi_open_input_filter");
+ defShrt(SHRT_MIDI_INPUT_TRANSPOSE, 0, "Midi: Midi input transpose", ARRANG_SHRT, "midi_open_input_transpose");
+ defShrt(SHRT_MIDI_REMOTE_CONTROL, 0, "Midi: Midi remote control", ARRANG_SHRT, "midi_remote_control");
+ defShrt(SHRT_RANDOM_RHYTHM_GENERATOR,0,"Midi: Random rhythm generator", ARRANG_SHRT, "midi_random_rhythm_generator");
+ defShrt(SHRT_MIDI_RESET, 0, "Midi: Reset midi", ARRANG_SHRT, "midi_reset");
+ defShrt(SHRT_MIDI_INIT, 0, "Midi: Init midi", ARRANG_SHRT, "midi_init");
+ defShrt(SHRT_MIDI_LOCAL_OFF, 0, "Midi: Midi local off", ARRANG_SHRT, "midi_local_off");
+
+ defShrt(SHRT_AUDIO_BOUNCE_TO_TRACK, 0, "Audio: Bounce audio to track", ARRANG_SHRT, "audio_bounce_to_track");
+ defShrt(SHRT_AUDIO_BOUNCE_TO_FILE, 0, "Audio: Bounce audio to file", ARRANG_SHRT, "audio_bounce_to_file");
+ defShrt(SHRT_AUDIO_RESTART, 0, "Audio: Restart audio", ARRANG_SHRT, "audio_restart");
+
+ defShrt(SHRT_MIXER_AUTOMATION, 0, "Automation: Mixer automation", ARRANG_SHRT, "mixer_automation");
+ defShrt(SHRT_MIXER_SNAPSHOT, 0, "Automation: Take mixer snapshot", ARRANG_SHRT, "mixer_snapshot");
+ defShrt(SHRT_MIXER_AUTOMATION_CLEAR,0, "Automation: Clear mixer automation", ARRANG_SHRT, "mixer_automation_clear");
+
+// defShrt(SHRT_OPEN_CLIPS, 0, "View audio clips", ARRANG_SHRT, "view_audio_clips");
+ defShrt(SHRT_OPEN_HELP, Qt::Key_F1, "Help: Open Manual", ARRANG_SHRT, "open_help");
+ defShrt(SHRT_START_WHATSTHIS, Qt::SHIFT + Qt::Key_F1, "Help: Toggle whatsthis mode", ARRANG_SHRT, "toggle_whatsthis");
+
+ defShrt(SHRT_EDIT_PART, Qt::Key_Return, "Edit: Edit selected part", ARRANG_SHRT, "edit_selected_part");
+ defShrt(SHRT_SEL_ABOVE, Qt::Key_Up, "Edit: Select nearest part on track above", ARRANG_SHRT, "sel_part_above");
+ defShrt(SHRT_SEL_ABOVE_ADD, Qt::SHIFT + Qt::Key_Up, "Edit: Add nearest part on track above", ARRANG_SHRT, "sel_part_above_add");
+ defShrt(SHRT_SEL_BELOW, Qt::Key_Down, "Edit: Select nearest part on track below", ARRANG_SHRT, "sel_part_below");
+ defShrt(SHRT_SEL_BELOW_ADD, Qt::SHIFT + Qt::Key_Down, "Edit: Add nearest part on track below", ARRANG_SHRT, "sel_part_below_add");
+
+// defShrt(SHRT_INSERT, Qt::CTRL+Qt::SHIFT+ Qt::Key_I, "Edit: Insert parts, moving time", ARRANG_SHRT, "insert_parts");
+// defShrt(SHRT_INSERTMEAS, Qt::CTRL+Qt::SHIFT+ Qt::Key_M, "Edit: Insert empty measure", ARRANG_SHRT, "insert_measure");
+
+ defShrt(SHRT_SEL_TRACK_ABOVE, Qt::CTRL + Qt::Key_Up, "Select track above", ARRANG_SHRT, "sel_track_above");
+ defShrt(SHRT_SEL_TRACK_BELOW, Qt::CTRL + Qt::Key_Down, "Select track below", ARRANG_SHRT, "sel_track_below");
+
+ //-----------------------------------------------------------
+
+ defShrt(SHRT_TRANSPOSE, 0, "Midi: Transpose", ARRANG_SHRT + PROLL_SHRT, "midi_transpose");
+
+ //-----------------------------------------------------------
+
+ defShrt(SHRT_SELECT_ALL, Qt::CTRL + Qt::Key_A, "Edit: Select all", ARRANG_SHRT + PROLL_SHRT + DEDIT_SHRT, "sel_all");
+ defShrt(SHRT_SELECT_NONE, Qt::CTRL + Qt::SHIFT + Qt::Key_A, "Edit: Select none", ARRANG_SHRT + PROLL_SHRT + DEDIT_SHRT, "sel_none");
+ defShrt(SHRT_SELECT_INVERT, Qt::CTRL + Qt::Key_I, "Edit: Invert selection", ARRANG_SHRT + PROLL_SHRT + DEDIT_SHRT, "sel_inv");
+ defShrt(SHRT_SELECT_ILOOP, 0, "Edit: Select events/parts inside locators", ARRANG_SHRT + PROLL_SHRT + DEDIT_SHRT, "sel_ins_loc");
+ defShrt(SHRT_SELECT_OLOOP, 0, "Edit: Select events/parts outside locators", ARRANG_SHRT + PROLL_SHRT + DEDIT_SHRT, "sel_out_loc");
+ defShrt(SHRT_SELECT_PREV_PART, Qt::ALT + Qt::Key_Left, "Edit: Select previous part", ARRANG_SHRT + PROLL_SHRT + DEDIT_SHRT, "sel_prv_prt");
+ defShrt(SHRT_SELECT_NEXT_PART, Qt::ALT + Qt::Key_Right, "Edit: Select next part", ARRANG_SHRT + PROLL_SHRT + DEDIT_SHRT, "sel_nxt_prt");
+ defShrt(SHRT_SEL_LEFT, Qt::Key_Left, "Edit: Select nearest part/event to the left", ARRANG_SHRT + PROLL_SHRT + DEDIT_SHRT, "sel_left");
+ defShrt(SHRT_SEL_LEFT_ADD, Qt::Key_Left + Qt::SHIFT, "Edit: Add nearest part/event to the left to selection", PROLL_SHRT + DEDIT_SHRT, "sel_left_add");
+ defShrt(SHRT_SEL_RIGHT, Qt::Key_Right, "Edit: Select nearest part/event to the left", ARRANG_SHRT + PROLL_SHRT + DEDIT_SHRT,"sel_right");
+ defShrt(SHRT_SEL_RIGHT_ADD, Qt::Key_Right + Qt::SHIFT, "Edit: Add nearest part/event to the right to selection", PROLL_SHRT + DEDIT_SHRT,"sel_right_add");
+ defShrt(SHRT_LOCATORS_TO_SELECTION, Qt::ALT + Qt::Key_P, "Edit: Set locators to selection", ARRANG_SHRT + PROLL_SHRT + DEDIT_SHRT, "loc_to_sel");
+ defShrt(SHRT_INC_PITCH, Qt::CTRL + Qt::Key_Up, "Edit: Increase pitch", PROLL_SHRT + DEDIT_SHRT, "sel_inc_pitch");
+ defShrt(SHRT_DEC_PITCH, Qt::CTRL + Qt::Key_Down, "Edit: Decrease pitch", PROLL_SHRT + DEDIT_SHRT, "sel_dec_pitch");
+ defShrt(SHRT_INC_POS, Qt::CTRL + Qt::Key_Right, "Edit: Increase event position", PROLL_SHRT + DEDIT_SHRT, "sel_inc_pos");
+ defShrt(SHRT_DEC_POS, Qt::CTRL + Qt::Key_Left, "Edit: Decrease event position", PROLL_SHRT + DEDIT_SHRT, "sel_dec_pos");
+ defShrt(SHRT_ZOOM_IN, Qt::CTRL + Qt::Key_PageUp, "View: Zoom in", PROLL_SHRT + DEDIT_SHRT, "zoom_in");
+ defShrt(SHRT_ZOOM_OUT, Qt::CTRL + Qt::Key_PageDown, "View: Zoom out", PROLL_SHRT + DEDIT_SHRT, "zoom_out");
+ defShrt(SHRT_GOTO_CPOS, Qt::Key_C, "View: Goto current position", PROLL_SHRT + DEDIT_SHRT, "goto_cpos");
+ defShrt(SHRT_SCROLL_LEFT, Qt::Key_H, "View: Scroll left", PROLL_SHRT + DEDIT_SHRT, "scroll_left");
+ defShrt(SHRT_SCROLL_RIGHT, Qt::Key_L, "View: Scroll left", PROLL_SHRT + DEDIT_SHRT, "scroll_right");
+
+ //-----------------------------------------------------------
+ //Drum:
+ //-----------------------------------------------------------
+
+ defShrt(SHRT_FIXED_LEN, Qt::ALT + Qt::Key_L, "Edit: Set fixed length on midi events", PROLL_SHRT + DEDIT_SHRT, "midi_fixed_len");
+
+ //-----------------------------------------------------------
+ //Pianoroll:
+ //-----------------------------------------------------------
+
+ defShrt(SHRT_OVER_QUANTIZE, 0, "Quantize: Over Quantize", PROLL_SHRT, "midi_over_quant");
+ defShrt(SHRT_ON_QUANTIZE, 0, "Quantize: Note On Quantize", PROLL_SHRT, "midi_quant_noteon");
+ defShrt(SHRT_ONOFF_QUANTIZE, 0, "Quantize: Note On/Off Quantize", PROLL_SHRT,"midi_quant_noteoff");
+ defShrt(SHRT_ITERATIVE_QUANTIZE,0,"Quantize: Iterative Quantize", PROLL_SHRT,"midi_quant_iterative");
+ defShrt(SHRT_CONFIG_QUANT, Qt::CTRL + Qt::ALT + Qt::Key_Q, "Quantize: Configure quant", PROLL_SHRT, "config_quant");
+ defShrt(SHRT_MODIFY_GATE_TIME, 0, "Quantize: Modify Gate Time", PROLL_SHRT, "midi_mod_gate_time");
+ defShrt(SHRT_MODIFY_VELOCITY, 0, "Quantize: Modify Velocity", PROLL_SHRT, "midi_mod_velo");
+ defShrt(SHRT_CRESCENDO, 0, "Edit: Crescendo", PROLL_SHRT, "midi_crescendo");
+ defShrt(SHRT_THIN_OUT, 0, "Edit: Thin Out", PROLL_SHRT, "midi_thin_out");
+ defShrt(SHRT_ERASE_EVENT, 0, "Edit: Erase Event", PROLL_SHRT, "midi_erase_event");
+ defShrt(SHRT_DELETE_OVERLAPS, 0, "Edit: Delete overlaps", PROLL_SHRT, "midi_delete_overlaps");
+ defShrt(SHRT_NOTE_SHIFT, 0, "Edit: Note Shift", PROLL_SHRT, "midi_note_shift");
+ defShrt(SHRT_MOVE_CLOCK, 0, "Edit: Move Clock", PROLL_SHRT, "midi_move_clock");
+ defShrt(SHRT_COPY_MEASURE, 0, "Edit: Copy Measure", PROLL_SHRT, "midi_copy_measure");
+ defShrt(SHRT_ERASE_MEASURE, 0, "Edit: Erase Measure", PROLL_SHRT,"midi_erase_measure");
+ defShrt(SHRT_DELETE_MEASURE, 0, "Edit: Delete Measure", PROLL_SHRT, "midi_delete_measure");
+ defShrt(SHRT_CREATE_MEASURE, 0, "Edit: Create Measure", PROLL_SHRT, "midi_create_measure");
+ defShrt(SHRT_EVENT_COLOR, Qt::Key_E, "Edit: Change event color", PROLL_SHRT, "change_event_color");
+
+
+ // Shortcuts for tools
+ // global
+ defShrt(SHRT_TOOL_POINTER, Qt::Key_A, "Tool: Pointer", ARRANG_SHRT + PROLL_SHRT + DEDIT_SHRT, "pointer_tool");
+ defShrt(SHRT_TOOL_PENCIL, Qt::Key_D, "Tool: Pencil", ARRANG_SHRT + PROLL_SHRT + DEDIT_SHRT, "pencil_tool");
+ defShrt(SHRT_TOOL_RUBBER, Qt::Key_R, "Tool: Eraser", ARRANG_SHRT + PROLL_SHRT + DEDIT_SHRT, "eraser_tool");
+ // piano roll & drum editor
+ defShrt(SHRT_TOOL_LINEDRAW, 0, "Tool: Line Draw", PROLL_SHRT + DEDIT_SHRT, "line_draw_tool");
+ // arranger
+ defShrt(SHRT_TOOL_SCISSORS, Qt::Key_S, "Tool: Scissor", ARRANG_SHRT, "scissor_tool");
+ defShrt(SHRT_TOOL_GLUE, Qt::Key_G, "Tool: Glue", ARRANG_SHRT, "glue_tool");
+ defShrt(SHRT_TOOL_MUTE, 0, "Tool: Mute", ARRANG_SHRT, "mute_tool");
+
+ //Increase/decrease current position, is going to be in arranger & drumeditor as well
+ defShrt(SHRT_POS_INC, Qt::Key_Plus, "Transport: Increase current position", GLOBAL_SHRT, "curpos_increase");
+ defShrt(SHRT_POS_DEC, Qt::Key_Minus, "Transport: Decrease current position", GLOBAL_SHRT, "curpos_decrease");
+ defShrt(SHRT_SET_QUANT_1, Qt::Key_1, "Quantize: Set quantize to 1/1 note", PROLL_SHRT, "midi_quant_1");
+ defShrt(SHRT_SET_QUANT_2, Qt::Key_2, "Quantize: Set quantize to 1/2 note", PROLL_SHRT, "midi_quant_2");
+ defShrt(SHRT_SET_QUANT_3, Qt::Key_3, "Quantize: Set quantize to 1/4 note", PROLL_SHRT, "midi_quant_3");
+ defShrt(SHRT_SET_QUANT_4, Qt::Key_4, "Quantize: Set quantize to 1/8 note", PROLL_SHRT, "midi_quant_4");
+ defShrt(SHRT_SET_QUANT_5, Qt::Key_5, "Quantize: Set quantize to 1/16 note", PROLL_SHRT, "midi_quant_5");
+ defShrt(SHRT_SET_QUANT_6, Qt::Key_6, "Quantize: Set quantize to 1/32 note", PROLL_SHRT, "midi_quant_6");
+ defShrt(SHRT_SET_QUANT_7, Qt::Key_7, "Quantize: Set quantize to 1/64 note", PROLL_SHRT, "midi_quant_7");
+
+ defShrt(SHRT_TOGGLE_TRIOL, Qt::Key_T, "Quantize: Toggle triol quantization", PROLL_SHRT, "midi_quant_triol");
+ defShrt(SHRT_TOGGLE_PUNCT, Qt::Key_Period, "Quantize: Toggle punctuation quantization", PROLL_SHRT, "midi_quant_punct");
+ defShrt(SHRT_TOGGLE_PUNCT2, Qt::Key_Comma, "Quantize: Toggle punctuation quantization (2)", PROLL_SHRT, "midi_quant_punct2");
+ defShrt(SHRT_INSERT_AT_LOCATION, Qt::SHIFT + Qt::Key_Right, "Edit: Insert at location", PROLL_SHRT, "midi_insert_at_loc");
+
+ defShrt(SHRT_INCREASE_LEN, Qt::CTRL + Qt::SHIFT + Qt::Key_Right, "Edit: Increase length", PROLL_SHRT, "increase_len");
+ defShrt(SHRT_DECREASE_LEN, Qt::CTRL + Qt::SHIFT + Qt::Key_Left, "Edit: Decrease length", PROLL_SHRT, "decrease_len");
+
+ //-----------------------------------------------------------
+ // List edit:
+ //-----------------------------------------------------------
+
+ defShrt(SHRT_LE_INS_NOTES, Qt::CTRL + Qt::Key_N, "Insert Note", LEDIT_SHRT, "le_ins_note");
+ defShrt(SHRT_LE_INS_SYSEX, Qt::CTRL + Qt::Key_S, "Insert SysEx", LEDIT_SHRT, "le_ins_sysex");
+ defShrt(SHRT_LE_INS_CTRL, Qt::CTRL + Qt::Key_T, "Insert Ctrl", LEDIT_SHRT, "le_ins_ctrl");
+ defShrt(SHRT_LE_INS_META, 0, "Insert Meta", LEDIT_SHRT, "le_ins_meta");
+ defShrt(SHRT_LE_INS_CHAN_AFTERTOUCH, Qt::CTRL + Qt::Key_A, "Insert Channel Aftertouch", LEDIT_SHRT, "le_ins_afttouch");
+ defShrt(SHRT_LE_INS_POLY_AFTERTOUCH, Qt::CTRL + Qt::Key_P, "Insert Key Aftertouch", LEDIT_SHRT, "le_ins_poly");
+
+ //-----------------------------------------------------------
+ // List masteredit:
+ //-----------------------------------------------------------
+ defShrt(SHRT_LM_INS_TEMPO, Qt::CTRL + Qt::Key_T, "Insert Tempo", LMEDIT_SHRT, "lm_ins_tempo");
+ defShrt(SHRT_LM_INS_SIG , Qt::CTRL + Qt::Key_R, "Insert Signature", LMEDIT_SHRT, "lm_ins_sig");
+ defShrt(SHRT_LM_EDIT_BEAT, Qt::CTRL + Qt::SHIFT+ Qt::Key_E, "Change Event Position", LMEDIT_SHRT, "lm_edit_beat");
+ defShrt(SHRT_LM_EDIT_VALUE, Qt::CTRL + Qt::Key_E, "Edit Event Value", LMEDIT_SHRT, "lm_edit_val");
+
+ defShrt(SHRT_NEXT_MARKER, Qt::Key_F6, "Goto Next Marker", ARRANG_SHRT, "me_sel_next");
+ defShrt(SHRT_PREV_MARKER, Qt::Key_F5, "Goto Prev Marker", ARRANG_SHRT, "me_sel_prev");
+
+ }
+
+ const shortcut_cg shortcut_category[SHRT_NUM_OF_CATEGORIES] = {
+ { GLOBAL_SHRT, "Global" },
+ { ARRANG_SHRT, "Arranger" },
+ { PROLL_SHRT, "Pianoroll" },
+ { DEDIT_SHRT, "Drumeditor" },
+ { LEDIT_SHRT, "List editor" },
+ { LMEDIT_SHRT, "List Mastertrack" },
+// { SCORE_SHRT, "Score editor" },
+// { WAVE_SHRT, "Wave editor" },
+ { ALL_SHRT , "All categories" }
+ };
+
+int getShrtByTag(const char* xml)
+ {
+ for (int i=0; i<SHRT_NUM_OF_ELEMENTS; i++) {
+ if (shortcuts[i].xml) {
+ if (strcmp(shortcuts[i].xml, xml) == 0)
+ return i;
+ }
+ }
+ return -1;
+ }
+
+void writeShortCuts(int level, Xml& xml)
+ {
+ xml.tag(level++, "shortcuts");
+ for (int i=0; i < SHRT_NUM_OF_ELEMENTS; i++) {
+ if (shortcuts[i].xml != NULL && shortcuts[i].type != INVIS_SHRT) //Avoid nullptr & hardcoded shortcuts
+ xml.intTag(level, shortcuts[i].xml, shortcuts[i].key);
+ }
+ xml.etag(level, "shortcuts");
+ }
+
+void readShortCuts(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::TagStart: {
+ if (tag.length()) {
+ int index = getShrtByTag(tag);
+ if (index == -1) //No such tag found
+ printf("Config file might be corrupted. Unknown shortcut: %s\n",tag.latin1());
+ else {
+ //printf("Index: %d\n",index);
+ shortcuts[index].key = xml.parseInt();
+ //printf("shortcuts[%d].key = %d, %s\n",index, shortcuts[index].key, shortcuts[index].descr);
+ }
+ }
+ }
+ case Xml::TagEnd:
+ if (tag == "shortcuts")
+ return;
+ default:
+ break;
+ }
+ }
+ }
diff --git a/muse2/muse/shortcuts.h b/muse2/muse/shortcuts.h
new file mode 100644
index 00000000..0e2121f9
--- /dev/null
+++ b/muse2/muse/shortcuts.h
@@ -0,0 +1,285 @@
+//
+// C++ Interface: shortcuts
+//
+// Description:
+// Datastructures and declaration of shortcuts used in the application
+//
+// Author: Mathias Lundgren <lunar_shuttle@users.sourceforge.net>, (C) 2003
+//
+// Copyright: Mathias Lundgren (lunar_shuttle@users.sourceforge.net) (C) 2003
+//
+//
+#ifndef __SHORTCUTS_H__
+#define __SHORTCUTS_H__
+
+#include <list>
+#include "xml.h"
+
+//
+// Shortcut categories
+//
+#define PROLL_SHRT 1 // Pianoroll shortcut
+#define DEDIT_SHRT 2 // Drumedit shortcut
+#define LEDIT_SHRT 4 // Listedit shortcut
+#define SCORE_SHRT 8 // Score shortcut
+#define ARRANG_SHRT 16 // Arrenger shortcut
+#define TRANSP_SHRT 32 // Transport shortcut
+#define WAVE_SHRT 64 // Waveedit shortcut
+#define GLOBAL_SHRT 128 // Global shortcuts
+#define LMEDIT_SHRT 256 // List masteredit
+#define MEDIT_SHRT 512 // Master editor
+#define ALL_SHRT 1023 // All shortcuts
+#define INVIS_SHRT 1024 // Shortcuts not shown in the config-dialog. Hard-coded. To avoid conflicts
+
+#define SHRT_NUM_OF_CATEGORIES 7 //Number of shortcut categories
+
+struct shortcut
+ {
+ int key;
+ const char* descr;
+ const char* xml; //xml-tag for config-file
+ int type;
+ };
+
+struct shortcut_cg
+ {
+ int id_flag;
+ const char* name;
+ };
+
+typedef struct shortcut ShortCut ;
+
+enum {
+ //Transport/Positioning
+ SHRT_PLAY_SONG, //Enter
+ SHRT_PLAY_TOGGLE, //Space
+ SHRT_STOP, //Insert
+ SHRT_GOTO_START, // W
+ SHRT_GOTO_LEFT, //End-keypad
+ SHRT_GOTO_RIGHT, //Cursordown-keypad
+ SHRT_POS_INC, // Plus
+ SHRT_POS_DEC, // Minus
+ SHRT_TOGGLE_LOOP, // Slash
+ SHRT_TOGGLE_METRO, // C
+ SHRT_START_REC, // *(keypad)
+ SHRT_REC_CLEAR, // *(keypad)
+
+ //Main + Drumeditor
+ SHRT_NEW, //Ctrl+N
+ SHRT_OPEN, //Ctrl+O
+ SHRT_SAVE, //Ctrl+S
+
+ //Used throughout the app:
+ SHRT_UNDO, //Ctrl+Z
+ SHRT_REDO, //Ctrl+Y
+ SHRT_COPY, //Ctrl+C
+ SHRT_CUT, //Ctrl+X
+ SHRT_PASTE, //Ctrl+V
+ SHRT_DELETE,//Delete
+
+
+ //Main:
+ SHRT_SAVE_AS, //Default: undefined
+ SHRT_OPEN_RECENT, //Ctrl+1
+ SHRT_LOAD_TEMPLATE, //Default: undefined
+ SHRT_CONFIG_PRINTER, //Ctrl+P
+ SHRT_IMPORT_MIDI, //Default: undefined
+ SHRT_EXPORT_MIDI, //Default: undefined
+ SHRT_IMPORT_PART, //!< Import midi part to current track & location, Default: undefined
+ SHRT_IMPORT_AUDIO, //Default: undefined
+ SHRT_QUIT, //Default: Ctrl+Q
+
+ SHRT_DESEL_PARTS, //Ctrl+B
+ SHRT_SELECT_PRTSTRACK, //Default: undefined
+ SHRT_OPEN_PIANO, //Ctrl+E
+ SHRT_OPEN_SCORE, //Ctrl+R
+ SHRT_OPEN_DRUMS, //Ctrl+D
+ SHRT_OPEN_LIST, //Ctrl+L
+ SHRT_OPEN_WAVE, //Ctrl+W
+ SHRT_OPEN_GRAPHIC_MASTER, //Ctrl+M
+ SHRT_OPEN_LIST_MASTER, //Ctrl+Shift+M
+ SHRT_OPEN_MIDI_TRANSFORM, //Ctrl+T
+
+ SHRT_GLOBAL_CUT, //Default: undefined
+ SHRT_GLOBAL_INSERT, //Default: undefined
+ SHRT_GLOBAL_SPLIT, //Default: undefined
+ SHRT_COPY_RANGE, //Default: undefined
+ SHRT_CUT_EVENTS, //Default: undefined
+
+ SHRT_OPEN_TRANSPORT, //F11
+ SHRT_OPEN_BIGTIME, //F12
+ SHRT_OPEN_MIXER, //Ctrl+*
+ SHRT_OPEN_MIXER2, //Ctrl+*
+ SHRT_OPEN_MARKER, // F9
+ SHRT_OPEN_CLIPS, //Default: undefined
+
+ SHRT_FOLLOW_JUMP, //Default: undefined
+ SHRT_FOLLOW_NO, //Default: undefined
+ SHRT_FOLLOW_CONTINUOUS, //Default: undefined
+
+ SHRT_GLOBAL_CONFIG, //Default: undefined
+ SHRT_CONFIG_SHORTCUTS, //Default: undefined
+ SHRT_CONFIG_METRONOME, //Default: undefined
+ SHRT_CONFIG_MIDISYNC, //Default: undefined
+ SHRT_MIDI_FILE_CONFIG, //Default: undefined
+ SHRT_APPEARANCE_SETTINGS, //Default: undefined
+ SHRT_CONFIG_MIDI_PORTS, //Default: undefined
+ SHRT_CONFIG_AUDIO_PORTS, //Default: undefined
+ //SHRT_SAVE_GLOBAL_CONFIG, //Default: undefined
+
+ SHRT_MIDI_EDIT_INSTRUMENTS, //Default: undefined
+ SHRT_MIDI_INPUT_TRANSFORM, //Default: undefined
+ SHRT_MIDI_INPUT_FILTER, //Default: undefined
+ SHRT_MIDI_INPUT_TRANSPOSE, //Default: undefined
+ SHRT_MIDI_REMOTE_CONTROL, //Default: undefined
+ SHRT_RANDOM_RHYTHM_GENERATOR, //Default: undefined
+ SHRT_MIDI_RESET, //Default: undefined
+ SHRT_MIDI_INIT, //Default: undefined
+ SHRT_MIDI_LOCAL_OFF, //Default: undefined
+
+ SHRT_AUDIO_BOUNCE_TO_TRACK, //Default: undefined
+ SHRT_AUDIO_BOUNCE_TO_FILE, //Default: undefined
+ SHRT_AUDIO_RESTART, //Default: undefined
+
+ SHRT_MIXER_AUTOMATION, //Default: undefined
+ SHRT_MIXER_SNAPSHOT, //Default: undefined
+ SHRT_MIXER_AUTOMATION_CLEAR, //Default: undefined
+
+ SHRT_ADD_MIDI_TRACK, //Default: Ctrl+J
+ SHRT_ADD_DRUM_TRACK, //Default: undefined
+ SHRT_ADD_WAVE_TRACK, //Default: undefined
+ SHRT_ADD_AUDIO_OUTPUT, //Default: undefined
+ SHRT_ADD_AUDIO_GROUP, //Default: undefined
+ SHRT_ADD_AUDIO_INPUT, //Default: undefined
+ SHRT_ADD_AUDIO_AUX, //Default: undefined
+ SHRT_RESET_MIDI, //Ctrl+Alt+Z
+
+ SHRT_OPEN_HELP, //F1
+ SHRT_START_WHATSTHIS, //Shift-F1
+
+ //Arranger, parts:
+ SHRT_EDIT_PART, //Enter
+ SHRT_SEL_ABOVE, //Up
+ SHRT_SEL_ABOVE_ADD, //move up and add to selection
+ SHRT_SEL_BELOW, //Down
+ SHRT_SEL_BELOW_ADD, //move down and add to selection
+
+ /*
+ SHRT_INSERT, //Ctrl+Shift+I - insert parts instead of pasting
+ SHRT_INSERTMEAS, //Ctrl+Shift+M - insert measures
+ */
+ //Arranger tracks
+ SHRT_SEL_TRACK_BELOW,
+ SHRT_SEL_TRACK_ABOVE,
+
+ //To be in arranger, pianoroll & drumeditor
+ SHRT_SELECT_ALL, //Ctrl+A
+ SHRT_SELECT_NONE, //Ctrl+Shift+A
+ SHRT_SELECT_INVERT, //Ctrl+I
+ SHRT_SELECT_ILOOP, //Default: Undefined
+ SHRT_SELECT_OLOOP, //Default: Undefined
+ SHRT_SELECT_PREV_PART, // Ctrl+-
+ SHRT_SELECT_NEXT_PART, // Ctrl++
+ SHRT_SEL_LEFT, //left
+ SHRT_SEL_LEFT_ADD, //move left and add to selection
+ SHRT_SEL_RIGHT, //Right
+ SHRT_SEL_RIGHT_ADD, //move right and add to selection
+ SHRT_INC_PITCH,
+ SHRT_DEC_PITCH,
+ SHRT_INC_POS,
+ SHRT_DEC_POS,
+ SHRT_LOCATORS_TO_SELECTION, //Alt+P, currently in arranger & pianoroll
+ SHRT_INSERT_AT_LOCATION, //Shift+CrsrRight
+ SHRT_INCREASE_LEN,
+ SHRT_DECREASE_LEN,
+
+ SHRT_TOOL_1,//Shift+1 Pointer
+ SHRT_TOOL_2,//Shift+2 Pen
+ SHRT_TOOL_3,//Shift+3 Rubber
+ SHRT_TOOL_4,//Shift+4
+ SHRT_TOOL_5,//Shift+5
+ SHRT_TOOL_6,//Shift+6
+ SHRT_TRANSPOSE, //Default: undefined
+
+ //Shortcuts to be in pianoroll & drumeditor
+ SHRT_ZOOM_IN, // PgUp
+ SHRT_ZOOM_OUT, // PgDown
+ SHRT_GOTO_CPOS, // c
+ SHRT_SCROLL_LEFT, // h
+ SHRT_SCROLL_RIGHT, // l
+ SHRT_FIXED_LEN, //Alt+L, currently only drumeditor
+ SHRT_QUANTIZE, //q
+ SHRT_OVER_QUANTIZE, //Default: undefined
+ SHRT_ON_QUANTIZE, //Default: undefined
+ SHRT_ONOFF_QUANTIZE, //Default: undefined
+ SHRT_ITERATIVE_QUANTIZE, //Default: undefined
+ SHRT_CONFIG_QUANT, //Default: Ctrl+Alt+Q
+ SHRT_MODIFY_GATE_TIME, //Default: undefined
+ SHRT_MODIFY_VELOCITY,
+ SHRT_CRESCENDO,
+ SHRT_DELETE_OVERLAPS,
+
+ SHRT_THIN_OUT,
+ SHRT_ERASE_EVENT,
+ SHRT_NOTE_SHIFT,
+ SHRT_MOVE_CLOCK,
+ SHRT_COPY_MEASURE,
+ SHRT_ERASE_MEASURE,
+ SHRT_DELETE_MEASURE,
+ SHRT_CREATE_MEASURE,
+ SHRT_SET_QUANT_1, //1 - pianoroll
+ SHRT_SET_QUANT_2, //2 - pianoroll
+ SHRT_SET_QUANT_3, //3 - pianoroll
+ SHRT_SET_QUANT_4, //4 - pianoroll
+ SHRT_SET_QUANT_5, //5 - pianoroll
+ SHRT_SET_QUANT_6, //6 - pianoroll
+ SHRT_SET_QUANT_7, //7 - pianoroll
+ SHRT_TOGGLE_TRIOL, //t
+ SHRT_TOGGLE_PUNCT, //.-keypad
+ SHRT_TOGGLE_PUNCT2, // ,
+
+ SHRT_EVENT_COLOR, //e
+
+ // Shortcuts for tools
+ // global
+ SHRT_TOOL_POINTER, //
+ SHRT_TOOL_PENCIL,
+ SHRT_TOOL_RUBBER,
+
+ // pianoroll and drum editor
+ SHRT_TOOL_LINEDRAW,
+
+ // arranger
+ SHRT_TOOL_SCISSORS,
+ SHRT_TOOL_GLUE,
+ SHRT_TOOL_MUTE,
+
+
+ //Listeditor:
+ SHRT_LE_INS_NOTES, //Ctrl+N
+ SHRT_LE_INS_SYSEX, //Ctrl+S
+ SHRT_LE_INS_CTRL, //Ctrl+T
+ SHRT_LE_INS_META, //Default: undefined
+ SHRT_LE_INS_CHAN_AFTERTOUCH,//Ctrl+A
+ SHRT_LE_INS_POLY_AFTERTOUCH,//Ctrl+P
+
+ //List master editor:
+ SHRT_LM_INS_TEMPO, // Ctrl+T
+ SHRT_LM_INS_SIG, // Ctrl+R
+ SHRT_LM_EDIT_BEAT, // Ctrl+Shift+E
+ SHRT_LM_EDIT_VALUE,// Ctrl+E
+
+ // Marker view
+ SHRT_NEXT_MARKER,
+ SHRT_PREV_MARKER,
+
+ //Last item:
+ SHRT_NUM_OF_ELEMENTS // must be last
+ };
+
+extern ShortCut shortcuts[SHRT_NUM_OF_ELEMENTS]; //size of last entry
+extern void initShortCuts();
+extern void writeShortCuts(int level, Xml& xml);
+extern void readShortCuts (Xml& xml);
+extern const shortcut_cg shortcut_category[SHRT_NUM_OF_CATEGORIES];
+#endif
diff --git a/muse2/muse/sig.cpp b/muse2/muse/sig.cpp
new file mode 100644
index 00000000..8bbebfae
--- /dev/null
+++ b/muse2/muse/sig.cpp
@@ -0,0 +1,439 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: sig.cpp,v 1.5.2.2 2009/03/09 02:05:17 terminator356 Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <assert.h>
+#include "sig.h"
+#include "gconfig.h"
+#include "xml.h"
+
+SigList sigmap;
+
+//---------------------------------------------------------
+// SigList
+//---------------------------------------------------------
+
+SigList::SigList()
+ {
+ insert(std::pair<const unsigned, SigEvent*> (MAX_TICK, new SigEvent(4, 4, 0)));
+ }
+
+//---------------------------------------------------------
+// add
+// signatures are only allowed at the beginning of
+// a bar
+//---------------------------------------------------------
+
+void SigList::add(unsigned tick, int z, int n)
+ {
+ if (z == 0 || n == 0) {
+ printf("SigList::add illegal signature %d/%d\n", z, n);
+
+ // Added p3.3.43
+ return;
+ }
+ tick = raster1(tick, 0);
+ iSigEvent e = upper_bound(tick);
+ assert(e != end());
+
+ if (tick == e->second->tick) {
+ e->second->z = z;
+ e->second->n = n;
+ }
+ else {
+ SigEvent* ne = e->second;
+ SigEvent* ev = new SigEvent(ne->z, ne->n, ne->tick);
+ ne->z = z;
+ ne->n = n;
+ ne->tick = tick;
+ insert(std::pair<const unsigned, SigEvent*> (tick, ev));
+ }
+ normalize();
+ }
+
+//---------------------------------------------------------
+// del
+//---------------------------------------------------------
+
+void SigList::del(unsigned tick)
+ {
+// printf("SigList::del(%d)\n", tick);
+ iSigEvent e = find(tick);
+ if (e == end()) {
+ printf("SigList::del(%d): not found\n", tick);
+ return;
+ }
+ iSigEvent ne = e;
+ ++ne;
+ if (ne == end()) {
+ printf("SigList::del() HALLO\n");
+ return;
+ }
+ ne->second->z = e->second->z;
+ ne->second->n = e->second->n;
+ ne->second->tick = e->second->tick;
+ erase(e);
+ normalize();
+ }
+
+//---------------------------------------------------------
+// SigList::normalize
+//---------------------------------------------------------
+
+void SigList::normalize()
+ {
+ int z = 0;
+ int n = 0;
+ unsigned tick = 0;
+ iSigEvent ee;
+
+ for (iSigEvent e = begin(); e != end();) {
+ if (z == e->second->z && n == e->second->n) {
+ e->second->tick = tick;
+ erase(ee);
+ }
+ z = e->second->z;
+ n = e->second->n;
+ ee = e;
+ tick = e->second->tick;
+ ++e;
+ }
+
+ int bar = 0;
+ for (iSigEvent e = begin(); e != end();) {
+ e->second->bar = bar;
+ int delta = e->first - e->second->tick;
+ int ticksB = ticks_beat(e->second->n);
+ int ticksM = ticksB * e->second->z;
+ bar += delta / ticksM;
+ if (delta % ticksM) // Teil eines Taktes
+ ++bar;
+ ++e;
+ }
+ }
+
+//---------------------------------------------------------
+// SigList::dump
+//---------------------------------------------------------
+
+void SigList::dump() const
+ {
+ printf("\nSigList:\n");
+ for (ciSigEvent i = begin(); i != end(); ++i) {
+ printf("%6d %06d Bar %3d %02d/%d\n",
+ i->first, i->second->tick,
+ i->second->bar, i->second->z, i->second->n);
+ }
+ }
+
+void SigList::clear()
+ {
+ for (iSigEvent i = begin(); i != end(); ++i)
+ delete i->second;
+ SIGLIST::clear();
+ insert(std::pair<const unsigned, SigEvent*> (MAX_TICK, new SigEvent(4, 4, 0)));
+ }
+
+//---------------------------------------------------------
+// ticksMeasure
+//---------------------------------------------------------
+
+int SigList::ticksMeasure(int Z, int N) const
+ {
+ return ticks_beat(N) * Z;
+ }
+
+int SigList::ticksMeasure(unsigned tick) const
+ {
+ ciSigEvent i = upper_bound(tick);
+ if (i == end()) {
+ printf("ticksMeasure: not found %d\n", tick);
+ // abort();
+ return 0;
+ }
+ return ticksMeasure(i->second->z, i->second->n);
+ }
+
+//---------------------------------------------------------
+// ticksBeat
+//---------------------------------------------------------
+
+int SigList::ticksBeat(unsigned tick) const
+ {
+ ciSigEvent i = upper_bound(tick);
+ assert(i != end());
+ return ticks_beat(i->second->n);
+ }
+
+int SigList::ticks_beat(int n) const
+ {
+ int m = config.division;
+ switch (n) {
+ case 1: m <<= 2; break; // 1536
+ case 2: m <<= 1; break; // 768
+ case 3: m += m >> 1; break; // 384+192
+ case 4: break; // 384
+ case 8: m >>= 1; break; // 192
+ case 16: m >>= 2; break; // 96
+ case 32: m >>= 3; break; // 48
+ case 64: m >>= 4; break; // 24
+ case 128: m >>= 5; break; // 12
+ default: assert(false); break;
+ }
+ return m;
+ }
+
+//---------------------------------------------------------
+// timesig
+//---------------------------------------------------------
+
+void SigList::timesig(unsigned tick, int& z, int& n) const
+ {
+ ciSigEvent i = upper_bound(tick);
+ if (i == end()) {
+ printf("timesig(%d): not found\n", tick);
+ // abort();
+ z = 4;
+ n = 4;
+ }
+ else {
+ z = i->second->z;
+ n = i->second->n;
+ }
+ }
+
+//---------------------------------------------------------
+// tickValues
+//---------------------------------------------------------
+
+void SigList::tickValues(unsigned t, int* bar, int* beat, unsigned* tick) const
+ {
+ ciSigEvent e = upper_bound(t);
+ if (e == end()) {
+ fprintf(stderr, "tickValues(0x%x) not found(%zd)\n", t, size());
+ // abort();
+ *bar = 0;
+ *beat = 0;
+ *tick = 0;
+ return;
+ }
+
+ int delta = t - e->second->tick;
+ int ticksB = ticks_beat(e->second->n);
+ int ticksM = ticksB * e->second->z;
+ *bar = e->second->bar + delta / ticksM;
+ int rest = delta % ticksM;
+ *beat = rest / ticksB;
+ *tick = rest % ticksB;
+ }
+
+//---------------------------------------------------------
+// bar2tick
+//---------------------------------------------------------
+
+unsigned SigList::bar2tick(int bar, int beat, unsigned tick) const
+ {
+ ciSigEvent e;
+
+ if (bar < 0)
+ bar = 0;
+ for (e = begin(); e != end();) {
+ ciSigEvent ee = e;
+ ++ee;
+ if (ee == end())
+ break;
+ if (bar < ee->second->bar)
+ break;
+ e = ee;
+ }
+ int ticksB = ticks_beat(e->second->n);
+ int ticksM = ticksB * e->second->z;
+ return e->second->tick + (bar-e->second->bar)*ticksM + ticksB*beat + tick;
+ }
+
+//---------------------------------------------------------
+// raster
+//---------------------------------------------------------
+
+unsigned SigList::raster(unsigned t, int raster) const
+ {
+ if (raster == 1)
+ return t;
+ ciSigEvent e = upper_bound(t);
+ if (e == end()) {
+ printf("SigList::raster(%x,)\n", t);
+ // abort();
+ return t;
+ }
+ int delta = t - e->second->tick;
+ int ticksM = ticks_beat(e->second->n) * e->second->z;
+ if (raster == 0)
+ raster = ticksM;
+ int rest = delta % ticksM;
+ int bb = (delta/ticksM)*ticksM;
+ return e->second->tick + bb + ((rest + raster/2)/raster)*raster;
+ }
+
+//---------------------------------------------------------
+// raster1
+// round down
+//---------------------------------------------------------
+
+unsigned SigList::raster1(unsigned t, int raster) const
+ {
+ if (raster == 1)
+ return t;
+ ciSigEvent e = upper_bound(t);
+ assert(e != end());
+
+ int delta = t - e->second->tick;
+ int ticksM = ticks_beat(e->second->n) * e->second->z;
+ if (raster == 0)
+ raster = ticksM;
+ int rest = delta % ticksM;
+ int bb = (delta/ticksM)*ticksM;
+ return e->second->tick + bb + (rest/raster)*raster;
+ }
+
+//---------------------------------------------------------
+// raster2
+// round up
+//---------------------------------------------------------
+
+unsigned SigList::raster2(unsigned t, int raster) const
+ {
+ if (raster == 1)
+ return t;
+ ciSigEvent e = upper_bound(t);
+ assert(e != end());
+
+ int delta = t - e->second->tick;
+ int ticksM = ticks_beat(e->second->n) * e->second->z;
+ if (raster == 0)
+ raster = ticksM;
+ int rest = delta % ticksM;
+ int bb = (delta/ticksM)*ticksM;
+ return e->second->tick + bb + ((rest+raster-1)/raster)*raster;
+ }
+
+//---------------------------------------------------------
+// rasterStep
+//---------------------------------------------------------
+
+int SigList::rasterStep(unsigned t, int raster) const
+ {
+ if (raster == 0) {
+ ciSigEvent e = upper_bound(t);
+ assert(e != end());
+ return ticks_beat(e->second->n) * e->second->z;
+ }
+ return raster;
+ }
+
+//---------------------------------------------------------
+// SigList::write
+//---------------------------------------------------------
+
+void SigList::write(int level, Xml& xml) const
+ {
+ xml.tag(level++, "siglist");
+ for (ciSigEvent i = begin(); i != end(); ++i)
+ i->second->write(level, xml, i->first);
+ xml.tag(level, "/siglist");
+ }
+
+//---------------------------------------------------------
+// SigList::read
+//---------------------------------------------------------
+
+void SigList::read(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "sig") {
+ SigEvent* t = new SigEvent();
+ unsigned tick = t->read(xml);
+ iSigEvent pos = find(tick);
+ if (pos != end())
+ erase(pos);
+ insert(std::pair<const unsigned, SigEvent*> (tick, t));
+ }
+ else
+ xml.unknown("SigList");
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if (tag == "siglist") {
+ normalize();
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// SigEvent::write
+//---------------------------------------------------------
+
+void SigEvent::write(int level, Xml& xml, int at) const
+ {
+ xml.tag(level++, "sig at=\"%d\"", at);
+ xml.intTag(level, "tick", tick);
+ xml.intTag(level, "nom", z);
+ xml.intTag(level, "denom", n);
+ xml.tag(level, "/sig");
+ }
+
+//---------------------------------------------------------
+// SigEvent::read
+//---------------------------------------------------------
+
+int SigEvent::read(Xml& xml)
+ {
+ int at = 0;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return 0;
+ case Xml::TagStart:
+ if (tag == "tick")
+ tick = xml.parseInt();
+ else if (tag == "nom")
+ z = xml.parseInt();
+ else if (tag == "denom")
+ n = xml.parseInt();
+ else
+ xml.unknown("SigEvent");
+ break;
+ case Xml::Attribut:
+ if (tag == "at")
+ at = xml.s2().toInt();
+ break;
+ case Xml::TagEnd:
+ if (tag == "sig")
+ return at;
+ default:
+ break;
+ }
+ }
+ return 0;
+ }
+
+
diff --git a/muse2/muse/sig.h b/muse2/muse/sig.h
new file mode 100644
index 00000000..6a561d6e
--- /dev/null
+++ b/muse2/muse/sig.h
@@ -0,0 +1,79 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: sig.h,v 1.2 2004/01/11 18:55:34 wschweer Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SIG_H__
+#define __SIG_H__
+
+#include <map>
+
+#ifndef MAX_TICK
+#define MAX_TICK (0x7fffffff/100)
+#endif
+
+class Xml;
+
+//---------------------------------------------------------
+// Signature Event
+//---------------------------------------------------------
+
+struct SigEvent {
+ int z, n; // takt signatur
+ unsigned tick; // ab dieser Position gilt signatur
+ int bar; // precomputed
+
+ int read(Xml&);
+ void write(int, Xml&, int) const;
+
+ SigEvent() { }
+ SigEvent(int Z, int N, unsigned tk) {
+ z = Z;
+ n = N;
+ tick = tk;
+ bar = 0;
+ }
+ };
+
+//---------------------------------------------------------
+// SigList
+//---------------------------------------------------------
+
+typedef std::map<unsigned, SigEvent*, std::less<unsigned> > SIGLIST;
+typedef SIGLIST::iterator iSigEvent;
+typedef SIGLIST::const_iterator ciSigEvent;
+typedef SIGLIST::reverse_iterator riSigEvent;
+typedef SIGLIST::const_reverse_iterator criSigEvent;
+
+class SigList : public SIGLIST {
+ int ticks_beat(int N) const;
+ void normalize();
+ int ticksMeasure(int z, int n) const;
+
+ public:
+ SigList();
+ void clear();
+ void add(unsigned tick, int z, int n);
+ void del(unsigned tick);
+
+ void read(Xml&);
+ void write(int, Xml&) const;
+ void dump() const;
+
+ void timesig(unsigned tick, int& z, int& n) const;
+ void tickValues(unsigned t, int* bar, int* beat, unsigned* tick) const;
+ unsigned bar2tick(int bar, int beat, unsigned tick) const;
+
+ int ticksMeasure(unsigned tick) const;
+ int ticksBeat(unsigned tick) const;
+ unsigned raster(unsigned tick, int raster) const;
+ unsigned raster1(unsigned tick, int raster) const;
+ unsigned raster2(unsigned tick, int raster) const;
+ int rasterStep(unsigned tick, int raster) const;
+ };
+
+extern SigList sigmap;
+#endif
diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp
new file mode 100644
index 00000000..8c682e39
--- /dev/null
+++ b/muse2/muse/song.cpp
@@ -0,0 +1,3681 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: song.cpp,v 1.59.2.52 2009/12/15 03:39:58 terminator356 Exp $
+//
+// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <qapplication.h>
+#include <qmessagebox.h>
+#include <q3popupmenu.h>
+#include <qdir.h>
+#include <qaction.h>
+#include <qcursor.h>
+#include <qpoint.h>
+//#include <qbutton.h>
+//Added by qt3to4:
+#include <Q3TextStream>
+
+#include "app.h"
+#include "driver/jackmidi.h"
+#include "driver/alsamidi.h"
+#include "song.h"
+#include "track.h"
+#include "undo.h"
+#include "key.h"
+#include "globals.h"
+#include "event.h"
+#include "drummap.h"
+#include "marker/marker.h"
+#include "synth.h"
+#include "audio.h"
+#include "mididev.h"
+#include "amixer.h"
+#include "midiseq.h"
+#include "audiodev.h"
+#include "gconfig.h"
+#include "sync.h"
+#include "midictrl.h"
+#include "menutitleitem.h"
+#include "midi.h"
+#include "sig.h"
+#include <sys/wait.h>
+
+extern void clearMidiTransforms();
+extern void clearMidiInputTransforms();
+Song* song;
+
+/*
+//---------------------------------------------------------
+// RoutingMenuItem
+//---------------------------------------------------------
+
+class RoutingMenuItem : public QCustomMenuItem
+{
+ Route route;
+ //virtual QSize sizeHint() { return QSize(80, h); }
+ virtual void paint(QPainter* p, const QColorGroup&, bool, bool, int x, int y, int w, int h)
+ {
+ p->fillRect(x, y, w, h, QBrush(lightGray));
+ p->drawText(x, y, w, h, AlignCenter, route.name());
+ }
+
+ public:
+ RoutingMenuItem(const Route& r) : route(r) { }
+};
+*/
+
+//---------------------------------------------------------
+// Song
+//---------------------------------------------------------
+
+Song::Song(const char* name)
+ :QObject(0, name)
+ {
+ _recRaster = 0; // Set to measure, the same as Arranger intial value. Arranger snap combo will set this.
+ noteFifoSize = 0;
+ noteFifoWindex = 0;
+ noteFifoRindex = 0;
+ undoList = new UndoList;
+ redoList = new UndoList;
+ _markerList = new MarkerList;
+ _globalPitchShift = 0;
+ clear(false);
+ }
+
+//---------------------------------------------------------
+// Song
+//---------------------------------------------------------
+
+Song::~Song()
+ {
+ delete undoList;
+ delete redoList;
+ delete _markerList;
+ }
+
+//---------------------------------------------------------
+// putEvent
+//---------------------------------------------------------
+
+void Song::putEvent(int pv)
+ {
+ if (noteFifoSize < REC_NOTE_FIFO_SIZE) {
+ recNoteFifo[noteFifoWindex] = pv;
+ noteFifoWindex = (noteFifoWindex + 1) % REC_NOTE_FIFO_SIZE;
+ ++noteFifoSize;
+ }
+ }
+
+//---------------------------------------------------------
+// setTempo
+// public slot
+//---------------------------------------------------------
+
+void Song::setTempo(int newTempo)
+ {
+ audio->msgSetTempo(pos[0].tick(), newTempo, true);
+ }
+
+//---------------------------------------------------------
+// setSig
+// called from transport window
+//---------------------------------------------------------
+
+void Song::setSig(int z, int n)
+ {
+ if (_masterFlag) {
+ audio->msgAddSig(pos[0].tick(), z, n);
+ }
+ }
+
+//---------------------------------------------------------
+// addNewTrack
+// Called from GUI context
+// Besides normal track types, n includes synth menu ids from populateAddTrack()
+//---------------------------------------------------------
+
+Track* Song::addNewTrack(int n)
+{
+ // Ignore negative numbers since this slot could be called by a menu or list etc. passing -1.
+ if(n < 0)
+ return 0;
+
+ // Synth sub-menu id?
+ if(n >= MENU_ADD_SYNTH_ID_BASE)
+ {
+ n -= MENU_ADD_SYNTH_ID_BASE;
+ if(n < (int)synthis.size())
+ {
+ //SynthI* si = createSynthI(synthis[n]->baseName());
+ //SynthI* si = createSynthI(synthis[n]->name());
+ SynthI* si = createSynthI(synthis[n]->baseName(), synthis[n]->name());
+ if(!si)
+ return 0;
+
+ // Add instance last in midi device list.
+ for (int i = 0; i < MIDI_PORTS; ++i)
+ {
+ MidiPort* port = &midiPorts[i];
+ MidiDevice* dev = port->device();
+ if (dev==0)
+ {
+ midiSeq->msgSetMidiDevice(port, si);
+ muse->changeConfig(true); // save configuration file
+ deselectTracks();
+ si->setSelected(true);
+ update();
+ return si;
+ }
+ }
+ deselectTracks();
+ si->setSelected(true);
+ update(SC_SELECTION);
+ return si;
+ }
+ else
+ return 0;
+ }
+ // Normal track.
+ else
+ {
+ // Ignore AUDIO_SOFTSYNTH, now that we have it as the synth menu id, since addTrack doesn't like it.
+ if((Track::TrackType)n == Track::AUDIO_SOFTSYNTH)
+ return 0;
+
+ Track* t = addTrack((Track::TrackType)n);
+ deselectTracks();
+ t->setSelected(true);
+ update(SC_SELECTION);
+ return t;
+ }
+}
+
+
+//---------------------------------------------------------
+// addTrack
+// called from GUI context
+//---------------------------------------------------------
+
+Track* Song::addTrack(int t)
+ {
+ Track::TrackType type = (Track::TrackType) t;
+ Track* track = 0;
+ int lastAuxIdx = _auxs.size();
+ switch(type) {
+ case Track::MIDI:
+ track = new MidiTrack();
+ track->setType(Track::MIDI);
+ break;
+ case Track::DRUM:
+ track = new MidiTrack();
+ track->setType(Track::DRUM);
+ ((MidiTrack*)track)->setOutChannel(9);
+ break;
+ case Track::WAVE:
+ track = new WaveTrack();
+ ((AudioTrack*)track)->addAuxSend(lastAuxIdx);
+ break;
+ case Track::AUDIO_OUTPUT:
+ track = new AudioOutput();
+ break;
+ case Track::AUDIO_GROUP:
+ track = new AudioGroup();
+ ((AudioTrack*)track)->addAuxSend(lastAuxIdx);
+ break;
+ case Track::AUDIO_AUX:
+ track = new AudioAux();
+ break;
+ case Track::AUDIO_INPUT:
+ track = new AudioInput();
+ ((AudioTrack*)track)->addAuxSend(lastAuxIdx);
+ break;
+ case Track::AUDIO_SOFTSYNTH:
+ printf("not implemented: Song::addTrack(SOFTSYNTH)\n");
+ // ((AudioTrack*)track)->addAuxSend(lastAuxIdx);
+ break;
+ default:
+ printf("Song::addTrack() illegal type %d\n", type);
+ abort();
+ }
+ track->setDefaultName();
+ insertTrack1(track, -1);
+ msgInsertTrack(track, -1, true);
+ insertTrack3(track, -1);
+
+ //
+ // add default route to master
+ //
+ OutputList* ol = song->outputs();
+ if (!ol->empty()) {
+ AudioOutput* ao = ol->front();
+ switch(type) {
+ case Track::MIDI:
+ case Track::DRUM:
+ case Track::AUDIO_OUTPUT:
+ break;
+ case Track::WAVE:
+ case Track::AUDIO_GROUP:
+ case Track::AUDIO_AUX:
+ case Track::AUDIO_INPUT:
+ // p3.3.38
+ //case Track::AUDIO_SOFTSYNTH:
+ audio->msgAddRoute(Route((AudioTrack*)track, -1), Route(ao, -1));
+ updateFlags |= SC_ROUTE;
+ break;
+ // p3.3.38 It should actually never get here now, but just in case.
+ case Track::AUDIO_SOFTSYNTH:
+ audio->msgAddRoute(Route((AudioTrack*)track, 0, ((AudioTrack*)track)->channels()), Route(ao, 0, ((AudioTrack*)track)->channels()));
+ updateFlags |= SC_ROUTE;
+ break;
+ }
+ }
+ audio->msgUpdateSoloStates();
+ return track;
+ }
+
+//---------------------------------------------------------
+// cmdRemoveTrack
+//---------------------------------------------------------
+
+void Song::cmdRemoveTrack(Track* track)
+ {
+ int idx = _tracks.index(track);
+ undoOp(UndoOp::DeleteTrack, idx, track);
+ removeTrack2(track);
+ updateFlags |= SC_TRACK_REMOVED;
+ }
+
+//---------------------------------------------------------
+// removeMarkedTracks
+//---------------------------------------------------------
+
+void Song::removeMarkedTracks()
+ {
+ bool loop;
+ do {
+ loop = false;
+ for (iTrack t = _tracks.begin(); t != _tracks.end(); ++t) {
+ if ((*t)->selected()) {
+ removeTrack2(*t);
+ loop = true;
+ break;
+ }
+ }
+ } while (loop);
+ }
+
+//---------------------------------------------------------
+// deselectTracks
+//---------------------------------------------------------
+
+void Song::deselectTracks()
+ {
+ for (iTrack t = _tracks.begin(); t != _tracks.end(); ++t)
+ (*t)->setSelected(false);
+ }
+
+//---------------------------------------------------------
+// changeTrack
+// oldTrack - copy of the original track befor modification
+// newTrack - modified original track
+//---------------------------------------------------------
+
+void Song::changeTrack(Track* oldTrack, Track* newTrack)
+ {
+ oldTrack->setSelected(false); //??
+ int idx = _tracks.index(newTrack);
+
+ //undoOp(UndoOp::ModifyTrack, oldTrack, newTrack);
+ undoOp(UndoOp::ModifyTrack, idx, oldTrack, newTrack);
+ updateFlags |= SC_TRACK_MODIFIED;
+ }
+
+//---------------------------------------------------------
+// addEvent
+// return true if event was added
+//---------------------------------------------------------
+
+bool Song::addEvent(Event& event, Part* part)
+ {
+ /*
+ if (event.type() == Controller) {
+ MidiTrack* track = (MidiTrack*)part->track();
+ int ch = track->outChannel();
+ int tick = event.tick() + part->tick();
+ int cntrl = event.dataA();
+ int val = event.dataB();
+ MidiPort* mp = &midiPorts[track->outPort()];
+
+ // Is it a drum controller event, according to the track port's instrument?
+ if(track->type() == Track::DRUM)
+ {
+ MidiController* mc = mp->drumController(cntrl);
+ if(mc)
+ {
+ int note = cntrl & 0x7f;
+ cntrl &= ~0xff;
+ ch = drumMap[note].channel;
+ mp = &midiPorts[drumMap[note].port];
+ cntrl |= drumMap[note].anote;
+ }
+ }
+
+ // Changed by T356.
+ //if (!mp->setCtrl(ch, tick, cntrl, val)) {
+ // mp->addManagedController(ch, cntrl);
+ // if (!mp->setCtrl(ch, tick, cntrl, val))
+ // return false;
+ // }
+ // Changed again. Don't depend on return value of this - search for the event, below.
+ //if(!mp->setControllerVal(ch, tick, cntrl, val, part))
+ // return false;
+ if(mp->setControllerVal(ch, tick, cntrl, val, part))
+ updateFlags |= SC_MIDI_CONTROLLER;
+ }
+ */
+
+ //addPortCtrlEvents(event, part);
+
+ // Return false if the event is already found.
+ // (But allow a port controller value, above, in case it is not already stored.)
+ if(part->events()->find(event) != part->events()->end())
+ {
+ // This can be normal for some (redundant) operations.
+ if(debugMsg)
+ printf("Song::addEvent event already found in part:%s size:%zd\n", part->name().latin1(), part->events()->size());
+ return false;
+ }
+
+ part->events()->add(event);
+ return true;
+ }
+
+//---------------------------------------------------------
+// changeEvent
+//---------------------------------------------------------
+
+void Song::changeEvent(Event& oldEvent, Event& newEvent, Part* part)
+{
+ iEvent i = part->events()->find(oldEvent);
+
+ if (i == part->events()->end()) {
+ // This can be normal for some (redundant) operations.
+ if(debugMsg)
+ printf("Song::changeEvent event not found in part:%s size:%zd\n", part->name().latin1(), part->events()->size());
+ // abort();
+ // Removed by T356. Allow it to add the new event.
+ // (And remove the old one from the midi port controller!)
+ //return;
+ }
+ else
+ part->events()->erase(i);
+
+ part->events()->add(newEvent);
+
+ /*
+ if (oldEvent.type() == Controller) {
+ MidiTrack* track = (MidiTrack*)part->track();
+ int ch = track->outChannel();
+ int tick = oldEvent.tick() + part->tick();
+ int cntrl = oldEvent.dataA();
+ MidiPort* mp = &midiPorts[track->outPort()];
+ // Is it a drum controller event, according to the track port's instrument?
+ if(track->type() == Track::DRUM)
+ {
+ MidiController* mc = mp->drumController(cntrl);
+ if(mc)
+ {
+ int note = cntrl & 0x7f;
+ cntrl &= ~0xff;
+ ch = drumMap[note].channel;
+ mp = &midiPorts[drumMap[note].port];
+ cntrl |= drumMap[note].anote;
+ }
+ }
+
+ mp->deleteController(ch, tick, cntrl, part);
+ }
+ */
+ //removePortCtrlEvents(oldEvent, part);
+
+ /*
+ if (newEvent.type() == Controller) {
+ MidiTrack* track = (MidiTrack*)part->track();
+ int ch = track->outChannel();
+ int tick = newEvent.tick() + part->tick();
+ int cntrl = newEvent.dataA();
+ int val = newEvent.dataB();
+ MidiPort* mp = &midiPorts[track->outPort()];
+ // Is it a drum controller event, according to the track port's instrument?
+ if(track->type() == Track::DRUM)
+ {
+ MidiController* mc = mp->drumController(cntrl);
+ if(mc)
+ {
+ int note = cntrl & 0x7f;
+ cntrl &= ~0xff;
+ ch = drumMap[note].channel;
+ mp = &midiPorts[drumMap[note].port];
+ cntrl |= drumMap[note].anote;
+ }
+ }
+
+ mp->setControllerVal(ch, tick, cntrl, val, part);
+ }
+ */
+ //addPortCtrlEvents(newEvent, part);
+}
+
+//---------------------------------------------------------
+// deleteEvent
+//---------------------------------------------------------
+
+void Song::deleteEvent(Event& event, Part* part)
+ {
+ /*
+ if (event.type() == Controller) {
+ MidiTrack* track = (MidiTrack*)part->track();
+ int ch = track->outChannel();
+ int tick = event.tick() + part->tick();
+ int cntrl = event.dataA();
+
+ MidiPort* mp = &midiPorts[track->outPort()];
+ // Is it a drum controller event, according to the track port's instrument?
+ if(track->type() == Track::DRUM)
+ {
+ MidiController* mc = mp->drumController(cntrl);
+ if(mc)
+ {
+ int note = cntrl & 0x7f;
+ cntrl &= ~0xff;
+ ch = drumMap[note].channel;
+ mp = &midiPorts[drumMap[note].port];
+ cntrl |= drumMap[note].anote;
+ }
+ }
+
+ mp->deleteController(ch, tick, cntrl, part);
+ }
+ */
+ //removePortCtrlEvents(event, part);
+
+ iEvent ev = part->events()->find(event);
+ if (ev == part->events()->end()) {
+ // This can be normal for some (redundant) operations.
+ if(debugMsg)
+ printf("Song::deleteEvent event not found in part:%s size:%zd\n", part->name().latin1(), part->events()->size());
+ return;
+ }
+ part->events()->erase(ev);
+ }
+
+//---------------------------------------------------------
+// remapPortDrumCtrlEvents
+// Called when drum map anote, channel, or port is changed.
+//---------------------------------------------------------
+
+void Song::remapPortDrumCtrlEvents(int mapidx, int newnote, int newchan, int newport)
+{
+ if(mapidx == -1)
+ return;
+
+ for(ciMidiTrack it = _midis.begin(); it != _midis.end(); ++it)
+ {
+ MidiTrack* mt = *it;
+ if(mt->type() != Track::DRUM)
+ continue;
+
+ MidiPort* trackmp = &midiPorts[mt->outPort()];
+ const PartList* pl = mt->cparts();
+ for(ciPart ip = pl->begin(); ip != pl->end(); ++ip)
+ {
+ MidiPart* part = (MidiPart*)(ip->second);
+ const EventList* el = part->cevents();
+ unsigned len = part->lenTick();
+ for(ciEvent ie = el->begin(); ie != el->end(); ++ie)
+ {
+ const Event& ev = ie->second;
+ // Added by T356. Do not handle events which are past the end of the part.
+ if(ev.tick() >= len)
+ break;
+
+ if(ev.type() != Controller)
+ continue;
+
+ int cntrl = ev.dataA();
+
+ // Is it a drum controller event, according to the track port's instrument?
+ MidiController* mc = trackmp->drumController(cntrl);
+ if(!mc)
+ continue;
+
+ int note = cntrl & 0x7f;
+ // Does the index match?
+ if(note == mapidx)
+ {
+ int tick = ev.tick() + part->tick();
+ int ch = drumMap[note].channel;
+ int port = drumMap[note].port;
+ MidiPort* mp = &midiPorts[port];
+ cntrl = (cntrl & ~0xff) | drumMap[note].anote;
+
+ // Remove the port controller value.
+ mp->deleteController(ch, tick, cntrl, part);
+
+ if(newnote != -1 && newnote != drumMap[note].anote)
+ cntrl = (cntrl & ~0xff) | newnote;
+ if(newchan != -1 && newchan != ch)
+ ch = newchan;
+ if(newport != -1 && newport != port)
+ port = newport;
+
+ mp = &midiPorts[port];
+
+ // Add the port controller value.
+ mp->setControllerVal(ch, tick, cntrl, ev.dataB(), part);
+ }
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------
+// changeAllPortDrumCtlEvents
+// add true: add events. false: remove events
+// drumonly true: Do drum controller events ONLY. false (default): Do ALL controller events.
+//---------------------------------------------------------
+
+void Song::changeAllPortDrumCtrlEvents(bool add, bool drumonly)
+{
+ int ch, trackch, cntrl, tick;
+ MidiPort* mp, *trackmp;
+ for(ciMidiTrack it = _midis.begin(); it != _midis.end(); ++it)
+ {
+ MidiTrack* mt = *it;
+ if(mt->type() != Track::DRUM)
+ continue;
+
+ trackmp = &midiPorts[mt->outPort()];
+ trackch = mt->outChannel();
+ const PartList* pl = mt->cparts();
+ for(ciPart ip = pl->begin(); ip != pl->end(); ++ip)
+ {
+ MidiPart* part = (MidiPart*)(ip->second);
+ const EventList* el = part->cevents();
+ unsigned len = part->lenTick();
+ for(ciEvent ie = el->begin(); ie != el->end(); ++ie)
+ {
+ const Event& ev = ie->second;
+ // Added by T356. Do not handle events which are past the end of the part.
+ if(ev.tick() >= len)
+ break;
+
+ if(ev.type() != Controller)
+ continue;
+
+ cntrl = ev.dataA();
+ mp = trackmp;
+ ch = trackch;
+
+ // Is it a drum controller event, according to the track port's instrument?
+ if(trackmp->drumController(cntrl))
+ {
+ int note = cntrl & 0x7f;
+ ch = drumMap[note].channel;
+ mp = &midiPorts[drumMap[note].port];
+ cntrl = (cntrl & ~0xff) | drumMap[note].anote;
+ }
+ else
+ {
+ if(drumonly)
+ continue;
+ }
+
+ tick = ev.tick() + part->tick();
+
+ if(add)
+ // Add the port controller value.
+ mp->setControllerVal(ch, tick, cntrl, ev.dataB(), part);
+ else
+ // Remove the port controller value.
+ mp->deleteController(ch, tick, cntrl, part);
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------
+// cmdAddRecordedEvents
+// add recorded Events into part
+//---------------------------------------------------------
+
+void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned startTick)
+ {
+ if (events->empty()) {
+ if (debugMsg)
+ printf("no events recorded\n");
+ return;
+ }
+ iEvent s;
+ iEvent e;
+ unsigned endTick;
+
+ // Changed by Tim. p3.3.8
+
+ //if (punchin())
+ if((audio->loopCount() > 0 && startTick > lPos().tick()) || (punchin() && startTick < lPos().tick()))
+ {
+ startTick = lpos();
+ s = events->lower_bound(startTick);
+ }
+ else
+ {
+ s = events->begin();
+// startTick = s->first;
+ }
+
+ // Changed by Tim. p3.3.8
+
+ //if (punchout())
+ //{
+ // endTick = rpos();
+ // e = events->lower_bound(endTick);
+ //}
+ //else
+ //{
+ // search for last noteOff:
+ endTick = 0;
+ for (iEvent i = events->begin(); i != events->end(); ++i) {
+ Event ev = i->second;
+ unsigned l = ev.endTick();
+ if (l > endTick)
+ endTick = l;
+ }
+ // e = events->end();
+ //}
+ if((audio->loopCount() > 0) || (punchout() && endTick > rPos().tick()) )
+ {
+ endTick = rpos();
+ e = events->lower_bound(endTick);
+ }
+ else
+ e = events->end();
+
+ if (startTick > endTick) {
+ if (debugMsg)
+ printf("no events in record area\n");
+ return;
+ }
+
+ //---------------------------------------------------
+ // if startTick points into a part,
+ // record to that part
+ // else
+ // create new part
+ //---------------------------------------------------
+
+ PartList* pl = mt->parts();
+ MidiPart* part = 0;
+ iPart ip;
+ for (ip = pl->begin(); ip != pl->end(); ++ip) {
+ part = (MidiPart*)(ip->second);
+ unsigned partStart = part->tick();
+ unsigned partEnd = part->endTick();
+ if (startTick >= partStart && startTick < partEnd)
+ break;
+ }
+ if (ip == pl->end()) {
+ if (debugMsg)
+ printf("create new part for recorded events\n");
+ // create new part
+ part = new MidiPart(mt);
+
+ // Changed by Tim. p3.3.8
+
+ // Honour the Arranger snap settings. (Set to bar by default).
+ //startTick = roundDownBar(startTick);
+ //endTick = roundUpBar(endTick);
+ // Round the start down using the Arranger part snap raster value.
+ startTick = sigmap.raster1(startTick, recRaster());
+ // Round the end up using the Arranger part snap raster value.
+ endTick = sigmap.raster2(endTick, recRaster());
+
+ part->setTick(startTick);
+ part->setLenTick(endTick - startTick);
+ part->setName(mt->name());
+ // copy events
+ for (iEvent i = s; i != e; ++i) {
+ Event old = i->second;
+ Event event = old.clone();
+ event.setTick(old.tick() - startTick);
+ // addEvent also adds port controller values. So does msgAddPart, below. Let msgAddPart handle them.
+ //addEvent(event, part);
+ if(part->events()->find(event) == part->events()->end())
+ part->events()->add(event);
+ }
+ audio->msgAddPart(part);
+ updateFlags |= SC_PART_INSERTED;
+ return;
+ }
+
+ updateFlags |= SC_EVENT_INSERTED;
+
+ unsigned partTick = part->tick();
+ if (endTick > part->endTick()) {
+ // Determine new part length...
+ endTick = 0;
+ for (iEvent i = s; i != e; ++i) {
+ Event event = i->second;
+ unsigned tick = event.tick() - partTick + event.lenTick();
+ if (endTick < tick)
+ endTick = tick;
+ }
+ // Added by Tim. p3.3.8
+
+ // Round the end up (again) using the Arranger part snap raster value.
+ endTick = sigmap.raster2(endTick, recRaster());
+
+ // Remove all of the part's port controller values. Indicate do not do clone parts.
+ removePortCtrlEvents(part, false);
+ // Clone the part. This doesn't increment aref count, and doesn't chain clones.
+ // It also gives the new part a new serial number, but it is
+ // overwritten with the old one by Song::changePart(), below.
+ Part* newPart = part->clone();
+ // Set the new part's length.
+ newPart->setLenTick(endTick);
+ // Change the part.
+ changePart(part, newPart);
+ // Manually adjust reference counts.
+ part->events()->incARef(-1);
+ newPart->events()->incARef(1);
+ // Replace the part in the clone chain with the new part.
+ replaceClone(part, newPart);
+ // Now add all of the new part's port controller values. Indicate do not do clone parts.
+ addPortCtrlEvents(newPart, false);
+ // Create an undo op. Indicate do port controller values but not clone parts.
+ undoOp(UndoOp::ModifyPart, part, newPart, true, false);
+ updateFlags |= SC_PART_MODIFIED;
+
+ if (_recMode == REC_REPLACE)
+ {
+ iEvent si = newPart->events()->lower_bound(startTick - newPart->tick());
+ iEvent ei = newPart->events()->lower_bound(newPart->endTick() - newPart->tick());
+ for (iEvent i = si; i != ei; ++i)
+ {
+ Event event = i->second;
+ // Create an undo op. Indicate do port controller values and clone parts.
+ undoOp(UndoOp::DeleteEvent, event, newPart, true, true);
+ // Remove the event from the new part's port controller values, and do all clone parts.
+ removePortCtrlEvents(event, newPart, true);
+ }
+ newPart->events()->erase(si, ei);
+ }
+
+ for (iEvent i = s; i != e; ++i) {
+ Event event = i->second;
+ event.setTick(event.tick() - partTick);
+ Event e;
+ // Create an undo op. Indicate do port controller values and clone parts.
+ undoOp(UndoOp::AddEvent, e, event, newPart, true, true);
+
+ if(newPart->events()->find(event) == newPart->events()->end())
+ newPart->events()->add(event);
+
+ // Add the event to the new part's port controller values, and do all clone parts.
+ addPortCtrlEvents(event, newPart, true);
+ }
+
+
+ /*
+ if (_recMode == REC_REPLACE)
+ {
+ iEvent si = part->events()->lower_bound(startTick - part->tick());
+ iEvent ei = part->events()->lower_bound(part->endTick() - part->tick());
+
+ for (iEvent i = si; i != ei; ++i)
+ {
+ Event event = i->second;
+ // Create an undo op. Indicate do port controller values and clone parts.
+ //undoOp(UndoOp::DeleteEvent, event, part);
+ undoOp(UndoOp::DeleteEvent, event, part, true, true);
+
+ //if (event.type() == Controller) {
+ // MidiTrack* track = (MidiTrack*)part->track();
+ // int ch = track->outChannel();
+ // int tick = event.tick() + part->tick();
+ // int cntrl = event.dataA();
+ // midiPorts[track->outPort()].deleteController(ch, tick, cntrl, part);
+ // }
+
+ // Remove the event from the part's port controller values, and do all clone parts.
+ //removePortCtrlEvents(event, part, true);
+ }
+ part->events()->erase(si, ei);
+ }
+
+ // Remove all of the part's port controller values, and do all clone parts.
+ removePortCtrlEvents(part, true);
+
+ // Clone the part. This doesn't increment aref count, and doesn't chain clones.
+ // It also gives the new part a new serial number, but it is
+ // overwritten with the old one by Song::changePart(), below.
+ Part* newPart = part->clone();
+
+ endTick = 0;
+ for (iEvent i = s; i != e; ++i) {
+ Event event = i->second;
+ unsigned tick = event.tick() - partTick;
+ event.setTick(tick);
+ Event e;
+ // Create an undo op. Indicate do port controller values and clone parts.
+ //undoOp(UndoOp::AddEvent, e, event, newPart);
+ undoOp(UndoOp::AddEvent, e, event, newPart, true, true);
+
+ // addEvent also adds port controller values. So does msgChangePart, below. Let msgChangePart handle them.
+ //addEvent(event, (MidiPart*)newPart);
+ if(newPart->events()->find(event) == newPart->events()->end())
+ newPart->events()->add(event);
+
+ if (endTick < event.tick() + event.lenTick())
+ endTick = event.tick() + event.lenTick();
+ }
+ newPart->setLenTick(endTick); // endTick - part->tick()
+
+ //printf("Song::cmdAddRecordedEvents before changePart part:%p events:%p refs:%d Arefs:%d newPart:%p events:%p refs:%d Arefs:%d\n", part, part->events(), part->events()->refCount(), part->events()->arefCount(), newPart, newPart->events(), newPart->events()->refCount(), newPart->events()->arefCount());
+
+ // Change the part.
+ changePart(part, newPart);
+ // Manually adjust reference counts.
+ part->events()->incARef(-1);
+ newPart->events()->incARef(1);
+ // Replace the part in the clone chain with the new part.
+ replaceClone(part, newPart);
+ // Now add all of the new part's port controller values, and do all clone parts.
+ addPortCtrlEvents(newPart, true);
+
+ //printf("Song::cmdAddRecordedEvents after changePart part:%p events:%p refs:%d Arefs:%d newPart:%p events:%p refs:%d Arefs:%d\n", part, part->events(), part->events()->refCount(), part->events()->arefCount(), newPart, newPart->events(), newPart->events()->refCount(), newPart->events()->arefCount());
+
+ //undoOp(UndoOp::ModifyPart, part, newPart);
+ // Create an undo op. Indicate do not do port controller values and clone parts.
+ undoOp(UndoOp::ModifyPart, part, newPart, false, false);
+
+ // Removed by T356.
+ //part->events()->incARef(-1);
+
+ updateFlags |= SC_PART_MODIFIED;
+ //printf("Song::cmdAddRecordedEvents final part:%p events:%p refs:%d Arefs:%d newPart:%p events:%p refs:%d Arefs:%d\n", part, part->events(), part->events()->refCount(), part->events()->arefCount(), newPart, newPart->events(), newPart->events()->refCount(), newPart->events()->arefCount());
+ */
+
+ }
+ else {
+ if (_recMode == REC_REPLACE) {
+ iEvent si = part->events()->lower_bound(startTick - part->tick());
+ iEvent ei = part->events()->lower_bound(endTick - part->tick());
+
+ for (iEvent i = si; i != ei; ++i) {
+ Event event = i->second;
+ // Create an undo op. Indicate that controller values and clone parts were handled.
+ //undoOp(UndoOp::DeleteEvent, event, part);
+ undoOp(UndoOp::DeleteEvent, event, part, true, true);
+ /*
+ if (event.type() == Controller) {
+ MidiTrack* track = (MidiTrack*)part->track();
+ int ch = track->outChannel();
+ int tick = event.tick() + part->tick();
+ int cntrl = event.dataA();
+ midiPorts[track->outPort()].deleteController(ch, tick, cntrl, part);
+ }
+ */
+ // Remove the event from the part's port controller values, and do all clone parts.
+ removePortCtrlEvents(event, part, true);
+ }
+ part->events()->erase(si, ei);
+ }
+ for (iEvent i = s; i != e; ++i) {
+ Event event = i->second;
+ int tick = event.tick() - partTick;
+ event.setTick(tick);
+
+ // Create an undo op. Indicate that controller values and clone parts were handled.
+ //undoOp(UndoOp::AddEvent, event, part);
+ undoOp(UndoOp::AddEvent, event, part, true, true);
+
+ //addEvent(event, part);
+ if(part->events()->find(event) == part->events()->end())
+ part->events()->add(event);
+
+ // Add the event to the part's port controller values, and do all clone parts.
+ addPortCtrlEvents(event, part, true);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// findTrack
+//---------------------------------------------------------
+
+MidiTrack* Song::findTrack(const Part* part) const
+ {
+ for (ciTrack t = _tracks.begin(); t != _tracks.end(); ++t) {
+ MidiTrack* track = dynamic_cast<MidiTrack*>(*t);
+ if (track == 0)
+ continue;
+ PartList* pl = track->parts();
+ for (iPart p = pl->begin(); p != pl->end(); ++p) {
+ if (part == p->second)
+ return track;
+ }
+ }
+ return 0;
+ }
+
+//---------------------------------------------------------
+// findTrack
+// find track by name
+//---------------------------------------------------------
+
+Track* Song::findTrack(const QString& name) const
+ {
+ for (ciTrack i = _tracks.begin(); i != _tracks.end(); ++i) {
+ if ((*i)->name() == name)
+ return *i;
+ }
+ return 0;
+ }
+
+//---------------------------------------------------------
+// setLoop
+// set transport loop flag
+//---------------------------------------------------------
+
+void Song::setLoop(bool f)
+ {
+ if (loopFlag != f) {
+ loopFlag = f;
+ loopAction->setOn(loopFlag);
+ emit loopChanged(loopFlag);
+ }
+ }
+
+//---------------------------------------------------------
+// clearTrackRec
+//---------------------------------------------------------
+void Song::clearTrackRec()
+{
+ for (iTrack it = tracks()->begin(); it != tracks()->end(); ++it)
+ setRecordFlag(*it,false);
+}
+
+//---------------------------------------------------------
+// setRecord
+//---------------------------------------------------------
+void Song::setRecord(bool f, bool autoRecEnable)
+ {
+ if (recordFlag != f) {
+ if (f && autoRecEnable) {
+ bool alreadyRecEnabled = false;
+ Track *selectedTrack = 0;
+ // loop through list and check if any track is rec enabled
+ // if not then rec enable the selected track
+ WaveTrackList* wtl = waves();
+ for (iWaveTrack i = wtl->begin(); i != wtl->end(); ++i) {
+ if((*i)->recordFlag())
+ {
+ alreadyRecEnabled = true;
+ break;
+ }
+ if((*i)->selected())
+ selectedTrack = (*i);
+ }
+ if (!alreadyRecEnabled) {
+ MidiTrackList* mtl = midis();
+ for (iMidiTrack it = mtl->begin(); it != mtl->end(); ++it) {
+ if((*it)->recordFlag())
+ {
+ alreadyRecEnabled = true;
+ break;
+ }
+ if((*it)->selected())
+ selectedTrack = (*it);
+ }
+ }
+ if (!alreadyRecEnabled && selectedTrack) {
+ setRecordFlag(selectedTrack, true);
+ }
+ else if (alreadyRecEnabled) {
+ // do nothing
+ }
+ else {
+ // if there are no tracks, do not enable record
+ if (!waves()->size() && !midis()->size()) {
+ printf("No track to select, won't enable record\n");
+ f = false;
+ }
+ }
+#if 0
+ // check for midi devices suitable for recording
+ bool portFound = false;
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ MidiDevice* dev = midiPorts[i].device();
+ if (dev && (dev->rwFlags() & 0x2))
+ portFound = true;
+ }
+ if (!portFound) {
+ QMessageBox::critical(qApp->mainWidget(), "MusE: Record",
+ "There are no midi devices configured for recording");
+ f = false;
+ }
+#endif
+ }
+ else {
+ bounceTrack = 0;
+ }
+ if (audio->isPlaying() && f)
+ f = false;
+ recordFlag = f;
+ recordAction->setOn(recordFlag);
+ emit recordChanged(recordFlag);
+ }
+ }
+
+//---------------------------------------------------------
+// setPunchin
+// set punchin flag
+//---------------------------------------------------------
+
+void Song::setPunchin(bool f)
+ {
+ if (punchinFlag != f) {
+ punchinFlag = f;
+ punchinAction->setOn(punchinFlag);
+ emit punchinChanged(punchinFlag);
+ }
+ }
+
+//---------------------------------------------------------
+// setPunchout
+// set punchout flag
+//---------------------------------------------------------
+
+void Song::setPunchout(bool f)
+ {
+ if (punchoutFlag != f) {
+ punchoutFlag = f;
+ punchoutAction->setOn(punchoutFlag);
+ emit punchoutChanged(punchoutFlag);
+ }
+ }
+
+//---------------------------------------------------------
+// setClick
+//---------------------------------------------------------
+
+void Song::setClick(bool val)
+ {
+ if (_click != val) {
+ _click = val;
+ emit clickChanged(_click);
+ }
+ }
+
+//---------------------------------------------------------
+// setQuantize
+//---------------------------------------------------------
+
+void Song::setQuantize(bool val)
+ {
+ if (_quantize != val) {
+ _quantize = val;
+ emit quantizeChanged(_quantize);
+ }
+ }
+
+//---------------------------------------------------------
+// setMasterFlag
+//---------------------------------------------------------
+
+void Song::setMasterFlag(bool val)
+ {
+ _masterFlag = val;
+ if (tempomap.setMasterFlag(cpos(), val))
+ {
+ //audioDevice->setMaster(val);
+ emit songChanged(SC_MASTER);
+ }
+ // Removed. p3.3.26
+ //audioDevice->setMaster(val);
+ }
+
+//---------------------------------------------------------
+// setPlay
+// set transport play flag
+//---------------------------------------------------------
+
+void Song::setPlay(bool f)
+ {
+ if (extSyncFlag.value()) {
+ if (debugMsg)
+ printf("not allowed while using external sync");
+ return;
+ }
+ // only allow the user to set the button "on"
+ if (!f)
+ playAction->setOn(true);
+ else
+ audio->msgPlay(true);
+ }
+
+void Song::setStop(bool f)
+ {
+ if (extSyncFlag.value()) {
+ if (debugMsg)
+ printf("not allowed while using external sync");
+ return;
+ }
+ // only allow the user to set the button "on"
+ if (!f)
+ stopAction->setOn(true);
+ else
+ audio->msgPlay(false);
+ }
+
+void Song::setStopPlay(bool f)
+ {
+ playAction->blockSignals(true);
+ stopAction->blockSignals(true);
+
+ emit playChanged(f); // signal transport window
+
+ playAction->setOn(f);
+ stopAction->setOn(!f);
+
+ stopAction->blockSignals(false);
+ playAction->blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// swapTracks
+//---------------------------------------------------------
+
+void Song::swapTracks(int i1, int i2)
+ {
+ undoOp(UndoOp::SwapTrack, i1, i2);
+ Track* track = _tracks[i1];
+ _tracks[i1] = _tracks[i2];
+ _tracks[i2] = track;
+ }
+
+//---------------------------------------------------------
+// setPos
+// song->setPos(Song::CPOS, pos, true, true, true);
+//---------------------------------------------------------
+
+void Song::setPos(int idx, const Pos& val, bool sig,
+ bool isSeek, bool adjustScrollbar)
+ {
+// printf("setPos %d sig=%d,seek=%d,scroll=%d ",
+// idx, sig, isSeek, adjustScrollbar);
+// val.dump(0);
+// printf("\n");
+
+ // p3.3.23
+ //printf("Song::setPos before audio->msgSeek idx:%d isSeek:%d frame:%d\n", idx, isSeek, val.frame());
+ if (pos[idx] == val)
+ return;
+ if (idx == CPOS) {
+ _vcpos = val;
+ if (isSeek && !extSyncFlag.value()) {
+ audio->msgSeek(val);
+ // p3.3.23
+ //printf("Song::setPos after audio->msgSeek idx:%d isSeek:%d frame:%d\n", idx, isSeek, val.frame());
+ return;
+ }
+ }
+ pos[idx] = val;
+ bool swap = pos[LPOS] > pos[RPOS];
+ if (swap) { // swap lpos/rpos if lpos > rpos
+ Pos tmp = pos[LPOS];
+ pos[LPOS] = pos[RPOS];
+ pos[RPOS] = tmp;
+ }
+ if (sig) {
+ if (swap) {
+ emit posChanged(LPOS, pos[LPOS].tick(), adjustScrollbar);
+ emit posChanged(RPOS, pos[RPOS].tick(), adjustScrollbar);
+ if (idx != LPOS && idx != RPOS)
+ emit posChanged(idx, pos[idx].tick(), adjustScrollbar);
+ }
+ else
+ emit posChanged(idx, pos[idx].tick(), adjustScrollbar);
+ }
+
+ if (idx == CPOS) {
+ iMarker i1 = _markerList->begin();
+ iMarker i2 = i1;
+ bool currentChanged = false;
+ for (; i1 != _markerList->end(); ++i1) {
+ ++i2;
+ if (val.tick() >= i1->first && (i2==_markerList->end() || val.tick() < i2->first)) {
+ if (i1->second.current())
+ return;
+ i1->second.setCurrent(true);
+ if (currentChanged) {
+ emit markerChanged(MARKER_CUR);
+ return;
+ }
+ ++i1;
+ for (; i1 != _markerList->end(); ++i1) {
+ if (i1->second.current())
+ i1->second.setCurrent(false);
+ }
+ emit markerChanged(MARKER_CUR);
+ return;
+ }
+ else {
+ if (i1->second.current()) {
+ currentChanged = true;
+ i1->second.setCurrent(false);
+ }
+ }
+ }
+ if (currentChanged)
+ emit markerChanged(MARKER_CUR);
+ }
+ }
+
+//---------------------------------------------------------
+// forward
+//---------------------------------------------------------
+
+void Song::forward()
+ {
+ unsigned newPos = pos[0].tick() + config.division;
+ audio->msgSeek(Pos(newPos, true));
+ }
+
+//---------------------------------------------------------
+// rewind
+//---------------------------------------------------------
+
+void Song::rewind()
+ {
+ unsigned newPos;
+ if (unsigned(config.division) > pos[0].tick())
+ newPos = 0;
+ else
+ newPos = pos[0].tick() - config.division;
+ audio->msgSeek(Pos(newPos, true));
+ }
+
+//---------------------------------------------------------
+// rewindStart
+//---------------------------------------------------------
+
+void Song::rewindStart()
+ {
+ // Added by T356
+ //audio->msgIdle(true);
+
+ audio->msgSeek(Pos(0, true));
+
+ // Added by T356
+ //audio->msgIdle(false);
+ }
+
+//---------------------------------------------------------
+// update
+//---------------------------------------------------------
+
+void Song::update(int flags)
+ {
+ static int level = 0; // DEBUG
+ if (level) {
+ printf("Song::update %08x, level %d\n", flags, level);
+ return;
+ }
+ ++level;
+ emit songChanged(flags);
+ --level;
+ }
+
+//---------------------------------------------------------
+// updatePos
+//---------------------------------------------------------
+
+void Song::updatePos()
+ {
+ emit posChanged(0, pos[0].tick(), false);
+ emit posChanged(1, pos[1].tick(), false);
+ emit posChanged(2, pos[2].tick(), false);
+ }
+
+//---------------------------------------------------------
+// setChannelMute
+// mute all midi tracks associated with channel
+//---------------------------------------------------------
+
+void Song::setChannelMute(int channel, bool val)
+ {
+ for (iTrack i = _tracks.begin(); i != _tracks.end(); ++i) {
+ MidiTrack* track = dynamic_cast<MidiTrack*>(*i);
+ if (track == 0)
+ continue;
+ if (track->outChannel() == channel)
+ track->setMute(val);
+ }
+ emit songChanged(SC_MUTE);
+ }
+
+//---------------------------------------------------------
+// len
+//---------------------------------------------------------
+
+void Song::initLen()
+ {
+ _len = sigmap.bar2tick(40, 0, 0); // default song len
+ for (iTrack t = _tracks.begin(); t != _tracks.end(); ++t) {
+ MidiTrack* track = dynamic_cast<MidiTrack*>(*t);
+ if (track == 0)
+ continue;
+ PartList* parts = track->parts();
+ for (iPart p = parts->begin(); p != parts->end(); ++p) {
+ unsigned last = p->second->tick() + p->second->lenTick();
+ if (last > _len)
+ _len = last;
+ }
+ }
+ _len = roundUpBar(_len);
+ }
+
+//---------------------------------------------------------
+// tempoChanged
+//---------------------------------------------------------
+
+void Song::tempoChanged()
+{
+ emit songChanged(SC_TEMPO);
+}
+
+//---------------------------------------------------------
+// roundUpBar
+//---------------------------------------------------------
+
+int Song::roundUpBar(int t) const
+ {
+ int bar, beat;
+ unsigned tick;
+ sigmap.tickValues(t, &bar, &beat, &tick);
+ if (beat || tick)
+ return sigmap.bar2tick(bar+1, 0, 0);
+ return t;
+ }
+
+//---------------------------------------------------------
+// roundUpBeat
+//---------------------------------------------------------
+
+int Song::roundUpBeat(int t) const
+ {
+ int bar, beat;
+ unsigned tick;
+ sigmap.tickValues(t, &bar, &beat, &tick);
+ if (tick)
+ return sigmap.bar2tick(bar, beat+1, 0);
+ return t;
+ }
+
+//---------------------------------------------------------
+// roundDownBar
+//---------------------------------------------------------
+
+int Song::roundDownBar(int t) const
+ {
+ int bar, beat;
+ unsigned tick;
+ sigmap.tickValues(t, &bar, &beat, &tick);
+ return sigmap.bar2tick(bar, 0, 0);
+ }
+
+//---------------------------------------------------------
+// dumpMaster
+//---------------------------------------------------------
+
+void Song::dumpMaster()
+ {
+ tempomap.dump();
+ sigmap.dump();
+ }
+
+//---------------------------------------------------------
+// getSelectedParts
+//---------------------------------------------------------
+
+PartList* Song::getSelectedMidiParts() const
+ {
+ PartList* parts = new PartList();
+
+ //------------------------------------------------------
+ // wenn ein Part selektiert ist, diesen editieren
+ // wenn ein Track selektiert ist, den Ersten
+ // Part des Tracks editieren, die restlichen sind
+ // 'ghostparts'
+ // wenn mehrere Parts selektiert sind, dann Ersten
+ // editieren, die restlichen sind 'ghostparts'
+ //
+ // Rough translation:
+ /*
+ If a part is selected, edit that.
+ If a track is selected, edit the first
+ part of the track, the rest are
+ 'ghost parts'
+ When multiple parts are selected, then edit the first,
+ the rest are 'ghost parts'
+ */
+
+
+ // collect marked parts
+ for (ciMidiTrack t = _midis.begin(); t != _midis.end(); ++t) {
+ MidiTrack* track = *t;
+ PartList* pl = track->parts();
+ for (iPart p = pl->begin(); p != pl->end(); ++p) {
+ if (p->second->selected()) {
+ parts->add(p->second);
+ }
+ }
+ }
+ // if no part is selected, then search for selected track
+ // and collect all parts of this track
+
+ if (parts->empty()) {
+ for (ciTrack t = _tracks.begin(); t != _tracks.end(); ++t) {
+ if ((*t)->selected()) {
+ MidiTrack* track = dynamic_cast<MidiTrack*>(*t);
+ if (track == 0)
+ continue;
+ PartList* pl = track->parts();
+ for (iPart p = pl->begin(); p != pl->end(); ++p)
+ parts->add(p->second);
+ break;
+ }
+ }
+ }
+ return parts;
+ }
+
+PartList* Song::getSelectedWaveParts() const
+ {
+ PartList* parts = new PartList();
+
+ //------------------------------------------------------
+ // wenn ein Part selektiert ist, diesen editieren
+ // wenn ein Track selektiert ist, den Ersten
+ // Part des Tracks editieren, die restlichen sind
+ // 'ghostparts'
+ // wenn mehrere Parts selektiert sind, dann Ersten
+ // editieren, die restlichen sind 'ghostparts'
+ //
+
+ // markierte Parts sammeln
+ for (ciTrack t = _tracks.begin(); t != _tracks.end(); ++t) {
+ WaveTrack* track = dynamic_cast<WaveTrack*>(*t);
+ if (track == 0)
+ continue;
+ PartList* pl = track->parts();
+ for (iPart p = pl->begin(); p != pl->end(); ++p) {
+ if (p->second->selected()) {
+ parts->add(p->second);
+ }
+ }
+ }
+ // wenn keine Parts selektiert, dann markierten Track suchen
+ // und alle Parts dieses Tracks zusammensuchen
+
+ if (parts->empty()) {
+ for (ciTrack t = _tracks.begin(); t != _tracks.end(); ++t) {
+ if ((*t)->selected()) {
+ WaveTrack* track = dynamic_cast<WaveTrack*>(*t);
+ if (track == 0)
+ continue;
+ PartList* pl = track->parts();
+ for (iPart p = pl->begin(); p != pl->end(); ++p)
+ parts->add(p->second);
+ break;
+ }
+ }
+ }
+ return parts;
+ }
+
+void Song::setMType(MType t)
+ {
+// printf("set MType %d\n", t);
+ _mtype = t;
+ }
+
+//---------------------------------------------------------
+// beat
+//---------------------------------------------------------
+
+void Song::beat()
+ {
+ // Keep the sync detectors running...
+ for(int port = 0; port < MIDI_PORTS; ++port)
+ {
+ // Must keep them running even if there's no device...
+ //if(midiPorts[port].device())
+ midiPorts[port].syncInfo().setTime();
+ }
+
+
+ int tick = audio->tickPos();
+ if (audio->isPlaying())
+ setPos(0, tick, true, false, true);
+
+ // p3.3.40 Update synth native guis at the heartbeat rate.
+ for(ciSynthI is = _synthIs.begin(); is != _synthIs.end(); ++is)
+ (*is)->guiHeartBeat();
+
+ while (noteFifoSize) {
+ int pv = recNoteFifo[noteFifoRindex];
+ noteFifoRindex = (noteFifoRindex + 1) % REC_NOTE_FIFO_SIZE;
+ int pitch = (pv >> 8) & 0xff;
+ int velo = pv & 0xff;
+
+ //---------------------------------------------------
+ // filter midi remote control events
+ //---------------------------------------------------
+
+ if (rcEnable && velo != 0) {
+ if (pitch == rcStopNote)
+ setStop(true);
+ else if (pitch == rcRecordNote)
+ setRecord(true);
+ else if (pitch == rcGotoLeftMarkNote)
+ setPos(0, pos[LPOS].tick(), true, true, true);
+ else if (pitch == rcPlayNote)
+ setPlay(true);
+ }
+ emit song->midiNote(pitch, velo);
+ --noteFifoSize;
+ }
+ }
+
+//---------------------------------------------------------
+// setLen
+//---------------------------------------------------------
+
+void Song::setLen(unsigned l)
+ {
+ _len = l;
+ update();
+ }
+
+//---------------------------------------------------------
+// addMarker
+//---------------------------------------------------------
+
+Marker* Song::addMarker(const QString& s, int t, bool lck)
+ {
+ Marker* marker = _markerList->add(s, t, lck);
+ emit markerChanged(MARKER_ADD);
+ return marker;
+ }
+
+//---------------------------------------------------------
+// addMarker
+//---------------------------------------------------------
+
+Marker* Song::getMarkerAt(int t)
+ {
+ iMarker markerI;
+ for (markerI=_markerList->begin(); markerI != _markerList->end(); ++markerI) {
+// if (i1->second.current())
+ if (unsigned(t) == markerI->second.tick())//prevent of copmiler warning: comparison signed/unsigned
+ return &markerI->second;
+ }
+ //Marker* marker = _markerList->add(s, t, lck);
+ return NULL;
+ }
+
+//---------------------------------------------------------
+// removeMarker
+//---------------------------------------------------------
+
+void Song::removeMarker(Marker* marker)
+ {
+ _markerList->remove(marker);
+ emit markerChanged(MARKER_REMOVE);
+ }
+
+Marker* Song::setMarkerName(Marker* m, const QString& s)
+ {
+ m->setName(s);
+ emit markerChanged(MARKER_NAME);
+ return m;
+ }
+
+Marker* Song::setMarkerTick(Marker* m, int t)
+ {
+ Marker mm(*m);
+ _markerList->remove(m);
+ mm.setTick(t);
+ m = _markerList->add(mm);
+ emit markerChanged(MARKER_TICK);
+ return m;
+ }
+
+Marker* Song::setMarkerLock(Marker* m, bool f)
+ {
+ m->setType(f ? Pos::FRAMES : Pos::TICKS);
+ emit markerChanged(MARKER_LOCK);
+ return m;
+ }
+
+//---------------------------------------------------------
+// setRecordFlag
+//---------------------------------------------------------
+
+void Song::setRecordFlag(Track* track, bool val)
+ {
+ if (track->type() == Track::WAVE) {
+ WaveTrack* audioTrack = (WaveTrack*)track;
+ if(!audioTrack->setRecordFlag1(val))
+ return;
+ audio->msgSetRecord(audioTrack, val);
+ }
+ else {
+ track->setRecordFlag1(val);
+ track->setRecordFlag2(val);
+ }
+// updateFlags |= SC_RECFLAG;
+ update(SC_RECFLAG);
+ }
+
+//---------------------------------------------------------
+// rescanAlsaPorts
+//---------------------------------------------------------
+
+void Song::rescanAlsaPorts()
+ {
+ emit midiPortsChanged();
+ }
+
+//---------------------------------------------------------
+// endMsgCmd
+//---------------------------------------------------------
+
+void Song::endMsgCmd()
+ {
+ if (updateFlags) {
+ redoList->clear(); // TODO: delete elements in list
+ undoAction->setEnabled(true);
+ redoAction->setEnabled(false);
+ emit songChanged(updateFlags);
+ }
+ }
+
+//---------------------------------------------------------
+// undo
+//---------------------------------------------------------
+
+void Song::undo()
+ {
+ updateFlags = 0;
+ if (doUndo1())
+ return;
+ audio->msgUndo();
+ doUndo3();
+ redoAction->setEnabled(true);
+ undoAction->setEnabled(!undoList->empty());
+
+ if(updateFlags && (SC_TRACK_REMOVED | SC_TRACK_INSERTED))
+ audio->msgUpdateSoloStates();
+
+ emit songChanged(updateFlags);
+ }
+
+//---------------------------------------------------------
+// redo
+//---------------------------------------------------------
+
+void Song::redo()
+ {
+ updateFlags = 0;
+ if (doRedo1())
+ return;
+ audio->msgRedo();
+ doRedo3();
+ undoAction->setEnabled(true);
+ redoAction->setEnabled(!redoList->empty());
+
+ if(updateFlags && (SC_TRACK_REMOVED | SC_TRACK_INSERTED))
+ audio->msgUpdateSoloStates();
+
+ emit songChanged(updateFlags);
+ }
+
+//---------------------------------------------------------
+// processMsg
+// executed in realtime thread context
+//---------------------------------------------------------
+
+void Song::processMsg(AudioMsg* msg)
+ {
+ switch(msg->id) {
+ case SEQM_UPDATE_SOLO_STATES:
+ updateSoloStates();
+ break;
+ case SEQM_UNDO:
+ doUndo2();
+ break;
+ case SEQM_REDO:
+ doRedo2();
+ break;
+ case SEQM_MOVE_TRACK:
+ if (msg->a > msg->b) {
+ for (int i = msg->a; i > msg->b; --i) {
+ swapTracks(i, i-1);
+ }
+ }
+ else {
+ for (int i = msg->a; i < msg->b; ++i) {
+ swapTracks(i, i+1);
+ }
+ }
+ updateFlags = SC_TRACK_MODIFIED;
+ break;
+ case SEQM_ADD_EVENT:
+ updateFlags = SC_EVENT_INSERTED;
+ if (addEvent(msg->ev1, (MidiPart*)msg->p2)) {
+ Event ev;
+ //undoOp(UndoOp::AddEvent, ev, msg->ev1, (Part*)msg->p2);
+ undoOp(UndoOp::AddEvent, ev, msg->ev1, (Part*)msg->p2, msg->a, msg->b);
+ }
+ else
+ updateFlags = 0;
+ if(msg->a)
+ addPortCtrlEvents(msg->ev1, (Part*)msg->p2, msg->b);
+ break;
+ case SEQM_REMOVE_EVENT:
+ {
+ Event event = msg->ev1;
+ MidiPart* part = (MidiPart*)msg->p2;
+ if(msg->a)
+ removePortCtrlEvents(event, part, msg->b);
+ Event e;
+ //undoOp(UndoOp::DeleteEvent, e, event, (Part*)part);
+ undoOp(UndoOp::DeleteEvent, e, event, (Part*)part, msg->a, msg->b);
+ deleteEvent(event, part);
+ updateFlags = SC_EVENT_REMOVED;
+ }
+ break;
+ case SEQM_CHANGE_EVENT:
+ if(msg->a)
+ removePortCtrlEvents(msg->ev1, (MidiPart*)msg->p3, msg->b);
+ changeEvent(msg->ev1, msg->ev2, (MidiPart*)msg->p3);
+ if(msg->a)
+ addPortCtrlEvents(msg->ev2, (Part*)msg->p3, msg->b);
+ //undoOp(UndoOp::ModifyEvent, msg->ev2, msg->ev1, (Part*)msg->p3);
+ undoOp(UndoOp::ModifyEvent, msg->ev2, msg->ev1, (Part*)msg->p3, msg->a, msg->b);
+ updateFlags = SC_EVENT_MODIFIED;
+ break;
+
+ case SEQM_ADD_TEMPO:
+ //printf("processMsg (SEQM_ADD_TEMPO) UndoOp::AddTempo. adding tempo at: %d with tempo=%d\n", msg->a, msg->b);
+ undoOp(UndoOp::AddTempo, msg->a, msg->b);
+ tempomap.addTempo(msg->a, msg->b);
+ updateFlags = SC_TEMPO;
+ break;
+
+ case SEQM_SET_TEMPO:
+ //printf("processMsg (SEQM_SET_TEMPO) UndoOp::AddTempo. adding tempo at: %d with tempo=%d\n", msg->a, msg->b);
+ undoOp(UndoOp::AddTempo, msg->a, msg->b);
+ tempomap.setTempo(msg->a, msg->b);
+ updateFlags = SC_TEMPO;
+ break;
+
+ case SEQM_SET_GLOBAL_TEMPO:
+ tempomap.setGlobalTempo(msg->a);
+ break;
+
+ case SEQM_REMOVE_TEMPO:
+ //printf("processMsg (SEQM_REMOVE_TEMPO) UndoOp::DeleteTempo. adding tempo at: %d with tempo=%d\n", msg->a, msg->b);
+ undoOp(UndoOp::DeleteTempo, msg->a, msg->b);
+ tempomap.delTempo(msg->a);
+ updateFlags = SC_TEMPO;
+ break;
+
+ case SEQM_ADD_SIG:
+ undoOp(UndoOp::AddSig, msg->a, msg->b, msg->c);
+ sigmap.add(msg->a, msg->b, msg->c);
+ updateFlags = SC_SIG;
+ break;
+
+ case SEQM_REMOVE_SIG:
+ undoOp(UndoOp::DeleteSig, msg->a, msg->b, msg->c);
+ sigmap.del(msg->a);
+ updateFlags = SC_SIG;
+ break;
+
+ default:
+ printf("unknown seq message %d\n", msg->id);
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// cmdAddPart
+//---------------------------------------------------------
+
+void Song::cmdAddPart(Part* part)
+ {
+ addPart(part);
+ undoOp(UndoOp::AddPart, part);
+ updateFlags = SC_PART_INSERTED;
+ }
+
+//---------------------------------------------------------
+// cmdRemovePart
+//---------------------------------------------------------
+
+void Song::cmdRemovePart(Part* part)
+ {
+ removePart(part);
+ undoOp(UndoOp::DeletePart, part);
+ part->events()->incARef(-1);
+ //part->unchainClone();
+ unchainClone(part);
+ updateFlags = SC_PART_REMOVED;
+ }
+
+//---------------------------------------------------------
+// cmdChangePart
+//---------------------------------------------------------
+
+//void Song::cmdChangePart(Part* oldPart, Part* newPart)
+void Song::cmdChangePart(Part* oldPart, Part* newPart, bool doCtrls, bool doClones)
+ {
+ //printf("Song::cmdChangePart before changePart oldPart:%p events:%p refs:%d Arefs:%d sn:%d newPart:%p events:%p refs:%d Arefs:%d sn:%d\n", oldPart, oldPart->events(), oldPart->events()->refCount(), oldPart->events()->arefCount(), oldPart->sn(), newPart, newPart->events(), newPart->events()->refCount(), newPart->events()->arefCount(), newPart->sn());
+
+ if(doCtrls)
+ removePortCtrlEvents(oldPart, doClones);
+
+ changePart(oldPart, newPart);
+
+ //undoOp(UndoOp::ModifyPart, oldPart, newPart);
+ undoOp(UndoOp::ModifyPart, oldPart, newPart, doCtrls, doClones);
+
+ // Changed by T356. Do not decrement ref count if the new part is a clone of the old part, since the event list
+ // will still be active.
+ if(oldPart->cevents() != newPart->cevents())
+ oldPart->events()->incARef(-1);
+
+ //oldPart->replaceClone(newPart);
+
+ //printf("Song::cmdChangePart before repl/unchClone oldPart:%p events:%p refs:%d Arefs:%d sn:%d newPart:%p events:%p refs:%d Arefs:%d sn:%d\n", oldPart, oldPart->events(), oldPart->events()->refCount(), oldPart->events()->arefCount(), oldPart->sn(), newPart, newPart->events(), newPart->events()->refCount(), newPart->events()->arefCount(), newPart->sn());
+
+ replaceClone(oldPart, newPart);
+
+ if(doCtrls)
+ addPortCtrlEvents(newPart, doClones);
+
+ //printf("Song::cmdChangePart after repl/unchClone oldPart:%p events:%p refs:%d Arefs:%d sn:%d newPart:%p events:%p refs:%d Arefs:%d sn:%d\n", oldPart, oldPart->events(), oldPart->events()->refCount(), oldPart->events()->arefCount(), oldPart->sn(), newPart, newPart->events(), newPart->events()->refCount(), newPart->events()->arefCount(), newPart->sn());
+
+ updateFlags = SC_PART_MODIFIED;
+ }
+
+//---------------------------------------------------------
+// panic
+//---------------------------------------------------------
+
+void Song::panic()
+ {
+ audio->msgPanic();
+ }
+
+//---------------------------------------------------------
+// clear
+// signal - emit signals for changes if true
+// called from constructor as clear(false) and
+// from MusE::clearSong() as clear(false)
+//---------------------------------------------------------
+
+void Song::clear(bool signal)
+ {
+ if(debugMsg)
+ printf("Song::clear\n");
+
+ bounceTrack = 0;
+
+ _tracks.clear();
+ _midis.clearDelete();
+ _waves.clearDelete();
+ _inputs.clearDelete(); // audio input ports
+ _outputs.clearDelete(); // audio output ports
+ _groups.clearDelete(); // mixer groups
+ _auxs.clearDelete(); // aux sends
+
+ // p3.3.45 Clear all midi port devices.
+ for(int i = 0; i < MIDI_PORTS; ++i)
+ {
+ // p3.3.50 Since midi ports are not deleted, clear all midi port in/out routes. They point to non-existant tracks now.
+ midiPorts[i].inRoutes()->clear();
+ midiPorts[i].outRoutes()->clear();
+
+ // p3.3.50 Reset this.
+ midiPorts[i].setFoundInSongFile(false);
+
+ // This will also close the device.
+ midiPorts[i].setMidiDevice(0);
+ }
+
+ _synthIs.clearDelete();
+
+ // p3.3.45 Make sure to delete Jack midi devices, and remove all ALSA midi device routes...
+ // Otherwise really nasty things happen when loading another song when one is already loaded.
+ // The loop is a safe way to delete while iterating.
+ bool loop;
+ do
+ {
+ loop = false;
+ for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd)
+ {
+ //if((*imd)->deviceType() == MidiDevice::JACK_MIDI)
+ if(dynamic_cast< MidiJackDevice* >(*imd))
+ {
+ // Remove the device from the list.
+ midiDevices.erase(imd);
+ // Since Jack midi devices are created dynamically, we must delete them.
+ // The destructor unregisters the device from Jack, which also disconnects all device-to-jack routes.
+ // This will also delete all midi-track-to-device routes, they point to non-existant midi tracks
+ // which were all deleted above
+ delete (*imd);
+ loop = true;
+ break;
+ }
+ else
+ //if((*imd)->deviceType() == MidiDevice::ALSA_MIDI)
+ if(dynamic_cast< MidiAlsaDevice* >(*imd))
+ {
+ // With alsa devices, we must not delete them (they're always in the list). But we must
+ // clear all routes. They point to non-existant midi tracks, which were all deleted above.
+ (*imd)->inRoutes()->clear();
+ (*imd)->outRoutes()->clear();
+ }
+ }
+ }
+ while (loop);
+
+ tempomap.clear();
+ sigmap.clear();
+ undoList->clearDelete();
+ redoList->clear();
+ _markerList->clear();
+ pos[0].setTick(0);
+ pos[1].setTick(0);
+ pos[2].setTick(0);
+ _vcpos.setTick(0);
+
+ Track::clearSoloRefCounts();
+ clearMidiTransforms();
+ clearMidiInputTransforms();
+
+ // Clear all midi port controller values.
+ for(int i = 0; i < MIDI_PORTS; ++i)
+ // Don't remove the controllers, just the values.
+ midiPorts[i].controller()->clearDelete(false);
+
+ _masterFlag = true;
+ loopFlag = false;
+ loopFlag = false;
+ punchinFlag = false;
+ punchoutFlag = false;
+ recordFlag = false;
+ soloFlag = false;
+ // seq
+ _mtype = MT_UNKNOWN;
+ _recMode = REC_OVERDUP;
+ _cycleMode = CYCLE_NORMAL;
+ _click = false;
+ _quantize = false;
+ _len = 0; // song len in ticks
+ _follow = JUMP;
+ // _tempo = 500000; // default tempo 120
+ dirty = false;
+ initDrumMap();
+ if (signal) {
+ emit loopChanged(false);
+ recordChanged(false);
+ }
+ }
+
+//---------------------------------------------------------
+// cleanupForQuit
+// called from Muse::closeEvent
+//---------------------------------------------------------
+
+void Song::cleanupForQuit()
+{
+ bounceTrack = 0;
+
+ if(debugMsg)
+ printf("MusE: Song::cleanupForQuit...\n");
+
+ _tracks.clear();
+
+ if(debugMsg)
+ printf("deleting _midis\n");
+ _midis.clearDelete();
+
+ if(debugMsg)
+ printf("deleting _waves\n");
+ _waves.clearDelete();
+
+ if(debugMsg)
+ printf("deleting _inputs\n");
+ _inputs.clearDelete(); // audio input ports
+
+ if(debugMsg)
+ printf("deleting _outputs\n");
+ _outputs.clearDelete(); // audio output ports
+
+ if(debugMsg)
+ printf("deleting _groups\n");
+ _groups.clearDelete(); // mixer groups
+
+ if(debugMsg)
+ printf("deleting _auxs\n");
+ _auxs.clearDelete(); // aux sends
+
+ if(debugMsg)
+ printf("deleting _synthIs\n");
+ _synthIs.clearDelete(); // each ~SynthI() -> deactivate3() -> ~SynthIF()
+
+ tempomap.clear();
+ sigmap.clear();
+
+ if(debugMsg)
+ printf("deleting undoList, clearing redoList\n");
+ undoList->clearDelete();
+ redoList->clear(); // Check this - Should we do a clearDelete? IIRC it was OK this way - no clearDelete in case of same items in both lists.
+
+ _markerList->clear();
+
+ if(debugMsg)
+ printf("deleting transforms\n");
+ clearMidiTransforms(); // Deletes stuff.
+ clearMidiInputTransforms(); // Deletes stuff.
+
+ if(debugMsg)
+ printf("deleting midiport controllers\n");
+ // Clear all midi port controllers and values.
+ for(int i = 0; i < MIDI_PORTS; ++i)
+ // Remove the controllers and the values.
+ midiPorts[i].controller()->clearDelete(true);
+
+ // Can't do this here. Jack isn't running.
+ /*
+ if(debugMsg)
+ printf("deleting midi devices\n");
+ for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd)
+ {
+ // Since Syntis are midi devices, there's no need to delete them below.
+ if((*imd)->isSynti())
+ continue;
+ delete (*imd);
+ }
+ midiDevices.clear(); // midi devices
+ */
+
+ if(debugMsg)
+ printf("deleting synths\n");
+ // Delete all synths.
+ std::vector<Synth*>::iterator is;
+ for(is = synthis.begin(); is != synthis.end(); ++is)
+ {
+ Synth* s = *is;
+
+ if(s)
+ delete s;
+ }
+ synthis.clear();
+
+ // Nothing required for ladspa plugin list, and rack instances of them
+ // are handled by ~AudioTrack.
+
+ if(debugMsg)
+ printf("...finished cleaning up.\n");
+}
+
+//---------------------------------------------------------
+// seqSignal
+// sequencer message to GUI
+// execution environment: gui thread
+//---------------------------------------------------------
+
+void Song::seqSignal(int fd)
+ {
+ char buffer[16];
+
+ int n = ::read(fd, buffer, 16);
+ if (n < 0) {
+ printf("Song: seqSignal(): READ PIPE failed: %s\n",
+ strerror(errno));
+ return;
+ }
+ for (int i = 0; i < n; ++i) {
+// printf("seqSignal to gui:<%c>\n", buffer[i]);
+ switch(buffer[i]) {
+ case '0': // STOP
+ stopRolling();
+ break;
+ case '1': // PLAY
+ setStopPlay(true);
+ break;
+ case '2': // record
+ setRecord(true);
+ break;
+ case '3': // START_PLAY + jack STOP
+ abortRolling();
+ break;
+ case 'P': // alsa ports changed
+ rescanAlsaPorts();
+ break;
+ case 'G':
+ clearRecAutomation(true);
+ setPos(0, audio->tickPos(), true, false, true);
+ break;
+ case 'S': // shutdown audio
+ muse->seqStop();
+
+ {
+ // give the user a sensible explanation
+ int btn = QMessageBox::critical( muse, tr(QString("Jack shutdown!")),
+ tr(QString("Jack has detected a performance problem which has lead to\n"
+ "MusE being disconnected.\n"
+ "This could happen due to a number of reasons:\n"
+ "- a performance issue with your particular setup.\n"
+ "- a bug in MusE (or possibly in another connected software).\n"
+ "- a random hiccup which might never occur again.\n"
+ "- jack was voluntary stopped by you or someone else\n"
+ "- jack crashed\n"
+ "If there is a persisting problem you are much welcome to discuss it\n"
+ "on the MusE mailinglist.\n"
+ "(there is information about joining the mailinglist on the MusE\n"
+ " homepage which is available through the help menu)\n"
+ "\n"
+ "To proceed check the status of Jack and try to restart it and then .\n"
+ "click on the Restart button.")), "restart", "cancel");
+ if (btn == 0) {
+ printf("restarting!\n");
+ muse->seqRestart();
+ }
+ }
+
+ break;
+ case 'f': // start freewheel
+ if(debugMsg)
+ printf("Song: seqSignal: case f: setFreewheel start\n");
+
+ // Enabled by Tim. p3.3.6
+ if(config.freewheelMode)
+ audioDevice->setFreewheel(true);
+
+ break;
+
+ case 'F': // stop freewheel
+ if(debugMsg)
+ printf("Song: seqSignal: case F: setFreewheel stop\n");
+
+ // Enabled by Tim. p3.3.6
+ if(config.freewheelMode)
+ audioDevice->setFreewheel(false);
+
+ audio->msgPlay(false);
+#if 0
+ if (record())
+ audio->recordStop();
+ setStopPlay(false);
+#endif
+ break;
+
+ case 'C': // Graph changed
+ if (audioDevice)
+ audioDevice->graphChanged();
+ break;
+
+ // p3.3.37
+ case 'R': // Registration changed
+ if (audioDevice)
+ audioDevice->registrationChanged();
+ break;
+
+ default:
+ printf("unknown Seq Signal <%c>\n", buffer[i]);
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// recordEvent
+//---------------------------------------------------------
+
+void Song::recordEvent(MidiTrack* mt, Event& event)
+ {
+ //---------------------------------------------------
+ // if tick points into a part,
+ // record to that part
+ // else
+ // create new part
+ //---------------------------------------------------
+
+ unsigned tick = event.tick();
+ PartList* pl = mt->parts();
+ MidiPart* part = 0;
+ iPart ip;
+ for (ip = pl->begin(); ip != pl->end(); ++ip) {
+ part = (MidiPart*)(ip->second);
+ unsigned partStart = part->tick();
+ unsigned partEnd = partStart + part->lenTick();
+ if (tick >= partStart && tick < partEnd)
+ break;
+ }
+ updateFlags |= SC_EVENT_INSERTED;
+ if (ip == pl->end()) {
+ // create new part
+ part = new MidiPart(mt);
+ int startTick = roundDownBar(tick);
+ //int endTick = roundUpBar(tick);
+ int endTick = roundUpBar(tick + 1);
+ part->setTick(startTick);
+ part->setLenTick(endTick - startTick);
+ part->setName(mt->name());
+ event.move(-startTick);
+ part->events()->add(event);
+ audio->msgAddPart(part);
+ return;
+ }
+ part = (MidiPart*)(ip->second);
+ tick -= part->tick();
+ event.setTick(tick);
+
+ Event ev;
+ if(event.type() == Controller)
+ {
+ EventRange range = part->events()->equal_range(tick);
+ for(iEvent i = range.first; i != range.second; ++i)
+ {
+ ev = i->second;
+ // At the moment, Song::recordEvent() is only called by the 'Rec' buttons in the
+ // midi track info panel. So only controller types are fed to it. If other event types
+ // are to be passed, we will have to expand on this to check if equal. Instead, maybe add an isEqual() to Event class.
+ //if((ev.type() == Controller && event.type() == Controller || ev.type() == Controller && event.type() == Controller)
+ // && ev.dataA() == event.dataA() && ev.dataB() == event.dataB())
+ if(ev.type() == Controller && ev.dataA() == event.dataA())
+ {
+ // Don't bother if already set.
+ if(ev.dataB() == event.dataB())
+ return;
+ // Indicate do undo, and do port controller values and clone parts.
+ audio->msgChangeEvent(ev, event, part, true, true, true);
+ return;
+ }
+ }
+ }
+
+ // Indicate do undo, and do port controller values and clone parts.
+ //audio->msgAddEvent(event, part);
+ audio->msgAddEvent(event, part, true, true, true);
+ }
+
+//---------------------------------------------------------
+// execAutomationCtlPopup
+//---------------------------------------------------------
+
+int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& menupos, int acid)
+{
+ //enum { HEADER, SEP1, PREV_EVENT, NEXT_EVENT, SEP2, ADD_EVENT, CLEAR_EVENT, CLEAR_RANGE, CLEAR_ALL_EVENTS };
+ enum { HEADER, PREV_EVENT, NEXT_EVENT, SEP2, ADD_EVENT, CLEAR_EVENT, CLEAR_RANGE, CLEAR_ALL_EVENTS };
+ Q3PopupMenu* menu = new Q3PopupMenu;
+
+ int count = 0;
+ bool isEvent = false, canSeekPrev = false, canSeekNext = false, canEraseRange = false;
+ bool canAdd = false;
+ double ctlval = 0.0;
+ if(track)
+ {
+ ciCtrlList icl = track->controller()->find(acid);
+ if(icl != track->controller()->end())
+ {
+ CtrlList *cl = icl->second;
+ canAdd = true;
+ ctlval = cl->curVal();
+ count = cl->size();
+ if(count)
+ {
+ int frame = pos[0].frame();
+
+ iCtrl s = cl->lower_bound(frame);
+ iCtrl e = cl->upper_bound(frame);
+
+ isEvent = (s != cl->end() && s->second.frame == frame);
+
+ canSeekPrev = s != cl->begin();
+ canSeekNext = e != cl->end();
+
+ s = cl->lower_bound(pos[1].frame());
+
+ canEraseRange = s != cl->end()
+ && (int)pos[2].frame() > s->second.frame;
+ }
+ }
+ }
+
+ //menu->insertItem(tr("Automation:"), HEADER, HEADER);
+ //menu->setItemEnabled(HEADER, false);
+ //MenuTitleItem* title = new MenuTitleItem(tr("Automation:")); ddskrjo
+ //menu->insertItem(title, HEADER, HEADER); ddskrjo
+
+ //menu->insertSeparator(SEP1);
+
+ menu->insertItem(tr("previous event"), PREV_EVENT, PREV_EVENT);
+ menu->setItemEnabled(PREV_EVENT, canSeekPrev);
+
+ menu->insertItem(tr("next event"), NEXT_EVENT, NEXT_EVENT);
+ menu->setItemEnabled(NEXT_EVENT, canSeekNext);
+
+ menu->insertSeparator(SEP2);
+
+ if(isEvent)
+ menu->insertItem(tr("set event"), ADD_EVENT, ADD_EVENT);
+ else
+ menu->insertItem(tr("add event"), ADD_EVENT, ADD_EVENT);
+ menu->setItemEnabled(ADD_EVENT, canAdd);
+ menu->insertItem(tr("erase event"), CLEAR_EVENT, CLEAR_EVENT);
+ menu->setItemEnabled(CLEAR_EVENT, isEvent);
+
+ menu->insertItem(tr("erase range"), CLEAR_RANGE, CLEAR_RANGE);
+ menu->setItemEnabled(CLEAR_RANGE, canEraseRange);
+
+ menu->insertItem(tr("clear automation"), CLEAR_ALL_EVENTS, CLEAR_ALL_EVENTS);
+ menu->setItemEnabled(CLEAR_ALL_EVENTS, (bool)count);
+
+ int sel = menu->exec(menupos, 1);
+ delete menu;
+ if (sel == -1)
+ return -1;
+
+ if(!track)
+ return -1;
+ switch(sel)
+ {
+ case ADD_EVENT:
+ audio->msgAddACEvent(track, acid, pos[0].frame(), ctlval);
+ break;
+ case CLEAR_EVENT:
+ audio->msgEraseACEvent(track, acid, pos[0].frame());
+ break;
+
+ case CLEAR_RANGE:
+ audio->msgEraseRangeACEvents(track, acid, pos[1].frame(), pos[2].frame());
+ break;
+
+ case CLEAR_ALL_EVENTS:
+ if(QMessageBox::question(muse, QString("Muse"),
+ tr("Clear all controller events?"), tr("&Ok"), tr("&Cancel"),
+ QString::null, 0, 1 ) == 0)
+ audio->msgClearControllerEvents(track, acid);
+ break;
+
+ case PREV_EVENT:
+ audio->msgSeekPrevACEvent(track, acid);
+ break;
+
+ case NEXT_EVENT:
+ audio->msgSeekNextACEvent(track, acid);
+ break;
+
+ default:
+ return -1;
+ break;
+ }
+ return sel;
+}
+
+//---------------------------------------------------------
+// execMidiAutomationCtlPopup
+//---------------------------------------------------------
+
+int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPoint& menupos, int ctlnum)
+{
+ if(!track && !part)
+ return -1;
+
+ //enum { HEADER, SEP1, PREV_EVENT, NEXT_EVENT, SEP2, ADD_EVENT, CLEAR_EVENT, CLEAR_RANGE, CLEAR_ALL_EVENTS };
+ enum { HEADER, ADD_EVENT, CLEAR_EVENT };
+ Q3PopupMenu* menu = new Q3PopupMenu;
+
+ //int count = 0;
+ bool isEvent = false;
+ //bool canSeekPrev = false, canSeekNext = false, canEraseRange = false;
+ //bool canAdd = false;
+ //double ctlval = 0.0;
+
+ MidiTrack* mt;
+ if(track)
+ mt = track;
+ else
+ mt = (MidiTrack*)part->track();
+ int portno = mt->outPort();
+ int channel = mt->outChannel();
+ MidiPort* mp = &midiPorts[portno];
+
+ int dctl = ctlnum;
+ // Is it a drum controller, according to the track port's instrument?
+ MidiController *mc = mp->drumController(ctlnum);
+ if(mc)
+ {
+ // Change the controller event's index into the drum map to an instrument note.
+ int note = ctlnum & 0x7f;
+ dctl &= ~0xff;
+ channel = drumMap[note].channel;
+ mp = &midiPorts[drumMap[note].port];
+ dctl |= drumMap[note].anote;
+ }
+
+ //printf("Song::execMidiAutomationCtlPopup ctlnum:%d dctl:%d anote:%d\n", ctlnum, dctl, drumMap[ctlnum & 0x7f].anote);
+
+ unsigned tick = cpos();
+
+ if(!part)
+ {
+ PartList* pl = mt->parts();
+ iPart ip;
+ for(ip = pl->begin(); ip != pl->end(); ++ip)
+ {
+ MidiPart* tpart = (MidiPart*)(ip->second);
+ unsigned partStart = tpart->tick();
+ unsigned partEnd = partStart + tpart->lenTick();
+ if(tick >= partStart && tick < partEnd)
+ {
+ // Prefer a selected part, otherwise keep looking...
+ if(tpart->selected())
+ {
+ part = tpart;
+ break;
+ }
+ else
+ // Remember the first part found...
+ if(!part)
+ part = tpart;
+ }
+ }
+ }
+
+ Event ev;
+ if(part)
+ {
+ unsigned partStart = part->tick();
+ unsigned partEnd = partStart + part->lenTick();
+ if(tick >= partStart && tick < partEnd)
+ {
+ EventRange range = part->events()->equal_range(tick - partStart);
+ for(iEvent i = range.first; i != range.second; ++i)
+ {
+ ev = i->second;
+ if(ev.type() == Controller)
+ {
+ //printf("Song::execMidiAutomationCtlPopup ev.dataA:%d\n", ev.dataA());
+
+ //if(ev.dataA() == dctl)
+ if(ev.dataA() == ctlnum)
+ {
+ isEvent = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+
+ //menu->insertItem(tr("Automation:"), HEADER, HEADER);
+ //menu->setItemEnabled(HEADER, false);
+ //MenuTitleItem* title = new MenuTitleItem(tr("Automation:")); ddskrjo
+ ///menu->insertItem(title, HEADER, HEADER); ddskrjo
+
+ //menu->insertSeparator(SEP1);
+
+// menu->insertItem(tr("previous event"), PREV_EVENT, PREV_EVENT);
+// menu->setItemEnabled(PREV_EVENT, canSeekPrev);
+
+// menu->insertItem(tr("next event"), NEXT_EVENT, NEXT_EVENT);
+// menu->setItemEnabled(NEXT_EVENT, canSeekNext);
+
+// menu->insertSeparator(SEP2);
+
+ if(isEvent)
+ menu->insertItem(tr("set event"), ADD_EVENT, ADD_EVENT);
+ else
+ menu->insertItem(tr("add event"), ADD_EVENT, ADD_EVENT);
+ //menu->setItemEnabled(ADD_EVENT, canAdd);
+ menu->setItemEnabled(ADD_EVENT, true);
+
+ menu->insertItem(tr("erase event"), CLEAR_EVENT, CLEAR_EVENT);
+ menu->setItemEnabled(CLEAR_EVENT, isEvent);
+
+// menu->insertItem(tr("erase range"), CLEAR_RANGE, CLEAR_RANGE);
+// menu->setItemEnabled(CLEAR_RANGE, canEraseRange);
+
+// menu->insertItem(tr("clear automation"), CLEAR_ALL_EVENTS, CLEAR_ALL_EVENTS);
+// menu->setItemEnabled(CLEAR_ALL_EVENTS, (bool)count);
+
+ int sel = menu->exec(menupos, 1);
+ delete menu;
+ if (sel == -1)
+ return -1;
+
+ //if(!part)
+ // return -1;
+
+ switch(sel)
+ {
+ case ADD_EVENT:
+ {
+ //int val = mp->hwCtrlState(channel, ctlnum);
+ int val = mp->hwCtrlState(channel, dctl);
+ if(val == CTRL_VAL_UNKNOWN)
+ return -1;
+ Event e(Controller);
+ //e.setA(dctl);
+ e.setA(ctlnum);
+ e.setB(val);
+ // Do we replace an old event?
+ if(isEvent)
+ {
+ // Don't bother if already set.
+ if(ev.dataB() == val)
+ return -1;
+
+ e.setTick(tick - part->tick());
+ // Indicate do undo, and do port controller values and clone parts.
+ audio->msgChangeEvent(ev, e, part, true, true, true);
+ }
+ else
+ {
+ // Store a new event...
+ if(part)
+ {
+ e.setTick(tick - part->tick());
+ // Indicate do undo, and do port controller values and clone parts.
+ audio->msgAddEvent(e, part, true, true, true);
+ }
+ else
+ {
+ // Create a new part...
+ part = new MidiPart(mt);
+ int startTick = roundDownBar(tick);
+ int endTick = roundUpBar(tick + 1);
+ part->setTick(startTick);
+ part->setLenTick(endTick - startTick);
+ part->setName(mt->name());
+ e.setTick(tick - startTick);
+ part->events()->add(e);
+ // Allow undo.
+ audio->msgAddPart(part);
+ }
+ }
+ }
+ break;
+ case CLEAR_EVENT:
+ // Indicate do undo, and do port controller values and clone parts.
+ audio->msgDeleteEvent(ev, part, true, true, true);
+ break;
+
+ //case CLEAR_RANGE:
+ //audio->msgEraseRangeACEvents(track, acid, pos[1].frame(), pos[2].frame());
+ //break;
+
+ //case CLEAR_ALL_EVENTS:
+ //if(QMessageBox::question(muse, QString("Muse"),
+ // tr("Clear all controller events?"), tr("&Ok"), tr("&Cancel"),
+ // QString::null, 0, 1 ) == 0)
+ //audio->msgClearControllerEvents(track, acid);
+ //break;
+
+ //case PREV_EVENT:
+ //audio->msgSeekPrevACEvent(track, acid);
+ //break;
+
+ //case NEXT_EVENT:
+ //audio->msgSeekNextACEvent(track, acid);
+ //break;
+
+ default:
+ return -1;
+ break;
+ }
+
+ return sel;
+}
+
+//---------------------------------------------------------
+// updateSoloStates
+// This will properly set all soloing variables (including other tracks) based entirely
+// on the current values of all the tracks' _solo members.
+//---------------------------------------------------------
+
+void Song::updateSoloStates()
+{
+ Track::clearSoloRefCounts();
+ for(ciTrack i = _tracks.begin(); i != _tracks.end(); ++i)
+ (*i)->setInternalSolo(0);
+ for(ciTrack i = _tracks.begin(); i != _tracks.end(); ++i)
+ (*i)->updateSoloStates(true);
+}
+
+//---------------------------------------------------------
+// clearRecAutomation
+//---------------------------------------------------------
+
+void Song::clearRecAutomation(bool clearList)
+{
+ // Clear all pan/vol pressed and touched flags, and all rec event lists, if needed.
+ for (iTrack it = tracks()->begin(); it != tracks()->end(); ++it)
+ ((Track*)(*it))->clearRecAutomation(clearList);
+}
+
+//---------------------------------------------------------
+// processAutomationEvents
+//---------------------------------------------------------
+
+void Song::processAutomationEvents()
+{
+ // Just clear all pressed and touched flags, not rec event lists.
+ clearRecAutomation(false);
+ if (!automation)
+ return;
+ for(iTrack i = _tracks.begin(); i != _tracks.end(); ++i)
+ {
+ if(!(*i)->isMidiTrack())
+ // Process (and clear) rec events.
+ ((AudioTrack*)(*i))->processAutomationEvents();
+ }
+}
+
+//---------------------------------------------------------
+// abortRolling
+//---------------------------------------------------------
+
+void Song::abortRolling()
+{
+ if (record())
+ audio->recordStop();
+ setStopPlay(false);
+}
+
+//---------------------------------------------------------
+// stopRolling
+//---------------------------------------------------------
+
+void Song::stopRolling()
+ {
+ abortRolling();
+ processAutomationEvents();
+ }
+
+//---------------------------------------------------------
+// connectJackRoutes
+//---------------------------------------------------------
+
+void Song::connectJackRoutes(AudioTrack* track, bool disconnect)
+{
+ switch(track->type())
+ {
+ case Track::AUDIO_OUTPUT:
+ {
+ AudioOutput* ao = (AudioOutput*)track;
+ // This will re-register the track's jack ports.
+ if(!disconnect)
+ ao->setName(ao->name());
+ // Now reconnect the output routes.
+ if(checkAudioDevice() && audio->isRunning())
+ {
+ for(int ch = 0; ch < ao->channels(); ++ch)
+ {
+ RouteList* ir = ao->outRoutes();
+ for (iRoute ii = ir->begin(); ii != ir->end(); ++ii)
+ {
+ Route r = *ii;
+ if ((r.type == Route::JACK_ROUTE) && (r.channel == ch))
+ {
+ if(disconnect)
+ audioDevice->disconnect(ao->jackPort(ch), r.jackPort);
+ else
+ audioDevice->connect(ao->jackPort(ch), r.jackPort);
+ break;
+ }
+ }
+ if(disconnect)
+ {
+ audioDevice->unregisterPort(ao->jackPort(ch));
+ ao->setJackPort(ch, 0);
+ }
+ }
+ }
+ }
+ break;
+ case Track::AUDIO_INPUT:
+ {
+ AudioInput* ai = (AudioInput*)track;
+ // This will re-register the track's jack ports.
+ if(!disconnect)
+ ai->setName(ai->name());
+ // Now reconnect the input routes.
+ if(checkAudioDevice() && audio->isRunning())
+ {
+ for(int ch = 0; ch < ai->channels(); ++ch)
+ {
+ RouteList* ir = ai->inRoutes();
+ for (iRoute ii = ir->begin(); ii != ir->end(); ++ii)
+ {
+ Route r = *ii;
+ if ((r.type == Route::JACK_ROUTE) && (r.channel == ch))
+ {
+ if(disconnect)
+ audioDevice->disconnect(r.jackPort, ai->jackPort(ch));
+ else
+ audioDevice->connect(r.jackPort, ai->jackPort(ch));
+ break;
+ }
+ }
+ if(disconnect)
+ {
+ audioDevice->unregisterPort(ai->jackPort(ch));
+ ai->setJackPort(ch, 0);
+ }
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+/*
+//---------------------------------------------------------
+// chooseMidiRoutes
+//---------------------------------------------------------
+
+void Song::chooseMidiRoutes(QButton* parent, MidiTrack* track, bool dst)
+{
+ if(!track)
+ return;
+
+ //if(!track->isMidiTrack())
+ // return;
+
+ QPoint ppt = QCursor::pos();
+ //QPoint ppt = parent->rect().bottomLeft();
+
+ //if(dst)
+ //{
+ // TODO
+
+ //}
+ //else
+ //{
+ RouteList* rl = dst ? track->outRoutes() : track->inRoutes();
+ //Route dst(track, -1);
+
+ QPopupMenu* pup = new QPopupMenu(parent);
+ pup->setCheckable(true);
+
+ int gid = 0;
+ int n;
+
+ // FIXME:
+ // Routes can't be re-read until the message sent from msgAddRoute1()
+ // has had time to be sent and actually affected the routes.
+ ///_redisplay:
+
+ pup->clear();
+ gid = 0;
+
+ //MidiInPortList* tl = song->midiInPorts();
+ //for(iMidiInPort i = tl->begin();i != tl->end(); ++i)
+ for(int i = 0; i < MIDI_PORTS; ++i)
+ {
+ //MidiInPort* track = *i;
+ // NOTE: Could possibly list all devices, bypassing ports, but no, let's stick wth ports.
+ MidiPort* mp = &midiPorts[i];
+ MidiDevice* md = mp->device();
+ if(!md)
+ continue;
+
+ if(!(md->rwFlags() & (dst ? 1 : 2)))
+ continue;
+
+ //printf("MidiStrip::iRoutePressed adding submenu portnum:%d\n", i);
+
+ //QMenu* m = menu->addMenu(track->name());
+ QPopupMenu* subp = new QPopupMenu(parent);
+
+ for(int ch = 0; ch < MIDI_CHANNELS; ++ch)
+ {
+ //QAction* a = m->addAction(QString("Channel %1").arg(ch+1));
+ //subp->insertItem(QT_TR_NOOP(QString("Channel %1").arg(ch+1)), i * MIDI_CHANNELS + ch);
+ gid = i * MIDI_CHANNELS + ch;
+
+ //printf("MidiStrip::iRoutePressed inserting gid:%d\n", gid);
+
+ subp->insertItem(QString("Channel %1").arg(ch+1), gid);
+ //a->setCheckable(true);
+ //Route src(track, ch, RouteNode::TRACK);
+ //Route src(md, ch);
+ //Route r = Route(src, dst);
+ //a->setData(QVariant::fromValue(r));
+ //a->setChecked(rl->indexOf(r) != -1);
+ Route srcRoute(md, ch);
+ for(iRoute ir = rl->begin(); ir != rl->end(); ++ir)
+ {
+ //if(*ir == dst)
+ if(*ir == srcRoute)
+ {
+ subp->setItemChecked(gid, true);
+ break;
+ }
+ }
+ }
+ pup->insertItem(QT_TR_NOOP(md->name()), subp);
+ }
+
+// QPopupMenu* pup = new QPopupMenu(iR);
+// pup->setCheckable(true);
+ //MidiTrack* t = (MidiTrack*)track;
+// RouteList* irl = track->inRoutes();
+
+// MidiTrack* t = (MidiTrack*)track;
+// int gid = 0;
+// for (int i = 0; i < channel; ++i)
+// {
+// char buffer[128];
+// snprintf(buffer, 128, "%s %d", tr("Channel").latin1(), i+1);
+// MenuTitleItem* titel = new MenuTitleItem(QString(buffer));
+// pup->insertItem(titel);
+
+// if (!checkAudioDevice()) return;
+// std::list<QString> ol = audioDevice->outputPorts();
+// for (std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip) {
+// int id = pup->insertItem(*ip, (gid * 16) + i);
+// Route dst(*ip, true, i);
+// ++gid;
+// for (iRoute ir = irl->begin(); ir != irl->end(); ++ir) {
+// if (*ir == dst) {
+// pup->setItemChecked(id, true);
+// break;
+// }
+// }
+// }
+// if (i+1 != channel)
+// pup->insertSeparator();
+// }
+
+ if(pup->count() == 0)
+ {
+ delete pup;
+ return;
+ }
+
+ //n = pup->exec(QCursor::pos());
+ n = pup->exec(ppt);
+ ///delete pup;
+ if (n != -1)
+ {
+ int mdidx = n / MIDI_CHANNELS;
+ int ch = n % MIDI_CHANNELS;
+
+ //if(debugMsg)
+ //printf("Song::chooseMidiRoutes mdidx:%d ch:%d\n", mdidx, ch);
+
+ MidiPort* mp = &midiPorts[mdidx];
+ MidiDevice* md = mp->device();
+ if(!md)
+ {
+ delete pup;
+ return;
+ }
+
+ //if(!(md->rwFlags() & 2))
+ if(!(md->rwFlags() & (dst ? 1 : 2)))
+ {
+ delete pup;
+ return;
+ }
+
+ //QString s(pup->text(n));
+ //QT_TR_NOOP(md->name())
+
+ //Route srcRoute(s, false, -1);
+ Route aRoute(md, ch);
+ //Route srcRoute(md, -1);
+ //Route dstRoute(track, -1);
+ Route bRoute(track, ch);
+
+ //if (track->type() == Track::AUDIO_INPUT)
+ // srcRoute.channel = dstRoute.channel = n & 0xf;
+ iRoute iir = rl->begin();
+ for (; iir != rl->end(); ++iir)
+ {
+ //if(*iir == (dst ? bRoute : aRoute))
+ if(*iir == aRoute)
+ break;
+ }
+ if (iir != rl->end())
+ {
+ // disconnect
+ if(dst)
+ {
+ //printf("Song::chooseMidiRoutes removing route src track name: %s dst device name: %s\n", track->name().latin1(), md->name().latin1());
+ audio->msgRemoveRoute(bRoute, aRoute);
+ }
+ else
+ {
+ //printf("Song::chooseMidiRoutes removing route src device name: %s dst track name: %s\n", md->name().latin1(), track->name().latin1());
+ audio->msgRemoveRoute(aRoute, bRoute);
+ }
+ }
+ else
+ {
+ // connect
+ if(dst)
+ {
+ //printf("Song::chooseMidiRoutes adding route src track name: %s dst device name: %s\n", track->name().latin1(), md->name().latin1());
+ audio->msgAddRoute(bRoute, aRoute);
+ }
+ else
+ {
+ //printf("Song::chooseMidiRoutes adding route src device name: %s dst track name: %s\n", md->name().latin1(), track->name().latin1());
+ audio->msgAddRoute(aRoute, bRoute);
+ }
+ }
+
+ //printf("Song::chooseMidiRoutes calling msgUpdateSoloStates\n");
+ audio->msgUpdateSoloStates();
+ //printf("Song::chooseMidiRoutes calling song->update\n");
+ song->update(SC_ROUTE);
+
+ // p3.3.46
+ ///goto _redisplay;
+ }
+ delete pup;
+ parent->setDown(false); // pup->exec() catches mouse release event
+ //printf("Song::chooseMidiRoutes end\n");
+
+ //}
+}
+*/
+
+//---------------------------------------------------------
+// insertTrack0
+//---------------------------------------------------------
+
+void Song::insertTrack0(Track* track, int idx)
+ {
+ insertTrack1(track, idx);
+ insertTrack2(track, idx); // audio->msgInsertTrack(track, idx, false);
+ insertTrack3(track, idx);
+ }
+
+//---------------------------------------------------------
+// insertTrack1
+// non realtime part of insertTrack
+//---------------------------------------------------------
+
+void Song::insertTrack1(Track* track, int /*idx*/)
+ {
+ //printf("Song::insertTrack1 track:%lx\n", track);
+
+ switch(track->type()) {
+ case Track::AUDIO_SOFTSYNTH:
+ {
+ SynthI* s = (SynthI*)track;
+ Synth* sy = s->synth();
+ if (!s->isActivated()) {
+ s->initInstance(sy, s->name());
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ //printf("Song::insertTrack1 end of function\n");
+
+ }
+
+//---------------------------------------------------------
+// insertTrack2
+// realtime part
+//---------------------------------------------------------
+
+void Song::insertTrack2(Track* track, int idx)
+{
+ //printf("Song::insertTrack2 track:%lx\n", track);
+
+ int n;
+ switch(track->type()) {
+ case Track::MIDI:
+ case Track::DRUM:
+ _midis.push_back((MidiTrack*)track);
+ // Added by T356.
+ //((MidiTrack*)track)->addPortCtrlEvents();
+ addPortCtrlEvents(((MidiTrack*)track));
+
+ break;
+ case Track::WAVE:
+ _waves.push_back((WaveTrack*)track);
+ break;
+ case Track::AUDIO_OUTPUT:
+ _outputs.push_back((AudioOutput*)track);
+ // set default master & monitor if not defined
+ if (audio->audioMaster() == 0)
+ audio->setMaster((AudioOutput*)track);
+ if (audio->audioMonitor() == 0)
+ audio->setMonitor((AudioOutput*)track);
+ break;
+ case Track::AUDIO_GROUP:
+ _groups.push_back((AudioGroup*)track);
+ break;
+ case Track::AUDIO_AUX:
+ _auxs.push_back((AudioAux*)track);
+ break;
+ case Track::AUDIO_INPUT:
+ _inputs.push_back((AudioInput*)track);
+ break;
+ case Track::AUDIO_SOFTSYNTH:
+ {
+ SynthI* s = (SynthI*)track;
+ midiDevices.add(s);
+ midiInstruments.push_back(s);
+ _synthIs.push_back(s);
+ }
+ break;
+ default:
+ fprintf(stderr, "unknown track type %d\n", track->type());
+ // abort();
+ return;
+ }
+
+ //
+ // initialize missing aux send
+ //
+ iTrack i = _tracks.index2iterator(idx);
+ //printf("Song::insertTrack2 inserting into _tracks...\n");
+
+ _tracks.insert(i, track);
+ //printf("Song::insertTrack2 inserted\n");
+
+ n = _auxs.size();
+ for (iTrack i = _tracks.begin(); i != _tracks.end(); ++i) {
+ if ((*i)->isMidiTrack())
+ continue;
+ WaveTrack* wt = (WaveTrack*)*i;
+ if (wt->hasAuxSend()) {
+ wt->addAuxSend(n);
+ }
+ }
+
+ /*
+ //
+ // add routes
+ //
+
+ if (track->isMidiTrack())
+ return;
+ AudioTrack* at = (AudioTrack*)track;
+ Route src(at, -1);
+ if (at->type() == Track::AUDIO_OUTPUT) {
+ const RouteList* rl = at->inRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ r->track->outRoutes()->push_back(src);
+ }
+ else if (at->type() == Track::AUDIO_INPUT) {
+ const RouteList* rl = at->outRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ r->track->inRoutes()->push_back(src);
+ }
+ else {
+ const RouteList* rl = at->inRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ r->track->outRoutes()->push_back(src);
+ rl = at->outRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ r->track->inRoutes()->push_back(src);
+ }
+ */
+
+ // p3.3.38
+
+ //
+ // add routes
+ //
+
+ if (track->type() == Track::AUDIO_OUTPUT)
+ {
+ const RouteList* rl = track->inRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ //if(r->track == track)
+ // r->track->outRoutes()->push_back(*r);
+ // p3.3.50
+ Route src(track, r->channel, r->channels);
+ src.remoteChannel = r->remoteChannel;
+ r->track->outRoutes()->push_back(src);
+ }
+ }
+ else if (track->type() == Track::AUDIO_INPUT)
+ {
+ const RouteList* rl = track->outRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ //if(r->track == track)
+ // r->track->inRoutes()->push_back(*r);
+ // p3.3.50
+ Route src(track, r->channel, r->channels);
+ src.remoteChannel = r->remoteChannel;
+ r->track->inRoutes()->push_back(src);
+ }
+ }
+ else if (track->isMidiTrack()) // p3.3.50
+ {
+ const RouteList* rl = track->inRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ //printf("Song::insertTrack2 %s in route port:%d\n", track->name().latin1(), r->midiPort); // p3.3.50
+ Route src(track, r->channel);
+ midiPorts[r->midiPort].outRoutes()->push_back(src);
+ }
+ rl = track->outRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ //printf("Song::insertTrack2 %s out route port:%d\n", track->name().latin1(), r->midiPort); // p3.3.50
+ Route src(track, r->channel);
+ midiPorts[r->midiPort].inRoutes()->push_back(src);
+ }
+ }
+ else
+ {
+ const RouteList* rl = track->inRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ //if(r->track == track)
+ // r->track->outRoutes()->push_back(*r);
+ // p3.3.50
+ Route src(track, r->channel, r->channels);
+ src.remoteChannel = r->remoteChannel;
+ r->track->outRoutes()->push_back(src);
+ }
+ rl = track->outRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ //if(r->track == track)
+ // r->track->inRoutes()->push_back(*r);
+ // p3.3.50
+ Route src(track, r->channel, r->channels);
+ src.remoteChannel = r->remoteChannel;
+ r->track->inRoutes()->push_back(src);
+ }
+ }
+
+ //printf("Song::insertTrack2 end of function\n");
+
+}
+
+//---------------------------------------------------------
+// insertTrack3
+// non realtime part of insertTrack
+//---------------------------------------------------------
+
+void Song::insertTrack3(Track* /*track*/, int /*idx*/)//prevent compiler warning: unused parameter
+{
+ //printf("Song::insertTrack3\n");
+
+ /*
+ switch(track->type()) {
+ case Track::AUDIO_SOFTSYNTH:
+ break;
+ default:
+ break;
+ }
+ */
+}
+
+//---------------------------------------------------------
+// removeTrack0
+//---------------------------------------------------------
+
+void Song::removeTrack0(Track* track)
+ {
+ removeTrack1(track);
+ audio->msgRemoveTrack(track);
+ removeTrack3(track);
+ //delete track;
+ update(SC_TRACK_REMOVED);
+ }
+
+//---------------------------------------------------------
+// removeTrack1
+// non realtime part of removeTrack
+//---------------------------------------------------------
+
+void Song::removeTrack1(Track* track)
+ {
+ switch(track->type())
+ {
+ case Track::WAVE:
+ case Track::AUDIO_OUTPUT:
+ case Track::AUDIO_INPUT:
+ case Track::AUDIO_GROUP:
+ case Track::AUDIO_AUX:
+ case Track::AUDIO_SOFTSYNTH:
+ ((AudioTrack*)track)->deleteAllEfxGuis();
+ break;
+ default:
+ break;
+ }
+
+ switch(track->type())
+ {
+ case Track::AUDIO_OUTPUT:
+ case Track::AUDIO_INPUT:
+ connectJackRoutes((AudioTrack*)track, true);
+ break;
+ case Track::AUDIO_SOFTSYNTH:
+ {
+ SynthI* si = (SynthI*)track;
+ if(si->hasGui())
+ si->showGui(false);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// removeTrack
+// called from RT context
+//---------------------------------------------------------
+
+void Song::removeTrack2(Track* track)
+{
+ //printf("Song::removeTrack2 track:%s\n", track->name().latin1()); // p3.3.50
+
+ switch(track->type()) {
+ case Track::MIDI:
+ case Track::DRUM:
+ // Added by T356.
+ //((MidiTrack*)track)->removePortCtrlEvents();
+ removePortCtrlEvents(((MidiTrack*)track));
+ unchainTrackParts(track, true);
+
+ _midis.erase(track);
+ break;
+ case Track::WAVE:
+ // Added by T356.
+ unchainTrackParts(track, true);
+
+ _waves.erase(track);
+ break;
+ case Track::AUDIO_OUTPUT:
+ _outputs.erase(track);
+ break;
+ case Track::AUDIO_INPUT:
+ _inputs.erase(track);
+ break;
+ case Track::AUDIO_GROUP:
+ _groups.erase(track);
+ break;
+ case Track::AUDIO_AUX:
+ _auxs.erase(track);
+ break;
+ case Track::AUDIO_SOFTSYNTH:
+ {
+ SynthI* s = (SynthI*) track;
+ s->deactivate2();
+ _synthIs.erase(track);
+ }
+ break;
+ }
+ _tracks.erase(track);
+
+
+ /*
+ if (track->isMidiTrack())
+ return;
+ //
+ // remove routes
+ //
+
+ AudioTrack* at = (AudioTrack*)track;
+ Route src(at, -1);
+ if (at->type() == Track::AUDIO_OUTPUT) {
+ const RouteList* rl = at->inRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ r->track->outRoutes()->removeRoute(src);
+ }
+ else if (at->type() == Track::AUDIO_INPUT) {
+ const RouteList* rl = at->outRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ r->track->inRoutes()->removeRoute(src);
+ }
+ else {
+ const RouteList* rl = at->inRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ r->track->outRoutes()->removeRoute(src);
+ rl = at->outRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ r->track->inRoutes()->removeRoute(src);
+ }
+ */
+
+ // p3.3.38
+
+ //
+ // remove routes
+ //
+
+ if (track->type() == Track::AUDIO_OUTPUT)
+ {
+ const RouteList* rl = track->inRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ //if(r->track == track)
+ // r->track->outRoutes()->removeRoute(*r);
+ //printf("Song::removeTrack2 %s audio out track:%s\n", track->name().latin1(), r->track->name().latin1()); // p3.3.50
+ // p3.3.50
+ Route src(track, r->channel, r->channels);
+ src.remoteChannel = r->remoteChannel;
+ r->track->outRoutes()->removeRoute(src);
+ }
+ }
+ else if (track->type() == Track::AUDIO_INPUT)
+ {
+ const RouteList* rl = track->outRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ //if(r->track == track)
+ // r->track->inRoutes()->removeRoute(*r);
+ //printf("Song::removeTrack2 %s audio in track:%s\n", track->name().latin1(), r->track->name().latin1()); // p3.3.50
+ // p3.3.50
+ Route src(track, r->channel, r->channels);
+ src.remoteChannel = r->remoteChannel;
+ r->track->inRoutes()->removeRoute(src);
+ }
+ }
+ else if (track->isMidiTrack()) // p3.3.50
+ {
+ const RouteList* rl = track->inRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ //printf("Song::removeTrack2 %s in route port:%d\n", track->name().latin1(), r->midiPort); // p3.3.50
+ Route src(track, r->channel);
+ midiPorts[r->midiPort].outRoutes()->removeRoute(src);
+ }
+ rl = track->outRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ //printf("Song::removeTrack2 %s out route port:%d\n", track->name().latin1(), r->midiPort); // p3.3.50
+ Route src(track, r->channel);
+ midiPorts[r->midiPort].inRoutes()->removeRoute(src);
+ }
+ }
+ else
+ {
+ const RouteList* rl = track->inRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ //if(r->track == track)
+ // r->track->outRoutes()->removeRoute(*r);
+ //printf("Song::removeTrack2 %s in route track:%s\n", track->name().latin1(), r->track->name().latin1()); // p3.3.50
+ // p3.3.50
+ Route src(track, r->channel, r->channels);
+ src.remoteChannel = r->remoteChannel;
+ r->track->outRoutes()->removeRoute(src);
+ }
+ rl = track->outRoutes();
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ //if(r->track == track)
+ // r->track->inRoutes()->removeRoute(*r);
+ //printf("Song::removeTrack2 %s out route track:%s\n", track->name().latin1(), r->track->name().latin1()); // p3.3.50
+ // p3.3.50
+ Route src(track, r->channel, r->channels);
+ src.remoteChannel = r->remoteChannel;
+ r->track->inRoutes()->removeRoute(src);
+ }
+ }
+
+}
+
+//---------------------------------------------------------
+// removeTrack3
+// non realtime part of removeTrack
+//---------------------------------------------------------
+
+void Song::removeTrack3(Track* /*track*/)//prevent of compiler warning: unused parameter
+ {
+ /*
+ switch(track->type()) {
+ case Track::AUDIO_SOFTSYNTH:
+ {
+ SynthI* s = (SynthI*) track;
+ s->deactivate3();
+ }
+ break;
+ default:
+ break;
+ }
+ */
+ }
+
+
+//---------------------------------------------------------
+// executeScript
+//---------------------------------------------------------
+void Song::executeScript(const char* scriptfile, PartList* parts, int quant, bool onlyIfSelected)
+{
+ // a simple format for external processing
+ // will be extended if there is a need
+ //
+ // Semantics:
+ // PARTLEN <len in ticks>
+ // BEATLEN <len in ticks>
+ // QUANTLEN <len in ticks>
+ // NOTE <tick> <nr> <len in ticks> <velocity>
+ // CONTROLLER <tick> <a> <b> <c>
+ //
+ song->startUndo(); // undo this entire block
+ for (iPart i = parts->begin(); i != parts->end(); i++) {
+ const char* tmp = tmpnam(NULL);
+ printf("script input filename=%s\n",tmp);
+ FILE *fp = fopen(tmp, "w");
+ MidiPart *part = (MidiPart*)(i->second);
+ int partStart = part->endTick()-part->lenTick();
+ int z, n;
+ sigmap.timesig(0, z, n);
+ fprintf(fp, "TIMESIG %d %d\n", z, n);
+ fprintf(fp, "PART %d %d\n", partStart, part->lenTick());
+ fprintf(fp, "BEATLEN %d\n", sigmap.ticksBeat(0));
+ fprintf(fp, "QUANTLEN %d\n", quant);
+
+ //for (iCItem i = items.begin(); i != items.end(); ++i) {
+ for (iEvent e = part->events()->begin(); e != part->events()->end(); e++) {
+ Event ev = e->second;
+
+ if (ev.isNote())
+ {
+ if (onlyIfSelected && ev.selected() == false)
+ continue;
+
+ fprintf(fp,"NOTE %d %d %d %d\n", ev.tick(), ev.dataA(), ev.lenTick(), ev.dataB());
+ // Indicate no undo, and do not do port controller values and clone parts.
+ audio->msgDeleteEvent(ev, part, false, false, false);
+ } else if (ev.type()==Controller) {
+ fprintf(fp,"CONTROLLER %d %d %d %d\n", ev.tick(), ev.dataA(), ev.dataB(), ev.dataC());
+ // Indicate no undo, and do not do port controller values and clone parts.
+ audio->msgDeleteEvent(ev, part, false, false, false);
+ }
+ }
+ fclose(fp);
+
+ // Call external program, let it manipulate the file
+ int pid = fork();
+ if (pid == 0) {
+ if (execlp(scriptfile, scriptfile, tmp, NULL) == -1) {
+ perror("Failed to launch script!");
+ // Get out of here
+
+ // cannot report error through gui, we are in another fork!
+ //@!TODO: Handle unsuccessful attempts
+ exit(99);
+ }
+ exit(0);
+ }
+ else if (pid == -1) {
+ perror("fork failed");
+ }
+ else {
+ int status;
+ waitpid(pid, &status, 0);
+ if (WEXITSTATUS(status) != 0 ) {
+ QMessageBox::warning(muse, tr("MusE - external script failed"),
+ tr("MusE was unable to launch the script\n")
+ );
+ endUndo(SC_EVENT_REMOVED);
+ return;
+ }
+ else { // d0 the fun55or5!
+ // TODO: Create a new part, update the entire editor from it, hehh....
+
+ QFile file(tmp);
+ if ( file.open( QIODevice::ReadOnly ) ) {
+ Q3TextStream stream( &file );
+ QString line;
+ while ( !stream.atEnd() ) {
+ line = stream.readLine(); // line of text excluding '\n'
+ if (line.startsWith("NOTE"))
+ {
+ QStringList sl = QStringList::split(" ",line);
+
+ Event e(Note);
+ int tick = sl[1].toInt();
+ int pitch = sl[2].toInt();
+ int len = sl[3].toInt();
+ int velo = sl[4].toInt();
+ printf ("tick=%d pitch=%d velo=%d len=%d\n", tick,pitch,velo,len);
+ e.setTick(tick);
+ e.setPitch(pitch);
+ e.setVelo(velo);
+ e.setLenTick(len);
+ // Indicate no undo, and do not do port controller values and clone parts.
+ audio->msgAddEvent(e, part, false, false, false);
+ }
+ if (line.startsWith("CONTROLLER"))
+ {
+ QStringList sl = QStringList::split(" ",line);
+
+ Event e(Controller);
+ int tick = sl[1].toInt();
+ int a = sl[2].toInt();
+ int b = sl[3].toInt();
+ int c = sl[4].toInt();
+ printf ("tick=%d a=%d b=%d c=%d\n", tick,a,b,c);
+ e.setA(a);
+ e.setB(b);
+ e.setB(c);
+ // Indicate no undo, and do not do port controller values and clone parts.
+ audio->msgAddEvent(e, part, false, false, false);
+ }
+ }
+ file.close();
+ }
+ }
+ }
+ remove(tmp);
+ }
+
+ endUndo(SC_EVENT_REMOVED);
+}
+
+#define SCRIPTSSUFFIX "/share/muse/scripts/"
+#define USERSCRIPTSSUFFIX "/.muse/scripts/"
+void Song::populateScriptMenu(Q3PopupMenu* menuPlugins, QObject* receiver)
+{
+ //
+ // List scripts
+ //
+ QString distScripts = QString(INSTPREFIX) + QString(SCRIPTSSUFFIX);
+ QString home = "";
+ if (getenv("HOME") != NULL)
+ home = QString(getenv("HOME"));
+ QString userScripts = home + QString(USERSCRIPTSSUFFIX);
+
+ QFileInfo distScriptsFi(distScripts);
+ if (distScriptsFi.isDir()) {
+ QDir dir = QDir(distScripts);
+ dir.setFilter(QDir::Executable | QDir::Files);
+ deliveredScriptNames = dir.entryList();
+ }
+ QFileInfo userScriptsFi(userScripts);
+ if (userScriptsFi.isDir()) {
+ QDir dir(userScripts);
+ dir.setFilter(QDir::Executable | QDir::Files);
+ userScriptNames = dir.entryList();
+ }
+
+ if (deliveredScriptNames.size() > 0 || userScriptNames.size() > 0) {
+ //menuPlugins = new QPopupMenu(this);
+ //menuBar()->insertItem(tr("&Plugins"), menuPlugins);
+ int id = 0;
+ if (deliveredScriptNames.size() > 0) {
+ for (QStringList::Iterator it = deliveredScriptNames.begin(); it != deliveredScriptNames.end(); it++, id++) {
+ //menuPlugins->insertItem(*it, this, SLOT(execDeliveredScript(int)), 0, id);
+ //menuPlugins->insertItem(*it, this, slot_deliveredscripts, 0, id);
+ menuPlugins->insertItem(*it, receiver, SLOT(execDeliveredScript(int)), 0, id);
+ }
+ menuPlugins->insertSeparator();
+ }
+ if (userScriptNames.size() > 0) {
+ for (QStringList::Iterator it = userScriptNames.begin(); it != userScriptNames.end(); it++, id++) {
+ //menuPlugins->insertItem(*it, this, slot_userscripts, 0, id);
+ menuPlugins->insertItem(*it, receiver, SLOT(execUserScript(int)), 0, id);
+ }
+ menuPlugins->insertSeparator();
+ }
+ }
+ return;
+}
+
+//---------------------------------------------------------
+// getScriptPath
+//---------------------------------------------------------
+QString Song::getScriptPath(int id, bool isdelivered)
+{
+ if (isdelivered) {
+ QString path = QString(INSTPREFIX) + SCRIPTSSUFFIX + deliveredScriptNames[id];
+ return path;
+ }
+
+ QString path = QString(getenv("HOME")) + USERSCRIPTSSUFFIX + userScriptNames[id - deliveredScriptNames.size()];
+ return path;
+}
+
diff --git a/muse2/muse/song.h b/muse2/muse/song.h
new file mode 100644
index 00000000..cc7267b7
--- /dev/null
+++ b/muse2/muse/song.h
@@ -0,0 +1,413 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: song.h,v 1.35.2.25 2009/12/15 03:39:58 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SONG_H__
+#define __SONG_H__
+
+#include <qstring.h>
+#include <qobject.h>
+#include <qfont.h>
+//Added by qt3to4:
+#include <Q3PopupMenu>
+#include <QEvent>
+
+#include "pos.h"
+#include "globaldefs.h"
+#include "tempo.h"
+#include "sig.h"
+#include "undo.h"
+#include "track.h"
+
+class SynthI;
+struct MidiMsg;
+struct AudioMsg;
+class Event;
+class Xml;
+class Sequencer;
+class Track;
+class Part;
+class MidiPart;
+class PartList;
+class MPEventList;
+class EventList;
+class MarkerList;
+class Marker;
+class SNode;
+class Q3PopupMenu;
+class QButton;
+
+class MidiPort;
+class MidiDevice;
+class AudioPort;
+class AudioDevice;
+
+#define SC_TRACK_INSERTED 1
+#define SC_TRACK_REMOVED 2
+#define SC_TRACK_MODIFIED 4
+#define SC_PART_INSERTED 8
+#define SC_PART_REMOVED 0x10
+#define SC_PART_MODIFIED 0x20
+#define SC_EVENT_INSERTED 0x40
+#define SC_EVENT_REMOVED 0x80
+#define SC_EVENT_MODIFIED 0x100
+#define SC_SIG 0x200 // timing signature
+#define SC_TEMPO 0x400 // tempo map changed
+#define SC_MASTER 0x800 // master flag changed
+#define SC_SELECTION 0x1000
+#define SC_MIDI_CONTROLLER 0x2000 // must update midi mixer
+#define SC_MUTE 0x4000
+#define SC_SOLO 0x8000
+#define SC_RECFLAG 0x10000
+#define SC_ROUTE 0x20000
+#define SC_CHANNELS 0x40000
+#define SC_CONFIG 0x80000 // midiPort-midiDevice
+#define SC_DRUMMAP 0x100000 // must update drumeditor
+#define SC_MIXER_VOLUME 0x200000
+#define SC_MIXER_PAN 0x400000
+#define SC_AUTOMATION 0x800000
+#define SC_AUX 0x1000000 // mixer aux changed
+#define SC_RACK 0x2000000 // mixer rack changed
+#define SC_CLIP_MODIFIED 0x4000000
+#define SC_MIDI_CONTROLLER_ADD 0x8000000 // a hardware midi controller was added or deleted
+#define SC_MIDI_CHANNEL 0x10000000 // a midi track's channel changed
+
+#define REC_NOTE_FIFO_SIZE 16
+
+//---------------------------------------------------------
+// Song
+//---------------------------------------------------------
+
+class Song : public QObject {
+ Q_OBJECT
+
+ public:
+ enum POS { CPOS = 0, LPOS, RPOS };
+ enum FollowMode { NO, JUMP, CONTINUOUS };
+ enum { REC_OVERDUP, REC_REPLACE };
+ enum { CYCLE_NORMAL, CYCLE_MIX, CYCLE_REPLACE };
+ enum { MARKER_CUR, MARKER_ADD, MARKER_REMOVE, MARKER_NAME,
+ MARKER_TICK, MARKER_LOCK };
+
+ private:
+ // fifo for note-on events
+ // - this events are read by the heart beat interrupt
+ // - used for single step recording in midi editors
+
+ int recNoteFifo[REC_NOTE_FIFO_SIZE];
+ volatile int noteFifoSize;
+ int noteFifoWindex;
+ int noteFifoRindex;
+
+ int updateFlags;
+
+ TrackList _tracks; // tracklist as seen by arranger
+ MidiTrackList _midis;
+ WaveTrackList _waves;
+ InputList _inputs; // audio input ports
+ OutputList _outputs; // audio output ports
+ GroupList _groups; // mixer groups
+ AuxList _auxs; // aux sends
+ SynthIList _synthIs;
+
+ UndoList* undoList;
+ UndoList* redoList;
+ Pos pos[3];
+ Pos _vcpos; // virtual CPOS (locate in progress)
+ MarkerList* _markerList;
+
+ bool _masterFlag;
+ bool loopFlag;
+ bool punchinFlag;
+ bool punchoutFlag;
+ bool recordFlag;
+ bool soloFlag;
+ enum MType _mtype;
+ int _recMode;
+ int _cycleMode;
+ bool _click;
+ bool _quantize;
+ int _recRaster; // Used for audio rec new part snapping. Set by Arranger snap combo box.
+ unsigned _len; // song len in ticks
+ FollowMode _follow;
+ int _globalPitchShift;
+ void readMarker(Xml&);
+
+ QString songInfoStr; // contains user supplied song information, stored in song file.
+ QStringList deliveredScriptNames;
+ QStringList userScriptNames;
+
+ public:
+ Song(const char* name = 0);
+ ~Song();
+
+ void putEvent(int pv);
+ void endMsgCmd();
+ void processMsg(AudioMsg* msg);
+
+ void setMType(MType t);
+ MType mtype() const { return _mtype; }
+
+ void setFollow(FollowMode m) { _follow = m; }
+ FollowMode follow() const { return _follow; }
+
+ bool dirty;
+ WaveTrack* bounceTrack;
+ AudioOutput* bounceOutput;
+ void updatePos();
+
+ void read(Xml&);
+ void write(int, Xml&) const;
+ void writeFont(int level, Xml& xml, const char* name,
+ const QFont& font) const;
+ QFont readFont(Xml& xml, const char* name);
+ QString getSongInfo() { return songInfoStr; }
+ void setSongInfo(QString info) { songInfoStr = info; }
+
+ void clear(bool signal);
+ void update(int flags = -1);
+ void cleanupForQuit();
+
+ int globalPitchShift() const { return _globalPitchShift; }
+ void setGlobalPitchShift(int val) { _globalPitchShift = val; }
+
+ //-----------------------------------------
+ // Marker
+ //-----------------------------------------
+
+ MarkerList* marker() const { return _markerList; }
+ Marker* addMarker(const QString& s, int t, bool lck);
+ Marker* getMarkerAt(int t);
+ void removeMarker(Marker*);
+ Marker* setMarkerName(Marker*, const QString&);
+ Marker* setMarkerTick(Marker*, int);
+ Marker* setMarkerLock(Marker*, bool);
+ void setMarkerCurrent(Marker* m, bool f);
+
+ //-----------------------------------------
+ // transport
+ //-----------------------------------------
+
+ void setPos(int, const Pos&, bool sig = true, bool isSeek = true,
+ bool adjustScrollbar = false);
+ const Pos& cPos() const { return pos[0]; }
+ const Pos& lPos() const { return pos[1]; }
+ const Pos& rPos() const { return pos[2]; }
+ unsigned cpos() const { return pos[0].tick(); }
+ unsigned vcpos() const { return _vcpos.tick(); }
+ const Pos& vcPos() const { return _vcpos; }
+ unsigned lpos() const { return pos[1].tick(); }
+ unsigned rpos() const { return pos[2].tick(); }
+
+ bool loop() const { return loopFlag; }
+ bool record() const { return recordFlag; }
+ bool punchin() const { return punchinFlag; }
+ bool punchout() const { return punchoutFlag; }
+ bool masterFlag() const { return _masterFlag; }
+ void setRecMode(int val) { _recMode = val; }
+ int recMode() const { return _recMode; }
+ void setCycleMode(int val) { _cycleMode = val; }
+ int cycleMode() const { return _cycleMode; }
+ bool click() const { return _click; }
+ bool quantize() const { return _quantize; }
+ void setStopPlay(bool);
+ void stopRolling();
+ void abortRolling();
+
+ //-----------------------------------------
+ // access tempomap/sigmap (Mastertrack)
+ //-----------------------------------------
+
+ unsigned len() const { return _len; }
+ void setLen(unsigned l); // set songlen in ticks
+ int roundUpBar(int tick) const;
+ int roundUpBeat(int tick) const;
+ int roundDownBar(int tick) const;
+ void initLen();
+ void tempoChanged();
+
+ //-----------------------------------------
+ // event manipulations
+ //-----------------------------------------
+
+ //void cmdAddRecordedWave(WaveTrack* track, const Pos&, const Pos&);
+ void cmdAddRecordedWave(WaveTrack* track, Pos, Pos);
+ void cmdAddRecordedEvents(MidiTrack*, EventList*, unsigned);
+ bool addEvent(Event&, Part*);
+ void changeEvent(Event&, Event&, Part*);
+ void deleteEvent(Event&, Part*);
+ void cmdChangeWave(QString original, QString tmpfile, unsigned sx, unsigned ex);
+ void remapPortDrumCtrlEvents(int mapidx, int newnote, int newchan, int newport);
+ void changeAllPortDrumCtrlEvents(bool add, bool drumonly = false);
+
+ //-----------------------------------------
+ // part manipulations
+ //-----------------------------------------
+
+ void cmdResizePart(Track* t, Part* p, unsigned int size);
+ void cmdSplitPart(Track* t, Part* p, int tick);
+ void cmdGluePart(Track* t, Part* p);
+
+ void addPart(Part* part);
+ void removePart(Part* part);
+ void changePart(Part*, Part*);
+ PartList* getSelectedMidiParts() const;
+ PartList* getSelectedWaveParts() const;
+ bool msgRemoveParts();
+
+ //void cmdChangePart(Part* oldPart, Part* newPart);
+ void cmdChangePart(Part* oldPart, Part* newPart, bool doCtrls, bool doClones);
+ void cmdRemovePart(Part* part);
+ void cmdAddPart(Part* part);
+ int recRaster() { return _recRaster; } // Used by Song::cmdAddRecordedWave to snap new wave parts
+ void setRecRaster(int r) { _recRaster = r; } // Used by Arranger snap combo box
+
+ //-----------------------------------------
+ // track manipulations
+ //-----------------------------------------
+
+ TrackList* tracks() { return &_tracks; }
+ MidiTrackList* midis() { return &_midis; }
+ WaveTrackList* waves() { return &_waves; }
+ InputList* inputs() { return &_inputs; }
+ OutputList* outputs() { return &_outputs; }
+ GroupList* groups() { return &_groups; }
+ AuxList* auxs() { return &_auxs; }
+ SynthIList* syntis() { return &_synthIs; }
+
+ void cmdRemoveTrack(Track* track);
+ void removeTrack0(Track* track);
+ void removeTrack1(Track* track);
+ void removeTrack2(Track* track);
+ void removeTrack3(Track* track);
+ void removeMarkedTracks();
+ void changeTrack(Track* oldTrack, Track* newTrack);
+ MidiTrack* findTrack(const Part* part) const;
+ Track* findTrack(const QString& name) const;
+ void swapTracks(int i1, int i2);
+ void setChannelMute(int channel, bool flag);
+ void setRecordFlag(Track*, bool);
+ void insertTrack0(Track*, int idx);
+ void insertTrack1(Track*, int idx);
+ void insertTrack2(Track*, int idx);
+ void insertTrack3(Track*, int idx);
+ void deselectTracks();
+ void readRoute(Xml& xml);
+ void recordEvent(MidiTrack*, Event&);
+ void msgInsertTrack(Track* track, int idx, bool u = true);
+ void clearRecAutomation(bool clearList);
+ void processAutomationEvents();
+ int execAutomationCtlPopup(AudioTrack*, const QPoint&, int);
+ int execMidiAutomationCtlPopup(MidiTrack*, MidiPart*, const QPoint&, int);
+ void connectJackRoutes(AudioTrack* track, bool disconnect);
+ void updateSoloStates();
+ //void chooseMidiRoutes(QButton* /*parent*/, MidiTrack* /*track*/, bool /*dst*/);
+
+ //-----------------------------------------
+ // undo, redo
+ //-----------------------------------------
+
+ void startUndo();
+ void endUndo(int);
+ //void undoOp(UndoOp::UndoType, Track* oTrack, Track* nTrack);
+ void undoOp(UndoOp::UndoType, int n, Track* oTrack, Track* nTrack);
+ void undoOp(UndoOp::UndoType, int, Track*);
+ void undoOp(UndoOp::UndoType, int, int, int = 0);
+ void undoOp(UndoOp::UndoType, Part*);
+ //void undoOp(UndoOp::UndoType, Event& nevent, Part*);
+ void undoOp(UndoOp::UndoType, Event& nevent, Part*, bool doCtrls, bool doClones);
+ //void undoOp(UndoOp::UndoType, Event& oevent, Event& nevent, Part*);
+ void undoOp(UndoOp::UndoType, Event& oevent, Event& nevent, Part*, bool doCtrls, bool doClones);
+ void undoOp(UndoOp::UndoType, SigEvent* oevent, SigEvent* nevent);
+ void undoOp(UndoOp::UndoType, int channel, int ctrl, int oval, int nval);
+ //void undoOp(UndoOp::UndoType, Part* oPart, Part* nPart);
+ void undoOp(UndoOp::UndoType, Part* oPart, Part* nPart, bool doCtrls, bool doClones);
+ void undoOp(UndoOp::UndoType type, const char* changedFile, const char* changeData, int startframe, int endframe);
+ void undoOp(UndoOp::UndoType type, Marker* copyMarker, Marker* realMarker);
+ bool doUndo1();
+ void doUndo2();
+ void doUndo3();
+ bool doRedo1();
+ void doRedo2();
+ void doRedo3();
+
+ void addUndo(UndoOp& i);
+
+ //-----------------------------------------
+ // Configuration
+ //-----------------------------------------
+
+ //SynthI* createSynthI(const QString& sclass);
+ SynthI* createSynthI(const QString& sclass, const QString& label = QString());
+
+ void rescanAlsaPorts();
+
+ //-----------------------------------------
+ // Debug
+ //-----------------------------------------
+
+ void dumpMaster();
+ void addUpdateFlags(int f) { updateFlags |= f; }
+
+ //-----------------------------------------
+ // Python bridge related
+ //-----------------------------------------
+#ifdef ENABLE_PYTHON
+ virtual bool event (QEvent* e );
+#endif
+ void executeScript(const char* scriptfile, PartList* parts, int quant, bool onlyIfSelected);
+
+ public slots:
+ void beat();
+
+ void undo();
+ void redo();
+
+ void setTempo(int t);
+ void setSig(int a, int b);
+ void setTempo(double tempo) { setTempo(int(60000000.0/tempo)); }
+
+ void setMasterFlag(bool flag);
+ bool getLoop() { return loopFlag; }
+ void setLoop(bool f);
+ void setRecord(bool f, bool autoRecEnable = true);
+ void clearTrackRec();
+ void setPlay(bool f);
+ void setStop(bool);
+ void forward();
+ void rewindStart();
+ void rewind();
+ void setPunchin(bool f);
+ void setPunchout(bool f);
+ void setClick(bool val);
+ void setQuantize(bool val);
+ void panic();
+ void seqSignal(int fd);
+ Track* addTrack(int);
+ Track* addNewTrack(int);
+ QString getScriptPath(int id, bool delivered);
+ void populateScriptMenu(Q3PopupMenu* menuPlugins, QObject* receiver);
+
+ signals:
+ void songChanged(int);
+ void posChanged(int, unsigned, bool);
+ void loopChanged(bool);
+ void recordChanged(bool);
+ void playChanged(bool);
+ void punchinChanged(bool);
+ void punchoutChanged(bool);
+ void clickChanged(bool);
+ void quantizeChanged(bool);
+ void markerChanged(int);
+ void midiPortsChanged();
+ void midiNote(int pitch, int velo);
+ };
+
+extern Song* song;
+
+#endif
+
diff --git a/muse2/muse/songfile.cpp b/muse2/muse/songfile.cpp
new file mode 100644
index 00000000..b13cb07a
--- /dev/null
+++ b/muse2/muse/songfile.cpp
@@ -0,0 +1,1507 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: songfile.cpp,v 1.25.2.12 2009/11/04 15:06:07 spamatica Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <assert.h>
+#include <qmessagebox.h>
+#include <uuid/uuid.h>
+
+#include "app.h"
+#include "song.h"
+#include "arranger.h"
+#include "transport.h"
+#include "cobject.h"
+#include "drumedit.h"
+#include "pianoroll.h"
+#include "globals.h"
+#include "xml.h"
+#include "drummap.h"
+#include "event.h"
+#include "marker/marker.h"
+#include "midiport.h"
+#include "audio.h"
+#include "mitplugin.h"
+#include "wave.h"
+#include "midictrl.h"
+#include "amixer.h"
+#include "conf.h"
+#include "driver/jackmidi.h"
+
+//struct ClonePart {
+ //const EventList* el;
+// const Part* cp;
+// int id;
+ //ClonePart(const EventList* e, int i) : el(e), id(i) {}
+// ClonePart(const Part* p, int i) : cp(p), id(i) {}
+// };
+
+//typedef std::list<ClonePart> CloneList;
+//typedef CloneList::iterator iClone;
+
+//---------------------------------------------------------
+// ClonePart
+//---------------------------------------------------------
+
+ClonePart::ClonePart(const Part* p, int i)
+{
+ cp = p;
+ id = i;
+ uuid_generate(uuid);
+}
+
+//static CloneList cloneList;
+//static CloneList copyCloneList;
+CloneList cloneList;
+//CloneList copyCloneList;
+
+/*
+//---------------------------------------------------------
+// updateCloneList
+//---------------------------------------------------------
+
+void updateCloneList(Part* oPart, Part* nPart)
+{
+ for(iClone i = cloneList.begin(); i != cloneList.end(); ++i)
+ {
+ if(i->cp == oPart)
+ {
+ i->cp = nPart;
+ break;
+ }
+ }
+}
+
+void updateCloneList(PartList* oParts, PartList* nParts)
+{
+ for(iPart ip = oParts->begin(); ip != oParts->end(); ++ip)
+ {
+ for(iClone i = cloneList.begin(); i != cloneList.end(); ++i)
+ {
+ if(i->cp == oPart)
+ {
+ i->cp = nPart;
+ break;
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------
+// clearClipboardAndCloneList
+//---------------------------------------------------------
+
+void clearClipboardAndCloneList()
+{
+ //QApplication::clipboard()->clear(QClipboard::Clipboard);
+ cloneList.clear();
+}
+*/
+
+//---------------------------------------------------------
+// NKey::write
+//---------------------------------------------------------
+
+void NKey::write(int level, Xml& xml) const
+ {
+ xml.intTag(level, "key", val);
+ }
+
+//---------------------------------------------------------
+// NKey::read
+//---------------------------------------------------------
+
+void NKey::read(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::Text:
+ val = xml.s1().toInt();
+ break;
+ case Xml::TagEnd:
+ if (xml.s1() == "key")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// Scale::write
+//---------------------------------------------------------
+
+void Scale::write(int level, Xml& xml) const
+ {
+ xml.intTag(level, "scale", val);
+ }
+
+//---------------------------------------------------------
+// Scale::read
+//---------------------------------------------------------
+
+void Scale::read(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::Text:
+ val = xml.s1().toInt();
+ break;
+ case Xml::TagEnd:
+ if (xml.s1() == "scale")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// readXmlPart
+//---------------------------------------------------------
+
+Part* readXmlPart(Xml& xml, Track* track, bool doClone, bool toTrack)
+ {
+ int id = -1;
+ Part* npart = 0;
+ uuid_t uuid;
+ uuid_clear(uuid);
+ bool uuidvalid = false;
+ bool clone = true;
+ bool wave = false;
+ bool isclone = false;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return npart;
+ case Xml::TagStart:
+ // If the part has not been created yet...
+ if(!npart)
+ {
+ // If an id was found...
+ if(id != -1)
+ {
+ for(iClone i = cloneList.begin(); i != cloneList.end(); ++i)
+ {
+ // Is a matching part found in the clone list?
+ if(i->id == id)
+ {
+ // If it's a regular paste (not paste clone), and the original part is
+ // not a clone, defer so that a new copy is created in TagStart above.
+ //if(!doClone && i->cp->cevents()->arefCount() <= 1)
+ //if(!doClone && !isclone)
+ // break;
+
+ // This makes a clone, chains the part, and increases ref counts.
+ npart = track->newPart((Part*)i->cp, true);
+ break;
+ }
+ }
+ }
+ else
+ // If a uuid was found...
+ if(uuidvalid)
+ {
+ for(iClone i = cloneList.begin(); i != cloneList.end(); ++i)
+ {
+ // Is a matching part found in the clone list?
+ if(uuid_compare(uuid, i->uuid) == 0)
+ {
+ Track* cpt = i->cp->track();
+ // If we want to paste to the given track...
+ if(toTrack)
+ {
+ // If the given track type is not the same as the part's
+ // original track type, we can't continue. Just return.
+ if(!track || cpt->type() != track->type())
+ {
+ xml.skip("part");
+ return 0;
+ }
+ }
+ else
+ // ...else we want to paste to the part's original track.
+ {
+ // Make sure the track exists (has not been deleted).
+ if((cpt->isMidiTrack() && song->midis()->find(cpt) != song->midis()->end()) ||
+ (cpt->type() == Track::WAVE && song->waves()->find(cpt) != song->waves()->end()))
+ track = cpt;
+ else
+ // Track was not found. Try pasting to the given track, as above...
+ {
+ if(!track || cpt->type() != track->type())
+ {
+ // No luck. Just return.
+ xml.skip("part");
+ return 0;
+ }
+ }
+ }
+
+ // If it's a regular paste (not paste clone), and the original part is
+ // not a clone, defer so that a new copy is created in TagStart above.
+ //if(!doClone && i->cp->cevents()->arefCount() <= 1)
+ if(!doClone && !isclone)
+ break;
+
+ // This makes a clone, chains the part, and increases ref counts.
+ npart = track->newPart((Part*)i->cp, true);
+ break;
+ }
+ }
+ }
+
+ // If the part still has not been created yet...
+ if(!npart)
+ {
+ // A clone was not created from any matching part. Create a non-clone part now.
+ if(!track)
+ {
+ xml.skip("part");
+ return 0;
+ }
+ // If we're pasting to selected track and the 'wave'
+ // variable is valid, check for mismatch...
+ if(toTrack && uuidvalid)
+ {
+ // If both the part and track are not midi or wave...
+ if((wave && track->isMidiTrack()) ||
+ (!wave && track->type() == Track::WAVE))
+ {
+ xml.skip("part");
+ return 0;
+ }
+ }
+
+ if (track->isMidiTrack())
+ npart = new MidiPart((MidiTrack*)track);
+ else if (track->type() == Track::WAVE)
+ npart = new WavePart((WaveTrack*)track);
+ else
+ {
+ xml.skip("part");
+ return 0;
+ }
+
+ // Signify a new non-clone part was created.
+ // Even if the original part was itself a clone, clear this because the
+ // attribute section did not create a clone from any matching part.
+ clone = false;
+
+ // If an id or uuid was found, add the part to the clone list
+ // so that subsequent parts can look it up and clone from it...
+ if(id != -1)
+ {
+ ClonePart ncp(npart, id);
+ cloneList.push_back(ncp);
+ }
+ else
+ if(uuidvalid)
+ {
+ ClonePart ncp(npart);
+ // New ClonePart creates its own uuid, but we need to replace it.
+ uuid_copy(ncp.uuid, uuid);
+ cloneList.push_back(ncp);
+ }
+ }
+ }
+
+ if (tag == "name")
+ npart->setName(xml.parse1());
+ else if (tag == "poslen") {
+ ((PosLen*)npart)->read(xml, "poslen");
+ }
+ else if (tag == "pos") {
+ Pos pos;
+ pos.read(xml, "pos"); // obsolete
+ npart->setTick(pos.tick());
+ }
+ else if (tag == "len") {
+ Pos len;
+ len.read(xml, "len"); // obsolete
+ npart->setLenTick(len.tick());
+ }
+ else if (tag == "selected")
+ npart->setSelected(xml.parseInt());
+ else if (tag == "color")
+ npart->setColorIndex(xml.parseInt());
+ else if (tag == "mute")
+ npart->setMute(xml.parseInt());
+ else if (tag == "event")
+ {
+ // If a new non-clone part was created, accept the events...
+ if(!clone)
+ {
+ EventType type = Wave;
+ if(track->isMidiTrack())
+ type = Note;
+ Event e(type);
+ e.read(xml);
+ // stored tickpos for event has absolute value. However internally
+ // tickpos is relative to start of part, we substract tick().
+ // TODO: better handling for wave event
+ e.move( -npart->tick() );
+ int tick = e.tick();
+
+ // Do not discard events belonging to clone parts,
+ // at least not yet. A later clone might have a longer,
+ // fully accommodating part length!
+ //if ((tick < 0) || (tick >= (int) lenTick())) {
+ //if ((tick < 0) || ( id == -1 && !clone && (tick >= (int)lenTick()) ))
+ // No way to tell at the moment whether there will be clones referencing this...
+ // No choice but to accept all events past 0.
+ if(tick < 0)
+ {
+ //printf("readClone: warning: event not in part: %d - %d -%d, discarded\n",
+ printf("readClone: warning: event at tick:%d not in part:%s, discarded\n",
+ tick, npart->name().latin1());
+ }
+ else
+ {
+ npart->events()->add(e);
+ }
+ }
+ else
+ // ...Otherwise a clone was created, so we don't need the events.
+ xml.skip(tag);
+ }
+ else
+ xml.unknown("readXmlPart");
+ break;
+ case Xml::Attribut:
+ if (tag == "type")
+ {
+ if(xml.s2() == "wave")
+ wave = true;
+ }
+ else if (tag == "cloneId")
+ {
+ id = xml.s2().toInt();
+ //if(id != -1)
+ //{
+ // for(iClone i = cloneList.begin(); i != cloneList.end(); ++i)
+ // {
+ // Is a matching part found in the clone list?
+ // if(i->id == id)
+ // {
+ // If it's a regular paste (not paste clone), and the original part is
+ // not a clone, defer so that a new copy is created in TagStart above.
+ //if(!doClone && i->cp->cevents()->arefCount() <= 1)
+ //if(!doClone && !isclone)
+ // break;
+
+ // This makes a clone, chains the part, and increases ref counts.
+ // npart = track->newPart((Part*)i->cp, true);
+ // break;
+ // }
+ // }
+ //}
+ }
+ else if (tag == "uuid")
+ {
+ uuid_parse(xml.s2().latin1(), uuid);
+ if(!uuid_is_null(uuid))
+ {
+ uuidvalid = true;
+ /*
+ for(iClone i = cloneList.begin(); i != cloneList.end(); ++i)
+ {
+ // Is a matching part found in the clone list?
+ if(uuid_compare(uuid, i->uuid) == 0)
+ {
+ Track* cpt = i->cp->track();
+ // If we want to paste to the given track...
+ if(toTrack)
+ {
+ // If the given track type is not the same as the part's
+ // original track type, we can't continue. Just return.
+ if(!track || cpt->type() != track->type())
+ {
+ xml.skip("part");
+ return 0;
+ }
+ }
+ else
+ // ...else we want to paste to the part's original track.
+ {
+ // Make sure the track exists (has not been deleted).
+ if((cpt->isMidiTrack() && song->midis()->find(cpt) != song->midis()->end()) ||
+ (cpt->type() == Track::WAVE && song->waves()->find(cpt) != song->waves()->end()))
+ track = cpt;
+ else
+ // Track was not found. Try pasting to the given track, as above...
+ {
+ if(!track || cpt->type() != track->type())
+ {
+ // No luck. Just return.
+ xml.skip("part");
+ return 0;
+ }
+ }
+ }
+
+ // If it's a regular paste (not paste clone), and the original part is
+ // not a clone, defer so that a new copy is created in TagStart above.
+ //if(!doClone && i->cp->cevents()->arefCount() <= 1)
+ if(!doClone && !isclone)
+ break;
+
+ // This makes a clone, chains the part, and increases ref counts.
+ npart = track->newPart((Part*)i->cp, true);
+ break;
+ }
+ }
+ */
+ }
+ }
+ else if(tag == "isclone")
+ isclone = xml.s2().toInt();
+ break;
+ case Xml::TagEnd:
+ if (tag == "part")
+ return npart;
+ default:
+ break;
+ }
+ }
+ return npart;
+}
+
+//---------------------------------------------------------
+// Part::write
+// If isCopy is true, write the xml differently so that
+// we can have 'Paste Clone' feature.
+//---------------------------------------------------------
+
+//void Part::write(int level, Xml& xml) const
+void Part::write(int level, Xml& xml, bool isCopy, bool forceWavePaths) const
+ {
+ const EventList* el = cevents();
+ int id = -1;
+ uuid_t uuid;
+ uuid_clear(uuid);
+ bool dumpEvents = true;
+ bool wave = _track->type() == Track::WAVE;
+
+ if(isCopy)
+ {
+ //for(iClone i = copyCloneList.begin(); i != copyCloneList.end(); ++i)
+ for(iClone i = cloneList.begin(); i != cloneList.end(); ++i)
+ {
+ //if(i->el == el) {
+ if(i->cp->cevents() == el)
+ {
+ //id = i->id;
+ uuid_copy(uuid, i->uuid);
+ dumpEvents = false;
+ break;
+ }
+ }
+ //if(id == -1)
+ if(uuid_is_null(uuid))
+ {
+ //id = copyCloneList.size();
+ //id = cloneList.size();
+ //ClonePart cp(el, id);
+ //ClonePart cp(this, id);
+ ClonePart cp(this);
+ uuid_copy(uuid, cp.uuid);
+ //copyCloneList.push_back(cp);
+ cloneList.push_back(cp);
+ }
+ }
+ else
+ {
+ if (el->arefCount() > 1)
+ {
+ for (iClone i = cloneList.begin(); i != cloneList.end(); ++i)
+ {
+ //if (i->el == el) {
+ if (i->cp->cevents() == el)
+ {
+ id = i->id;
+ //uuid_copy(id, i->uid);
+ dumpEvents = false;
+ break;
+ }
+ }
+ if (id == -1)
+ //if(uuid_is_null(id))
+ {
+ id = cloneList.size();
+ //ClonePart cp(el, id);
+ ClonePart cp(this, id);
+ //ClonePart cp(this);
+ cloneList.push_back(cp);
+ }
+ }
+ }
+
+ // Special markers if this is a copy operation and the
+ // part is a clone.
+ if(isCopy)
+ {
+ char sid[40]; // uuid string is 36 chars. Try 40 for good luck.
+ sid[0] = 0;
+ uuid_unparse_lower(uuid, sid);
+ //if(midi)
+ // xml.nput(level, "<midipart uuid=\"%s\"", sid);
+ //else
+ if(wave)
+ xml.nput(level, "<part type=\"wave\" uuid=\"%s\"", sid);
+ else
+ xml.nput(level, "<part uuid=\"%s\"", sid);
+
+ if(el->arefCount() > 1)
+ xml.nput(" isclone=\"1\"");
+ xml.put(">");
+ level++;
+ }
+ else
+ if (id != -1)
+ //if(!uuid_is_null(id))
+ {
+ xml.tag(level++, "part cloneId=\"%d\"", id);
+ //char sid[40]; // uuid string is 36 chars. Try 40 for good luck.
+ //sid[0] = 0;
+ //uuid_unparse_lower(id, sid);
+ //xml.tag(level++, "part cloneId=\"%s\"", sid);
+ }
+ else
+ xml.tag(level++, "part");
+
+ xml.strTag(level, "name", _name);
+
+// PosLen poslen(*this);
+// int tickpos = tick();
+// poslen.setTick(tickpos);
+ PosLen::write(level, xml, "poslen");
+ xml.intTag(level, "selected", _selected);
+ xml.intTag(level, "color", _colorIndex);
+ if (_mute)
+ xml.intTag(level, "mute", _mute);
+ if (dumpEvents) {
+ for (ciEvent e = el->begin(); e != el->end(); ++e)
+ //e->second.write(level, xml, *this);
+ e->second.write(level, xml, *this, forceWavePaths);
+ }
+ xml.etag(level, "part");
+ }
+
+/*
+//---------------------------------------------------------
+// Part::read
+//---------------------------------------------------------
+
+void Part::read(Xml& xml, int, bool toTrack) // int newPartOffset
+ {
+ int id = -1;
+ bool containsEvents = false;
+ uuid_t uuid;
+ uuid_clear(uuid);
+ bool uuidvalid = false;
+ bool clone = false;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "name")
+ _name = xml.parse1();
+ else if (tag == "poslen") {
+ PosLen::read(xml, "poslen");
+ }
+ else if (tag == "pos") {
+ Pos pos;
+ pos.read(xml, "pos"); // obsolete
+ setTick(pos.tick());
+ }
+ else if (tag == "len") {
+ Pos len;
+ len.read(xml, "len"); // obsolete
+ setLenTick(len.tick());
+ }
+ else if (tag == "selected")
+ _selected = xml.parseInt();
+ else if (tag == "color")
+ _colorIndex = xml.parseInt();
+ else if (tag == "mute")
+ _mute = xml.parseInt();
+ else if (tag == "event") {
+ containsEvents = true;
+ EventType type = Wave;
+ if (_track->isMidiTrack())
+ type = Note;
+ Event e(type);
+ e.read(xml);
+ // stored tickpos for event has absolute value. However internally
+ // tickpos is relative to start of part, we substract tick().
+ // TODO: better handling for wave event
+ e.move(-tick());
+ int tick = e.tick();
+
+ // Changed by T356. Do not discard events belonging to clone parts,
+ // at least not yet. A later clone might have a longer,
+ // fully accommodating part length!
+ //if ((tick < 0) || (tick >= (int) lenTick())) {
+ if ((tick < 0) || ( id == -1 && !clone && (tick >= (int)lenTick()) ))
+ {
+ //printf("Part::read: warning: event not in part: %d - %d -%d, discarded\n",
+ printf("Part::read: warning: event at tick:%d not in part:%s, discarded\n",
+ tick, name().latin1());
+ }
+ else {
+ _events->add(e);
+*/
+
+
+ /*
+ // TODO: This should NOT be done here since the event list
+ // might be deleted below. Since after reading a part it
+ // likely (always?) that (msg)AddPart() or (msg)ChangePart()
+ // will be called (must check if they're ever called BEFORE
+ // Part::read), then those routines will take care of it,
+ // they are already coded to do so.
+ // Note the redundancy of doing it here AND (msg)Add/ChangePart !
+ // Try to eliminate this section altogether by verifying that
+ // (msg)Add/ChangePart (or one of the other routines which add port
+ // controller values) is always called after Part::read...
+ if (e.type() == Controller) {
+ MidiTrack* mt = (MidiTrack*)_track;
+ int channel = mt->outChannel();
+ MidiPort* mp = &midiPorts[mt->outPort()];
+ // tick is relative to part, controller needs an absolute value hence
+ // part offset is added. If newPartOffset was given we use that instead of
+ // the recorded offset!
+ if (!newPartOffset)
+ newPartOffset=this->tick();
+
+ int ctl = e.dataA();
+ if(mt->type() == Track::DRUM)
+ {
+ // Is it a drum controller event, according to the track port's instrument?
+ MidiController* mc = mp->drumController(ctl);
+ if(mc)
+ {
+ int note = ctl & 0x7f;
+ ctl &= ~0xff;
+ channel = drumMap[note].channel;
+ mp = &midiPorts[drumMap[note].port];
+ ctl |= drumMap[note].anote;
+ }
+ }
+
+ // Removed by T356
+ // check if controller exists
+ //if (mp->hwCtrlState(channel, e.dataA()) == CTRL_VAL_UNKNOWN) {
+ // mp->addManagedController(channel, e.dataA());
+ // }
+
+ // Changed by T356
+ // add controller value
+ //mp->setCtrl(channel, tick+newPartOffset, e.dataA(), e.dataB());
+ mp->setControllerVal(channel, tick+newPartOffset, ctl, e.dataB(), this);
+ }
+ */
+/*
+ }
+ }
+ else
+ xml.unknown("Part::read");
+ break;
+ case Xml::Attribut:
+ if (tag == "cloneId")
+ id = xml.s2().toInt();
+ else if (tag == "uuid")
+ {
+ uuid_parse(xml.s2().latin1(), uuid);
+ if(!uuid_is_null(uuid))
+ uuidvalid = true;
+ }
+ else if (tag == "isclone")
+ clone = xml.s2().toInt();
+ break;
+ case Xml::TagEnd:
+ if (tag == "part")
+ {
+*/
+ /*
+ if (id != -1)
+ {
+
+ // clone part
+ if (containsEvents) {
+ // add to cloneList:
+ //ClonePart cp(_events, id);
+ ClonePart cp(this, id);
+ cloneList.push_back(cp);
+ }
+ else {
+ // replace event list with clone event
+ // list
+ for (iClone i = cloneList.begin();
+ i != cloneList.end(); ++i) {
+ if (i->id == id) {
+ delete _events;
+ //_events = (EventList*)(i->el);
+ _events = (EventList*)(i->cp->cevents());
+ _events->incRef(1);
+ _events->incARef(1);
+ //i->cp->chainClone(this);
+ chainClone((Part*)i->cp, this);
+ break;
+ }
+ }
+ }
+ */
+
+/*
+ if(id != -1)
+ {
+ // See if the part exists in the clone list.
+ // The clone list is also the copy/paste clone list.
+ // Care must be taken to ensure the list is ALWAYS EMPTY
+ // before loading or dropping parts INTO muse, because the
+ // current song parts are NOT the same as when the imported parts
+ // were created, (even if they were created from the current session,
+ // we should NOT look them up). Always back up the list, clear it,
+ // read part(s), then restore the list so that paste works after.
+ Part* cp = 0;
+ for(iClone i = cloneList.begin(); i != cloneList.end(); ++i)
+ {
+ if(i->id == id)
+ {
+ cp = (Part*)i->cp;
+ break;
+ }
+ }
+ // Was a matching part found in the clone list?
+ if(cp)
+ {
+ // Make this part a clone of that part. Use its event list...
+ delete _events;
+ _events = (EventList*)(cp->cevents());
+ _events->incRef(1);
+ _events->incARef(1);
+ chainClone(cp, this);
+ }
+ else
+ {
+ // No matching part to clone was found in the clone list.
+ // Does the part contain some events?
+ //if(containsEvents)
+ {
+ // Add the part to the clone list so that subsequent parts
+ // can look it up and clone from it...
+ ClonePart ncp(this, id);
+ cloneList.push_back(ncp);
+ }
+ // Otherwise this part has no matching part in the clone list
+ // and no events of its own. Nothing left to do, we now have
+ // a blank part with the original offset, colour etc.
+ }
+ }
+ else
+ // If a uuid was found, do the same as above. Using uuids
+ // allows foolproof rejection of copied parts not found
+ // in the clone list, particularly when copying parts from
+ // another instance of muse.
+ if(uuidvalid)
+ {
+ Part* cp = 0;
+ for(iClone i = cloneList.begin(); i != cloneList.end(); ++i)
+ {
+ if(uuid_compare(uuid, i->uuid) == 0)
+ {
+ cp = (Part*)i->cp;
+ break;
+ }
+ }
+ // If a matching part was found, and we want to paste to the original track...
+ if(cp && !toTrack)
+ {
+ // Make sure the track exists (has not been deleted).
+ if((cp->track()->isMidiTrack() && song->midis()->find(cp->track()) != song->midis()->end()) ||
+ (cp->track()->type() == Track::WAVE && song->waves()->find(cp->track()) != song->waves()->end()))
+ setTrack(cp->track());
+ }
+ // Was a matching part found in the clone list, and was it
+ // originally a clone part?
+ if(cp && clone)
+ {
+ // Make this part a clone of that part. Use its event list...
+ delete _events;
+ _events = (EventList*)(cp->cevents());
+ _events->incRef(1);
+ _events->incARef(1);
+ // Chain the clone.
+ // Use the slower function which makes sure it chains to a part
+ // within a valid (non-deleted) track.
+ //chainClone(cp, this);
+ chainClone(this);
+ }
+ else
+ {
+ // No matching part to clone was found in the clone list.
+ // Does the part contain some events?
+ //if(containsEvents)
+ {
+ // Add the part to the clone list so that subsequent parts
+ // can look it up and clone from it...
+ ClonePart ncp(this);
+ // New ClonePart creates its own uuid, but we need to replace it.
+ uuid_copy(ncp.uuid, uuid);
+ cloneList.push_back(ncp);
+ }
+ }
+ }
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+*/
+
+//---------------------------------------------------------
+// writeFont
+//---------------------------------------------------------
+
+void Song::writeFont(int level, Xml& xml, const char* name,
+ const QFont& font) const
+ {
+ xml.nput(level, "<%s family=\"%s\" size=\"%d\"",
+ //name, font.family().latin1(), font.pointSize());
+ name, Xml::xmlString(font.family()).latin1(), font.pointSize());
+ if (font.weight() != QFont::Normal)
+ xml.nput(" weight=\"%d\"", font.weight());
+ if (font.italic())
+ xml.nput(" italic=\"1\"");
+ xml.nput(" />\n");
+ }
+
+//---------------------------------------------------------
+// readFont
+//---------------------------------------------------------
+
+QFont Song::readFont(Xml& xml, const char* name)
+ {
+ QFont f;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return f;
+ case Xml::TagStart:
+ xml.unknown("readFont");
+ break;
+ case Xml::Attribut:
+ if (xml.s1() == "family")
+ f.setFamily(xml.s2());
+ else if (xml.s1() == "size")
+ f.setPointSize(xml.s2().toInt());
+ else if (xml.s1() == "weight")
+ f.setWeight(xml.s2().toInt());
+ else if (xml.s1() == "italic")
+ f.setItalic(xml.s2().toInt());
+ break;
+ case Xml::TagEnd:
+ if (xml.s1() == name)
+ return f;
+ default:
+ break;
+ }
+ }
+ return f;
+ }
+
+//---------------------------------------------------------
+// readPart
+//---------------------------------------------------------
+
+Part* MusE::readPart(Xml& xml)
+ {
+ Part* part = 0;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return part;
+ case Xml::Text:
+ {
+ int trackIdx, partIdx;
+ sscanf(tag.latin1(), "%d:%d", &trackIdx, &partIdx);
+ Track* track = song->tracks()->index(trackIdx);
+ if (track)
+ part = track->parts()->find(partIdx);
+ }
+ break;
+ case Xml::TagStart:
+ xml.unknown("readPart");
+ break;
+ case Xml::TagEnd:
+ if (tag == "part")
+ return part;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// readToplevels
+//---------------------------------------------------------
+
+void MusE::readToplevels(Xml& xml)
+ {
+ PartList* pl = new PartList;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "part") {
+ Part* part = readPart(xml);
+ if (part)
+ pl->add(part);
+ }
+ else if (tag == "pianoroll") {
+ // p3.3.34
+ // Do not open if there are no parts.
+ // Had bogus '-1' part index for list edit in med file,
+ // causing list edit to segfault on song load.
+ // Somehow that -1 was put there on write, because the
+ // current part didn't exist anymore, so no index number
+ // could be found for it on write. Watching... may be fixed.
+ // But for now be safe for all the top levels...
+ if(!pl->empty())
+ {
+
+ startPianoroll(pl);
+ toplevels.back().cobject()->readStatus(xml);
+ pl = new PartList;
+ }
+ }
+ else if (tag == "drumedit") {
+ if(!pl->empty())
+ {
+ startDrumEditor(pl);
+ toplevels.back().cobject()->readStatus(xml);
+ pl = new PartList;
+ }
+ }
+ else if (tag == "listeditor") {
+ if(!pl->empty())
+ {
+ startListEditor(pl);
+ toplevels.back().cobject()->readStatus(xml);
+ pl = new PartList;
+ }
+ }
+ else if (tag == "master") {
+ startMasterEditor();
+ toplevels.back().cobject()->readStatus(xml);
+ }
+ else if (tag == "lmaster") {
+ startLMasterEditor();
+ toplevels.back().cobject()->readStatus(xml);
+ }
+ else if (tag == "marker") {
+ showMarker(true);
+ toplevels.back().cobject()->readStatus(xml);
+ }
+ else if (tag == "waveedit") {
+ if(!pl->empty())
+ {
+ startWaveEditor(pl);
+ toplevels.back().cobject()->readStatus(xml);
+ pl = new PartList;
+ }
+ }
+ else if (tag == "cliplist") {
+ startClipList();
+ toplevels.back().cobject()->readStatus(xml);
+ }
+ else
+ xml.unknown("MusE");
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if (tag == "toplevels") {
+ delete pl;
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// readCtrl
+//---------------------------------------------------------
+
+void MusE::readCtrl(Xml&, int /*prt*/, int /*channel*/)
+ {
+#if 0
+ ChannelState* iState = midiPorts[prt].iState(channel);
+
+ int idx = 0;
+ int val = -1;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ xml.unknown("readCtrl");
+ break;
+ case Xml::Attribut:
+ if (xml.s1() == "idx")
+ idx = xml.s2().toInt();
+ else if (xml.s1() == "val")
+ val = xml.s2().toInt();
+ break;
+ case Xml::TagEnd:
+ if (xml.s1() == "ctrl") {
+ iState->controller[idx] = val;
+// printf("%d %d ctrl %d val %d\n", prt, channel, idx, val);
+ return;
+ }
+ default:
+ break;
+ }
+ }
+#endif
+ }
+
+//---------------------------------------------------------
+// readMidichannel
+//---------------------------------------------------------
+
+void MusE::readMidichannel(Xml& xml, int prt)
+ {
+ int channel = 0;
+// MidiPort* port = &midiPorts[prt];
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "pitch") {
+//TODO port->setCtrl(channel, 0, CTRL_PITCH, xml.parseInt());
+ }
+ else if (tag == "program") {
+//TODO port->setCtrl(channel, 0, CTRL_PROGRAM, xml.parseInt());
+ }
+ else if (tag == "ctrl")
+ readCtrl(xml, prt, channel);
+ else {
+ xml.unknown("readMidichannel");
+ }
+ break;
+ case Xml::Attribut:
+ if (tag == "ch") {
+ channel = xml.s2().toInt();
+ }
+ break;
+ case Xml::TagEnd:
+ if (tag == "midichannel")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// readMidiport
+//---------------------------------------------------------
+
+void MusE::readMidiport(Xml& xml)
+ {
+ int port = 0;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "midichannel")
+ readMidichannel(xml, port);
+ else {
+ xml.unknown("readMidiport");
+ }
+ break;
+ case Xml::Attribut:
+ if (tag == "port") {
+ port = xml.s2().toInt();
+ }
+ break;
+ case Xml::TagEnd:
+ if (tag == "midiport") {
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// readMarker
+//---------------------------------------------------------
+
+void Song::readMarker(Xml& xml)
+ {
+ Marker m;
+ m.read(xml);
+ _markerList->add(m);
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void Song::read(Xml& xml)
+ {
+ cloneList.clear();
+ for (;;) {
+ Xml::Token token;
+ token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "master")
+ setMasterFlag(xml.parseInt());
+ else if (tag == "info")
+ songInfoStr = xml.parse1();
+ else if (tag == "loop")
+ setLoop(xml.parseInt());
+ else if (tag == "punchin")
+ setPunchin(xml.parseInt());
+ else if (tag == "punchout")
+ setPunchout(xml.parseInt());
+ else if (tag == "record")
+ setRecord(xml.parseInt());
+ else if (tag == "solo")
+ soloFlag = xml.parseInt();
+ else if (tag == "type")
+ _mtype = MType(xml.parseInt());
+ else if (tag == "recmode")
+ _recMode = xml.parseInt();
+ else if (tag == "cycle")
+ _cycleMode = xml.parseInt();
+ else if (tag == "click")
+ setClick(xml.parseInt());
+ else if (tag == "quantize")
+ _quantize = xml.parseInt();
+ else if (tag == "len")
+ _len = xml.parseInt();
+ else if (tag == "follow")
+ _follow = FollowMode(xml.parseInt());
+ else if (tag == "tempolist") {
+ tempomap.read(xml);
+ }
+ else if (tag == "siglist")
+ sigmap.read(xml);
+ else if (tag == "miditrack") {
+ MidiTrack* track = new MidiTrack();
+ track->read(xml);
+ insertTrack0(track, -1);
+ }
+ else if (tag == "drumtrack") {
+ MidiTrack* track = new MidiTrack();
+ track->setType(Track::DRUM);
+ track->read(xml);
+ insertTrack0(track, -1);
+ }
+ else if (tag == "wavetrack") {
+ WaveTrack* track = new WaveTrack();
+ track->read(xml);
+ insertTrack0(track,-1);
+ // Now that the track has been added to the lists in insertTrack2(),
+ // OSC can find the track and its plugins, and start their native guis if required...
+ track->showPendingPluginNativeGuis();
+ }
+ else if (tag == "AudioInput") {
+ AudioInput* track = new AudioInput();
+ track->read(xml);
+ insertTrack0(track,-1);
+ track->showPendingPluginNativeGuis();
+ }
+ else if (tag == "AudioOutput") {
+ AudioOutput* track = new AudioOutput();
+ track->read(xml);
+ insertTrack0(track,-1);
+ track->showPendingPluginNativeGuis();
+ }
+ else if (tag == "AudioGroup") {
+ AudioGroup* track = new AudioGroup();
+ track->read(xml);
+ insertTrack0(track,-1);
+ track->showPendingPluginNativeGuis();
+ }
+ else if (tag == "AudioAux") {
+ AudioAux* track = new AudioAux();
+ track->read(xml);
+ insertTrack0(track,-1);
+ track->showPendingPluginNativeGuis();
+ }
+ else if (tag == "SynthI") {
+ SynthI* track = new SynthI();
+ track->read(xml);
+ // Done in SynthI::read()
+ // insertTrack(track,-1);
+ //track->showPendingPluginNativeGuis();
+ }
+ else if (tag == "Route") {
+ readRoute(xml);
+ }
+ else if (tag == "marker")
+ readMarker(xml);
+ else if (tag == "globalPitchShift")
+ _globalPitchShift = xml.parseInt();
+ else if (tag == "automation")
+ automation = xml.parseInt();
+ else if (tag == "cpos") {
+ int pos = xml.parseInt();
+ Pos p(pos, true);
+ setPos(Song::CPOS, p, false, false, false);
+ }
+ else if (tag == "lpos") {
+ int pos = xml.parseInt();
+ Pos p(pos, true);
+ setPos(Song::LPOS, p, false, false, false);
+ }
+ else if (tag == "rpos") {
+ int pos = xml.parseInt();
+ Pos p(pos, true);
+ setPos(Song::RPOS, p, false, false, false);
+ }
+ else if (tag == "drummap")
+ readDrumMap(xml, false);
+ else
+ xml.unknown("Song");
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if (tag == "song") {
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ dirty = false;
+
+ // Since cloneList is also used for copy/paste operations,
+ // clear the copy clone list again.
+ cloneList.clear();
+ }
+
+//---------------------------------------------------------
+// read
+// read song
+//---------------------------------------------------------
+
+void MusE::read(Xml& xml, bool skipConfig)
+ {
+ bool skipmode = true;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (skipmode && tag == "muse")
+ skipmode = false;
+ else if (skipmode)
+ break;
+ else if (tag == "configuration")
+ if (skipConfig)
+ //xml.skip(tag);
+ readConfiguration(xml,true /* only read sequencer settings */);
+ else
+ readConfiguration(xml, false);
+ else if (tag == "song")
+ {
+ song->read(xml);
+ audio->msgUpdateSoloStates();
+ }
+ else if (tag == "midiport")
+ readMidiport(xml);
+ else if (tag == "Controller") { // obsolete
+ MidiController* ctrl = new MidiController;
+ ctrl->read(xml);
+ delete ctrl;
+ }
+ else if (tag == "mplugin")
+ readStatusMidiInputTransformPlugin(xml);
+ else if (tag == "toplevels")
+ readToplevels(xml);
+ else
+ xml.unknown("muse");
+ break;
+ case Xml::Attribut:
+ if (tag == "version") {
+ int major = xml.s2().section('.', 0, 0).toInt();
+ int minor = xml.s2().section('.', 1, 1).toInt();
+ xml.setVersion(major, minor);
+ }
+ break;
+ case Xml::TagEnd:
+ if (!skipmode && tag == "muse")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void Song::write(int level, Xml& xml) const
+ {
+ xml.tag(level++, "song");
+ xml.strTag(level, "info", songInfoStr);
+ xml.intTag(level, "automation", automation);
+ xml.intTag(level, "cpos", song->cpos());
+ xml.intTag(level, "rpos", song->rpos());
+ xml.intTag(level, "lpos", song->lpos());
+ xml.intTag(level, "master", _masterFlag);
+ xml.intTag(level, "loop", loopFlag);
+ xml.intTag(level, "punchin", punchinFlag);
+ xml.intTag(level, "punchout", punchoutFlag);
+ xml.intTag(level, "record", recordFlag);
+ xml.intTag(level, "solo", soloFlag);
+ xml.intTag(level, "type", _mtype);
+ xml.intTag(level, "recmode", _recMode);
+ xml.intTag(level, "cycle", _cycleMode);
+ xml.intTag(level, "click", _click);
+ xml.intTag(level, "quantize", _quantize);
+ xml.intTag(level, "len", _len);
+ xml.intTag(level, "follow", _follow);
+ if (_globalPitchShift)
+ xml.intTag(level, "globalPitchShift", _globalPitchShift);
+
+ // Make a backup of the current clone list, to retain any 'copy' items,
+ // so that pasting works properly after.
+ CloneList copyCloneList = cloneList;
+ cloneList.clear();
+
+ // write tracks
+ for (ciTrack i = _tracks.begin(); i != _tracks.end(); ++i)
+ (*i)->write(level, xml);
+
+ // write routing
+ for (ciTrack i = _tracks.begin(); i != _tracks.end(); ++i) {
+
+ // p3.3.38 Changed
+ //if ((*i)->isMidiTrack())
+ // continue;
+ //WaveTrack* track = (WaveTrack*)(*i);
+ //track->writeRouting(level, xml);
+
+ (*i)->writeRouting(level, xml);
+ }
+
+ // Write midi device routing.
+ for (iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i) {
+ //MidiJackDevice* mjd = dynamic_cast<MidiJackDevice*>(*i);
+ //if (!mjd)
+ // continue;
+ //mjd->writeRouting(level, xml);
+ (*i)->writeRouting(level, xml);
+ }
+
+ // p3.3.49 Write midi port routing.
+ for (int i = 0; i < MIDI_PORTS; ++i) {
+ midiPorts[i].writeRouting(level, xml);
+ }
+
+ tempomap.write(level, xml);
+ sigmap.write(level, xml);
+ _markerList->write(level, xml);
+
+ writeDrumMap(level, xml, false);
+ xml.tag(level, "/song");
+
+ // Restore backup of the clone list, to retain any 'copy' items,
+ // so that pasting works properly after.
+ cloneList.clear();
+ cloneList = copyCloneList;
+ }
+
+//---------------------------------------------------------
+// write
+// write song
+//---------------------------------------------------------
+
+void MusE::write(Xml& xml) const
+ {
+ xml.header();
+
+ int level = 0;
+ xml.tag(level++, "muse version=\"2.0\"");
+ writeConfiguration(level, xml);
+
+ writeStatusMidiInputTransformPlugins(level, xml);
+
+ song->write(level, xml);
+
+ if (!toplevels.empty()) {
+ xml.tag(level++, "toplevels");
+ for (ciToplevel i = toplevels.begin(); i != toplevels.end(); ++i) {
+ if (i->cobject()->isVisible())
+ i->cobject()->writeStatus(level, xml);
+ }
+ xml.tag(level--, "/toplevels");
+ }
+
+ xml.tag(level, "/muse");
+ }
+
diff --git a/muse2/muse/stringparam.cpp b/muse2/muse/stringparam.cpp
new file mode 100644
index 00000000..b3b5104e
--- /dev/null
+++ b/muse2/muse/stringparam.cpp
@@ -0,0 +1,113 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// $Id: stringparam.cpp,v 1.0.0.0 2010/04/24 01:01:01 terminator356 Exp $
+//
+// Copyright (C) 1999-2010 by Werner Schweer and others
+// String parameter module added by Tim.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//=============================================================================
+
+#include <qstring.h>
+#include "stringparam.h"
+#include "xml.h"
+
+//---------------------------------------------------------
+// findKey
+//---------------------------------------------------------
+
+iStringParamMap StringParamMap::findKey(const char* key)
+{
+ iStringParamMap icm = find(std::string(key));
+ return icm;
+}
+
+//---------------------------------------------------------
+// set
+//---------------------------------------------------------
+
+void StringParamMap::set(const char* key, const char* value)
+{
+ iStringParamMap icm = find(std::string(key));
+ if(icm == end())
+ insert(std::pair<std::string, std::string>(key, value));
+ else
+ icm->second = std::string(value);
+}
+
+//---------------------------------------------------------
+// remove
+//---------------------------------------------------------
+
+void StringParamMap::remove(const char* key)
+{
+ erase(std::string(key));
+}
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void StringParamMap::read(Xml& xml, const QString& name)
+{
+ QString n;
+ QString value;
+
+ for (;;)
+ {
+ Xml::Token token = xml.parse();
+ const QString tag = xml.s1();
+ switch (token)
+ {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ xml.unknown(name);
+ break;
+ case Xml::Attribut:
+ if(tag == "name")
+ n = xml.s2();
+ else
+ if(tag == "val")
+ value = xml.s2();
+ else
+ xml.unknown(name);
+ break;
+ case Xml::TagEnd:
+ if(tag == name)
+ {
+ // Add or modify the item.
+ set(n.latin1(), value.latin1());
+ return;
+ }
+ default:
+ break;
+ }
+ }
+}
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void StringParamMap::write(int level, Xml& xml, const char* name) const
+{
+ if(empty())
+ return;
+
+ for(ciStringParamMap r = begin(); r != end(); ++r)
+ xml.tag(level, "%s name=\"%s\" val=\"%s\"/", name, r->first.c_str(), r->second.c_str());
+}
+
diff --git a/muse2/muse/stringparam.h b/muse2/muse/stringparam.h
new file mode 100644
index 00000000..0e05c987
--- /dev/null
+++ b/muse2/muse/stringparam.h
@@ -0,0 +1,49 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// $Id: stringparam.h,v 1.0.0.0 2010/04/24 01:01:01 terminator356 Exp $
+//
+// Copyright (C) 1999-2010 by Werner Schweer and others
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//=============================================================================
+
+
+#ifndef __STRINGPARAM_H__
+#define __STRINGPARAM_H__
+
+#include <string>
+#include <map>
+
+class QString;
+class Xml;
+
+//typedef std::pair<std::string, std::string > StringParamMapItem;
+typedef std::map<std::string, std::string >::iterator iStringParamMap;
+typedef std::map<std::string, std::string >::const_iterator ciStringParamMap;
+
+class StringParamMap : public std::map<std::string, std::string >
+{
+ public:
+ void set(const char* /*key*/, const char* /*value*/);
+ void remove(const char* /*key*/);
+
+ iStringParamMap findKey(const char* /*key*/);
+ //int index(char* /*key*/);
+
+ void read(Xml& /*xml*/, const QString& /*name*/);
+ void write(int /*level*/, Xml& /*xml*/, const char* /*name*/) const;
+};
+
+
+#endif //__STRINGPARAM_H__ \ No newline at end of file
diff --git a/muse2/muse/sync.cpp b/muse2/muse/sync.cpp
new file mode 100644
index 00000000..699b5a33
--- /dev/null
+++ b/muse2/muse/sync.cpp
@@ -0,0 +1,1380 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: sync.cpp,v 1.6.2.12 2009/06/20 22:20:41 terminator356 Exp $
+//
+// (C) Copyright 2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <cmath>
+#include "sync.h"
+#include "song.h"
+#include "utils.h"
+#include "midiport.h"
+#include "mididev.h"
+#include "globals.h"
+#include "midiseq.h"
+#include "audio.h"
+#include "audiodev.h"
+#include "gconfig.h"
+#include "xml.h"
+#include "midi.h"
+
+//int rxSyncPort = -1; // receive from all ports
+//int txSyncPort = 1;
+//int rxDeviceId = 0x7f; // any device
+//int txDeviceId = 0x7f; // any device
+//MidiSyncPort midiSyncPorts[MIDI_PORTS];
+int volatile curMidiSyncInPort = -1;
+
+bool debugSync = true;
+
+int mtcType = 1;
+MTC mtcOffset;
+BValue extSyncFlag(0, "extSync"); // false - MASTER, true - SLAVE
+//bool genMTCSync = false; // output MTC Sync
+//bool genMCSync = false; // output MidiClock Sync
+//bool genMMC = false; // output Midi Machine Control
+//bool acceptMTC = false;
+//bool acceptMC = true;
+//bool acceptMMC = true;
+BValue useJackTransport(0,"useJackTransport");
+bool volatile jackTransportMaster = true;
+
+static MTC mtcCurTime;
+static int mtcState; // 0-7 next expected quarter message
+static bool mtcValid;
+static int mtcLost;
+static bool mtcSync; // receive complete mtc frame?
+
+// p3.3.28
+static bool playPendingFirstClock = false;
+unsigned int syncSendFirstClockDelay = 1; // In milliseconds.
+//static int lastStoppedBeat = 0;
+static unsigned int curExtMidiSyncTick = 0;
+unsigned int volatile lastExtMidiSyncTick = 0;
+double volatile curExtMidiSyncTime = 0.0;
+double volatile lastExtMidiSyncTime = 0.0;
+
+// Not used yet.
+// static bool mcStart = false;
+// static int mcStartTick;
+
+// p3.3.25
+// From the "Introduction to the Volatile Keyword" at Embedded dot com
+/* A variable should be declared volatile whenever its value could change unexpectedly.
+ ... <such as> global variables within a multi-threaded application
+ ... So all shared global variables should be declared volatile */
+unsigned int volatile midiExtSyncTicks = 0;
+
+//---------------------------------------------------------
+// MidiSyncInfo
+//---------------------------------------------------------
+
+MidiSyncInfo::MidiSyncInfo()
+{
+ _port = -1;
+ _idOut = 127;
+ _idIn = 127;
+ _sendMC = false;
+ _sendMRT = false;
+ _sendMMC = false;
+ _sendMTC = false;
+ _recMC = false;
+ _recMRT = false;
+ _recMMC = false;
+ _recMTC = false;
+
+ _lastClkTime = 0.0;
+ _lastTickTime = 0.0;
+ _lastMRTTime = 0.0;
+ _lastMMCTime = 0.0;
+ _lastMTCTime = 0.0;
+ _clockTrig = false;
+ _tickTrig = false;
+ _MRTTrig = false;
+ _MMCTrig = false;
+ _MTCTrig = false;
+ _clockDetect = false;
+ _tickDetect = false;
+ _MRTDetect = false;
+ _MMCDetect = false;
+ _MTCDetect = false;
+ _recMTCtype = 0;
+ _recRewOnStart = true;
+ //_sendContNotStart = false;
+ _actDetectBits = 0;
+ for(int i = 0; i < MIDI_CHANNELS; ++i)
+ {
+ _lastActTime[i] = 0.0;
+ _actTrig[i] = false;
+ _actDetect[i] = false;
+ }
+}
+
+//---------------------------------------------------------
+// operator =
+//---------------------------------------------------------
+
+MidiSyncInfo& MidiSyncInfo::operator=(const MidiSyncInfo &sp)
+{
+ //_port = sp._port;
+
+ copyParams(sp);
+
+ _lastClkTime = sp._lastClkTime;
+ _lastTickTime = sp._lastTickTime;
+ _lastMRTTime = sp._lastMRTTime;
+ _lastMMCTime = sp._lastMMCTime;
+ _lastMTCTime = sp._lastMTCTime;
+ _clockTrig = sp._clockTrig;
+ _tickTrig = sp._tickTrig;
+ _MRTTrig = sp._MRTTrig;
+ _MMCTrig = sp._MMCTrig;
+ _MTCTrig = sp._MTCTrig;
+ _clockDetect = sp._clockDetect;
+ _tickDetect = sp._tickDetect;
+ _MRTDetect = sp._MRTDetect;
+ _MMCDetect = sp._MMCDetect;
+ _MTCDetect = sp._MTCDetect;
+ _recMTCtype = sp._recMTCtype;
+ for(int i = 0; i < MIDI_CHANNELS; ++i)
+ {
+ _lastActTime[i] = sp._lastActTime[i];
+ _actTrig[i] = sp._actTrig[i];
+ _actDetect[i] = sp._actDetect[i];
+ }
+ return *this;
+}
+
+//---------------------------------------------------------
+// copyParams
+//---------------------------------------------------------
+
+MidiSyncInfo& MidiSyncInfo::copyParams(const MidiSyncInfo &sp)
+{
+ //_port = sp._port;
+
+ _idOut = sp._idOut;
+ _idIn = sp._idIn;
+ _sendMC = sp._sendMC;
+ _sendMRT = sp._sendMRT;
+ _sendMMC = sp._sendMMC;
+ _sendMTC = sp._sendMTC;
+ setMCIn(sp._recMC);
+ _recMRT = sp._recMRT;
+ _recMMC = sp._recMMC;
+ _recMTC = sp._recMTC;
+ _recRewOnStart = sp._recRewOnStart;
+ //_sendContNotStart = sp._sendContNotStart;
+ return *this;
+}
+
+//---------------------------------------------------------
+// setTime
+//---------------------------------------------------------
+
+void MidiSyncInfo::setTime()
+{
+ // Note: CurTime() makes a system call to gettimeofday(),
+ // which apparently can be slow in some cases. So I avoid calling this function
+ // too frequently by calling it (at the heartbeat rate) in Song::beat(). T356
+ double t = curTime();
+
+ if(_clockTrig)
+ {
+ _clockTrig = false;
+ _lastClkTime = t;
+ }
+ else
+ if(_clockDetect && (t - _lastClkTime >= 1.0)) // Set detect indicator timeout to about 1 second.
+ {
+ _clockDetect = false;
+ // Give up the current midi sync in port number if we took it...
+ if(curMidiSyncInPort == _port)
+ curMidiSyncInPort = -1;
+ }
+
+ if(_tickTrig)
+ {
+ _tickTrig = false;
+ _lastTickTime = t;
+ }
+ else
+ if(_tickDetect && (t - _lastTickTime) >= 1.0) // Set detect indicator timeout to about 1 second.
+ _tickDetect = false;
+
+ if(_MRTTrig)
+ {
+ _MRTTrig = false;
+ _lastMRTTime = t;
+ }
+ else
+ if(_MRTDetect && (t - _lastMRTTime) >= 1.0) // Set detect indicator timeout to about 1 second.
+ {
+ _MRTDetect = false;
+ // Give up the current midi sync in port number if we took it...
+ //if(curMidiSyncInPort == _port)
+ // curMidiSyncInPort = -1;
+ }
+
+ if(_MMCTrig)
+ {
+ _MMCTrig = false;
+ _lastMMCTime = t;
+ }
+ else
+ if(_MMCDetect && (t - _lastMMCTime) >= 1.0) // Set detect indicator timeout to about 1 second.
+ {
+ _MMCDetect = false;
+ // Give up the current midi sync in port number if we took it...
+ //if(curMidiSyncInPort == _port)
+ // curMidiSyncInPort = -1;
+ }
+
+ if(_MTCTrig)
+ {
+ _MTCTrig = false;
+ _lastMTCTime = t;
+ }
+ else
+ if(_MTCDetect && (t - _lastMTCTime) >= 1.0) // Set detect indicator timeout to about 1 second.
+ {
+ _MTCDetect = false;
+ // Give up the current midi sync in port number if we took it...
+ if(curMidiSyncInPort == _port)
+ curMidiSyncInPort = -1;
+ }
+
+ for(int i = 0; i < MIDI_CHANNELS; i++)
+ {
+ if(_actTrig[i])
+ {
+ _actTrig[i] = false;
+ _lastActTime[i] = t;
+ }
+ else
+ if(_actDetect[i] && (t - _lastActTime[i]) >= 1.0) // Set detect indicator timeout to about 1 second.
+ {
+ _actDetect[i] = false;
+ _actDetectBits &= ~bitShiftLU[i];
+ }
+ }
+}
+
+//---------------------------------------------------------
+// setMCIn
+//---------------------------------------------------------
+
+void MidiSyncInfo::setMCIn(const bool v)
+{
+ _recMC = v;
+ // If sync receive was turned off, clear the current midi sync in port number so another port can grab it.
+ if(!_recMC && _port != -1 && curMidiSyncInPort == _port)
+ curMidiSyncInPort = -1;
+}
+
+//---------------------------------------------------------
+// setMRTIn
+//---------------------------------------------------------
+
+void MidiSyncInfo::setMRTIn(const bool v)
+{
+ _recMRT = v;
+ // If sync receive was turned off, clear the current midi sync in port number so another port can grab it.
+ //if(!_recMRT && _port != -1 && curMidiSyncInPort == _port)
+ // curMidiSyncInPort = -1;
+}
+
+//---------------------------------------------------------
+// setMMCIn
+//---------------------------------------------------------
+
+void MidiSyncInfo::setMMCIn(const bool v)
+{
+ _recMMC = v;
+ // If sync receive was turned off, clear the current midi sync in port number so another port can grab it.
+ //if(!_recMMC && _port != -1 && curMidiSyncInPort == _port)
+ // curMidiSyncInPort = -1;
+}
+
+//---------------------------------------------------------
+// setMTCIn
+//---------------------------------------------------------
+
+void MidiSyncInfo::setMTCIn(const bool v)
+{
+ _recMTC = v;
+ // If sync receive was turned off, clear the current midi sync in port number so another port can grab it.
+ if(!_recMTC && _port != -1 && curMidiSyncInPort == _port)
+ curMidiSyncInPort = -1;
+}
+
+//---------------------------------------------------------
+// trigMCSyncDetect
+//---------------------------------------------------------
+
+void MidiSyncInfo::trigMCSyncDetect()
+{
+ _clockDetect = true;
+ _clockTrig = true;
+ // Set the current midi sync in port number if it's not taken...
+ if(_recMC && curMidiSyncInPort == -1)
+ curMidiSyncInPort = _port;
+}
+
+//---------------------------------------------------------
+// trigTickDetect
+//---------------------------------------------------------
+
+void MidiSyncInfo::trigTickDetect()
+{
+ _tickDetect = true;
+ _tickTrig = true;
+}
+
+//---------------------------------------------------------
+// trigMRTDetect
+//---------------------------------------------------------
+
+void MidiSyncInfo::trigMRTDetect()
+{
+ _MRTDetect = true;
+ _MRTTrig = true;
+ // Set the current midi sync in port number if it's not taken...
+ //if(_recMRT && curMidiSyncInPort == -1)
+ // curMidiSyncInPort = _port;
+}
+
+//---------------------------------------------------------
+// trigMMCDetect
+//---------------------------------------------------------
+
+void MidiSyncInfo::trigMMCDetect()
+{
+ _MMCDetect = true;
+ _MMCTrig = true;
+ // Set the current midi sync in port number if it's not taken...
+ //if(_recMMC && curMidiSyncInPort == -1)
+ // curMidiSyncInPort = _port;
+}
+
+//---------------------------------------------------------
+// trigMTCDetect
+//---------------------------------------------------------
+
+void MidiSyncInfo::trigMTCDetect()
+{
+ _MTCDetect = true;
+ _MTCTrig = true;
+ // Set the current midi sync in port number if it's not taken...
+ if(_recMTC && curMidiSyncInPort == -1)
+ curMidiSyncInPort = _port;
+}
+
+//---------------------------------------------------------
+// actDetect
+//---------------------------------------------------------
+
+bool MidiSyncInfo::actDetect(const int ch) const
+{
+ if(ch < 0 || ch >= MIDI_CHANNELS)
+ return false;
+
+ return _actDetect[ch];
+}
+
+//---------------------------------------------------------
+// trigActDetect
+//---------------------------------------------------------
+
+void MidiSyncInfo::trigActDetect(const int ch)
+{
+ if(ch < 0 || ch >= MIDI_CHANNELS)
+ return;
+
+ _actDetectBits |= bitShiftLU[ch];
+ _actDetect[ch] = true;
+ _actTrig[ch] = true;
+}
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void MidiSyncInfo::read(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token(xml.parse());
+ const QString& tag(xml.s1());
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "idOut")
+ _idOut = xml.parseInt();
+ else if (tag == "idIn")
+ _idIn = xml.parseInt();
+ else if (tag == "sendMC")
+ _sendMC = xml.parseInt();
+ else if (tag == "sendMRT")
+ _sendMRT = xml.parseInt();
+ else if (tag == "sendMMC")
+ _sendMMC = xml.parseInt();
+ else if (tag == "sendMTC")
+ _sendMTC = xml.parseInt();
+ //else if (tag == "sendContNotStart")
+ // _sendContNotStart = xml.parseInt();
+ else if (tag == "recMC")
+ _recMC = xml.parseInt();
+ else if (tag == "recMRT")
+ _recMRT = xml.parseInt();
+ else if (tag == "recMMC")
+ _recMMC = xml.parseInt();
+ else if (tag == "recMTC")
+ _recMTC = xml.parseInt();
+ else if (tag == "recRewStart")
+ _recRewOnStart = xml.parseInt();
+ else
+ xml.unknown("midiSyncInfo");
+ break;
+ case Xml::TagEnd:
+ if (tag == "midiSyncInfo")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+//void MidiSyncInfo::write(int level, Xml& xml, MidiDevice* md)
+void MidiSyncInfo::write(int level, Xml& xml)
+{
+ //if(!md)
+ // return;
+
+ // All defaults? Nothing to write.
+ if(_idOut == 127 && _idIn == 127 && !_sendMC && !_sendMRT && !_sendMMC && !_sendMTC &&
+ /* !_sendContNotStart && */ !_recMC && !_recMRT && !_recMMC && !_recMTC && _recRewOnStart)
+ return;
+
+ xml.tag(level++, "midiSyncInfo");
+ //xml.intTag(level, "idx", idx);
+ //xml.intTag(level++, "midiSyncPort", idx);
+ //xml.tag(level++, "midiSyncInfo idx=\"%d\"", idx);
+
+ //xml.strTag(level, "device", md->name());
+
+ if(_idOut != 127)
+ xml.intTag(level, "idOut", _idOut);
+ if(_idIn != 127)
+ xml.intTag(level, "idIn", _idIn);
+
+ if(_sendMC)
+ xml.intTag(level, "sendMC", true);
+ if(_sendMRT)
+ xml.intTag(level, "sendMRT", true);
+ if(_sendMRT)
+ xml.intTag(level, "sendMMC", true);
+ if(_sendMTC)
+ xml.intTag(level, "sendMTC", true);
+ //if(_sendContNotStart)
+ // xml.intTag(level, "sendContNotStart", true);
+
+ if(_recMC)
+ xml.intTag(level, "recMC", true);
+ if(_recMRT)
+ xml.intTag(level, "recMRT", true);
+ if(_recMMC)
+ xml.intTag(level, "recMMC", true);
+ if(_recMTC)
+ xml.intTag(level, "recMTC", true);
+ if(!_recRewOnStart)
+ xml.intTag(level, "recRewStart", false);
+
+ xml.etag(level, "midiSyncInfo");
+}
+
+//---------------------------------------------------------
+// mmcInput
+// Midi Machine Control Input received
+//---------------------------------------------------------
+
+//void MidiSeq::mmcInput(const unsigned char* p, int n)
+void MidiSeq::mmcInput(int port, const unsigned char* p, int n)
+ {
+ if (debugSync)
+ printf("mmcInput: n:%d %02x %02x %02x %02x\n",
+ n, p[2], p[3], p[4], p[5]);
+
+ MidiPort* mp = &midiPorts[port];
+ MidiSyncInfo& msync = mp->syncInfo();
+ // Trigger MMC detect in.
+ msync.trigMMCDetect();
+ // MMC locate SMPTE time code may contain format type bits. Grab them.
+ if(p[3] == 0x44 && p[4] == 6 && p[5] == 1)
+ msync.setRecMTCtype((p[6] >> 5) & 3);
+
+ // MMC in not turned on? Forget it.
+ if(!msync.MMCIn())
+ return;
+
+ //if (!(extSyncFlag.value() && acceptMMC))
+ //if(!extSyncFlag.value())
+ // return;
+
+ switch(p[3]) {
+ case 1:
+ if (debugSync)
+ printf(" MMC: STOP\n");
+
+ playPendingFirstClock = false;
+
+ //if ((state == PLAY || state == PRECOUNT))
+ if (audio->isPlaying())
+ audio->msgPlay(false);
+ playStateExt = false;
+ alignAllTicks();
+ //stopPlay();
+ break;
+ case 2:
+ if (debugSync)
+ printf(" MMC: PLAY\n");
+ case 3:
+ if (debugSync)
+ printf(" MMC: DEFERRED PLAY\n");
+ mtcState = 0;
+ mtcValid = false;
+ mtcLost = 0;
+ mtcSync = false;
+ //startPlay();
+ alignAllTicks();
+ audio->msgPlay(true);
+ playStateExt = true;
+ break;
+
+ case 4:
+ printf("MMC: FF not implemented\n");
+ playPendingFirstClock = false;
+ break;
+ case 5:
+ printf("MMC: REWIND not implemented\n");
+ playPendingFirstClock = false;
+ break;
+ case 6:
+ printf("MMC: REC STROBE not implemented\n");
+ playPendingFirstClock = false;
+ break;
+ case 7:
+ printf("MMC: REC EXIT not implemented\n");
+ playPendingFirstClock = false;
+ break;
+ case 0xd:
+ printf("MMC: RESET not implemented\n");
+ playPendingFirstClock = false;
+ break;
+ case 0x44:
+ if (p[5] == 0) {
+ printf("MMC: LOCATE IF not implemented\n");
+ break;
+ }
+ else if (p[5] == 1) {
+ if (!checkAudioDevice()) return;
+ MTC mtc(p[6] & 0x1f, p[7], p[8], p[9], p[10]);
+ int type = (p[6] >> 5) & 3;
+ //int mmcPos = tempomap.frame2tick(lrint(mtc.time()*sampleRate));
+ //int mmcPos = lrint(mtc.time()*sampleRate);
+ int mmcPos = lrint(mtc.time(type) * sampleRate);
+
+ //Pos tp(mmcPos, true);
+ Pos tp(mmcPos, false);
+ //audioDevice->seekTransport(tp.frame());
+ audioDevice->seekTransport(tp);
+ alignAllTicks();
+ //seek(tp);
+ if (debugSync) {
+ //printf("MMC: %f %d seek ", mtc.time(), mmcPos);
+ printf("MMC: LOCATE mtc type:%d time:%lf frame:%d mtc: ", type, mtc.time(), mmcPos);
+ mtc.print();
+ printf("\n");
+ }
+ //write(sigFd, "G", 1);
+ break;
+ }
+ // fall through
+ default:
+ printf("MMC %x %x, unknown\n", p[3], p[4]); break;
+ }
+ }
+
+//---------------------------------------------------------
+// mtcInputQuarter
+// process Quarter Frame Message
+//---------------------------------------------------------
+
+//void MidiSeq::mtcInputQuarter(int, unsigned char c)
+void MidiSeq::mtcInputQuarter(int port, unsigned char c)
+ {
+ static int hour, min, sec, frame;
+
+ // p3.3.28
+ //printf("MidiSeq::mtcInputQuarter c:%h\n", c);
+
+ int valL = c & 0xf;
+ int valH = valL << 4;
+
+ int _state = (c & 0x70) >> 4;
+ if (mtcState != _state)
+ mtcLost += _state - mtcState;
+ mtcState = _state + 1;
+
+ switch(_state) {
+ case 7:
+ hour = (hour & 0x0f) | valH;
+ break;
+ case 6:
+ hour = (hour & 0xf0) | valL;
+ break;
+ case 5:
+ min = (min & 0x0f) | valH;
+ break;
+ case 4:
+ min = (min & 0xf0) | valL;
+ break;
+ case 3:
+ sec = (sec & 0x0f) | valH;
+ break;
+ case 2:
+ sec = (sec & 0xf0) | valL;
+ break;
+ case 1:
+ frame = (frame & 0x0f) | valH;
+ break;
+ case 0: frame = (frame & 0xf0) | valL;
+ break;
+ }
+ frame &= 0x1f; // 0-29
+ sec &= 0x3f; // 0-59
+ min &= 0x3f; // 0-59
+ int tmphour = hour;
+ int type = (hour >> 5) & 3;
+ hour &= 0x1f;
+
+ if(mtcState == 8)
+ {
+ mtcValid = (mtcLost == 0);
+ mtcState = 0;
+ mtcLost = 0;
+ if(mtcValid)
+ {
+ mtcCurTime.set(hour, min, sec, frame);
+ if(port != -1)
+ {
+ MidiPort* mp = &midiPorts[port];
+ MidiSyncInfo& msync = mp->syncInfo();
+ msync.setRecMTCtype(type);
+ msync.trigMTCDetect();
+ // Not for the current in port? External sync not turned on? MTC in not turned on? Forget it.
+ if(port == curMidiSyncInPort && extSyncFlag.value() && msync.MTCIn())
+ {
+ if(debugSync)
+ printf("MidiSeq::mtcInputQuarter hour byte:%hx\n", tmphour);
+ mtcSyncMsg(mtcCurTime, type, !mtcSync);
+ }
+ }
+ mtcSync = true;
+ }
+ }
+ else if (mtcValid && (mtcLost == 0))
+ {
+ //mtcCurTime.incQuarter();
+ mtcCurTime.incQuarter(type);
+ //mtcSyncMsg(mtcCurTime, type, false);
+ }
+ }
+
+//---------------------------------------------------------
+// mtcInputFull
+// process Frame Message
+//---------------------------------------------------------
+
+//void MidiSeq::mtcInputFull(const unsigned char* p, int n)
+void MidiSeq::mtcInputFull(int port, const unsigned char* p, int n)
+ {
+ if (debugSync)
+ printf("mtcInputFull\n");
+ //if (!extSyncFlag.value())
+ // return;
+
+ if (p[3] != 1) {
+ if (p[3] != 2) { // silently ignore user bits
+ printf("unknown mtc msg subtype 0x%02x\n", p[3]);
+ dump(p, n);
+ }
+ return;
+ }
+ int hour = p[4];
+ int min = p[5];
+ int sec = p[6];
+ int frame = p[7];
+
+ frame &= 0x1f; // 0-29
+ sec &= 0x3f; // 0-59
+ min &= 0x3f; // 0-59
+ int type = (hour >> 5) & 3;
+ hour &= 0x1f;
+
+ mtcCurTime.set(hour, min, sec, frame);
+ mtcState = 0;
+ mtcValid = true;
+ mtcLost = 0;
+
+ // Added by Tim.
+ if(debugSync)
+ printf("mtcInputFull: time:%lf stime:%lf hour byte (all bits):%hx\n", mtcCurTime.time(), mtcCurTime.time(type), p[4]);
+ if(port != -1)
+ {
+ MidiPort* mp = &midiPorts[port];
+ MidiSyncInfo& msync = mp->syncInfo();
+ msync.setRecMTCtype(type);
+ msync.trigMTCDetect();
+ // MTC in not turned on? Forget it.
+ //if(extSyncFlag.value() && msync.MTCIn())
+ if(msync.MTCIn())
+ {
+ //Pos tp(lrint(mtcCurTime.time() * sampleRate), false);
+ Pos tp(lrint(mtcCurTime.time(type) * sampleRate), false);
+ audioDevice->seekTransport(tp);
+ alignAllTicks();
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// nonRealtimeSystemSysex
+//---------------------------------------------------------
+
+//void MidiSeq::nonRealtimeSystemSysex(const unsigned char* p, int n)
+void MidiSeq::nonRealtimeSystemSysex(int /*port*/, const unsigned char* p, int n)
+ {
+// int chan = p[2];
+ switch(p[3]) {
+ case 4:
+ printf("NRT Setup\n");
+ break;
+ default:
+ printf("unknown NRT Msg 0x%02x\n", p[3]);
+ dump(p, n);
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// setSongPosition
+// MidiBeat is a 14 Bit value. Each MidiBeat spans
+// 6 MIDI Clocks. Inother words, each MIDI Beat is a
+// 16th note (since there are 24 MIDI Clocks in a
+// quarter note).
+//---------------------------------------------------------
+
+void MidiSeq::setSongPosition(int port, int midiBeat)
+ {
+ if (midiInputTrace)
+ printf("set song position port:%d %d\n", port, midiBeat);
+
+ //midiPorts[port].syncInfo().trigMCSyncDetect();
+ midiPorts[port].syncInfo().trigMRTDetect();
+
+ //if (!extSyncFlag.value())
+ // External sync not on? Clock in not turned on?
+ //if(!extSyncFlag.value() || !midiPorts[port].syncInfo().MCIn())
+ if(!extSyncFlag.value() || !midiPorts[port].syncInfo().MRTIn())
+ return;
+
+ // Re-transmit song position to other devices if clock out turned on.
+ for(int p = 0; p < MIDI_PORTS; ++p)
+ //if(p != port && midiPorts[p].syncInfo().MCOut())
+ if(p != port && midiPorts[p].syncInfo().MRTOut())
+ midiPorts[p].sendSongpos(midiBeat);
+
+ curExtMidiSyncTick = (config.division * midiBeat) / 4;
+ lastExtMidiSyncTick = curExtMidiSyncTick;
+
+ //Pos pos((config.division * midiBeat) / 4, true);
+ Pos pos(curExtMidiSyncTick, true);
+
+ if (!checkAudioDevice()) return;
+
+ //audioDevice->seekTransport(pos.frame());
+ audioDevice->seekTransport(pos);
+ alignAllTicks(pos.frame());
+ if (debugSync)
+ printf("setSongPosition %d\n", pos.tick());
+ }
+
+
+
+//---------------------------------------------------------
+// set all runtime variables to the "in sync" value
+//---------------------------------------------------------
+void MidiSeq::alignAllTicks(int frameOverride)
+ {
+ //printf("alignAllTicks audioDriver->framePos=%d, audio->pos().frame()=%d\n",
+ // audioDevice->framePos(), audio->pos().frame());
+ unsigned curFrame;
+ if (!frameOverride)
+ curFrame = audio->pos().frame();
+ else
+ curFrame = frameOverride;
+
+ int tempo = tempomap.tempo(0);
+
+ // use the last old values to give start values for the tripple buffering
+ int recTickSpan = recTick1 - recTick2;
+ int songTickSpan = (int)(songtick1 - songtick2); //prevent compiler warning: casting double to int
+ storedtimediffs = 0; // pretend there is no sync history
+
+ mclock2=mclock1=0.0; // set all clock values to "in sync"
+
+ recTick = (int) ((double(curFrame)/double(sampleRate)) *
+ double(config.division * 1000000.0) / double(tempo) //prevent compiler warning: casting double to int
+ );
+ songtick1 = recTick - songTickSpan;
+ if (songtick1 < 0)
+ songtick1 = 0;
+ songtick2 = songtick1 - songTickSpan;
+ if (songtick2 < 0)
+ songtick2 = 0;
+ recTick1 = recTick - recTickSpan;
+ if (recTick1 < 0)
+ recTick1 = 0;
+ recTick2 = recTick1 - recTickSpan;
+ if (recTick2 < 0)
+ recTick2 = 0;
+ if (debugSync)
+ printf("alignAllTicks curFrame=%d recTick=%d tempo=%.3f frameOverride=%d\n",curFrame,recTick,(float)((1000000.0 * 60.0)/tempo), frameOverride);
+
+ }
+
+//---------------------------------------------------------
+// realtimeSystemInput
+// real time message received
+//---------------------------------------------------------
+void MidiSeq::realtimeSystemInput(int port, int c)
+ {
+
+ if (midiInputTrace)
+ printf("realtimeSystemInput port:%d 0x%x\n", port+1, c);
+
+ //if (midiInputTrace && (rxSyncPort != port) && rxSyncPort != -1) {
+ // if (debugSync)
+ // printf("rxSyncPort configured as %d; received sync from port %d\n",
+ // rxSyncPort, port);
+ // return;
+ // }
+
+ MidiPort* mp = &midiPorts[port];
+
+ // Trigger on any tick, clock, or realtime command.
+ if(c == ME_TICK) // Tick
+ mp->syncInfo().trigTickDetect();
+ else
+ if(c == ME_CLOCK) // Clock
+ mp->syncInfo().trigMCSyncDetect();
+ else
+ mp->syncInfo().trigMRTDetect(); // Other
+
+ // External sync not on? Clock in not turned on? Otherwise realtime in not turned on?
+ if(!extSyncFlag.value())
+ return;
+ if(c == ME_CLOCK)
+ {
+ if(!mp->syncInfo().MCIn())
+ return;
+ }
+ else
+ if(!mp->syncInfo().MRTIn())
+ return;
+
+
+ switch(c) {
+ case ME_CLOCK: // midi clock (24 ticks / quarter note)
+ {
+ // Not for the current in port? Forget it.
+ if(port != curMidiSyncInPort)
+ break;
+
+ // p3.3.31
+ //printf("midi clock:%f\n", curTime());
+
+ // Re-transmit clock to other devices if clock out turned on.
+ // Must be careful not to allow more than one clock input at a time.
+ // Would re-transmit mixture of multiple clocks - confusing receivers.
+ // Solution: Added curMidiSyncInPort.
+ // Maybe in MidiSeq::processTimerTick(), call sendClock for the other devices, instead of here.
+ for(int p = 0; p < MIDI_PORTS; ++p)
+ if(p != port && midiPorts[p].syncInfo().MCOut())
+ midiPorts[p].sendClock();
+
+ // p3.3.28
+ if(playPendingFirstClock)
+ {
+ playPendingFirstClock = false;
+ // Hopefully the transport will be ready by now, the seek upon start should mean the
+ // audio prefetch has already finished or at least started...
+ // Must comfirm that play does not force a complete prefetch again, but don't think so...
+ if(!audio->isPlaying())
+ audioDevice->startTransport();
+ }
+ //else
+ // This part will be run on the second and subsequent clocks, after start.
+ // Can't check audio state, might not be playing yet, we might miss some increments.
+ //if(audio->isPlaying())
+ if(playStateExt)
+ {
+ lastExtMidiSyncTime = curExtMidiSyncTime;
+ curExtMidiSyncTime = curTime();
+ int div = config.division/24;
+ midiExtSyncTicks += div;
+ lastExtMidiSyncTick = curExtMidiSyncTick;
+ curExtMidiSyncTick += div;
+ }
+
+//BEGIN : Original code:
+ /*
+ double mclock0 = curTime();
+ // Difference in time last 2 rounds:
+ double tdiff0 = mclock0 - mclock1;
+ double tdiff1 = mclock1 - mclock2;
+ double averagetimediff = 0.0;
+
+ if (mclock1 != 0.0) {
+ if (storedtimediffs < 24)
+ {
+ timediff[storedtimediffs] = mclock0 - mclock1;
+ storedtimediffs++;
+ }
+ else {
+ for (int i=0; i<23; i++) {
+ timediff[i] = timediff[i+1];
+ }
+ timediff[23] = mclock0 - mclock1;
+ }
+ // Calculate average timediff:
+ for (int i=0; i < storedtimediffs; i++) {
+ averagetimediff += timediff[i]/storedtimediffs;
+ }
+ }
+
+ // Compare w audio if playing:
+ if (playStateExt == true ) { //audio->isPlaying() state == PLAY
+ //BEGIN standard setup:
+ recTick += config.division / 24; // The one we're syncing to
+ int tempo = tempomap.tempo(0);
+ unsigned curFrame = audio->pos().frame();
+ double songtick = (double(curFrame)/double(sampleRate)) *
+ double(config.division * 1000000.0) / double(tempo);
+
+ double scale = double(tdiff0/averagetimediff);
+ double tickdiff = songtick - ((double) recTick - 24 + scale*24.0);
+
+ //END standard setup
+ if (debugSync) {
+ int m, b, t;
+ audio->pos().mbt(&m, &b, &t);
+
+ int song_beat = b + m*4; // if the time-signature is different than 4/4, this will be wrong.
+ int sync_beat = recTick/config.division;
+ printf("pT=%.3f rT=%d diff=%.3f songB=%d syncB=%d scale=%.3f, curFrame=%d",
+ songtick, recTick, tickdiff, song_beat, sync_beat, scale, curFrame);
+ }
+
+ //if ((mclock2 !=0.0) && (tdiff1 > 0.0) && fabs(tickdiff) > 0.5 && lastTempo != 0) {
+ if ((mclock2 !=0.0) && (tdiff1 > 0.0) && lastTempo != 0) {
+ // Interpolate:
+ double tickdiff1 = songtick1 - recTick1;
+ double tickdiff2 = songtick2 - recTick2;
+ double newtickdiff = (tickdiff1+tickdiff2)/250;
+ //tickdiff/5.0 +
+ tickdiff1/16.0 +
+ tickdiff2/24.0; //5 mins 30 secs on 116BPM, -p 512 jackd
+
+ if (newtickdiff != 0.0) {
+ int newTempo = tempomap.tempo(0);
+ //newTempo += int(24.0 * newtickdiff * scale);
+ newTempo += int(24.0 * newtickdiff);
+ if (debugSync)
+ printf(" tdiff=%f ntd=%f lt=%d tmpo=%.3f",
+ tdiff0, newtickdiff, lastTempo, (float)((1000000.0 * 60.0)/newTempo));
+ //syncTempo = newTempo;
+ tempomap.setTempo(0,newTempo);
+ }
+ if (debugSync)
+ printf("\n");
+ }
+ else if (debugSync)
+ printf("\n");
+
+ //BEGIN post calc
+ lastTempo = tempo;
+ recTick2 = recTick1;
+ recTick1 = recTick;
+ mclock2 = mclock1;
+ mclock1 = mclock0;
+ songtick2 = songtick1;
+ songtick1 = songtick;
+ //END post calc
+ break;
+ } // END state play
+ //
+ // Pre-sync (when audio is not running)
+ // Calculate tempo depending on time per pulse
+ //
+ if (mclock1 == 0.0) {
+ mp->device()->discardInput();
+ if (debugSync)
+ printf("Discarding input from port %d\n", port);
+ }
+ if ((mclock2 != 0.0) && (tdiff0 > 0.0)) {
+ int tempo0 = int(24000000.0 * tdiff0 + .5);
+ int tempo1 = int(24000000.0 * tdiff1 + .5);
+ int tempo = tempomap.tempo(0);
+
+ int diff0 = tempo0 - tempo;
+ int diff1 = tempo1 - tempo0;
+ if (diff0) {
+ int newTempo = tempo + diff0/8 + diff1/16;
+ if (debugSync)
+ printf("setting new tempo %d = %f\n", newTempo, (float)((1000000.0 * 60.0)/newTempo));
+ tempomap.setTempo(0, newTempo);
+ }
+ }
+ mclock2 = mclock1;
+ mclock1 = mclock0;
+ */
+//END : Original Code
+
+//BEGIN : Using external tempo map:
+ /*
+ double mclock0 = curTime();
+ // Difference in time last 2 rounds:
+ double tdiff0 = mclock0 - mclock1;
+ double tdiff1 = mclock1 - mclock2;
+ double averagetimediff = 0.0;
+
+ if (mclock1 != 0.0) {
+ if (storedtimediffs < 24)
+ {
+ timediff[storedtimediffs] = mclock0 - mclock1;
+ storedtimediffs++;
+ }
+ else {
+ for (int i=0; i<23; i++) {
+ timediff[i] = timediff[i+1];
+ }
+ timediff[23] = mclock0 - mclock1;
+ }
+ // Calculate average timediff:
+ for (int i=0; i < storedtimediffs; i++) {
+ averagetimediff += timediff[i]/storedtimediffs;
+ }
+ }
+
+ // Compare w audio if playing:
+ //if (playStateExt == true ) { //audio->isPlaying() state == PLAY
+ if (0) {
+ //BEGIN standard setup:
+ recTick += config.division / 24; // The one we're syncing to
+ int tempo = tempomap.tempo(0);
+ //unsigned curFrame = audio->pos().frame();
+ //double songtick = (double(curFrame)/double(sampleRate)) *
+ // double(config.division * 1000000.0) / double(tempo);
+ double songtick = tempomap.curTickExt(mclock0);
+
+ double scale = double(tdiff0/averagetimediff);
+ double tickdiff = songtick - ((double) recTick - 24 + scale*24.0);
+
+ //END standard setup
+ if (debugSync) {
+ int m, b, t;
+ audio->pos().mbt(&m, &b, &t);
+
+ int song_beat = b + m*4; // if the time-signature is different than 4/4, this will be wrong.
+ int sync_beat = recTick/config.division;
+ printf("pT=%.3f rT=%d diff=%.3f songB=%d syncB=%d scale=%.3f, curFrame=%d averagetimediff:%.3lf",
+ songtick, recTick, tickdiff, song_beat, sync_beat, scale, audio->pos().frame(), averagetimediff);
+ }
+
+ //if ((mclock2 !=0.0) && (tdiff1 > 0.0) && fabs(tickdiff) > 0.5 && lastTempo != 0) {
+ if ((mclock2 !=0.0) && (tdiff1 > 0.0) && lastTempo != 0) {
+ // Interpolate:
+ double tickdiff1 = songtick1 - recTick1;
+ double tickdiff2 = songtick2 - recTick2;
+ double newtickdiff = (tickdiff1+tickdiff2)/250;
+ ////double newtickdiff = (tickdiff1+tickdiff2) / 10.0;
+ //double newtickdiff = tickdiff/5.0 +
+ // tickdiff1/16.0 +
+ // tickdiff2/24.0; //5 mins 30 secs on 116BPM, -p 512 jackd
+
+ if (newtickdiff != 0.0) {
+ //int newTempo = tempomap.tempo(0);
+ int newTempo = tempo;
+ //newTempo += int(24.0 * newtickdiff * scale);
+ newTempo += int(24.0 * newtickdiff);
+ if (debugSync)
+ printf(" tdiff=%f ntd=%f lt=%d tmpo=%.3f",
+ tdiff0, newtickdiff, lastTempo, (float)((1000000.0 * 60.0)/newTempo));
+ //syncTempo = newTempo;
+ //tempomap.setTempo(0,newTempo);
+ // Don't set the last stable tempo.
+ //tempomap.setTempo(0, newTempo, false);
+ tempomap.setExtTempo(newTempo);
+ }
+ if (debugSync)
+ printf("\n");
+ }
+ else if (debugSync)
+ printf("\n");
+
+ //BEGIN post calc
+ lastTempo = tempo;
+ recTick2 = recTick1;
+ recTick1 = recTick;
+ mclock2 = mclock1;
+ mclock1 = mclock0;
+ songtick2 = songtick1;
+ songtick1 = songtick;
+ //END post calc
+ break;
+ } // END state play
+ //
+ // Pre-sync (when audio is not running)
+ // Calculate tempo depending on time per pulse
+ //
+ if (mclock1 == 0.0) {
+ mp->device()->discardInput();
+ if (debugSync)
+ printf("Discarding input from port %d\n", port);
+ }
+ if ((mclock2 != 0.0) && (tdiff0 > 0.0)) {
+
+ //int tempo0 = int(24000000.0 * tdiff0 + .5);
+ //int tempo1 = int(24000000.0 * tdiff1 + .5);
+ //int tempo = tempomap.tempo(0);
+ //int diff0 = tempo0 - tempo;
+ //int diff1 = tempo1 - tempo0;
+
+ //if (diff0) {
+ // int newTempo = tempo + diff0/8 + diff1/16;
+ // if (debugSync)
+ // printf("setting new tempo %d = %f\n", newTempo, (float)((1000000.0 * 60.0)/newTempo));
+ //tempomap.setTempo(0, newTempo);
+ // Don't set the last stable tempo.
+ //tempomap.setTempo(0, newTempo, false);
+ // tempomap.setExtTempo(newTempo);
+ // }
+
+ //double tempo0 = 24000000.0 * tdiff0;
+ //double tempo1 = 24000000.0 * tdiff1;
+ //int newTempo = int((tempo0 + tempo1) / 2.0);
+ int newTempo = int(averagetimediff * 24000000.0);
+ if(debugSync)
+ printf("setting new tempo %d = %f\n", newTempo, (float)((1000000.0 * 60.0)/newTempo));
+ tempomap.setExtTempo(newTempo);
+ }
+
+ mclock2 = mclock1;
+ mclock1 = mclock0;
+ */
+//END : Using external tempo map
+
+ }
+ break;
+ case ME_TICK: // midi tick (every 10 msec)
+ // FIXME: Unfinished? mcStartTick is uninitialized and Song::setPos doesn't set it either. Dangerous to allow this.
+ //if (mcStart) {
+ // song->setPos(0, mcStartTick);
+ // mcStart = false;
+ // return;
+ // }
+ break;
+ case ME_START: // start
+ // Re-transmit start to other devices if clock out turned on.
+ for(int p = 0; p < MIDI_PORTS; ++p)
+ //if(p != port && midiPorts[p].syncInfo().MCOut())
+ if(p != port && midiPorts[p].syncInfo().MRTOut())
+ {
+ // p3.3.31
+ // If we aren't rewinding on start, there's no point in re-sending start.
+ // Re-send continue instead, for consistency.
+ if(midiPorts[port].syncInfo().recRewOnStart())
+ midiPorts[p].sendStart();
+ else
+ midiPorts[p].sendContinue();
+ }
+ if (debugSync)
+ printf(" start\n");
+
+ // p3.3.31
+ //printf("midi start:%f\n", curTime());
+
+ if (1 /* !audio->isPlaying()*/ /*state == IDLE*/) {
+ if (!checkAudioDevice()) return;
+
+ // p3.3.31
+ // Rew on start option.
+ if(midiPorts[port].syncInfo().recRewOnStart())
+ {
+ curExtMidiSyncTick = 0;
+ lastExtMidiSyncTick = curExtMidiSyncTick;
+ //audioDevice->seekTransport(0);
+ audioDevice->seekTransport(Pos(0, false));
+ }
+
+ //unsigned curFrame = audio->curFrame();
+ //if (debugSync)
+ // printf(" curFrame=%d\n", curFrame);
+
+ alignAllTicks();
+ //if (debugSync)
+ // printf(" curFrame: %d curTick: %d tempo: %d\n", curFrame, recTick, tempomap.tempo(0));
+
+ storedtimediffs = 0;
+ for (int i=0; i<24; i++)
+ timediff[i] = 0.0;
+
+ // p3.3.26 1/23/10
+ // Changed because msgPlay calls audioDevice->seekTransport(song->cPos())
+ // and song->cPos() may not be changed to 0 yet, causing tranport not to go to 0.
+ //audio->msgPlay(true);
+ //audioDevice->startTransport();
+ // p3.3.28
+ playPendingFirstClock = true;
+
+ midiExtSyncTicks = 0;
+ playStateExt = true;
+ }
+ break;
+ case ME_CONTINUE: // continue
+ // Re-transmit continue to other devices if clock out turned on.
+ for(int p = 0; p < MIDI_PORTS; ++p)
+ //if(p != port && midiPorts[p].syncInfo().MCOut())
+ if(p != port && midiPorts[p].syncInfo().MRTOut())
+ midiPorts[p].sendContinue();
+
+ if (debugSync)
+ printf("realtimeSystemInput continue\n");
+
+ // p3.3.31
+ //printf("continue:%f\n", curTime());
+
+ if (1 /* !audio->isPlaying() */ /*state == IDLE */) {
+ //unsigned curFrame = audio->curFrame();
+ //recTick = tempomap.frame2tick(curFrame); // don't think this will work... (ml)
+ //alignAllTicks();
+
+ // p3.3.28
+ //audio->msgPlay(true);
+ // p3.3.31
+ // Begin incrementing immediately upon first clock reception.
+ playPendingFirstClock = true;
+
+ playStateExt = true;
+ }
+ break;
+ case ME_STOP: // stop
+ {
+ // p3.3.35
+ // Stop the increment right away.
+ midiExtSyncTicks = 0;
+ playStateExt = false;
+ playPendingFirstClock = false;
+
+ // Re-transmit stop to other devices if clock out turned on.
+ for(int p = 0; p < MIDI_PORTS; ++p)
+ //if(p != port && midiPorts[p].syncInfo().MCOut())
+ if(p != port && midiPorts[p].syncInfo().MRTOut())
+ midiPorts[p].sendStop();
+
+ //playPendingFirstClock = false;
+
+ //lastStoppedBeat = (audio->tickPos() * 4) / config.division;
+ //curExtMidiSyncTick = (config.division * lastStoppedBeat) / 4;
+
+ // p3.3.31
+ //printf("stop:%f\n", curTime());
+
+ if (audio->isPlaying() /*state == PLAY*/) {
+ audio->msgPlay(false);
+ //playStateExt = false;
+ }
+
+ if (debugSync)
+ printf("realtimeSystemInput stop\n");
+
+ // Just in case the process still runs a cycle or two and causes the
+ // audio tick position to increment, reset the incrementer and force
+ // the transport position to what the hardware thinks is the current position.
+ //midiExtSyncTicks = 0;
+ //Pos pos((config.division * lastStoppedBeat) / 4, true);
+ //Pos pos(curExtMidiSyncTick, true);
+ //audioDevice->seekTransport(pos);
+ }
+
+ break;
+ //case 0xfd: // unknown
+ //case ME_SENSE: // active sensing
+ //case ME_META: // system reset (reset is 0xff same enumeration as file meta event)
+ default:
+ break;
+ }
+
+ }
+
+//---------------------------------------------------------
+// mtcSyncMsg
+// process received mtc Sync
+// seekFlag - first complete mtc frame received after
+// start
+//---------------------------------------------------------
+
+void MidiSeq::mtcSyncMsg(const MTC& mtc, int type, bool seekFlag)
+ {
+ double time = mtc.time();
+ double stime = mtc.time(type);
+ if (debugSync)
+ printf("MidiSeq::mtcSyncMsg time:%lf stime:%lf seekFlag:%d\n", time, stime, seekFlag);
+
+ if (seekFlag && audio->isRunning() /*state == START_PLAY*/) {
+// int tick = tempomap.time2tick(time);
+ //state = PLAY;
+ //write(sigFd, "1", 1); // say PLAY to gui
+ if (!checkAudioDevice()) return;
+ if (debugSync)
+ printf("MidiSeq::mtcSyncMsg starting transport.\n");
+ audioDevice->startTransport();
+ return;
+ }
+
+ /*if (tempoSN != tempomap.tempoSN()) {
+ double cpos = tempomap.tick2time(_midiTick, 0);
+ samplePosStart = samplePos - lrint(cpos * sampleRate);
+ rtcTickStart = rtcTick - lrint(cpos * realRtcTicks);
+ tempoSN = tempomap.tempoSN();
+ }*/
+
+ //
+ // diff is the time in sec MusE is out of sync
+ //
+ /*double diff = time - (double(samplePosStart)/double(sampleRate));
+ if (debugSync)
+ printf(" state %d diff %f\n", mtcState, diff);
+ */
+ }
+
+
diff --git a/muse2/muse/sync.h b/muse2/muse/sync.h
new file mode 100644
index 00000000..d6a08f0d
--- /dev/null
+++ b/muse2/muse/sync.h
@@ -0,0 +1,153 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: sync.h,v 1.1.1.1.2.2 2009/04/01 01:37:11 terminator356 Exp $
+//
+// (C) Copyright 2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SYNC_H__
+#define __SYNC_H__
+
+#include "mtc.h"
+#include "value.h"
+#include "globaldefs.h"
+
+class Xml;
+//class MidiDevice;
+
+//class MidiSyncPort
+class MidiSyncInfo
+{
+ private:
+ int _port;
+
+ int _idOut;
+ int _idIn;
+
+ bool _sendMC;
+ bool _sendMRT;
+ bool _sendMMC;
+ bool _sendMTC;
+ bool _recMC;
+ bool _recMRT;
+ bool _recMMC;
+ bool _recMTC;
+
+ int _recMTCtype;
+
+ bool _recRewOnStart;
+ //bool _sendContNotStart;
+
+ double _lastClkTime;
+ double _lastTickTime;
+ double _lastMRTTime;
+ double _lastMMCTime;
+ double _lastMTCTime;
+ double _lastActTime[MIDI_CHANNELS];
+ bool _clockTrig;
+ bool _tickTrig;
+ bool _MRTTrig;
+ bool _MMCTrig;
+ bool _MTCTrig;
+ bool _actTrig[MIDI_CHANNELS];
+ bool _clockDetect;
+ bool _tickDetect;
+ bool _MRTDetect;
+ bool _MMCDetect;
+ bool _MTCDetect;
+ bool _actDetect[MIDI_CHANNELS];
+ int _actDetectBits;
+
+ public:
+ MidiSyncInfo();
+ MidiSyncInfo& operator= (const MidiSyncInfo &sp);
+ MidiSyncInfo& copyParams(const MidiSyncInfo &sp);
+
+ int port() const { return _port; }
+ void setPort(const int p) { _port = p; }
+
+ int idOut() const { return _idOut; }
+ int idIn() const { return _idIn; }
+ void setIdOut(const int v) { _idOut = v; }
+ void setIdIn(const int v) { _idIn = v; }
+
+ bool MCOut() const { return _sendMC; }
+ bool MRTOut() const { return _sendMRT; }
+ bool MMCOut() const { return _sendMMC; }
+ bool MTCOut() const { return _sendMTC; }
+
+ bool MCIn() const { return _recMC; }
+ bool MRTIn() const { return _recMRT; }
+ bool MMCIn() const { return _recMMC; }
+ bool MTCIn() const { return _recMTC; }
+
+ void setMCOut(const bool v) { _sendMC = v; }
+ void setMRTOut(const bool v) { _sendMRT = v; }
+ void setMMCOut(const bool v) { _sendMMC = v; }
+ void setMTCOut(const bool v) { _sendMTC = v; }
+
+ void setMCIn(const bool v);
+ void setMRTIn(const bool v);
+ void setMMCIn(const bool v);
+ void setMTCIn(const bool v);
+
+ void setTime();
+
+ bool recRewOnStart() const { return _recRewOnStart; }
+ void setRecRewOnStart(const bool v) { _recRewOnStart = v; }
+ //bool sendContNotStart() const { return _sendContNotStart; }
+ //void setSendContNotStart(const bool v) { _sendContNotStart = v; }
+
+ bool MCSyncDetect() const { return _clockDetect; }
+ void trigMCSyncDetect();
+
+ bool tickDetect() const { return _tickDetect; }
+ void trigTickDetect();
+
+ bool MTCDetect() const { return _MTCDetect; }
+ void trigMTCDetect();
+ int recMTCtype() const { return _recMTCtype; }
+ void setRecMTCtype(int t) { _recMTCtype = t; }
+
+ bool MRTDetect() const { return _MRTDetect; }
+ void trigMRTDetect();
+
+ bool MMCDetect() const { return _MMCDetect; }
+ void trigMMCDetect();
+
+ int actDetectBits() const { return _actDetectBits; }
+ bool actDetect(const int ch) const;
+ void trigActDetect(const int ch);
+
+ void read(Xml& xml);
+ //void write(int level, Xml& xml, MidiDevice* md);
+ void write(int level, Xml& xml);
+};
+
+//extern MidiSync midiSyncPorts[MIDI_PORTS];
+
+extern bool debugSync;
+
+//extern int rxSyncPort;
+//extern int txSyncPort;
+//extern int rxDeviceId;
+//extern int txDeviceId;
+
+extern int mtcType;
+extern MTC mtcOffset;
+extern BValue extSyncFlag;
+//extern bool genMTCSync; // output MTC Sync
+//extern bool genMCSync; // output MidiClock Sync
+//extern bool genMMC; // output Midi Machine Control
+//extern bool acceptMTC;
+//extern bool acceptMC;
+//extern bool acceptMMC;
+extern int volatile curMidiSyncInPort;
+extern BValue useJackTransport;
+extern bool volatile jackTransportMaster;
+extern unsigned int syncSendFirstClockDelay; // In milliseconds.
+
+
+#endif
+
diff --git a/muse2/muse/synth.cpp b/muse2/muse/synth.cpp
new file mode 100644
index 00000000..352be582
--- /dev/null
+++ b/muse2/muse/synth.cpp
@@ -0,0 +1,947 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: synth.cpp,v 1.43.2.23 2009/12/15 03:39:58 terminator356 Exp $
+// (C) Copyright 2000-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "config.h"
+#include <sys/wait.h>
+#include <signal.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/mman.h>
+#include <vector>
+#include <fcntl.h>
+
+#include <qdir.h>
+#include <dlfcn.h>
+#include <q3popupmenu.h>
+
+#include "app.h"
+#include "synth.h"
+#include "xml.h"
+#include "midi.h"
+#include "midiport.h"
+#include "mididev.h"
+#include "libsynti/mess.h"
+#include "song.h"
+#include "audio.h"
+#include "event.h"
+#include "mpevent.h"
+#include "audio.h"
+#include "midiseq.h"
+#include "midictrl.h"
+//#include "stringparam.h"
+
+std::vector<Synth*> synthis; // array of available synthis
+
+extern void connectNodes(AudioTrack*, AudioTrack*);
+
+/*
+//---------------------------------------------------------
+// description
+//---------------------------------------------------------
+
+const char* MessSynth::description() const
+ {
+ return _descr ? _descr->description : "";
+ }
+
+//---------------------------------------------------------
+// version
+//---------------------------------------------------------
+
+const char* MessSynth::version() const
+ {
+ return _descr ? _descr->version : "";
+ }
+*/
+
+bool MessSynthIF::guiVisible() const
+ {
+ return _mess ? _mess->guiVisible() : false;
+ }
+
+void MessSynthIF::showGui(bool v)
+ {
+ if (v == guiVisible())
+ return;
+ if (_mess)
+ _mess->showGui(v);
+ }
+
+bool MessSynthIF::hasGui() const
+ {
+ if (_mess)
+ return _mess->hasGui();
+ return false;
+ }
+
+MidiPlayEvent MessSynthIF::receiveEvent()
+ {
+ if (_mess)
+ return _mess->receiveEvent();
+ return MidiPlayEvent();
+ }
+
+int MessSynthIF::eventsPending() const
+ {
+ if (_mess)
+ return _mess->eventsPending();
+ return 0;
+ }
+
+void MessSynthIF::getGeometry(int* x, int* y, int* w, int* h) const
+ {
+ if (_mess)
+ _mess->getGeometry(x, y, w, h);
+ }
+
+void MessSynthIF::setGeometry(int x, int y, int w, int h)
+ {
+ if (_mess)
+ _mess->setGeometry(x, y, w, h);
+ }
+
+//---------------------------------------------------------
+// findSynth
+// search for synthesizer base class
+//---------------------------------------------------------
+
+//static Synth* findSynth(const QString& sclass)
+static Synth* findSynth(const QString& sclass, const QString& label)
+ {
+ for (std::vector<Synth*>::iterator i = synthis.begin();
+ i != synthis.end(); ++i)
+ {
+ //if ((*i)->baseName() == sclass)
+ //if ((*i)->name() == sclass)
+ if ( ((*i)->baseName() == sclass) && (label.isEmpty() || ((*i)->name() == label)) )
+
+ return *i;
+ }
+ printf("synthi class:%s label:%s not found\n", sclass.latin1(), label.latin1());
+ return 0;
+ }
+
+//---------------------------------------------------------
+// createSynthInstance
+// create a synthesizer instance of class "label"
+//---------------------------------------------------------
+
+//static SynthI* createSynthI(const QString& sclass)
+static SynthI* createSynthInstance(const QString& sclass, const QString& label)
+ {
+ //Synth* s = findSynth(sclass);
+ Synth* s = findSynth(sclass, label);
+ SynthI* si = 0;
+ if (s) {
+ si = new SynthI();
+ QString n;
+ n.setNum(s->instances());
+ //QString instance_name = s->baseName() + "-" + n;
+ QString instance_name = s->name() + "-" + n;
+
+ if (si->initInstance(s, instance_name)) {
+ delete si;
+ return 0;
+ }
+ }
+ else
+ printf("createSynthInstance: synthi class:%s label:%s not found\n", sclass.latin1(), label.latin1());
+ return si;
+ }
+
+//---------------------------------------------------------
+// Synth
+//---------------------------------------------------------
+
+//Synth::Synth(const QFileInfo& fi)
+// : info(fi)
+//Synth::Synth(const QFileInfo& fi, QString label)
+// : info(fi), _name(label)
+Synth::Synth(const QFileInfo& fi, QString label, QString descr, QString maker, QString ver)
+ : info(fi), _name(label), _description(descr), _maker(maker), _version(ver)
+ {
+ _instances = 0;
+ }
+
+//---------------------------------------------------------
+// instantiate
+//---------------------------------------------------------
+
+//void* MessSynth::instantiate()
+void* MessSynth::instantiate(const QString& instanceName)
+ {
+ ++_instances;
+
+ //QString n;
+ //n.setNum(_instances);
+ //QString instanceName = baseName() + "-" + n;
+
+ doSetuid();
+ const char* path = info.filePath().latin1();
+
+ // load Synti dll
+ void* handle = dlopen(path, RTLD_NOW);
+ if (handle == 0) {
+ fprintf(stderr, "Synth::instantiate: dlopen(%s) failed: %s\n",
+ path, dlerror());
+ undoSetuid();
+ return 0;
+ }
+ typedef const MESS* (*MESS_Function)();
+ MESS_Function msynth = (MESS_Function)dlsym(handle, "mess_descriptor");
+
+ if (!msynth) {
+ const char *txt = dlerror();
+ if (txt) {
+ fprintf(stderr,
+ "Unable to find msynth_descriptor() function in plugin "
+ "library file \"%s\": %s.\n"
+ "Are you sure this is a MESS plugin file?\n",
+ info.filePath().ascii(), txt);
+ undoSetuid();
+ return 0;
+ }
+ }
+ _descr = msynth();
+ if (_descr == 0) {
+ fprintf(stderr, "Synth::instantiate: no MESS descr found\n");
+ undoSetuid();
+ return 0;
+ }
+ Mess* mess = _descr->instantiate(sampleRate, muse, &museProject, instanceName.latin1());
+ undoSetuid();
+ return mess;
+ }
+
+//---------------------------------------------------------
+// SynthI
+//---------------------------------------------------------
+
+SynthI::SynthI()
+ : AudioTrack(AUDIO_SOFTSYNTH)
+ {
+ synthesizer = 0;
+ _sif = 0;
+ _rwFlags = 1;
+ _openFlags = 1;
+ _readEnable = false;
+ _writeEnable = false;
+
+ _curBankH = 0;
+ _curBankL = 0;
+ _curProgram = 0;
+
+ setVolume(1.0);
+ setPan(0.0);
+ }
+
+//---------------------------------------------------------
+// open
+//---------------------------------------------------------
+
+QString SynthI::open()
+{
+ // Make it behave like a regular midi device.
+ _readEnable = false;
+ _writeEnable = (_openFlags & 0x01);
+
+ return QString("OK");
+}
+
+//---------------------------------------------------------
+// close
+//---------------------------------------------------------
+
+void SynthI::close()
+{
+ _readEnable = false;
+ _writeEnable = false;
+}
+
+//---------------------------------------------------------
+// putMidiEvent
+//---------------------------------------------------------
+
+bool SynthI::putEvent(const MidiPlayEvent& ev)
+//bool SynthI::putMidiEvent(const MidiPlayEvent& ev)
+{
+ if(_writeEnable)
+ return _sif->putEvent(ev);
+
+ // Hmm, act as if the event went through?
+ //return true;
+ return false;
+}
+
+//---------------------------------------------------------
+// setName
+//---------------------------------------------------------
+
+void SynthI::setName(const QString& s)
+ {
+ AudioTrack::setName(s);
+ MidiDevice::setName(s);
+ }
+
+//---------------------------------------------------------
+// currentProg
+//---------------------------------------------------------
+
+void SynthI::currentProg(unsigned long *prog, unsigned long *bankL, unsigned long *bankH)
+{
+ if(prog)
+ *prog = _curProgram;
+ if(bankL)
+ *bankL = _curBankL;
+ if(bankH)
+ *bankH = _curBankH;
+}
+
+//---------------------------------------------------------
+// init
+//---------------------------------------------------------
+
+//bool MessSynthIF::init(Synth* s)
+bool MessSynthIF::init(Synth* s, SynthI* si)
+ {
+ //_mess = (Mess*)s->instantiate();
+ _mess = (Mess*)((MessSynth*)s)->instantiate(si->name());
+
+ return (_mess == 0);
+ }
+
+int MessSynthIF::channels() const
+ {
+ return _mess->channels();
+ }
+
+int MessSynthIF::totalOutChannels() const
+ {
+ return _mess->channels();
+ }
+
+int MessSynthIF::totalInChannels() const
+ {
+ return 0;
+ }
+
+//SynthIF* MessSynth::createSIF() const
+SynthIF* MessSynth::createSIF(SynthI* si)
+ {
+ //return new MessSynthIF(si);
+
+ MessSynthIF* sif = new MessSynthIF(si);
+ sif->init(this, si);
+ return sif;
+ }
+
+//---------------------------------------------------------
+// initInstance
+// returns false on success
+//---------------------------------------------------------
+
+bool SynthI::initInstance(Synth* s, const QString& instanceName)
+ {
+ synthesizer = s;
+ //sif = s->createSIF();
+ //_sif = s->createSIF(this);
+
+ //sif->init(s);
+
+ setName(instanceName); // set midi device name
+ setIName(instanceName); // set instrument name
+ _sif = s->createSIF(this);
+
+ // p3.3.38
+ //AudioTrack::setChannels(_sif->channels());
+ AudioTrack::setTotalOutChannels(_sif->totalOutChannels());
+ AudioTrack::setTotalInChannels(_sif->totalInChannels());
+
+ //---------------------------------------------------
+ // read available controller from synti
+ //---------------------------------------------------
+
+ int id = 0;
+ MidiControllerList* cl = MidiInstrument::controller();
+ for (;;) {
+ const char* name;
+ int ctrl;
+ int min;
+ int max;
+ int initval = CTRL_VAL_UNKNOWN;
+ id = _sif->getControllerInfo(id, &name, &ctrl, &min, &max, &initval);
+// printf("looking for params\n");
+ if (id == 0)
+ break;
+// printf("got parameter:: %s\n", name);
+
+
+ // Added by T356. Override existing program controller.
+ iMidiController i = cl->end();
+ if(ctrl == CTRL_PROGRAM)
+ {
+ for(i = cl->begin(); i != cl->end(); ++i)
+ {
+ if(i->second->num() == CTRL_PROGRAM)
+ {
+ delete i->second;
+ cl->erase(i);
+
+ break;
+ }
+ }
+ }
+
+ MidiController* c = new MidiController(QString(name), ctrl, min, max, initval);
+ cl->add(c);
+ }
+
+ EventList* iel = midiState();
+ if (!iel->empty()) {
+ for (iEvent i = iel->begin(); i != iel->end(); ++i) {
+ Event ev = i->second;
+ MidiPlayEvent pev(0, 0, 0, ev);
+ if (_sif->putEvent(pev))
+ break; // try later
+ }
+ iel->clear();
+ }
+
+ unsigned long idx = 0;
+ for (std::vector<float>::iterator i = initParams.begin(); i != initParams.end(); ++i, ++idx)
+ _sif->setParameter(idx, *i);
+
+ // p3.3.40 Since we are done with the (sometimes huge) initial parameters list, clear it.
+ // TODO: Decide: Maybe keep them around for a 'reset to previously loaded values' (revert) command? ...
+ initParams.clear();
+
+ return false;
+ }
+
+//---------------------------------------------------------
+// getControllerInfo
+//---------------------------------------------------------
+
+int MessSynthIF::getControllerInfo(int id, const char** name, int* ctrl, int* min, int* max, int* initval)
+ {
+ return _mess->getControllerInfo(id, name, ctrl, min, max, initval);
+ }
+
+//---------------------------------------------------------
+// SynthI::deactivate
+//---------------------------------------------------------
+
+void SynthI::deactivate2()
+ {
+ removeMidiInstrument(this);
+ midiDevices.remove(this);
+ if (midiPort() != -1) {
+ // synthi is attached
+ midiPorts[midiPort()].setMidiDevice(0);
+ }
+ }
+//---------------------------------------------------------
+// deactivate3
+//---------------------------------------------------------
+
+void SynthI::deactivate3()
+ {
+ _sif->deactivate3();
+ // Moved below by Tim. p3.3.14
+ //synthesizer->incInstances(-1);
+
+ if(debugMsg)
+ printf("SynthI::deactivate3 deleting _sif...\n");
+
+ delete _sif;
+ _sif = 0;
+
+ if(debugMsg)
+ printf("SynthI::deactivate3 decrementing synth instances...\n");
+
+ synthesizer->incInstances(-1);
+ }
+
+void MessSynthIF::deactivate3()
+ {
+ if (_mess) {
+ delete _mess;
+ _mess = 0;
+ }
+ }
+
+//---------------------------------------------------------
+// ~SynthI
+//---------------------------------------------------------
+
+SynthI::~SynthI()
+ {
+ deactivate2();
+ deactivate3();
+ }
+
+//---------------------------------------------------------
+// initMidiSynth
+// search for software synthis and advertise
+//---------------------------------------------------------
+
+void initMidiSynth()
+ {
+ QString s = museGlobalLib + "/synthi";
+
+ QDir pluginDir(s, QString("*.so")); // ddskrjo
+ if (debugMsg)
+ printf("searching for software synthesizer in <%s>\n", s.latin1());
+ if (pluginDir.exists()) {
+ QFileInfoList list = pluginDir.entryInfoList();
+ QFileInfoListIterator it=list.begin();
+ QFileInfo* fi;
+ while(it!=list.end()) {
+ fi = &*it;
+
+ //doSetuid();
+ const char* path = fi->filePath().latin1();
+
+ // load Synti dll
+ void* handle = dlopen(path, RTLD_NOW);
+ if (handle == 0) {
+ //fprintf(stderr, "initMidiSynth: dlopen(%s) failed: %s\n",
+ // path, dlerror());
+ //undoSetuid();
+ //return 0;
+ ++it;
+ continue;
+ }
+ typedef const MESS* (*MESS_Function)();
+ MESS_Function msynth = (MESS_Function)dlsym(handle, "mess_descriptor");
+
+ if (!msynth) {
+ //const char *txt = dlerror();
+ //if (txt) {
+ // fprintf(stderr,
+ // "Unable to find msynth_descriptor() function in plugin "
+ // "library file \"%s\": %s.\n"
+ // "Are you sure this is a MESS plugin file?\n",
+ // info.filePath().ascii(), txt);
+ //undoSetuid();
+ //return 0;
+ // }
+ dlclose(handle);
+ ++it;
+ continue;
+ }
+ const MESS* descr = msynth();
+ if (descr == 0) {
+ //fprintf(stderr, "Synth::instantiate: no MESS descr found\n");
+ //undoSetuid();
+ //return 0;
+ dlclose(handle);
+ ++it;
+ continue;
+ }
+ //Mess* mess = descr->instantiate(sampleRate, muse, &museProject, instanceName.latin1());
+ //undoSetuid();
+
+
+
+
+ //synthis.push_back(new MessSynth(*fi));
+ synthis.push_back(new MessSynth(*fi, QString(descr->name), QString(descr->description), QString(""), QString(descr->version)));
+
+ dlclose(handle);
+ ++it;
+ }
+ if (debugMsg)
+ printf("%zd soft synth found\n", synthis.size());
+ }
+ }
+
+//---------------------------------------------------------
+// createSynthI
+// create a synthesizer instance of class "label"
+//---------------------------------------------------------
+
+//SynthI* Song::createSynthI(const QString& sclass)
+SynthI* Song::createSynthI(const QString& sclass, const QString& label)
+ {
+ //printf("Song::createSynthI calling ::createSynthI class:%s\n", sclass.latin1());
+
+ //SynthI* si = ::createSynthI(sclass);
+ //SynthI* si = ::createSynthI(sclass, label);
+ SynthI* si = createSynthInstance(sclass, label);
+ if(!si)
+ return 0;
+ //printf("Song::createSynthI created SynthI. Before insertTrack1...\n");
+
+ insertTrack1(si, -1);
+ //printf("Song::createSynthI after insertTrack1. Before msgInsertTrack...\n");
+
+ msgInsertTrack(si, -1, true); // add to instance list
+ //printf("Song::createSynthI after msgInsertTrack. Before insertTrack3...\n");
+
+ insertTrack3(si, -1);
+
+ //printf("Song::createSynthI after insertTrack3. Adding default routes...\n");
+
+ OutputList* ol = song->outputs();
+ // add default route to master (first audio output)
+ if (!ol->empty()) {
+ AudioOutput* ao = ol->front();
+ // p3.3.38
+ //audio->msgAddRoute(Route(si, -1), Route(ao, -1));
+ //audio->msgAddRoute(Route((AudioTrack*)si, -1), Route(ao, -1));
+ // Make sure the route channel and channels are valid.
+ audio->msgAddRoute(Route((AudioTrack*)si, 0, ((AudioTrack*)si)->channels()), Route(ao, 0, ((AudioTrack*)si)->channels()));
+
+ audio->msgUpdateSoloStates();
+ }
+
+ // Now that the track has been added to the lists in insertTrack2(),
+ // if it's a dssi synth, OSC can find the synth, and initialize (and show) its native gui.
+ // No, initializing OSC without actually showing the gui doesn't work, at least for
+ // dssi-vst plugins - without showing the gui they exit after ten seconds.
+ //si->initGui();
+
+ return si;
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void SynthI::write(int level, Xml& xml) const
+ {
+ xml.tag(level++, "SynthI");
+ AudioTrack::writeProperties(level, xml);
+ xml.strTag(level, "class", synth()->baseName());
+
+ // To support plugins like dssi-vst where all the baseNames are the same 'dssi-vst' and the label is the name of the dll file.
+ // Added by Tim. p3.3.16
+ xml.strTag(level, "label", synth()->name());
+
+ //---------------------------------------------
+ // if soft synth is attached to a midi port,
+ // write out port number
+ //---------------------------------------------
+
+ if (midiPort() != -1)
+ xml.intTag(level, "port", midiPort());
+
+ if (hasGui()) {
+ xml.intTag(level, "guiVisible", guiVisible());
+ int x, y, w, h;
+ w = 0;
+ h = 0;
+ getGeometry(&x, &y, &w, &h);
+ if (h || w)
+ xml.qrectTag(level, "geometry", QRect(x, y, w, h));
+ }
+
+ _stringParamMap.write(level, xml, "stringParam");
+
+ xml.tag(level, "curProgram bankH=\"%ld\" bankL=\"%ld\" prog=\"%ld\"/", _curBankH, _curBankL, _curProgram);
+
+ _sif->write(level, xml);
+ xml.etag(level, "SynthI");
+ }
+
+void MessSynthIF::write(int level, Xml& xml) const
+ {
+ //---------------------------------------------
+ // dump current state of synth
+ //---------------------------------------------
+
+ int len = 0;
+ const unsigned char* p;
+ _mess->getInitData(&len, &p);
+ if (len) {
+ xml.tag(level++, "midistate");
+ xml.nput(level++, "<event type=\"%d\"", Sysex);
+ xml.nput(" datalen=\"%d\">\n", len);
+ xml.nput(level, "");
+ for (int i = 0; i < len; ++i) {
+ if (i && ((i % 16) == 0)) {
+ xml.nput("\n");
+ xml.nput(level, "");
+ }
+ xml.nput("%02x ", p[i] & 0xff);
+ }
+ xml.nput("\n");
+ xml.tag(level--, "/event");
+ xml.etag(level--, "midistate");
+ }
+ }
+
+//---------------------------------------------------------
+// SynthI::readProgram
+//---------------------------------------------------------
+
+void SynthI::readProgram(Xml& xml, const QString& name)
+{
+ for (;;)
+ {
+ Xml::Token token = xml.parse();
+ const QString tag = xml.s1();
+ switch (token)
+ {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ xml.unknown(name);
+ break;
+ case Xml::Attribut:
+ if(tag == "bankH")
+ _curBankH = xml.s2().toUInt();
+ else
+ if(tag == "bankL")
+ _curBankL = xml.s2().toUInt();
+ else
+ if(tag == "prog")
+ _curProgram = xml.s2().toUInt();
+ else
+ xml.unknown(name);
+ break;
+ case Xml::TagEnd:
+ if(tag == name)
+ return;
+ default:
+ break;
+ }
+ }
+}
+
+//---------------------------------------------------------
+// SynthI::read
+//---------------------------------------------------------
+
+void SynthI::read(Xml& xml)
+ {
+ QString sclass;
+ QString label;
+
+ int port = -1;
+ bool startgui = false;
+ QRect r;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "class")
+ sclass = xml.parse1();
+ else if (tag == "label")
+ label = xml.parse1();
+ else if (tag == "port")
+ port = xml.parseInt();
+ else if (tag == "guiVisible")
+ startgui = xml.parseInt();
+ else if (tag == "midistate")
+ readMidiState(xml);
+ else if (tag == "param") {
+ float val = xml.parseFloat();
+ initParams.push_back(val);
+ }
+ else if (tag == "stringParam")
+ _stringParamMap.read(xml, tag);
+ else if (tag == "curProgram")
+ readProgram(xml, tag);
+ else if (tag == "geometry")
+ r = readGeometry(xml, tag);
+ else if (AudioTrack::readProperties(xml, tag))
+ xml.unknown("softSynth");
+ break;
+ case Xml::TagEnd:
+ if (tag == "SynthI") {
+ //Synth* s = findSynth(sclass);
+ Synth* s = findSynth(sclass, label);
+ if (s == 0)
+ return;
+ if (initInstance(s, name()))
+ return;
+ song->insertTrack0(this, -1);
+ if (port != -1 && port < MIDI_PORTS)
+ midiPorts[port].setMidiDevice(this);
+
+ // Now that the track has been added to the lists in insertTrack2(),
+ // if it's a dssi synth, OSC can find the synth, and initialize (and show) its native gui.
+ // No, initializing OSC without actually showing the gui doesn't work, at least for
+ // dssi-vst plugins - without showing the gui they exit after ten seconds.
+ //initGui();
+ showGui(startgui);
+ setGeometry(r.x(), r.y(), r.width(), r.height());
+
+ mapRackPluginsToControllers();
+
+ // Now that the track has been added to the lists in insertTrack2(), if it's a dssi synth
+ // OSC can find the track and its plugins, and start their native guis if required...
+ showPendingPluginNativeGuis();
+
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ AudioTrack::mapRackPluginsToControllers();
+ }
+
+//---------------------------------------------------------
+// getPatchName
+//---------------------------------------------------------
+
+const char* MessSynthIF::getPatchName(int channel, int prog, MType type, bool drum)
+ {
+ if (_mess)
+ {
+ //return _mess->getPatchName(channel, prog, type, drum);
+ const char* s = _mess->getPatchName(channel, prog, type, drum);
+ if(s)
+ return s;
+ }
+ return "";
+ }
+
+//---------------------------------------------------------
+// populatePatchPopup
+//---------------------------------------------------------
+
+void MessSynthIF::populatePatchPopup(Q3PopupMenu* menu, int ch, MType, bool)
+ {
+ menu->clear();
+ const MidiPatch* mp = _mess->getPatchInfo(ch, 0);
+ while (mp) {
+ int id = ((mp->hbank & 0xff) << 16)
+ + ((mp->lbank & 0xff) << 8) + mp->prog;
+ /*
+ int pgid = ((mp->hbank & 0xff) << 8) | (mp->lbank & 0xff) | 0x40000000;
+ int itemnum = menu->indexOf(pgid);
+ if(itemnum == -1)
+ {
+ QPopupMenu* submenu = new QPopupMenu(menu);
+ itemnum =
+ }
+ */
+ menu->insertItem(QString(mp->name), id);
+ mp = _mess->getPatchInfo(ch, mp);
+ }
+ }
+
+//---------------------------------------------------------
+// preProcessAlways
+//---------------------------------------------------------
+
+void SynthI::preProcessAlways()
+{
+ if(_sif)
+ _sif->preProcessAlways();
+ _processed = false;
+}
+
+void MessSynthIF::preProcessAlways()
+{
+ if(_mess)
+ _mess->processMessages();
+}
+
+//---------------------------------------------------------
+// getData
+//---------------------------------------------------------
+
+bool SynthI::getData(unsigned pos, int ports, unsigned n, float** buffer)
+ {
+ for (int k = 0; k < ports; ++k)
+ memset(buffer[k], 0, n * sizeof(float));
+
+ int p = midiPort();
+ MidiPort* mp = (p != -1) ? &midiPorts[p] : 0;
+ MPEventList* el = playEvents();
+
+ iMPEvent ie = nextPlayEvent();
+
+ ie = _sif->getData(mp, el, ie, pos, ports, n, buffer);
+
+ setNextPlayEvent(ie);
+ return true;
+ }
+
+iMPEvent MessSynthIF::getData(MidiPort* mp, MPEventList* el, iMPEvent i, unsigned pos, int /*ports*/, unsigned n, float** buffer)
+{
+ //prevent compiler warning: comparison of signed/unsigned
+ int curPos = pos;
+ int endPos = pos + n;
+ int off = pos;
+ int frameOffset = audio->getFrameOffset();
+
+ for (; i != el->end(); ++i) {
+ int evTime = i->time();
+ if (evTime == 0) {
+ // printf("MessSynthIF::getData - time is 0!\n");
+ // continue;
+ evTime=frameOffset; // will cause frame to be zero, problem?
+ }
+ int frame = evTime - frameOffset;
+
+//TODO if (frame > 0) // robert: ugly fix, don't really know what is going on here
+// // makes PPC work much better.
+
+ if (frame >= endPos) {
+ printf("frame > endPos!! frame = %d >= endPos %d, i->time() %d, frameOffset %d curPos=%d\n", frame, endPos, i->time(), frameOffset,curPos);
+ continue;
+ }
+
+ if (frame > curPos) {
+ if (frame < pos)
+ printf("should not happen: missed event %d\n", pos -frame);
+ else
+ {
+ if (!_mess)
+ printf("should not happen - no _mess\n");
+ else
+ {
+ _mess->process(buffer, curPos-pos, frame - curPos);
+ }
+ }
+ curPos = frame;
+ }
+ if (mp)
+ mp->sendEvent(*i);
+ else {
+ if (putEvent(*i))
+ break;
+ }
+ }
+ if (endPos - curPos)
+ {
+ if (!_mess)
+ printf("should not happen - no _mess\n");
+ else
+ {
+ _mess->process(buffer, curPos - off, endPos - curPos);
+ }
+ }
+ return i;
+}
+
+//---------------------------------------------------------
+// putEvent
+// return true on error (busy)
+//---------------------------------------------------------
+
+bool MessSynthIF::putEvent(const MidiPlayEvent& ev)
+ {
+ if (midiOutputTrace)
+ ev.dump();
+ if (_mess)
+ return _mess->processEvent(ev);
+ return true;
+ }
diff --git a/muse2/muse/synth.h b/muse2/muse/synth.h
new file mode 100644
index 00000000..627d276f
--- /dev/null
+++ b/muse2/muse/synth.h
@@ -0,0 +1,290 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: synth.h,v 1.22.2.12 2009/12/06 10:05:00 terminator356 Exp $
+// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SYNTH_H__
+#define __SYNTH_H__
+
+#include <QFileInfo>
+//Added by qt3to4:
+#include <Q3PopupMenu>
+#include <string>
+#include <vector>
+#include <map>
+
+#include "globals.h"
+#include "node.h"
+#include "instruments/minstrument.h"
+#include "mididev.h"
+#include "midiport.h"
+#include "track.h"
+#include "stringparam.h"
+
+//class MidiEvent;
+class MidiPlayEvent;
+class Mess;
+struct MESS;
+
+class SynthI;
+class SynthIF;
+
+//---------------------------------------------------------
+// Synth
+// software synthesizer
+//---------------------------------------------------------
+
+class Synth {
+ protected:
+ QFileInfo info;
+ int _instances;
+ QString _name;
+ QString _description;
+ QString _maker;
+ QString _version;
+
+ public:
+ //Synth(const QFileInfo& fi);
+ //Synth(const QFileInfo& fi, QString label);
+ Synth(const QFileInfo& fi, QString label, QString descr, QString maker, QString ver);
+
+ virtual ~Synth() {}
+ //virtual const char* description() const { return ""; }
+ //virtual const char* version() const { return ""; }
+
+ int instances() const { return _instances; }
+ virtual void incInstances(int val) { _instances += val; }
+ QString baseName(bool complete = true) /*const*/ { return info.baseName(complete); } // ddskrjo
+ QString name() const { return _name; }
+ QString dirPath(bool complete = true) const { return info.dirPath(complete); }
+ QString filePath() const { return info.filePath(); }
+ QString description() const { return _description; }
+ QString version() const { return _version; }
+ //QString maker() const { return _version; } ??
+ QString maker() const { return _maker; }
+
+ //virtual void* instantiate() = 0;
+
+ //virtual SynthIF* createSIF() const = 0;
+ virtual SynthIF* createSIF(SynthI*) = 0;
+ };
+
+//---------------------------------------------------------
+// MessSynth
+//---------------------------------------------------------
+
+class MessSynth : public Synth {
+ const MESS* _descr;
+
+ public:
+ //MessSynth(const QFileInfo& fi) : Synth(fi) { descr = 0; }
+ //MessSynth(const QFileInfo& fi) : Synth(fi, fi.baseName()) { descr = 0; }
+ MessSynth(const QFileInfo& fi, QString label, QString descr, QString maker, QString ver) :
+ Synth(fi, label, descr, maker, ver) { _descr = 0; }
+
+ virtual ~MessSynth() {}
+ //virtual const char* description() const;
+ //virtual const char* version() const;
+
+ //virtual void* instantiate();
+ virtual void* instantiate(const QString&);
+
+ //virtual SynthIF* createSIF() const;
+ virtual SynthIF* createSIF(SynthI*);
+ };
+
+class Mess;
+
+//---------------------------------------------------------
+// SynthIF
+// synth instance interface
+//---------------------------------------------------------
+
+class SynthIF {
+ protected:
+ SynthI* synti;
+
+ public:
+ //SynthIF() {}
+ SynthIF(SynthI* s) { synti = s; }
+ virtual ~SynthIF() {}
+
+ virtual bool initGui() = 0;
+ virtual void guiHeartBeat() = 0;
+ virtual bool guiVisible() const = 0;
+ virtual void showGui(bool v) = 0;
+ virtual bool hasGui() const = 0;
+ virtual void getGeometry(int*, int*, int*, int*) const = 0;
+ virtual void setGeometry(int, int, int, int) = 0;
+ virtual void preProcessAlways() = 0;
+ virtual iMPEvent getData(MidiPort*, MPEventList*, iMPEvent, unsigned pos, int ports, unsigned n, float** buffer) = 0;
+ virtual bool putEvent(const MidiPlayEvent& ev) = 0;
+ virtual MidiPlayEvent receiveEvent() = 0;
+ virtual int eventsPending() const = 0;
+
+ //virtual bool init(Synth* s) = 0;
+
+ virtual int channels() const = 0;
+ virtual int totalOutChannels() const = 0;
+ virtual int totalInChannels() const = 0;
+ virtual void deactivate3() = 0;
+ virtual const char* getPatchName(int, int, int, bool) const = 0;
+ virtual const char* getPatchName(int, int, MType, bool) = 0;
+ virtual void populatePatchPopup(Q3PopupMenu*, int, MType, bool) = 0;
+ virtual void write(int level, Xml& xml) const = 0;
+ virtual float getParameter(unsigned long idx) const = 0;
+ virtual void setParameter(unsigned long idx, float value) = 0;
+ virtual int getControllerInfo(int id, const char** name, int* ctrl, int* min, int* max, int* initval) = 0;
+ };
+
+//---------------------------------------------------------
+// SynthI
+// software synthesizer instance
+// Track
+// MidiDevice
+// MidiInstrument
+//---------------------------------------------------------
+
+class SynthI : public AudioTrack, public MidiDevice,
+ public MidiInstrument
+ {
+ SynthIF* _sif;
+
+ protected:
+ Synth* synthesizer;
+ MidiFifo putFifo;
+
+ // List of initial floating point parameters, for synths which use them.
+ // Used once upon song reload, then discarded.
+ std::vector<float> initParams;
+ // List of gui controls to update upon heartbeat.
+ std::vector<bool> _guiUpdateControls;
+ // Update gui program upon heartbeat.
+ bool _guiUpdateProgram;
+ // Initial, and running, string parameters for synths which use them, like dssi.
+ StringParamMap _stringParamMap;
+ // Current bank and program for synths which use them, like dssi.
+ // In cases like dssi which have no 'hi' and 'lo' bank, just use _curBankL.
+ unsigned long _curBankH;
+ unsigned long _curBankL;
+ unsigned long _curProgram;
+
+ void preProcessAlways();
+ bool getData(unsigned a, int b, unsigned c, float** data);
+
+ //bool putEvent(const MidiPlayEvent& ev);
+
+ virtual QString open();
+ virtual void close();
+
+ virtual bool putMidiEvent(const MidiPlayEvent&) {return true;}
+ //bool putMidiEvent(const MidiEvent&);
+
+ virtual Track* newTrack() const { return 0; }
+
+ public:
+ friend class SynthIF;
+ friend class MessSynthIF;
+ friend class DssiSynthIF;
+ friend class VstSynthIF;
+
+ SynthI();
+ virtual ~SynthI();
+ //SynthI* clone() const { return new SynthI(*this); }
+ SynthI* clone(bool /*cloneParts*/) const { return new SynthI(*this); }
+
+ virtual inline int deviceType() { return SYNTH_MIDI; }
+
+ SynthIF* sif() const { return _sif; }
+ bool initInstance(Synth* s, const QString& instanceName);
+
+ void readProgram(Xml&, const QString&);
+ void read(Xml&);
+ virtual void write(int, Xml&) const;
+
+ void setName(const QString& s);
+ QString name() const { return AudioTrack::name(); }
+
+ Synth* synth() const { return synthesizer; }
+ virtual bool isSynti() const { return true; }
+
+ virtual const char* getPatchName(int ch, int prog, MType t, bool dr) {
+ return _sif->getPatchName(ch, prog, t, dr);
+ }
+
+ virtual void populatePatchPopup(Q3PopupMenu* m, int i, MType t, bool d) {
+ _sif->populatePatchPopup(m, i, t, d);
+ }
+
+ // void setParameter(const char* name, const char* value) const; // Not required
+ //StringParamMap& stringParameters() { return _stringParamMap; } // Not required
+ void currentProg(unsigned long */*prog*/, unsigned long */*bankL*/, unsigned long */*bankH*/);
+
+ void guiHeartBeat() { return _sif->guiHeartBeat(); }
+ bool initGui() const { return _sif->initGui(); }
+ bool guiVisible() const { return _sif->guiVisible(); }
+ void showGui(bool v) { _sif->showGui(v); }
+ bool hasGui() const { return _sif->hasGui(); }
+ void getGeometry(int* x, int* y, int* w, int* h) const {
+ _sif->getGeometry(x, y, w, h);
+ }
+ void setGeometry(int x, int y, int w, int h) {
+ _sif->setGeometry(x, y, w, h);
+ }
+
+ bool putEvent(const MidiPlayEvent& ev);
+
+ MidiPlayEvent receiveEvent() { return _sif->receiveEvent(); }
+ int eventsPending() const { return _sif->eventsPending(); }
+ void deactivate2();
+ void deactivate3();
+ bool isActivated() const { return synthesizer && _sif; }
+ virtual bool hasAuxSend() const { return true; }
+ };
+
+//---------------------------------------------------------
+// MessSynthIF
+// mess synthesizer instance
+//---------------------------------------------------------
+
+class MessSynthIF : public SynthIF {
+ Mess* _mess;
+
+ public:
+ //MessSynthIF() { _mess = 0; }
+ MessSynthIF(SynthI* s) : SynthIF(s) { _mess = 0; }
+ virtual ~MessSynthIF() { }
+
+ virtual bool initGui() { return true; };
+ virtual void guiHeartBeat() { }
+ virtual bool guiVisible() const;
+ virtual void showGui(bool v);
+ virtual bool hasGui() const;
+ virtual void getGeometry(int*, int*, int*, int*) const;
+ virtual void setGeometry(int, int, int, int);
+ virtual void preProcessAlways();
+ virtual iMPEvent getData(MidiPort*, MPEventList*, iMPEvent, unsigned pos, int ports, unsigned n, float** buffer);
+ virtual bool putEvent(const MidiPlayEvent& ev);
+ virtual MidiPlayEvent receiveEvent();
+ virtual int eventsPending() const;
+ //virtual bool init(Synth* s);
+ bool init(Synth* s, SynthI* si);
+
+ virtual int channels() const;
+ virtual int totalOutChannels() const;
+ virtual int totalInChannels() const;
+ virtual void deactivate3();
+ virtual const char* getPatchName(int, int, int, bool) const { return ""; }
+ virtual const char* getPatchName(int, int, MType, bool);
+ virtual void populatePatchPopup(Q3PopupMenu*, int, MType, bool);
+ virtual void write(int level, Xml& xml) const;
+ virtual float getParameter(unsigned long) const { return 0.0; }
+ virtual void setParameter(unsigned long, float) {}
+ virtual int getControllerInfo(int id, const char** name, int* ctrl, int* min, int* max, int* initval);
+ };
+
+extern std::vector<Synth*> synthis; // array of available synthis
+#endif
+
diff --git a/muse2/muse/tempo.cpp b/muse2/muse/tempo.cpp
new file mode 100644
index 00000000..418ec031
--- /dev/null
+++ b/muse2/muse/tempo.cpp
@@ -0,0 +1,503 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: tempo.cpp,v 1.7.2.7 2008/05/21 00:28:52 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <errno.h>
+#include <cmath>
+
+#include "tempo.h"
+#include "globals.h"
+#include "gconfig.h"
+#include "xml.h"
+
+TempoList tempomap;
+
+//---------------------------------------------------------
+// TempoList
+//---------------------------------------------------------
+
+TempoList::TempoList()
+ {
+ _tempo = 500000;
+ insert(std::pair<const unsigned, TEvent*> (MAX_TICK+1, new TEvent(_tempo, 0)));
+ _tempoSN = 1;
+ _globalTempo = 100;
+ useList = true;
+ }
+
+//---------------------------------------------------------
+// add
+//---------------------------------------------------------
+
+void TempoList::add(unsigned tick, int tempo)
+ {
+ if (tick > MAX_TICK)
+ tick = MAX_TICK;
+ iTEvent e = upper_bound(tick);
+
+ if (tick == e->second->tick)
+ e->second->tempo = tempo;
+ else {
+ TEvent* ne = e->second;
+ TEvent* ev = new TEvent(ne->tempo, ne->tick);
+ ne->tempo = tempo;
+ ne->tick = tick;
+ insert(std::pair<const unsigned, TEvent*> (tick, ev));
+ }
+ normalize();
+ }
+
+//---------------------------------------------------------
+// TempoList::normalize
+//---------------------------------------------------------
+
+void TempoList::normalize()
+ {
+ int frame = 0;
+ for (iTEvent e = begin(); e != end(); ++e) {
+ e->second->frame = frame;
+ unsigned dtick = e->first - e->second->tick;
+ double dtime = double(dtick) / (config.division * _globalTempo * 10000.0/e->second->tempo);
+ frame += lrint(dtime * sampleRate);
+ }
+ }
+
+//---------------------------------------------------------
+// TempoList::dump
+//---------------------------------------------------------
+
+void TempoList::dump() const
+ {
+ printf("\nTempoList:\n");
+ for (ciTEvent i = begin(); i != end(); ++i) {
+ printf("%6d %06d Tempo %6d Frame %d\n",
+ i->first, i->second->tick, i->second->tempo,
+ i->second->frame);
+ }
+ }
+
+//---------------------------------------------------------
+// clear
+//---------------------------------------------------------
+
+void TempoList::clear()
+ {
+ for (iTEvent i = begin(); i != end(); ++i)
+ delete i->second;
+ TEMPOLIST::clear();
+ insert(std::pair<const unsigned, TEvent*> (MAX_TICK+1, new TEvent(500000, 0)));
+ ++_tempoSN;
+ }
+
+//---------------------------------------------------------
+// tempo
+//---------------------------------------------------------
+
+int TempoList::tempo(unsigned tick) const
+ {
+ if (useList) {
+ ciTEvent i = upper_bound(tick);
+ if (i == end()) {
+ printf("no TEMPO at tick %d,0x%x\n", tick, tick);
+ return 1000;
+ }
+ return i->second->tempo;
+ }
+ else
+ return _tempo;
+ }
+
+//---------------------------------------------------------
+// del
+//---------------------------------------------------------
+
+void TempoList::del(unsigned tick)
+ {
+// printf("TempoList::del(%d)\n", tick);
+ iTEvent e = find(tick);
+ if (e == end()) {
+ printf("TempoList::del(%d): not found\n", tick);
+ return;
+ }
+ del(e);
+ ++_tempoSN;
+ }
+
+void TempoList::del(iTEvent e)
+ {
+ iTEvent ne = e;
+ ++ne;
+ if (ne == end()) {
+ printf("TempoList::del() HALLO\n");
+ return;
+ }
+ ne->second->tempo = e->second->tempo;
+ ne->second->tick = e->second->tick;
+ erase(e);
+ normalize();
+ ++_tempoSN;
+ }
+
+//---------------------------------------------------------
+// change
+//---------------------------------------------------------
+
+void TempoList::change(unsigned tick, int newTempo)
+ {
+ iTEvent e = find(tick);
+ e->second->tempo = newTempo;
+ normalize();
+ ++_tempoSN;
+ }
+
+//---------------------------------------------------------
+// setTempo
+// called from transport window
+// & slave mode tempo changes
+//---------------------------------------------------------
+
+void TempoList::setTempo(unsigned tick, int newTempo)
+ {
+ if (useList)
+ add(tick, newTempo);
+ else
+ _tempo = newTempo;
+ ++_tempoSN;
+ }
+
+//---------------------------------------------------------
+// setGlobalTempo
+//---------------------------------------------------------
+
+void TempoList::setGlobalTempo(int val)
+ {
+ _globalTempo = val;
+ ++_tempoSN;
+ normalize();
+ }
+
+//---------------------------------------------------------
+// addTempo
+//---------------------------------------------------------
+
+void TempoList::addTempo(unsigned t, int tempo)
+ {
+ add(t, tempo);
+ ++_tempoSN;
+ }
+
+//---------------------------------------------------------
+// delTempo
+//---------------------------------------------------------
+
+void TempoList::delTempo(unsigned tick)
+ {
+ del(tick);
+ ++_tempoSN;
+ }
+
+//---------------------------------------------------------
+// changeTempo
+//---------------------------------------------------------
+
+void TempoList::changeTempo(unsigned tick, int newTempo)
+ {
+ change(tick, newTempo);
+ ++_tempoSN;
+ }
+
+//---------------------------------------------------------
+// setMasterFlag
+//---------------------------------------------------------
+
+bool TempoList::setMasterFlag(unsigned /*tick*/, bool val)
+ {
+ if (useList != val) {
+ useList = val;
+ ++_tempoSN;
+ return true;
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// tick2frame
+//---------------------------------------------------------
+
+unsigned TempoList::tick2frame(unsigned tick, unsigned frame, int* sn) const
+ {
+ return (*sn == _tempoSN) ? frame : tick2frame(tick, sn);
+ }
+
+//---------------------------------------------------------
+// tick2frame
+//---------------------------------------------------------
+
+unsigned TempoList::tick2frame(unsigned tick, int* sn) const
+ {
+ int f;
+ if (useList) {
+ ciTEvent i = upper_bound(tick);
+ if (i == end()) {
+ printf("tick2frame(%d,0x%x): not found\n", tick, tick);
+ // abort();
+ return 0;
+ }
+ unsigned dtick = tick - i->second->tick;
+ double dtime = double(dtick) / (config.division * _globalTempo * 10000.0/ i->second->tempo);
+ unsigned dframe = lrint(dtime * sampleRate);
+ f = i->second->frame + dframe;
+ }
+ else {
+ double t = (double(tick) * double(_tempo)) / (double(config.division) * _globalTempo * 10000.0);
+ f = lrint(t * sampleRate);
+ }
+ if (sn)
+ *sn = _tempoSN;
+ return f;
+ }
+
+//---------------------------------------------------------
+// frame2tick
+// return cached value t if list did not change
+//---------------------------------------------------------
+
+unsigned TempoList::frame2tick(unsigned frame, unsigned t, int* sn) const
+ {
+ return (*sn == _tempoSN) ? t : frame2tick(frame, sn);
+ }
+
+//---------------------------------------------------------
+// frame2tick
+//---------------------------------------------------------
+
+unsigned TempoList::frame2tick(unsigned frame, int* sn) const
+ {
+ unsigned tick;
+ if (useList) {
+ ciTEvent e;
+ for (e = begin(); e != end();) {
+ ciTEvent ee = e;
+ ++ee;
+ if (ee == end())
+ break;
+ if (frame < ee->second->frame)
+ break;
+ e = ee;
+ }
+ unsigned te = e->second->tempo;
+ int dframe = frame - e->second->frame;
+ double dtime = double(dframe) / double(sampleRate);
+ tick = e->second->tick + lrint(dtime * _globalTempo * config.division * 10000.0 / te);
+ }
+ else
+ tick = lrint((double(frame)/double(sampleRate)) * _globalTempo * config.division * 10000.0 / double(_tempo));
+ if (sn)
+ *sn = _tempoSN;
+ return tick;
+ }
+
+//---------------------------------------------------------
+// deltaTick2frame
+//---------------------------------------------------------
+
+unsigned TempoList::deltaTick2frame(unsigned tick1, unsigned tick2, int* sn) const
+ {
+ int f1, f2;
+ if (useList) {
+ ciTEvent i = upper_bound(tick1);
+ if (i == end()) {
+ printf("TempoList::deltaTick2frame: tick1:%d not found\n", tick1);
+ // abort();
+ return 0;
+ }
+ unsigned dtick = tick1 - i->second->tick;
+ double dtime = double(dtick) / (config.division * _globalTempo * 10000.0/ i->second->tempo);
+ unsigned dframe = lrint(dtime * sampleRate);
+ f1 = i->second->frame + dframe;
+
+ i = upper_bound(tick2);
+ if (i == end()) {
+ return 0;
+ }
+ dtick = tick2 - i->second->tick;
+ dtime = double(dtick) / (config.division * _globalTempo * 10000.0/ i->second->tempo);
+ dframe = lrint(dtime * sampleRate);
+ f2 = i->second->frame + dframe;
+ }
+ else {
+ double t = (double(tick1) * double(_tempo)) / (double(config.division) * _globalTempo * 10000.0);
+ f1 = lrint(t * sampleRate);
+
+ t = (double(tick2) * double(_tempo)) / (double(config.division) * _globalTempo * 10000.0);
+ f2 = lrint(t * sampleRate);
+ }
+ if (sn)
+ *sn = _tempoSN;
+ // FIXME: Caution: This should be rounded off properly somehow, but how to do that?
+ // But it seems to work so far.
+ return f2 - f1;
+ }
+
+
+//---------------------------------------------------------
+// deltaFrame2tick
+//---------------------------------------------------------
+
+unsigned TempoList::deltaFrame2tick(unsigned frame1, unsigned frame2, int* sn) const
+ {
+ unsigned tick1, tick2;
+ if (useList) {
+ ciTEvent e;
+ for (e = begin(); e != end();) {
+ ciTEvent ee = e;
+ ++ee;
+ if (ee == end())
+ break;
+ if (frame1 < ee->second->frame)
+ break;
+ e = ee;
+ }
+ unsigned te = e->second->tempo;
+ int dframe = frame1 - e->second->frame;
+ double dtime = double(dframe) / double(sampleRate);
+ tick1 = e->second->tick + lrint(dtime * _globalTempo * config.division * 10000.0 / te);
+
+ for (e = begin(); e != end();) {
+ ciTEvent ee = e;
+ ++ee;
+ if (ee == end())
+ break;
+ if (frame2 < ee->second->frame)
+ break;
+ e = ee;
+ }
+ te = e->second->tempo;
+ dframe = frame2 - e->second->frame;
+ dtime = double(dframe) / double(sampleRate);
+ tick2 = e->second->tick + lrint(dtime * _globalTempo * config.division * 10000.0 / te);
+ }
+ else
+ {
+ tick1 = lrint((double(frame1)/double(sampleRate)) * _globalTempo * config.division * 10000.0 / double(_tempo));
+ tick2 = lrint((double(frame2)/double(sampleRate)) * _globalTempo * config.division * 10000.0 / double(_tempo));
+ }
+ if (sn)
+ *sn = _tempoSN;
+ // FIXME: Caution: This should be rounded off properly somehow, but how to do that?
+ // But it seems to work so far.
+ return tick2 - tick1;
+ }
+
+//---------------------------------------------------------
+// TempoList::write
+//---------------------------------------------------------
+
+void TempoList::write(int level, Xml& xml) const
+ {
+ xml.put(level++, "<tempolist fix=\"%d\">", _tempo);
+ if (_globalTempo != 100)
+ xml.intTag(level, "globalTempo", _globalTempo);
+ for (ciTEvent i = begin(); i != end(); ++i)
+ i->second->write(level, xml, i->first);
+ xml.tag(level, "/tempolist");
+ }
+
+//---------------------------------------------------------
+// TempoList::read
+//---------------------------------------------------------
+
+void TempoList::read(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "tempo") {
+ TEvent* t = new TEvent();
+ unsigned tick = t->read(xml);
+ iTEvent pos = find(tick);
+ if (pos != end())
+ erase(pos);
+ insert(std::pair<const int, TEvent*> (tick, t));
+ }
+ else if (tag == "globalTempo")
+ _globalTempo = xml.parseInt();
+ else
+ xml.unknown("TempoList");
+ break;
+ case Xml::Attribut:
+ if (tag == "fix")
+ _tempo = xml.s2().toInt();
+ break;
+ case Xml::TagEnd:
+ if (tag == "tempolist") {
+ normalize();
+ ++_tempoSN;
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// TEvent::write
+//---------------------------------------------------------
+
+void TEvent::write(int level, Xml& xml, int at) const
+ {
+ xml.tag(level++, "tempo at=\"%d\"", at);
+ xml.intTag(level, "tick", tick);
+ xml.intTag(level, "val", tempo);
+ xml.tag(level, "/tempo");
+ }
+
+//---------------------------------------------------------
+// TEvent::read
+//---------------------------------------------------------
+
+int TEvent::read(Xml& xml)
+ {
+ int at = 0;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return 0;
+ case Xml::TagStart:
+ if (tag == "tick")
+ tick = xml.parseInt();
+ else if (tag == "val")
+ tempo = xml.parseInt();
+ else
+ xml.unknown("TEvent");
+ break;
+ case Xml::Attribut:
+ if (tag == "at")
+ at = xml.s2().toInt();
+ break;
+ case Xml::TagEnd:
+ if (tag == "tempo") {
+ return at;
+ }
+ default:
+ break;
+ }
+ }
+ return 0;
+ }
+
+
diff --git a/muse2/muse/tempo.h b/muse2/muse/tempo.h
new file mode 100644
index 00000000..61ec50f5
--- /dev/null
+++ b/muse2/muse/tempo.h
@@ -0,0 +1,89 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: tempo.h,v 1.2.2.1 2006/09/19 19:07:09 spamatica Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __TEMPO_H__
+#define __TEMPO_H__
+
+#include <map>
+
+#ifndef MAX_TICK
+#define MAX_TICK (0x7fffffff/100)
+#endif
+
+class Xml;
+
+//---------------------------------------------------------
+// Tempo Event
+//---------------------------------------------------------
+
+struct TEvent {
+ int tempo;
+ unsigned tick; // new tempo at tick
+ unsigned frame; // precomputed time for tick in sec
+
+ int read(Xml&);
+ void write(int, Xml&, int) const;
+
+ TEvent() { }
+ TEvent(unsigned t, unsigned tk) {
+ tempo = t;
+ tick = tk;
+ frame = 0;
+ }
+ };
+
+//---------------------------------------------------------
+// TempoList
+//---------------------------------------------------------
+
+typedef std::map<unsigned, TEvent*, std::less<unsigned> > TEMPOLIST;
+typedef TEMPOLIST::iterator iTEvent;
+typedef TEMPOLIST::const_iterator ciTEvent;
+typedef TEMPOLIST::reverse_iterator riTEvent;
+typedef TEMPOLIST::const_reverse_iterator criTEvent;
+
+class TempoList : public TEMPOLIST {
+ int _tempoSN; // serial no to track tempo changes
+ bool useList;
+ int _tempo; // tempo if not using tempo list
+ int _globalTempo; // %percent 50-200%
+
+ void normalize();
+ void add(unsigned tick, int tempo);
+ void change(unsigned tick, int newTempo);
+ void del(iTEvent);
+ void del(unsigned tick);
+
+ public:
+ TempoList();
+ void clear();
+
+ void read(Xml&);
+ void write(int, Xml&) const;
+ void dump() const;
+
+ int tempo(unsigned tick) const;
+ unsigned tick2frame(unsigned tick, unsigned frame, int* sn) const;
+ unsigned tick2frame(unsigned tick, int* sn = 0) const;
+ unsigned frame2tick(unsigned frame, int* sn = 0) const;
+ unsigned frame2tick(unsigned frame, unsigned tick, int* sn) const;
+ unsigned deltaTick2frame(unsigned tick1, unsigned tick2, int* sn = 0) const;
+ unsigned deltaFrame2tick(unsigned frame1, unsigned frame2, int* sn = 0) const;
+
+ int tempoSN() const { return _tempoSN; }
+ void setTempo(unsigned tick, int newTempo);
+ void addTempo(unsigned t, int tempo);
+ void delTempo(unsigned tick);
+ void changeTempo(unsigned tick, int newTempo);
+ bool setMasterFlag(unsigned tick, bool val);
+ int globalTempo() const { return _globalTempo; }
+ void setGlobalTempo(int val);
+ };
+
+extern TempoList tempomap;
+#endif
diff --git a/muse2/muse/thread.cpp b/muse2/muse/thread.cpp
new file mode 100644
index 00000000..444d5219
--- /dev/null
+++ b/muse2/muse/thread.cpp
@@ -0,0 +1,455 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: thread.cpp,v 1.4.2.5 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2001-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "thread.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/poll.h>
+#include <fcntl.h>
+
+#include "globals.h"
+#include "errno.h"
+
+//---------------------------------------------------------
+// Thread
+//---------------------------------------------------------
+
+Thread::~Thread()
+ {
+ }
+
+//---------------------------------------------------------
+// serverloop
+//---------------------------------------------------------
+
+static void* loop(void* mops)
+ {
+ Thread* t = (Thread*) mops;
+ t->loop();
+ return 0;
+ }
+
+//---------------------------------------------------------
+// start
+//---------------------------------------------------------
+
+//void Thread::start(void* ptr)
+void Thread::start(int prio, void* ptr)
+ {
+ // Changed by Tim. p3.3.17
+
+ userPtr = ptr;
+ pthread_attr_t* attributes = 0;
+ _realTimePriority = prio;
+
+ /*
+ attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t));
+ pthread_attr_init(attributes);
+ */
+
+// pthread_mutexattr_t mutexattr;
+// pthread_mutexattr_init(&mutexattr);
+// pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_TIMED_NP);
+// pthread_mutex_init(&lock, &mutexattr);
+// pthread_cond_init(&ready, 0);
+
+// pthread_mutex_lock(&lock);
+
+
+ if (_realTimePriority) {
+ attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t));
+ pthread_attr_init(attributes);
+
+ if (pthread_attr_setschedpolicy(attributes, SCHED_FIFO)) {
+ printf("cannot set FIFO scheduling class for RT thread\n");
+ }
+ if (pthread_attr_setscope (attributes, PTHREAD_SCOPE_SYSTEM)) {
+ printf("Cannot set scheduling scope for RT thread\n");
+ }
+ if (pthread_attr_setinheritsched(attributes, PTHREAD_EXPLICIT_SCHED)) {
+ printf("Cannot set setinheritsched for RT thread\n");
+ }
+
+ struct sched_param rt_param;
+ memset(&rt_param, 0, sizeof(rt_param));
+ rt_param.sched_priority = _realTimePriority;
+ if (pthread_attr_setschedparam (attributes, &rt_param)) {
+ printf("Cannot set scheduling priority %d for RT thread (%s)\n",
+ _realTimePriority, strerror(errno));
+ }
+ }
+
+
+ /*
+ if (pthread_create(&thread, attributes, ::loop, this))
+ perror("creating thread failed:");
+// else
+// {
+// pthread_cond_wait(&ready, &lock);
+// }
+// pthread_mutex_unlock(&lock);
+ */
+
+
+ int rv;
+ if ((rv = pthread_create(&thread, attributes, ::loop, this)))
+ {
+ fprintf(stderr, "creating thread <%s> failed: %s\n",
+ _name, strerror(rv));
+ thread = 0;
+ }
+
+ //undoSetuid();
+ }
+
+//---------------------------------------------------------
+// stop
+//---------------------------------------------------------
+
+void Thread::stop(bool force)
+ {
+ // Changed by Tim. p3.3.17
+
+ if (thread == 0)
+ return;
+ //if (force && thread > 0) {
+ if (force) {
+ pthread_cancel(thread);
+ threadStop();
+ }
+ _running = false;
+ if (thread) {
+ if (pthread_join(thread, 0)) {
+ // perror("Failed to join sequencer thread");
+ }
+ }
+ }
+//---------------------------------------------------------
+// Thread
+// prio = 0 no realtime scheduling
+//---------------------------------------------------------
+
+//Thread::Thread(int prio, const char* s)
+Thread::Thread(const char* s)
+ {
+ // Changed by Tim. p3.3.17
+
+ userPtr = 0;
+ _name = s;
+ //realTimePriority = prio;
+ _realTimePriority = 0;
+
+ pfd = 0;
+ npfd = 0;
+ maxpfd = 0;
+ _running = false;
+ _pollWait = -1;
+ thread = 0;
+
+ //if (debugMsg)
+ // printf("Start thread %s with priority %d\n", s, prio);
+
+ // create message channels
+ int filedes[2]; // 0 - reading 1 - writing
+ if (pipe(filedes) == -1) {
+ perror("thread:creating pipe");
+ exit(-1);
+ }
+ toThreadFdr = filedes[0];
+ toThreadFdw = filedes[1];
+
+ if (pipe(filedes) == -1) {
+ perror("thread: creating pipe");
+ exit(-1);
+ }
+ fromThreadFdr = filedes[0];
+ fromThreadFdw = filedes[1];
+
+// pthread_mutexattr_t mutexattr;
+// pthread_mutexattr_init(&mutexattr);
+// pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_TIMED_NP);
+// pthread_mutex_init(&lock, &mutexattr);
+// pthread_cond_init(&ready, 0);
+ }
+
+//---------------------------------------------------------
+// addPollFd
+//---------------------------------------------------------
+
+void Thread::addPollFd(int fd, int action, void (*handler)(void*,void*), void* p, void* q)
+ {
+ if (fd == -1)
+ return;
+ for (iPoll i = plist.begin(); i != plist.end(); ++i) {
+ if ((i->fd == fd) && (i->action == action))
+ return;
+ }
+
+ plist.push_back(Poll(fd, action, handler, p, q));
+
+ if (npfd == maxpfd) {
+ int n = (maxpfd == 0) ? 4 : maxpfd * 2;
+ //TODO: delete old pfd
+ pfd = new struct pollfd[n];
+ maxpfd = n;
+ }
+ ++npfd;
+ int idx = 0;
+ for (iPoll i = plist.begin(); i != plist.end(); ++i, ++idx) {
+ pfd[idx].fd = i->fd;
+ pfd[idx].events = i->action;
+ }
+ }
+
+//---------------------------------------------------------
+// removePollFd
+//---------------------------------------------------------
+
+void Thread::removePollFd(int fd, int action)
+ {
+ for (iPoll i = plist.begin(); i != plist.end(); ++i) {
+ if (i->fd == fd && i->action == action) {
+ plist.erase(i);
+ --npfd;
+ break;
+ }
+ }
+ int idx = 0;
+ for (iPoll i = plist.begin(); i != plist.end(); ++i, ++idx) {
+ pfd[idx].fd = i->fd;
+ pfd[idx].events = i->action;
+ }
+ }
+
+//---------------------------------------------------------
+// loop
+//---------------------------------------------------------
+
+void Thread::loop()
+ {
+ // Changed by Tim. p3.3.17
+
+ if (!debugMode) {
+ if (mlockall(MCL_CURRENT | MCL_FUTURE))
+ perror("WARNING: Cannot lock memory:");
+ }
+
+/*
+ pthread_attr_t* attributes = 0;
+ attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t));
+ pthread_attr_init(attributes);
+
+ if (realTimeScheduling && realTimePriority > 0) {
+
+ doSetuid();
+// if (pthread_attr_setschedpolicy(attributes, SCHED_FIFO)) {
+// printf("cannot set FIFO scheduling class for RT thread\n");
+// }
+// if (pthread_attr_setscope (attributes, PTHREAD_SCOPE_SYSTEM)) {
+// printf("Cannot set scheduling scope for RT thread\n");
+// }
+// struct sched_param rt_param;
+// memset(&rt_param, 0, sizeof(rt_param));
+// rt_param.sched_priority = realTimePriority;
+// if (pthread_attr_setschedparam (attributes, &rt_param)) {
+// printf("Cannot set scheduling priority %d for RT thread (%s)\n",
+// realTimePriority, strerror(errno));
+// }
+
+ // do the SCHED_FIFO stuff _after_ thread creation:
+ struct sched_param *param = new struct sched_param;
+ param->sched_priority = realTimePriority;
+ int error = pthread_setschedparam(pthread_self(), SCHED_FIFO, param);
+ if (error != 0)
+ perror( "error set_schedparam 2:");
+
+// if (!debugMode) {
+// if (mlockall(MCL_CURRENT|MCL_FUTURE))
+// perror("WARNING: Cannot lock memory:");
+// }
+
+ undoSetuid();
+ }
+
+*/
+
+
+/*
+#define BIG_ENOUGH_STACK (1024*1024*1)
+ char buf[BIG_ENOUGH_STACK];
+ for (int i = 0; i < BIG_ENOUGH_STACK; i++)
+ buf[i] = i;
+#undef BIG_ENOUGH_STACK
+*/
+
+#ifdef __APPLE__
+#define BIG_ENOUGH_STACK (1024*256*1)
+#else
+#define BIG_ENOUGH_STACK (1024*1024*1)
+#endif
+ char buf[BIG_ENOUGH_STACK];
+ for (int i = 0; i < BIG_ENOUGH_STACK; i++)
+ buf[i] = i;
+#undef BIG_ENOUGH_STACK
+
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
+ pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
+
+ int policy = 0;
+ if ((policy = sched_getscheduler (0)) < 0) {
+ printf("Thread: Cannot get current client scheduler: %s\n", strerror(errno));
+ }
+
+ /*
+ if (debugMsg)
+ printf("Thread <%s> set to %s priority %d\n",
+ _name, policy == SCHED_FIFO ? "SCHED_FIFO" : "SCHED_OTHER",
+ realTimePriority);
+ */
+ if (debugMsg)
+ printf("Thread <%s, id %p> has %s priority %d\n",
+ _name, (void *)pthread_self(), policy == SCHED_FIFO ? "SCHED_FIFO" : "SCHED_OTHER",
+ _realTimePriority);
+
+
+// pthread_mutex_lock(&lock);
+ _running = true;
+// pthread_cond_signal(&ready);
+// pthread_mutex_unlock(&lock);
+
+ threadStart(userPtr);
+
+ while (_running) {
+ if (debugMode) // DEBUG
+ _pollWait = 10; // ms
+ else
+ _pollWait = -1;
+
+ int n = poll(pfd, npfd, _pollWait);
+ if (n < 0) {
+ if (errno == EINTR)
+ continue;
+ fprintf(stderr, "poll failed: %s\n", strerror(errno));
+ exit(-1);
+ }
+ if (n == 0) { // timeout
+ defaultTick();
+ continue;
+ }
+
+ struct pollfd* p = &pfd[0];
+ int i = 0;
+ for (iPoll ip = plist.begin(); ip != plist.end(); ++ip, ++p, ++i) {
+ if (ip->action & p->revents) {
+ (ip->handler)(ip->param1, ip->param2);
+ break;
+ }
+ }
+ }
+ threadStop();
+ }
+
+//---------------------------------------------------------
+// send
+// send request from gui to thread
+// wait until request is processed
+//---------------------------------------------------------
+
+bool Thread::sendMsg(const ThreadMsg* m)
+{
+ // Changed by Tim. p3.3.17
+
+ if (_running)
+ {
+ int rv = write(toThreadFdw, &m, sizeof(ThreadMsg*));
+ if (rv != sizeof(ThreadMsg*)) {
+ perror("Thread::sendMessage(): write pipe failed");
+ return true;
+ }
+
+ // wait for sequencer to finish operation
+ char c;
+ rv = read(fromThreadFdr, &c, 1);
+ if (rv != 1)
+ {
+ perror("Thread::sendMessage(): read pipe failed");
+ return true;
+ }
+ //int c;
+ //rv = read(fromThreadFdr, &c, sizeof(c));
+ //if (rv != sizeof(c)) {
+ // perror("Thread::sendMessage(): read pipe failed");
+ // return true;
+ // }
+ }
+ else
+ {
+ // if thread is not running (during initialization)
+ // process commands directly:
+ processMsg(m);
+ }
+ return false;
+}
+
+//---------------------------------------------------------
+// send
+// send request from gui to thread
+// do __not__ wait until request is processed
+//---------------------------------------------------------
+
+bool Thread::sendMsg1(const void* m, int n)
+ {
+ int rv = write(toThreadFdw, m, n);
+ if (rv != n) {
+ perror("Thread::sendMessage1(): write pipe failed");
+ return true;
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// readMsg
+//---------------------------------------------------------
+
+void Thread::readMsg()
+ {
+ ThreadMsg* p;
+ if (read(toThreadFdr, &p, sizeof(p)) != sizeof(p)) {
+ perror("Thread::readMessage(): read pipe failed");
+ exit(-1);
+ }
+ processMsg(p);
+ char c = 'x';
+ int rv = write(fromThreadFdw, &c, 1);
+ if (rv != 1)
+ perror("Thread::readMessage(): write pipe failed");
+ //int c = p->serialNo;
+ //int rv = write(fromThreadFdw, &c, sizeof(c));
+ //if (rv != sizeof(c))
+ // perror("Thread::readMsg(): write pipe failed");
+ }
+
+//---------------------------------------------------------
+// readMsg
+// sequencer reads one gui message
+//---------------------------------------------------------
+
+void Thread::readMsg1(int size)
+ {
+ char buffer[size];
+ int n = read(toThreadFdr, buffer, size);
+ if (n != size) {
+ fprintf(stderr, "Thread::readMsg1(): read pipe failed, get %d, expected %d: %s\n",
+ n, size, strerror(errno));
+ exit(-1);
+ }
+ processMsg1(buffer);
+ }
+
diff --git a/muse2/muse/thread.h b/muse2/muse/thread.h
new file mode 100644
index 00000000..f9642301
--- /dev/null
+++ b/muse2/muse/thread.h
@@ -0,0 +1,104 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: thread.h,v 1.1.1.1.2.2 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __THREAD_H__
+#define __THREAD_H__
+
+#include <pthread.h>
+#include <list>
+
+//---------------------------------------------------------
+// Poll
+//---------------------------------------------------------
+
+struct Poll {
+ int fd;
+ int action;
+ void (*handler)(void*,void*);
+ void* param1;
+ void* param2;
+
+ Poll(int _fd, int _action, void(*_handler)(void*,void*), void* p, void* q) {
+ fd = _fd;
+ action = _action;
+ handler = _handler;
+ param1 = p;
+ param2 = q;
+ }
+ };
+
+typedef std::list<Poll> PollList;
+typedef std::list<Poll>::iterator iPoll;
+
+
+//---------------------------------------------------------
+// ThreadMsg
+//---------------------------------------------------------
+
+struct ThreadMsg {
+ int id;
+ };
+
+//---------------------------------------------------------
+// Thread
+//---------------------------------------------------------
+
+class Thread {
+ const char* _name;
+ volatile bool _running;
+ //int realTimePriority;
+ int _pollWait; // poll timeout in msec (-1 = infinite)
+
+ pthread_t thread;
+
+ int toThreadFdw; // message to thread (app write)
+
+ PollList plist;
+// pthread_mutex_t lock;
+// pthread_cond_t ready;
+ void* userPtr;
+
+ protected:
+ int _realTimePriority;
+ int fromThreadFdr; // message from thread (seq read)
+ int fromThreadFdw; // message from thread (app write)
+ int toThreadFdr; // message to thread (seq read)
+ struct pollfd* pfd; // poll file descriptors
+ int npfd;
+ int maxpfd;
+ virtual void processMsg(const ThreadMsg*) {}
+ virtual void processMsg1(const void *) {}
+ virtual void defaultTick() {}
+
+ public:
+ //Thread(int prio, const char* name);
+ Thread(const char* name);
+
+ virtual ~Thread();
+ const char* name() const { return _name; }
+
+ //virtual void start(void* ptr=0);
+ virtual void start(int priority, void* ptr=0);
+
+ void stop(bool);
+ void clearPollFd() { plist.clear(); npfd = 0; }
+ void addPollFd(int fd, int action, void (*handler)(void*,void*), void*, void*);
+ void removePollFd(int fd, int action);
+ void loop();
+ void readMsg();
+ void readMsg1(int size);
+ bool sendMsg1(const void* m, int n);
+ bool sendMsg(const ThreadMsg* m);
+ bool isRunning() const { return _running; }
+ void setPollWait(int val) { _pollWait = val; }
+ virtual void threadStart(void*){ } // called from loop
+ virtual void threadStop() { } // called from loop before leaving
+ };
+
+#endif
+
diff --git a/muse2/muse/ticksynth.cpp b/muse2/muse/ticksynth.cpp
new file mode 100644
index 00000000..d6d327db
--- /dev/null
+++ b/muse2/muse/ticksynth.cpp
@@ -0,0 +1,215 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ticksynth.cpp,v 1.8.2.7 2009/12/20 05:00:35 terminator356 Exp $
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "audio.h"
+#include "ticksynth.h"
+#include "default_click.h"
+//Added by qt3to4:
+#include <Q3PopupMenu>
+
+// Added by Tim. p3.3.18
+//#define METRONOME_DEBUG
+
+MetronomeSynthI* metronome = 0;
+
+class MetronomeSynth;
+static MetronomeSynth* metronomeSynth = 0;
+
+//---------------------------------------------------------
+// MetronomeSynth
+//---------------------------------------------------------
+
+class MetronomeSynth : public Synth {
+ public:
+ //MetronomeSynth(const QFileInfo& fi) : Synth(fi) {}
+ //MetronomeSynth(const QFileInfo& fi) : Synth(fi, QString("Metronome")) {}
+ MetronomeSynth(const QFileInfo& fi) : Synth(fi, QString("Metronome"), QString("Metronome"), QString(), QString()) {}
+ virtual ~MetronomeSynth() {}
+ virtual void incInstances(int) {}
+ virtual void* instantiate();
+
+ //virtual SynthIF* createSIF() const;
+ virtual SynthIF* createSIF(SynthI*);
+ };
+
+//---------------------------------------------------------
+// instantiate
+//---------------------------------------------------------
+
+void* MetronomeSynth::instantiate()
+ {
+ return 0;
+ }
+
+//---------------------------------------------------------
+// MetronomeSynthIF
+//---------------------------------------------------------
+
+class MetronomeSynthIF : public SynthIF
+ {
+ const float* data;
+ int pos;
+ int len;
+ void process(float** buffer, int offset, int n);
+
+ public:
+ //MetronomeSynthIF() {
+ // data = 0;
+ // }
+ MetronomeSynthIF(SynthI* s) : SynthIF(s) {
+ data = 0;
+ }
+ virtual bool initGui() { return true; };
+ virtual void guiHeartBeat() { }
+ virtual bool guiVisible() const { return false; }
+ virtual void showGui(bool) {}
+ virtual bool hasGui() const { return false; }
+ virtual void getGeometry(int*, int*, int*, int*) const {}
+ virtual void setGeometry(int, int, int, int) {}
+ virtual void preProcessAlways() { };
+ virtual iMPEvent getData(MidiPort*, MPEventList*, iMPEvent, unsigned pos, int ports, unsigned n, float** buffer);
+ virtual bool putEvent(const MidiPlayEvent& ev);
+ virtual MidiPlayEvent receiveEvent() { return MidiPlayEvent(); }
+ virtual int eventsPending() const { return 0; }
+
+ //virtual bool init(Synth*) { return true; }
+
+ virtual int channels() const { return 1; }
+ virtual int totalOutChannels() const { return 1; }
+ virtual int totalInChannels() const { return 0; }
+ virtual void deactivate3() {}
+ virtual const char* getPatchName(int, int, int, bool) const { return ""; }
+ virtual const char* getPatchName(int, int, MType, bool) { return ""; }
+ virtual void populatePatchPopup(Q3PopupMenu*, int, MType, bool) {};
+ virtual void write(int, Xml&) const {}
+ virtual float getParameter(unsigned long) const { return 0.0; }
+ virtual void setParameter(unsigned long, float) {}
+ virtual int getControllerInfo(int, const char**, int*, int*, int*, int*) { return 0; }
+ };
+
+//---------------------------------------------------------
+// getData
+//---------------------------------------------------------
+
+iMPEvent MetronomeSynthIF::getData(MidiPort*, MPEventList* el, iMPEvent i, unsigned pos, int/*ports*/, unsigned n, float** buffer)
+ {
+ // Added by Tim. p3.3.18
+ #ifdef METRONOME_DEBUG
+ printf("MusE: MetronomeSynthIF::getData\n");
+ #endif
+
+ //set type to unsigned , due to compiler warning: comparison signed/unsigned
+ unsigned int curPos = pos; //prevent compiler warning: comparison signed/unsigned
+ unsigned int endPos = pos + n; //prevent compiler warning: comparison signed/unsigned
+ unsigned int off = pos; //prevent compiler warning: comparison signed/unsigned
+ int frameOffset = audio->getFrameOffset();
+
+ for (; i != el->end(); ++i) {
+ unsigned int frame = i->time() - frameOffset; //prevent compiler warning: comparison signed /unsigned
+ if (frame >= endPos)
+ break;
+ if (frame > curPos) {
+ if (frame < pos)
+ printf("should not happen: missed event %d\n", pos -frame);
+ else
+ process(buffer, curPos-pos, frame - curPos);
+ curPos = frame;
+ }
+ putEvent(*i);
+ }
+ if (endPos - curPos)
+ process(buffer, curPos - off, endPos - curPos);
+ return el->end();
+ }
+
+//---------------------------------------------------------
+// putEvent
+//---------------------------------------------------------
+
+bool MetronomeSynthIF::putEvent(const MidiPlayEvent& ev)
+ {
+ if (ev.dataA() == 0) {
+ data = defaultClickEmphasis;
+ len = defaultClickEmphasisLength;
+ }
+ else {
+ data = defaultClick;
+ len = defaultClickLength;
+ }
+ pos = 0;
+ return false;
+ }
+
+//---------------------------------------------------------
+// createSIF
+//---------------------------------------------------------
+
+//SynthIF* MetronomeSynth::createSIF() const
+// {
+// return new MetronomeSynthIF();
+// }
+SynthIF* MetronomeSynth::createSIF(SynthI* s)
+ {
+ return new MetronomeSynthIF(s);
+ }
+
+//---------------------------------------------------------
+// process
+// synthesize n samples into buffer+offset
+//---------------------------------------------------------
+
+void MetronomeSynthIF::process(float** buffer, int offset, int n)
+ {
+ // Added by Tim. p3.3.18
+ #ifdef METRONOME_DEBUG
+ printf("MusE: MetronomeSynthIF::process data:%p offset:%d n:%d\n", data, offset, n);
+ #endif
+
+ if (data == 0)
+ return;
+
+ const float* s = data + pos;
+ float* d = *buffer + offset;
+ int l = std::min(n, len);
+
+ for (int i = 0; i < l; ++i)
+ *d++ += *s++ * audioClickVolume;
+ pos += l;
+ len -= l;
+ if (len <= 0)
+ data = 0;
+ }
+
+//---------------------------------------------------------
+// initMetronome
+//---------------------------------------------------------
+
+void initMetronome()
+ {
+ QFileInfo fi;
+ metronomeSynth = new MetronomeSynth(fi);
+ metronome = new MetronomeSynthI();
+
+ QString name("metronome");
+ metronome->initInstance(metronomeSynth, name);
+ }
+
+//---------------------------------------------------------
+// exitMetronome
+//---------------------------------------------------------
+
+void exitMetronome()
+{
+ if(metronome)
+ delete metronome;
+ metronome = 0;
+
+ if(metronomeSynth)
+ delete metronomeSynth;
+ metronomeSynth = 0;
+}
+
diff --git a/muse2/muse/ticksynth.h b/muse2/muse/ticksynth.h
new file mode 100644
index 00000000..4f467bcd
--- /dev/null
+++ b/muse2/muse/ticksynth.h
@@ -0,0 +1,22 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ticksynth.h,v 1.1.2.3 2009/12/06 10:05:00 terminator356 Exp $
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __TICKSYNTH_H__
+#define __TICKSYNTH_H__
+
+#include "synth.h"
+extern void initMetronome();
+extern void exitMetronome();
+class MetronomeSynthI : public SynthI
+{
+ virtual bool hasAuxSend() const { return false; }
+
+};
+extern MetronomeSynthI* metronome;
+
+#endif
+
diff --git a/muse2/muse/track.cpp b/muse2/muse/track.cpp
new file mode 100644
index 00000000..8a51062b
--- /dev/null
+++ b/muse2/muse/track.cpp
@@ -0,0 +1,980 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: track.cpp,v 1.34.2.11 2009/11/30 05:05:49 terminator356 Exp $
+//
+// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+//#include <qt.h>
+#include <qstring.h>
+
+#include "track.h"
+#include "event.h"
+#include "mididev.h"
+#include "midiport.h"
+#include "song.h"
+#include "xml.h"
+#include "plugin.h"
+#include "drummap.h"
+#include "audio.h"
+#include "globaldefs.h"
+#include "route.h"
+
+unsigned int Track::_soloRefCnt = 0;
+Track* Track::_tmpSoloChainTrack = 0;
+bool Track::_tmpSoloChainDoIns = false;
+bool Track::_tmpSoloChainNoDec = false;
+
+//---------------------------------------------------------
+// addPortCtrlEvents
+//---------------------------------------------------------
+
+void addPortCtrlEvents(MidiTrack* t)
+{
+ const PartList* pl = t->cparts();
+ for(ciPart ip = pl->begin(); ip != pl->end(); ++ip)
+ {
+ Part* part = ip->second;
+ const EventList* el = part->cevents();
+ unsigned len = part->lenTick();
+ for(ciEvent ie = el->begin(); ie != el->end(); ++ie)
+ {
+ const Event& ev = ie->second;
+ // Added by T356. Do not add events which are past the end of the part.
+ if(ev.tick() >= len)
+ break;
+
+ if(ev.type() == Controller)
+ {
+ int tick = ev.tick() + part->tick();
+ int cntrl = ev.dataA();
+ int val = ev.dataB();
+ int ch = t->outChannel();
+
+ MidiPort* mp = &midiPorts[t->outPort()];
+ // Is it a drum controller event, according to the track port's instrument?
+ if(t->type() == Track::DRUM)
+ {
+ MidiController* mc = mp->drumController(cntrl);
+ if(mc)
+ {
+ int note = cntrl & 0x7f;
+ cntrl &= ~0xff;
+ ch = drumMap[note].channel;
+ mp = &midiPorts[drumMap[note].port];
+ cntrl |= drumMap[note].anote;
+ }
+ }
+
+ mp->setControllerVal(ch, tick, cntrl, val, part);
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------
+// removePortCtrlEvents
+//---------------------------------------------------------
+
+void removePortCtrlEvents(MidiTrack* t)
+{
+ const PartList* pl = t->cparts();
+ for(ciPart ip = pl->begin(); ip != pl->end(); ++ip)
+ {
+ Part* part = ip->second;
+ const EventList* el = part->cevents();
+ //unsigned len = part->lenTick();
+ for(ciEvent ie = el->begin(); ie != el->end(); ++ie)
+ {
+ const Event& ev = ie->second;
+ // Added by T356. Do not remove events which are past the end of the part.
+ // No, actually, do remove ALL of them belonging to the part.
+ // Just in case there are stray values left after the part end.
+ //if(ev.tick() >= len)
+ // break;
+
+ if(ev.type() == Controller)
+ {
+ int tick = ev.tick() + part->tick();
+ int cntrl = ev.dataA();
+ int ch = t->outChannel();
+
+ MidiPort* mp = &midiPorts[t->outPort()];
+ // Is it a drum controller event, according to the track port's instrument?
+ if(t->type() == Track::DRUM)
+ {
+ MidiController* mc = mp->drumController(cntrl);
+ if(mc)
+ {
+ int note = cntrl & 0x7f;
+ cntrl &= ~0xff;
+ ch = drumMap[note].channel;
+ mp = &midiPorts[drumMap[note].port];
+ cntrl |= drumMap[note].anote;
+ }
+ }
+
+ mp->deleteController(ch, tick, cntrl, part);
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------
+// y
+//---------------------------------------------------------
+
+int Track::y() const
+ {
+ TrackList* tl = song->tracks();
+ int yy = 0;
+ for (ciTrack it = tl->begin(); it != tl->end(); ++it) {
+ if (this == *it)
+ return yy;
+ yy += (*it)->height();
+ }
+ printf("Track::y(%s): track not in tracklist\n", name().latin1());
+ return -1;
+ }
+
+//---------------------------------------------------------
+// Track::init
+//---------------------------------------------------------
+
+void Track::init()
+ {
+ _activity = 0;
+ _lastActivity = 0;
+ _recordFlag = false;
+ _mute = false;
+ _solo = false;
+ _internalSolo = 0;
+ _off = false;
+ _channels = 0; // 1 - mono, 2 - stereo
+
+ _volumeEnCtrl = true;
+ _volumeEn2Ctrl = true;
+ _panEnCtrl = true;
+ _panEn2Ctrl = true;
+
+ _selected = false;
+ _height = 20;
+ _locked = false;
+ for (int i = 0; i < MAX_CHANNELS; ++i) {
+ //_meter[i] = 0;
+ //_peak[i] = 0;
+ _meter[i] = 0.0;
+ _peak[i] = 0.0;
+ }
+ }
+
+Track::Track(Track::TrackType t)
+ {
+ init();
+ _type = t;
+ }
+
+//Track::Track(const Track& t)
+Track::Track(const Track& t, bool cloneParts)
+ {
+ _activity = t._activity;
+ _lastActivity = t._lastActivity;
+ _recordFlag = t._recordFlag;
+ _mute = t._mute;
+ _solo = t._solo;
+ _internalSolo = t._internalSolo;
+ _off = t._off;
+ _channels = t._channels;
+
+ _volumeEnCtrl = t._volumeEnCtrl;
+ _volumeEn2Ctrl = t._volumeEn2Ctrl;
+ _panEnCtrl = t._panEnCtrl;
+ _panEn2Ctrl = t._panEn2Ctrl;
+
+ _selected = t.selected();
+ _y = t._y;
+ _height = t._height;
+ _comment = t.comment();
+ _name = t.name();
+ _type = t.type();
+ _locked = t.locked();
+
+ if(cloneParts)
+ {
+ const PartList* pl = t.cparts();
+ for (ciPart ip = pl->begin(); ip != pl->end(); ++ip) {
+ Part* newPart = ip->second->clone();
+ newPart->setTrack(this);
+ _parts.add(newPart);
+ }
+ }
+ else
+ {
+ _parts = *(t.cparts());
+ // NOTE: We can't do this because of the way clipboard, cloneList, and undoOp::ModifyTrack, work.
+ // A couple of schemes were conceived to deal with cloneList being invalid, but the best way is
+ // to not alter the part list here. It's a big headache because: Either the parts in the cloneList
+ // need to be reliably looked up replaced with the new ones, or the clipboard and cloneList must be cleared.
+ // Fortunately the ONLY part of muse using this function is track rename (in TrackList and TrackInfo).
+ // So we can get away with leaving this out:
+ //for (iPart ip = _parts.begin(); ip != _parts.end(); ++ip)
+ // ip->second->setTrack(this);
+ }
+
+ for (int i = 0; i < MAX_CHANNELS; ++i) {
+ //_meter[i] = 0;
+ //_peak[i] = 0;
+ _meter[i] = 0.0;
+ _peak[i] = 0.0;
+ }
+ }
+
+//---------------------------------------------------------
+// operator =
+// Added by Tim. Parts' track members MUST point to this track,
+// not some other track, so simple assignment operator won't do!
+//---------------------------------------------------------
+
+Track& Track::operator=(const Track& t)
+{
+ _activity = t._activity;
+ _lastActivity = t._lastActivity;
+ _recordFlag = t._recordFlag;
+ _mute = t._mute;
+ _solo = t._solo;
+ _internalSolo = t._internalSolo;
+ _off = t._off;
+ _channels = t._channels;
+
+ _volumeEnCtrl = t._volumeEnCtrl;
+ _volumeEn2Ctrl = t._volumeEn2Ctrl;
+ _panEnCtrl = t._panEnCtrl;
+ _panEn2Ctrl = t._panEn2Ctrl;
+
+ _selected = t.selected();
+ _y = t._y;
+ _height = t._height;
+ _comment = t.comment();
+ _name = t.name();
+ _type = t.type();
+ _locked = t.locked();
+
+ _parts = *(t.cparts());
+ // NOTE: Can't do this. See comments in copy constructor.
+ //for (iPart ip = _parts.begin(); ip != _parts.end(); ++ip)
+ // ip->second->setTrack(this);
+
+ for (int i = 0; i < MAX_CHANNELS; ++i) {
+ _meter[i] = t._meter[i];
+ _peak[i] = t._peak[i];
+ }
+ return *this;
+}
+
+//---------------------------------------------------------
+// setDefaultName
+// generate unique name for track
+//---------------------------------------------------------
+
+void Track::setDefaultName()
+ {
+ QString base;
+ switch(_type) {
+ case MIDI:
+ case DRUM:
+ case WAVE:
+ base = QString("Track");
+ break;
+ case AUDIO_OUTPUT:
+ base = QString("Out");
+ break;
+ case AUDIO_GROUP:
+ base = QString("Group");
+ break;
+ case AUDIO_AUX:
+ base = QString("Aux");
+ break;
+ case AUDIO_INPUT:
+ base = QString("Input");
+ break;
+ case AUDIO_SOFTSYNTH:
+ base = QString("Synth");
+ break;
+ };
+ base += " ";
+ for (int i = 1; true; ++i) {
+ QString n;
+ n.setNum(i);
+ QString s = base + n;
+ Track* track = song->findTrack(s);
+ if (track == 0) {
+ setName(s);
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// clearRecAutomation
+//---------------------------------------------------------
+
+void Track::clearRecAutomation(bool clearList)
+{
+ _volumeEnCtrl = true;
+ _volumeEn2Ctrl = true;
+ _panEnCtrl = true;
+ _panEn2Ctrl = true;
+
+ if(isMidiTrack())
+ return;
+
+ AudioTrack *t = (AudioTrack*)this;
+ Pipeline *pl = t->efxPipe();
+ PluginI *p;
+ for(iPluginI i = pl->begin(); i != pl->end(); ++i)
+ {
+ p = *i;
+ if(!p)
+ continue;
+ p->enableAllControllers(true);
+ }
+
+ if(clearList)
+ t->recEvents()->clear();
+}
+
+//---------------------------------------------------------
+// dump
+//---------------------------------------------------------
+
+void Track::dump() const
+ {
+ printf("Track <%s>: typ %d, parts %zd sel %d\n",
+ _name.latin1(), _type, _parts.size(), _selected);
+ }
+
+//---------------------------------------------------------
+// MidiTrack
+//---------------------------------------------------------
+
+MidiTrack::MidiTrack()
+ : Track(MIDI)
+ {
+ init();
+ _events = new EventList;
+ _mpevents = new MPEventList;
+ }
+
+//MidiTrack::MidiTrack(const MidiTrack& mt)
+// : Track(mt)
+MidiTrack::MidiTrack(const MidiTrack& mt, bool cloneParts)
+ : Track(mt, cloneParts)
+ {
+ _outPort = mt.outPort();
+ _outChannel = mt.outChannel();
+ ///_inPortMask = mt.inPortMask();
+ ///_inChannelMask = mt.inChannelMask();
+ _events = new EventList;
+ _mpevents = new MPEventList;
+ transposition = mt.transposition;
+ velocity = mt.velocity;
+ delay = mt.delay;
+ len = mt.len;
+ compression = mt.compression;
+ _recEcho = mt.recEcho();
+ }
+
+MidiTrack::~MidiTrack()
+ {
+ delete _events;
+ delete _mpevents;
+ }
+
+//---------------------------------------------------------
+// init
+//---------------------------------------------------------
+
+void MidiTrack::init()
+ {
+ _outPort = 0;
+ _outChannel = 0;
+ // Changed by Tim. p3.3.8
+ //_inPortMask = 0xffff;
+ ///_inPortMask = 0xffffffff;
+
+ ///_inChannelMask = 0xffff; // "ALL"
+ transposition = 0;
+ velocity = 0;
+ delay = 0;
+ len = 100; // percent
+ compression = 100; // percent
+ _recEcho = true;
+ }
+
+//---------------------------------------------------------
+// setOutChanAndUpdate
+//---------------------------------------------------------
+
+void MidiTrack::setOutChanAndUpdate(int i)
+{
+ if(_outChannel == i)
+ return;
+
+ //removePortCtrlEvents();
+ removePortCtrlEvents(this);
+ _outChannel = i;
+ //addPortCtrlEvents();
+ addPortCtrlEvents(this);
+}
+
+//---------------------------------------------------------
+// setOutPortAndUpdate
+//---------------------------------------------------------
+
+void MidiTrack::setOutPortAndUpdate(int i)
+{
+ if(_outPort == i)
+ return;
+
+ //removePortCtrlEvents();
+ removePortCtrlEvents(this);
+ _outPort = i;
+ //addPortCtrlEvents();
+ addPortCtrlEvents(this);
+}
+
+//---------------------------------------------------------
+// setInPortAndChannelMask
+// For old song files with port mask (max 32 ports) and channel mask (16 channels),
+// before midi routing was added (the iR button). p3.3.48
+//---------------------------------------------------------
+
+void MidiTrack::setInPortAndChannelMask(unsigned int portmask, int chanmask)
+{
+ //if(!portmask || !chanmask)
+ // return;
+
+ //RouteList* rl = inRoutes();
+ bool changed = false;
+
+ for(int port = 0; port < 32; ++port) // 32 is the old maximum number of ports.
+ {
+ // p3.3.50 If the port was not used in the song file to begin with, just ignore it.
+ // This saves from having all of the first 32 ports' channels connected.
+ if(!midiPorts[port].foundInSongFile())
+ continue;
+
+ //if(!(portmask & (1 << port)))
+ // continue;
+
+ // p3.3.50 Removed. Allow to connect to port with no device so user can change device later.
+ //MidiPort* mp = &midiPorts[port];
+ //MidiDevice* md = mp->device();
+ //if(!md)
+ // continue;
+
+ //for(int ch = 0; ch < MIDI_CHANNELS; ++ch) // p3.3.50 Removed.
+ //{
+ //if(!(chanmask & (1 << ch)))
+ // continue;
+
+ //Route aRoute(md, ch);
+ //Route bRoute(this, ch);
+ Route aRoute(port, chanmask); // p3.3.50
+ Route bRoute(this, chanmask);
+
+ // p3.3.50 Removed.
+ //iRoute iir = rl->begin();
+ //for(; iir != rl->end(); ++iir)
+ //{
+ //if(*iir == aRoute)
+ // if(iir->type == Route::MIDI_PORT_ROUTE && iir->midiPort == port) // p3.3.50
+ // break;
+ //}
+
+ // Route wanted?
+ //if((portmask & (1 << port)) && (chanmask & (1 << ch)))
+ if(portmask & (1 << port)) // p3.3.50
+ {
+ // Route already exists?
+ //if(iir != rl->end())
+ // continue;
+ audio->msgAddRoute(aRoute, bRoute);
+ changed = true;
+ }
+ else
+ {
+ // Route does not exist?
+ //if(iir == rl->end())
+ // continue;
+ audio->msgRemoveRoute(aRoute, bRoute);
+ changed = true;
+ }
+ //}
+ }
+
+ if(changed)
+ {
+ audio->msgUpdateSoloStates();
+ song->update(SC_ROUTE);
+ }
+}
+
+/*
+//---------------------------------------------------------
+// addPortCtrlEvents
+//---------------------------------------------------------
+
+void MidiTrack::addPortCtrlEvents()
+{
+ const PartList* pl = cparts();
+ for(ciPart ip = pl->begin(); ip != pl->end(); ++ip)
+ {
+ Part* part = ip->second;
+ const EventList* el = part->cevents();
+ for(ciEvent ie = el->begin(); ie != el->end(); ++ie)
+ {
+ const Event& ev = ie->second;
+ if(ev.type() == Controller)
+ {
+ int tick = ev.tick() + part->tick();
+ int cntrl = ev.dataA();
+ int val = ev.dataB();
+ int ch = _outChannel;
+
+ MidiPort* mp = &midiPorts[_outPort];
+ // Is it a drum controller event, according to the track port's instrument?
+ if(type() == DRUM)
+ {
+ MidiController* mc = mp->drumController(cntrl);
+ if(mc)
+ {
+ int note = cntrl & 0x7f;
+ cntrl &= ~0xff;
+ ch = drumMap[note].channel;
+ mp = &midiPorts[drumMap[note].port];
+ cntrl |= drumMap[note].anote;
+ }
+ }
+
+ mp->setControllerVal(ch, tick, cntrl, val, part);
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------
+// removePortCtrlEvents
+//---------------------------------------------------------
+
+void MidiTrack::removePortCtrlEvents()
+{
+ const PartList* pl = cparts();
+ for(ciPart ip = pl->begin(); ip != pl->end(); ++ip)
+ {
+ Part* part = ip->second;
+ const EventList* el = part->cevents();
+ for(ciEvent ie = el->begin(); ie != el->end(); ++ie)
+ {
+ const Event& ev = ie->second;
+ if(ev.type() == Controller)
+ {
+ int tick = ev.tick() + part->tick();
+ int cntrl = ev.dataA();
+ int ch = _outChannel;
+
+ MidiPort* mp = &midiPorts[_outPort];
+ // Is it a drum controller event, according to the track port's instrument?
+ if(type() == DRUM)
+ {
+ MidiController* mc = mp->drumController(cntrl);
+ if(mc)
+ {
+ int note = cntrl & 0x7f;
+ cntrl &= ~0xff;
+ ch = drumMap[note].channel;
+ mp = &midiPorts[drumMap[note].port];
+ cntrl |= drumMap[note].anote;
+ }
+ }
+
+ mp->deleteController(ch, tick, cntrl, part);
+ }
+ }
+ }
+}
+*/
+
+//---------------------------------------------------------
+// addPart
+//---------------------------------------------------------
+
+iPart Track::addPart(Part* p)
+ {
+ p->setTrack(this);
+ return _parts.add(p);
+ }
+
+//---------------------------------------------------------
+// findPart
+//---------------------------------------------------------
+
+Part* Track::findPart(unsigned tick)
+ {
+ for (iPart i = _parts.begin(); i != _parts.end(); ++i) {
+ Part* part = i->second;
+ if (tick >= part->tick() && tick < (part->tick()+part->lenTick()))
+ return part;
+ }
+ return 0;
+ }
+
+//---------------------------------------------------------
+// newPart
+//---------------------------------------------------------
+
+Part* MidiTrack::newPart(Part*p, bool clone)
+ {
+ MidiPart* part = clone ? new MidiPart(this, p->events()) : new MidiPart(this);
+ if (p) {
+ part->setName(p->name());
+ part->setColorIndex(p->colorIndex());
+
+ *(PosLen*)part = *(PosLen*)p;
+ part->setMute(p->mute());
+ }
+
+ if(clone)
+ //p->chainClone(part);
+ chainClone(p, part);
+
+ return part;
+ }
+
+//---------------------------------------------------------
+// automationType
+//---------------------------------------------------------
+
+AutomationType MidiTrack::automationType() const
+ {
+ MidiPort* port = &midiPorts[outPort()];
+ return port->automationType(outChannel());
+ }
+
+//---------------------------------------------------------
+// setAutomationType
+//---------------------------------------------------------
+
+void MidiTrack::setAutomationType(AutomationType t)
+ {
+ MidiPort* port = &midiPorts[outPort()];
+ port->setAutomationType(outChannel(), t);
+ }
+
+//---------------------------------------------------------
+// Track::writeProperties
+//---------------------------------------------------------
+
+void Track::writeProperties(int level, Xml& xml) const
+ {
+ xml.strTag(level, "name", _name);
+ if (!_comment.isEmpty())
+ xml.strTag(level, "comment", _comment);
+ xml.intTag(level, "record", _recordFlag);
+ xml.intTag(level, "mute", mute());
+ xml.intTag(level, "solo", solo());
+ xml.intTag(level, "off", off());
+ xml.intTag(level, "channels", _channels);
+ xml.intTag(level, "height", _height);
+ xml.intTag(level, "locked", _locked);
+ if (_selected)
+ xml.intTag(level, "selected", _selected);
+ }
+
+//---------------------------------------------------------
+// Track::readProperties
+//---------------------------------------------------------
+
+bool Track::readProperties(Xml& xml, const QString& tag)
+ {
+ if (tag == "name")
+ _name = xml.parse1();
+ else if (tag == "comment")
+ _comment = xml.parse1();
+ else if (tag == "record") {
+ bool recordFlag = xml.parseInt();
+ setRecordFlag1(recordFlag);
+ setRecordFlag2(recordFlag);
+ }
+ else if (tag == "mute")
+ _mute = xml.parseInt();
+ else if (tag == "solo")
+ _solo = xml.parseInt();
+ else if (tag == "off")
+ _off = xml.parseInt();
+ else if (tag == "height")
+ _height = xml.parseInt();
+ else if (tag == "channels")
+ {
+ _channels = xml.parseInt();
+ if(_channels > MAX_CHANNELS)
+ _channels = MAX_CHANNELS;
+ }
+ else if (tag == "locked")
+ _locked = xml.parseInt();
+ else if (tag == "selected")
+ _selected = xml.parseInt();
+ else
+ return true;
+ return false;
+ }
+
+//---------------------------------------------------------
+// writeRouting
+//---------------------------------------------------------
+
+void Track::writeRouting(int level, Xml& xml) const
+{
+ QString s;
+
+ if (type() == Track::AUDIO_INPUT)
+ {
+ const RouteList* rl = &_inRoutes;
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ if(!r->name().isEmpty())
+ {
+ s = QT_TR_NOOP("Route");
+ if(r->channel != -1)
+ s += QString(QT_TR_NOOP(" channel=\"%1\"")).arg(r->channel);
+
+ ///Route dst(name(), true, r->channel);
+ //xml.tag(level++, "Route");
+ xml.tag(level++, s);
+
+ // p3.3.38 New routing scheme.
+ ///xml.strTag(level, "srcNode", r->name());
+ //xml.tag(level, "source type=\"%d\" name=\"%s\"/", r->type, r->name().latin1());
+ s = QT_TR_NOOP("source");
+ if(r->type != Route::TRACK_ROUTE)
+ s += QString(QT_TR_NOOP(" type=\"%1\"")).arg(r->type);
+ //s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(r->name());
+ s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(Xml::xmlString(r->name()));
+ xml.tag(level, s);
+
+ ///xml.strTag(level, "dstNode", dst.name());
+
+ //if(r->channel != -1)
+ // xml.tag(level, "dest type=\"%d\" channel=\"%d\" name=\"%s\"/", Route::TRACK_ROUTE, r->channel, name().latin1());
+ //else
+ // xml.tag(level, "dest type=\"%d\" name=\"%s\"/", Route::TRACK_ROUTE, name().latin1());
+
+ //xml.tag(level, "dest name=\"%s\"/", name().latin1());
+ xml.tag(level, "dest name=\"%s\"/", Xml::xmlString(name()).latin1());
+
+ xml.etag(level--, "Route");
+ }
+ }
+ }
+
+ const RouteList* rl = &_outRoutes;
+ for (ciRoute r = rl->begin(); r != rl->end(); ++r)
+ {
+ //if(!r->name().isEmpty())
+ if(r->midiPort != -1 || !r->name().isEmpty()) // p3.3.49
+ {
+ ///QString src(name());
+ ///if (type() == Track::AUDIO_OUTPUT)
+ ///{
+ ///Route s(src, false, r->channel);
+ ///src = s.name();
+ ///}
+
+ s = QT_TR_NOOP("Route");
+ if(r->type == Route::MIDI_PORT_ROUTE) // p3.3.50
+ {
+ if(r->channel != -1 && r->channel != 0)
+ s += QString(QT_TR_NOOP(" channelMask=\"%1\"")).arg(r->channel); // Use new channel mask.
+ }
+ else
+ {
+ if(r->channel != -1)
+ s += QString(QT_TR_NOOP(" channel=\"%1\"")).arg(r->channel);
+ }
+ if(r->channels != -1)
+ s += QString(QT_TR_NOOP(" channels=\"%1\"")).arg(r->channels);
+ if(r->remoteChannel != -1)
+ s += QString(QT_TR_NOOP(" remch=\"%1\"")).arg(r->remoteChannel);
+
+ //xml.tag(level++, "Route");
+ xml.tag(level++, s);
+
+ ///xml.strTag(level, "srcNode", src);
+ //if(r->channel != -1)
+
+ // Allow for a regular mono or stereo track to feed a multi-channel synti.
+ // thisChannel is the 'starting' channel of this source if feeding a regular track.
+ //if(r->type == Route::TRACK_ROUTE && r->track->isSynti() && r->channel != -1)
+ //if(isSynti() && r->thisChannel != -1)
+ //xml.tag(level, "source type=\"%d\" channel=\"%d\" name=\"%s\"/", Route::TRACK_ROUTE, r->channel, name().latin1());
+ // xml.tag(level, "source type=\"%d\" channel=\"%d\" name=\"%s\"/", Route::TRACK_ROUTE, r->thisChannel, name().latin1());
+ //else
+
+ //if(r->channel != -1)
+ // xml.tag(level, "source type=\"%d\" channel=\"%d\" name=\"%s\"/", Route::TRACK_ROUTE, r->channel, name().latin1());
+ //else
+ // xml.tag(level, "source type=\"%d\" name=\"%s\"/", Route::TRACK_ROUTE, name().latin1());
+ //xml.tag(level, "source name=\"%s\"/", name().latin1());
+ xml.tag(level, "source name=\"%s\"/", Xml::xmlString(name()).latin1());
+
+ ///xml.strTag(level, "dstNode", r->name());
+ //if(r->channel != -1)
+ // xml.tag(level, "dest type=\"%d\" channel=\"%d\" name=\"%s\"/", r->type, r->channel, r->name().latin1());
+ //else
+ // xml.tag(level, "dest type=\"%d\" name=\"%s\"/", r->type, r->name().latin1());
+
+ // Allow for a regular mono or stereo track to feed a multi-channel synti.
+ // Channel is the 'starting' channel of the destination.
+ //if(r->type == Route::TRACK_ROUTE && r->track->isSynti() && r->channel != -1)
+
+ //if(r->type == Route::TRACK_ROUTE && r->track->type() == Track::AUDIO_SOFTSYNTH && r->remoteChannel != -1)
+ // xml.tag(level, "dest type=\"%d\" channel=\"%d\" name=\"%s\"/", r->type, r->remoteChannel, r->name().latin1());
+ //else
+ //if(r->type == Route::MIDI_DEVICE_ROUTE)
+ // xml.tag(level, "dest devtype=\"%d\" name=\"%s\"/", r->device->deviceType(), r->name().latin1());
+ //else
+ // xml.tag(level, "dest type=\"%d\" name=\"%s\"/", r->type, r->name().latin1());
+
+ s = QT_TR_NOOP("dest");
+
+ //if(r->type == Route::MIDI_DEVICE_ROUTE) // p3.3.49 Obsolete since 1.1-RC2
+ // s += QString(QT_TR_NOOP(" devtype=\"%1\"")).arg(r->device->deviceType()); //
+ //if(r->type != Route::TRACK_ROUTE) //
+ if(r->type != Route::TRACK_ROUTE && r->type != Route::MIDI_PORT_ROUTE)
+ s += QString(QT_TR_NOOP(" type=\"%1\"")).arg(r->type);
+
+ //s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(r->name());
+ if(r->type == Route::MIDI_PORT_ROUTE) // p3.3.49
+ s += QString(QT_TR_NOOP(" mport=\"%1\"/")).arg(r->midiPort);
+ else
+ s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(Xml::xmlString(r->name()));
+
+ xml.tag(level, s);
+
+ xml.etag(level--, "Route");
+ }
+ }
+}
+
+//---------------------------------------------------------
+// MidiTrack::write
+//---------------------------------------------------------
+
+void MidiTrack::write(int level, Xml& xml) const
+ {
+ const char* tag;
+
+ if (type() == DRUM)
+ tag = "drumtrack";
+ else
+ tag = "miditrack";
+ xml.tag(level++, tag);
+ Track::writeProperties(level, xml);
+
+ xml.intTag(level, "device", outPort());
+ xml.intTag(level, "channel", outChannel());
+ //xml.intTag(level, "inportMap", inPortMask());
+ ///xml.uintTag(level, "inportMap", inPortMask()); // Obsolete
+ ///xml.intTag(level, "inchannelMap", inChannelMask()); // Obsolete
+ xml.intTag(level, "locked", _locked);
+ xml.intTag(level, "echo", _recEcho);
+
+ xml.intTag(level, "transposition", transposition);
+ xml.intTag(level, "velocity", velocity);
+ xml.intTag(level, "delay", delay);
+ xml.intTag(level, "len", len);
+ xml.intTag(level, "compression", compression);
+ xml.intTag(level, "automation", int(automationType()));
+
+ const PartList* pl = cparts();
+ for (ciPart p = pl->begin(); p != pl->end(); ++p)
+ p->second->write(level, xml);
+ xml.etag(level, tag);
+ }
+
+//---------------------------------------------------------
+// MidiTrack::read
+//---------------------------------------------------------
+
+void MidiTrack::read(Xml& xml)
+ {
+ unsigned int portmask = 0;
+ int chanmask = 0;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "transposition")
+ transposition = xml.parseInt();
+ else if (tag == "velocity")
+ velocity = xml.parseInt();
+ else if (tag == "delay")
+ delay = xml.parseInt();
+ else if (tag == "len")
+ len = xml.parseInt();
+ else if (tag == "compression")
+ compression = xml.parseInt();
+ else if (tag == "part") {
+ //Part* p = newPart();
+ //p->read(xml);
+ Part* p = 0;
+ p = readXmlPart(xml, this);
+ if(p)
+ parts()->add(p);
+ }
+ else if (tag == "device")
+ setOutPort(xml.parseInt());
+ else if (tag == "channel")
+ setOutChannel(xml.parseInt());
+ else if (tag == "inportMap")
+ //setInPortMask(xml.parseInt());
+ ///setInPortMask(xml.parseUInt());
+ //xml.skip(tag); // Obsolete.
+ portmask = xml.parseUInt(); // p3.3.48: Support old files.
+ else if (tag == "inchannelMap")
+ ///setInChannelMask(xml.parseInt());
+ //xml.skip(tag); // Obsolete.
+ chanmask = xml.parseInt(); // p3.3.48: Support old files.
+ else if (tag == "locked")
+ _locked = xml.parseInt();
+ else if (tag == "echo")
+ _recEcho = xml.parseInt();
+ else if (tag == "automation")
+ setAutomationType(AutomationType(xml.parseInt()));
+ else if (Track::readProperties(xml, tag)) {
+ // version 1.0 compatibility:
+ if (tag == "track" && xml.majorVersion() == 1 && xml.minorVersion() == 0)
+ break;
+ xml.unknown("MidiTrack");
+ }
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if (tag == "miditrack" || tag == "drumtrack")
+ {
+ setInPortAndChannelMask(portmask, chanmask); // p3.3.48: Support old files.
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
diff --git a/muse2/muse/track.h b/muse2/muse/track.h
new file mode 100644
index 00000000..c0a11056
--- /dev/null
+++ b/muse2/muse/track.h
@@ -0,0 +1,675 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: track.h,v 1.39.2.17 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __TRACK_H__
+#define __TRACK_H__
+
+#include <qstring.h>
+#include <vector>
+#include <algorithm>
+
+#include "part.h"
+#include "key.h"
+#include "node.h"
+#include "route.h"
+#include "ctrl.h"
+#include "globaldefs.h"
+
+class Pipeline;
+class Xml;
+class SndFile;
+class MPEventList;
+class SynthI;
+class PluginI;
+
+//---------------------------------------------------------
+// Track
+//---------------------------------------------------------
+
+class Track {
+ public:
+ enum TrackType {
+ MIDI=0, DRUM, WAVE, AUDIO_OUTPUT, AUDIO_INPUT, AUDIO_GROUP,
+ AUDIO_AUX, AUDIO_SOFTSYNTH
+ };
+ private:
+ TrackType _type;
+ QString _comment;
+
+ PartList _parts;
+
+ void init();
+
+ protected:
+ static unsigned int _soloRefCnt;
+ static Track* _tmpSoloChainTrack;
+ static bool _tmpSoloChainDoIns;
+ static bool _tmpSoloChainNoDec;
+
+ // p3.3.38
+ RouteList _inRoutes;
+ RouteList _outRoutes;
+
+ QString _name;
+ bool _recordFlag;
+ bool _mute;
+ bool _solo;
+ unsigned int _internalSolo;
+ bool _off;
+ int _channels; // 1 - mono, 2 - stereo
+
+ bool _volumeEnCtrl;
+ bool _volumeEn2Ctrl;
+ bool _panEnCtrl;
+ bool _panEn2Ctrl;
+
+ int _activity;
+ int _lastActivity;
+ //int _meter[MAX_CHANNELS];
+ //int _peak[MAX_CHANNELS];
+ double _meter[MAX_CHANNELS];
+ double _peak[MAX_CHANNELS];
+
+ int _y;
+ int _height; // visual height in arranger
+
+ bool _locked;
+ bool _selected;
+ bool readProperties(Xml& xml, const QString& tag);
+ void writeProperties(int level, Xml& xml) const;
+
+ public:
+ Track(TrackType);
+ //Track(const Track&);
+ Track(const Track&, bool cloneParts);
+ virtual ~Track() {};
+ virtual Track& operator=(const Track& t);
+ QString comment() const { return _comment; }
+ void setComment(const QString& s) { _comment = s; }
+
+ int y() const;
+ void setY(int n) { _y = n; }
+ int height() const { return _height; }
+ void setHeight(int n) { _height = n; }
+
+ bool selected() const { return _selected; }
+ void setSelected(bool f) { _selected = f; }
+ bool locked() const { return _locked; }
+ void setLocked(bool b) { _locked = b; }
+
+ bool volumeControllerEnabled() const { return _volumeEnCtrl; }
+ bool volumeControllerEnabled2() const { return _volumeEn2Ctrl; }
+ bool panControllerEnabled() const { return _panEnCtrl; }
+ bool panControllerEnabled2() const { return _panEn2Ctrl; }
+ void enableVolumeController(bool b) { _volumeEnCtrl = b; }
+ void enable2VolumeController(bool b) { _volumeEn2Ctrl = b; }
+ void enablePanController(bool b) { _panEnCtrl = b; }
+ void enable2PanController(bool b) { _panEn2Ctrl = b; }
+ void clearRecAutomation(bool clearList);
+
+ const QString& name() const { return _name; }
+ virtual void setName(const QString& s) { _name = s; }
+
+ TrackType type() const { return _type; }
+ void setType(TrackType t) { _type = t; }
+
+ // routing
+ RouteList* inRoutes() { return &_inRoutes; }
+ RouteList* outRoutes() { return &_outRoutes; }
+ bool noInRoute() const { return _inRoutes.empty(); }
+ bool noOutRoute() const { return _outRoutes.empty(); }
+ void writeRouting(int, Xml&) const;
+
+ PartList* parts() { return &_parts; }
+ const PartList* cparts() const { return &_parts; }
+ Part* findPart(unsigned tick);
+ iPart addPart(Part* p);
+
+ virtual void write(int, Xml&) const = 0;
+
+ virtual Track* newTrack() const = 0;
+ //virtual Track* clone() const = 0;
+ virtual Track* clone(bool CloneParts) const = 0;
+
+ virtual bool setRecordFlag1(bool f) = 0;
+ virtual void setRecordFlag2(bool f) = 0;
+
+ virtual Part* newPart(Part*p=0, bool clone = false) = 0;
+ void dump() const;
+ virtual void splitPart(Part*, int, Part*&, Part*&);
+
+ virtual void setMute(bool val);
+ virtual void setOff(bool val);
+ virtual void updateSoloStates(bool noDec) = 0;
+ virtual void updateInternalSoloStates();
+ void updateSoloState();
+ void setInternalSolo(unsigned int val);
+ static void clearSoloRefCounts();
+ virtual void setSolo(bool val) = 0;
+ virtual bool isMute() const = 0;
+
+ unsigned int internalSolo() const { return _internalSolo; }
+ bool soloMode() const { return _soloRefCnt; }
+ bool solo() const { return _solo; }
+ bool mute() const { return _mute; }
+ bool off() const { return _off; }
+ bool recordFlag() const { return _recordFlag; }
+
+ int activity() { return _activity; }
+ void setActivity(int v) { _activity = v; }
+ int lastActivity() { return _lastActivity; }
+ void setLastActivity(int v) { _lastActivity = v; }
+ void addActivity(int v) { _activity += v; }
+ void resetPeaks();
+ static void resetAllMeter();
+ //int meter(int ch) const { return _meter[ch]; }
+ //int peak(int ch) const { return _peak[ch]; }
+ double meter(int ch) const { return _meter[ch]; }
+ double peak(int ch) const { return _peak[ch]; }
+ void resetMeter();
+
+ bool readProperty(Xml& xml, const QString& tag);
+ void setDefaultName();
+ int channels() const { return _channels; }
+ virtual void setChannels(int n);
+ bool isMidiTrack() const { return type() == MIDI || type() == DRUM; }
+ virtual bool canRecord() const { return false; }
+ virtual AutomationType automationType() const = 0;
+ virtual void setAutomationType(AutomationType t) = 0;
+ };
+
+//---------------------------------------------------------
+// MidiTrack
+//---------------------------------------------------------
+
+class MidiTrack : public Track {
+ //friend class AudioTrack;
+ //static unsigned int _soloRefCnt;
+
+ int _outPort;
+ int _outChannel;
+ //int _inPortMask;
+ ///unsigned int _inPortMask; // bitmask of accepted record ports
+ ///int _inChannelMask; // bitmask of accepted record channels
+ bool _recEcho; // For midi (and audio). Whether to echo incoming record events to output device.
+
+ EventList* _events; // tmp Events during midi import
+ MPEventList* _mpevents; // tmp Events druring recording
+
+ public:
+ MidiTrack();
+ //MidiTrack(const MidiTrack&);
+ MidiTrack(const MidiTrack&, bool cloneParts);
+ virtual ~MidiTrack();
+
+ void init();
+ virtual AutomationType automationType() const;
+ virtual void setAutomationType(AutomationType);
+
+ // play parameter
+ int transposition;
+ int velocity;
+ int delay;
+ int len;
+ int compression;
+
+ virtual bool setRecordFlag1(bool f) { _recordFlag = f; return true;}
+ virtual void setRecordFlag2(bool) {}
+
+ EventList* events() const { return _events; }
+ MPEventList* mpevents() const { return _mpevents; }
+
+ virtual void read(Xml&);
+ virtual void write(int, Xml&) const;
+
+ virtual MidiTrack* newTrack() const { return new MidiTrack(); }
+ //virtual MidiTrack* clone() const { return new MidiTrack(*this); }
+ virtual MidiTrack* clone(bool cloneParts) const { return new MidiTrack(*this, cloneParts); }
+ virtual Part* newPart(Part*p=0, bool clone=false);
+
+ void setOutChannel(int i) { _outChannel = i; }
+ void setOutPort(int i) { _outPort = i; }
+ void setOutChanAndUpdate(int i);
+ void setOutPortAndUpdate(int i);
+
+ //void setInPortMask(int i) { _inPortMask = i; }
+ ///void setInPortMask(unsigned int i) { _inPortMask = i; } // Obsolete
+ ///void setInChannelMask(int i) { _inChannelMask = i; } //
+ // Backward compatibility: For reading old songs.
+ void setInPortAndChannelMask(unsigned int /*portmask*/, int /*chanmask*/);
+
+ void setRecEcho(bool b) { _recEcho = b; }
+ int outPort() const { return _outPort; }
+ //int inPortMask() const { return _inPortMask; }
+ ///unsigned int inPortMask() const { return _inPortMask; }
+ int outChannel() const { return _outChannel; }
+ ///int inChannelMask() const { return _inChannelMask; }
+ bool recEcho() const { return _recEcho; }
+
+ virtual bool isMute() const;
+ virtual void setSolo(bool val);
+ virtual void updateSoloStates(bool noDec);
+ virtual void updateInternalSoloStates();
+
+ //bool soloMode() const { return _soloRefCnt; }
+
+ virtual bool canRecord() const { return true; }
+ };
+
+//---------------------------------------------------------
+// AudioTrack
+// this track can hold audio automation data and can
+// hold tracktypes AUDIO, AUDIO_MASTER, AUDIO_GROUP,
+// AUDIO_INPUT, AUDIO_SOFTSYNTH, AUDIO_AUX
+//---------------------------------------------------------
+
+class AudioTrack : public Track {
+ //friend class MidiTrack;
+ //static unsigned int _soloRefCnt;
+
+ bool _haveData;
+
+ CtrlListList _controller;
+ CtrlRecList _recEvents; // recorded automation events
+
+ bool _prefader; // prefader metering
+ std::vector<double> _auxSend;
+ Pipeline* _efxPipe;
+
+ AutomationType _automationType;
+
+ //RouteList _inRoutes;
+ //RouteList _outRoutes;
+
+ bool _sendMetronome;
+
+ //void readRecfile(Xml& xml);
+ void readAuxSend(Xml& xml);
+
+ protected:
+ float** outBuffers;
+ //float* outBuffers[MAX_CHANNELS];
+ int _totalOutChannels;
+ int _totalInChannels;
+
+ unsigned bufferPos;
+ virtual bool getData(unsigned, int, unsigned, float**);
+ SndFile* _recFile;
+ Fifo fifo; // fifo -> _recFile
+ bool _processed;
+
+ public:
+ AudioTrack(TrackType t);
+ //AudioTrack(TrackType t, int num_out_bufs = MAX_CHANNELS);
+
+ //AudioTrack(const AudioTrack&);
+ AudioTrack(const AudioTrack&, bool cloneParts);
+ virtual ~AudioTrack();
+
+ virtual bool setRecordFlag1(bool f);
+ virtual void setRecordFlag2(bool f);
+
+ bool processed() { return _processed; }
+ //void setProcessed(bool v) { _processed = v; }
+
+ void addController(CtrlList*);
+ void removeController(int id);
+ void swapControllerIDX(int idx1, int idx2);
+
+ bool readProperties(Xml&, const QString&);
+ void writeProperties(int, Xml&) const;
+
+ void mapRackPluginsToControllers();
+ void showPendingPluginNativeGuis();
+
+ //virtual AudioTrack* clone() const = 0;
+ virtual AudioTrack* clone(bool cloneParts) const = 0;
+ virtual Part* newPart(Part*p=0, bool clone=false);
+
+ SndFile* recFile() const { return _recFile; }
+ void setRecFile(SndFile* sf) { _recFile = sf; }
+
+ CtrlListList* controller() { return &_controller; }
+
+ virtual void setChannels(int n);
+ virtual void setTotalOutChannels(int num);
+ virtual int totalOutChannels() { return _totalOutChannels; }
+ virtual void setTotalInChannels(int num);
+ virtual int totalInChannels() { return _totalInChannels; }
+
+ virtual bool isMute() const;
+ virtual void setSolo(bool val);
+ virtual void updateSoloStates(bool noDec);
+ virtual void updateInternalSoloStates();
+
+ //bool soloMode() const { return _soloRefCnt; }
+
+ void putFifo(int channels, unsigned long n, float** bp);
+
+ void record();
+
+ virtual void setMute(bool val);
+ virtual void setOff(bool val);
+
+ void setSendMetronome(bool val) { _sendMetronome = val; }
+ bool sendMetronome() const { return _sendMetronome; }
+
+ double volume() const;
+ void setVolume(double val);
+ double pan() const;
+ void setPan(double val);
+
+ bool prefader() const { return _prefader; }
+ double auxSend(int idx) const;
+ void setAuxSend(int idx, double v);
+ void addAuxSend(int n);
+
+ void setPrefader(bool val);
+ Pipeline* efxPipe() { return _efxPipe; }
+ void deleteAllEfxGuis();
+ void clearEfxList();
+ void addPlugin(PluginI* plugin, int idx);
+
+ double pluginCtrlVal(int ctlID) const;
+ void setPluginCtrlVal(int param, double val);
+
+ void readVolume(Xml& xml);
+ //void writeRouting(int, Xml&) const;
+
+ // routing
+ //RouteList* inRoutes() { return &_inRoutes; }
+ //RouteList* outRoutes() { return &_outRoutes; }
+ //bool noInRoute() const { return _inRoutes.empty(); }
+ //bool noOutRoute() const { return _outRoutes.empty(); }
+
+ virtual void preProcessAlways() { _processed = false; }
+ virtual void addData(unsigned /*samplePos*/, int /*channels*/, int /*srcStartChan*/, int /*srcChannels*/, unsigned /*frames*/, float** /*buffer*/);
+ virtual void copyData(unsigned /*samplePos*/, int /*channels*/, int /*srcStartChan*/, int /*srcChannels*/, unsigned /*frames*/, float** /*buffer*/);
+ virtual bool hasAuxSend() const { return false; }
+
+ // automation
+ virtual AutomationType automationType() const { return _automationType; }
+ virtual void setAutomationType(AutomationType t);
+ void processAutomationEvents();
+ CtrlRecList* recEvents() { return &_recEvents; }
+ void recordAutomation(int n, double v);
+ void startAutoRecord(int, double);
+ void stopAutoRecord(int, double);
+ void setControllerMode(int, CtrlList::Mode m);
+ void clearControllerEvents(int);
+ void seekPrevACEvent(int);
+ void seekNextACEvent(int);
+ void eraseACEvent(int, int);
+ void eraseRangeACEvents(int, int, int);
+ void addACEvent(int, int, double);
+ };
+
+//---------------------------------------------------------
+// AudioInput
+//---------------------------------------------------------
+
+class AudioInput : public AudioTrack {
+ void* jackPorts[MAX_CHANNELS];
+ virtual bool getData(unsigned, int, unsigned, float**);
+
+ public:
+ AudioInput();
+ //AudioInput(const AudioInput&);
+ AudioInput(const AudioInput&, bool cloneParts);
+ virtual ~AudioInput();
+ //AudioInput* clone() const { return new AudioInput(*this); }
+ AudioInput* clone(bool cloneParts) const { return new AudioInput(*this, cloneParts); }
+ virtual AudioInput* newTrack() const { return new AudioInput(); }
+ virtual void read(Xml&);
+ virtual void write(int, Xml&) const;
+ virtual void setName(const QString& s);
+ void* jackPort(int channel) { return jackPorts[channel]; }
+ void setJackPort(int channel, void*p) { jackPorts[channel] = p; }
+ virtual void setChannels(int n);
+ virtual bool hasAuxSend() const { return true; }
+ };
+
+//---------------------------------------------------------
+// AudioOutput
+//---------------------------------------------------------
+
+class AudioOutput : public AudioTrack {
+ void* jackPorts[MAX_CHANNELS];
+ float* buffer[MAX_CHANNELS];
+ float* buffer1[MAX_CHANNELS];
+ unsigned long _nframes;
+
+ float* _monitorBuffer[MAX_CHANNELS];
+
+ public:
+ AudioOutput();
+ //AudioOutput(const AudioOutput&);
+ AudioOutput(const AudioOutput&, bool cloneParts);
+ virtual ~AudioOutput();
+ //AudioOutput* clone() const { return new AudioOutput(*this); }
+ AudioOutput* clone(bool cloneParts) const { return new AudioOutput(*this, cloneParts); }
+ virtual AudioOutput* newTrack() const { return new AudioOutput(); }
+ virtual void read(Xml&);
+ virtual void write(int, Xml&) const;
+ virtual void setName(const QString& s);
+ void* jackPort(int channel) { return jackPorts[channel]; }
+ void setJackPort(int channel, void*p) { jackPorts[channel] = p; }
+ virtual void setChannels(int n);
+// virtual bool isMute() const;
+
+ void processInit(unsigned);
+ void process(unsigned pos, unsigned offset, unsigned);
+ void processWrite();
+ void silence(unsigned);
+ virtual bool canRecord() const { return true; }
+
+ float** monitorBuffer() { return _monitorBuffer; }
+ };
+
+//---------------------------------------------------------
+// AudioGroup
+//---------------------------------------------------------
+
+class AudioGroup : public AudioTrack {
+ public:
+ AudioGroup() : AudioTrack(AUDIO_GROUP) { }
+ //AudioGroup* clone() const { return new AudioGroup(*this); }
+ AudioGroup* clone(bool /*cloneParts*/) const { return new AudioGroup(*this); }
+ virtual AudioGroup* newTrack() const { return new AudioGroup(); }
+ virtual void read(Xml&);
+ virtual void write(int, Xml&) const;
+ virtual bool hasAuxSend() const { return true; }
+ };
+
+//---------------------------------------------------------
+// AudioAux
+//---------------------------------------------------------
+
+class AudioAux : public AudioTrack {
+ float* buffer[MAX_CHANNELS];
+
+ public:
+ AudioAux();
+ //AudioAux* clone() const { return new AudioAux(*this); }
+ AudioAux* clone(bool /*cloneParts*/) const { return new AudioAux(*this); }
+ ~AudioAux();
+ virtual AudioAux* newTrack() const { return new AudioAux(); }
+ virtual void read(Xml&);
+ virtual void write(int, Xml&) const;
+ virtual bool getData(unsigned, int, unsigned, float**);
+ virtual void setChannels(int n);
+ float** sendBuffer() { return buffer; }
+ };
+
+//---------------------------------------------------------
+// WaveTrack
+//---------------------------------------------------------
+
+class WaveTrack : public AudioTrack {
+ Fifo _prefetchFifo; // prefetch Fifo
+
+ public:
+ static bool firstWaveTrack;
+
+ WaveTrack() : AudioTrack(Track::WAVE) { }
+ //WaveTrack(const WaveTrack& wt) : AudioTrack(wt) {}
+ WaveTrack(const WaveTrack& wt, bool cloneParts) : AudioTrack(wt, cloneParts) {}
+
+ //virtual WaveTrack* clone() const { return new WaveTrack(*this); }
+ virtual WaveTrack* clone(bool cloneParts) const { return new WaveTrack(*this, cloneParts); }
+ virtual WaveTrack* newTrack() const { return new WaveTrack(); }
+ virtual Part* newPart(Part*p=0, bool clone=false);
+
+ virtual void read(Xml&);
+ virtual void write(int, Xml&) const;
+
+ //virtual void fetchData(unsigned pos, unsigned frames, float** bp);
+ virtual void fetchData(unsigned pos, unsigned frames, float** bp, bool doSeek);
+
+ virtual bool getData(unsigned, int ch, unsigned, float** bp);
+
+ void clearPrefetchFifo() { _prefetchFifo.clear(); }
+ Fifo* prefetchFifo() { return &_prefetchFifo; }
+ virtual void setChannels(int n);
+ virtual bool hasAuxSend() const { return true; }
+ bool canEnableRecord() const;
+ virtual bool canRecord() const { return true; }
+ };
+
+//---------------------------------------------------------
+// TrackList
+//---------------------------------------------------------
+
+template<class T> class tracklist : public std::vector<Track*> {
+ typedef std::vector<Track*> vlist;
+
+ public:
+ class iterator : public vlist::iterator {
+ public:
+ iterator() : vlist::iterator() {}
+ iterator(vlist::iterator i) : vlist::iterator(i) {}
+
+ T operator*() {
+ return (T)(**((vlist::iterator*)this));
+ }
+ iterator operator++(int) {
+ return iterator ((*(vlist::iterator*)this).operator++(0));
+ }
+ iterator& operator++() {
+ return (iterator&) ((*(vlist::iterator*)this).operator++());
+ }
+ };
+
+ class const_iterator : public vlist::const_iterator {
+ public:
+ const_iterator() : vlist::const_iterator() {}
+ const_iterator(vlist::const_iterator i) : vlist::const_iterator(i) {}
+ const_iterator(vlist::iterator i) : vlist::const_iterator(i) {}
+
+ const T operator*() const {
+ return (T)(**((vlist::const_iterator*)this));
+ }
+ };
+
+ class reverse_iterator : public vlist::reverse_iterator {
+ public:
+ reverse_iterator() : vlist::reverse_iterator() {}
+ reverse_iterator(vlist::reverse_iterator i) : vlist::reverse_iterator(i) {}
+
+ T operator*() {
+ return (T)(**((vlist::reverse_iterator*)this));
+ }
+ };
+
+ tracklist() : vlist() {}
+ virtual ~tracklist() {}
+
+ void push_back(T v) { vlist::push_back(v); }
+ iterator begin() { return vlist::begin(); }
+ iterator end() { return vlist::end(); }
+ const_iterator begin() const { return vlist::begin(); }
+ const_iterator end() const { return vlist::end(); }
+ reverse_iterator rbegin() { return vlist::rbegin(); }
+ reverse_iterator rend() { return vlist::rend(); }
+ T& back() const { return (T&)(vlist::back()); }
+ T& front() const { return (T&)(vlist::front()); }
+ iterator find(const Track* t) {
+ return std::find(begin(), end(), t);
+ }
+ const_iterator find(const Track* t) const {
+ return std::find(begin(), end(), t);
+ }
+ unsigned index(const Track* t) const {
+ unsigned n = 0;
+ for (vlist::const_iterator i = begin(); i != end(); ++i, ++n) {
+ if (*i == t)
+ return n;
+ }
+ return -1;
+ }
+ T index(int k) const { return (*this)[k]; }
+ iterator index2iterator(int k) {
+ if ((unsigned)k >= size())
+ return end();
+ return begin() + k;
+ }
+ void erase(Track* t) { vlist::erase(find(t)); }
+
+ void clearDelete() {
+ for (vlist::iterator i = begin(); i != end(); ++i)
+ delete *i;
+ vlist::clear();
+ }
+ void erase(vlist::iterator i) { vlist::erase(i); }
+ void replace(Track* ot, Track* nt) {
+ for (vlist::iterator i = begin(); i != end(); ++i) {
+ if (*i == ot) {
+ *i = nt;
+ return;
+ }
+ }
+ }
+ };
+
+typedef tracklist<Track*> TrackList;
+typedef TrackList::iterator iTrack;
+typedef TrackList::const_iterator ciTrack;
+
+typedef tracklist<MidiTrack*>::iterator iMidiTrack;
+typedef tracklist<MidiTrack*>::const_iterator ciMidiTrack;
+typedef tracklist<MidiTrack*> MidiTrackList;
+
+typedef tracklist<WaveTrack*>::iterator iWaveTrack;
+typedef tracklist<WaveTrack*>::const_iterator ciWaveTrack;
+typedef tracklist<WaveTrack*> WaveTrackList;
+
+typedef tracklist<AudioInput*>::iterator iAudioInput;
+typedef tracklist<AudioInput*>::const_iterator ciAudioInput;
+typedef tracklist<AudioInput*> InputList;
+
+typedef tracklist<AudioOutput*>::iterator iAudioOutput;
+typedef tracklist<AudioOutput*>::const_iterator ciAudioOutput;
+typedef tracklist<AudioOutput*> OutputList;
+
+typedef tracklist<AudioGroup*>::iterator iAudioGroup;
+typedef tracklist<AudioGroup*>::const_iterator ciAudioGroup;
+typedef tracklist<AudioGroup*> GroupList;
+
+typedef tracklist<AudioAux*>::iterator iAudioAux;
+typedef tracklist<AudioAux*>::const_iterator ciAudioAux;
+typedef tracklist<AudioAux*> AuxList;
+
+typedef tracklist<SynthI*>::iterator iSynthI;
+typedef tracklist<SynthI*>::const_iterator ciSynthI;
+typedef tracklist<SynthI*> SynthIList;
+
+extern void addPortCtrlEvents(MidiTrack* t);
+extern void removePortCtrlEvents(MidiTrack* t);
+
+#endif
+
diff --git a/muse2/muse/transport.cpp b/muse2/muse/transport.cpp
new file mode 100644
index 00000000..4cb206a2
--- /dev/null
+++ b/muse2/muse/transport.cpp
@@ -0,0 +1,673 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: transport.cpp,v 1.8.2.3 2009/07/01 10:39:42 spamatica Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <q3vbox.h>
+#include <qlabel.h>
+#include <qslider.h>
+#include <qpushbutton.h>
+#include <q3frame.h>
+#include <q3whatsthis.h>
+#include <qtooltip.h>
+#include <qlayout.h>
+#include <qtoolbutton.h>
+#include <qcombobox.h>
+#include <qaction.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <QPixmap>
+#include <QMouseEvent>
+#include <Q3VBoxLayout>
+#include <Q3BoxLayout>
+
+#include "song.h"
+#include "transport.h"
+#include "doublelabel.h"
+#include "siglabel.h"
+#include "globals.h"
+#include "icons.h"
+#include "posedit.h"
+#include "sync.h"
+#include "shortcuts.h"
+#include "gconfig.h"
+#include "app.h"
+
+static const char* recordTransportText = QT_TR_NOOP("Click this button to enable recording");
+static const char* stopTransportText = QT_TR_NOOP("Click this button to stop playback");
+static const char* playTransportText = QT_TR_NOOP("Click this button to start playback");
+static const char* startTransportText = QT_TR_NOOP("Click this button to rewind to start position");
+static const char* frewindTransportText = QT_TR_NOOP("Click this button to rewind");
+static const char* fforwardTransportText = QT_TR_NOOP("Click this button to forward current play position");
+
+//---------------------------------------------------------
+// toolButton
+//---------------------------------------------------------
+
+static QToolButton* newButton(QWidget* parent, const QString& s,
+ const QString& tt, bool toggle=false, int height=25)
+ {
+ QToolButton* button = new QToolButton(parent);
+ button->setFixedHeight(height);
+ button->setText(s);
+ button->setToggleButton(toggle);
+ QToolTip::add(button, tt);
+ return button;
+ }
+
+static QToolButton* newButton(QWidget* parent, const QPixmap* pm,
+ const QString& tt, bool toggle=false)
+ {
+ QToolButton* button = new QToolButton(parent);
+ button->setFixedHeight(25);
+ button->setPixmap(*pm);
+ button->setToggleButton(toggle);
+ QToolTip::add(button, tt);
+ return button;
+ }
+
+//---------------------------------------------------------
+// Handle
+// erlaubt das Verschieben eines Root-Windows mit der
+// Maus
+//---------------------------------------------------------
+
+Handle::Handle(QWidget* root, QWidget* r)
+ : QWidget(root)
+ {
+ rootWin = r;
+ setFixedWidth(20);
+ setCursor(Qt::pointingHandCursor);
+ setBackgroundColor(config.transportHandleColor);
+ }
+
+//---------------------------------------------------------
+// mouseMoveEvent
+//---------------------------------------------------------
+
+void Handle::mouseMoveEvent(QMouseEvent* ev)
+ {
+ rootWin->move(ev->globalX()-dx, ev->globalY() - dy);
+ }
+
+//---------------------------------------------------------
+// mousePressEvent
+//---------------------------------------------------------
+
+void Handle::mousePressEvent(QMouseEvent* ev)
+ {
+ rootWin->raise();
+ dx = ev->globalX() - rootWin->x();
+ dy = ev->globalY() - rootWin->y();
+ }
+
+//---------------------------------------------------------
+// TempoSig
+// Widget fÃŊÂŋÂ―r Tempo + Signature
+//---------------------------------------------------------
+
+TempoSig::TempoSig(QWidget* parent)
+ : QWidget(parent, "TempoSig")
+ {
+ Q3BoxLayout* vb1 = new Q3VBoxLayout(this);
+ vb1->setAutoAdd(true);
+
+ Q3Frame* f = new Q3Frame(this);
+ f->setFrameStyle(Q3Frame::Panel | Q3Frame::Sunken);
+ f->setLineWidth(1);
+
+ Q3BoxLayout* vb2 = new Q3VBoxLayout(f);
+ vb2->setAutoAdd(true);
+
+ l1 = new DoubleLabel(120.0, 20.0, 400.0, f);
+
+ l1->setSpecialText(QString("extern"));
+ l2 = new SigLabel(4, 4, f);
+
+ l3 = new QLabel(tr("Tempo/Sig"), this);
+ l3->setFont(config.fonts[2]);
+
+ l1->setBackgroundMode(Qt::PaletteLight);
+ l1->setAlignment(Qt::AlignCenter);
+ l1->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
+ l2->setBackgroundMode(Qt::PaletteLight);
+ l2->setAlignment(Qt::AlignCenter);
+ l2->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
+ l3->setAlignment(Qt::AlignCenter);
+ l3->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
+
+ connect(l1, SIGNAL(valueChanged(double,int)), SLOT(setTempo(double)));
+ connect(l2, SIGNAL(valueChanged(int,int)), SIGNAL(sigChanged(int,int)));
+ connect(muse, SIGNAL(configChanged()), SLOT(configChanged()));
+ }
+
+//---------------------------------------------------------
+// configChanged
+//---------------------------------------------------------
+
+void TempoSig::configChanged()
+ {
+ l3->setFont(config.fonts[2]);
+ }
+
+//---------------------------------------------------------
+// setTempo
+//---------------------------------------------------------
+
+void TempoSig::setTempo(double t)
+ {
+ int tempo = int ((1000000.0 * 60.0)/t);
+ emit tempoChanged(tempo);
+ }
+
+//---------------------------------------------------------
+// setTempo
+//---------------------------------------------------------
+
+void TempoSig::setTempo(int tempo)
+ {
+ double t;
+ if(tempo == 0)
+ t = l1->off() - 1.0;
+ else
+ t = (1000000.0 * 60.0)/tempo;
+
+ l1->blockSignals(true);
+ l1->setValue(t);
+ l1->blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// setTimesig
+//---------------------------------------------------------
+
+void TempoSig::setTimesig(int a, int b)
+ {
+ l2->setValue(a, b);
+ }
+
+//---------------------------------------------------------
+// setRecord
+//---------------------------------------------------------
+
+void Transport::setRecord(bool flag)
+ {
+ buttons[5]->blockSignals(true);
+ buttons[5]->setOn(flag);
+ buttons[5]->blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// Transport
+//---------------------------------------------------------
+
+Transport::Transport(QWidget*, const char* name)
+ // : QWidget(0, name, WStyle_Customize | WType_TopLevel | WStyle_Tool
+ //| WStyle_NoBorder | WStyle_StaysOnTop)
+ : QWidget(0, name, Qt::WStyle_Customize | Qt::WType_TopLevel | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop)
+ {
+ setCaption(QString("Muse: Transport"));
+ setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
+
+ Q3HBoxLayout* hbox = new Q3HBoxLayout(this, 2, 5);
+
+ hbox->setAutoAdd(true);
+ lefthandle = new Handle(this, this);
+
+ //-----------------------------------------------------
+ // Record & Cycle Mode
+ //-----------------------------------------------------
+
+ Q3VBox* box1 = new Q3VBox(this);
+ recMode = new QComboBox(box1);
+ recMode->setFocusPolicy(Qt::NoFocus);
+ recMode->insertItem(tr("Overdub"), Song::REC_OVERDUP);
+ recMode->insertItem(tr("Replace"), Song::REC_REPLACE);
+ recMode->setCurrentItem(song->recMode());
+ l2 = new QLabel(tr("Rec Mode"), box1);
+ l2->setFont(config.fonts[2]);
+ l2->setAlignment(Qt::AlignCenter);
+ connect(recMode, SIGNAL(activated(int)), SLOT(setRecMode(int)));
+
+ cycleMode = new QComboBox(box1);
+ cycleMode->setFocusPolicy(Qt::NoFocus);
+ cycleMode->insertItem(tr("Normal"), Song::CYCLE_NORMAL);
+ cycleMode->insertItem(tr("Mix"), Song::CYCLE_MIX);
+ cycleMode->insertItem(tr("Replace"), Song::CYCLE_REPLACE);
+ cycleMode->setCurrentItem(song->cycleMode());
+ l3 = new QLabel(tr("Cycle Rec"), box1);
+ l3->setFont(config.fonts[2]);
+ l3->setAlignment(Qt::AlignCenter);
+ connect(cycleMode, SIGNAL(activated(int)), SLOT(setCycleMode(int)));
+
+ //-----------------------------------------------------
+ // loop flags
+ //-----------------------------------------------------
+
+ Q3VBox* button2 = new Q3VBox(this);
+ button2->setMargin(3);
+
+ QToolButton* b1 = newButton(button2, punchinIcon, tr("punchin"), true);
+ QToolButton* b2 = newButton(button2, loopIcon, tr("loop"), true);
+ b2->setAccel(shortcuts[SHRT_TOGGLE_LOOP].key);
+
+ QToolButton* b3 = newButton(button2, punchoutIcon, tr("punchout"), true);
+ QToolTip::add(b1, tr("Punch In"));
+ QToolTip::add(b2, tr("Loop"));
+ QToolTip::add(b3, tr("Punch Out"));
+ Q3WhatsThis::add(b1, tr("Punch In"));
+
+ connect(b1, SIGNAL(toggled(bool)), song, SLOT(setPunchin(bool)));
+ connect(b2, SIGNAL(toggled(bool)), song, SLOT(setLoop(bool)));
+ connect(b3, SIGNAL(toggled(bool)), song, SLOT(setPunchout(bool)));
+
+ b1->setOn(song->punchin());
+ b2->setOn(song->loop());
+ b3->setOn(song->punchout());
+
+ connect(song, SIGNAL(punchinChanged(bool)), b1, SLOT(setOn(bool)));
+ connect(song, SIGNAL(punchoutChanged(bool)), b3, SLOT(setOn(bool)));
+ connect(song, SIGNAL(loopChanged(bool)), b2, SLOT(setOn(bool)));
+
+ //-----------------------------------------------------
+ // left right mark
+ //-----------------------------------------------------
+
+ Q3VBox* marken = new Q3VBox(this);
+ tl1 = new PosEdit(marken);
+ l5 = new QLabel(tr("Left Mark"), marken);
+ l5->setFont(config.fonts[2]);
+ l5->setAlignment(Qt::AlignCenter);
+ tl2 = new PosEdit(marken);
+ l6 = new QLabel(tr("Right Mark"), marken);
+ l6->setFont(config.fonts[2]);
+ l6->setAlignment(Qt::AlignCenter);
+
+ //-----------------------------------------------------
+ // Transport Buttons
+ //-----------------------------------------------------
+
+ Q3VBox* box4 = new Q3VBox(this);
+ box4->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
+ box4->setSpacing(3);
+ Q3HBox* hbox1 = new Q3HBox(box4);
+ hbox1->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
+ time1 = new PosEdit(hbox1);
+ time2 = new PosEdit(hbox1);
+ time2->setSmpte(true);
+ time1->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
+ time2->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
+
+ slider = new QSlider(0, 200000, 1000, 0, Qt::Horizontal, box4);
+
+ tb = new Q3HBox(box4);
+ tb->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
+
+ buttons[0] = newButton(tb, startIcon, tr("rewind to start"));
+ Q3WhatsThis::add(buttons[0], tr(startTransportText));
+
+ buttons[1] = newButton(tb, frewindIcon, tr("rewind"));
+ buttons[1]->setAutoRepeat(true);
+ Q3WhatsThis::add(buttons[1], tr(frewindTransportText));
+
+ buttons[2] = newButton(tb, fforwardIcon, tr("forward"));
+ buttons[2]->setAutoRepeat(true);
+ Q3WhatsThis::add(buttons[2], tr(fforwardTransportText));
+
+ buttons[3] = newButton(tb, stopIcon, tr("stop"), true);
+ buttons[3]->setOn(true); // set STOP
+ Q3WhatsThis::add(buttons[3], tr(stopTransportText));
+
+ buttons[4] = newButton(tb, playIcon, tr("play"), true);
+ Q3WhatsThis::add(buttons[4], tr(playTransportText));
+
+ buttons[5] = newButton(tb, record_on_Icon, tr("record"), true);
+ Q3WhatsThis::add(buttons[5], tr(recordTransportText));
+
+ for (int i = 0; i < 6; ++i)
+ buttons[i]->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
+
+
+ connect(buttons[3], SIGNAL(toggled(bool)), SLOT(stopToggled(bool)));
+ connect(buttons[4], SIGNAL(toggled(bool)), SLOT(playToggled(bool)));
+
+ connect(buttons[5], SIGNAL(toggled(bool)), song, SLOT(setRecord(bool)));
+ connect(song, SIGNAL(recordChanged(bool)), SLOT(setRecord(bool)));
+ connect(buttons[0], SIGNAL(clicked()), song, SLOT(rewindStart()));
+ connect(buttons[1], SIGNAL(clicked()), song, SLOT(rewind()));
+ connect(buttons[2], SIGNAL(clicked()), song, SLOT(forward()));
+
+ //-----------------------------------------------------
+ // AQ - Click - Sync
+ //-----------------------------------------------------
+
+ Q3VBox* button1 = new Q3VBox(this);
+ button1->setMargin(1);
+
+ quantizeButton = newButton(button1, tr("AC"), tr("quantize during record"), true,19);
+ clickButton = newButton(button1, tr("Click"), tr("metronom click on/off"), true,19);
+ clickButton->setAccel(shortcuts[SHRT_TOGGLE_METRO].key);
+
+ syncButton = newButton(button1, tr("Sync"), tr("external sync on/off"), true,19);
+ jackTransportButton = newButton(button1, tr("Jack"), tr("Jack transport sync on/off"), true,19);
+
+ quantizeButton->setOn(song->quantize());
+ clickButton->setOn(song->click());
+ syncButton->setOn(extSyncFlag.value());
+ jackTransportButton->setOn(useJackTransport.value());
+
+ connect(quantizeButton, SIGNAL(toggled(bool)), song, SLOT(setQuantize(bool)));
+ connect(clickButton, SIGNAL(toggled(bool)), song, SLOT(setClick(bool)));
+
+ connect(syncButton, SIGNAL(toggled(bool)), &extSyncFlag, SLOT(setValue(bool)));
+ connect(jackTransportButton, SIGNAL(toggled(bool)),&useJackTransport, SLOT(setValue(bool)));
+ connect(&extSyncFlag, SIGNAL(valueChanged(bool)), SLOT(syncChanged(bool)));
+ connect(&useJackTransport, SIGNAL(valueChanged(bool)), SLOT(jackSyncChanged(bool)));
+
+ connect(song, SIGNAL(quantizeChanged(bool)), this, SLOT(setQuantizeFlag(bool)));
+ connect(song, SIGNAL(clickChanged(bool)), this, SLOT(setClickFlag(bool)));
+
+ //-----------------------------------------------------
+ // Tempo/Sig
+ //-----------------------------------------------------
+
+ Q3VBox* box5 = new Q3VBox(this);
+ tempo = new TempoSig(box5);
+ tempo->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
+ masterButton = newButton(box5, tr("Master"), tr("use master track"), true);
+ masterButton->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
+
+ connect(masterButton, SIGNAL(toggled(bool)), song, SLOT(setMasterFlag(bool)));
+
+ //-----------------------------------------------------
+
+ connect(tl1, SIGNAL(valueChanged(const Pos&)), SLOT(lposChanged(const Pos&)));
+ connect(tl2, SIGNAL(valueChanged(const Pos&)), SLOT(rposChanged(const Pos&)));
+ connect(time1, SIGNAL(valueChanged(const Pos&)), SLOT(cposChanged(const Pos&)));
+ connect(time2, SIGNAL(valueChanged(const Pos&)), SLOT(cposChanged(const Pos&)));
+
+ connect(slider,SIGNAL(valueChanged(int)), SLOT(cposChanged(int)));
+ connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool)));
+ connect(tempo, SIGNAL(tempoChanged(int)), song, SLOT(setTempo(int)));
+ connect(tempo, SIGNAL(sigChanged(int, int)), song, SLOT(setSig(int, int)));
+ connect(song, SIGNAL(playChanged(bool)), SLOT(setPlay(bool)));
+ connect(song, SIGNAL(songChanged(int)), this, SLOT(songChanged(int)));
+ connect(muse, SIGNAL(configChanged()), SLOT(configChanged()));
+ righthandle = new Handle(this, this);
+ }
+
+//---------------------------------------------------------
+// configChanged
+//---------------------------------------------------------
+
+void Transport::configChanged()
+ {
+ l2->setFont(config.fonts[2]);
+ l3->setFont(config.fonts[2]);
+ l5->setFont(config.fonts[2]);
+ l6->setFont(config.fonts[2]);
+ lefthandle->setBackgroundColor(config.transportHandleColor);
+ righthandle->setBackgroundColor(config.transportHandleColor);
+ }
+
+//---------------------------------------------------------
+// setTempo
+//---------------------------------------------------------
+
+void Transport::setTempo(int t)
+ {
+ static int tempoVal = -1;
+ if (t != tempoVal) {
+ tempo->setTempo(t);
+ tempoVal = t;
+ }
+ }
+
+//---------------------------------------------------------
+// setHandleColor
+//---------------------------------------------------------
+
+void Transport::setHandleColor(QColor c)
+ {
+ lefthandle->setBackgroundColor(c);
+ righthandle->setBackgroundColor(c);
+ }
+
+//---------------------------------------------------------
+// setTimesig
+//---------------------------------------------------------
+
+void Transport::setTimesig(int z, int n)
+ {
+ tempo->setTimesig(z, n);
+ }
+
+//---------------------------------------------------------
+// setPos
+//---------------------------------------------------------
+
+void Transport::setPos(int idx, unsigned v, bool)
+ {
+ switch (idx) {
+ case 0:
+ time1->setValue(v);
+ time2->setValue(v);
+ slider->blockSignals(true);
+ slider->setValue(v);
+ slider->blockSignals(false);
+ if (song->masterFlag())
+ setTempo(tempomap.tempo(v));
+ {
+ int z, n;
+ sigmap.timesig(v, z, n);
+ setTimesig(z, n);
+ }
+ break;
+ case 1:
+ tl1->setValue(v);
+ break;
+ case 2:
+ tl2->setValue(v);
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// cposChanged
+//---------------------------------------------------------
+
+void Transport::cposChanged(int tick)
+ {
+ song->setPos(0, tick);
+ }
+
+//---------------------------------------------------------
+// cposChanged
+//---------------------------------------------------------
+
+void Transport::cposChanged(const Pos& pos)
+ {
+ song->setPos(0, pos.tick());
+ }
+
+//---------------------------------------------------------
+// lposChanged
+//---------------------------------------------------------
+
+void Transport::lposChanged(const Pos& pos)
+ {
+ song->setPos(1, pos.tick());
+ }
+
+//---------------------------------------------------------
+// rposChanged
+//---------------------------------------------------------
+
+void Transport::rposChanged(const Pos& pos)
+ {
+ song->setPos(2, pos.tick());
+ }
+
+//---------------------------------------------------------
+// setPlay
+//---------------------------------------------------------
+
+void Transport::setPlay(bool f)
+ {
+ buttons[3]->blockSignals(true);
+ buttons[4]->blockSignals(true);
+ buttons[3]->setOn(!f);
+ buttons[4]->setOn(f);
+ buttons[3]->blockSignals(false);
+ buttons[4]->blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// setMasterFlag
+//---------------------------------------------------------
+
+void Transport::setMasterFlag(bool f)
+ {
+ masterButton->setOn(f);
+ }
+
+//---------------------------------------------------------
+// setClickFlag
+//---------------------------------------------------------
+
+void Transport::setClickFlag(bool f)
+ {
+ clickButton->blockSignals(true);
+ clickButton->setOn(f);
+ clickButton->blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// setQuantizeFlag
+//---------------------------------------------------------
+
+void Transport::setQuantizeFlag(bool f)
+ {
+ quantizeButton->setOn(f);
+ }
+
+//---------------------------------------------------------
+// setSyncFlag
+//---------------------------------------------------------
+
+void Transport::setSyncFlag(bool f)
+ {
+ syncButton->setOn(f);
+ }
+
+//---------------------------------------------------------
+// toggleRecMode
+//---------------------------------------------------------
+
+void Transport::setRecMode(int id)
+ {
+ song->setRecMode(id);
+ }
+
+//---------------------------------------------------------
+// toggleCycleMode
+//---------------------------------------------------------
+
+void Transport::setCycleMode(int id)
+ {
+ song->setCycleMode(id);
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void Transport::songChanged(int flags)
+ {
+ // Is it simply a midi controller value adjustment? Forget it.
+ if(flags == SC_MIDI_CONTROLLER)
+ return;
+
+ slider->setRange(0, song->len());
+ int cpos = song->cpos();
+ int t = tempomap.tempo(cpos);
+ if (flags & (SC_MASTER | SC_TEMPO)) {
+ if (extSyncFlag.value())
+ setTempo(0);
+ else
+ setTempo(t);
+ }
+ if (flags & SC_SIG) {
+ int z, n;
+ sigmap.timesig(cpos, z, n);
+ setTimesig(z, n);
+ }
+ if (flags & SC_MASTER)
+ masterButton->setOn(song->masterFlag());
+ }
+
+//---------------------------------------------------------
+// syncChanged
+//---------------------------------------------------------
+
+void Transport::syncChanged(bool flag)
+ {
+ syncButton->setOn(flag);
+ buttons[0]->setEnabled(!flag); // goto start
+ buttons[1]->setEnabled(!flag); // rewind
+ buttons[2]->setEnabled(!flag); // forward
+ buttons[3]->setEnabled(!flag); // stop
+ buttons[4]->setEnabled(!flag); // play
+ slider->setEnabled(!flag);
+ masterButton->setEnabled(!flag);
+ if (flag) {
+ masterButton->setOn(false);
+ song->setMasterFlag(false);
+ tempo->setTempo(0); // slave mode: show "extern"
+ }
+ else
+ tempo->setTempo(tempomap.tempo(song->cpos()));
+ playAction->setEnabled(!flag);
+ startAction->setEnabled(!flag);
+ stopAction->setEnabled(!flag);
+ rewindAction->setEnabled(!flag);
+ forwardAction->setEnabled(!flag);
+ }
+
+void Transport::jackSyncChanged(bool flag)
+ {
+ jackTransportButton->setOn(flag);
+ }
+//---------------------------------------------------------
+// stopToggled
+//---------------------------------------------------------
+
+void Transport::stopToggled(bool val)
+ {
+ if (val)
+ song->setStop(true);
+ else {
+ buttons[3]->blockSignals(true);
+ buttons[3]->setOn(true);
+ buttons[3]->blockSignals(false);
+ }
+ }
+
+//---------------------------------------------------------
+// playToggled
+//---------------------------------------------------------
+
+void Transport::playToggled(bool val)
+ {
+ if (val)
+ song->setPlay(true);
+ else {
+ buttons[4]->blockSignals(true);
+ buttons[4]->setOn(true);
+ buttons[4]->blockSignals(false);
+ }
+ }
+
diff --git a/muse2/muse/transport.h b/muse2/muse/transport.h
new file mode 100644
index 00000000..cf87ead6
--- /dev/null
+++ b/muse2/muse/transport.h
@@ -0,0 +1,129 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: transport.h,v 1.4 2004/06/28 21:13:16 wschweer Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __TRANSPORT_H__
+#define __TRANSPORT_H__
+
+#include <qwidget.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QLabel>
+
+class QToolButton;
+class Q3HBox;
+class PosEdit;
+class QSlider;
+class DoubleLabel;
+class SigLabel;
+class QComboBox;
+class Pos;
+class QLabel;
+
+//---------------------------------------------------------
+// TempoSig
+//---------------------------------------------------------
+
+class TempoSig : public QWidget {
+ DoubleLabel* l1;
+ SigLabel* l2;
+ QLabel* l3;
+ Q_OBJECT
+
+ private slots:
+ void configChanged();
+
+ public slots:
+ void setTempo(double);
+ void setTempo(int tempo);
+
+ signals:
+ void tempoChanged(int);
+ void sigChanged(int, int);
+
+ public:
+ TempoSig(QWidget* parent);
+ void setTimesig(int a, int b);
+ };
+
+//---------------------------------------------------------
+// Handle
+//---------------------------------------------------------
+
+class Handle : public QWidget {
+ QWidget* rootWin;
+ int dx, dy;
+ void mouseMoveEvent(QMouseEvent* ev);
+ void mousePressEvent(QMouseEvent* ev);
+ public:
+ Handle(QWidget* parent, QWidget* root);
+ };
+
+class TimeLLabel;
+
+//---------------------------------------------------------
+// Transport
+//---------------------------------------------------------
+
+class Transport : public QWidget
+ {
+ PosEdit* tl1; // left mark
+ PosEdit* tl2; // right mark
+ PosEdit* time1; // tick time
+ PosEdit* time2; // SMPTE
+ QSlider* slider;
+ TempoSig* tempo;
+ Q3HBox* tb;
+ QToolButton* masterButton;
+ QComboBox* recMode;
+ QComboBox* cycleMode;
+ QToolButton* quantizeButton;
+ QToolButton* clickButton;
+ QToolButton* syncButton;
+ QToolButton* jackTransportButton;
+ QToolButton* buttons[6]; // transport buttons
+ QLabel* l2;
+ QLabel* l3;
+ QLabel* l5;
+ QLabel* l6;
+
+ Handle *lefthandle, *righthandle;
+
+ Q_OBJECT
+
+ private slots:
+ void cposChanged(const Pos&);
+ void cposChanged(int);
+ void lposChanged(const Pos&);
+ void rposChanged(const Pos&);
+ void setRecMode(int);
+ void setCycleMode(int);
+ void songChanged(int);
+ void syncChanged(bool);
+ void jackSyncChanged(bool);
+ void setRecord(bool flag);
+ void stopToggled(bool);
+ void playToggled(bool);
+ void configChanged();
+
+ public slots:
+ void setTempo(int tempo);
+ void setTimesig(int a, int b);
+ void setPos(int,unsigned, bool);
+ void setMasterFlag(bool);
+ void setClickFlag(bool);
+ void setQuantizeFlag(bool);
+ void setSyncFlag(bool);
+ void setPlay(bool f);
+ void setHandleColor(QColor);
+
+ public:
+ Transport(QWidget* parent, const char* name = 0);
+ QColor getHandleColor() const { return lefthandle->backgroundColor(); }
+ };
+#endif
+
diff --git a/muse2/muse/transpose.cpp b/muse2/muse/transpose.cpp
new file mode 100644
index 00000000..3090b450
--- /dev/null
+++ b/muse2/muse/transpose.cpp
@@ -0,0 +1,92 @@
+
+#include <stdio.h>
+#include <qcombobox.h>
+#include <qspinbox.h>
+#include <q3buttongroup.h>
+#include <qradiobutton.h>
+#include "transpose.h"
+#include "track.h"
+#include "song.h"
+#include "event.h"
+#include "audio.h"
+
+//---------------------------------------------------------
+// Transpose
+//---------------------------------------------------------
+
+Transpose::Transpose(QWidget* parent, const char* name)
+ : TransposeDialogBase(parent, name)
+ {
+ if (song->lpos() != song->rpos()) {
+ time_selected->setChecked(true);
+ }
+ else {
+// time_all->setChecked(true);
+ ButtonGroup1->setEnabled(false);
+ }
+// parts_all->setSelected(true);
+ }
+
+//---------------------------------------------------------
+// accept
+//---------------------------------------------------------
+
+void Transpose::accept()
+ {
+ int left = 0, right = 0;
+ int dv = delta->value();
+
+ TrackList *tracks = song->tracks();
+
+ if (time_selected->isChecked()) {
+ left = song->lpos();
+ right = song->rpos();
+ }
+ else {
+ left = 0;
+ right = song->len();
+ }
+
+ std::vector< EventList* > doneList;
+ typedef std::vector< EventList* >::iterator iDoneList;
+
+ song->startUndo();
+ for (iTrack t = tracks->begin(); t != tracks->end(); ++t) {
+// if (((*t)->type() == Track::MIDI || (*t)->type() == Track::DRUM)
+ if (((*t)->type() != Track::MIDI)
+ || !(parts_all->isChecked() || (*t)->selected()))
+ continue;
+
+ PartList *pl = (*t)->parts();
+ for (iPart p = pl->begin(); p != pl->end(); ++p) {
+ MidiPart *mp = (MidiPart *) p->second;
+ EventList* el = mp->events();
+
+ // Check if the event list has already been done. Skip repeated clones.
+ iDoneList idl;
+ for(idl = doneList.begin(); idl != doneList.end(); ++idl)
+ if(*idl == el)
+ break;
+ if(idl != doneList.end())
+ break;
+ doneList.push_back(el);
+
+ for (iEvent i = el->begin(); i != el->end(); ++i) {
+ Event oe = i->second;
+ int tick = oe.tick();
+ if (tick > right)
+ break;
+ if (tick < left)
+ continue;
+ Event ne = oe.clone();
+ ne.setA(oe.dataA() + dv );
+ // Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(oe, ne, mp, false);
+ audio->msgChangeEvent(oe, ne, mp, false, false, false);
+ }
+ }
+ }
+ song->endUndo(SC_EVENT_MODIFIED);
+ close(true);
+ }
+
diff --git a/muse2/muse/transpose.h b/muse2/muse/transpose.h
new file mode 100644
index 00000000..a5e004f8
--- /dev/null
+++ b/muse2/muse/transpose.h
@@ -0,0 +1,21 @@
+
+#ifndef __TRANSPOSE_H__
+#define __TRANSPOSE_H__
+
+#include "transposebase.h"
+
+//---------------------------------------------------------
+// transpose widget
+//---------------------------------------------------------
+
+class Transpose : public TransposeDialogBase {
+ Q_OBJECT
+
+ private slots:
+ virtual void accept();
+
+ public:
+ Transpose(QWidget* parent=0, const char* name=0);
+ };
+
+#endif
diff --git a/muse2/muse/undo.cpp b/muse2/muse/undo.cpp
new file mode 100644
index 00000000..ba020d2f
--- /dev/null
+++ b/muse2/muse/undo.cpp
@@ -0,0 +1,968 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: undo.cpp,v 1.12.2.9 2009/05/24 21:43:44 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "undo.h"
+#include "song.h"
+#include "globals.h"
+
+// iundo points to last Undo() in Undo-list
+
+static bool undoMode = false; // for debugging
+
+std::list<QString> temporaryWavFiles;
+
+//---------------------------------------------------------
+// typeName
+//---------------------------------------------------------
+
+const char* UndoOp::typeName()
+ {
+ static const char* name[] = {
+ "AddTrack", "DeleteTrack", "ModifyTrack",
+ "AddPart", "DeletePart", "ModifyPart",
+ "AddEvent", "DeleteEvent", "ModifyEvent",
+ "AddTempo", "DeleteTempo", "AddSig", "DeleteSig",
+ "SwapTrack", "ModifyClip"
+ };
+ return name[type];
+ }
+
+//---------------------------------------------------------
+// dump
+//---------------------------------------------------------
+
+void UndoOp::dump()
+ {
+ printf("UndoOp: %s\n ", typeName());
+ switch(type) {
+ case AddTrack:
+ case DeleteTrack:
+ printf("%d %s\n", trackno, oTrack->name().latin1());
+ break;
+ case ModifyTrack:
+ printf("%d <%s>-<%s>\n", trackno, oTrack->name().latin1(), nTrack->name().latin1());
+ break;
+ case AddPart:
+ case DeletePart:
+ case ModifyPart:
+ break;
+ case AddEvent:
+ case DeleteEvent:
+ printf("old event:\n");
+ oEvent.dump(5);
+ printf(" new event:\n");
+ nEvent.dump(5);
+ printf(" Part:\n");
+ if (part)
+ part->dump(5);
+ break;
+ case ModifyEvent:
+ case AddTempo:
+ case DeleteTempo:
+ case AddSig:
+ case SwapTrack:
+ case DeleteSig:
+ case ModifyClip:
+ case ModifyMarker:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// clearDelete
+//---------------------------------------------------------
+
+void UndoList::clearDelete()
+{
+ if(!empty())
+ {
+ for(iUndo iu = begin(); iu != end(); ++iu)
+ {
+ Undo& u = *iu;
+ for(riUndoOp i = u.rbegin(); i != u.rend(); ++i)
+ {
+ switch(i->type)
+ {
+ case UndoOp::DeleteTrack:
+ if(i->oTrack)
+ {
+ delete i->oTrack;
+ iUndo iu2 = iu;
+ ++iu2;
+ for(; iu2 != end(); ++iu2)
+ {
+ Undo& u2 = *iu2;
+ for(riUndoOp i2 = u2.rbegin(); i2 != u2.rend(); ++i2)
+ {
+ if(i2->type == UndoOp::DeleteTrack)
+ {
+ if(i2->oTrack == i->oTrack)
+ i2->oTrack = 0;
+ }
+ }
+ }
+ }
+ break;
+ case UndoOp::ModifyTrack:
+ if(i->oTrack)
+ {
+ // Prevent delete i->oTrack from crashing.
+ switch(i->oTrack->type())
+ {
+ case Track::AUDIO_OUTPUT:
+ {
+ AudioOutput* ao = (AudioOutput*)i->oTrack;
+ for(int ch = 0; ch < ao->channels(); ++ch)
+ ao->setJackPort(ch, 0);
+ }
+ break;
+ case Track::AUDIO_INPUT:
+ {
+ AudioInput* ai = (AudioInput*)i->oTrack;
+ for(int ch = 0; ch < ai->channels(); ++ch)
+ ai->setJackPort(ch, 0);
+ }
+ break;
+ default:
+ break;
+ }
+ if(!i->oTrack->isMidiTrack())
+ ((AudioTrack*)i->oTrack)->clearEfxList();
+ delete i->oTrack;
+
+ iUndo iu2 = iu;
+ ++iu2;
+ for(; iu2 != end(); ++iu2)
+ {
+ Undo& u2 = *iu2;
+ for(riUndoOp i2 = u2.rbegin(); i2 != u2.rend(); ++i2)
+ {
+ if(i2->type == UndoOp::ModifyTrack)
+ {
+ if(i2->oTrack == i->oTrack)
+ i2->oTrack = 0;
+ }
+ }
+ }
+ }
+ break;
+ //case UndoOp::DeletePart:
+ //delete i->oPart;
+ // break;
+ //case UndoOp::DeleteTempo:
+ // break;
+ //case UndoOp::DeleteSig:
+ // break;
+ case UndoOp::ModifyMarker:
+ if (i->copyMarker)
+ delete i->copyMarker;
+ default:
+ break;
+ }
+ }
+ u.clear();
+ }
+ }
+
+ clear();
+}
+
+//---------------------------------------------------------
+// startUndo
+//---------------------------------------------------------
+
+void Song::startUndo()
+ {
+ undoList->push_back(Undo());
+ updateFlags = 0;
+ undoMode = true;
+ }
+
+//---------------------------------------------------------
+// endUndo
+//---------------------------------------------------------
+
+void Song::endUndo(int flags)
+ {
+ updateFlags |= flags;
+ endMsgCmd();
+ undoMode = false;
+ }
+
+//---------------------------------------------------------
+// doUndo2
+// real time part
+//---------------------------------------------------------
+
+void Song::doUndo2()
+ {
+ Undo& u = undoList->back();
+ for (riUndoOp i = u.rbegin(); i != u.rend(); ++i) {
+ switch(i->type) {
+ case UndoOp::AddTrack:
+ removeTrack2(i->oTrack);
+ updateFlags |= SC_TRACK_REMOVED;
+ break;
+ case UndoOp::DeleteTrack:
+ insertTrack2(i->oTrack, i->trackno);
+ // Added by T356.
+ chainTrackParts(i->oTrack, true);
+
+ updateFlags |= SC_TRACK_INSERTED;
+ break;
+ case UndoOp::ModifyTrack:
+ {
+ // Added by Tim. p3.3.6
+ //printf("Song::doUndo2 ModifyTrack #1 oTrack %p %s nTrack %p %s\n", i->oTrack, i->oTrack->name().latin1(), i->nTrack, i->nTrack->name().latin1());
+
+ // Unchain the track parts, but don't touch the ref counts.
+ unchainTrackParts(i->nTrack, false);
+
+ //Track* track = i->nTrack->clone();
+ Track* track = i->nTrack->clone(false);
+
+ // A Track custom assignment operator was added by Tim.
+ *(i->nTrack) = *(i->oTrack);
+
+ // Added by Tim. p3.3.6
+ //printf("Song::doUndo2 ModifyTrack #2 oTrack %p %s nTrack %p %s\n", i->oTrack, i->oTrack->name().latin1(), i->nTrack, i->nTrack->name().latin1());
+
+ // Prevent delete i->oTrack from crashing.
+ switch(i->oTrack->type())
+ {
+ case Track::AUDIO_OUTPUT:
+ {
+ AudioOutput* ao = (AudioOutput*)i->oTrack;
+ for(int ch = 0; ch < ao->channels(); ++ch)
+ ao->setJackPort(ch, 0);
+ }
+ break;
+ case Track::AUDIO_INPUT:
+ {
+ AudioInput* ai = (AudioInput*)i->oTrack;
+ for(int ch = 0; ch < ai->channels(); ++ch)
+ ai->setJackPort(ch, 0);
+ }
+ break;
+ default:
+ break;
+ }
+ if(!i->oTrack->isMidiTrack())
+ ((AudioTrack*)i->oTrack)->clearEfxList();
+
+ delete i->oTrack;
+ i->oTrack = track;
+
+ // Chain the track parts, but don't touch the ref counts.
+ chainTrackParts(i->nTrack, false);
+
+ // Added by Tim. p3.3.6
+ //printf("Song::doUndo2 ModifyTrack #3 oTrack %p %s nTrack %p %s\n", i->oTrack, i->oTrack->name().latin1(), i->nTrack, i->nTrack->name().latin1());
+
+ // Connect and register ports.
+ switch(i->nTrack->type())
+ {
+ case Track::AUDIO_OUTPUT:
+ {
+ AudioOutput* ao = (AudioOutput*)i->nTrack;
+ ao->setName(ao->name());
+ }
+ break;
+ case Track::AUDIO_INPUT:
+ {
+ AudioInput* ai = (AudioInput*)i->nTrack;
+ ai->setName(ai->name());
+ }
+ break;
+ default:
+ break;
+ }
+
+ // Update solo states, since the user may have changed soloing on other tracks.
+ updateSoloStates();
+
+ updateFlags |= SC_TRACK_MODIFIED;
+ }
+ break;
+
+ /*
+ switch(i->nTrack->type())
+ {
+ case Track::AUDIO_OUTPUT:
+ {
+ AudioOutput* ao = (AudioOutput*)i->nTrack;
+ for(int ch = 0; ch < ao->channels(); ++ch)
+ ao->setJackPort(ch, 0);
+ }
+ break;
+ case Track::AUDIO_INPUT:
+ {
+ AudioInput* ai = (AudioInput*)i->nTrack;
+ for(int ch = 0; ch < ai->channels(); ++ch)
+ ai->setJackPort(ch, 0);
+ }
+ break;
+ default:
+ break;
+ }
+ if(!i->nTrack->isMidiTrack())
+ ((AudioTrack*)i->nTrack)->clearEfxList();
+
+ //delete i->oTrack;
+ //i->oTrack = track;
+
+ // Remove the track. removeTrack2 takes care of unchaining the new track.
+ removeTrack2(i->nTrack);
+
+ // Connect and register ports.
+ switch(i->oTrack->type())
+ {
+ case Track::AUDIO_OUTPUT:
+ {
+ AudioOutput* ao = (AudioOutput*)i->oTrack;
+ ao->setName(ao->name());
+ }
+ break;
+ case Track::AUDIO_INPUT:
+ {
+ AudioInput* ai = (AudioInput*)i->oTrack;
+ ai->setName(ai->name());
+ }
+ break;
+ default:
+ break;
+ }
+
+ // Insert the old track.
+ insertTrack2(i->oTrack, i->trackno);
+ // Chain the old track parts. (removeTrack2, above, takes care of unchaining the new track).
+ chainTrackParts(i->oTrack, true);
+
+ // Update solo states, since the user may have changed soloing on other tracks.
+ updateSoloStates();
+
+ updateFlags |= SC_TRACK_MODIFIED;
+ }
+ break;
+ */
+
+ case UndoOp::SwapTrack:
+ {
+ updateFlags |= SC_TRACK_MODIFIED;
+ Track* track = _tracks[i->a];
+ _tracks[i->a] = _tracks[i->b];
+ _tracks[i->b] = track;
+ updateFlags |= SC_TRACK_MODIFIED;
+ }
+ break;
+ case UndoOp::AddPart:
+ {
+ Part* part = i->oPart;
+ removePart(part);
+ updateFlags |= SC_PART_REMOVED;
+ i->oPart->events()->incARef(-1);
+ //i->oPart->unchainClone();
+ unchainClone(i->oPart);
+ }
+ break;
+ case UndoOp::DeletePart:
+ addPart(i->oPart);
+ updateFlags |= SC_PART_INSERTED;
+ i->oPart->events()->incARef(1);
+ //i->oPart->chainClone();
+ chainClone(i->oPart);
+ break;
+ case UndoOp::ModifyPart:
+ if(i->doCtrls)
+ removePortCtrlEvents(i->oPart, i->doClones);
+ changePart(i->oPart, i->nPart);
+ i->oPart->events()->incARef(-1);
+ i->nPart->events()->incARef(1);
+ //i->oPart->replaceClone(i->nPart);
+ replaceClone(i->oPart, i->nPart);
+ if(i->doCtrls)
+ addPortCtrlEvents(i->nPart, i->doClones);
+ updateFlags |= SC_PART_MODIFIED;
+ break;
+ case UndoOp::AddEvent:
+ if(i->doCtrls)
+ removePortCtrlEvents(i->nEvent, i->part, i->doClones);
+ deleteEvent(i->nEvent, i->part);
+ updateFlags |= SC_EVENT_REMOVED;
+ break;
+ case UndoOp::DeleteEvent:
+ addEvent(i->nEvent, i->part);
+ if(i->doCtrls)
+ addPortCtrlEvents(i->nEvent, i->part, i->doClones);
+ updateFlags |= SC_EVENT_INSERTED;
+ break;
+ case UndoOp::ModifyEvent:
+ if(i->doCtrls)
+ removePortCtrlEvents(i->oEvent, i->part, i->doClones);
+ changeEvent(i->oEvent, i->nEvent, i->part);
+ if(i->doCtrls)
+ addPortCtrlEvents(i->nEvent, i->part, i->doClones);
+ updateFlags |= SC_EVENT_MODIFIED;
+ break;
+ case UndoOp::AddTempo:
+ //printf("doUndo2: UndoOp::AddTempo. deleting tempo at: %d\n", i->a);
+ tempomap.delTempo(i->a);
+ updateFlags |= SC_TEMPO;
+ break;
+ case UndoOp::DeleteTempo:
+ //printf("doUndo2: UndoOp::DeleteTempo. adding tempo at: %d, tempo=%d\n", i->a, i->b);
+ tempomap.addTempo(i->a, i->b);
+ updateFlags |= SC_TEMPO;
+ break;
+ case UndoOp::AddSig:
+ sigmap.del(i->a);
+ updateFlags |= SC_SIG;
+ break;
+ case UndoOp::DeleteSig:
+ sigmap.add(i->a, i->b, i->c);
+ updateFlags |= SC_SIG;
+ break;
+ case UndoOp::ModifyClip:
+ case UndoOp::ModifyMarker:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// Song::doRedo2
+//---------------------------------------------------------
+
+void Song::doRedo2()
+ {
+ Undo& u = redoList->back();
+ for (iUndoOp i = u.begin(); i != u.end(); ++i) {
+ switch(i->type) {
+ case UndoOp::AddTrack:
+ insertTrack2(i->oTrack, i->trackno);
+ // Added by T356.
+ chainTrackParts(i->oTrack, true);
+
+ updateFlags |= SC_TRACK_INSERTED;
+ break;
+ case UndoOp::DeleteTrack:
+ removeTrack2(i->oTrack);
+ updateFlags |= SC_TRACK_REMOVED;
+ break;
+ case UndoOp::ModifyTrack:
+ {
+ // Unchain the track parts, but don't touch the ref counts.
+ unchainTrackParts(i->nTrack, false);
+
+ //Track* track = i->nTrack->clone();
+ Track* track = i->nTrack->clone(false);
+
+ *(i->nTrack) = *(i->oTrack);
+
+ // Prevent delete i->oTrack from crashing.
+ switch(i->oTrack->type())
+ {
+ case Track::AUDIO_OUTPUT:
+ {
+ AudioOutput* ao = (AudioOutput*)i->oTrack;
+ for(int ch = 0; ch < ao->channels(); ++ch)
+ ao->setJackPort(ch, 0);
+ }
+ break;
+ case Track::AUDIO_INPUT:
+ {
+ AudioInput* ai = (AudioInput*)i->oTrack;
+ for(int ch = 0; ch < ai->channels(); ++ch)
+ ai->setJackPort(ch, 0);
+ }
+ break;
+ default:
+ break;
+ }
+ if(!i->oTrack->isMidiTrack())
+ ((AudioTrack*)i->oTrack)->clearEfxList();
+
+ delete i->oTrack;
+ i->oTrack = track;
+
+ // Chain the track parts, but don't touch the ref counts.
+ chainTrackParts(i->nTrack, false);
+
+ // Connect and register ports.
+ switch(i->nTrack->type())
+ {
+ case Track::AUDIO_OUTPUT:
+ {
+ AudioOutput* ao = (AudioOutput*)i->nTrack;
+ ao->setName(ao->name());
+ }
+ break;
+ case Track::AUDIO_INPUT:
+ {
+ AudioInput* ai = (AudioInput*)i->nTrack;
+ ai->setName(ai->name());
+ }
+ break;
+ default:
+ break;
+ }
+
+ // Update solo states, since the user may have changed soloing on other tracks.
+ updateSoloStates();
+
+ updateFlags |= SC_TRACK_MODIFIED;
+ }
+ break;
+
+ /*
+ // Prevent delete i->oTrack from crashing.
+ switch(i->oTrack->type())
+ {
+ case Track::AUDIO_OUTPUT:
+ {
+ AudioOutput* ao = (AudioOutput*)i->oTrack;
+ for(int ch = 0; ch < ao->channels(); ++ch)
+ ao->setJackPort(ch, 0);
+ }
+ break;
+ case Track::AUDIO_INPUT:
+ {
+ AudioInput* ai = (AudioInput*)i->oTrack;
+ for(int ch = 0; ch < ai->channels(); ++ch)
+ ai->setJackPort(ch, 0);
+ }
+ break;
+ default:
+ break;
+ }
+ if(!i->oTrack->isMidiTrack())
+ ((AudioTrack*)i->oTrack)->clearEfxList();
+
+ //delete i->oTrack;
+ //i->oTrack = track;
+
+ // Remove the track. removeTrack2 takes care of unchaining the old track.
+ removeTrack2(i->oTrack);
+
+ // Connect and register ports.
+ switch(i->nTrack->type())
+ {
+ case Track::AUDIO_OUTPUT:
+ {
+ AudioOutput* ao = (AudioOutput*)i->nTrack;
+ ao->setName(ao->name());
+ }
+ break;
+ case Track::AUDIO_INPUT:
+ {
+ AudioInput* ai = (AudioInput*)i->nTrack;
+ ai->setName(ai->name());
+ }
+ break;
+ default:
+ break;
+ }
+
+ // Insert the new track.
+ insertTrack2(i->nTrack, i->trackno);
+ // Chain the new track parts. (removeTrack2, above, takes care of unchaining the old track).
+ chainTrackParts(i->nTrack, true);
+
+ // Update solo states, since the user may have changed soloing on other tracks.
+ updateSoloStates();
+
+ updateFlags |= SC_TRACK_MODIFIED;
+ }
+ break;
+ */
+
+ case UndoOp::SwapTrack:
+ {
+ Track* track = _tracks[i->a];
+ _tracks[i->a] = _tracks[i->b];
+ _tracks[i->b] = track;
+ updateFlags |= SC_TRACK_MODIFIED;
+ }
+ break;
+ case UndoOp::AddPart:
+ addPart(i->oPart);
+ updateFlags |= SC_PART_INSERTED;
+ i->oPart->events()->incARef(1);
+ //i->oPart->chainClone();
+ chainClone(i->oPart);
+ break;
+ case UndoOp::DeletePart:
+ removePart(i->oPart);
+ updateFlags |= SC_PART_REMOVED;
+ i->oPart->events()->incARef(-1);
+ //i->oPart->unchainClone();
+ unchainClone(i->oPart);
+ break;
+ case UndoOp::ModifyPart:
+ if(i->doCtrls)
+ removePortCtrlEvents(i->nPart, i->doClones);
+ changePart(i->nPart, i->oPart);
+ i->oPart->events()->incARef(1);
+ i->nPart->events()->incARef(-1);
+ //i->nPart->replaceClone(i->oPart);
+ replaceClone(i->nPart, i->oPart);
+ if(i->doCtrls)
+ addPortCtrlEvents(i->oPart, i->doClones);
+ updateFlags |= SC_PART_MODIFIED;
+ break;
+ case UndoOp::AddEvent:
+ addEvent(i->nEvent, i->part);
+ if(i->doCtrls)
+ addPortCtrlEvents(i->nEvent, i->part, i->doClones);
+ updateFlags |= SC_EVENT_INSERTED;
+ break;
+ case UndoOp::DeleteEvent:
+ if(i->doCtrls)
+ removePortCtrlEvents(i->nEvent, i->part, i->doClones);
+ deleteEvent(i->nEvent, i->part);
+ updateFlags |= SC_EVENT_REMOVED;
+ break;
+ case UndoOp::ModifyEvent:
+ if(i->doCtrls)
+ removePortCtrlEvents(i->nEvent, i->part, i->doClones);
+ changeEvent(i->nEvent, i->oEvent, i->part);
+ if(i->doCtrls)
+ addPortCtrlEvents(i->oEvent, i->part, i->doClones);
+ updateFlags |= SC_EVENT_MODIFIED;
+ break;
+ case UndoOp::AddTempo:
+ //printf("doRedo2: UndoOp::AddTempo. adding tempo at: %d with tempo=%d\n", i->a, i->b);
+ tempomap.addTempo(i->a, i->b);
+ updateFlags |= SC_TEMPO;
+ break;
+ case UndoOp::DeleteTempo:
+ //printf("doRedo2: UndoOp::DeleteTempo. deleting tempo at: %d with tempo=%d\n", i->a, i->b);
+ tempomap.delTempo(i->a);
+ updateFlags |= SC_TEMPO;
+ break;
+ case UndoOp::AddSig:
+ sigmap.add(i->a, i->b, i->c);
+ updateFlags |= SC_SIG;
+ break;
+ case UndoOp::DeleteSig:
+ sigmap.del(i->a);
+ updateFlags |= SC_SIG;
+ break;
+ case UndoOp::ModifyClip:
+ case UndoOp::ModifyMarker:
+ break;
+ }
+ }
+ }
+
+void Song::undoOp(UndoOp::UndoType type, int a, int b, int c)
+ {
+ UndoOp i;
+ i.type = type;
+ i.a = a;
+ i.b = b;
+ i.c = c;
+ addUndo(i);
+ }
+
+//void Song::undoOp(UndoOp::UndoType type, Track* oldTrack, Track* newTrack)
+void Song::undoOp(UndoOp::UndoType type, int n, Track* oldTrack, Track* newTrack)
+ {
+ UndoOp i;
+ i.type = type;
+ i.trackno = n;
+ i.oTrack = oldTrack;
+ i.nTrack = newTrack;
+ // Added by Tim. p3.3.6
+ //printf("Song::undoOp ModifyTrack oTrack %p %s nTrack %p %s\n", i.oTrack, i.oTrack->name().latin1(), i.nTrack, i.nTrack->name().latin1());
+
+ addUndo(i);
+ }
+
+void Song::undoOp(UndoOp::UndoType type, int n, Track* track)
+ {
+ UndoOp i;
+ i.type = type;
+ i.trackno = n;
+ i.oTrack = track;
+ if (type == UndoOp::AddTrack)
+ updateFlags |= SC_TRACK_INSERTED;
+ addUndo(i);
+ }
+
+void Song::undoOp(UndoOp::UndoType type, Part* part)
+ {
+ UndoOp i;
+ i.type = type;
+ i.oPart = part;
+ addUndo(i);
+ }
+
+//void Song::undoOp(UndoOp::UndoType type, Event& oev, Event& nev, Part* part)
+void Song::undoOp(UndoOp::UndoType type, Event& oev, Event& nev, Part* part, bool doCtrls, bool doClones)
+ {
+ UndoOp i;
+ i.type = type;
+ i.nEvent = nev;
+ i.oEvent = oev;
+ i.part = part;
+ i.doCtrls = doCtrls;
+ i.doClones = doClones;
+ addUndo(i);
+ }
+
+void Song::undoOp(UndoOp::UndoType type, Event& nev, Part* part, bool doCtrls, bool doClones)
+ {
+ UndoOp i;
+ i.type = type;
+ i.nEvent = nev;
+ i.part = part;
+ i.doCtrls = doCtrls;
+ i.doClones = doClones;
+ addUndo(i);
+ }
+
+//void Song::undoOp(UndoOp::UndoType type, Part* oPart, Part* nPart)
+void Song::undoOp(UndoOp::UndoType type, Part* oPart, Part* nPart, bool doCtrls, bool doClones)
+ {
+ UndoOp i;
+ i.type = type;
+ i.oPart = nPart;
+ i.nPart = oPart;
+ i.doCtrls = doCtrls;
+ i.doClones = doClones;
+ addUndo(i);
+ }
+
+void Song::undoOp(UndoOp::UndoType type, int c, int ctrl, int ov, int nv)
+ {
+ UndoOp i;
+ i.type = type;
+ i.channel = c;
+ i.ctrl = ctrl;
+ i.oVal = ov;
+ i.nVal = nv;
+ addUndo(i);
+ }
+
+void Song::undoOp(UndoOp::UndoType type, SigEvent* oevent, SigEvent* nevent)
+ {
+ UndoOp i;
+ i.type = type;
+ i.oSignature = oevent;
+ i.nSignature = nevent;
+ addUndo(i);
+ }
+
+void Song::undoOp(UndoOp::UndoType type, const char* changedFile, const char* changeData, int startframe, int endframe)
+ {
+ UndoOp i;
+ i.type = type;
+ i.filename = changedFile;
+ i.tmpwavfile = changeData;
+ i.startframe = startframe;
+ i.endframe = endframe;
+ addUndo(i);
+ temporaryWavFiles.push_back(QString(changeData));
+
+ //printf("Adding ModifyClip undo-operation: origfile=%s tmpfile=%s sf=%d ef=%d\n", changedFile, changeData, startframe, endframe);
+ }
+
+void Song::undoOp(UndoOp::UndoType type, Marker* copyMarker, Marker* realMarker)
+ {
+ UndoOp i;
+ i.type = type;
+ i.realMarker = realMarker;
+ i.copyMarker = copyMarker;
+
+ addUndo(i);
+ }
+
+//---------------------------------------------------------
+// addUndo
+//---------------------------------------------------------
+
+void Song::addUndo(UndoOp& i)
+ {
+ if (!undoMode) {
+ printf("internal error: undoOp without startUndo()\n");
+ return;
+ }
+ undoList->back().push_back(i);
+ dirty = true;
+ }
+
+//---------------------------------------------------------
+// doUndo1
+// non realtime context
+// return true if nothing to do
+//---------------------------------------------------------
+
+bool Song::doUndo1()
+ {
+ if (undoList->empty())
+ return true;
+ Undo& u = undoList->back();
+ for (riUndoOp i = u.rbegin(); i != u.rend(); ++i) {
+ switch(i->type) {
+ case UndoOp::AddTrack:
+ removeTrack1(i->oTrack);
+ break;
+ case UndoOp::DeleteTrack:
+ insertTrack1(i->oTrack, i->trackno);
+
+ // FIXME: Would like to put this part in Undo2, but indications
+ // elsewhere are that (dis)connecting jack routes must not be
+ // done in the realtime thread. The result is that we get a few
+ // "PANIC Process init: No buffer from audio device" messages
+ // before the routes are (dis)connected. So far seems to do no harm though...
+ switch(i->oTrack->type())
+ {
+ case Track::AUDIO_OUTPUT:
+ case Track::AUDIO_INPUT:
+ connectJackRoutes((AudioTrack*)i->oTrack, false);
+ break;
+ //case Track::AUDIO_SOFTSYNTH:
+ //SynthI* si = (SynthI*)i->oTrack;
+ //si->synth()->init(
+ // break;
+ default:
+ break;
+ }
+
+ break;
+ case UndoOp::ModifyClip:
+ SndFile::applyUndoFile(i->filename, i->tmpwavfile, i->startframe, i->endframe);
+ break;
+
+ default:
+ break;
+ }
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// doUndo3
+// non realtime context
+//---------------------------------------------------------
+
+void Song::doUndo3()
+ {
+ Undo& u = undoList->back();
+ for (riUndoOp i = u.rbegin(); i != u.rend(); ++i) {
+ switch(i->type) {
+ case UndoOp::AddTrack:
+ removeTrack3(i->oTrack);
+ break;
+ case UndoOp::DeleteTrack:
+ insertTrack3(i->oTrack, i->trackno);
+ break;
+ case UndoOp::ModifyTrack:
+ // Not much choice but to do this - Tim.
+ //clearClipboardAndCloneList();
+ break;
+ case UndoOp::ModifyMarker:
+ {
+ //printf("performing undo for one marker at %d\n", i->realMarker->tick());
+ Marker tmpMarker = *i->realMarker;
+ *i->realMarker = *i->copyMarker; // swap them
+ *i->copyMarker = tmpMarker;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ redoList->push_back(u); // put item on redo list
+ undoList->pop_back();
+ dirty = true;
+ }
+
+//---------------------------------------------------------
+// doRedo1
+// non realtime context
+// return true if nothing to do
+//---------------------------------------------------------
+
+bool Song::doRedo1()
+ {
+ if (redoList->empty())
+ return true;
+ Undo& u = redoList->back();
+ for (iUndoOp i = u.begin(); i != u.end(); ++i) {
+ switch(i->type) {
+ case UndoOp::AddTrack:
+ insertTrack1(i->oTrack, i->trackno);
+
+ // FIXME: See comments in Undo1.
+ switch(i->oTrack->type())
+ {
+ case Track::AUDIO_OUTPUT:
+ case Track::AUDIO_INPUT:
+ connectJackRoutes((AudioTrack*)i->oTrack, false);
+ break;
+ //case Track::AUDIO_SOFTSYNTH:
+ //SynthI* si = (SynthI*)i->oTrack;
+ //si->synth()->init(
+ // break;
+ default:
+ break;
+ }
+
+ break;
+ case UndoOp::DeleteTrack:
+ removeTrack1(i->oTrack);
+ break;
+ case UndoOp::ModifyClip:
+ SndFile::applyUndoFile(i->filename, i->tmpwavfile, i->startframe, i->endframe);
+ break;
+ default:
+ break;
+ }
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// doRedo3
+// non realtime context
+//---------------------------------------------------------
+
+void Song::doRedo3()
+ {
+ Undo& u = redoList->back();
+ for (iUndoOp i = u.begin(); i != u.end(); ++i) {
+ switch(i->type) {
+ case UndoOp::AddTrack:
+ insertTrack3(i->oTrack, i->trackno);
+ break;
+ case UndoOp::DeleteTrack:
+ removeTrack3(i->oTrack);
+ break;
+ case UndoOp::ModifyTrack:
+ // Not much choice but to do this - Tim.
+ //clearClipboardAndCloneList();
+ break;
+ case UndoOp::ModifyMarker:
+ {
+ //printf("performing redo for one marker at %d\n", i->realMarker->tick());
+ Marker tmpMarker = *i->realMarker;
+ *i->realMarker = *i->copyMarker; // swap them
+ *i->copyMarker = tmpMarker;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ undoList->push_back(u); // put item on undo list
+ redoList->pop_back();
+ dirty = true;
+ }
+
diff --git a/muse2/muse/undo.h b/muse2/muse/undo.h
new file mode 100644
index 00000000..c20fe3f5
--- /dev/null
+++ b/muse2/muse/undo.h
@@ -0,0 +1,102 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: undo.h,v 1.6.2.5 2009/05/24 21:43:44 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __UNDO_H__
+#define __UNDO_H__
+
+#include <list>
+#include <qstring.h>
+#include "event.h"
+#include "marker/marker.h"
+
+class Track;
+class TEvent;
+class SigEvent;
+class Part;
+
+extern std::list<QString> temporaryWavFiles; //!< Used for storing all tmp-files, for cleanup on shutdown
+//---------------------------------------------------------
+// UndoOp
+//---------------------------------------------------------
+
+struct UndoOp {
+ enum UndoType {
+ AddTrack, DeleteTrack, ModifyTrack,
+ AddPart, DeletePart, ModifyPart,
+ AddEvent, DeleteEvent, ModifyEvent,
+ AddTempo, DeleteTempo,
+ AddSig, DeleteSig,
+ SwapTrack,
+ ModifyClip,
+ ModifyMarker
+ };
+ UndoType type;
+
+ union {
+ struct {
+ int a;
+ int b;
+ int c;
+ };
+ struct {
+ Track* oTrack;
+ Track* nTrack;
+ int trackno;
+ };
+ struct {
+ Part* oPart;
+ Part* nPart;
+ };
+ struct {
+ Part* part;
+ };
+ struct {
+ SigEvent* nSignature;
+ SigEvent* oSignature;
+ };
+ struct {
+ int channel;
+ int ctrl;
+ int oVal;
+ int nVal;
+ };
+ struct {
+ int startframe; //!< Start frame of changed data
+ int endframe; //!< End frame of changed data
+ const char* filename; //!< The file that is changed
+ const char* tmpwavfile; //!< The file with the changed data
+ };
+ struct {
+ Marker* realMarker;
+ Marker* copyMarker;
+ };
+ };
+ Event oEvent;
+ Event nEvent;
+ bool doCtrls;
+ bool doClones;
+ const char* typeName();
+ void dump();
+ };
+
+class Undo : public std::list<UndoOp> {
+ void undoOp(UndoOp::UndoType, int data);
+ };
+
+typedef Undo::iterator iUndoOp;
+typedef Undo::reverse_iterator riUndoOp;
+
+class UndoList : public std::list<Undo> {
+ public:
+ void clearDelete();
+ };
+
+typedef UndoList::iterator iUndo;
+
+
+#endif // __UNDO_H__
diff --git a/muse2/muse/value.cpp b/muse2/muse/value.cpp
new file mode 100644
index 00000000..0acfc6e0
--- /dev/null
+++ b/muse2/muse/value.cpp
@@ -0,0 +1,60 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: value.cpp,v 1.2 2004/02/28 14:58:21 wschweer Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "value.h"
+#include "xml.h"
+
+
+IValue::IValue(QObject* parent, const char* name)
+ : QObject(parent, name)
+ {
+ }
+BValue::BValue(QObject* parent, const char* name)
+ : QObject(parent, name)
+ {
+ }
+
+//---------------------------------------------------------
+// save
+//---------------------------------------------------------
+
+void BValue::save(int level, Xml& xml)
+ {
+ xml.intTag(level, name(), val);
+ }
+
+//---------------------------------------------------------
+// save
+//---------------------------------------------------------
+
+void IValue::save(int level, Xml& xml)
+ {
+ xml.intTag(level, name(), val);
+ }
+
+//---------------------------------------------------------
+// setValue
+//---------------------------------------------------------
+
+void BValue::setValue(bool v)
+ {
+ if (val != v) {
+ val = v;
+ emit valueChanged(val);
+ emit valueChanged(int(val));
+ }
+ }
+
+void IValue::setValue(int v)
+ {
+ if (val != v) {
+ val = v;
+ emit valueChanged(val);
+ }
+ }
+
diff --git a/muse2/muse/value.h b/muse2/muse/value.h
new file mode 100644
index 00000000..fe3817a2
--- /dev/null
+++ b/muse2/muse/value.h
@@ -0,0 +1,61 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: value.h,v 1.1.1.1 2003/10/27 18:51:53 wschweer Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __VALUE_H__
+#define __VALUE_H__
+
+#include <qobject.h>
+
+class Xml;
+
+//---------------------------------------------------------
+// IValue
+//---------------------------------------------------------
+
+class IValue : public QObject {
+ int val;
+
+ Q_OBJECT
+
+ signals:
+ void valueChanged(int);
+
+ public slots:
+ void setValue(int v);
+
+ public:
+ IValue(QObject* parent=0, const char* name=0);
+ int value() const { return val; }
+ void save(int level, Xml& xml);
+ };
+
+//---------------------------------------------------------
+// BValue
+//---------------------------------------------------------
+
+class BValue : public QObject {
+ bool val;
+
+ Q_OBJECT
+
+ signals:
+ void valueChanged(bool);
+ void valueChanged(int);
+
+ public slots:
+ void setValue(bool v);
+ void setValue(int v) { setValue(bool(v)); }
+
+ public:
+ BValue(QObject* parent=0, const char* name=0);
+ bool value() const { return val; }
+ void save(int level, Xml& xml);
+ };
+
+#endif
+
diff --git a/muse2/muse/vst.cpp b/muse2/muse/vst.cpp
new file mode 100644
index 00000000..ddb2e87d
--- /dev/null
+++ b/muse2/muse/vst.cpp
@@ -0,0 +1,630 @@
+//===================================================================
+// MusE
+// Linux Music Editor
+// $Id: vst.cpp,v 1.5.2.6 2009/12/06 10:05:00 terminator356 Exp $
+//
+// This code is based on jack_fst:
+// Copyright (C) 2004 Paul Davis <paul@linuxaudiosystems.com>
+// Torben Hohn <torbenh@informatik.uni-bremen.de>
+//
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//===================================================================
+
+#include "config.h"
+
+#ifdef VST_SUPPORT
+
+#include <qdir.h>
+#include <cmath>
+#include <fst.h>
+#include <vst/aeffectx.h>
+#include <jack/jack.h>
+
+#include "vst.h"
+#include "globals.h"
+#include "synth.h"
+#include "jackaudio.h"
+#include "midi.h"
+#include "xml.h"
+
+extern "C" void fst_error(const char *fmt, ...);
+extern long vstHostCallback (AEffect*, long, long, long, void*, float);
+
+extern JackAudioDevice* jackAudio;
+
+//---------------------------------------------------------
+// vstHostCallback
+//---------------------------------------------------------
+
+long vstHostCallback(AEffect* effect,
+ long opcode, long index, long value, void* ptr, float opt)
+ {
+ static VstTimeInfo _timeInfo;
+
+// JackVST* jackvst = effect ? ((JackVST*) effect->user) : NULL;
+ jack_position_t jack_pos;
+ jack_transport_state_t tstate;
+
+ switch (opcode) {
+ case audioMasterAutomate:
+ // index, value, returns 0
+ effect->setParameter (effect, index, opt);
+ return 0;
+
+ case audioMasterVersion:
+ // vst version, currently 2 (0 for older)
+ return 2;
+
+ case audioMasterCurrentId:
+ // returns the unique id of a plug that's currently
+ // loading
+ return 0;
+
+ case audioMasterIdle:
+ // call application idle routine (this will
+ // call effEditIdle for all open editors too)
+ effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f);
+ return 0;
+
+ case audioMasterPinConnected:
+ // inquire if an input or output is beeing connected;
+ // index enumerates input or output counting from zero:
+ // value is 0 for input and != 0 otherwise. note: the
+ // return value is 0 for <true> such that older versions
+ // will always return true.
+ return 1;
+
+ case audioMasterWantMidi:
+ // <value> is a filter which is currently ignored
+ return 0;
+
+ case audioMasterGetTime:
+ // returns const VstTimeInfo* (or 0 if not supported)
+ // <value> should contain a mask indicating which fields are required
+ // (see valid masks above), as some items may require extensive
+ // conversions
+
+ memset(&_timeInfo, 0, sizeof(_timeInfo));
+
+ if (effect) {
+ tstate = jackAudio->transportQuery(&jack_pos);
+
+ _timeInfo.samplePos = jack_pos.frame;
+ _timeInfo.sampleRate = jack_pos.frame_rate;
+ _timeInfo.flags = 0;
+
+ if ((value & (kVstBarsValid|kVstTempoValid)) && (jack_pos.valid & JackPositionBBT)) {
+ _timeInfo.tempo = jack_pos.beats_per_minute;
+ _timeInfo.timeSigNumerator = (long) floor (jack_pos.beats_per_bar);
+ _timeInfo.timeSigDenominator = (long) floor (jack_pos.beat_type);
+ _timeInfo.flags |= (kVstBarsValid|kVstTempoValid);
+ }
+ if (tstate == JackTransportRolling) {
+ _timeInfo.flags |= kVstTransportPlaying;
+ }
+ }
+ else {
+ _timeInfo.samplePos = 0;
+ _timeInfo.sampleRate = sampleRate;
+ }
+ return (long)&_timeInfo;
+
+ case audioMasterProcessEvents:
+ // VstEvents* in <ptr>
+ return 0;
+
+ case audioMasterSetTime:
+ // VstTimenfo* in <ptr>, filter in <value>, not supported
+
+ case audioMasterTempoAt:
+ // returns tempo (in bpm * 10000) at sample frame location passed in <value>
+ return 0;
+
+ case audioMasterGetNumAutomatableParameters:
+ return 0;
+
+ case audioMasterGetParameterQuantization:
+ // returns the integer value for +1.0 representation,
+ // or 1 if full single float precision is maintained
+ // in automation. parameter index in <value> (-1: all, any)
+ return 0;
+
+ case audioMasterIOChanged:
+ // numInputs and/or numOutputs has changed
+ return 0;
+
+ case audioMasterNeedIdle:
+ // plug needs idle calls (outside its editor window)
+ return 0;
+
+ case audioMasterSizeWindow:
+ // index: width, value: height
+ return 0;
+
+ case audioMasterGetSampleRate:
+ return 0;
+
+ case audioMasterGetBlockSize:
+ return 0;
+
+ case audioMasterGetInputLatency:
+ return 0;
+
+ case audioMasterGetOutputLatency:
+ return 0;
+
+ case audioMasterGetPreviousPlug:
+ // input pin in <value> (-1: first to come), returns cEffect*
+ return 0;
+
+ case audioMasterGetNextPlug:
+ // output pin in <value> (-1: first to come), returns cEffect*
+
+ case audioMasterWillReplaceOrAccumulate:
+ // returns: 0: not supported, 1: replace, 2: accumulate
+ return 0;
+
+ case audioMasterGetCurrentProcessLevel:
+ // returns: 0: not supported,
+ // 1: currently in user thread (gui)
+ // 2: currently in audio thread (where process is called)
+ // 3: currently in 'sequencer' thread (midi, timer etc)
+ // 4: currently offline processing and thus in user thread
+ // other: not defined, but probably pre-empting user thread.
+ return 0;
+
+ case audioMasterGetAutomationState:
+ // returns 0: not supported, 1: off, 2:read, 3:write, 4:read/write
+ // offline
+ return 0;
+
+ case audioMasterOfflineStart:
+ case audioMasterOfflineRead:
+ // ptr points to offline structure, see below. return 0: error, 1 ok
+ return 0;
+
+ case audioMasterOfflineWrite:
+ // same as read
+ return 0;
+
+ case audioMasterOfflineGetCurrentPass:
+ case audioMasterOfflineGetCurrentMetaPass:
+ return 0;
+
+ case audioMasterSetOutputSampleRate:
+ // for variable i/o, sample rate in <opt>
+ return 0;
+
+ case audioMasterGetSpeakerArrangement:
+ // (long)input in <value>, output in <ptr>
+ return 0;
+
+ case audioMasterGetVendorString:
+ // fills <ptr> with a string identifying the vendor (max 64 char)
+ strcpy ((char*) ptr, "LAD");
+ return 0;
+
+ case audioMasterGetProductString:
+ // fills <ptr> with a string with product name (max 64 char)
+ strcpy ((char*) ptr, "FreeST");
+
+ case audioMasterGetVendorVersion:
+ // returns vendor-specific version
+ return 1000;
+
+ case audioMasterVendorSpecific:
+ // no definition, vendor specific handling
+ return 0;
+
+ case audioMasterSetIcon:
+ // void* in <ptr>, format not defined yet
+ return 0;
+
+ case audioMasterCanDo:
+ // string in ptr, see below
+ return 0;
+
+ case audioMasterGetLanguage:
+ // see enum
+ return 0;
+
+ case audioMasterOpenWindow:
+ // returns platform specific ptr
+ return 0;
+
+ case audioMasterCloseWindow:
+ // close window, platform specific handle in <ptr>
+ return 0;
+
+ case audioMasterGetDirectory:
+ // get plug directory, FSSpec on MAC, else char*
+ return 0;
+
+ case audioMasterUpdateDisplay:
+ // something has changed, update 'multi-fx' display
+ effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f);
+ return 0;
+
+ case audioMasterBeginEdit:
+ // begin of automation session (when mouse down), parameter index in <index>
+ return 0;
+
+ case audioMasterEndEdit:
+ // end of automation session (when mouse up), parameter index in <index>
+ return 0;
+
+ case audioMasterOpenFileSelector:
+ // open a fileselector window with VstFileSelect* in <ptr>
+ return 0;
+
+ default:
+ break;
+ }
+ return 0;
+ }
+
+//---------------------------------------------------------
+// scanVstDir
+//---------------------------------------------------------
+
+static void scanVstDir(const QString& s)
+ {
+ if (debugMsg)
+ printf("scan vst plugin dir <%s>\n", s.latin1());
+ QDir pluginDir(s, QString("*.dll"), QDir::Files);
+ if (pluginDir.exists()) {
+ const QFileInfoList* list = pluginDir.entryInfoList();
+ QFileInfoListIterator it(*list);
+ QFileInfo* fi;
+ while((fi = it.current())) {
+ char* path = strdup(fi->filePath().latin1());
+ FSTInfo* info = fst_get_info(path);
+ if (info) {
+ if (info->numInputs == 0 && info->numOutputs)
+ //synthis.push_back(new VstSynth(*fi));
+ synthis.push_back(new VstSynth(*fi, fi->baseName(), QString(), QString(), QString()));
+ fst_free_info(info);
+ }
+ free(path);
+ ++it;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// fstSignalHandler
+//---------------------------------------------------------
+
+static void fstSignalHandler(int sig, siginfo_t* /*info*/, void* /*context*/)
+ {
+ fst_error("fst signal handler %d, thread = 0x%x", sig, pthread_self ());
+ if (sig == SIGSEGV || sig == SIGABRT) {
+ char*p = 0;
+ *p = 0;
+ }
+ exit(-1);
+ }
+
+void jfst_reserve_mem (int bufsize)
+{
+ char buf [bufsize];
+ int i;
+
+ fprintf (stderr, "Reserving memory: base=%p, size=%d, end=%p\n",
+ buf, sizeof(buf), buf+sizeof(buf));
+ for (i=0; i<bufsize; i++)
+ {
+ buf[i] = (char) (i % 256);
+ }
+}
+
+//---------------------------------------------------------
+// initVST
+//---------------------------------------------------------
+
+void initVST()
+ {
+ jfst_reserve_mem(1000000);
+
+ if (fst_init(fstSignalHandler)) {
+ printf("initVST failed\n");
+ return;
+ }
+
+ char* vstPath = getenv("VST_PATH");
+ if (vstPath == 0)
+ vstPath = "/usr/lib/vst:/usr/local/lib/vst";
+
+ char* p = vstPath;
+ while (*p != '\0') {
+ char* pe = p;
+ while (*pe != ':' && *pe != '\0')
+ pe++;
+
+ int n = pe - p;
+ if (n) {
+ char* buffer = new char[n + 1];
+ strncpy(buffer, p, n);
+ buffer[n] = '\0';
+ scanVstDir(QString(buffer));
+ delete[] buffer;
+ }
+ p = pe;
+ if (*p == ':')
+ p++;
+ }
+ }
+
+//---------------------------------------------------------
+// guiVisible
+//---------------------------------------------------------
+
+bool VstSynthIF::guiVisible() const
+ {
+ return _guiVisible;
+ }
+
+
+//---------------------------------------------------------
+// showGui
+//---------------------------------------------------------
+
+void VstSynthIF::showGui(bool v)
+ {
+ if (v == guiVisible())
+ return;
+ if (v)
+ fst_run_editor(_fst);
+ else
+ fst_destroy_editor(_fst);
+ _guiVisible = v;
+ }
+
+//---------------------------------------------------------
+// receiveEvent
+//---------------------------------------------------------
+
+MidiPlayEvent VstSynthIF::receiveEvent()
+ {
+ return MidiPlayEvent();
+ }
+
+//---------------------------------------------------------
+// hasGui
+//---------------------------------------------------------
+
+bool VstSynthIF::hasGui() const
+ {
+ return _fst->plugin->flags & effFlagsHasEditor;
+ }
+
+//---------------------------------------------------------
+// incInstances
+//---------------------------------------------------------
+
+void VstSynth::incInstances(int val)
+ {
+ _instances += val;
+ if (_instances == 0 && fstHandle) {
+ fst_unload(fstHandle);
+ fstHandle = 0;
+ }
+ }
+
+//---------------------------------------------------------
+// instantiate
+//---------------------------------------------------------
+
+void* VstSynth::instantiate()
+ {
+ ++_instances;
+ QString n;
+ n.setNum(_instances);
+ QString instanceName = baseName() + "-" + n;
+ doSetuid();
+ const char* path = info.filePath().latin1();
+
+ fstHandle = fst_load(path);
+ if (fstHandle == 0) {
+ printf("Synth::instantiate: cannot load vst plugin %s\n", path);
+ undoSetuid();
+ return 0;
+ }
+ FST* fst = fst_instantiate(fstHandle, vstHostCallback, 0);
+ if (fst == 0) {
+ printf("Synth::instantiate:: cannot instantiate plugin %s\n", path);
+ undoSetuid();
+ return 0;
+ }
+ AEffect* plugin = fst->plugin;
+ plugin->dispatcher (plugin, effMainsChanged, 0, 1, 0, 0.0f);
+
+ /* set program to zero */
+
+ plugin->dispatcher (plugin, effSetProgram, 0, 0, NULL, 0.0f);
+
+ if (fst_run_editor(fst)) {
+ printf("Synth::instantiate: cannot create gui");
+ undoSetuid();
+ return 0;
+ }
+// int vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, NULL, 0.0f);
+ undoSetuid();
+ return fst;
+ }
+
+//---------------------------------------------------------
+// init
+//---------------------------------------------------------
+
+bool VstSynthIF::init(Synth* s)
+ {
+ _fst = (FST*)((VstSynth*)s)->instantiate();
+ return (_fst == 0);
+ }
+
+//---------------------------------------------------------
+// channels
+//---------------------------------------------------------
+
+int VstSynthIF::channels() const
+ {
+ AEffect* plugin = _fst->plugin;
+ return plugin->numOutputs;
+ }
+
+int VstSynthIF::totalOutChannels() const
+ {
+ AEffect* plugin = _fst->plugin;
+ return plugin->numOutputs;
+ }
+
+int VstSynthIF::totalInChannels() const
+ {
+ AEffect* plugin = _fst->plugin;
+ return plugin->numInputs;
+ }
+
+//---------------------------------------------------------
+// createSIF
+//---------------------------------------------------------
+
+//SynthIF* VstSynth::createSIF() const
+SynthIF* VstSynth::createSIF(SynthI* s)
+ {
+ //return new VstSynthIF();
+
+ VstSynthIF* sif = new VstSynthIF(s);
+ sif->init(this, s);
+ return sif;
+ }
+
+//---------------------------------------------------------
+// deactivate3
+//---------------------------------------------------------
+
+void VstSynthIF::deactivate3()
+ {
+ if (_fst) {
+ if (_guiVisible)
+ fst_destroy_editor(_fst);
+ fst_close(_fst);
+ _fst = 0;
+ }
+ }
+
+//---------------------------------------------------------
+// getParameter
+//---------------------------------------------------------
+
+float VstSynthIF::getParameter(unsigned long idx) const
+ {
+ return _fst->plugin->getParameter(_fst->plugin, idx);
+ }
+
+//---------------------------------------------------------
+// setParameter
+//---------------------------------------------------------
+
+void VstSynthIF::setParameter(unsigned long idx, float value)
+ {
+ _fst->plugin->setParameter(_fst->plugin, idx, value);
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void VstSynthIF::write(int level, Xml& xml) const
+ {
+ //---------------------------------------------
+ // dump current state of synth
+ //---------------------------------------------
+
+ int len = 0;
+ const unsigned char* p;
+ AEffect* plugin = _fst->plugin;
+ int params = plugin->numParams;
+ for (int i = 0; i < params; ++i) {
+ float f = plugin->getParameter(plugin, i);
+ xml.floatTag(level, "param", f);
+ }
+ }
+
+//---------------------------------------------------------
+// getData
+//---------------------------------------------------------
+
+iMPEvent VstSynthIF::getData(MidiPort* mp, MPEventList* el, iMPEvent i, unsigned pos, int ports, unsigned n, float** buffer)
+ {
+ AEffect* plugin = _fst->plugin;
+ for (; i != el->end(); ++i) {
+ if (mp)
+ mp->sendEvent(*i);
+ else {
+ if (putEvent(*i))
+ break;
+ }
+ }
+ if (plugin->flags & effFlagsCanReplacing) {
+ plugin->processReplacing(plugin, 0, buffer, n);
+ }
+ else {
+ plugin->process(plugin, 0, buffer, n);
+ }
+ return el->end();
+ }
+
+//---------------------------------------------------------
+// putEvent
+//---------------------------------------------------------
+
+bool VstSynthIF::putEvent(const MidiPlayEvent& ev)
+ {
+ if (midiOutputTrace)
+ ev.dump();
+ AEffect* plugin = _fst->plugin;
+ static struct VstEvents events;
+ static struct VstMidiEvent event;
+ events.numEvents = 1;
+ events.reserved = 0;
+ events.events[0] = (VstEvent*)(&event);
+
+ event.type = kVstMidiType;
+ event.byteSize = 24;
+ event.deltaFrames = 0;
+ event.flags = 0;
+ event.detune = 0;
+ event.noteLength = 0;
+ event.noteOffset = 0;
+ event.reserved1 = 0;
+ event.reserved2 = 0;
+ event.noteOffVelocity = 0;
+ switch (ev.type()) {
+ case ME_PITCHBEND:
+ {
+ int a = ev.dataA() + 8192;
+ int b = a >> 7;
+ event.midiData[0] = (ev.type() | ev.channel()) & 0xff;
+ event.midiData[1] = a & 0x7f;
+ event.midiData[2] = b & 0x7f;
+ event.midiData[3] = 0;
+ }
+ break;
+
+ case ME_CONTROLLER:
+ case ME_NOTEON:
+ default:
+ event.midiData[0] = (ev.type() | ev.channel()) & 0xff;
+ event.midiData[1] = ev.dataA() & 0xff;
+ event.midiData[2] = ev.dataB() & 0xff;
+ event.midiData[3] = 0;
+ break;
+ }
+ int rv = plugin->dispatcher(plugin, effProcessEvents, 0, 0, &events, 0.0f);
+ return false;
+ }
+#else
+void initVST() {}
+#endif
+
diff --git a/muse2/muse/vst.h b/muse2/muse/vst.h
new file mode 100644
index 00000000..38585e8e
--- /dev/null
+++ b/muse2/muse/vst.h
@@ -0,0 +1,83 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: vst.h,v 1.11.2.3 2009/11/25 09:09:44 terminator356 Exp $
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __VST_H__
+#define __VST_H__
+
+#include "synth.h"
+//Added by qt3to4:
+#include <Q3PopupMenu>
+
+struct _FSTHandle;
+struct _FST;
+
+//---------------------------------------------------------
+// VstSynth
+//---------------------------------------------------------
+
+class VstSynth : public Synth {
+ _FSTHandle* fstHandle;
+
+ public:
+ //VstSynth(const QFileInfo& fi) : Synth(fi) { fstHandle = 0; }
+ VstSynth(const QFileInfo& fi) : Synth(fi, fi->baseName()) {
+ fstHandle = 0;
+ }
+
+ virtual ~VstSynth() {}
+ virtual void incInstances(int val);
+ virtual void* instantiate();
+ //virtual SynthIF* createSIF() const;
+ virtual SynthIF* createSIF(SynthI*) const;
+ };
+
+//---------------------------------------------------------
+// VstSynthIF
+// VSTi synthesizer instance
+//---------------------------------------------------------
+
+class VstSynthIF : public SynthIF
+ {
+ _FST* _fst;
+ bool _guiVisible;
+
+ public:
+ //VstSynthIF() { _fst = 0; _guiVisible = false; }
+ VstSynthIF(SynthI* s) : SynthIF(s) {
+ _fst = 0;
+ _guiVisible = false;
+ }
+
+ virtual bool initGui() { return true; };
+ virtual void guiHeartBeat() { }
+ virtual bool guiVisible() const;
+ virtual void showGui(bool v);
+ virtual bool hasGui() const;
+ virtual void getGeometry(int*, int*, int*, int*) const {}
+ virtual void setGeometry(int, int, int, int) {}
+ virtual void preProcessAlways() { };
+ virtual iMPEvent getData(MidiPort*, MPEventList*, iMPEvent, unsigned pos, int ports, unsigned n, float** buffer) ;
+ virtual bool putEvent(const MidiPlayEvent& ev);
+ virtual MidiPlayEvent receiveEvent();
+ virtual int eventsPending() const { return 0; }
+ virtual bool init(Synth*);
+ virtual int channels() const;
+ virtual int totalOutChannels() const;
+ virtual int totalInChannels() const;
+ virtual void deactivate3();
+ virtual const char* getPatchName(int, int, int, bool) const { return ""; }
+ virtual const char* getPatchName(int, int, MType, bool) { return ""; }
+ virtual void populatePatchPopup(Q3PopupMenu*, int, MType, bool) {};
+ virtual void write(int level, Xml& xml) const;
+ virtual float getParameter(unsigned long idx) const;
+ virtual void setParameter(unsigned long idx, float value);
+ virtual int getControllerInfo(int, const char**, int*, int*, int*, int*) { return 0; }
+ };
+
+
+#endif
+
diff --git a/muse2/muse/wave.cpp b/muse2/muse/wave.cpp
new file mode 100644
index 00000000..761df539
--- /dev/null
+++ b/muse2/muse/wave.cpp
@@ -0,0 +1,1175 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: wave.cpp,v 1.19.2.20 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <qfileinfo.h>
+#include <cmath>
+#include <qdatetime.h>
+#include <qmessagebox.h>
+#include <q3progressdialog.h>
+
+#include "xml.h"
+#include "song.h"
+#include "wave.h"
+#include "app.h"
+#include "filedialog.h"
+#include "arranger/arranger.h"
+#include "globals.h"
+#include "event.h"
+#include "audio.h"
+#include "sig.h"
+
+//#define WAVE_DEBUG
+//#define WAVE_DEBUG_PRC
+
+/*
+const char* audioFilePattern[] = {
+ "Wave/Binary (*.wav *.ogg *.bin)",
+ "Wave (*.wav *.ogg)",
+ "Binary (*.bin)",
+ "All Files (*)",
+ 0
+ };
+*/
+const int cacheMag = 128;
+
+// ClipList* waveClips;
+
+SndFileList SndFile::sndFiles;
+
+//---------------------------------------------------------
+// SndFile
+//---------------------------------------------------------
+
+SndFile::SndFile(const QString& name)
+ {
+ finfo = new QFileInfo(name);
+ sf = 0;
+ sfUI = 0;
+ csize = 0;
+ cache = 0;
+ openFlag = false;
+ sndFiles.push_back(this);
+ refCount=0;
+ }
+
+SndFile::~SndFile()
+ {
+ if (openFlag)
+ close();
+ for (iSndFile i = sndFiles.begin(); i != sndFiles.end(); ++i) {
+ if (*i == this) {
+ sndFiles.erase(i);
+ break;
+ }
+ }
+ delete finfo;
+ if (cache) {
+ for (unsigned i = 0; i < channels(); ++i)
+ delete cache[i];
+ delete[] cache;
+ cache = 0;
+ }
+ }
+
+//---------------------------------------------------------
+// openRead
+//---------------------------------------------------------
+
+bool SndFile::openRead()
+ {
+ if (openFlag) {
+ printf("SndFile:: alread open\n");
+ return false;
+ }
+ QString p = path();
+ sfinfo.format = 0;
+ sf = sf_open(p.latin1(), SFM_READ, &sfinfo);
+ sfinfo.format = 0;
+ sfUI = sf_open(p.latin1(), SFM_READ, &sfinfo);
+ if (sf == 0 || sfUI == 0)
+ return true;
+
+ writeFlag = false;
+ openFlag = true;
+ QString cacheName = finfo->dirPath(true) + QString("/") + finfo->baseName(true) + QString(".wca");
+ readCache(cacheName, true);
+ return false;
+ }
+
+//---------------------------------------------------------
+// update
+// called after recording to file
+//---------------------------------------------------------
+
+void SndFile::update()
+ {
+ close();
+
+ // force recreation of wca data
+ QString cacheName = finfo->dirPath(true) +
+ QString("/") + finfo->baseName(true) + QString(".wca");
+ ::remove(cacheName.latin1());
+ if (openRead()) {
+ printf("SndFile::update openRead(%s) failed: %s\n", path().latin1(), strerror().latin1());
+ }
+ }
+
+//---------------------------------------------------------
+// readCache
+//---------------------------------------------------------
+
+void SndFile::readCache(const QString& path, bool showProgress)
+ {
+// printf("readCache %s for %d samples channel %d\n",
+// path.latin1(), samples(), channels());
+
+ if (cache) {
+ for (unsigned i = 0; i < channels(); ++i)
+ delete cache[i];
+ delete[] cache;
+ }
+ if (samples() == 0) {
+// printf("SndFile::readCache: file empty\n");
+ return;
+ }
+ csize = (samples() + cacheMag - 1)/cacheMag;
+ cache = new SampleV*[channels()];
+ for (unsigned ch = 0; ch < channels(); ++ch)
+ cache[ch] = new SampleV[csize];
+
+ FILE* cfile = fopen(path.latin1(), "r");
+ if (cfile) {
+ for (unsigned ch = 0; ch < channels(); ++ch)
+ fread(cache[ch], csize * sizeof(SampleV), 1, cfile);
+ fclose(cfile);
+ return;
+ }
+
+ //---------------------------------------------------
+ // create cache
+ //---------------------------------------------------
+
+ Q3ProgressDialog* progress = 0;
+ if (showProgress) {
+ QString label(QWidget::tr("create peakfile for "));
+ label += basename();
+ progress = new Q3ProgressDialog(label,
+ QString::null, csize, 0, 0, true);
+ progress->setMinimumDuration(0);
+ progress->show();
+ }
+ float data[channels()][cacheMag];
+ float* fp[channels()];
+ for (unsigned k = 0; k < channels(); ++k)
+ fp[k] = &data[k][0];
+ int interval = csize / 10;
+
+ if(!interval)
+ interval = 1;
+ for (int i = 0; i < csize; i++) {
+ if (showProgress && ((i % interval) == 0))
+ progress->setProgress(i);
+ seek(i * cacheMag, 0);
+ read(channels(), fp, cacheMag);
+ for (unsigned ch = 0; ch < channels(); ++ch) {
+ float rms = 0.0;
+ cache[ch][i].peak = 0;
+ for (int n = 0; n < cacheMag; n++) {
+ float fd = data[ch][n];
+ rms += fd * fd;
+ int idata = int(fd * 255.0);
+ if (idata < 0)
+ idata = -idata;
+ if (cache[ch][i].peak < idata)
+ cache[ch][i].peak = idata;
+ }
+ // amplify rms value +12dB
+ int rmsValue = int((sqrt(rms/cacheMag) * 255.0));
+ if (rmsValue > 255)
+ rmsValue = 255;
+ cache[ch][i].rms = rmsValue;
+ }
+ }
+ if (showProgress)
+ progress->setProgress(csize);
+ writeCache(path);
+ if (showProgress)
+ delete progress;
+ }
+
+//---------------------------------------------------------
+// writeCache
+//---------------------------------------------------------
+
+void SndFile::writeCache(const QString& path)
+ {
+ FILE* cfile = fopen(path.latin1(), "w");
+ if (cfile == 0)
+ return;
+ for (unsigned ch = 0; ch < channels(); ++ch)
+ fwrite(cache[ch], csize * sizeof(SampleV), 1, cfile);
+ fclose(cfile);
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void SndFile::read(SampleV* s, int mag, unsigned pos, bool overwrite)
+ {
+ if(overwrite)
+ for (unsigned ch = 0; ch < channels(); ++ch) {
+ s[ch].peak = 0;
+ s[ch].rms = 0;
+ }
+
+ if (pos > samples()) {
+// printf("%p pos %d > samples %d\n", this, pos, samples());
+ return;
+ }
+
+ if (mag < cacheMag) {
+ float data[channels()][mag];
+ float* fp[channels()];
+ for (unsigned i = 0; i < channels(); ++i)
+ fp[i] = &data[i][0];
+
+ sf_count_t ret = 0;
+ if(sfUI)
+ ret = sf_seek(sfUI, pos, SEEK_SET);
+ else
+ ret = sf_seek(sf, pos, SEEK_SET);
+ if(ret == -1)
+ return;
+ {
+ int srcChannels = channels();
+ int dstChannels = sfinfo.channels;
+ size_t n = mag;
+ float** dst = fp;
+ float buffer[n * dstChannels];
+
+ size_t rn = 0;
+ if(sfUI)
+ rn = sf_readf_float(sfUI, buffer, n);
+ else
+ rn = sf_readf_float(sf, buffer, n);
+ if(rn != n)
+ return;
+ float* src = buffer;
+
+ if (srcChannels == dstChannels) {
+ for (size_t i = 0; i < rn; ++i) {
+ for (int ch = 0; ch < srcChannels; ++ch)
+ *(dst[ch]+i) = *src++;
+ }
+ }
+ else if ((srcChannels == 1) && (dstChannels == 2)) {
+ // stereo to mono
+ for (size_t i = 0; i < rn; ++i)
+ *(dst[0] + i) = src[i + i] + src[i + i + 1];
+ }
+ else if ((srcChannels == 2) && (dstChannels == 1)) {
+ // mono to stereo
+ for (size_t i = 0; i < rn; ++i) {
+ float data = *src++;
+ *(dst[0]+i) = data;
+ *(dst[1]+i) = data;
+ }
+ }
+ }
+
+ for (unsigned ch = 0; ch < channels(); ++ch) {
+
+ if(overwrite)
+ s[ch].peak = 0;
+
+ float rms = 0.0;
+ for (int i = 0; i < mag; i++) {
+ float fd = data[ch][i];
+ rms += fd;
+ int idata = int(fd * 255.0);
+ if (idata < 0)
+ idata = -idata;
+ if (s[ch].peak < idata)
+ s[ch].peak = idata;
+ }
+
+ s[ch].rms = 0; // TODO rms / mag;
+ }
+ }
+ else {
+ mag /= cacheMag;
+ int rest = csize - (pos/cacheMag);
+ int end = mag;
+ if (rest < mag)
+ end = rest;
+
+ for (unsigned ch = 0; ch < channels(); ++ch) {
+ int rms = 0;
+ int off = pos/cacheMag;
+ for (int offset = off; offset < off+end; offset++) {
+ rms += cache[ch][offset].rms;
+ if (s[ch].peak < cache[ch][offset].peak)
+ s[ch].peak = cache[ch][offset].peak;
+ }
+
+ if(overwrite)
+ s[ch].rms = rms / mag;
+
+ else
+ s[ch].rms += rms / mag;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// openWrite
+//---------------------------------------------------------
+
+bool SndFile::openWrite()
+ {
+ if (openFlag) {
+ printf("SndFile:: alread open\n");
+ return false;
+ }
+ QString p = path();
+ sf = sf_open(p.latin1(), SFM_RDWR, &sfinfo);
+ sfUI = 0;
+ if (sf) {
+ openFlag = true;
+ writeFlag = true;
+ QString cacheName = finfo->dirPath(true) +
+ QString("/") + finfo->baseName(true) + QString(".wca");
+ readCache(cacheName, true);
+ }
+ return sf == 0;
+ }
+
+//---------------------------------------------------------
+// close
+//---------------------------------------------------------
+
+void SndFile::close()
+ {
+ if (!openFlag) {
+ printf("SndFile:: alread closed\n");
+ return;
+ }
+ sf_close(sf);
+ if (sfUI)
+ sf_close(sfUI);
+ openFlag = false;
+ }
+
+//---------------------------------------------------------
+// remove
+//---------------------------------------------------------
+
+void SndFile::remove()
+ {
+ if (openFlag)
+ close();
+ QFile::remove(finfo->filePath());
+ }
+
+QString SndFile::basename() const
+ {
+ return finfo->baseName(true);
+ }
+
+QString SndFile::path() const
+ {
+ return finfo->filePath();
+ }
+
+QString SndFile::dirPath() const
+ {
+ return finfo->dirPath(true);
+ }
+
+QString SndFile::name() const
+ {
+ return finfo->fileName();
+ }
+
+//---------------------------------------------------------
+// samples
+//---------------------------------------------------------
+
+unsigned SndFile::samples() const
+ {
+ if (!writeFlag) // if file is read only sfinfo is reliable
+ return sfinfo.frames;
+ sf_count_t curPos = sf_seek(sf, 0, SEEK_CUR);
+ int frames = sf_seek(sf, 0, SEEK_END);
+ sf_seek(sf, curPos, SEEK_SET);
+ return frames;
+ }
+
+//---------------------------------------------------------
+// channels
+//---------------------------------------------------------
+
+unsigned SndFile::channels() const
+ {
+ return sfinfo.channels;
+ }
+
+unsigned SndFile::samplerate() const
+ {
+ return sfinfo.samplerate;
+ }
+
+unsigned SndFile::format() const
+ {
+ return sfinfo.format;
+ }
+
+void SndFile::setFormat(int fmt, int ch, int rate)
+ {
+ sfinfo.samplerate = rate;
+ sfinfo.channels = ch;
+ sfinfo.format = fmt;
+ sfinfo.seekable = true;
+ sfinfo.frames = 0;
+ }
+
+//---------------------------------------------------------
+// readWithHeap
+// not as realtime friendly but can retrieve bigger data
+//---------------------------------------------------------
+size_t SndFile::readWithHeap(int srcChannels, float** dst, size_t n, bool overwrite)
+ {
+ float *buffer = new float[n * sfinfo.channels];
+ int rn = readInternal(srcChannels,dst,n,overwrite, buffer);
+ delete buffer;
+ return rn;
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+size_t SndFile::read(int srcChannels, float** dst, size_t n, bool overwrite)
+ {
+ float buffer[n * sfinfo.channels];
+ int rn = readInternal(srcChannels,dst,n,overwrite, buffer);
+ return rn;
+ }
+
+size_t SndFile::readInternal(int srcChannels, float** dst, size_t n, bool overwrite, float *buffer)
+{
+ size_t rn = sf_readf_float(sf, buffer, n);
+
+ float* src = buffer;
+ int dstChannels = sfinfo.channels;
+ if (srcChannels == dstChannels) {
+ if(overwrite)
+ for (size_t i = 0; i < rn; ++i) {
+ for (int ch = 0; ch < srcChannels; ++ch)
+ *(dst[ch]+i) = *src++;
+ }
+ else
+ for (size_t i = 0; i < rn; ++i) {
+ for (int ch = 0; ch < srcChannels; ++ch)
+ *(dst[ch]+i) += *src++;
+ }
+ }
+ else if ((srcChannels == 1) && (dstChannels == 2)) {
+ // stereo to mono
+ if(overwrite)
+ for (size_t i = 0; i < rn; ++i)
+ *(dst[0] + i) = src[i + i] + src[i + i + 1];
+ else
+ for (size_t i = 0; i < rn; ++i)
+ *(dst[0] + i) += src[i + i] + src[i + i + 1];
+ }
+ else if ((srcChannels == 2) && (dstChannels == 1)) {
+ // mono to stereo
+ if(overwrite)
+ for (size_t i = 0; i < rn; ++i) {
+ float data = *src++;
+ *(dst[0]+i) = data;
+ *(dst[1]+i) = data;
+ }
+ else
+ for (size_t i = 0; i < rn; ++i) {
+ float data = *src++;
+ *(dst[0]+i) += data;
+ *(dst[1]+i) += data;
+ }
+ }
+ else {
+ printf("SndFile:read channel mismatch %d -> %d\n",
+ srcChannels, dstChannels);
+ }
+
+ return rn;
+
+}
+
+
+//---------------------------------------------------------
+// write
+//
+// A hardcoded limiter was added that limits the output at 0.99/-0.99
+// libsndfile handles signal betwee -1.0/1.0 with current setting
+// outside these values there will be heavy distortion
+//
+//---------------------------------------------------------
+
+size_t SndFile::write(int srcChannels, float** src, size_t n)
+ {
+ int dstChannels = sfinfo.channels;
+ //float buffer[n * dstChannels];
+ float *buffer = new float[n * dstChannels];
+ float *dst = buffer;
+
+ const float limitValue=0.9999;
+
+
+ if (srcChannels == dstChannels) {
+ for (size_t i = 0; i < n; ++i) {
+ for (int ch = 0; ch < dstChannels; ++ch)
+ //*dst++ = *(src[ch]+i); // < limitValue ? *(src[ch]+i) : limitValue;
+ if (*(src[ch]+i) > 0)
+ *dst++ = *(src[ch]+i) < limitValue ? *(src[ch]+i) : limitValue;
+ else
+ *dst++ = *(src[ch]+i) > -limitValue ? *(src[ch]+i) : -limitValue;
+ }
+ }
+ else if ((srcChannels == 1) && (dstChannels == 2)) {
+ // mono to stereo
+ for (size_t i = 0; i < n; ++i) {
+ float data = *(src[0]+i);
+ if (data > 0) {
+ *dst++ = data < limitValue ? data : limitValue;
+ *dst++ = data < limitValue ? data : limitValue;
+ }
+ else {
+ *dst++ = data > -limitValue ? data : -limitValue;
+ *dst++ = data > -limitValue ? data : -limitValue;
+ }
+ }
+ }
+ else if ((srcChannels == 2) && (dstChannels == 1)) {
+ // stereo to mono
+ for (size_t i = 0; i < n; ++i)
+ if (*(src[0]+i) + *(src[1]+i) > 0)
+ *dst++ = (*(src[0]+i) + *(src[1]+i)) < limitValue ? (*(src[0]+i) + *(src[1]+i)) : limitValue;
+ else
+ *dst++ = (*(src[0]+i) + *(src[1]+i)) > -limitValue ? (*(src[0]+i) + *(src[1]+i)) : -limitValue;
+ }
+ else {
+ printf("SndFile:write channel mismatch %d -> %d\n",
+ srcChannels, dstChannels);
+ delete buffer;
+ return 0;
+ }
+ int nbr = sf_writef_float(sf, buffer, n) ;
+ delete buffer;
+ return nbr;
+ }
+
+//---------------------------------------------------------
+// seek
+//---------------------------------------------------------
+
+off_t SndFile::seek(off_t frames, int whence)
+ {
+ return sf_seek(sf, frames, whence);
+ }
+
+//---------------------------------------------------------
+// strerror
+//---------------------------------------------------------
+
+QString SndFile::strerror() const
+ {
+ char buffer[128];
+ buffer[0] = 0;
+ sf_error_str(sf, buffer, 128);
+ return QString(buffer);
+ }
+
+//---------------------------------------------------------
+// search
+//---------------------------------------------------------
+
+SndFile* SndFileList::search(const QString& name)
+ {
+ for (iSndFile i = begin(); i != end(); ++i) {
+ if ((*i)->path() == name)
+ return *i;
+ }
+ return 0;
+ }
+
+//---------------------------------------------------------
+// getSnd
+//---------------------------------------------------------
+
+SndFile* getWave(const QString& inName, bool readOnlyFlag)
+ {
+ QString name = inName;
+
+ if (QFileInfo(name).isRelative()) {
+ name = museProject + QString("/") + name;
+ }
+ else {
+ if (!QFile::exists(name)) {
+ if (QFile::exists(museProject + QString("/") + name)) {
+ name = museProject + QString("/") + name;
+ }
+ }
+ }
+// printf("=====%s %s\n", inName.latin1(), name.latin1());
+
+ // only open one instance of wave file
+ SndFile* f = SndFile::sndFiles.search(name);
+ if (f == 0) {
+ if (!QFile::exists(name)) {
+ fprintf(stderr, "wave file <%s> not found\n",
+ name.latin1());
+ return 0;
+ }
+ f = new SndFile(name);
+ bool error;
+ if (readOnlyFlag)
+ error = f->openRead();
+ else {
+ error = f->openWrite();
+ // if peak cache is older than wave file we reaquire the cache
+ QFileInfo wavinfo(name);
+ QString cacheName = wavinfo.dirPath(true) + QString("/") + wavinfo.baseName(true) + QString(".wca");
+ QFileInfo wcainfo(cacheName);
+ if (!wcainfo.exists() || wcainfo.lastModified() < wavinfo.lastModified()) {
+ //printf("wcafile is older or does not exist!\n");
+ QFile(cacheName).remove();
+ f->readCache(cacheName,true);
+ }
+
+ }
+ if (error) {
+ fprintf(stderr, "open wave file(%s) for %s failed: %s\n",
+ name.latin1(),
+ readOnlyFlag ? "writing" : "reading",
+ f->strerror().latin1());
+ QMessageBox::critical(NULL, "MusE import error.",
+ "MusE failed to import the file.\n"
+ "Possibly this wasn't a sound file?\n"
+ "If it was check the permissions, MusE\n"
+ "sometimes requires write access to the file.");
+
+ delete f;
+ f = 0;
+ }
+ }
+ else {
+ if (!readOnlyFlag && ! f->isWritable()) {
+ if (f->isOpen())
+ f->close();
+ f->openWrite();
+ }
+ else {
+ // if peak cache is older than wave file we reaquire the cache
+ QFileInfo wavinfo(name);
+ QString cacheName = wavinfo.dirPath(true) + QString("/") + wavinfo.baseName(true) + QString(".wca");
+ QFileInfo wcainfo(cacheName);
+ if (!wcainfo.exists() || wcainfo.lastModified() < wavinfo.lastModified()) {
+ //printf("wcafile is older or does not exist!\n");
+ QFile(cacheName).remove();
+ f->readCache(cacheName,true);
+ }
+
+ }
+ }
+ return f;
+ }
+
+//---------------------------------------------------------
+// applyUndoFile
+//---------------------------------------------------------
+void SndFile::applyUndoFile(const QString& original, const QString& tmpfile, unsigned startframe, unsigned endframe)
+ {
+ // This one is called on both undo and redo of a wavfile
+ // For redo to be called, undo must have been called first, and we don't store both the original data and the modified data in separate
+ // files. Thus, each time this function is called the data in the "original"-file will be written to the tmpfile, after the data
+ // from the tmpfile has been applied.
+ //
+ // F.ex. if mute has been made on part of a wavfile, the unmuted data is stored in the tmpfile when
+ // the undo operation occurs. The unmuted data is then written back to the original file, and the mute data will be
+ // put in the tmpfile, and when redo is eventually called the data is switched again (causing the muted data to be written to the "original"
+ // file. The data is merely switched.
+
+ //printf("Applying undofile: orig=%s tmpfile=%s startframe=%d endframe=%d\n", original.latin1(), tmpfile.latin1(), startframe, endframe);
+ SndFile* orig = sndFiles.search(original);
+ SndFile tmp = SndFile(tmpfile);
+ if (!orig) {
+ printf("Internal error: could not find original file: %s in filelist - Aborting\n", original.latin1());
+ return;
+ }
+
+ if (!orig->isOpen()) {
+ if (orig->openRead()) {
+ printf("Cannot open original file %s for reading - cannot undo! Aborting\n", original.latin1());
+ return;
+ }
+ }
+
+ if (!tmp.isOpen()) {
+ if (tmp.openRead()) {
+ printf("Could not open temporary file %s for writing - cannot undo! Aborting\n", tmpfile.latin1());
+ return;
+ }
+ }
+
+ audio->msgIdle(true);
+ tmp.setFormat(orig->format(), orig->channels(), orig->samplerate());
+
+ // Read data in original file to memory before applying tmpfile to original
+ unsigned file_channels = orig->channels();
+ unsigned tmpdatalen = endframe - startframe;
+ float* data2beoverwritten[file_channels];
+
+ for (unsigned i=0; i<file_channels; i++) {
+ data2beoverwritten[i] = new float[tmpdatalen];
+ }
+ orig->seek(startframe, 0);
+ orig->readWithHeap(file_channels, data2beoverwritten, tmpdatalen);
+
+ orig->close();
+
+ // Read data from temporary file to memory
+ float* tmpfiledata[file_channels];
+ for (unsigned i=0; i<file_channels; i++) {
+ tmpfiledata[i] = new float[tmpdatalen];
+ }
+ tmp.seek(0, 0);
+ tmp.readWithHeap(file_channels, tmpfiledata, tmpdatalen);
+ tmp.close();
+
+ // Write temporary data to original file:
+ if (orig->openWrite()) {
+ printf("Cannot open orig for write - aborting.\n");
+ return;
+ }
+
+ orig->seek(startframe, 0);
+ orig->write(file_channels, tmpfiledata, tmpdatalen);
+
+ // Delete dataholder for temporary file
+ for (unsigned i=0; i<file_channels; i++) {
+ delete[] tmpfiledata[i];
+ }
+
+ // Write the overwritten data to the tmpfile
+ if (tmp.openWrite()) {
+ printf("Cannot open tmpfile for writing - redo operation of this file won't be possible. Aborting.\n");
+ audio->msgIdle(false);
+ return;
+ }
+ tmp.seek(0, 0);
+ tmp.write(file_channels, data2beoverwritten, tmpdatalen);
+ tmp.close();
+
+ // Delete dataholder for replaced original file
+ for (unsigned i=0; i<file_channels; i++) {
+ delete[] data2beoverwritten[i];
+ }
+
+ orig->close();
+ orig->openRead();
+ orig->update();
+ audio->msgIdle(false);
+ }
+
+//---------------------------------------------------------
+// importAudio
+//---------------------------------------------------------
+
+void MusE::importWave()
+ {
+ Track* track = arranger->curTrack();
+ if (track == 0 || track->type() != Track::WAVE) {
+ QMessageBox::critical(this, QString("MusE"),
+ tr("to import an audio file you have first to select"
+ "a wave track"));
+ return;
+ }
+ //QString fn = getOpenFileName(lastWavePath, audioFilePattern, this,
+ QString fn = getOpenFileName(lastWavePath, audio_file_pattern, this,
+ tr("Import Wave File"), 0);
+ if (!fn.isEmpty()) {
+ lastWavePath = fn;
+ importWaveToTrack(fn);
+ }
+ }
+
+//---------------------------------------------------------
+// importWaveToTrack
+//---------------------------------------------------------
+
+bool MusE::importWaveToTrack(QString& name, unsigned tick, Track* track)
+ {
+ if (track==NULL)
+ track = (WaveTrack*)(arranger->curTrack());
+
+ SndFile* f = getWave(name, true);
+
+ if (f == 0) {
+ printf("import audio file failed\n");
+ return true;
+ }
+ int samples = f->samples();
+ if ((unsigned)sampleRate !=f->samplerate()) {
+ if(QMessageBox::question(this, tr("Import Wavefile"),
+ tr("This wave file has a samplerate of %1,\n"
+ "as opposed to current setting %2.\n"
+ "Do you still want to import it?").arg(f->samplerate()).arg(sampleRate),
+ tr("&Yes"), tr("&No"),
+ QString::null, 0, 1 ))
+ {
+ //printf("why won't muse let me delete the file object? %d\n", f->getRefCount());
+ if (f->getRefCount() == 0)
+ delete f;
+ return true;
+ }
+ }
+ track->setChannels(f->channels());
+
+ WavePart* part = new WavePart((WaveTrack *)track);
+ if (tick)
+ part->setTick(tick);
+ else
+ part->setTick(song->cpos());
+ part->setLenFrame(samples);
+
+ Event event(Wave);
+ SndFileR sf(f);
+ event.setSndFile(sf);
+ event.setSpos(0);
+ event.setLenFrame(samples);
+ part->addEvent(event);
+
+ part->setName(QFileInfo(name).baseName(true));
+ audio->msgAddPart(part);
+ unsigned endTick = part->tick() + part->lenTick();
+ if (song->len() < endTick)
+ song->setLen(endTick);
+ return false;
+ }
+#if 0
+//---------------------------------------------------------
+// Clip
+//---------------------------------------------------------
+
+ClipBase::ClipBase(const SndFileR& file, int start, int l)
+ : f(file)
+ {
+ refCount = 0;
+ for (int i = 1; true; ++i) {
+ _name.sprintf("%s.%d", f.basename().latin1(), i);
+ ciClip ic = waveClips->begin();
+ for (; ic != waveClips->end(); ++ic) {
+ if ((*ic)->name() == _name)
+ break;
+ }
+ if (ic == waveClips->end())
+ break;
+ // try another name
+ }
+ _spos = start;
+ len = l;
+ deleted = false;
+ lrefs = 0;
+ waveClips->add(this);
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void ClipBase::read(unsigned srcOffset, float** buffer, int channel, unsigned n)
+ {
+ if (f.isNull())
+ return;
+ f.seek(srcOffset + _spos, 0);
+ f.read(channel, buffer, n);
+ }
+
+ClipBase::~ClipBase()
+ {
+ waveClips->remove(this);
+ }
+
+//---------------------------------------------------------
+// ClipList::write(level, xml)
+//---------------------------------------------------------
+
+void ClipList::write(int level, Xml& xml) const
+ {
+ for (ciClip i = begin(); i != end(); ++i) {
+ ClipBase* clip = *i;
+ // only write visible clips
+ if (clip->references())
+ (*i)->write(level, xml);
+ }
+ }
+
+//---------------------------------------------------------
+// ClipBase::write(level, xml)
+//---------------------------------------------------------
+
+void ClipBase::write(int level, Xml& xml) const
+ {
+ xml.tag(level++, "clip");
+ QString path = f.dirPath();
+
+ //
+ // waves in the project dirctory are stored
+ // with relative path name, others with absolute path
+ //
+ if (path == museProject)
+ xml.strTag(level, "file", f.name());
+ else
+ xml.strTag(level, "file", f.path());
+
+ xml.strTag(level, "name", _name);
+ xml.intTag(level, "tick", _spos);
+ xml.intTag(level, "len", len);
+ xml.etag(level, "clip");
+ }
+
+//---------------------------------------------------------
+// ClipBase::read
+//---------------------------------------------------------
+
+ClipBase* readClip(Xml& xml)
+ {
+ SndFile* f = 0;
+ QString name;
+ unsigned spos = 0;
+ int len = 0;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return 0;
+ case Xml::TagStart:
+ if (tag == "file")
+ f = getWave(xml.parse1(), false);
+ else if (tag == "name")
+ name = xml.parse1();
+ else if (tag == "tick")
+ spos = xml.parseInt();
+ else if (tag == "len")
+ len = xml.parseInt();
+ else
+ xml.unknown("Clip");
+ break;
+ case Xml::TagEnd:
+ if (tag == "clip") {
+ if (!f)
+ printf("clip: file not found\n");
+ ClipBase* clip = new ClipBase(f, spos, len);
+ clip->setName(name);
+ return clip;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// search
+//---------------------------------------------------------
+
+Clip ClipList::search(const QString& name) const
+ {
+ for (ciClip i = begin(); i != end(); ++i)
+ if ((*i)->name() == name)
+ return Clip(*i);
+ fprintf(stderr, "ClipList: clip <%s> not found\n",
+ name.latin1());
+ return Clip();
+ }
+
+//---------------------------------------------------------
+// remove
+//---------------------------------------------------------
+
+void ClipList::remove(ClipBase* clip)
+ {
+ for (iClip i = begin(); i != end(); ++i) {
+ if (*i == clip) {
+ erase(i);
+ return;
+ }
+ }
+ printf("ClipList:remove: clip not found\n");
+ }
+
+//---------------------------------------------------------
+// idx
+//---------------------------------------------------------
+
+int ClipList::idx(const Clip& clip) const
+ {
+ int n = 0;
+ for (ciClip i = begin(); i != end(); ++i, ++n) {
+ if (clip == *i)
+ return n;
+ }
+ return -1;
+ }
+#endif
+
+//---------------------------------------------------------
+// cmdAddRecordedWave
+//---------------------------------------------------------
+
+//void Song::cmdAddRecordedWave(WaveTrack* track, const Pos& s, const Pos& e)
+void Song::cmdAddRecordedWave(WaveTrack* track, Pos s, Pos e)
+ {
+ SndFile* f = track->recFile();
+ if (f == 0) {
+ printf("cmdAddRecordedWave: no snd file for track <%s>\n",
+ track->name().latin1());
+ return;
+ }
+
+ // Removed by Tim. p3.3.8
+ //unsigned startTick = roundDownBar(s.tick());
+ //unsigned endTick = roundUpBar(e.tick());
+
+ // Added by Tim. p3.3.8
+
+ if((audio->loopCount() > 0 && s.tick() > lPos().tick()) || (punchin() && s.tick() < lPos().tick()))
+ s.setTick(lPos().tick());
+ // If we are looping, just set the end to the right marker, since we don't know how many loops have occurred.
+ // (Fixed: Added Audio::loopCount)
+ // Otherwise if punchout is on, limit the end to the right marker.
+ //if(loop() || (punchout() && e.tick() > rPos().tick()) )
+ if((audio->loopCount() > 0) || (punchout() && e.tick() > rPos().tick()) )
+ e.setTick(rPos().tick());
+ // No part to be created? Delete the rec sound file.
+ if(s.tick() >= e.tick())
+ {
+ QString s = f->path();
+ delete f;
+ // The function which calls this function already does this immediately after. But do it here anyway.
+ track->setRecFile(0);
+ remove(s.latin1());
+ if(debugMsg)
+ printf("Song::cmdAddRecordedWave: remove file %s\n", s.latin1());
+ return;
+ }
+ // Round the start down using the Arranger part snap raster value.
+ unsigned startTick = sigmap.raster1(s.tick(), song->recRaster());
+ // Round the end up using the Arranger part snap raster value.
+ unsigned endTick = sigmap.raster2(e.tick(), song->recRaster());
+
+ f->update();
+
+ WavePart* part = new WavePart(track);
+ part->setTick(startTick);
+ part->setLenTick(endTick - startTick);
+ part->setName(track->name());
+
+ // create Event
+ Event event(Wave);
+ SndFileR sf(f);
+ event.setSndFile(sf);
+ // We are done with the _recFile member. Set to zero. The function which
+ // calls this function already does this immediately after. But do it here anyway.
+ track->setRecFile(0);
+
+ event.setSpos(0);
+
+ // Since the part start was snapped down, we must apply the difference so that the
+ // wave event tick lines up with when the user actually started recording.
+ // Added by Tim. p3.3.8
+ event.setTick(s.tick() - startTick);
+
+
+ event.setLenFrame(e.frame() - s.frame());
+ part->addEvent(event);
+
+ song->cmdAddPart(part);
+
+ if (song->len() < endTick)
+ song->setLen(endTick);
+ }
+
+//---------------------------------------------------------
+// cmdChangeWave
+// called from GUI context
+//---------------------------------------------------------
+void Song::cmdChangeWave(QString original, QString tmpfile, unsigned sx, unsigned ex)
+ {
+ char* original_charstr = new char[original.length() + 1];
+ char* tmpfile_charstr = new char[tmpfile.length() + 1];
+ strcpy(original_charstr, original.latin1());
+ strcpy(tmpfile_charstr, tmpfile.latin1());
+ song->undoOp(UndoOp::ModifyClip, original_charstr, tmpfile_charstr, sx, ex);
+ }
+
+//---------------------------------------------------------
+// SndFileR
+//---------------------------------------------------------
+
+SndFileR::SndFileR(SndFile* _sf)
+ {
+ sf = _sf;
+ if (sf)
+ (sf->refCount)++;
+ }
+
+SndFileR::SndFileR(const SndFileR& ed)
+ {
+ sf = ed.sf;
+ if (sf)
+ (sf->refCount)++;
+ }
+
+//---------------------------------------------------------
+// operator=
+//---------------------------------------------------------
+
+SndFileR& SndFileR::operator=(const SndFileR& ed)
+ {
+ if (sf == ed.sf)
+ return *this;
+ if (sf && --(sf->refCount) == 0) {
+ delete sf;
+ }
+ sf = ed.sf;
+ if (sf)
+ (sf->refCount)++;
+ return *this;
+ }
+
+//---------------------------------------------------------
+// ~SndFileR
+//---------------------------------------------------------
+
+SndFileR::~SndFileR()
+ {
+ if (sf)
+ if (--(sf->refCount) == 0) {
+ delete sf;
+ sf=NULL;
+ }
+ }
diff --git a/muse2/muse/wave.h b/muse2/muse/wave.h
new file mode 100644
index 00000000..f83e5bdb
--- /dev/null
+++ b/muse2/muse/wave.h
@@ -0,0 +1,264 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: wave.h,v 1.5.2.7 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 1999/2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __WAVE_H__
+#define __WAVE_H__
+
+#include <qstring.h>
+#include <list>
+#include <qfileinfo.h>
+#include <sndfile.h>
+
+class Xml;
+
+//---------------------------------------------------------
+// SampleV
+// peak file value
+//---------------------------------------------------------
+
+struct SampleV {
+ unsigned char peak;
+ unsigned char rms;
+ };
+
+//---------------------------------------------------------
+// SndFileList
+//---------------------------------------------------------
+
+class SndFile;
+class SndFileList : public std::list<SndFile*> {
+ public:
+ SndFile* search(const QString& name);
+ };
+
+typedef SndFileList::iterator iSndFile;
+typedef SndFileList::const_iterator ciSndFile;
+
+//---------------------------------------------------------
+// SndFile
+//---------------------------------------------------------
+
+class SndFile {
+ //static SndFileList _sndFiles;
+ QFileInfo* finfo;
+ SNDFILE* sf;
+ SNDFILE* sfUI;
+ SF_INFO sfinfo;
+ SampleV** cache;
+ int csize; //!< frames in cache
+
+ void writeCache(const QString& path);
+
+ bool openFlag;
+ bool writeFlag;
+ size_t readInternal(int srcChannels, float** dst, size_t n, bool overwrite, float *buffer);
+
+ protected:
+ int refCount;
+
+ public:
+ SndFile(const QString& name);
+ ~SndFile();
+ int getRefCount() { return refCount; }
+
+ static SndFileList sndFiles;
+ static void applyUndoFile(const QString& original, const QString& tmpfile, unsigned sx, unsigned ex);
+
+ void readCache(const QString& path, bool progress);
+
+ bool openRead(); //!< returns true on error
+ bool openWrite(); //!< returns true on error
+ void close();
+ void remove();
+
+ bool isOpen() const { return openFlag; }
+ bool isWritable() const { return writeFlag; }
+ void update();
+
+ QString basename() const; //!< filename without extension
+ QString dirPath() const; //!< path
+ QString path() const; //!< path with filename
+ QString name() const; //!< filename
+
+ unsigned samples() const;
+ unsigned channels() const;
+ unsigned samplerate() const;
+ unsigned format() const;
+ int sampleBits() const;
+ void setFormat(int fmt, int ch, int rate);
+
+ size_t read(int channel, float**, size_t, bool overwrite = true);
+ size_t readWithHeap(int channel, float**, size_t, bool overwrite = true);
+ size_t readDirect(float* buf, size_t n) { return sf_readf_float(sf, buf, n); }
+ size_t write(int channel, float**, size_t);
+
+ off_t seek(off_t frames, int whence);
+ void read(SampleV* s, int mag, unsigned pos, bool overwrite = true);
+ QString strerror() const;
+
+ static SndFile* search(const QString& name);
+ friend class SndFileR;
+ };
+
+//---------------------------------------------------------
+// SndFileR
+// SndFile with reference count
+//---------------------------------------------------------
+
+class SndFileR {
+ SndFile* sf;
+
+ public:
+ SndFileR() { sf = 0; }
+ SndFileR(SndFile* _sf);
+ SndFileR(const SndFileR& ed);
+ SndFileR& operator=(const SndFileR& ed);
+ bool operator==(const SndFileR& c) const { return sf == c.sf; }
+ bool operator==(SndFile* c) const { return sf == c; }
+ ~SndFileR();
+ int getRefCount() const { return sf->refCount; }
+ bool isNull() const { return sf == 0; }
+
+ bool openRead() { return sf->openRead(); }
+ bool openWrite() { return sf->openWrite(); }
+ void close() { sf->close(); }
+ void remove() { sf->remove(); }
+
+ bool isOpen() const { return sf->isOpen(); }
+ bool isWritable() const { return sf->isWritable(); }
+ void update() { sf->update(); }
+
+ QString basename() const { return sf->basename(); }
+ QString dirPath() const { return sf->dirPath(); }
+ QString path() const { return sf->path(); }
+ QString name() const { return sf->name(); }
+
+ unsigned samples() const { return sf->samples(); }
+ unsigned channels() const { return sf->channels(); }
+ unsigned samplerate() const { return sf->samplerate(); }
+ unsigned format() const { return sf->format(); }
+ int sampleBits() const { return sf->sampleBits(); }
+ void setFormat(int fmt, int ch, int rate) {
+ sf->setFormat(fmt, ch, rate);
+ }
+ size_t readWithHeap(int channel, float** f, size_t n, bool overwrite = true) {
+ return sf->readWithHeap(channel, f, n, overwrite);
+ }
+ size_t read(int channel, float** f, size_t n, bool overwrite = true) {
+ return sf->read(channel, f, n, overwrite);
+ }
+ size_t readDirect(float* f, size_t n) { return sf->readDirect(f, n); }
+
+ size_t write(int channel, float** f, size_t n) {
+ return sf->write(channel, f, n);
+ }
+ off_t seek(off_t frames, int whence) {
+ return sf->seek(frames, whence);
+ }
+ void read(SampleV* s, int mag, unsigned pos, bool overwrite = true) {
+ sf->read(s, mag, pos, overwrite);
+ }
+ QString strerror() const { return sf->strerror(); }
+ };
+
+
+#if 0
+
+class Clip;
+//---------------------------------------------------------
+// ClipBase
+//---------------------------------------------------------
+
+class ClipBase {
+ protected:
+ QString _name;
+ SndFileR f;
+ int _spos; // start sample position in WaveFile
+ int len; // len of clip
+ int lrefs; // logical references
+ bool deleted;
+ int refCount;
+
+ public:
+ ClipBase(const SndFileR& f, int start, int len);
+ ~ClipBase();
+ const QString& name() const { return _name; }
+ void setName(const QString& s) { _name = s; }
+ int spos() const { return _spos; }
+ void setSpos(int s) { _spos = s; }
+ SndFileR file1() const { return f; }
+
+ void read(unsigned, float**, int, unsigned);
+ void write(int, Xml&) const;
+ int samples() const { return len; }
+ void setSamples(int s) { len = s; }
+ int getRefCount() const { return refCount; }
+ int references() const { return lrefs; }
+ void incRefs() { ++lrefs; }
+ void decRefs() { --lrefs; }
+ friend class WaveEvent;
+ };
+
+//---------------------------------------------------------
+// Clip
+//---------------------------------------------------------
+
+class Clip {
+ ClipBase* clip;
+
+ public:
+ Clip();
+ Clip(ClipBase* clip);
+ Clip(const SndFileR& f, int start, int len);
+ Clip(const Clip&);
+ Clip& operator=(const Clip&);
+ bool operator==(const Clip& c) const { return clip == c.clip; }
+ bool operator==(ClipBase* c) const { return clip == c; }
+ ~Clip();
+
+ // ClipBase* clipBase() const { return clip; }
+ bool isNull() const { return clip == 0; }
+ int getRefCount() const { return clip->getRefCount(); }
+
+ const QString& name() const { return clip->name(); }
+ void setName(const QString& s) { clip->setName(s); }
+ int spos() const { return clip->spos(); }
+ void setSpos(int s) { clip->setSpos(s); }
+ SndFileR file1() const { return clip->file1(); }
+
+ void read(unsigned off, float** f, int ch, unsigned nn) {
+ clip->read(off, f, ch, nn);
+ }
+ int samples() const { return clip->samples(); }
+ void setSamples(int s) { clip->setSamples(s); }
+ int references() const { return clip->references(); }
+ void incRefs() { clip->incRefs(); }
+ void decRefs() { clip->decRefs(); }
+ };
+
+//---------------------------------------------------------
+// ClipList
+//---------------------------------------------------------
+
+class ClipList : public std::list<ClipBase*> {
+ public:
+ int idx(const Clip&) const;
+ Clip search(const QString&) const;
+ void write(int, Xml&) const;
+ void add(ClipBase* clip) { push_back(clip); }
+ void remove(ClipBase*);
+ };
+
+typedef ClipList::iterator iClip;
+typedef ClipList::const_iterator ciClip;
+extern ClipBase* readClip(Xml& xml);
+#endif
+
+extern SndFile* getWave(const QString& name, bool readOnlyFlag);
+#endif
+
diff --git a/muse2/muse/waveedit/Makefile.am b/muse2/muse/waveedit/Makefile.am
new file mode 100644
index 00000000..0ab4f829
--- /dev/null
+++ b/muse2/muse/waveedit/Makefile.am
@@ -0,0 +1,18 @@
+include $(top_srcdir)/common.am
+
+if PCH
+AM_CXXFLAGS += -include $(top_srcdir)/all.h
+endif
+
+noinst_LIBRARIES = libwaveedit.a
+
+dist_libwaveedit_a_SOURCES = \
+ waveedit.cpp waveedit.h \
+ waveview.cpp waveview.h \
+ editgainbase.ui \
+ editgain.cpp editgain.h
+
+nodist_libwaveedit_a_SOURCES = \
+ moc_waveedit.cpp \
+ moc_waveview.cpp \
+ moc_editgain.cpp
diff --git a/muse2/muse/waveedit/Makefile.in b/muse2/muse/waveedit/Makefile.in
new file mode 100644
index 00000000..c9b5cf47
--- /dev/null
+++ b/muse2/muse/waveedit/Makefile.in
@@ -0,0 +1,606 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/common.am
+@PCH_TRUE@am__append_1 = -include $(top_srcdir)/all.h
+subdir = muse/waveedit
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
+ $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libwaveedit_a_AR = $(AR) $(ARFLAGS)
+libwaveedit_a_LIBADD =
+dist_libwaveedit_a_OBJECTS = waveedit.$(OBJEXT) waveview.$(OBJEXT) \
+ editgainbase.$(OBJEXT) editgain.$(OBJEXT)
+nodist_libwaveedit_a_OBJECTS = moc_waveedit.$(OBJEXT) \
+ moc_waveview.$(OBJEXT) moc_editgain.$(OBJEXT)
+libwaveedit_a_OBJECTS = $(dist_libwaveedit_a_OBJECTS) \
+ $(nodist_libwaveedit_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(dist_libwaveedit_a_SOURCES) \
+ $(nodist_libwaveedit_a_SOURCES)
+DIST_SOURCES = $(dist_libwaveedit_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCBOOKSTYLE = @DOCBOOKSTYLE@
+DOCBOOKTARGETS = @DOCBOOKTARGETS@
+DOT = @DOT@
+DOTPATH = @DOTPATH@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@
+FST_CFLAGS = @FST_CFLAGS@
+FST_LIBS = @FST_LIBS@
+Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@
+Fluidsynth_LIBS = @Fluidsynth_LIBS@
+GIVERTCAP = @GIVERTCAP@
+GREP = @GREP@
+HAVEDOT = @HAVEDOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JADE = @JADE@
+LASH_CFLAGS = @LASH_CFLAGS@
+LASH_LIBS = @LASH_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LO_CFLAGS = @LO_CFLAGS@
+LO_LIBS = @LO_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUSECXXFLAGS = @MUSECXXFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSGMLS = @NSGMLS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCH = @PCH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIB = @PYTHON_LIB@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+QTDIR_BIN = @QTDIR_BIN@
+QTDIR_INC = @QTDIR_INC@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+SUIDBUILD = @SUIDBUILD@
+SUIDINSTALL = @SUIDINSTALL@
+USE_SSE = @USE_SSE@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+have_docbook = @have_docbook@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+synth_fluid = @synth_fluid@
+synth_fluidsynth = @synth_fluidsynth@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \
+ -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(am__append_1)
+AM_CPPFLAGS =
+MOC = $(QTDIR_BIN)/moc
+#UIC = $(QTDIR_BIN)/uic3
+UIC = /usr/bin/uic3
+UIFILES = $(wildcard *.ui)
+MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \
+ if grep -q Q_OBJECT $$h; then \
+ echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \
+ fi; \
+ done)
+
+BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+SUFFIXES = .ui .h.gch
+noinst_LIBRARIES = libwaveedit.a
+dist_libwaveedit_a_SOURCES = \
+ waveedit.cpp waveedit.h \
+ waveview.cpp waveview.h \
+ editgainbase.ui \
+ editgain.cpp editgain.h
+
+nodist_libwaveedit_a_SOURCES = \
+ moc_waveedit.cpp \
+ moc_waveview.cpp \
+ moc_editgain.cpp
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .ui .h.gch .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/waveedit/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu muse/waveedit/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libwaveedit.a: $(libwaveedit_a_OBJECTS) $(libwaveedit_a_DEPENDENCIES)
+ -rm -f libwaveedit.a
+ $(libwaveedit_a_AR) libwaveedit.a $(libwaveedit_a_OBJECTS) $(libwaveedit_a_LIBADD)
+ $(RANLIB) libwaveedit.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/editgain.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_editgain.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_waveedit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_waveview.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/waveedit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/waveview.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+de:
+ @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done
+
+nde:
+ @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done
+
+.ui.o: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(CXXCOMPILE) -c $*.cpp -o $*.o
+ $(RM) $*.cpp moc_$*.cpp moc_$*.o
+
+.ui.lo: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(LTCXXCOMPILE) -c $*.cpp -o $*.lo
+ $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o
+
+moc_%.cpp: %.h
+ $(MOC) $< -o $@
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/muse2/muse/waveedit/editgain.cpp b/muse2/muse/waveedit/editgain.cpp
new file mode 100644
index 00000000..ef9b781c
--- /dev/null
+++ b/muse2/muse/waveedit/editgain.cpp
@@ -0,0 +1,91 @@
+//
+// C++ Implementation: editgain
+//
+// Description:
+//
+//
+// Author: Mathias Lundgren <lunar_shuttle@users.sf.net>, (C) 2005
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#include <qslider.h>
+#include <qpushbutton.h>
+
+#include "editgain.h"
+
+EditGain::EditGain(QWidget* parent, int initGainValue)
+ : EditGainBase(parent, "editgain", false)
+ {
+ sliderGain->setValue(sliderGain->maxValue() - initGainValue);
+ connect(buttonReset, SIGNAL(pressed()), this, SLOT(resetPressed()));
+ connect(buttonApply, SIGNAL(pressed()), this, SLOT(applyPressed()));
+ connect(buttonCancel,SIGNAL(pressed()), this, SLOT(cancelPressed()));
+ connect(sliderGain, SIGNAL(valueChanged(int)), this, SLOT(gainChanged(int)));
+ if (sliderGain->value() != 100)
+ buttonReset->setEnabled(true);
+ }
+
+
+EditGain::~EditGain()
+ {
+ }
+
+
+/*!
+ \fn EditGain::resetPressed
+ */
+void EditGain::resetPressed()
+ {
+ sliderGain->blockSignals(true);
+ sliderGain->setValue(100);
+ sliderGain->blockSignals(false);
+ buttonReset->setEnabled(false);
+ buttonApply->setEnabled(false);
+ }
+
+
+/*!
+ \fn EditGain::applyPressed()
+ */
+void EditGain::applyPressed()
+ {
+ done(QDialog::Accepted);
+ }
+
+
+/*!
+ \fn EditGain::cancelPressed()
+ */
+void EditGain::cancelPressed()
+ {
+ done(QDialog::Rejected);
+ }
+
+
+
+/*!
+ \fn EditGain::gainChanged(int value)
+ */
+void EditGain::gainChanged(int value)
+ {
+ gain = sliderGain->maxValue() - value;
+ if (sliderGain->value() != 100) {
+ buttonReset->setEnabled(true);
+ buttonApply->setEnabled(true);
+ }
+ else {
+ buttonReset->setEnabled(false);
+ buttonApply->setEnabled(false);
+ }
+ }
+
+
+/*!
+ \fn EditGain::getGain()
+ */
+int EditGain::getGain()
+ {
+ return gain;
+ }
diff --git a/muse2/muse/waveedit/editgain.h b/muse2/muse/waveedit/editgain.h
new file mode 100644
index 00000000..2094388b
--- /dev/null
+++ b/muse2/muse/waveedit/editgain.h
@@ -0,0 +1,37 @@
+//
+// C++ Interface: editgain
+//
+// Description:
+//
+//
+// Author: Mathias Lundgren <lunar_shuttle@users.sf.net>, (C) 2005
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#ifndef EDITGAIN_H
+#define EDITGAIN_H
+
+#include "editgainbase.h"
+
+class EditGain : public EditGainBase
+{
+ Q_OBJECT
+public:
+ EditGain(QWidget* parent = 0, int initGainValue=100);
+
+ ~EditGain();
+ int getGain();
+
+private:
+ int gain;
+
+private slots:
+ void resetPressed();
+ void applyPressed();
+ void cancelPressed();
+ void gainChanged(int value);
+};
+
+#endif
diff --git a/muse2/muse/waveedit/editgainbase.ui b/muse2/muse/waveedit/editgainbase.ui
new file mode 100644
index 00000000..b23cd70e
--- /dev/null
+++ b/muse2/muse/waveedit/editgainbase.ui
@@ -0,0 +1,302 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>EditGainBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>EditGainBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>284</width>
+ <height>367</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Modify gain</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Gain</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>90</width>
+ <height>41</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QSlider">
+ <property name="name">
+ <cstring>sliderGain</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>40</width>
+ <height>150</height>
+ </size>
+ </property>
+ <property name="maxValue">
+ <number>200</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="tickmarks">
+ <enum>Both</enum>
+ </property>
+ <property name="tickInterval">
+ <number>10</number>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>200%</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>109</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>100%</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>108</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>0%</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout16</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>70</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonReset</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Reset</string>
+ </property>
+ <property name="accel">
+ <string>Alt+R</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>71</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup2</cstring>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonApply</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Apply</string>
+ </property>
+ <property name="accel">
+ <string>Alt+A</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>61</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string>Alt+C</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp
new file mode 100644
index 00000000..b342c14d
--- /dev/null
+++ b/muse2/muse/waveedit/waveedit.cpp
@@ -0,0 +1,413 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: waveedit.cpp,v 1.5.2.12 2009/04/06 01:24:54 terminator356 Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "app.h"
+#include "xml.h"
+#include "waveedit.h"
+#include "mtscale.h"
+#include "scrollscale.h"
+#include "waveview.h"
+#include "ttoolbar.h"
+#include "globals.h"
+#include "audio.h"
+#include "utils.h"
+#include "song.h"
+#include "poslabel.h"
+#include "gconfig.h"
+#include "icons.h"
+#include "shortcuts.h"
+
+#include <q3toolbar.h>
+#include <qtoolbutton.h>
+#include <q3accel.h>
+#include <qlayout.h>
+#include <q3hbox.h>
+#include <qsizegrip.h>
+#include <qscrollbar.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <q3buttongroup.h>
+#include <q3listbox.h>
+#include <qcombobox.h>
+#include <q3header.h>
+#include <q3popupmenu.h>
+#include <qmenubar.h>
+#include <qaction.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+#include <QResizeEvent>
+#include <QKeyEvent>
+
+extern QColor readColor(Xml& xml);
+
+int WaveEdit::_widthInit = 600;
+int WaveEdit::_heightInit = 400;
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void WaveEdit::closeEvent(QCloseEvent* e)
+ {
+ emit deleted((unsigned long)this);
+ e->accept();
+ }
+
+//---------------------------------------------------------
+// WaveEdit
+//---------------------------------------------------------
+
+WaveEdit::WaveEdit(PartList* pl)
+ : MidiEditor(1, 1, pl)
+ {
+ resize(_widthInit, _heightInit);
+
+ //---------Pulldown Menu----------------------------
+ Q3PopupMenu* menuFile = new Q3PopupMenu(this);
+ Q3PopupMenu* menuEdit = new Q3PopupMenu(this);
+ menuBar()->insertItem(tr("&File"), menuFile);
+ menuBar()->insertItem(tr("&Edit"), menuEdit);
+ menuFunctions = new Q3PopupMenu(this);
+ menuBar()->insertItem(tr("Func&tions"), menuFunctions);
+
+ menuGain = new Q3PopupMenu(this);
+ menuGain->insertItem(tr("200%"), CMD_GAIN_200);
+ menuGain->insertItem(tr("150%"), CMD_GAIN_150);
+ menuGain->insertItem(tr("75%"), CMD_GAIN_75);
+ menuGain->insertItem(tr("50%"), CMD_GAIN_50);
+ menuGain->insertItem(tr("25%"), CMD_GAIN_25);
+ menuGain->insertItem(tr("Other"), CMD_GAIN_FREE);
+ menuFunctions->insertItem(tr("&Gain"), menuGain);
+ menuFunctions->insertSeparator();
+
+ menuEdit->insertItem(tr("Edit in E&xternal Editor"), CMD_EDIT_EXTERNAL);
+ menuFunctions->insertItem(tr("Mute Selection"), CMD_MUTE);
+ menuFunctions->insertItem(tr("Normalize Selection"), CMD_NORMALIZE);
+ menuFunctions->insertItem(tr("Fade In Selection"), CMD_FADE_IN);
+ menuFunctions->insertItem(tr("Fade Out Selection"), CMD_FADE_OUT);
+ menuFunctions->insertItem(tr("Reverse Selection"), CMD_REVERSE);
+
+ select = new Q3PopupMenu(this);
+ select->insertItem(QIcon(*select_allIcon), tr("Select &All"), CMD_SELECT_ALL);
+ select->insertItem(QIcon(*select_deselect_allIcon), tr("&Deselect All"), CMD_SELECT_NONE);
+
+ menuEdit->insertItem(QIcon(*selectIcon), tr("Select"), select);
+
+ connect(menuFunctions, SIGNAL(activated(int)), SLOT(cmd(int)));
+ connect(menuFile, SIGNAL(activated(int)), SLOT(cmd(int)));
+ connect(select, SIGNAL(activated(int)), SLOT(cmd(int)));
+ connect(menuGain, SIGNAL(activated(int)), SLOT(cmd(int)));
+ connect(menuEdit, SIGNAL(activated(int)), SLOT(cmd(int)));
+
+ //---------ToolBar----------------------------------
+ tools = new Q3ToolBar(this, "waveedit-tools");
+ undoRedo->addTo(tools);
+
+ Q3Accel* qa = new Q3Accel(this);
+ qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Z), song, SLOT(undo()));
+ qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Y), song, SLOT(redo()));
+ connect(muse, SIGNAL(configChanged()), SLOT(configChanged()));
+
+
+ //--------------------------------------------------
+ // Transport Bar
+ Q3ToolBar* transport = new Q3ToolBar(this);
+ transportAction->addTo(transport);
+
+ //--------------------------------------------------
+ // ToolBar: Solo Cursor1 Cursor2
+
+ tb1 = new Q3ToolBar(this, "pianoroll-tools");
+
+ tb1->setLabel(tr("weTools"));
+ solo = new QToolButton(tb1);
+ solo->setText(tr("Solo"));
+ solo->setToggleButton(true);
+ connect(solo, SIGNAL(toggled(bool)), SLOT(soloChanged(bool)));
+
+ QLabel* label = new QLabel(tr("Cursor"), tb1, "Cursor");
+ label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ label->setIndent(3);
+ pos1 = new PosLabel(tb1);
+ pos2 = new PosLabel(tb1);
+ pos2->setSmpte(true);
+
+ //---------------------------------------------------
+ // Rest
+ //---------------------------------------------------
+
+ int yscale = 256;
+ int xscale;
+
+ if (!parts()->empty()) { // Roughly match total size of part
+ Part* firstPart = parts()->begin()->second;
+ xscale = 0 - firstPart->lenFrame()/_widthInit;
+ }
+ else {
+ xscale = -8000;
+ }
+
+ hscroll = new ScrollScale(1, -32768, xscale, 10000, Qt::Horizontal, mainw, 0, true, 10000.0);
+ view = new WaveView(this, mainw, xscale, yscale);
+ wview = view; // HACK!
+
+ QSizeGrip* corner = new QSizeGrip(mainw);
+ ymag = new QSlider(1, 256, 256, yscale, Qt::Vertical, mainw);
+ time = new MTScale(&_raster, mainw, xscale, true);
+ ymag->setFixedWidth(16);
+ connect(ymag, SIGNAL(valueChanged(int)), view, SLOT(setYScale(int)));
+ time->setOrigin(0, 0);
+
+ mainGrid->setRowStretch(0, 100);
+ mainGrid->setColStretch(0, 100);
+
+ mainGrid->addMultiCellWidget(time, 0, 0, 0, 1);
+ mainGrid->addMultiCellWidget(hLine(mainw), 1, 1, 0, 1);
+ mainGrid->addWidget(view, 2, 0);
+ mainGrid->addWidget(ymag, 2, 1);
+ mainGrid->addWidget(hscroll, 3, 0);
+ mainGrid->addWidget(corner, 3, 1, Qt::AlignBottom | Qt::AlignRight);
+
+ connect(hscroll, SIGNAL(scrollChanged(int)), view, SLOT(setXPos(int)));
+ connect(hscroll, SIGNAL(scaleChanged(int)), view, SLOT(setXMag(int)));
+ setCaption(view->getCaption());
+ connect(view, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int)));
+
+ connect(hscroll, SIGNAL(scrollChanged(int)), time, SLOT(setXPos(int)));
+ connect(hscroll, SIGNAL(scaleChanged(int)), time, SLOT(setXMag(int)));
+// connect(time, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
+ connect(view, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
+
+ connect(hscroll, SIGNAL(scaleChanged(int)), SLOT(updateHScrollRange()));
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged1(int)));
+
+ updateHScrollRange();
+ configChanged();
+
+ if(!parts()->empty())
+ {
+ WavePart* part = (WavePart*)(parts()->begin()->second);
+ solo->setOn(part->track()->solo());
+ }
+ }
+
+//---------------------------------------------------------
+// configChanged
+//---------------------------------------------------------
+
+void WaveEdit::configChanged()
+ {
+ view->setBg(config.waveEditBackgroundColor);
+ select->setAccel(shortcuts[SHRT_SELECT_ALL].key, CMD_SELECT_ALL);
+ select->setAccel(shortcuts[SHRT_SELECT_NONE].key, CMD_SELECT_NONE);
+ }
+
+//---------------------------------------------------------
+// updateHScrollRange
+//---------------------------------------------------------
+void WaveEdit::updateHScrollRange()
+{
+ int s, e;
+ wview->range(&s, &e);
+ // Show one more measure.
+ e += sigmap.ticksMeasure(e);
+ // Show another quarter measure due to imprecise drawing at canvas end point.
+ e += sigmap.ticksMeasure(e) / 4;
+ // Compensate for the vscroll width.
+ //e += wview->rmapxDev(-vscroll->width());
+ int s1, e1;
+ hscroll->range(&s1, &e1);
+ if(s != s1 || e != e1)
+ hscroll->setRange(s, e);
+}
+
+//---------------------------------------------------------
+// setTime
+//---------------------------------------------------------
+
+void WaveEdit::setTime(unsigned samplepos)
+ {
+// printf("setTime %d %x\n", samplepos, samplepos);
+ unsigned tick = tempomap.frame2tick(samplepos);
+ pos1->setValue(tick);
+ //pos2->setValue(tick);
+ pos2->setValue(samplepos);
+ time->setPos(3, tick, false);
+ }
+
+//---------------------------------------------------------
+// ~WaveEdit
+//---------------------------------------------------------
+
+WaveEdit::~WaveEdit()
+ {
+ undoRedo->removeFrom(tools);
+ }
+
+//---------------------------------------------------------
+// cmd
+//---------------------------------------------------------
+
+void WaveEdit::cmd(int n)
+ {
+ view->cmd(n);
+ }
+
+//---------------------------------------------------------
+// loadConfiguration
+//---------------------------------------------------------
+
+void WaveEdit::readConfiguration(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::TagStart:
+ if (tag == "bgcolor")
+ config.waveEditBackgroundColor = readColor(xml);
+ else if (tag == "width")
+ _widthInit = xml.parseInt();
+ else if (tag == "height")
+ _heightInit = xml.parseInt();
+ else
+ xml.unknown("WaveEdit");
+ break;
+ case Xml::TagEnd:
+ if (tag == "waveedit")
+ return;
+ default:
+ break;
+ case Xml::Error:
+ case Xml::End:
+ return;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// saveConfiguration
+//---------------------------------------------------------
+
+void WaveEdit::writeConfiguration(int level, Xml& xml)
+ {
+ xml.tag(level++, "waveedit");
+ xml.colorTag(level, "bgcolor", config.waveEditBackgroundColor);
+ xml.intTag(level, "width", _widthInit);
+ xml.intTag(level, "height", _heightInit);
+ xml.tag(level, "/waveedit");
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void WaveEdit::writeStatus(int level, Xml& xml) const
+ {
+ writePartList(level, xml);
+ xml.tag(level++, "waveedit");
+ MidiEditor::writeStatus(level, xml);
+ xml.intTag(level, "xpos", hscroll->pos());
+ xml.intTag(level, "xmag", hscroll->mag());
+ xml.intTag(level, "ymag", ymag->value());
+ xml.tag(level, "/waveedit");
+ }
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void WaveEdit::readStatus(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+ QString tag = xml.s1();
+ switch (token) {
+ case Xml::TagStart:
+ if (tag == "midieditor")
+ MidiEditor::readStatus(xml);
+ else if (tag == "xmag")
+ hscroll->setMag(xml.parseInt());
+ else if (tag == "ymag")
+ ymag->setValue(xml.parseInt());
+ else if (tag == "xpos")
+ hscroll->setPos(xml.parseInt());
+ else
+ xml.unknown("WaveEdit");
+ break;
+ case Xml::TagEnd:
+ if (tag == "waveedit")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// resizeEvent
+//---------------------------------------------------------
+
+void WaveEdit::resizeEvent(QResizeEvent* ev)
+ {
+ QWidget::resizeEvent(ev);
+ _widthInit = ev->size().width();
+ _heightInit = ev->size().height();
+ }
+
+//---------------------------------------------------------
+// songChanged1
+// signal from "song"
+//---------------------------------------------------------
+
+void WaveEdit::songChanged1(int bits)
+ {
+
+ if (bits & SC_SOLO)
+ {
+ WavePart* part = (WavePart*)(parts()->begin()->second);
+ solo->blockSignals(true);
+ solo->setOn(part->track()->solo());
+ solo->blockSignals(false);
+ }
+
+ songChanged(bits);
+ }
+
+
+//---------------------------------------------------------
+// soloChanged
+// signal from solo button
+//---------------------------------------------------------
+
+void WaveEdit::soloChanged(bool flag)
+ {
+ WavePart* part = (WavePart*)(parts()->begin()->second);
+ audio->msgSetSolo(part->track(), flag);
+ song->update(SC_SOLO);
+ }
+
+//---------------------------------------------------------
+// viewKeyPressEvent
+//---------------------------------------------------------
+
+void WaveEdit::keyPressEvent(QKeyEvent* event)
+ {
+ int key = event->key();
+ if (key == Qt::Key_Escape) {
+ close();
+ return;
+ }
+ else {
+ event->ignore();
+ }
+ }
+
+
diff --git a/muse2/muse/waveedit/waveedit.h b/muse2/muse/waveedit/waveedit.h
new file mode 100644
index 00000000..eac0e5bf
--- /dev/null
+++ b/muse2/muse/waveedit/waveedit.h
@@ -0,0 +1,79 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: waveedit.h,v 1.3.2.8 2008/01/26 07:23:21 terminator356 Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __WAVE_EDIT_H__
+#define __WAVE_EDIT_H__
+
+#include <qwidget.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QKeyEvent>
+#include <Q3PopupMenu>
+#include <QCloseEvent>
+#include "midieditor.h"
+
+class QToolButton;
+class PartList;
+class WaveView;
+class ScrollScale;
+class QSlider;
+class PosLabel;
+class QResizeEvent;
+class SNode;
+
+//---------------------------------------------------------
+// WaveEdit
+//---------------------------------------------------------
+
+class WaveEdit : public MidiEditor {
+ WaveView* view;
+ QSlider* ymag;
+ Q3ToolBar* tools;
+ Q3ToolBar* tb1;
+ QToolButton* solo;
+ PosLabel* pos1;
+ PosLabel* pos2;
+
+ static int _widthInit, _heightInit;
+
+ Q_OBJECT
+ virtual void closeEvent(QCloseEvent*);
+ virtual void resizeEvent(QResizeEvent* ev);
+ virtual void keyPressEvent(QKeyEvent*);
+
+ Q3PopupMenu* menuFunctions, *select, *menuGain;
+
+ private slots:
+ void cmd(int);
+ void setTime(unsigned t);
+ void songChanged1(int);
+ void soloChanged(bool flag);
+
+ public slots:
+ void configChanged();
+
+ virtual void updateHScrollRange();
+
+ signals:
+ void deleted(unsigned long);
+
+ public:
+ WaveEdit(PartList*);
+ ~WaveEdit();
+ virtual void readStatus(Xml&);
+ virtual void writeStatus(int, Xml&) const;
+ static void readConfiguration(Xml&);
+ static void writeConfiguration(int, Xml&);
+
+ enum { CMD_MUTE=0, CMD_NORMALIZE, CMD_FADE_IN, CMD_FADE_OUT, CMD_REVERSE,
+ CMD_GAIN_FREE, CMD_GAIN_200, CMD_GAIN_150, CMD_GAIN_75, CMD_GAIN_50, CMD_GAIN_25,
+ CMD_EDIT_EXTERNAL,
+ CMD_SELECT_ALL, CMD_SELECT_NONE };
+ };
+
+#endif
+
diff --git a/muse2/muse/waveedit/waveview.cpp b/muse2/muse/waveedit/waveview.cpp
new file mode 100644
index 00000000..f0ece122
--- /dev/null
+++ b/muse2/muse/waveedit/waveview.cpp
@@ -0,0 +1,936 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: waveview.cpp,v 1.10.2.16 2009/11/14 03:37:48 terminator356 Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <values.h>
+#include <sys/wait.h>
+
+#include <qpainter.h>
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <qmessagebox.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+
+#include "editgain.h"
+#include "globals.h"
+#include "wave.h"
+#include "waveview.h"
+#include "song.h"
+#include "event.h"
+#include "waveedit.h"
+#include "audio.h"
+#include "gconfig.h"
+
+bool modifyWarnedYet = false;
+//---------------------------------------------------------
+// WaveView
+//---------------------------------------------------------
+
+WaveView::WaveView(MidiEditor* pr, QWidget* parent, int xscale, int yscale)
+ : View(parent, xscale, 1)
+ {
+ editor = pr;
+ setVirt(true);
+ pos[0] = tempomap.tick2frame(song->cpos());
+ pos[1] = tempomap.tick2frame(song->lpos());
+ pos[2] = tempomap.tick2frame(song->rpos());
+ yScale = yscale;
+ mode = NORMAL;
+ selectionStart = 0;
+ selectionStop = 0;
+ lastGainvalue = 100;
+
+ setMouseTracking(true);
+ setBg(QColor(192, 208, 255));
+
+ if (editor->parts()->empty()) {
+ curPart = 0;
+ curPartId = -1;
+ }
+ else {
+ curPart = (WavePart*)(editor->parts()->begin()->second);
+ curPartId = curPart->sn();
+ }
+
+
+ connect(song, SIGNAL(posChanged(int,unsigned,bool)), SLOT(setPos(int,unsigned,bool)));
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ songChanged(SC_SELECTION);
+ }
+
+//---------------------------------------------------------
+// setYScale
+//---------------------------------------------------------
+
+void WaveView::setYScale(int val)
+ {
+ yScale = val;
+ redraw();
+ }
+
+//---------------------------------------------------------
+// draw
+//---------------------------------------------------------
+
+void WaveView::pdraw(QPainter& p, const QRect& rr)
+ {
+ int x1 = rr.x();
+ int x2 = rr.right() + 1;
+ if (x1 < 0)
+ x1 = 0;
+ if (x2 > width())
+ x2 = width();
+ int hh = height();
+ int h = hh/2;
+ int y = rr.y() + h;
+
+ // Added by T356.
+ int xScale = xmag;
+ if (xScale < 0)
+ xScale = -xScale;
+
+ for (iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip) {
+ WavePart* wp = (WavePart*)(ip->second);
+ int channels = wp->track()->channels();
+ int px = wp->frame();
+
+ EventList* el = wp->events();
+ for (iEvent e = el->begin(); e != el->end(); ++e) {
+ Event event = e->second;
+ if (event.empty())
+ continue;
+ SndFileR f = event.sndFile();
+ if (f.isNull())
+ continue;
+
+ unsigned peoffset = px + event.frame() - event.spos();
+ int sx, ex;
+
+ sx = event.frame() + px + xScale/2;
+ ex = sx + event.lenFrame();
+ sx = sx / xScale - xpos;
+ ex = ex / xScale - xpos;
+
+ if (sx < x1)
+ sx = x1;
+ if (ex > x2)
+ ex = x2;
+
+ int pos = (xpos + sx) * xScale + event.spos() - event.frame() - px;
+
+ //printf("pos=%d xpos=%d sx=%d ex=%d xScale=%d event.spos=%d event.frame=%d px=%d\n",
+ // pos, xpos, sx, ex, xScale, event.spos(), event.frame(), px);
+
+ h = hh / (channels * 2);
+ int cc = hh % (channels * 2) ? 0 : 1;
+
+ for (int i = sx; i < ex; i++) {
+ y = rr.y() + h;
+ SampleV sa[f.channels()];
+ f.read(sa, xScale, pos);
+ pos += xScale;
+ if (pos < event.spos())
+ continue;
+
+ int selectionStartPos = selectionStart - peoffset; // Offset transformed to event coords
+ int selectionStopPos = selectionStop - peoffset;
+
+ for (int k = 0; k < channels; ++k) {
+ int kk = k % f.channels();
+ int peak = (sa[kk].peak * (h - 1)) / yScale;
+ int rms = (sa[kk].rms * (h - 1)) / yScale;
+ if (peak > h)
+ peak = h;
+ if (rms > h)
+ rms = h;
+ QColor peak_color = QColor(Qt::darkGray);
+ QColor rms_color = QColor(Qt::black);
+
+ // Changed by T356. Reduces (but not eliminates) drawing artifacts.
+ //if (pos > selectionStartPos && pos < selectionStopPos) {
+ if (pos > selectionStartPos && pos <= selectionStopPos) {
+
+ peak_color = QColor(Qt::lightGray);
+ rms_color = QColor(Qt::white);
+ // Draw inverted
+ p.setPen(QColor(Qt::black));
+ p.drawLine(i, y - h + cc, i, y + h - cc );
+ }
+ p.setPen(peak_color);
+ p.drawLine(i, y - peak - cc, i, y + peak);
+ p.setPen(rms_color);
+ p.drawLine(i, y - rms - cc, i, y + rms);
+ y += 2 * h;
+ }
+ }
+ }
+ }
+ View::pdraw(p, rr);
+ }
+
+//---------------------------------------------------------
+// draw
+//---------------------------------------------------------
+
+void WaveView::draw(QPainter& p, const QRect& r)
+ {
+ unsigned x = r.x() < 0 ? 0 : r.x();
+ unsigned y = r.y() < 0 ? 0 : r.y();
+ int w = r.width();
+ int h = r.height();
+
+ unsigned x2 = x + w;
+ unsigned y2 = y + h;
+
+ //
+ // draw marker & centerline
+ //
+ p.setPen(Qt::red);
+ if (pos[0] >= x && pos[0] < x2) {
+ p.drawLine(pos[0], y, pos[0], y2);
+ }
+ p.setPen(Qt::blue);
+ if (pos[1] >= x && pos[1] < x2) {
+ p.drawLine(pos[1], y, pos[1], y2);
+ }
+ if (pos[2] >= x && pos[2] < x2)
+ p.drawLine(pos[2], y, pos[2], y2);
+
+ // Changed by T356. Support multiple (or none) selected parts.
+ //int n = curPart->track()->channels();
+ int n = 1;
+ if(curPart)
+ n = curPart->track()->channels();
+
+ int hn = h / n;
+ int hh = hn / 2;
+ for (int i = 0; i < n; ++i) {
+ int h2 = hn * i;
+ int center = hh + h2;
+ p.setPen(QColor(i & i ? Qt::red : Qt::blue));
+ p.drawLine(x, center, x2, center);
+ p.setPen(QColor(Qt::black));
+ p.drawLine(x, h2, x2, h2);
+ }
+ }
+
+//---------------------------------------------------------
+// getCaption
+//---------------------------------------------------------
+
+QString WaveView::getCaption() const
+ {
+
+ // Changed by T356. Support multiple (or none) selected parts.
+ //return QString("Part ") + curPart->name();
+ if(curPart)
+ return QString("Part ") + curPart->name();
+ else
+ return QString("Part ");
+
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void WaveView::songChanged(int flags)
+ {
+ // Is it simply a midi controller value adjustment? Forget it.
+ if(flags == SC_MIDI_CONTROLLER)
+ return;
+
+ if (flags & SC_SELECTION) {
+ startSample = MAXINT;
+ endSample = 0;
+ curPart = 0;
+ for (iPart p = editor->parts()->begin(); p != editor->parts()->end(); ++p) {
+ WavePart* part = (WavePart*)(p->second);
+ if (part->sn() == curPartId)
+ curPart = part;
+ int ssample = part->frame();
+ int esample = ssample + part->lenFrame();
+ if (ssample < startSample) {
+ startSample = ssample;
+ //printf("startSample = %d\n", startSample);
+ }
+ if (esample > endSample) {
+ endSample = esample;
+ //printf("endSample = %d\n", endSample);
+ }
+ }
+ }
+ if (flags & SC_CLIP_MODIFIED) {
+ redraw(); // Boring, but the only thing possible to do
+ }
+ if (flags & SC_TEMPO) {
+ setPos(0, song->cpos(), false);
+ setPos(1, song->lpos(), false);
+ setPos(2, song->rpos(), false);
+ }
+ redraw();
+ }
+
+//---------------------------------------------------------
+// setPos
+// set one of three markers
+// idx - 0-cpos 1-lpos 2-rpos
+// flag - emit followEvent()
+//---------------------------------------------------------
+
+void WaveView::setPos(int idx, unsigned val, bool adjustScrollbar)
+ {
+ val = tempomap.tick2frame(val);
+ if (pos[idx] == val)
+ return;
+ int opos = mapx(pos[idx]);
+ int npos = mapx(val);
+
+ if (adjustScrollbar && idx == 0) {
+ switch (song->follow()) {
+ case Song::NO:
+ break;
+ case Song::JUMP:
+ if (npos >= width()) {
+ int ppos = val - xorg - rmapxDev(width()/4);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ else if (npos < 0) {
+ int ppos = val - xorg - rmapxDev(width()*3/4);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ break;
+ case Song::CONTINUOUS:
+ if (npos > (width()*5)/8) {
+ int ppos = pos[idx] - xorg - rmapxDev(width()*5/8);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ else if (npos < (width()*3)/8) {
+ int ppos = pos[idx] - xorg - rmapxDev(width()*3/8);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ break;
+ }
+ }
+
+ int x;
+ int w = 1;
+ if (opos > npos) {
+ w += opos - npos;
+ x = npos;
+ }
+ else {
+ w += npos - opos;
+ x = opos;
+ }
+ pos[idx] = val;
+ redraw(QRect(x, 0, w, height()));
+ }
+
+//---------------------------------------------------------
+// viewMousePressEvent
+//---------------------------------------------------------
+
+void WaveView::viewMousePressEvent(QMouseEvent* event)
+ {
+ button = event->button();
+ unsigned x = event->x();
+
+ switch (button) {
+ case Qt::LeftButton:
+ if (mode == NORMAL) {
+ // redraw and reset:
+ if (selectionStart != selectionStop) {
+ selectionStart = selectionStop = 0;
+ redraw();
+ }
+ mode = DRAG;
+ dragstartx = x;
+ selectionStart = selectionStop = x;
+ }
+ break;
+
+ case Qt::MidButton:
+ case Qt::RightButton:
+ default:
+ break;
+ }
+ viewMouseMoveEvent(event);
+ }
+
+//---------------------------------------------------------
+// viewMouseReleaseEvent
+//---------------------------------------------------------
+void WaveView::viewMouseReleaseEvent(QMouseEvent* /*event*/)
+ {
+ button = Qt::NoButton;
+
+ if (mode == DRAG) {
+ mode = NORMAL;
+ //printf("selectionStart=%d selectionStop=%d\n", selectionStart, selectionStop);
+ }
+ }
+
+//---------------------------------------------------------
+// viewMouseMoveEvent
+//---------------------------------------------------------
+
+void WaveView::viewMouseMoveEvent(QMouseEvent* event)
+ {
+ unsigned x = event->x();
+ emit timeChanged(x);
+
+ int i;
+ switch (button) {
+ case Qt::LeftButton:
+ i = 0;
+ if (mode == DRAG) {
+ if (x < dragstartx) {
+ selectionStart = x;
+ selectionStop = dragstartx;
+ }
+ else {
+ selectionStart = dragstartx;
+ selectionStop = x;
+ }
+ }
+ break;
+ case Qt::MidButton:
+ i = 1;
+ break;
+ case Qt::RightButton:
+ i = 2;
+ break;
+ default:
+ return;
+ }
+ Pos p(tempomap.frame2tick(x), true);
+ song->setPos(i, p);
+ }
+
+//---------------------------------------------------------
+// range
+// returns range in samples
+//---------------------------------------------------------
+
+void WaveView::range(int* s, int *e)
+ {
+
+ PartList* lst = editor->parts();
+ if(lst->empty())
+ {
+ *s = 0;
+ *e = tempomap.tick2frame(song->len());
+ return;
+ }
+ int ps = song->len(), pe = 0;
+ int tps, tpe;
+ for(iPart ip = lst->begin(); ip != lst->end(); ++ip)
+ {
+ tps = ip->second->tick();
+ if(tps < ps)
+ ps = tps;
+ tpe = tps + ip->second->lenTick();
+ if(tpe > pe)
+ pe = tpe;
+ }
+ *s = tempomap.tick2frame(ps);
+ *e = tempomap.tick2frame(pe);
+ }
+
+//---------------------------------------------------------
+// cmd
+//---------------------------------------------------------
+void WaveView::cmd(int n)
+ {
+ int modifyoperation = -1;
+ double paramA = 0.0;
+
+ switch(n) {
+ case WaveEdit::CMD_SELECT_ALL:
+ if (!editor->parts()->empty()) {
+ iPart iBeg = editor->parts()->begin();
+ iPart iEnd = editor->parts()->end();
+ iEnd--;
+ WavePart* beg = (WavePart*) iBeg->second;
+ WavePart* end = (WavePart*) iEnd->second;
+ selectionStart = beg->frame();
+ selectionStop = end->frame() + end->lenFrame();
+ redraw();
+ }
+ break;
+
+ case WaveEdit::CMD_EDIT_EXTERNAL:
+ modifyoperation = EDIT_EXTERNAL;
+ break;
+
+ case WaveEdit::CMD_SELECT_NONE:
+ selectionStart = selectionStop = 0;
+ redraw();
+ break;
+
+ case WaveEdit::CMD_MUTE:
+ modifyoperation = MUTE;
+ break;
+
+ case WaveEdit::CMD_NORMALIZE:
+ modifyoperation = NORMALIZE;
+ break;
+
+ case WaveEdit::CMD_FADE_IN:
+ modifyoperation = FADE_IN;
+ break;
+
+ case WaveEdit::CMD_FADE_OUT:
+ modifyoperation = FADE_OUT;
+ break;
+
+ case WaveEdit::CMD_REVERSE:
+ modifyoperation = REVERSE;
+ break;
+
+ case WaveEdit::CMD_GAIN_FREE: {
+ EditGain* editGain = new EditGain(this, lastGainvalue);
+ if (editGain->exec() == QDialog::Accepted) {
+ lastGainvalue = editGain->getGain();
+ modifyoperation = GAIN;
+ paramA = (double)lastGainvalue / 100.0;
+ }
+ delete editGain;
+ }
+ break;
+
+ case WaveEdit::CMD_GAIN_200:
+ modifyoperation = GAIN;
+ paramA = 2.0;
+ break;
+
+ case WaveEdit::CMD_GAIN_150:
+ modifyoperation = GAIN;
+ paramA = 1.5;
+ break;
+
+ case WaveEdit::CMD_GAIN_75:
+ modifyoperation = GAIN;
+ paramA = 0.75;
+ break;
+
+ case WaveEdit::CMD_GAIN_50:
+ modifyoperation = GAIN;
+ paramA = 0.5;
+ break;
+
+ case WaveEdit::CMD_GAIN_25:
+ modifyoperation = GAIN;
+ paramA = 0.25;
+ break;
+
+ default:
+ break;
+ }
+
+ if (modifyoperation != -1) {
+ if (selectionStart == selectionStop) {
+ printf("No selection. Ignoring\n"); //@!TODO: Disable menu options when no selection
+ QMessageBox::information(this,
+ QString("MusE"),
+ QWidget::tr("No selection. Ignoring"));
+
+ return;
+ }
+
+ //if(!modifyWarnedYet)
+ //{
+ // modifyWarnedYet = true;
+ // if(QMessageBox::warning(this, QString("Muse"),
+ // tr("Warning! Muse currently operates directly on the sound file.\n"
+ // "Undo is supported, but NOT after exit, WITH OR WITHOUT A SAVE!\n"
+ // "If you are stuck, try deleting the associated .wca file and reloading."), tr("&Ok"), tr("&Cancel"),
+ // QString::null, 0, 1 ) != 0)
+ // return;
+ //}
+ modifySelection(modifyoperation, selectionStart, selectionStop, paramA);
+ }
+ }
+
+
+//---------------------------------------------------------
+// getSelection
+//---------------------------------------------------------
+WaveSelectionList WaveView::getSelection(unsigned startpos, unsigned stoppos)
+ {
+ WaveSelectionList selection;
+
+ for (iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip) {
+ WavePart* wp = (WavePart*)(ip->second);
+ unsigned part_offset = wp->frame();
+
+ EventList* el = wp->events();
+ //printf("eventlist length=%d\n",el->size());
+
+ for (iEvent e = el->begin(); e != el->end(); ++e) {
+ Event event = e->second;
+ if (event.empty())
+ continue;
+ SndFileR file = event.sndFile();
+ if (file.isNull())
+ continue;
+
+ unsigned event_offset = event.frame() + part_offset;
+ unsigned event_startpos = event.spos();
+ unsigned event_length = event.lenFrame() + event.spos();
+ unsigned event_end = event_offset + event_length;
+ //printf("startpos=%d stoppos=%d part_offset=%d event_offset=%d event_startpos=%d event_length=%d event_end=%d\n", startpos, stoppos, part_offset, event_offset, event_startpos, event_length, event_end);
+
+ if (!(event_end <= startpos || event_offset > stoppos)) {
+ int tmp_sx = startpos - event_offset + event_startpos;
+ int tmp_ex = stoppos - event_offset + event_startpos;
+ unsigned sx;
+ unsigned ex;
+
+ tmp_sx < (int)event_startpos ? sx = event_startpos : sx = tmp_sx;
+ tmp_ex > (int)event_length ? ex = event_length : ex = tmp_ex;
+
+ //printf("Event data affected: %d->%d filename:%s\n", sx, ex, file.name().latin1());
+ WaveEventSelection s;
+ s.file = file;
+ s.startframe = sx;
+ s.endframe = ex+1;
+ //printf("sx=%d ex=%d\n",sx,ex);
+ selection.push_back(s);
+ }
+ }
+ }
+
+ return selection;
+ }
+
+//---------------------------------------------------------
+// modifySelection
+//---------------------------------------------------------
+void WaveView::modifySelection(int operation, unsigned startpos, unsigned stoppos, double paramA)
+ {
+ song->startUndo();
+
+ WaveSelectionList selection = getSelection(startpos, stoppos);
+ for (iWaveSelection i = selection.begin(); i != selection.end(); i++) {
+ WaveEventSelection w = *i;
+ SndFileR& file = w.file;
+ unsigned sx = w.startframe;
+ unsigned ex = w.endframe;
+ unsigned file_channels = file.channels();
+
+ QString tmpWavFile = QString::null;
+ if (!getUniqueTmpfileName(tmpWavFile)) {
+ break;
+ }
+
+ audio->msgIdle(true); // Not good with playback during operations
+ SndFile tmpFile(tmpWavFile);
+ tmpFile.setFormat(file.format(), file_channels, file.samplerate());
+ if (tmpFile.openWrite()) {
+ audio->msgIdle(false);
+ printf("Could not open temporary file...\n");
+ break;
+ }
+
+ //
+ // Write out data that will be changed to temp file
+ //
+ unsigned tmpdatalen = ex - sx;
+ off_t tmpdataoffset = sx;
+ float* tmpdata[file_channels];
+
+ for (unsigned i=0; i<file_channels; i++) {
+ tmpdata[i] = new float[tmpdatalen];
+ }
+ file.seek(tmpdataoffset, 0);
+ file.readWithHeap(file_channels, tmpdata, tmpdatalen);
+ file.close();
+ tmpFile.write(file_channels, tmpdata, tmpdatalen);
+ tmpFile.close();
+
+ switch(operation)
+ {
+ case MUTE:
+ muteSelection(file_channels, tmpdata, tmpdatalen);
+ break;
+
+ case NORMALIZE:
+ normalizeSelection(file_channels, tmpdata, tmpdatalen);
+ break;
+
+ case FADE_IN:
+ fadeInSelection(file_channels, tmpdata, tmpdatalen);
+ break;
+
+ case FADE_OUT:
+ fadeOutSelection(file_channels, tmpdata, tmpdatalen);
+ break;
+
+ case REVERSE:
+ reverseSelection(file_channels, tmpdata, tmpdatalen);
+ break;
+
+ case GAIN:
+ applyGain(file_channels, tmpdata, tmpdatalen, paramA);
+ break;
+
+ case EDIT_EXTERNAL:
+ editExternal(file.format(), file.samplerate(), file_channels, tmpdata, tmpdatalen);
+ break;
+
+ default:
+ printf("Error: Default state reached in modifySelection\n");
+ break;
+
+ }
+
+ file.openWrite();
+ file.seek(tmpdataoffset, 0);
+ file.write(file_channels, tmpdata, tmpdatalen);
+ file.update();
+ file.close();
+ file.openRead();
+
+ for (unsigned i=0; i<file_channels; i++) {
+ delete[] tmpdata[i];
+ }
+
+ // Undo handling
+ song->cmdChangeWave(file.dirPath() + "/" + file.name(), tmpWavFile, sx, ex);
+ audio->msgIdle(false); // Not good with playback during operations
+ }
+ song->endUndo(SC_CLIP_MODIFIED);
+ redraw();
+ }
+
+//---------------------------------------------------------
+// muteSelection
+//---------------------------------------------------------
+void WaveView::muteSelection(unsigned channels, float** data, unsigned length)
+ {
+ // Set everything to 0!
+ for (unsigned i=0; i<channels; i++) {
+ for (unsigned j=0; j<length; j++) {
+ data[i][j] = 0;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// normalizeSelection
+//---------------------------------------------------------
+void WaveView::normalizeSelection(unsigned channels, float** data, unsigned length)
+ {
+ float loudest = 0.0;
+
+ for (unsigned i=0; i<channels; i++) {
+ for (unsigned j=0; j<length; j++) {
+ if (data[i][j] > loudest)
+ loudest = data[i][j];
+ }
+ }
+
+ double scale = 0.99 / (double)loudest;
+
+ for (unsigned i=0; i<channels; i++) {
+ for (unsigned j=0; j<length; j++) {
+ data[i][j] = (float) ((double)data[i][j] * scale);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// fadeInSelection
+//---------------------------------------------------------
+void WaveView::fadeInSelection(unsigned channels, float** data, unsigned length)
+ {
+ for (unsigned i=0; i<channels; i++) {
+ for (unsigned j=0; j<length; j++) {
+ double scale = (double) j / (double)length ;
+ data[i][j] = (float) ((double)data[i][j] * scale);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// fadeOutSelection
+//---------------------------------------------------------
+void WaveView::fadeOutSelection(unsigned channels, float** data, unsigned length)
+ {
+ for (unsigned i=0; i<channels; i++) {
+ for (unsigned j=0; j<length; j++) {
+ double scale = (double) (length - j) / (double)length ;
+ data[i][j] = (float) ((double)data[i][j] * scale);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// reverseSelection
+//---------------------------------------------------------
+void WaveView::reverseSelection(unsigned channels, float** data, unsigned length)
+ {
+ if(length <= 1)
+ return;
+ for (unsigned i=0; i<channels; i++) {
+ for (unsigned j=0; j<length/2; j++) {
+ float tmpl = data[i][j];
+ float tmpr = data[i][length - j - 1];
+ data[i][j] = tmpr;
+ data[i][length - j - 1] = tmpl;
+ }
+ }
+ }
+//---------------------------------------------------------
+// applyGain
+//---------------------------------------------------------
+void WaveView::applyGain(unsigned channels, float** data, unsigned length, double gain)
+ {
+ for (unsigned i=0; i<channels; i++) {
+ for (unsigned j=0; j<length; j++) {
+ data[i][j] = (float) ((double)data[i][j] * gain);
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// editExternal
+//---------------------------------------------------------
+void WaveView::editExternal(unsigned file_format, unsigned file_samplerate, unsigned file_channels, float** tmpdata, unsigned tmpdatalen)
+ {
+ // Create yet another tmp-file
+ QString exttmpFileName;
+ if (!getUniqueTmpfileName(exttmpFileName)) {
+ printf("Could not create temp file - aborting...\n");
+ return;
+ }
+
+ SndFile exttmpFile(exttmpFileName);
+ exttmpFile.setFormat(file_format, file_channels, file_samplerate);
+ if (exttmpFile.openWrite()) {
+ printf("Could not open temporary file...\n");
+ return;
+ }
+ // Write out change-data to this file:
+ exttmpFile.write(file_channels, tmpdata, tmpdatalen);
+ exttmpFile.close();
+
+ // Forkaborkabork
+ int pid = fork();
+ if (pid == 0) {
+ if (execlp(config.externalWavEditor.latin1(), config.externalWavEditor.latin1(), exttmpFileName.latin1(), NULL) == -1) {
+ perror("Failed to launch external editor");
+ // Get out of here
+
+
+ // cannot report error through gui, we are in another fork!
+ //@!TODO: Handle unsuccessful attempts
+ exit(99);
+ }
+ exit(0);
+ }
+ else if (pid == -1) {
+ perror("fork failed");
+ }
+ else {
+ int status;
+ waitpid(pid, &status, 0);
+ //printf ("status=%d\n",status);
+ if( WEXITSTATUS(status) != 0 ){
+ QMessageBox::warning(this, tr("MusE - external editor failed"),
+ tr("MusE was unable to launch the external editor\ncheck if the editor setting in:\n"
+ "Global Settings->Audio:External Waveditor\nis set to a valid editor."));
+ }
+
+ if (exttmpFile.openRead()) {
+ printf("Could not reopen temporary file!\n");
+ }
+ else {
+ // Re-read file again
+ exttmpFile.seek(0, 0);
+ size_t sz = exttmpFile.readWithHeap(file_channels, tmpdata, tmpdatalen);
+ if (sz != tmpdatalen) {
+ // File must have been shrunken - not good. Alert user.
+ QMessageBox::critical(this, tr("MusE - file size changed"),
+ tr("When editing in external editor - you should not change the filesize\nsince it must fit the selected region.\n\nMissing data is muted"));
+ for (unsigned i=0; i<file_channels; i++) {
+ for (unsigned j=sz; j<tmpdatalen; j++) {
+ tmpdata[i][j] = 0;
+ }
+ }
+ }
+ }
+ QDir dir = exttmpFile.dirPath();
+ dir.remove(exttmpFileName);
+ dir.remove(exttmpFile.basename() + ".wca");
+ }
+ }
+
+//---------------------------------------------------------
+// getUniqueTmpfileName
+//---------------------------------------------------------
+bool WaveView::getUniqueTmpfileName(QString& newFilename)
+ {
+ // Check if tmp-directory exists under project path
+ QString tmpWavDir = museProject + "/tmp_musewav"; //!@TODO: Don't hardcode like this
+ QFileInfo tmpdirfi(tmpWavDir);
+ if (!tmpdirfi.isDir()) {
+ // Try to create a tmpdir
+ QDir projdir(museProject);
+ if (!projdir.mkdir("tmp_musewav")) {
+ printf("Could not create undo dir!\n");
+ return false;
+ }
+ }
+
+
+ tmpdirfi.setFile(tmpWavDir);
+
+ if (!tmpdirfi.isWritable()) {
+ printf("Temp directory is not writable - aborting\n");
+ return false;
+ }
+
+ QDir tmpdir = tmpdirfi.dir();
+
+ // Find a new filename
+ for (int i=0; i<10000; i++) {
+ QString filename = "muse_tmp";
+ filename.append(QString::number(i));
+ filename.append(".wav");
+
+ if (!tmpdir.exists(tmpWavDir +"/" + filename)) {
+ newFilename = tmpWavDir + "/" + filename;
+ return true;
+ }
+
+ }
+
+ printf("Could not find a suitable tmpfilename (more than 10000 tmpfiles in tmpdir - clean up!\n");
+ return false;
+ }
+
+
diff --git a/muse2/muse/waveedit/waveview.h b/muse2/muse/waveedit/waveview.h
new file mode 100644
index 00000000..1e2c7469
--- /dev/null
+++ b/muse2/muse/waveedit/waveview.h
@@ -0,0 +1,98 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: waveview.h,v 1.3.2.6 2009/02/02 21:38:01 terminator356 Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef WAVE_VIEW_H
+#define WAVE_VIEW_H
+
+#include "view.h"
+#include <qwidget.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include "wave.h"
+
+class PartList;
+class QPainter;
+class QRect;
+class WavePart;
+class MidiEditor;
+class SndFileR;
+
+struct WaveEventSelection {
+ SndFileR file;
+ unsigned startframe;
+ unsigned endframe;
+ };
+
+typedef std::list<WaveEventSelection> WaveSelectionList;
+typedef std::list<WaveEventSelection>::iterator iWaveSelection;
+
+//---------------------------------------------------------
+// WaveView
+//---------------------------------------------------------
+
+class WaveView : public View {
+ MidiEditor* editor;
+ unsigned pos[3];
+ int yScale;
+ int button;
+ int startSample;
+ int endSample;
+
+ WavePart* curPart;
+ int curPartId;
+
+ enum { NORMAL, DRAG } mode;
+ enum { MUTE = 0, NORMALIZE, FADE_IN, FADE_OUT, REVERSE, GAIN, EDIT_EXTERNAL }; //!< Modify operations
+
+ unsigned selectionStart, selectionStop, dragstartx;
+
+ Q_OBJECT
+ virtual void pdraw(QPainter&, const QRect&);
+ virtual void draw(QPainter&, const QRect&);
+ virtual void viewMousePressEvent(QMouseEvent*);
+ virtual void viewMouseMoveEvent(QMouseEvent*);
+ virtual void viewMouseReleaseEvent(QMouseEvent*);
+
+ bool getUniqueTmpfileName(QString& newFilename); //!< Generates unique filename for temporary SndFile
+ WaveSelectionList getSelection(unsigned startpos, unsigned stoppos);
+
+ int lastGainvalue; //!< Stores the last used gainvalue when specifiying gain value in the editgain dialog
+ void modifySelection(int operation, unsigned startpos, unsigned stoppos, double paramA); //!< Modifies selection
+
+ void muteSelection(unsigned channels, float** data, unsigned length); //!< Mutes selection
+ void normalizeSelection(unsigned channels, float** data, unsigned length); //!< Normalizes selection
+ void fadeInSelection(unsigned channels, float** data, unsigned length); //!< Linear fade in of selection
+ void fadeOutSelection(unsigned channels, float** data, unsigned length); //!< Linear fade out of selection
+ void reverseSelection(unsigned channels, float** data, unsigned length); //!< Reverse selection
+ void applyGain(unsigned channels, float** data, unsigned length, double gain); //!< Apply gain to selection
+
+ void editExternal(unsigned file_format, unsigned file_samplerate, unsigned channels, float** data, unsigned length);
+
+ //void applyLadspa(unsigned channels, float** data, unsigned length); //!< Apply LADSPA plugin on selection
+
+
+ private slots:
+ void setPos(int idx, unsigned val, bool adjustScrollbar);
+
+ public slots:
+ void setYScale(int);
+ void songChanged(int type);
+
+ signals:
+ void followEvent(int);
+ void timeChanged(unsigned);
+
+ public:
+ WaveView(MidiEditor*, QWidget* parent, int xscale, int yscale);
+ QString getCaption() const;
+ void range(int*, int*);
+ void cmd(int n);
+ WavePart* part() { return curPart; }
+ };
+
+#endif
+
diff --git a/muse2/muse/waveevent.cpp b/muse2/muse/waveevent.cpp
new file mode 100644
index 00000000..98bfe8cc
--- /dev/null
+++ b/muse2/muse/waveevent.cpp
@@ -0,0 +1,453 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: waveevent.cpp,v 1.9.2.6 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2000-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "audioconvert.h"
+#include "globals.h"
+#include "event.h"
+#include "waveevent.h"
+#include "xml.h"
+#include "wave.h"
+#include <iostream>
+#include <math.h>
+
+// Added by Tim. p3.3.18
+//#define USE_SAMPLERATE
+//
+//#define WAVEEVENT_DEBUG
+//#define WAVEEVENT_DEBUG_PRC
+
+//---------------------------------------------------------
+// WaveEvent
+//---------------------------------------------------------
+
+WaveEventBase::WaveEventBase(EventType t)
+ : EventBase(t)
+ {
+ deleted = false;
+ }
+
+//---------------------------------------------------------
+// WaveEventBase::clone
+//---------------------------------------------------------
+
+EventBase* WaveEventBase::clone()
+{
+ return new WaveEventBase(*this);
+}
+
+//---------------------------------------------------------
+// WaveEvent::mid
+//---------------------------------------------------------
+
+EventBase* WaveEventBase::mid(unsigned b, unsigned e)
+ {
+ WaveEventBase* ev = new WaveEventBase(*this);
+ unsigned fr = frame();
+ unsigned start = fr - b;
+ if(b > fr)
+ {
+ start = 0;
+ ev->setSpos(spos() + b - fr);
+ }
+ unsigned end = endFrame();
+
+ if (e < end)
+ end = e;
+
+ ev->setFrame(start);
+ ev->setLenFrame(end - b - start);
+ return ev;
+ }
+
+//---------------------------------------------------------
+// dump
+//---------------------------------------------------------
+
+void WaveEventBase::dump(int n) const
+ {
+ EventBase::dump(n);
+ }
+
+//---------------------------------------------------------
+// WaveEventBase::read
+//---------------------------------------------------------
+
+void WaveEventBase::read(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ case Xml::Attribut:
+ return;
+ case Xml::TagStart:
+ if (tag == "poslen")
+ PosLen::read(xml, "poslen");
+ else if (tag == "frame")
+ _spos = xml.parseInt();
+ else if (tag == "file") {
+ SndFile* wf = getWave(xml.parse1(), true);
+ if (wf) {
+ f = SndFileR(wf);
+ }
+ }
+ else
+ xml.unknown("Event");
+ break;
+ case Xml::TagEnd:
+ if (tag == "event") {
+ Pos::setType(FRAMES); // DEBUG
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+//void WaveEventBase::write(int level, Xml& xml, const Pos& offset) const
+void WaveEventBase::write(int level, Xml& xml, const Pos& offset, bool forcePath) const
+ {
+ if (f.isNull())
+ return;
+ xml.tag(level++, "event");
+ PosLen wpos(*this);
+ wpos += offset;
+// if (offset)
+// wpos.setTick(wpos.tick() + offset);
+ wpos.write(level, xml, "poslen");
+ xml.intTag(level, "frame", _spos); // offset in wave file
+
+ //
+ // waves in the project dirctory are stored
+ // with relative path name, others with absolute path
+ //
+ QString path = f.dirPath();
+
+ //if (path.contains(museProject)) {
+ if (!forcePath && path.contains(museProject)) {
+ // extract museProject.
+ QString newName = f.path().remove(museProject+"/");
+ xml.strTag(level, "file", newName);
+ }
+ else
+ xml.strTag(level, "file", f.path());
+ xml.etag(level, "event");
+ }
+
+//void WaveEventBase::read(unsigned offset, float** buffer, int channel, int n, bool overwrite)
+//void WaveEventBase::readAudio(unsigned offset, float** buffer, int channel, int n, bool doSeek, bool overwrite)
+//off_t WaveEventBase::readAudio(SRC_STATE* src_state, off_t sfCurFrame, unsigned offset, float** buffer, int channel, int n, bool doSeek, bool overwrite)
+//off_t WaveEventBase::readAudio(AudioConverter* audConv, off_t sfCurFrame, unsigned offset, float** buffer, int channel, int n, bool doSeek, bool overwrite)
+// p3.3.33
+void WaveEventBase::readAudio(WavePart* part, unsigned offset, float** buffer, int channel, int n, bool doSeek, bool overwrite)
+{
+ // Added by Tim. p3.3.17
+ #ifdef WAVEEVENT_DEBUG_PRC
+ printf("WaveEventBase::readAudio audConv:%p sfCurFrame:%ld offset:%u channel:%d n:%d\n", audConv, sfCurFrame, offset, channel, n);
+ #endif
+
+ // Changed by Tim. p3.3.18
+ #ifdef USE_SAMPLERATE
+
+ // TODO:
+ >>>>>>>>>>>+++++++++++++++++++++++++++++
+ // If we have a valid audio converter then use it to do the processing. Otherwise just a normal seek + read.
+ if(audConv)
+ //sfCurFrame = audConv->process(f, sfCurFrame, offset + _spos, buffer, channel, n, doSeek, overwrite);
+ sfCurFrame = audConv->readAudio(f, sfCurFrame, offset, buffer, channel, n, doSeek, overwrite);
+ else
+ {
+ if(!f.isNull())
+ {
+ sfCurFrame = f.seek(offset + _spos, 0);
+ sfCurFrame += f.read(channel, buffer, n, overwrite);
+ }
+ }
+ //return sfCurFrame;
+ return;
+
+ /*
+ unsigned fsrate = f.samplerate();
+ int fchan = f.channels();
+ off_t frame = offset + _spos;
+ //bool resample = src_state && ((unsigned)sampleRate != fsrate);
+ bool resample = audConv && audConv->isValid() && ((unsigned)sampleRate != fsrate);
+
+ // Is a 'transport' seek requested? (Not to be requested with every read! Should only be for 'first read' seeks, or positional 'transport' seeks.)
+ // Due to the support of sound file references in MusE, seek must ALWAYS be done before read, as before,
+ // except now we alter the seek position if sample rate conversion is being used and remember the seek positions.
+ if(doSeek)
+ {
+ if(!resample)
+ {
+ // Sample rates are the same. Just a regular seek, no conversion.
+ sfCurFrame = f.seek(frame, 0);
+ }
+ else
+ {
+ // Sample rates are different. Seek to a calculated 'sample rate ratio factored' position.
+
+ double srcratio = (double)fsrate / (double)sampleRate;
+ //long inSize = long((double)frames * _src_ratio) + 1 // From MusE-2 file converter.
+ off_t newfr = (off_t)floor(((double)frame * srcratio)); // From simplesynth.
+
+ //_sfCurFrame = sf_seek(sf, newfr, 0);
+ sfCurFrame = f.seek(newfr, 0);
+
+ // Added by Tim. p3.3.17
+ #ifdef WAVEEVENT_DEBUG_PRC
+ printf("WaveEventBase::readAudio Seek frame:%ld converted to frame:%ld _sfCurFrame:%ld\n", frame, newfr, sfCurFrame);
+ #endif
+
+ // Reset the src converter. It's current state is meaningless now.
+ //int srcerr = src_reset(src_state);
+ int srcerr = audConv->reset();
+ if(srcerr != 0)
+ printf("WaveEventBase::readAudio Converter reset failed: %s\n", src_strerror(srcerr));
+ }
+ }
+ else
+ {
+ // No seek requested. Are the rates the same?
+ if(!resample)
+ // Sample rates are the same. Just a regular seek, no conversion.
+ sfCurFrame = f.seek(frame, 0);
+ else
+ {
+ // Added by Tim. p3.3.17
+ #ifdef WAVEEVENT_DEBUG_PRC
+ printf("WaveEventBase::readAudio No 'transport' seek, rates different. Seeking to _sfCurFrame:%ld\n", sfCurFrame);
+ #endif
+
+ // Sample rates are different. We can't just tell seek to go to an absolute calculated position,
+ // since the last position can vary - it might not be what the calculated position is.
+ // We must use the last position left by SRC conversion, ie. let the file position progress on its own.
+ sfCurFrame = f.seek(sfCurFrame, 0);
+ }
+ }
+
+ // Do we not need to resample?
+ if(!resample)
+ {
+ return sfCurFrame + f.read(channel, buffer, n, overwrite);
+ }
+
+ size_t rn;
+
+ if((sampleRate == 0) || (fsrate == 0))
+ {
+ if(debugMsg)
+ printf("WaveEventBase::readAudio Using SRC: Error: sampleRate or file samplerate is zero!\n");
+ return sfCurFrame;
+ }
+
+ // Ratio is defined as output sample rate over input samplerate.
+ double srcratio = (double)sampleRate / (double)fsrate;
+ long outFrames = n;
+ //long outSize = outFrames * channel;
+ long outSize = outFrames * fchan;
+
+ //long inSize = long(outSize * srcratio) + 1 // From MusE-2 file converter.
+ //long inSize = (long)floor(((double)outSize / srcratio)); // From simplesynth.
+ //long inFrames = (long)floor(((double)outFrames / srcratio)); // From simplesynth.
+ long inFrames = (long)ceil(((double)outFrames / srcratio)); // From simplesynth.
+ //long inFrames = (long)floor(double(outFrames * sfinfo.samplerate) / double(sampleRate)); // From simplesynth.
+
+ // Extra input compensation - sometimes src requires more input frames than expected in order to
+ // always get a reliable number of used out frames !
+ //inFrames = inFrames / (srcratio / 2.0);
+ long inComp = 10;
+ inFrames += inComp;
+
+ long inSize = inFrames * fchan;
+ //long inSize = inFrames * channel;
+
+ float inbuffer[inSize];
+ float outbuffer[outSize];
+
+ //float* poutbuf;
+
+ // If the number of file channels is the same as the process channels AND we want overwrite, we can get away with direct copying.
+ //if(overwrite && channel == fchan)
+ // Point the out buffer directly at the return buffers.
+ // poutbuf = buffer;
+ //else
+ // Point the out buffer at our local buffers.
+ // poutbuf = &outbuffer[0];
+
+ // Converter channels are fixed at creation time! Can't change them on the fly. Can't use 'channel' paramter.
+ //rn = f.read(inbuffer, inFrames);
+ rn = f.readDirect(inbuffer, inFrames);
+
+ // convert
+ SRC_DATA srcdata;
+ srcdata.data_in = inbuffer;
+ srcdata.data_out = outbuffer;
+ //srcdata.data_out = poutbuf;
+ //srcdata.input_frames = inSize;
+ srcdata.input_frames = rn;
+ srcdata.output_frames = outFrames;
+ srcdata.end_of_input = ((long)rn != inFrames);
+ srcdata.src_ratio = srcratio;
+
+ #ifdef WAVEEVENT_DEBUG_PRC
+ printf("WaveEventBase::readAudio %s processing converter... inFrames:%ld inSize:%ld outFrames:%ld outSize:%ld rn:%d",
+ f.name().latin1(), inFrames, inSize, outFrames, outSize, rn);
+ #endif
+
+ //int srcerr = src_process(src_state, &srcdata);
+ int srcerr = audConv->process(&srcdata);
+ if(srcerr != 0)
+ {
+ printf("\nWaveEventBase::readAudio SampleRate converter process failed: %s\n", src_strerror(srcerr));
+ return sfCurFrame += rn;
+ }
+
+ #ifdef WAVEEVENT_DEBUG_PRC
+ printf(" frames used in:%ld out:%ld\n", srcdata.input_frames_used, srcdata.output_frames_gen);
+ #endif
+
+ // If the number of frames read by the soundfile equals the input frames, go back.
+ // Otherwise we have reached the end of the file, so going back is useless since
+ // there shouldn't be any further calls. (Definitely get buffer underruns if further calls!)
+ if((long)rn == inFrames)
+ {
+ // Go back by the amount of unused frames.
+ sf_count_t seekn = inFrames - srcdata.input_frames_used;
+ if(seekn != 0)
+ {
+ #ifdef WAVEEVENT_DEBUG_PRC
+ printf("WaveEventBase::readAudio Seek-back by:%d\n", seekn);
+ #endif
+ sfCurFrame = f.seek(-seekn, SEEK_CUR);
+ }
+ else
+ sfCurFrame += rn;
+ }
+ else
+ sfCurFrame += rn;
+
+ if(debugMsg)
+ {
+ if(srcdata.output_frames_gen != outFrames)
+ printf("WaveEventBase::readAudio %s output_frames_gen:%ld != outFrames:%ld outSize:%ld inFrames:%ld srcdata.input_frames_used:%ld inSize:%ld rn:%d\n",
+ f.name().latin1(), srcdata.output_frames_gen, outFrames, outSize, inFrames, srcdata.input_frames_used, inSize, rn);
+ }
+
+ if(inFrames != (long)rn)
+ {
+ if(debugMsg)
+ printf("WaveEventBase::readAudio %s rn:%zd != inFrames:%ld output_frames_gen:%ld outFrames:%ld outSize:%ld srcdata.input_frames_used:%ld inSize:%ld\n",
+ f.name().latin1(), rn, inFrames, srcdata.output_frames_gen, outFrames, outSize, srcdata.input_frames_used, inSize);
+
+ // We've reached the end of the file. Convert the number of frames read.
+ //rn = (double)rn * srcratio + 1;
+ rn = (long)floor((double)rn * srcratio);
+ if(rn > (size_t)outFrames)
+ rn = outFrames;
+ }
+ else
+ if(srcdata.output_frames_gen != outFrames)
+ {
+ // SRC didn't give us the number of frames we requested.
+ // This can occasionally be radically different from the requested frames, or zero,
+ // even when ample excess input frames are supplied.
+ // We're not done converting yet - we haven't reached the end of the file.
+ // We must do something with the buffer. So let's zero whatever SRC didn't fill.
+ // FIXME: Instead of zeroing, try processing more input data until the out buffer is full.
+ long b = srcdata.output_frames_gen * channel;
+ long e = outFrames * channel;
+ for(long i = b; i < e; ++i)
+ outbuffer[i] = 0.0f;
+ //poutbuf[i] = 0.0f;
+ rn = outFrames;
+ }
+ else
+ rn = outFrames;
+
+ float* poutbuf = &outbuffer[0];
+ if(fchan == channel)
+ {
+ if(overwrite)
+ for (size_t i = 0; i < rn; ++i)
+ {
+ for(int ch = 0; ch < channel; ++ch)
+ *(buffer[ch] + i) = *poutbuf++;
+ }
+ else
+ for(size_t i = 0; i < rn; ++i)
+ {
+ for(int ch = 0; ch < channel; ++ch)
+ *(buffer[ch] + i) += *poutbuf++;
+ }
+ }
+ else if((fchan == 2) && (channel == 1))
+ {
+ // stereo to mono
+ if(overwrite)
+ for(size_t i = 0; i < rn; ++i)
+ *(buffer[0] + i) = poutbuf[i + i] + poutbuf[i + i + 1];
+ else
+ for(size_t i = 0; i < rn; ++i)
+ *(buffer[0] + i) += poutbuf[i + i] + poutbuf[i + i + 1];
+ }
+ else if((fchan == 1) && (channel == 2))
+ {
+ // mono to stereo
+ if(overwrite)
+ for(size_t i = 0; i < rn; ++i)
+ {
+ float data = *poutbuf++;
+ *(buffer[0]+i) = data;
+ *(buffer[1]+i) = data;
+ }
+ else
+ for(size_t i = 0; i < rn; ++i)
+ {
+ float data = *poutbuf++;
+ *(buffer[0]+i) += data;
+ *(buffer[1]+i) += data;
+ }
+ }
+ else
+ {
+ if(debugMsg)
+ printf("WaveEventBase::readAudio Channel mismatch: source chans:%d -> dst chans:%d\n", fchan, channel);
+ }
+
+ return sfCurFrame;
+ */
+
+
+ #else
+ if(f.isNull())
+ return;
+ //return sfCurFrame;
+
+ //sfCurFrame = f.seek(offset + _spos, 0);
+ //sfCurFrame += f.read(channel, buffer, n, overwrite);
+ f.seek(offset + _spos, 0);
+ f.read(channel, buffer, n, overwrite);
+
+ // p3.3.41
+ //fprintf(stderr, "WaveEventBase::readAudio data: n:%ld %e %e %e %e\n", n, buffer[0][0], buffer[0][1], buffer[0][2], buffer[0][3]);
+
+
+ //return sfCurFrame;
+ return;
+ #endif
+
+}
+
diff --git a/muse2/muse/waveevent.h b/muse2/muse/waveevent.h
new file mode 100644
index 00000000..4ea4918b
--- /dev/null
+++ b/muse2/muse/waveevent.h
@@ -0,0 +1,64 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: waveevent.h,v 1.6.2.4 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __WAVE_EVENT_H__
+#define __WAVE_EVENT_H__
+
+//#include <samplerate.h>
+#include <sys/types.h>
+
+#include "eventbase.h"
+
+class AudioConverter;
+class WavePart;
+
+//---------------------------------------------------------
+// WaveEvent
+//---------------------------------------------------------
+
+class WaveEventBase : public EventBase {
+ QString _name;
+ SndFileR f;
+ int _spos; // start sample position in WaveFile
+ bool deleted;
+
+ // p3.3.31
+ //virtual EventBase* clone() { return new WaveEventBase(*this); }
+ virtual EventBase* clone();
+
+ public:
+ WaveEventBase(EventType t);
+ virtual ~WaveEventBase() {}
+
+ virtual void read(Xml&);
+ //virtual void write(int, Xml&, const Pos& offset) const;
+ virtual void write(int, Xml&, const Pos& offset, bool forcePath = false) const;
+ virtual EventBase* mid(unsigned, unsigned);
+
+ virtual void dump(int n = 0) const;
+
+ virtual const QString name() const { return _name; }
+ virtual void setName(const QString& s) { _name = s; }
+ virtual int spos() const { return _spos; }
+ virtual void setSpos(int s) { _spos = s; }
+ virtual SndFileR sndFile() const { return f; }
+ virtual void setSndFile(SndFileR& sf) { f = sf; }
+
+ // Changed by Tim. p3.3.17
+ //virtual void read(unsigned offset, float** bpp, int channels, int nn, bool overwrite = true);
+ //virtual void readAudio(unsigned /*offset*/, float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/);
+ //virtual off_t readAudio(SRC_STATE* /*src_state*/, off_t /*sfCurFrame*/, unsigned /*offset*/,
+ // float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/);
+ //virtual off_t readAudio(AudioConverter* /*audConv*/, off_t /*sfCurFrame*/, unsigned /*offset*/,
+ // float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/);
+ virtual void readAudio(WavePart* /*part*/, unsigned /*offset*/,
+ float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/);
+ };
+
+#endif
+
diff --git a/muse2/muse/wavetrack.cpp b/muse2/muse/wavetrack.cpp
new file mode 100644
index 00000000..0c2298a8
--- /dev/null
+++ b/muse2/muse/wavetrack.cpp
@@ -0,0 +1,360 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: wavetrack.cpp,v 1.15.2.12 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "track.h"
+#include "event.h"
+#include "audio.h"
+#include "wave.h"
+#include "xml.h"
+#include "song.h"
+#include "globals.h"
+#include "gconfig.h"
+#include "al/dsp.h"
+
+// Added by Tim. p3.3.18
+//#define WAVETRACK_DEBUG
+
+//---------------------------------------------------------
+// fetchData
+// called from prefetch thread
+//---------------------------------------------------------
+
+//void WaveTrack::fetchData(unsigned pos, unsigned samples, float** bp)
+void WaveTrack::fetchData(unsigned pos, unsigned samples, float** bp, bool doSeek)
+ {
+ // Added by Tim. p3.3.17
+ #ifdef WAVETRACK_DEBUG
+ printf("WaveTrack::fetchData %s samples:%lu pos:%u\n", name().latin1(), samples, pos);
+ #endif
+
+ // reset buffer to zero
+ for (int i = 0; i < channels(); ++i)
+ memset(bp[i], 0, samples * sizeof(float));
+
+ // p3.3.29
+ // Process only if track is not off.
+ if(!off())
+ {
+
+ PartList* pl = parts();
+ unsigned n = samples;
+ for (iPart ip = pl->begin(); ip != pl->end(); ++ip) {
+ WavePart* part = (WavePart*)(ip->second);
+ // Changed by Tim. p3.3.17
+ //if (part->mute() || isMute())
+ if (part->mute())
+ continue;
+
+ unsigned p_spos = part->frame();
+ unsigned p_epos = p_spos + part->lenFrame();
+ if (pos + n < p_spos)
+ break;
+ if (pos >= p_epos)
+ continue;
+
+ EventList* events = part->events();
+ for (iEvent ie = events->begin(); ie != events->end(); ++ie) {
+ Event& event = ie->second;
+ unsigned e_spos = event.frame() + p_spos;
+ unsigned nn = event.lenFrame();
+ unsigned e_epos = e_spos + nn;
+
+ if (pos + n < e_spos)
+ break;
+ if (pos >= e_epos)
+ continue;
+
+ int offset = e_spos - pos;
+
+ unsigned srcOffset, dstOffset;
+ if (offset > 0) {
+ nn = n - offset;
+ srcOffset = 0;
+ dstOffset = offset;
+ }
+ else {
+ srcOffset = -offset;
+ dstOffset = 0;
+
+ nn += offset;
+ if (nn > n)
+ nn = n;
+ }
+ float* bpp[channels()];
+ for (int i = 0; i < channels(); ++i)
+ bpp[i] = bp[i] + dstOffset;
+
+ // By T356. Allow overlapping parts or events to mix together !
+ // Since the buffers are cleared above, just read and add (don't overwrite) the samples.
+ //event.read(srcOffset, bpp, channels(), nn);
+ //event.read(srcOffset, bpp, channels(), nn, false);
+ //event.readAudio(srcOffset, bpp, channels(), nn, doSeek, false);
+ // p3.3.33
+ event.readAudio(part, srcOffset, bpp, channels(), nn, doSeek, false);
+
+ }
+ }
+ }
+
+ if(config.useDenormalBias) {
+ // add denormal bias to outdata
+ for (int i = 0; i < channels(); ++i)
+ for (int j = 0; j < samples; ++j)
+ {
+ bp[i][j] +=denormalBias;
+
+ /*
+ // p3.3.41
+ if(j & 1)
+ bp[i][j] -=denormalBias;
+ else
+ bp[i][j] +=denormalBias;
+ */
+ }
+ }
+
+ // p3.3.41
+ //fprintf(stderr, "WaveTrack::fetchData data: samples:%ld %e %e %e %e\n", samples, bp[0][0], bp[0][1], bp[0][2], bp[0][3]);
+
+ _prefetchFifo.add();
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void WaveTrack::write(int level, Xml& xml) const
+ {
+ xml.tag(level++, "wavetrack");
+ AudioTrack::writeProperties(level, xml);
+ const PartList* pl = cparts();
+ for (ciPart p = pl->begin(); p != pl->end(); ++p)
+ p->second->write(level, xml);
+ xml.etag(level, "wavetrack");
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void WaveTrack::read(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "part") {
+ //Part* p = newPart();
+ //p->read(xml);
+ Part* p = 0;
+ p = readXmlPart(xml, this);
+ if(p)
+ parts()->add(p);
+ }
+ else if (AudioTrack::readProperties(xml, tag))
+ xml.unknown("WaveTrack");
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if (tag == "wavetrack") {
+ mapRackPluginsToControllers();
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// newPart
+//---------------------------------------------------------
+
+Part* WaveTrack::newPart(Part*p, bool clone)
+ {
+ WavePart* part = clone ? new WavePart(this, p->events()) : new WavePart(this);
+ if (p) {
+ part->setName(p->name());
+ part->setColorIndex(p->colorIndex());
+
+ *(PosLen*)part = *(PosLen*)p;
+ part->setMute(p->mute());
+ }
+
+ if(clone)
+ //p->chainClone(part);
+ chainClone(p, part);
+
+ return part;
+ }
+
+//---------------------------------------------------------
+// getData
+//---------------------------------------------------------
+
+bool WaveTrack::getData(unsigned framePos, int channels, unsigned nframe, float** bp)
+ {
+ //if(debugMsg)
+ // printf("WaveTrack::getData framePos:%u channels:%d nframe:%u processed?:%d\n", framePos, channels, nframe, processed());
+
+ if ((song->bounceTrack != this) && !noInRoute()) {
+ RouteList* irl = inRoutes();
+ iRoute i = irl->begin();
+ if(i->track->isMidiTrack())
+ {
+ if(debugMsg)
+ printf("WaveTrack::getData: Error: First route is a midi track route!\n");
+ return false;
+ }
+ // p3.3.38
+ //((AudioTrack*)i->track)->copyData(framePos, channels, nframe, bp);
+ ((AudioTrack*)i->track)->copyData(framePos, channels,
+ //(i->track->type() == Track::AUDIO_SOFTSYNTH && i->channel != -1) ? i->channel : 0,
+ i->channel,
+ i->channels,
+ nframe, bp);
+
+ ++i;
+ for (; i != irl->end(); ++i)
+ {
+ if(i->track->isMidiTrack())
+ {
+ if(debugMsg)
+ printf("WaveTrack::getData: Error: Route is a midi track route!\n");
+ //return false;
+ continue;
+ }
+ // p3.3.38
+ //((AudioTrack*)i->track)->addData(framePos, channels, nframe, bp);
+ ((AudioTrack*)i->track)->addData(framePos, channels,
+ //(i->track->type() == Track::AUDIO_SOFTSYNTH && i->channel != -1) ? i->channel : 0,
+ i->channel,
+ i->channels,
+ nframe, bp);
+
+ }
+ if (recordFlag()) {
+ if (audio->isRecording() && recFile()) {
+ if (audio->freewheel()) {
+ }
+ else {
+ if (fifo.put(channels, nframe, bp, audio->pos().frame()))
+ printf("WaveTrack::getData(%d, %d, %d): fifo overrun\n",
+ framePos, channels, nframe);
+ }
+ }
+ return true;
+ }
+ }
+ if (!audio->isPlaying())
+ return false;
+
+ // Removed by T356. Multiple out route cacheing now handled by AudioTrack::copyData and ::addData.
+ /*
+ if (outRoutes()->size() > 1) {
+ if (bufferPos != framePos) {
+ // Added by Tim. p3.3.16
+ printf("WaveTrack::getData bufferPos:%d != framePos\n", bufferPos);
+
+ bufferPos = framePos;
+ if (audio->freewheel()) {
+ // when freewheeling, read data direct from file:
+ fetchData(bufferPos, nframe, outBuffers);
+ }
+ else {
+ unsigned pos;
+ if (_prefetchFifo.get(channels, nframe, outBuffers, &pos)) {
+ printf("WaveTrack::getData(%s) fifo underrun\n",
+ name().latin1());
+ return false;
+ }
+ if (pos != framePos) {
+ printf("fifo get error expected %d, got %d\n",
+ framePos, pos);
+ if (debugMsg)
+ printf("fifo get error expected %d, got %d\n",
+ framePos, pos);
+ while (pos < framePos) {
+ if (_prefetchFifo.get(channels, nframe, bp, &pos)) {
+ printf("WaveTrack::getData(%s) fifo underrun\n",
+ name().latin1());
+ return false;
+ }
+ }
+ }
+ }
+ }
+ for (int i = 0; i < channels; ++i)
+ //memcpy(bp[i], outBuffers[i], nframe * sizeof(float));
+ AL::dsp->cpy(bp[i], outBuffers[i], nframe);
+ }
+ else {
+ */
+
+ //printf("WaveTrack::getData no out routes\n");
+
+ if (audio->freewheel()) {
+
+ // when freewheeling, read data direct from file:
+ // Indicate do not seek file before each read.
+ // Changed by Tim. p3.3.17
+ //fetchData(framePos, nframe, bp);
+ fetchData(framePos, nframe, bp, false);
+
+ }
+ else {
+ unsigned pos;
+ if (_prefetchFifo.get(channels, nframe, bp, &pos)) {
+ printf("WaveTrack::getData(%s) fifo underrun\n",
+ name().latin1());
+ return false;
+ }
+ if (pos != framePos) {
+ if (debugMsg)
+ printf("fifo get error expected %d, got %d\n",
+ framePos, pos);
+ while (pos < framePos) {
+ if (_prefetchFifo.get(channels, nframe, bp, &pos)) {
+ printf("WaveTrack::getData(%s) fifo underrun\n",
+ name().latin1());
+ return false;
+ }
+ }
+ }
+
+ // p3.3.41
+ //fprintf(stderr, "WaveTrack::getData %s data: nframe:%ld %e %e %e %e\n", name().latin1(), nframe, bp[0][0], bp[0][1], bp[0][2], bp[0][3]);
+
+ }
+ //}
+ return true;
+ }
+
+//---------------------------------------------------------
+// setChannels
+//---------------------------------------------------------
+
+void WaveTrack::setChannels(int n)
+ {
+ AudioTrack::setChannels(n);
+ SndFile* sf = recFile();
+ if (sf) {
+ if (sf->samples() == 0) {
+ sf->remove();
+ sf->setFormat(sf->format(), _channels,
+ sf->samplerate());
+ sf->openWrite();
+ }
+ }
+ }
+
diff --git a/muse2/muse/widgets/.cvsignore b/muse2/muse/widgets/.cvsignore
new file mode 100644
index 00000000..89de206f
--- /dev/null
+++ b/muse2/muse/widgets/.cvsignore
@@ -0,0 +1,23 @@
+appearancebase.h
+audioconfbase.h
+ccontrolbase.h
+cliplisteditorbase.h
+commentbase.h
+editctrl7dialogbase.h
+editmetadialogbase.h
+editnotedialogbase.h
+editsysexdialogbase.h
+gatetimebase.h
+gensetbase.h
+itransformbase.h
+metronomebase.h
+midirawbase.h
+midisync.h
+mittransposebase.h
+mixdowndialogbase.h
+synthconfigbase.h
+trackinfobase.h
+transformbase.h
+transposebase.h
+velocitybase.h
+fdialogbuttons.h
diff --git a/muse2/muse/widgets/Makefile.am b/muse2/muse/widgets/Makefile.am
new file mode 100644
index 00000000..9a551264
--- /dev/null
+++ b/muse2/muse/widgets/Makefile.am
@@ -0,0 +1,262 @@
+include $(top_srcdir)/common.am
+
+## musewidgetsplugin_so_CPPFLAGS = $(MUSECXXFLAGS) -fPIC -I.. -I$(top_srcdir)/synti \
+## -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_PLUGIN
+libwidgets_a_CPPFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti
+
+if PCH
+libwidgets_a_CPPFLAGS += -include $(top_srcdir)/all.h
+## musewidgetsplugin_so_CPPFLAGS += -include $(top_srcdir)/all-pic.h
+endif
+
+AM_CXXFLAGS +=-DSVNVERSION=\"$(shell svnversion)\"
+
+
+noinst_LIBRARIES = libwidgets.a
+
+dist_libwidgets_a_SOURCES = \
+ utils.cpp utils.h \
+ citem.cpp citem.h \
+ vscale.cpp vscale.h \
+ drange.cpp drange.h \
+ sclif.cpp sclif.h \
+ dimap.cpp dimap.h \
+ scldiv.cpp scldiv.h \
+ mmath.cpp mmath.h \
+ scldraw.cpp scldraw.h \
+ action.h \
+ \
+ scrollscale.cpp scrollscale.h \
+ view.cpp view.h \
+ nentry.cpp nentry.h \
+ mtscale.cpp mtscale.h \
+ sigscale.cpp sigscale.h \
+ hitscale.cpp hitscale.h \
+ intlabel.cpp intlabel.h \
+ doublelabel.cpp doublelabel.h \
+ canvas.cpp canvas.h \
+ noteinfo.cpp noteinfo.h \
+ dentry.cpp dentry.h \
+ siglabel.cpp siglabel.h \
+ ttoolbar.cpp ttoolbar.h \
+ ttoolbutton.cpp ttoolbutton.h \
+ tb1.cpp tb1.h \
+ lcombo.cpp lcombo.h \
+ swidget.cpp swidget.h \
+ tempolabel.cpp tempolabel.h \
+ tools.cpp tools.h \
+ fontsel.cpp fontsel.h \
+ ctrlcombo.cpp ctrlcombo.h \
+ sliderbase.cpp sliderbase.h \
+ slider.cpp slider.h \
+ midisyncimpl.cpp midisyncimpl.h \
+ header.cpp header.h \
+ knob.cpp knob.h \
+ mlabel.cpp mlabel.h \
+ genset.cpp genset.h \
+ mixdowndialog.cpp mixdowndialog.h \
+ spinboxFP.cpp spinboxFP.h \
+ spinbox.cpp spinbox.h \
+ comboQuant.cpp comboQuant.h \
+ bigtime.cpp bigtime.h \
+ comment.cpp comment.h \
+ splitter.cpp splitter.h \
+ gatetime.cpp gatetime.h \
+ velocity.cpp velocity.h \
+ metronome.cpp metronome.h \
+ posedit.cpp posedit.h section.h \
+ pitchedit.cpp pitchedit.h \
+ pitchlabel.cpp pitchlabel.h \
+ poslabel.cpp poslabel.h \
+ filedialog.cpp filedialog.h \
+ sigedit.cpp sigedit.h \
+ shortcutconfig.cpp shortcutconfig.h \
+ shortcutcapturedialog.cpp shortcutcapturedialog.h \
+ combobox.cpp combobox.h \
+ checkbox.cpp checkbox.h \
+ aboutbox_impl.cpp aboutbox_impl.h \
+ popupmenu.cpp popupmenu.h \
+ listitem.h \
+ menutitleitem.h \
+ \
+ midisync.ui \
+ gensetbase.ui \
+ mixdowndialogbase.ui \
+ transposebase.ui \
+ transformbase.ui \
+ appearancebase.ui \
+ itransformbase.ui \
+ commentbase.ui \
+ synthconfigbase.ui \
+ gatetimebase.ui \
+ velocitybase.ui \
+ metronomebase.ui \
+ mtrackinfobase.ui \
+ wtrackinfobase.ui \
+ editctrl7dialogbase.ui \
+ editmetadialogbase.ui \
+ editnotedialogbase.ui \
+ editsysexdialogbase.ui \
+ cliplisteditorbase.ui \
+ mittransposebase.ui \
+ fdialogbuttons.ui \
+ shortcutconfigbase.ui \
+ shortcutcapturedialogbase.ui \
+ aboutbox.ui \
+ songinfo.ui \
+ didyouknow.ui \
+ configmidifilebase.ui
+
+nodist_libwidgets_a_SOURCES = \
+ moc_scrollscale.cpp \
+ moc_view.cpp \
+ moc_nentry.cpp \
+ moc_mtscale.cpp \
+ moc_sigscale.cpp \
+ moc_hitscale.cpp \
+ moc_intlabel.cpp \
+ moc_doublelabel.cpp \
+ moc_canvas.cpp \
+ moc_noteinfo.cpp \
+ moc_dentry.cpp \
+ moc_siglabel.cpp \
+ moc_ttoolbar.cpp \
+ moc_ttoolbutton.cpp \
+ moc_tb1.cpp \
+ moc_lcombo.cpp \
+ moc_swidget.cpp \
+ moc_tempolabel.cpp \
+ moc_tools.cpp \
+ moc_popupmenu.cpp \
+ moc_fontsel.cpp \
+ moc_ctrlcombo.cpp \
+ moc_sliderbase.cpp \
+ moc_slider.cpp \
+ moc_midisyncimpl.cpp \
+ moc_header.cpp \
+ moc_knob.cpp \
+ moc_mlabel.cpp \
+ moc_genset.cpp \
+ moc_mixdowndialog.cpp \
+ moc_spinboxFP.cpp \
+ moc_spinbox.cpp \
+ moc_comboQuant.cpp \
+ moc_bigtime.cpp \
+ moc_comment.cpp \
+ moc_splitter.cpp \
+ moc_gatetime.cpp \
+ moc_velocity.cpp \
+ moc_metronome.cpp \
+ moc_posedit.cpp \
+ moc_pitchedit.cpp \
+ moc_pitchlabel.cpp \
+ moc_poslabel.cpp \
+ moc_filedialog.cpp \
+ moc_sigedit.cpp \
+ moc_shortcutconfig.cpp \
+ moc_shortcutcapturedialog.cpp \
+ moc_combobox.cpp \
+ moc_aboutbox_impl.cpp\
+ moc_aboutbox.cpp \
+ moc_songinfo.cpp \
+ moc_didyouknow.cpp \
+ moc_checkbox.cpp \
+ moc_vscale.cpp \
+ moc_action.cpp
+
+# inst_PROGRAMS = musewidgetsplugin.so
+# instdir = $(pkglibdir)/qtplugins/designer
+#
+### widgetsplugin_LTLIBRARIES = musewidgetsplugin.la
+### widgetsplugindir = $(pkglibdir)/qtplugin
+
+#dist_musewidgetsplugin_so_SOURCES = \
+# musewidgetsplug.cpp \
+# sigedit.h \
+# $(top_srcdir)/muse/xml.cpp $(top_srcdir)/muse/tempo.cpp \
+# $(top_srcdir)/muse/sig.cpp $(top_srcdir)/muse/pos.cpp
+
+#nodist_musewidgetsplugin_so_SOURCES = \
+# moc_posedit.non-libtool.cpp moc_poslabel.non-libtool.cpp \
+# moc_sigedit.non-libtool.cpp \
+# moc_pitchedit.non-libtool.cpp moc_pitchlabel.non-libtool.cpp \
+# moc_tempolabel.non-libtool.cpp \
+# \
+# posedit.non-libtool.cpp poslabel.non-libtool.cpp \
+# pitchedit.non-libtool.cpp pitchlabel.non-libtool.cpp \
+# sigedit.non-libtool.cpp \
+# tempolabel.non-libtool.cpp \
+# slider.non-libtool.cpp moc_slider.non-libtool.cpp \
+# sliderbase.non-libtool.cpp moc_sliderbase.non-libtool.cpp \
+# sclif.non-libtool.cpp \
+# scldiv.non-libtool.cpp mmath.non-libtool.cpp scldraw.non-libtool.cpp \
+# dimap.non-libtool.cpp drange.non-libtool.cpp \
+# doublelabel.non-libtool.cpp moc_doublelabel.non-libtool.cpp \
+# dentry.non-libtool.cpp moc_dentry.non-libtool.cpp \
+# checkbox.non-libtool.cpp moc_checkbox.non-libtool.cpp \
+# combobox.non-libtool.cpp moc_combobox.non-libtool.cpp
+
+#musewidgetsplugin_so_LDFLAGS = --whole-archive -fno-exceptions -shared \
+# -Wl,-soname,libmusewidgetsplugin.so.1 $(QT_LIBS) -lasound
+
+#musewidgetsplug.o: musewidgetsplug.cpp
+# $(CXXCOMPILE) -fPIC -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_PLUGIN -c musewidgetsplug.cpp
+
+EXTRA_DIST = ctrlcombo.cw
+
+# This is for stuff that needs the widgets, but dosn't build them with
+# libtool
+
+BUILT_SOURCES += \
+ posedit.non-libtool.cpp \
+ poslabel.non-libtool.cpp \
+ pitchedit.non-libtool.cpp \
+ pitchlabel.non-libtool.cpp \
+ sigedit.non-libtool.cpp \
+ tempolabel.non-libtool.cpp \
+ slider.non-libtool.cpp \
+ sliderbase.non-libtool.cpp \
+ sclif.non-libtool.cpp \
+ moc_posedit.non-libtool.cpp \
+ moc_poslabel.non-libtool.cpp \
+ moc_sigedit.non-libtool.cpp \
+ moc_pitchedit.non-libtool.cpp \
+ moc_pitchlabel.non-libtool.cpp \
+ moc_tempolabel.non-libtool.cpp \
+ moc_slider.non-libtool.cpp \
+ moc_sliderbase.non-libtool.cpp \
+ scldiv.non-libtool.cpp mmath.non-libtool.cpp scldraw.non-libtool.cpp \
+ dimap.non-libtool.cpp drange.non-libtool.cpp \
+ doublelabel.non-libtool.cpp moc_doublelabel.non-libtool.cpp \
+ dentry.non-libtool.cpp moc_dentry.non-libtool.cpp \
+ checkbox.non-libtool.cpp moc_checkbox.non-libtool.cpp \
+ combobox.non-libtool.cpp moc_combobox.non-libtool.cpp
+
+%.non-libtool.cpp: %.cpp
+ $(LN_S) $*.cpp $*.non-libtool.cpp
+
+CLEANFILES = \
+ posedit.non-libtool.cpp \
+ poslabel.non-libtool.cpp \
+ pitchedit.non-libtool.cpp \
+ pitchlabel.non-libtool.cpp \
+ sigedit.non-libtool.cpp \
+ tempolabel.non-libtool.cpp \
+ slider.non-libtool.cpp \
+ sliderbase.non-libtool.cpp \
+ sclif.non-libtool.cpp \
+ moc_posedit.non-libtool.cpp \
+ moc_poslabel.non-libtool.cpp \
+ moc_sigedit.non-libtool.cpp \
+ moc_pitchedit.non-libtool.cpp \
+ moc_pitchlabel.non-libtool.cpp \
+ moc_tempolabel.non-libtool.cpp \
+ moc_slider.non-libtool.cpp \
+ moc_sliderbase.non-libtool.cpp \
+ scldiv.non-libtool.cpp mmath.non-libtool.cpp scldraw.non-libtool.cpp \
+ dimap.non-libtool.cpp drange.non-libtool.cpp \
+ doublelabel.non-libtool.cpp moc_doublelabel.non-libtool.cpp \
+ dentry.non-libtool.cpp moc_dentry.non-libtool.cpp \
+ checkbox.non-libtool.cpp moc_checkbox.non-libtool.cpp \
+ combobox.non-libtool.cpp moc_combobox.non-libtool.cpp
+
diff --git a/muse2/muse/widgets/Makefile.in b/muse2/muse/widgets/Makefile.in
new file mode 100644
index 00000000..01b5747c
--- /dev/null
+++ b/muse2/muse/widgets/Makefile.in
@@ -0,0 +1,2647 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/common.am
+@PCH_TRUE@am__append_1 = -include $(top_srcdir)/all.h
+subdir = muse/widgets
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \
+ $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libwidgets_a_AR = $(AR) $(ARFLAGS)
+libwidgets_a_LIBADD =
+dist_libwidgets_a_OBJECTS = libwidgets_a-utils.$(OBJEXT) \
+ libwidgets_a-citem.$(OBJEXT) libwidgets_a-vscale.$(OBJEXT) \
+ libwidgets_a-drange.$(OBJEXT) libwidgets_a-sclif.$(OBJEXT) \
+ libwidgets_a-dimap.$(OBJEXT) libwidgets_a-scldiv.$(OBJEXT) \
+ libwidgets_a-mmath.$(OBJEXT) libwidgets_a-scldraw.$(OBJEXT) \
+ libwidgets_a-scrollscale.$(OBJEXT) libwidgets_a-view.$(OBJEXT) \
+ libwidgets_a-nentry.$(OBJEXT) libwidgets_a-mtscale.$(OBJEXT) \
+ libwidgets_a-sigscale.$(OBJEXT) \
+ libwidgets_a-hitscale.$(OBJEXT) \
+ libwidgets_a-intlabel.$(OBJEXT) \
+ libwidgets_a-doublelabel.$(OBJEXT) \
+ libwidgets_a-canvas.$(OBJEXT) libwidgets_a-noteinfo.$(OBJEXT) \
+ libwidgets_a-dentry.$(OBJEXT) libwidgets_a-siglabel.$(OBJEXT) \
+ libwidgets_a-ttoolbar.$(OBJEXT) \
+ libwidgets_a-ttoolbutton.$(OBJEXT) libwidgets_a-tb1.$(OBJEXT) \
+ libwidgets_a-lcombo.$(OBJEXT) libwidgets_a-swidget.$(OBJEXT) \
+ libwidgets_a-tempolabel.$(OBJEXT) libwidgets_a-tools.$(OBJEXT) \
+ libwidgets_a-fontsel.$(OBJEXT) \
+ libwidgets_a-ctrlcombo.$(OBJEXT) \
+ libwidgets_a-sliderbase.$(OBJEXT) \
+ libwidgets_a-slider.$(OBJEXT) \
+ libwidgets_a-midisyncimpl.$(OBJEXT) \
+ libwidgets_a-header.$(OBJEXT) libwidgets_a-knob.$(OBJEXT) \
+ libwidgets_a-mlabel.$(OBJEXT) libwidgets_a-genset.$(OBJEXT) \
+ libwidgets_a-mixdowndialog.$(OBJEXT) \
+ libwidgets_a-spinboxFP.$(OBJEXT) \
+ libwidgets_a-spinbox.$(OBJEXT) \
+ libwidgets_a-comboQuant.$(OBJEXT) \
+ libwidgets_a-bigtime.$(OBJEXT) libwidgets_a-comment.$(OBJEXT) \
+ libwidgets_a-splitter.$(OBJEXT) \
+ libwidgets_a-gatetime.$(OBJEXT) \
+ libwidgets_a-velocity.$(OBJEXT) \
+ libwidgets_a-metronome.$(OBJEXT) \
+ libwidgets_a-posedit.$(OBJEXT) \
+ libwidgets_a-pitchedit.$(OBJEXT) \
+ libwidgets_a-pitchlabel.$(OBJEXT) \
+ libwidgets_a-poslabel.$(OBJEXT) \
+ libwidgets_a-filedialog.$(OBJEXT) \
+ libwidgets_a-sigedit.$(OBJEXT) \
+ libwidgets_a-shortcutconfig.$(OBJEXT) \
+ libwidgets_a-shortcutcapturedialog.$(OBJEXT) \
+ libwidgets_a-combobox.$(OBJEXT) \
+ libwidgets_a-checkbox.$(OBJEXT) \
+ libwidgets_a-aboutbox_impl.$(OBJEXT) \
+ libwidgets_a-popupmenu.$(OBJEXT) midisync.$(OBJEXT) \
+ gensetbase.$(OBJEXT) mixdowndialogbase.$(OBJEXT) \
+ transposebase.$(OBJEXT) transformbase.$(OBJEXT) \
+ appearancebase.$(OBJEXT) itransformbase.$(OBJEXT) \
+ commentbase.$(OBJEXT) synthconfigbase.$(OBJEXT) \
+ gatetimebase.$(OBJEXT) velocitybase.$(OBJEXT) \
+ metronomebase.$(OBJEXT) mtrackinfobase.$(OBJEXT) \
+ wtrackinfobase.$(OBJEXT) editctrl7dialogbase.$(OBJEXT) \
+ editmetadialogbase.$(OBJEXT) editnotedialogbase.$(OBJEXT) \
+ editsysexdialogbase.$(OBJEXT) cliplisteditorbase.$(OBJEXT) \
+ mittransposebase.$(OBJEXT) fdialogbuttons.$(OBJEXT) \
+ shortcutconfigbase.$(OBJEXT) \
+ shortcutcapturedialogbase.$(OBJEXT) aboutbox.$(OBJEXT) \
+ songinfo.$(OBJEXT) didyouknow.$(OBJEXT) \
+ configmidifilebase.$(OBJEXT)
+nodist_libwidgets_a_OBJECTS = libwidgets_a-moc_scrollscale.$(OBJEXT) \
+ libwidgets_a-moc_view.$(OBJEXT) \
+ libwidgets_a-moc_nentry.$(OBJEXT) \
+ libwidgets_a-moc_mtscale.$(OBJEXT) \
+ libwidgets_a-moc_sigscale.$(OBJEXT) \
+ libwidgets_a-moc_hitscale.$(OBJEXT) \
+ libwidgets_a-moc_intlabel.$(OBJEXT) \
+ libwidgets_a-moc_doublelabel.$(OBJEXT) \
+ libwidgets_a-moc_canvas.$(OBJEXT) \
+ libwidgets_a-moc_noteinfo.$(OBJEXT) \
+ libwidgets_a-moc_dentry.$(OBJEXT) \
+ libwidgets_a-moc_siglabel.$(OBJEXT) \
+ libwidgets_a-moc_ttoolbar.$(OBJEXT) \
+ libwidgets_a-moc_ttoolbutton.$(OBJEXT) \
+ libwidgets_a-moc_tb1.$(OBJEXT) \
+ libwidgets_a-moc_lcombo.$(OBJEXT) \
+ libwidgets_a-moc_swidget.$(OBJEXT) \
+ libwidgets_a-moc_tempolabel.$(OBJEXT) \
+ libwidgets_a-moc_tools.$(OBJEXT) \
+ libwidgets_a-moc_popupmenu.$(OBJEXT) \
+ libwidgets_a-moc_fontsel.$(OBJEXT) \
+ libwidgets_a-moc_ctrlcombo.$(OBJEXT) \
+ libwidgets_a-moc_sliderbase.$(OBJEXT) \
+ libwidgets_a-moc_slider.$(OBJEXT) \
+ libwidgets_a-moc_midisyncimpl.$(OBJEXT) \
+ libwidgets_a-moc_header.$(OBJEXT) \
+ libwidgets_a-moc_knob.$(OBJEXT) \
+ libwidgets_a-moc_mlabel.$(OBJEXT) \
+ libwidgets_a-moc_genset.$(OBJEXT) \
+ libwidgets_a-moc_mixdowndialog.$(OBJEXT) \
+ libwidgets_a-moc_spinboxFP.$(OBJEXT) \
+ libwidgets_a-moc_spinbox.$(OBJEXT) \
+ libwidgets_a-moc_comboQuant.$(OBJEXT) \
+ libwidgets_a-moc_bigtime.$(OBJEXT) \
+ libwidgets_a-moc_comment.$(OBJEXT) \
+ libwidgets_a-moc_splitter.$(OBJEXT) \
+ libwidgets_a-moc_gatetime.$(OBJEXT) \
+ libwidgets_a-moc_velocity.$(OBJEXT) \
+ libwidgets_a-moc_metronome.$(OBJEXT) \
+ libwidgets_a-moc_posedit.$(OBJEXT) \
+ libwidgets_a-moc_pitchedit.$(OBJEXT) \
+ libwidgets_a-moc_pitchlabel.$(OBJEXT) \
+ libwidgets_a-moc_poslabel.$(OBJEXT) \
+ libwidgets_a-moc_filedialog.$(OBJEXT) \
+ libwidgets_a-moc_sigedit.$(OBJEXT) \
+ libwidgets_a-moc_shortcutconfig.$(OBJEXT) \
+ libwidgets_a-moc_shortcutcapturedialog.$(OBJEXT) \
+ libwidgets_a-moc_combobox.$(OBJEXT) \
+ libwidgets_a-moc_aboutbox_impl.$(OBJEXT) \
+ libwidgets_a-moc_aboutbox.$(OBJEXT) \
+ libwidgets_a-moc_songinfo.$(OBJEXT) \
+ libwidgets_a-moc_didyouknow.$(OBJEXT) \
+ libwidgets_a-moc_checkbox.$(OBJEXT) \
+ libwidgets_a-moc_vscale.$(OBJEXT) \
+ libwidgets_a-moc_action.$(OBJEXT)
+libwidgets_a_OBJECTS = $(dist_libwidgets_a_OBJECTS) \
+ $(nodist_libwidgets_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(dist_libwidgets_a_SOURCES) $(nodist_libwidgets_a_SOURCES)
+DIST_SOURCES = $(dist_libwidgets_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCBOOKSTYLE = @DOCBOOKSTYLE@
+DOCBOOKTARGETS = @DOCBOOKTARGETS@
+DOT = @DOT@
+DOTPATH = @DOTPATH@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@
+FST_CFLAGS = @FST_CFLAGS@
+FST_LIBS = @FST_LIBS@
+Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@
+Fluidsynth_LIBS = @Fluidsynth_LIBS@
+GIVERTCAP = @GIVERTCAP@
+GREP = @GREP@
+HAVEDOT = @HAVEDOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JADE = @JADE@
+LASH_CFLAGS = @LASH_CFLAGS@
+LASH_LIBS = @LASH_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LO_CFLAGS = @LO_CFLAGS@
+LO_LIBS = @LO_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MUSECXXFLAGS = @MUSECXXFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSGMLS = @NSGMLS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCH = @PCH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIB = @PYTHON_LIB@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+QTDIR_BIN = @QTDIR_BIN@
+QTDIR_INC = @QTDIR_INC@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+STRIP = @STRIP@
+SUIDBUILD = @SUIDBUILD@
+SUIDINSTALL = @SUIDINSTALL@
+USE_SSE = @USE_SSE@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+have_docbook = @have_docbook@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+synth_fluid = @synth_fluid@
+synth_fluidsynth = @synth_fluidsynth@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \
+ -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT -DSVNVERSION=\"$(shell \
+ svnversion)\"
+AM_CPPFLAGS =
+MOC = $(QTDIR_BIN)/moc
+#UIC = $(QTDIR_BIN)/uic3
+UIC = /usr/bin/uic3
+UIFILES = $(wildcard *.ui)
+MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \
+ if grep -q Q_OBJECT $$h; then \
+ echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \
+ fi; \
+ done)
+
+
+# This is for stuff that needs the widgets, but dosn't build them with
+# libtool
+BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h) \
+ posedit.non-libtool.cpp poslabel.non-libtool.cpp \
+ pitchedit.non-libtool.cpp pitchlabel.non-libtool.cpp \
+ sigedit.non-libtool.cpp tempolabel.non-libtool.cpp \
+ slider.non-libtool.cpp sliderbase.non-libtool.cpp \
+ sclif.non-libtool.cpp moc_posedit.non-libtool.cpp \
+ moc_poslabel.non-libtool.cpp moc_sigedit.non-libtool.cpp \
+ moc_pitchedit.non-libtool.cpp moc_pitchlabel.non-libtool.cpp \
+ moc_tempolabel.non-libtool.cpp moc_slider.non-libtool.cpp \
+ moc_sliderbase.non-libtool.cpp scldiv.non-libtool.cpp \
+ mmath.non-libtool.cpp scldraw.non-libtool.cpp \
+ dimap.non-libtool.cpp drange.non-libtool.cpp \
+ doublelabel.non-libtool.cpp moc_doublelabel.non-libtool.cpp \
+ dentry.non-libtool.cpp moc_dentry.non-libtool.cpp \
+ checkbox.non-libtool.cpp moc_checkbox.non-libtool.cpp \
+ combobox.non-libtool.cpp moc_combobox.non-libtool.cpp
+MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h)
+SUFFIXES = .ui .h.gch
+libwidgets_a_CPPFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \
+ $(am__append_1)
+noinst_LIBRARIES = libwidgets.a
+dist_libwidgets_a_SOURCES = \
+ utils.cpp utils.h \
+ citem.cpp citem.h \
+ vscale.cpp vscale.h \
+ drange.cpp drange.h \
+ sclif.cpp sclif.h \
+ dimap.cpp dimap.h \
+ scldiv.cpp scldiv.h \
+ mmath.cpp mmath.h \
+ scldraw.cpp scldraw.h \
+ action.h \
+ \
+ scrollscale.cpp scrollscale.h \
+ view.cpp view.h \
+ nentry.cpp nentry.h \
+ mtscale.cpp mtscale.h \
+ sigscale.cpp sigscale.h \
+ hitscale.cpp hitscale.h \
+ intlabel.cpp intlabel.h \
+ doublelabel.cpp doublelabel.h \
+ canvas.cpp canvas.h \
+ noteinfo.cpp noteinfo.h \
+ dentry.cpp dentry.h \
+ siglabel.cpp siglabel.h \
+ ttoolbar.cpp ttoolbar.h \
+ ttoolbutton.cpp ttoolbutton.h \
+ tb1.cpp tb1.h \
+ lcombo.cpp lcombo.h \
+ swidget.cpp swidget.h \
+ tempolabel.cpp tempolabel.h \
+ tools.cpp tools.h \
+ fontsel.cpp fontsel.h \
+ ctrlcombo.cpp ctrlcombo.h \
+ sliderbase.cpp sliderbase.h \
+ slider.cpp slider.h \
+ midisyncimpl.cpp midisyncimpl.h \
+ header.cpp header.h \
+ knob.cpp knob.h \
+ mlabel.cpp mlabel.h \
+ genset.cpp genset.h \
+ mixdowndialog.cpp mixdowndialog.h \
+ spinboxFP.cpp spinboxFP.h \
+ spinbox.cpp spinbox.h \
+ comboQuant.cpp comboQuant.h \
+ bigtime.cpp bigtime.h \
+ comment.cpp comment.h \
+ splitter.cpp splitter.h \
+ gatetime.cpp gatetime.h \
+ velocity.cpp velocity.h \
+ metronome.cpp metronome.h \
+ posedit.cpp posedit.h section.h \
+ pitchedit.cpp pitchedit.h \
+ pitchlabel.cpp pitchlabel.h \
+ poslabel.cpp poslabel.h \
+ filedialog.cpp filedialog.h \
+ sigedit.cpp sigedit.h \
+ shortcutconfig.cpp shortcutconfig.h \
+ shortcutcapturedialog.cpp shortcutcapturedialog.h \
+ combobox.cpp combobox.h \
+ checkbox.cpp checkbox.h \
+ aboutbox_impl.cpp aboutbox_impl.h \
+ popupmenu.cpp popupmenu.h \
+ listitem.h \
+ menutitleitem.h \
+ \
+ midisync.ui \
+ gensetbase.ui \
+ mixdowndialogbase.ui \
+ transposebase.ui \
+ transformbase.ui \
+ appearancebase.ui \
+ itransformbase.ui \
+ commentbase.ui \
+ synthconfigbase.ui \
+ gatetimebase.ui \
+ velocitybase.ui \
+ metronomebase.ui \
+ mtrackinfobase.ui \
+ wtrackinfobase.ui \
+ editctrl7dialogbase.ui \
+ editmetadialogbase.ui \
+ editnotedialogbase.ui \
+ editsysexdialogbase.ui \
+ cliplisteditorbase.ui \
+ mittransposebase.ui \
+ fdialogbuttons.ui \
+ shortcutconfigbase.ui \
+ shortcutcapturedialogbase.ui \
+ aboutbox.ui \
+ songinfo.ui \
+ didyouknow.ui \
+ configmidifilebase.ui
+
+nodist_libwidgets_a_SOURCES = \
+ moc_scrollscale.cpp \
+ moc_view.cpp \
+ moc_nentry.cpp \
+ moc_mtscale.cpp \
+ moc_sigscale.cpp \
+ moc_hitscale.cpp \
+ moc_intlabel.cpp \
+ moc_doublelabel.cpp \
+ moc_canvas.cpp \
+ moc_noteinfo.cpp \
+ moc_dentry.cpp \
+ moc_siglabel.cpp \
+ moc_ttoolbar.cpp \
+ moc_ttoolbutton.cpp \
+ moc_tb1.cpp \
+ moc_lcombo.cpp \
+ moc_swidget.cpp \
+ moc_tempolabel.cpp \
+ moc_tools.cpp \
+ moc_popupmenu.cpp \
+ moc_fontsel.cpp \
+ moc_ctrlcombo.cpp \
+ moc_sliderbase.cpp \
+ moc_slider.cpp \
+ moc_midisyncimpl.cpp \
+ moc_header.cpp \
+ moc_knob.cpp \
+ moc_mlabel.cpp \
+ moc_genset.cpp \
+ moc_mixdowndialog.cpp \
+ moc_spinboxFP.cpp \
+ moc_spinbox.cpp \
+ moc_comboQuant.cpp \
+ moc_bigtime.cpp \
+ moc_comment.cpp \
+ moc_splitter.cpp \
+ moc_gatetime.cpp \
+ moc_velocity.cpp \
+ moc_metronome.cpp \
+ moc_posedit.cpp \
+ moc_pitchedit.cpp \
+ moc_pitchlabel.cpp \
+ moc_poslabel.cpp \
+ moc_filedialog.cpp \
+ moc_sigedit.cpp \
+ moc_shortcutconfig.cpp \
+ moc_shortcutcapturedialog.cpp \
+ moc_combobox.cpp \
+ moc_aboutbox_impl.cpp\
+ moc_aboutbox.cpp \
+ moc_songinfo.cpp \
+ moc_didyouknow.cpp \
+ moc_checkbox.cpp \
+ moc_vscale.cpp \
+ moc_action.cpp
+
+
+# inst_PROGRAMS = musewidgetsplugin.so
+# instdir = $(pkglibdir)/qtplugins/designer
+#
+### widgetsplugin_LTLIBRARIES = musewidgetsplugin.la
+### widgetsplugindir = $(pkglibdir)/qtplugin
+
+#dist_musewidgetsplugin_so_SOURCES = \
+# musewidgetsplug.cpp \
+# sigedit.h \
+# $(top_srcdir)/muse/xml.cpp $(top_srcdir)/muse/tempo.cpp \
+# $(top_srcdir)/muse/sig.cpp $(top_srcdir)/muse/pos.cpp
+
+#nodist_musewidgetsplugin_so_SOURCES = \
+# moc_posedit.non-libtool.cpp moc_poslabel.non-libtool.cpp \
+# moc_sigedit.non-libtool.cpp \
+# moc_pitchedit.non-libtool.cpp moc_pitchlabel.non-libtool.cpp \
+# moc_tempolabel.non-libtool.cpp \
+# \
+# posedit.non-libtool.cpp poslabel.non-libtool.cpp \
+# pitchedit.non-libtool.cpp pitchlabel.non-libtool.cpp \
+# sigedit.non-libtool.cpp \
+# tempolabel.non-libtool.cpp \
+# slider.non-libtool.cpp moc_slider.non-libtool.cpp \
+# sliderbase.non-libtool.cpp moc_sliderbase.non-libtool.cpp \
+# sclif.non-libtool.cpp \
+# scldiv.non-libtool.cpp mmath.non-libtool.cpp scldraw.non-libtool.cpp \
+# dimap.non-libtool.cpp drange.non-libtool.cpp \
+# doublelabel.non-libtool.cpp moc_doublelabel.non-libtool.cpp \
+# dentry.non-libtool.cpp moc_dentry.non-libtool.cpp \
+# checkbox.non-libtool.cpp moc_checkbox.non-libtool.cpp \
+# combobox.non-libtool.cpp moc_combobox.non-libtool.cpp
+
+#musewidgetsplugin_so_LDFLAGS = --whole-archive -fno-exceptions -shared \
+# -Wl,-soname,libmusewidgetsplugin.so.1 $(QT_LIBS) -lasound
+
+#musewidgetsplug.o: musewidgetsplug.cpp
+# $(CXXCOMPILE) -fPIC -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_PLUGIN -c musewidgetsplug.cpp
+EXTRA_DIST = ctrlcombo.cw
+CLEANFILES = \
+ posedit.non-libtool.cpp \
+ poslabel.non-libtool.cpp \
+ pitchedit.non-libtool.cpp \
+ pitchlabel.non-libtool.cpp \
+ sigedit.non-libtool.cpp \
+ tempolabel.non-libtool.cpp \
+ slider.non-libtool.cpp \
+ sliderbase.non-libtool.cpp \
+ sclif.non-libtool.cpp \
+ moc_posedit.non-libtool.cpp \
+ moc_poslabel.non-libtool.cpp \
+ moc_sigedit.non-libtool.cpp \
+ moc_pitchedit.non-libtool.cpp \
+ moc_pitchlabel.non-libtool.cpp \
+ moc_tempolabel.non-libtool.cpp \
+ moc_slider.non-libtool.cpp \
+ moc_sliderbase.non-libtool.cpp \
+ scldiv.non-libtool.cpp mmath.non-libtool.cpp scldraw.non-libtool.cpp \
+ dimap.non-libtool.cpp drange.non-libtool.cpp \
+ doublelabel.non-libtool.cpp moc_doublelabel.non-libtool.cpp \
+ dentry.non-libtool.cpp moc_dentry.non-libtool.cpp \
+ checkbox.non-libtool.cpp moc_checkbox.non-libtool.cpp \
+ combobox.non-libtool.cpp moc_combobox.non-libtool.cpp
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .ui .h.gch .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/widgets/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu muse/widgets/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libwidgets.a: $(libwidgets_a_OBJECTS) $(libwidgets_a_DEPENDENCIES)
+ -rm -f libwidgets.a
+ $(libwidgets_a_AR) libwidgets.a $(libwidgets_a_OBJECTS) $(libwidgets_a_LIBADD)
+ $(RANLIB) libwidgets.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-aboutbox_impl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-bigtime.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-canvas.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-checkbox.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-citem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-comboQuant.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-combobox.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-comment.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-ctrlcombo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-dentry.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-dimap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-doublelabel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-drange.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-filedialog.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-fontsel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-gatetime.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-genset.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-header.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-hitscale.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-intlabel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-knob.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-lcombo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-metronome.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-midisyncimpl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-mixdowndialog.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-mlabel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-mmath.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_aboutbox.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_aboutbox_impl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_action.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_bigtime.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_canvas.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_checkbox.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_comboQuant.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_combobox.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_comment.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_ctrlcombo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_dentry.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_didyouknow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_doublelabel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_filedialog.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_fontsel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_gatetime.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_genset.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_header.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_hitscale.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_intlabel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_knob.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_lcombo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_metronome.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_midisyncimpl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_mixdowndialog.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_mlabel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_mtscale.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_nentry.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_noteinfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_pitchedit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_pitchlabel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_popupmenu.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_posedit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_poslabel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_scrollscale.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_shortcutcapturedialog.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_shortcutconfig.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_sigedit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_siglabel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_sigscale.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_slider.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_sliderbase.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_songinfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_spinbox.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_spinboxFP.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_splitter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_swidget.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_tb1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_tempolabel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_tools.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_ttoolbar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_ttoolbutton.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_velocity.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_view.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-moc_vscale.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-mtscale.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-nentry.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-noteinfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-pitchedit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-pitchlabel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-popupmenu.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-posedit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-poslabel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-scldiv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-scldraw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-sclif.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-scrollscale.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-shortcutcapturedialog.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-shortcutconfig.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-sigedit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-siglabel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-sigscale.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-slider.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-sliderbase.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-spinbox.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-spinboxFP.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-splitter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-swidget.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-tb1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-tempolabel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-tools.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-ttoolbar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-ttoolbutton.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-utils.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-velocity.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-view.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwidgets_a-vscale.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+libwidgets_a-utils.o: utils.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-utils.o -MD -MP -MF $(DEPDIR)/libwidgets_a-utils.Tpo -c -o libwidgets_a-utils.o `test -f 'utils.cpp' || echo '$(srcdir)/'`utils.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-utils.Tpo $(DEPDIR)/libwidgets_a-utils.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='utils.cpp' object='libwidgets_a-utils.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-utils.o `test -f 'utils.cpp' || echo '$(srcdir)/'`utils.cpp
+
+libwidgets_a-utils.obj: utils.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-utils.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-utils.Tpo -c -o libwidgets_a-utils.obj `if test -f 'utils.cpp'; then $(CYGPATH_W) 'utils.cpp'; else $(CYGPATH_W) '$(srcdir)/utils.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-utils.Tpo $(DEPDIR)/libwidgets_a-utils.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='utils.cpp' object='libwidgets_a-utils.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-utils.obj `if test -f 'utils.cpp'; then $(CYGPATH_W) 'utils.cpp'; else $(CYGPATH_W) '$(srcdir)/utils.cpp'; fi`
+
+libwidgets_a-citem.o: citem.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-citem.o -MD -MP -MF $(DEPDIR)/libwidgets_a-citem.Tpo -c -o libwidgets_a-citem.o `test -f 'citem.cpp' || echo '$(srcdir)/'`citem.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-citem.Tpo $(DEPDIR)/libwidgets_a-citem.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='citem.cpp' object='libwidgets_a-citem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-citem.o `test -f 'citem.cpp' || echo '$(srcdir)/'`citem.cpp
+
+libwidgets_a-citem.obj: citem.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-citem.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-citem.Tpo -c -o libwidgets_a-citem.obj `if test -f 'citem.cpp'; then $(CYGPATH_W) 'citem.cpp'; else $(CYGPATH_W) '$(srcdir)/citem.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-citem.Tpo $(DEPDIR)/libwidgets_a-citem.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='citem.cpp' object='libwidgets_a-citem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-citem.obj `if test -f 'citem.cpp'; then $(CYGPATH_W) 'citem.cpp'; else $(CYGPATH_W) '$(srcdir)/citem.cpp'; fi`
+
+libwidgets_a-vscale.o: vscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-vscale.o -MD -MP -MF $(DEPDIR)/libwidgets_a-vscale.Tpo -c -o libwidgets_a-vscale.o `test -f 'vscale.cpp' || echo '$(srcdir)/'`vscale.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-vscale.Tpo $(DEPDIR)/libwidgets_a-vscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='vscale.cpp' object='libwidgets_a-vscale.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-vscale.o `test -f 'vscale.cpp' || echo '$(srcdir)/'`vscale.cpp
+
+libwidgets_a-vscale.obj: vscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-vscale.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-vscale.Tpo -c -o libwidgets_a-vscale.obj `if test -f 'vscale.cpp'; then $(CYGPATH_W) 'vscale.cpp'; else $(CYGPATH_W) '$(srcdir)/vscale.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-vscale.Tpo $(DEPDIR)/libwidgets_a-vscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='vscale.cpp' object='libwidgets_a-vscale.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-vscale.obj `if test -f 'vscale.cpp'; then $(CYGPATH_W) 'vscale.cpp'; else $(CYGPATH_W) '$(srcdir)/vscale.cpp'; fi`
+
+libwidgets_a-drange.o: drange.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-drange.o -MD -MP -MF $(DEPDIR)/libwidgets_a-drange.Tpo -c -o libwidgets_a-drange.o `test -f 'drange.cpp' || echo '$(srcdir)/'`drange.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-drange.Tpo $(DEPDIR)/libwidgets_a-drange.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='drange.cpp' object='libwidgets_a-drange.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-drange.o `test -f 'drange.cpp' || echo '$(srcdir)/'`drange.cpp
+
+libwidgets_a-drange.obj: drange.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-drange.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-drange.Tpo -c -o libwidgets_a-drange.obj `if test -f 'drange.cpp'; then $(CYGPATH_W) 'drange.cpp'; else $(CYGPATH_W) '$(srcdir)/drange.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-drange.Tpo $(DEPDIR)/libwidgets_a-drange.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='drange.cpp' object='libwidgets_a-drange.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-drange.obj `if test -f 'drange.cpp'; then $(CYGPATH_W) 'drange.cpp'; else $(CYGPATH_W) '$(srcdir)/drange.cpp'; fi`
+
+libwidgets_a-sclif.o: sclif.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-sclif.o -MD -MP -MF $(DEPDIR)/libwidgets_a-sclif.Tpo -c -o libwidgets_a-sclif.o `test -f 'sclif.cpp' || echo '$(srcdir)/'`sclif.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-sclif.Tpo $(DEPDIR)/libwidgets_a-sclif.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sclif.cpp' object='libwidgets_a-sclif.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-sclif.o `test -f 'sclif.cpp' || echo '$(srcdir)/'`sclif.cpp
+
+libwidgets_a-sclif.obj: sclif.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-sclif.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-sclif.Tpo -c -o libwidgets_a-sclif.obj `if test -f 'sclif.cpp'; then $(CYGPATH_W) 'sclif.cpp'; else $(CYGPATH_W) '$(srcdir)/sclif.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-sclif.Tpo $(DEPDIR)/libwidgets_a-sclif.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sclif.cpp' object='libwidgets_a-sclif.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-sclif.obj `if test -f 'sclif.cpp'; then $(CYGPATH_W) 'sclif.cpp'; else $(CYGPATH_W) '$(srcdir)/sclif.cpp'; fi`
+
+libwidgets_a-dimap.o: dimap.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-dimap.o -MD -MP -MF $(DEPDIR)/libwidgets_a-dimap.Tpo -c -o libwidgets_a-dimap.o `test -f 'dimap.cpp' || echo '$(srcdir)/'`dimap.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-dimap.Tpo $(DEPDIR)/libwidgets_a-dimap.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dimap.cpp' object='libwidgets_a-dimap.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-dimap.o `test -f 'dimap.cpp' || echo '$(srcdir)/'`dimap.cpp
+
+libwidgets_a-dimap.obj: dimap.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-dimap.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-dimap.Tpo -c -o libwidgets_a-dimap.obj `if test -f 'dimap.cpp'; then $(CYGPATH_W) 'dimap.cpp'; else $(CYGPATH_W) '$(srcdir)/dimap.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-dimap.Tpo $(DEPDIR)/libwidgets_a-dimap.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dimap.cpp' object='libwidgets_a-dimap.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-dimap.obj `if test -f 'dimap.cpp'; then $(CYGPATH_W) 'dimap.cpp'; else $(CYGPATH_W) '$(srcdir)/dimap.cpp'; fi`
+
+libwidgets_a-scldiv.o: scldiv.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-scldiv.o -MD -MP -MF $(DEPDIR)/libwidgets_a-scldiv.Tpo -c -o libwidgets_a-scldiv.o `test -f 'scldiv.cpp' || echo '$(srcdir)/'`scldiv.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-scldiv.Tpo $(DEPDIR)/libwidgets_a-scldiv.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scldiv.cpp' object='libwidgets_a-scldiv.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-scldiv.o `test -f 'scldiv.cpp' || echo '$(srcdir)/'`scldiv.cpp
+
+libwidgets_a-scldiv.obj: scldiv.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-scldiv.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-scldiv.Tpo -c -o libwidgets_a-scldiv.obj `if test -f 'scldiv.cpp'; then $(CYGPATH_W) 'scldiv.cpp'; else $(CYGPATH_W) '$(srcdir)/scldiv.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-scldiv.Tpo $(DEPDIR)/libwidgets_a-scldiv.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scldiv.cpp' object='libwidgets_a-scldiv.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-scldiv.obj `if test -f 'scldiv.cpp'; then $(CYGPATH_W) 'scldiv.cpp'; else $(CYGPATH_W) '$(srcdir)/scldiv.cpp'; fi`
+
+libwidgets_a-mmath.o: mmath.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-mmath.o -MD -MP -MF $(DEPDIR)/libwidgets_a-mmath.Tpo -c -o libwidgets_a-mmath.o `test -f 'mmath.cpp' || echo '$(srcdir)/'`mmath.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-mmath.Tpo $(DEPDIR)/libwidgets_a-mmath.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='mmath.cpp' object='libwidgets_a-mmath.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-mmath.o `test -f 'mmath.cpp' || echo '$(srcdir)/'`mmath.cpp
+
+libwidgets_a-mmath.obj: mmath.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-mmath.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-mmath.Tpo -c -o libwidgets_a-mmath.obj `if test -f 'mmath.cpp'; then $(CYGPATH_W) 'mmath.cpp'; else $(CYGPATH_W) '$(srcdir)/mmath.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-mmath.Tpo $(DEPDIR)/libwidgets_a-mmath.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='mmath.cpp' object='libwidgets_a-mmath.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-mmath.obj `if test -f 'mmath.cpp'; then $(CYGPATH_W) 'mmath.cpp'; else $(CYGPATH_W) '$(srcdir)/mmath.cpp'; fi`
+
+libwidgets_a-scldraw.o: scldraw.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-scldraw.o -MD -MP -MF $(DEPDIR)/libwidgets_a-scldraw.Tpo -c -o libwidgets_a-scldraw.o `test -f 'scldraw.cpp' || echo '$(srcdir)/'`scldraw.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-scldraw.Tpo $(DEPDIR)/libwidgets_a-scldraw.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scldraw.cpp' object='libwidgets_a-scldraw.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-scldraw.o `test -f 'scldraw.cpp' || echo '$(srcdir)/'`scldraw.cpp
+
+libwidgets_a-scldraw.obj: scldraw.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-scldraw.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-scldraw.Tpo -c -o libwidgets_a-scldraw.obj `if test -f 'scldraw.cpp'; then $(CYGPATH_W) 'scldraw.cpp'; else $(CYGPATH_W) '$(srcdir)/scldraw.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-scldraw.Tpo $(DEPDIR)/libwidgets_a-scldraw.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scldraw.cpp' object='libwidgets_a-scldraw.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-scldraw.obj `if test -f 'scldraw.cpp'; then $(CYGPATH_W) 'scldraw.cpp'; else $(CYGPATH_W) '$(srcdir)/scldraw.cpp'; fi`
+
+libwidgets_a-scrollscale.o: scrollscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-scrollscale.o -MD -MP -MF $(DEPDIR)/libwidgets_a-scrollscale.Tpo -c -o libwidgets_a-scrollscale.o `test -f 'scrollscale.cpp' || echo '$(srcdir)/'`scrollscale.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-scrollscale.Tpo $(DEPDIR)/libwidgets_a-scrollscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scrollscale.cpp' object='libwidgets_a-scrollscale.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-scrollscale.o `test -f 'scrollscale.cpp' || echo '$(srcdir)/'`scrollscale.cpp
+
+libwidgets_a-scrollscale.obj: scrollscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-scrollscale.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-scrollscale.Tpo -c -o libwidgets_a-scrollscale.obj `if test -f 'scrollscale.cpp'; then $(CYGPATH_W) 'scrollscale.cpp'; else $(CYGPATH_W) '$(srcdir)/scrollscale.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-scrollscale.Tpo $(DEPDIR)/libwidgets_a-scrollscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scrollscale.cpp' object='libwidgets_a-scrollscale.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-scrollscale.obj `if test -f 'scrollscale.cpp'; then $(CYGPATH_W) 'scrollscale.cpp'; else $(CYGPATH_W) '$(srcdir)/scrollscale.cpp'; fi`
+
+libwidgets_a-view.o: view.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-view.o -MD -MP -MF $(DEPDIR)/libwidgets_a-view.Tpo -c -o libwidgets_a-view.o `test -f 'view.cpp' || echo '$(srcdir)/'`view.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-view.Tpo $(DEPDIR)/libwidgets_a-view.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='view.cpp' object='libwidgets_a-view.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-view.o `test -f 'view.cpp' || echo '$(srcdir)/'`view.cpp
+
+libwidgets_a-view.obj: view.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-view.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-view.Tpo -c -o libwidgets_a-view.obj `if test -f 'view.cpp'; then $(CYGPATH_W) 'view.cpp'; else $(CYGPATH_W) '$(srcdir)/view.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-view.Tpo $(DEPDIR)/libwidgets_a-view.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='view.cpp' object='libwidgets_a-view.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-view.obj `if test -f 'view.cpp'; then $(CYGPATH_W) 'view.cpp'; else $(CYGPATH_W) '$(srcdir)/view.cpp'; fi`
+
+libwidgets_a-nentry.o: nentry.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-nentry.o -MD -MP -MF $(DEPDIR)/libwidgets_a-nentry.Tpo -c -o libwidgets_a-nentry.o `test -f 'nentry.cpp' || echo '$(srcdir)/'`nentry.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-nentry.Tpo $(DEPDIR)/libwidgets_a-nentry.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='nentry.cpp' object='libwidgets_a-nentry.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-nentry.o `test -f 'nentry.cpp' || echo '$(srcdir)/'`nentry.cpp
+
+libwidgets_a-nentry.obj: nentry.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-nentry.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-nentry.Tpo -c -o libwidgets_a-nentry.obj `if test -f 'nentry.cpp'; then $(CYGPATH_W) 'nentry.cpp'; else $(CYGPATH_W) '$(srcdir)/nentry.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-nentry.Tpo $(DEPDIR)/libwidgets_a-nentry.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='nentry.cpp' object='libwidgets_a-nentry.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-nentry.obj `if test -f 'nentry.cpp'; then $(CYGPATH_W) 'nentry.cpp'; else $(CYGPATH_W) '$(srcdir)/nentry.cpp'; fi`
+
+libwidgets_a-mtscale.o: mtscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-mtscale.o -MD -MP -MF $(DEPDIR)/libwidgets_a-mtscale.Tpo -c -o libwidgets_a-mtscale.o `test -f 'mtscale.cpp' || echo '$(srcdir)/'`mtscale.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-mtscale.Tpo $(DEPDIR)/libwidgets_a-mtscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='mtscale.cpp' object='libwidgets_a-mtscale.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-mtscale.o `test -f 'mtscale.cpp' || echo '$(srcdir)/'`mtscale.cpp
+
+libwidgets_a-mtscale.obj: mtscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-mtscale.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-mtscale.Tpo -c -o libwidgets_a-mtscale.obj `if test -f 'mtscale.cpp'; then $(CYGPATH_W) 'mtscale.cpp'; else $(CYGPATH_W) '$(srcdir)/mtscale.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-mtscale.Tpo $(DEPDIR)/libwidgets_a-mtscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='mtscale.cpp' object='libwidgets_a-mtscale.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-mtscale.obj `if test -f 'mtscale.cpp'; then $(CYGPATH_W) 'mtscale.cpp'; else $(CYGPATH_W) '$(srcdir)/mtscale.cpp'; fi`
+
+libwidgets_a-sigscale.o: sigscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-sigscale.o -MD -MP -MF $(DEPDIR)/libwidgets_a-sigscale.Tpo -c -o libwidgets_a-sigscale.o `test -f 'sigscale.cpp' || echo '$(srcdir)/'`sigscale.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-sigscale.Tpo $(DEPDIR)/libwidgets_a-sigscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sigscale.cpp' object='libwidgets_a-sigscale.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-sigscale.o `test -f 'sigscale.cpp' || echo '$(srcdir)/'`sigscale.cpp
+
+libwidgets_a-sigscale.obj: sigscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-sigscale.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-sigscale.Tpo -c -o libwidgets_a-sigscale.obj `if test -f 'sigscale.cpp'; then $(CYGPATH_W) 'sigscale.cpp'; else $(CYGPATH_W) '$(srcdir)/sigscale.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-sigscale.Tpo $(DEPDIR)/libwidgets_a-sigscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sigscale.cpp' object='libwidgets_a-sigscale.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-sigscale.obj `if test -f 'sigscale.cpp'; then $(CYGPATH_W) 'sigscale.cpp'; else $(CYGPATH_W) '$(srcdir)/sigscale.cpp'; fi`
+
+libwidgets_a-hitscale.o: hitscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-hitscale.o -MD -MP -MF $(DEPDIR)/libwidgets_a-hitscale.Tpo -c -o libwidgets_a-hitscale.o `test -f 'hitscale.cpp' || echo '$(srcdir)/'`hitscale.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-hitscale.Tpo $(DEPDIR)/libwidgets_a-hitscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='hitscale.cpp' object='libwidgets_a-hitscale.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-hitscale.o `test -f 'hitscale.cpp' || echo '$(srcdir)/'`hitscale.cpp
+
+libwidgets_a-hitscale.obj: hitscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-hitscale.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-hitscale.Tpo -c -o libwidgets_a-hitscale.obj `if test -f 'hitscale.cpp'; then $(CYGPATH_W) 'hitscale.cpp'; else $(CYGPATH_W) '$(srcdir)/hitscale.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-hitscale.Tpo $(DEPDIR)/libwidgets_a-hitscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='hitscale.cpp' object='libwidgets_a-hitscale.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-hitscale.obj `if test -f 'hitscale.cpp'; then $(CYGPATH_W) 'hitscale.cpp'; else $(CYGPATH_W) '$(srcdir)/hitscale.cpp'; fi`
+
+libwidgets_a-intlabel.o: intlabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-intlabel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-intlabel.Tpo -c -o libwidgets_a-intlabel.o `test -f 'intlabel.cpp' || echo '$(srcdir)/'`intlabel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-intlabel.Tpo $(DEPDIR)/libwidgets_a-intlabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='intlabel.cpp' object='libwidgets_a-intlabel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-intlabel.o `test -f 'intlabel.cpp' || echo '$(srcdir)/'`intlabel.cpp
+
+libwidgets_a-intlabel.obj: intlabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-intlabel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-intlabel.Tpo -c -o libwidgets_a-intlabel.obj `if test -f 'intlabel.cpp'; then $(CYGPATH_W) 'intlabel.cpp'; else $(CYGPATH_W) '$(srcdir)/intlabel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-intlabel.Tpo $(DEPDIR)/libwidgets_a-intlabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='intlabel.cpp' object='libwidgets_a-intlabel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-intlabel.obj `if test -f 'intlabel.cpp'; then $(CYGPATH_W) 'intlabel.cpp'; else $(CYGPATH_W) '$(srcdir)/intlabel.cpp'; fi`
+
+libwidgets_a-doublelabel.o: doublelabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-doublelabel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-doublelabel.Tpo -c -o libwidgets_a-doublelabel.o `test -f 'doublelabel.cpp' || echo '$(srcdir)/'`doublelabel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-doublelabel.Tpo $(DEPDIR)/libwidgets_a-doublelabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='doublelabel.cpp' object='libwidgets_a-doublelabel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-doublelabel.o `test -f 'doublelabel.cpp' || echo '$(srcdir)/'`doublelabel.cpp
+
+libwidgets_a-doublelabel.obj: doublelabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-doublelabel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-doublelabel.Tpo -c -o libwidgets_a-doublelabel.obj `if test -f 'doublelabel.cpp'; then $(CYGPATH_W) 'doublelabel.cpp'; else $(CYGPATH_W) '$(srcdir)/doublelabel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-doublelabel.Tpo $(DEPDIR)/libwidgets_a-doublelabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='doublelabel.cpp' object='libwidgets_a-doublelabel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-doublelabel.obj `if test -f 'doublelabel.cpp'; then $(CYGPATH_W) 'doublelabel.cpp'; else $(CYGPATH_W) '$(srcdir)/doublelabel.cpp'; fi`
+
+libwidgets_a-canvas.o: canvas.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-canvas.o -MD -MP -MF $(DEPDIR)/libwidgets_a-canvas.Tpo -c -o libwidgets_a-canvas.o `test -f 'canvas.cpp' || echo '$(srcdir)/'`canvas.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-canvas.Tpo $(DEPDIR)/libwidgets_a-canvas.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='canvas.cpp' object='libwidgets_a-canvas.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-canvas.o `test -f 'canvas.cpp' || echo '$(srcdir)/'`canvas.cpp
+
+libwidgets_a-canvas.obj: canvas.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-canvas.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-canvas.Tpo -c -o libwidgets_a-canvas.obj `if test -f 'canvas.cpp'; then $(CYGPATH_W) 'canvas.cpp'; else $(CYGPATH_W) '$(srcdir)/canvas.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-canvas.Tpo $(DEPDIR)/libwidgets_a-canvas.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='canvas.cpp' object='libwidgets_a-canvas.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-canvas.obj `if test -f 'canvas.cpp'; then $(CYGPATH_W) 'canvas.cpp'; else $(CYGPATH_W) '$(srcdir)/canvas.cpp'; fi`
+
+libwidgets_a-noteinfo.o: noteinfo.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-noteinfo.o -MD -MP -MF $(DEPDIR)/libwidgets_a-noteinfo.Tpo -c -o libwidgets_a-noteinfo.o `test -f 'noteinfo.cpp' || echo '$(srcdir)/'`noteinfo.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-noteinfo.Tpo $(DEPDIR)/libwidgets_a-noteinfo.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='noteinfo.cpp' object='libwidgets_a-noteinfo.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-noteinfo.o `test -f 'noteinfo.cpp' || echo '$(srcdir)/'`noteinfo.cpp
+
+libwidgets_a-noteinfo.obj: noteinfo.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-noteinfo.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-noteinfo.Tpo -c -o libwidgets_a-noteinfo.obj `if test -f 'noteinfo.cpp'; then $(CYGPATH_W) 'noteinfo.cpp'; else $(CYGPATH_W) '$(srcdir)/noteinfo.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-noteinfo.Tpo $(DEPDIR)/libwidgets_a-noteinfo.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='noteinfo.cpp' object='libwidgets_a-noteinfo.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-noteinfo.obj `if test -f 'noteinfo.cpp'; then $(CYGPATH_W) 'noteinfo.cpp'; else $(CYGPATH_W) '$(srcdir)/noteinfo.cpp'; fi`
+
+libwidgets_a-dentry.o: dentry.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-dentry.o -MD -MP -MF $(DEPDIR)/libwidgets_a-dentry.Tpo -c -o libwidgets_a-dentry.o `test -f 'dentry.cpp' || echo '$(srcdir)/'`dentry.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-dentry.Tpo $(DEPDIR)/libwidgets_a-dentry.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dentry.cpp' object='libwidgets_a-dentry.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-dentry.o `test -f 'dentry.cpp' || echo '$(srcdir)/'`dentry.cpp
+
+libwidgets_a-dentry.obj: dentry.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-dentry.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-dentry.Tpo -c -o libwidgets_a-dentry.obj `if test -f 'dentry.cpp'; then $(CYGPATH_W) 'dentry.cpp'; else $(CYGPATH_W) '$(srcdir)/dentry.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-dentry.Tpo $(DEPDIR)/libwidgets_a-dentry.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dentry.cpp' object='libwidgets_a-dentry.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-dentry.obj `if test -f 'dentry.cpp'; then $(CYGPATH_W) 'dentry.cpp'; else $(CYGPATH_W) '$(srcdir)/dentry.cpp'; fi`
+
+libwidgets_a-siglabel.o: siglabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-siglabel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-siglabel.Tpo -c -o libwidgets_a-siglabel.o `test -f 'siglabel.cpp' || echo '$(srcdir)/'`siglabel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-siglabel.Tpo $(DEPDIR)/libwidgets_a-siglabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='siglabel.cpp' object='libwidgets_a-siglabel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-siglabel.o `test -f 'siglabel.cpp' || echo '$(srcdir)/'`siglabel.cpp
+
+libwidgets_a-siglabel.obj: siglabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-siglabel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-siglabel.Tpo -c -o libwidgets_a-siglabel.obj `if test -f 'siglabel.cpp'; then $(CYGPATH_W) 'siglabel.cpp'; else $(CYGPATH_W) '$(srcdir)/siglabel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-siglabel.Tpo $(DEPDIR)/libwidgets_a-siglabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='siglabel.cpp' object='libwidgets_a-siglabel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-siglabel.obj `if test -f 'siglabel.cpp'; then $(CYGPATH_W) 'siglabel.cpp'; else $(CYGPATH_W) '$(srcdir)/siglabel.cpp'; fi`
+
+libwidgets_a-ttoolbar.o: ttoolbar.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-ttoolbar.o -MD -MP -MF $(DEPDIR)/libwidgets_a-ttoolbar.Tpo -c -o libwidgets_a-ttoolbar.o `test -f 'ttoolbar.cpp' || echo '$(srcdir)/'`ttoolbar.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-ttoolbar.Tpo $(DEPDIR)/libwidgets_a-ttoolbar.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ttoolbar.cpp' object='libwidgets_a-ttoolbar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-ttoolbar.o `test -f 'ttoolbar.cpp' || echo '$(srcdir)/'`ttoolbar.cpp
+
+libwidgets_a-ttoolbar.obj: ttoolbar.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-ttoolbar.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-ttoolbar.Tpo -c -o libwidgets_a-ttoolbar.obj `if test -f 'ttoolbar.cpp'; then $(CYGPATH_W) 'ttoolbar.cpp'; else $(CYGPATH_W) '$(srcdir)/ttoolbar.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-ttoolbar.Tpo $(DEPDIR)/libwidgets_a-ttoolbar.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ttoolbar.cpp' object='libwidgets_a-ttoolbar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-ttoolbar.obj `if test -f 'ttoolbar.cpp'; then $(CYGPATH_W) 'ttoolbar.cpp'; else $(CYGPATH_W) '$(srcdir)/ttoolbar.cpp'; fi`
+
+libwidgets_a-ttoolbutton.o: ttoolbutton.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-ttoolbutton.o -MD -MP -MF $(DEPDIR)/libwidgets_a-ttoolbutton.Tpo -c -o libwidgets_a-ttoolbutton.o `test -f 'ttoolbutton.cpp' || echo '$(srcdir)/'`ttoolbutton.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-ttoolbutton.Tpo $(DEPDIR)/libwidgets_a-ttoolbutton.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ttoolbutton.cpp' object='libwidgets_a-ttoolbutton.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-ttoolbutton.o `test -f 'ttoolbutton.cpp' || echo '$(srcdir)/'`ttoolbutton.cpp
+
+libwidgets_a-ttoolbutton.obj: ttoolbutton.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-ttoolbutton.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-ttoolbutton.Tpo -c -o libwidgets_a-ttoolbutton.obj `if test -f 'ttoolbutton.cpp'; then $(CYGPATH_W) 'ttoolbutton.cpp'; else $(CYGPATH_W) '$(srcdir)/ttoolbutton.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-ttoolbutton.Tpo $(DEPDIR)/libwidgets_a-ttoolbutton.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ttoolbutton.cpp' object='libwidgets_a-ttoolbutton.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-ttoolbutton.obj `if test -f 'ttoolbutton.cpp'; then $(CYGPATH_W) 'ttoolbutton.cpp'; else $(CYGPATH_W) '$(srcdir)/ttoolbutton.cpp'; fi`
+
+libwidgets_a-tb1.o: tb1.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-tb1.o -MD -MP -MF $(DEPDIR)/libwidgets_a-tb1.Tpo -c -o libwidgets_a-tb1.o `test -f 'tb1.cpp' || echo '$(srcdir)/'`tb1.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-tb1.Tpo $(DEPDIR)/libwidgets_a-tb1.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tb1.cpp' object='libwidgets_a-tb1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-tb1.o `test -f 'tb1.cpp' || echo '$(srcdir)/'`tb1.cpp
+
+libwidgets_a-tb1.obj: tb1.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-tb1.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-tb1.Tpo -c -o libwidgets_a-tb1.obj `if test -f 'tb1.cpp'; then $(CYGPATH_W) 'tb1.cpp'; else $(CYGPATH_W) '$(srcdir)/tb1.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-tb1.Tpo $(DEPDIR)/libwidgets_a-tb1.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tb1.cpp' object='libwidgets_a-tb1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-tb1.obj `if test -f 'tb1.cpp'; then $(CYGPATH_W) 'tb1.cpp'; else $(CYGPATH_W) '$(srcdir)/tb1.cpp'; fi`
+
+libwidgets_a-lcombo.o: lcombo.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-lcombo.o -MD -MP -MF $(DEPDIR)/libwidgets_a-lcombo.Tpo -c -o libwidgets_a-lcombo.o `test -f 'lcombo.cpp' || echo '$(srcdir)/'`lcombo.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-lcombo.Tpo $(DEPDIR)/libwidgets_a-lcombo.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lcombo.cpp' object='libwidgets_a-lcombo.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-lcombo.o `test -f 'lcombo.cpp' || echo '$(srcdir)/'`lcombo.cpp
+
+libwidgets_a-lcombo.obj: lcombo.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-lcombo.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-lcombo.Tpo -c -o libwidgets_a-lcombo.obj `if test -f 'lcombo.cpp'; then $(CYGPATH_W) 'lcombo.cpp'; else $(CYGPATH_W) '$(srcdir)/lcombo.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-lcombo.Tpo $(DEPDIR)/libwidgets_a-lcombo.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lcombo.cpp' object='libwidgets_a-lcombo.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-lcombo.obj `if test -f 'lcombo.cpp'; then $(CYGPATH_W) 'lcombo.cpp'; else $(CYGPATH_W) '$(srcdir)/lcombo.cpp'; fi`
+
+libwidgets_a-swidget.o: swidget.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-swidget.o -MD -MP -MF $(DEPDIR)/libwidgets_a-swidget.Tpo -c -o libwidgets_a-swidget.o `test -f 'swidget.cpp' || echo '$(srcdir)/'`swidget.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-swidget.Tpo $(DEPDIR)/libwidgets_a-swidget.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='swidget.cpp' object='libwidgets_a-swidget.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-swidget.o `test -f 'swidget.cpp' || echo '$(srcdir)/'`swidget.cpp
+
+libwidgets_a-swidget.obj: swidget.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-swidget.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-swidget.Tpo -c -o libwidgets_a-swidget.obj `if test -f 'swidget.cpp'; then $(CYGPATH_W) 'swidget.cpp'; else $(CYGPATH_W) '$(srcdir)/swidget.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-swidget.Tpo $(DEPDIR)/libwidgets_a-swidget.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='swidget.cpp' object='libwidgets_a-swidget.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-swidget.obj `if test -f 'swidget.cpp'; then $(CYGPATH_W) 'swidget.cpp'; else $(CYGPATH_W) '$(srcdir)/swidget.cpp'; fi`
+
+libwidgets_a-tempolabel.o: tempolabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-tempolabel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-tempolabel.Tpo -c -o libwidgets_a-tempolabel.o `test -f 'tempolabel.cpp' || echo '$(srcdir)/'`tempolabel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-tempolabel.Tpo $(DEPDIR)/libwidgets_a-tempolabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tempolabel.cpp' object='libwidgets_a-tempolabel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-tempolabel.o `test -f 'tempolabel.cpp' || echo '$(srcdir)/'`tempolabel.cpp
+
+libwidgets_a-tempolabel.obj: tempolabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-tempolabel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-tempolabel.Tpo -c -o libwidgets_a-tempolabel.obj `if test -f 'tempolabel.cpp'; then $(CYGPATH_W) 'tempolabel.cpp'; else $(CYGPATH_W) '$(srcdir)/tempolabel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-tempolabel.Tpo $(DEPDIR)/libwidgets_a-tempolabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tempolabel.cpp' object='libwidgets_a-tempolabel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-tempolabel.obj `if test -f 'tempolabel.cpp'; then $(CYGPATH_W) 'tempolabel.cpp'; else $(CYGPATH_W) '$(srcdir)/tempolabel.cpp'; fi`
+
+libwidgets_a-tools.o: tools.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-tools.o -MD -MP -MF $(DEPDIR)/libwidgets_a-tools.Tpo -c -o libwidgets_a-tools.o `test -f 'tools.cpp' || echo '$(srcdir)/'`tools.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-tools.Tpo $(DEPDIR)/libwidgets_a-tools.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tools.cpp' object='libwidgets_a-tools.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-tools.o `test -f 'tools.cpp' || echo '$(srcdir)/'`tools.cpp
+
+libwidgets_a-tools.obj: tools.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-tools.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-tools.Tpo -c -o libwidgets_a-tools.obj `if test -f 'tools.cpp'; then $(CYGPATH_W) 'tools.cpp'; else $(CYGPATH_W) '$(srcdir)/tools.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-tools.Tpo $(DEPDIR)/libwidgets_a-tools.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tools.cpp' object='libwidgets_a-tools.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-tools.obj `if test -f 'tools.cpp'; then $(CYGPATH_W) 'tools.cpp'; else $(CYGPATH_W) '$(srcdir)/tools.cpp'; fi`
+
+libwidgets_a-fontsel.o: fontsel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-fontsel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-fontsel.Tpo -c -o libwidgets_a-fontsel.o `test -f 'fontsel.cpp' || echo '$(srcdir)/'`fontsel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-fontsel.Tpo $(DEPDIR)/libwidgets_a-fontsel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fontsel.cpp' object='libwidgets_a-fontsel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-fontsel.o `test -f 'fontsel.cpp' || echo '$(srcdir)/'`fontsel.cpp
+
+libwidgets_a-fontsel.obj: fontsel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-fontsel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-fontsel.Tpo -c -o libwidgets_a-fontsel.obj `if test -f 'fontsel.cpp'; then $(CYGPATH_W) 'fontsel.cpp'; else $(CYGPATH_W) '$(srcdir)/fontsel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-fontsel.Tpo $(DEPDIR)/libwidgets_a-fontsel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fontsel.cpp' object='libwidgets_a-fontsel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-fontsel.obj `if test -f 'fontsel.cpp'; then $(CYGPATH_W) 'fontsel.cpp'; else $(CYGPATH_W) '$(srcdir)/fontsel.cpp'; fi`
+
+libwidgets_a-ctrlcombo.o: ctrlcombo.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-ctrlcombo.o -MD -MP -MF $(DEPDIR)/libwidgets_a-ctrlcombo.Tpo -c -o libwidgets_a-ctrlcombo.o `test -f 'ctrlcombo.cpp' || echo '$(srcdir)/'`ctrlcombo.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-ctrlcombo.Tpo $(DEPDIR)/libwidgets_a-ctrlcombo.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ctrlcombo.cpp' object='libwidgets_a-ctrlcombo.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-ctrlcombo.o `test -f 'ctrlcombo.cpp' || echo '$(srcdir)/'`ctrlcombo.cpp
+
+libwidgets_a-ctrlcombo.obj: ctrlcombo.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-ctrlcombo.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-ctrlcombo.Tpo -c -o libwidgets_a-ctrlcombo.obj `if test -f 'ctrlcombo.cpp'; then $(CYGPATH_W) 'ctrlcombo.cpp'; else $(CYGPATH_W) '$(srcdir)/ctrlcombo.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-ctrlcombo.Tpo $(DEPDIR)/libwidgets_a-ctrlcombo.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ctrlcombo.cpp' object='libwidgets_a-ctrlcombo.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-ctrlcombo.obj `if test -f 'ctrlcombo.cpp'; then $(CYGPATH_W) 'ctrlcombo.cpp'; else $(CYGPATH_W) '$(srcdir)/ctrlcombo.cpp'; fi`
+
+libwidgets_a-sliderbase.o: sliderbase.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-sliderbase.o -MD -MP -MF $(DEPDIR)/libwidgets_a-sliderbase.Tpo -c -o libwidgets_a-sliderbase.o `test -f 'sliderbase.cpp' || echo '$(srcdir)/'`sliderbase.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-sliderbase.Tpo $(DEPDIR)/libwidgets_a-sliderbase.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sliderbase.cpp' object='libwidgets_a-sliderbase.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-sliderbase.o `test -f 'sliderbase.cpp' || echo '$(srcdir)/'`sliderbase.cpp
+
+libwidgets_a-sliderbase.obj: sliderbase.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-sliderbase.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-sliderbase.Tpo -c -o libwidgets_a-sliderbase.obj `if test -f 'sliderbase.cpp'; then $(CYGPATH_W) 'sliderbase.cpp'; else $(CYGPATH_W) '$(srcdir)/sliderbase.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-sliderbase.Tpo $(DEPDIR)/libwidgets_a-sliderbase.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sliderbase.cpp' object='libwidgets_a-sliderbase.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-sliderbase.obj `if test -f 'sliderbase.cpp'; then $(CYGPATH_W) 'sliderbase.cpp'; else $(CYGPATH_W) '$(srcdir)/sliderbase.cpp'; fi`
+
+libwidgets_a-slider.o: slider.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-slider.o -MD -MP -MF $(DEPDIR)/libwidgets_a-slider.Tpo -c -o libwidgets_a-slider.o `test -f 'slider.cpp' || echo '$(srcdir)/'`slider.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-slider.Tpo $(DEPDIR)/libwidgets_a-slider.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='slider.cpp' object='libwidgets_a-slider.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-slider.o `test -f 'slider.cpp' || echo '$(srcdir)/'`slider.cpp
+
+libwidgets_a-slider.obj: slider.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-slider.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-slider.Tpo -c -o libwidgets_a-slider.obj `if test -f 'slider.cpp'; then $(CYGPATH_W) 'slider.cpp'; else $(CYGPATH_W) '$(srcdir)/slider.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-slider.Tpo $(DEPDIR)/libwidgets_a-slider.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='slider.cpp' object='libwidgets_a-slider.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-slider.obj `if test -f 'slider.cpp'; then $(CYGPATH_W) 'slider.cpp'; else $(CYGPATH_W) '$(srcdir)/slider.cpp'; fi`
+
+libwidgets_a-midisyncimpl.o: midisyncimpl.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-midisyncimpl.o -MD -MP -MF $(DEPDIR)/libwidgets_a-midisyncimpl.Tpo -c -o libwidgets_a-midisyncimpl.o `test -f 'midisyncimpl.cpp' || echo '$(srcdir)/'`midisyncimpl.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-midisyncimpl.Tpo $(DEPDIR)/libwidgets_a-midisyncimpl.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='midisyncimpl.cpp' object='libwidgets_a-midisyncimpl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-midisyncimpl.o `test -f 'midisyncimpl.cpp' || echo '$(srcdir)/'`midisyncimpl.cpp
+
+libwidgets_a-midisyncimpl.obj: midisyncimpl.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-midisyncimpl.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-midisyncimpl.Tpo -c -o libwidgets_a-midisyncimpl.obj `if test -f 'midisyncimpl.cpp'; then $(CYGPATH_W) 'midisyncimpl.cpp'; else $(CYGPATH_W) '$(srcdir)/midisyncimpl.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-midisyncimpl.Tpo $(DEPDIR)/libwidgets_a-midisyncimpl.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='midisyncimpl.cpp' object='libwidgets_a-midisyncimpl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-midisyncimpl.obj `if test -f 'midisyncimpl.cpp'; then $(CYGPATH_W) 'midisyncimpl.cpp'; else $(CYGPATH_W) '$(srcdir)/midisyncimpl.cpp'; fi`
+
+libwidgets_a-header.o: header.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-header.o -MD -MP -MF $(DEPDIR)/libwidgets_a-header.Tpo -c -o libwidgets_a-header.o `test -f 'header.cpp' || echo '$(srcdir)/'`header.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-header.Tpo $(DEPDIR)/libwidgets_a-header.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='header.cpp' object='libwidgets_a-header.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-header.o `test -f 'header.cpp' || echo '$(srcdir)/'`header.cpp
+
+libwidgets_a-header.obj: header.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-header.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-header.Tpo -c -o libwidgets_a-header.obj `if test -f 'header.cpp'; then $(CYGPATH_W) 'header.cpp'; else $(CYGPATH_W) '$(srcdir)/header.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-header.Tpo $(DEPDIR)/libwidgets_a-header.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='header.cpp' object='libwidgets_a-header.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-header.obj `if test -f 'header.cpp'; then $(CYGPATH_W) 'header.cpp'; else $(CYGPATH_W) '$(srcdir)/header.cpp'; fi`
+
+libwidgets_a-knob.o: knob.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-knob.o -MD -MP -MF $(DEPDIR)/libwidgets_a-knob.Tpo -c -o libwidgets_a-knob.o `test -f 'knob.cpp' || echo '$(srcdir)/'`knob.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-knob.Tpo $(DEPDIR)/libwidgets_a-knob.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='knob.cpp' object='libwidgets_a-knob.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-knob.o `test -f 'knob.cpp' || echo '$(srcdir)/'`knob.cpp
+
+libwidgets_a-knob.obj: knob.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-knob.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-knob.Tpo -c -o libwidgets_a-knob.obj `if test -f 'knob.cpp'; then $(CYGPATH_W) 'knob.cpp'; else $(CYGPATH_W) '$(srcdir)/knob.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-knob.Tpo $(DEPDIR)/libwidgets_a-knob.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='knob.cpp' object='libwidgets_a-knob.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-knob.obj `if test -f 'knob.cpp'; then $(CYGPATH_W) 'knob.cpp'; else $(CYGPATH_W) '$(srcdir)/knob.cpp'; fi`
+
+libwidgets_a-mlabel.o: mlabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-mlabel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-mlabel.Tpo -c -o libwidgets_a-mlabel.o `test -f 'mlabel.cpp' || echo '$(srcdir)/'`mlabel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-mlabel.Tpo $(DEPDIR)/libwidgets_a-mlabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='mlabel.cpp' object='libwidgets_a-mlabel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-mlabel.o `test -f 'mlabel.cpp' || echo '$(srcdir)/'`mlabel.cpp
+
+libwidgets_a-mlabel.obj: mlabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-mlabel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-mlabel.Tpo -c -o libwidgets_a-mlabel.obj `if test -f 'mlabel.cpp'; then $(CYGPATH_W) 'mlabel.cpp'; else $(CYGPATH_W) '$(srcdir)/mlabel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-mlabel.Tpo $(DEPDIR)/libwidgets_a-mlabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='mlabel.cpp' object='libwidgets_a-mlabel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-mlabel.obj `if test -f 'mlabel.cpp'; then $(CYGPATH_W) 'mlabel.cpp'; else $(CYGPATH_W) '$(srcdir)/mlabel.cpp'; fi`
+
+libwidgets_a-genset.o: genset.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-genset.o -MD -MP -MF $(DEPDIR)/libwidgets_a-genset.Tpo -c -o libwidgets_a-genset.o `test -f 'genset.cpp' || echo '$(srcdir)/'`genset.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-genset.Tpo $(DEPDIR)/libwidgets_a-genset.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='genset.cpp' object='libwidgets_a-genset.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-genset.o `test -f 'genset.cpp' || echo '$(srcdir)/'`genset.cpp
+
+libwidgets_a-genset.obj: genset.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-genset.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-genset.Tpo -c -o libwidgets_a-genset.obj `if test -f 'genset.cpp'; then $(CYGPATH_W) 'genset.cpp'; else $(CYGPATH_W) '$(srcdir)/genset.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-genset.Tpo $(DEPDIR)/libwidgets_a-genset.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='genset.cpp' object='libwidgets_a-genset.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-genset.obj `if test -f 'genset.cpp'; then $(CYGPATH_W) 'genset.cpp'; else $(CYGPATH_W) '$(srcdir)/genset.cpp'; fi`
+
+libwidgets_a-mixdowndialog.o: mixdowndialog.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-mixdowndialog.o -MD -MP -MF $(DEPDIR)/libwidgets_a-mixdowndialog.Tpo -c -o libwidgets_a-mixdowndialog.o `test -f 'mixdowndialog.cpp' || echo '$(srcdir)/'`mixdowndialog.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-mixdowndialog.Tpo $(DEPDIR)/libwidgets_a-mixdowndialog.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='mixdowndialog.cpp' object='libwidgets_a-mixdowndialog.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-mixdowndialog.o `test -f 'mixdowndialog.cpp' || echo '$(srcdir)/'`mixdowndialog.cpp
+
+libwidgets_a-mixdowndialog.obj: mixdowndialog.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-mixdowndialog.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-mixdowndialog.Tpo -c -o libwidgets_a-mixdowndialog.obj `if test -f 'mixdowndialog.cpp'; then $(CYGPATH_W) 'mixdowndialog.cpp'; else $(CYGPATH_W) '$(srcdir)/mixdowndialog.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-mixdowndialog.Tpo $(DEPDIR)/libwidgets_a-mixdowndialog.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='mixdowndialog.cpp' object='libwidgets_a-mixdowndialog.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-mixdowndialog.obj `if test -f 'mixdowndialog.cpp'; then $(CYGPATH_W) 'mixdowndialog.cpp'; else $(CYGPATH_W) '$(srcdir)/mixdowndialog.cpp'; fi`
+
+libwidgets_a-spinboxFP.o: spinboxFP.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-spinboxFP.o -MD -MP -MF $(DEPDIR)/libwidgets_a-spinboxFP.Tpo -c -o libwidgets_a-spinboxFP.o `test -f 'spinboxFP.cpp' || echo '$(srcdir)/'`spinboxFP.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-spinboxFP.Tpo $(DEPDIR)/libwidgets_a-spinboxFP.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='spinboxFP.cpp' object='libwidgets_a-spinboxFP.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-spinboxFP.o `test -f 'spinboxFP.cpp' || echo '$(srcdir)/'`spinboxFP.cpp
+
+libwidgets_a-spinboxFP.obj: spinboxFP.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-spinboxFP.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-spinboxFP.Tpo -c -o libwidgets_a-spinboxFP.obj `if test -f 'spinboxFP.cpp'; then $(CYGPATH_W) 'spinboxFP.cpp'; else $(CYGPATH_W) '$(srcdir)/spinboxFP.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-spinboxFP.Tpo $(DEPDIR)/libwidgets_a-spinboxFP.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='spinboxFP.cpp' object='libwidgets_a-spinboxFP.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-spinboxFP.obj `if test -f 'spinboxFP.cpp'; then $(CYGPATH_W) 'spinboxFP.cpp'; else $(CYGPATH_W) '$(srcdir)/spinboxFP.cpp'; fi`
+
+libwidgets_a-spinbox.o: spinbox.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-spinbox.o -MD -MP -MF $(DEPDIR)/libwidgets_a-spinbox.Tpo -c -o libwidgets_a-spinbox.o `test -f 'spinbox.cpp' || echo '$(srcdir)/'`spinbox.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-spinbox.Tpo $(DEPDIR)/libwidgets_a-spinbox.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='spinbox.cpp' object='libwidgets_a-spinbox.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-spinbox.o `test -f 'spinbox.cpp' || echo '$(srcdir)/'`spinbox.cpp
+
+libwidgets_a-spinbox.obj: spinbox.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-spinbox.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-spinbox.Tpo -c -o libwidgets_a-spinbox.obj `if test -f 'spinbox.cpp'; then $(CYGPATH_W) 'spinbox.cpp'; else $(CYGPATH_W) '$(srcdir)/spinbox.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-spinbox.Tpo $(DEPDIR)/libwidgets_a-spinbox.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='spinbox.cpp' object='libwidgets_a-spinbox.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-spinbox.obj `if test -f 'spinbox.cpp'; then $(CYGPATH_W) 'spinbox.cpp'; else $(CYGPATH_W) '$(srcdir)/spinbox.cpp'; fi`
+
+libwidgets_a-comboQuant.o: comboQuant.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-comboQuant.o -MD -MP -MF $(DEPDIR)/libwidgets_a-comboQuant.Tpo -c -o libwidgets_a-comboQuant.o `test -f 'comboQuant.cpp' || echo '$(srcdir)/'`comboQuant.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-comboQuant.Tpo $(DEPDIR)/libwidgets_a-comboQuant.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='comboQuant.cpp' object='libwidgets_a-comboQuant.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-comboQuant.o `test -f 'comboQuant.cpp' || echo '$(srcdir)/'`comboQuant.cpp
+
+libwidgets_a-comboQuant.obj: comboQuant.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-comboQuant.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-comboQuant.Tpo -c -o libwidgets_a-comboQuant.obj `if test -f 'comboQuant.cpp'; then $(CYGPATH_W) 'comboQuant.cpp'; else $(CYGPATH_W) '$(srcdir)/comboQuant.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-comboQuant.Tpo $(DEPDIR)/libwidgets_a-comboQuant.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='comboQuant.cpp' object='libwidgets_a-comboQuant.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-comboQuant.obj `if test -f 'comboQuant.cpp'; then $(CYGPATH_W) 'comboQuant.cpp'; else $(CYGPATH_W) '$(srcdir)/comboQuant.cpp'; fi`
+
+libwidgets_a-bigtime.o: bigtime.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-bigtime.o -MD -MP -MF $(DEPDIR)/libwidgets_a-bigtime.Tpo -c -o libwidgets_a-bigtime.o `test -f 'bigtime.cpp' || echo '$(srcdir)/'`bigtime.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-bigtime.Tpo $(DEPDIR)/libwidgets_a-bigtime.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='bigtime.cpp' object='libwidgets_a-bigtime.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-bigtime.o `test -f 'bigtime.cpp' || echo '$(srcdir)/'`bigtime.cpp
+
+libwidgets_a-bigtime.obj: bigtime.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-bigtime.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-bigtime.Tpo -c -o libwidgets_a-bigtime.obj `if test -f 'bigtime.cpp'; then $(CYGPATH_W) 'bigtime.cpp'; else $(CYGPATH_W) '$(srcdir)/bigtime.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-bigtime.Tpo $(DEPDIR)/libwidgets_a-bigtime.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='bigtime.cpp' object='libwidgets_a-bigtime.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-bigtime.obj `if test -f 'bigtime.cpp'; then $(CYGPATH_W) 'bigtime.cpp'; else $(CYGPATH_W) '$(srcdir)/bigtime.cpp'; fi`
+
+libwidgets_a-comment.o: comment.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-comment.o -MD -MP -MF $(DEPDIR)/libwidgets_a-comment.Tpo -c -o libwidgets_a-comment.o `test -f 'comment.cpp' || echo '$(srcdir)/'`comment.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-comment.Tpo $(DEPDIR)/libwidgets_a-comment.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='comment.cpp' object='libwidgets_a-comment.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-comment.o `test -f 'comment.cpp' || echo '$(srcdir)/'`comment.cpp
+
+libwidgets_a-comment.obj: comment.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-comment.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-comment.Tpo -c -o libwidgets_a-comment.obj `if test -f 'comment.cpp'; then $(CYGPATH_W) 'comment.cpp'; else $(CYGPATH_W) '$(srcdir)/comment.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-comment.Tpo $(DEPDIR)/libwidgets_a-comment.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='comment.cpp' object='libwidgets_a-comment.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-comment.obj `if test -f 'comment.cpp'; then $(CYGPATH_W) 'comment.cpp'; else $(CYGPATH_W) '$(srcdir)/comment.cpp'; fi`
+
+libwidgets_a-splitter.o: splitter.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-splitter.o -MD -MP -MF $(DEPDIR)/libwidgets_a-splitter.Tpo -c -o libwidgets_a-splitter.o `test -f 'splitter.cpp' || echo '$(srcdir)/'`splitter.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-splitter.Tpo $(DEPDIR)/libwidgets_a-splitter.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='splitter.cpp' object='libwidgets_a-splitter.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-splitter.o `test -f 'splitter.cpp' || echo '$(srcdir)/'`splitter.cpp
+
+libwidgets_a-splitter.obj: splitter.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-splitter.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-splitter.Tpo -c -o libwidgets_a-splitter.obj `if test -f 'splitter.cpp'; then $(CYGPATH_W) 'splitter.cpp'; else $(CYGPATH_W) '$(srcdir)/splitter.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-splitter.Tpo $(DEPDIR)/libwidgets_a-splitter.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='splitter.cpp' object='libwidgets_a-splitter.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-splitter.obj `if test -f 'splitter.cpp'; then $(CYGPATH_W) 'splitter.cpp'; else $(CYGPATH_W) '$(srcdir)/splitter.cpp'; fi`
+
+libwidgets_a-gatetime.o: gatetime.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-gatetime.o -MD -MP -MF $(DEPDIR)/libwidgets_a-gatetime.Tpo -c -o libwidgets_a-gatetime.o `test -f 'gatetime.cpp' || echo '$(srcdir)/'`gatetime.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-gatetime.Tpo $(DEPDIR)/libwidgets_a-gatetime.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='gatetime.cpp' object='libwidgets_a-gatetime.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-gatetime.o `test -f 'gatetime.cpp' || echo '$(srcdir)/'`gatetime.cpp
+
+libwidgets_a-gatetime.obj: gatetime.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-gatetime.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-gatetime.Tpo -c -o libwidgets_a-gatetime.obj `if test -f 'gatetime.cpp'; then $(CYGPATH_W) 'gatetime.cpp'; else $(CYGPATH_W) '$(srcdir)/gatetime.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-gatetime.Tpo $(DEPDIR)/libwidgets_a-gatetime.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='gatetime.cpp' object='libwidgets_a-gatetime.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-gatetime.obj `if test -f 'gatetime.cpp'; then $(CYGPATH_W) 'gatetime.cpp'; else $(CYGPATH_W) '$(srcdir)/gatetime.cpp'; fi`
+
+libwidgets_a-velocity.o: velocity.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-velocity.o -MD -MP -MF $(DEPDIR)/libwidgets_a-velocity.Tpo -c -o libwidgets_a-velocity.o `test -f 'velocity.cpp' || echo '$(srcdir)/'`velocity.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-velocity.Tpo $(DEPDIR)/libwidgets_a-velocity.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='velocity.cpp' object='libwidgets_a-velocity.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-velocity.o `test -f 'velocity.cpp' || echo '$(srcdir)/'`velocity.cpp
+
+libwidgets_a-velocity.obj: velocity.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-velocity.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-velocity.Tpo -c -o libwidgets_a-velocity.obj `if test -f 'velocity.cpp'; then $(CYGPATH_W) 'velocity.cpp'; else $(CYGPATH_W) '$(srcdir)/velocity.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-velocity.Tpo $(DEPDIR)/libwidgets_a-velocity.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='velocity.cpp' object='libwidgets_a-velocity.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-velocity.obj `if test -f 'velocity.cpp'; then $(CYGPATH_W) 'velocity.cpp'; else $(CYGPATH_W) '$(srcdir)/velocity.cpp'; fi`
+
+libwidgets_a-metronome.o: metronome.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-metronome.o -MD -MP -MF $(DEPDIR)/libwidgets_a-metronome.Tpo -c -o libwidgets_a-metronome.o `test -f 'metronome.cpp' || echo '$(srcdir)/'`metronome.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-metronome.Tpo $(DEPDIR)/libwidgets_a-metronome.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='metronome.cpp' object='libwidgets_a-metronome.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-metronome.o `test -f 'metronome.cpp' || echo '$(srcdir)/'`metronome.cpp
+
+libwidgets_a-metronome.obj: metronome.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-metronome.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-metronome.Tpo -c -o libwidgets_a-metronome.obj `if test -f 'metronome.cpp'; then $(CYGPATH_W) 'metronome.cpp'; else $(CYGPATH_W) '$(srcdir)/metronome.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-metronome.Tpo $(DEPDIR)/libwidgets_a-metronome.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='metronome.cpp' object='libwidgets_a-metronome.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-metronome.obj `if test -f 'metronome.cpp'; then $(CYGPATH_W) 'metronome.cpp'; else $(CYGPATH_W) '$(srcdir)/metronome.cpp'; fi`
+
+libwidgets_a-posedit.o: posedit.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-posedit.o -MD -MP -MF $(DEPDIR)/libwidgets_a-posedit.Tpo -c -o libwidgets_a-posedit.o `test -f 'posedit.cpp' || echo '$(srcdir)/'`posedit.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-posedit.Tpo $(DEPDIR)/libwidgets_a-posedit.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='posedit.cpp' object='libwidgets_a-posedit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-posedit.o `test -f 'posedit.cpp' || echo '$(srcdir)/'`posedit.cpp
+
+libwidgets_a-posedit.obj: posedit.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-posedit.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-posedit.Tpo -c -o libwidgets_a-posedit.obj `if test -f 'posedit.cpp'; then $(CYGPATH_W) 'posedit.cpp'; else $(CYGPATH_W) '$(srcdir)/posedit.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-posedit.Tpo $(DEPDIR)/libwidgets_a-posedit.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='posedit.cpp' object='libwidgets_a-posedit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-posedit.obj `if test -f 'posedit.cpp'; then $(CYGPATH_W) 'posedit.cpp'; else $(CYGPATH_W) '$(srcdir)/posedit.cpp'; fi`
+
+libwidgets_a-pitchedit.o: pitchedit.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-pitchedit.o -MD -MP -MF $(DEPDIR)/libwidgets_a-pitchedit.Tpo -c -o libwidgets_a-pitchedit.o `test -f 'pitchedit.cpp' || echo '$(srcdir)/'`pitchedit.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-pitchedit.Tpo $(DEPDIR)/libwidgets_a-pitchedit.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='pitchedit.cpp' object='libwidgets_a-pitchedit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-pitchedit.o `test -f 'pitchedit.cpp' || echo '$(srcdir)/'`pitchedit.cpp
+
+libwidgets_a-pitchedit.obj: pitchedit.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-pitchedit.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-pitchedit.Tpo -c -o libwidgets_a-pitchedit.obj `if test -f 'pitchedit.cpp'; then $(CYGPATH_W) 'pitchedit.cpp'; else $(CYGPATH_W) '$(srcdir)/pitchedit.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-pitchedit.Tpo $(DEPDIR)/libwidgets_a-pitchedit.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='pitchedit.cpp' object='libwidgets_a-pitchedit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-pitchedit.obj `if test -f 'pitchedit.cpp'; then $(CYGPATH_W) 'pitchedit.cpp'; else $(CYGPATH_W) '$(srcdir)/pitchedit.cpp'; fi`
+
+libwidgets_a-pitchlabel.o: pitchlabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-pitchlabel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-pitchlabel.Tpo -c -o libwidgets_a-pitchlabel.o `test -f 'pitchlabel.cpp' || echo '$(srcdir)/'`pitchlabel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-pitchlabel.Tpo $(DEPDIR)/libwidgets_a-pitchlabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='pitchlabel.cpp' object='libwidgets_a-pitchlabel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-pitchlabel.o `test -f 'pitchlabel.cpp' || echo '$(srcdir)/'`pitchlabel.cpp
+
+libwidgets_a-pitchlabel.obj: pitchlabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-pitchlabel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-pitchlabel.Tpo -c -o libwidgets_a-pitchlabel.obj `if test -f 'pitchlabel.cpp'; then $(CYGPATH_W) 'pitchlabel.cpp'; else $(CYGPATH_W) '$(srcdir)/pitchlabel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-pitchlabel.Tpo $(DEPDIR)/libwidgets_a-pitchlabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='pitchlabel.cpp' object='libwidgets_a-pitchlabel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-pitchlabel.obj `if test -f 'pitchlabel.cpp'; then $(CYGPATH_W) 'pitchlabel.cpp'; else $(CYGPATH_W) '$(srcdir)/pitchlabel.cpp'; fi`
+
+libwidgets_a-poslabel.o: poslabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-poslabel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-poslabel.Tpo -c -o libwidgets_a-poslabel.o `test -f 'poslabel.cpp' || echo '$(srcdir)/'`poslabel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-poslabel.Tpo $(DEPDIR)/libwidgets_a-poslabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='poslabel.cpp' object='libwidgets_a-poslabel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-poslabel.o `test -f 'poslabel.cpp' || echo '$(srcdir)/'`poslabel.cpp
+
+libwidgets_a-poslabel.obj: poslabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-poslabel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-poslabel.Tpo -c -o libwidgets_a-poslabel.obj `if test -f 'poslabel.cpp'; then $(CYGPATH_W) 'poslabel.cpp'; else $(CYGPATH_W) '$(srcdir)/poslabel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-poslabel.Tpo $(DEPDIR)/libwidgets_a-poslabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='poslabel.cpp' object='libwidgets_a-poslabel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-poslabel.obj `if test -f 'poslabel.cpp'; then $(CYGPATH_W) 'poslabel.cpp'; else $(CYGPATH_W) '$(srcdir)/poslabel.cpp'; fi`
+
+libwidgets_a-filedialog.o: filedialog.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-filedialog.o -MD -MP -MF $(DEPDIR)/libwidgets_a-filedialog.Tpo -c -o libwidgets_a-filedialog.o `test -f 'filedialog.cpp' || echo '$(srcdir)/'`filedialog.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-filedialog.Tpo $(DEPDIR)/libwidgets_a-filedialog.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='filedialog.cpp' object='libwidgets_a-filedialog.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-filedialog.o `test -f 'filedialog.cpp' || echo '$(srcdir)/'`filedialog.cpp
+
+libwidgets_a-filedialog.obj: filedialog.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-filedialog.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-filedialog.Tpo -c -o libwidgets_a-filedialog.obj `if test -f 'filedialog.cpp'; then $(CYGPATH_W) 'filedialog.cpp'; else $(CYGPATH_W) '$(srcdir)/filedialog.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-filedialog.Tpo $(DEPDIR)/libwidgets_a-filedialog.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='filedialog.cpp' object='libwidgets_a-filedialog.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-filedialog.obj `if test -f 'filedialog.cpp'; then $(CYGPATH_W) 'filedialog.cpp'; else $(CYGPATH_W) '$(srcdir)/filedialog.cpp'; fi`
+
+libwidgets_a-sigedit.o: sigedit.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-sigedit.o -MD -MP -MF $(DEPDIR)/libwidgets_a-sigedit.Tpo -c -o libwidgets_a-sigedit.o `test -f 'sigedit.cpp' || echo '$(srcdir)/'`sigedit.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-sigedit.Tpo $(DEPDIR)/libwidgets_a-sigedit.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sigedit.cpp' object='libwidgets_a-sigedit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-sigedit.o `test -f 'sigedit.cpp' || echo '$(srcdir)/'`sigedit.cpp
+
+libwidgets_a-sigedit.obj: sigedit.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-sigedit.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-sigedit.Tpo -c -o libwidgets_a-sigedit.obj `if test -f 'sigedit.cpp'; then $(CYGPATH_W) 'sigedit.cpp'; else $(CYGPATH_W) '$(srcdir)/sigedit.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-sigedit.Tpo $(DEPDIR)/libwidgets_a-sigedit.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sigedit.cpp' object='libwidgets_a-sigedit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-sigedit.obj `if test -f 'sigedit.cpp'; then $(CYGPATH_W) 'sigedit.cpp'; else $(CYGPATH_W) '$(srcdir)/sigedit.cpp'; fi`
+
+libwidgets_a-shortcutconfig.o: shortcutconfig.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-shortcutconfig.o -MD -MP -MF $(DEPDIR)/libwidgets_a-shortcutconfig.Tpo -c -o libwidgets_a-shortcutconfig.o `test -f 'shortcutconfig.cpp' || echo '$(srcdir)/'`shortcutconfig.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-shortcutconfig.Tpo $(DEPDIR)/libwidgets_a-shortcutconfig.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='shortcutconfig.cpp' object='libwidgets_a-shortcutconfig.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-shortcutconfig.o `test -f 'shortcutconfig.cpp' || echo '$(srcdir)/'`shortcutconfig.cpp
+
+libwidgets_a-shortcutconfig.obj: shortcutconfig.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-shortcutconfig.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-shortcutconfig.Tpo -c -o libwidgets_a-shortcutconfig.obj `if test -f 'shortcutconfig.cpp'; then $(CYGPATH_W) 'shortcutconfig.cpp'; else $(CYGPATH_W) '$(srcdir)/shortcutconfig.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-shortcutconfig.Tpo $(DEPDIR)/libwidgets_a-shortcutconfig.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='shortcutconfig.cpp' object='libwidgets_a-shortcutconfig.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-shortcutconfig.obj `if test -f 'shortcutconfig.cpp'; then $(CYGPATH_W) 'shortcutconfig.cpp'; else $(CYGPATH_W) '$(srcdir)/shortcutconfig.cpp'; fi`
+
+libwidgets_a-shortcutcapturedialog.o: shortcutcapturedialog.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-shortcutcapturedialog.o -MD -MP -MF $(DEPDIR)/libwidgets_a-shortcutcapturedialog.Tpo -c -o libwidgets_a-shortcutcapturedialog.o `test -f 'shortcutcapturedialog.cpp' || echo '$(srcdir)/'`shortcutcapturedialog.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-shortcutcapturedialog.Tpo $(DEPDIR)/libwidgets_a-shortcutcapturedialog.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='shortcutcapturedialog.cpp' object='libwidgets_a-shortcutcapturedialog.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-shortcutcapturedialog.o `test -f 'shortcutcapturedialog.cpp' || echo '$(srcdir)/'`shortcutcapturedialog.cpp
+
+libwidgets_a-shortcutcapturedialog.obj: shortcutcapturedialog.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-shortcutcapturedialog.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-shortcutcapturedialog.Tpo -c -o libwidgets_a-shortcutcapturedialog.obj `if test -f 'shortcutcapturedialog.cpp'; then $(CYGPATH_W) 'shortcutcapturedialog.cpp'; else $(CYGPATH_W) '$(srcdir)/shortcutcapturedialog.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-shortcutcapturedialog.Tpo $(DEPDIR)/libwidgets_a-shortcutcapturedialog.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='shortcutcapturedialog.cpp' object='libwidgets_a-shortcutcapturedialog.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-shortcutcapturedialog.obj `if test -f 'shortcutcapturedialog.cpp'; then $(CYGPATH_W) 'shortcutcapturedialog.cpp'; else $(CYGPATH_W) '$(srcdir)/shortcutcapturedialog.cpp'; fi`
+
+libwidgets_a-combobox.o: combobox.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-combobox.o -MD -MP -MF $(DEPDIR)/libwidgets_a-combobox.Tpo -c -o libwidgets_a-combobox.o `test -f 'combobox.cpp' || echo '$(srcdir)/'`combobox.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-combobox.Tpo $(DEPDIR)/libwidgets_a-combobox.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='combobox.cpp' object='libwidgets_a-combobox.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-combobox.o `test -f 'combobox.cpp' || echo '$(srcdir)/'`combobox.cpp
+
+libwidgets_a-combobox.obj: combobox.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-combobox.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-combobox.Tpo -c -o libwidgets_a-combobox.obj `if test -f 'combobox.cpp'; then $(CYGPATH_W) 'combobox.cpp'; else $(CYGPATH_W) '$(srcdir)/combobox.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-combobox.Tpo $(DEPDIR)/libwidgets_a-combobox.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='combobox.cpp' object='libwidgets_a-combobox.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-combobox.obj `if test -f 'combobox.cpp'; then $(CYGPATH_W) 'combobox.cpp'; else $(CYGPATH_W) '$(srcdir)/combobox.cpp'; fi`
+
+libwidgets_a-checkbox.o: checkbox.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-checkbox.o -MD -MP -MF $(DEPDIR)/libwidgets_a-checkbox.Tpo -c -o libwidgets_a-checkbox.o `test -f 'checkbox.cpp' || echo '$(srcdir)/'`checkbox.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-checkbox.Tpo $(DEPDIR)/libwidgets_a-checkbox.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='checkbox.cpp' object='libwidgets_a-checkbox.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-checkbox.o `test -f 'checkbox.cpp' || echo '$(srcdir)/'`checkbox.cpp
+
+libwidgets_a-checkbox.obj: checkbox.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-checkbox.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-checkbox.Tpo -c -o libwidgets_a-checkbox.obj `if test -f 'checkbox.cpp'; then $(CYGPATH_W) 'checkbox.cpp'; else $(CYGPATH_W) '$(srcdir)/checkbox.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-checkbox.Tpo $(DEPDIR)/libwidgets_a-checkbox.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='checkbox.cpp' object='libwidgets_a-checkbox.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-checkbox.obj `if test -f 'checkbox.cpp'; then $(CYGPATH_W) 'checkbox.cpp'; else $(CYGPATH_W) '$(srcdir)/checkbox.cpp'; fi`
+
+libwidgets_a-aboutbox_impl.o: aboutbox_impl.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-aboutbox_impl.o -MD -MP -MF $(DEPDIR)/libwidgets_a-aboutbox_impl.Tpo -c -o libwidgets_a-aboutbox_impl.o `test -f 'aboutbox_impl.cpp' || echo '$(srcdir)/'`aboutbox_impl.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-aboutbox_impl.Tpo $(DEPDIR)/libwidgets_a-aboutbox_impl.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='aboutbox_impl.cpp' object='libwidgets_a-aboutbox_impl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-aboutbox_impl.o `test -f 'aboutbox_impl.cpp' || echo '$(srcdir)/'`aboutbox_impl.cpp
+
+libwidgets_a-aboutbox_impl.obj: aboutbox_impl.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-aboutbox_impl.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-aboutbox_impl.Tpo -c -o libwidgets_a-aboutbox_impl.obj `if test -f 'aboutbox_impl.cpp'; then $(CYGPATH_W) 'aboutbox_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/aboutbox_impl.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-aboutbox_impl.Tpo $(DEPDIR)/libwidgets_a-aboutbox_impl.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='aboutbox_impl.cpp' object='libwidgets_a-aboutbox_impl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-aboutbox_impl.obj `if test -f 'aboutbox_impl.cpp'; then $(CYGPATH_W) 'aboutbox_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/aboutbox_impl.cpp'; fi`
+
+libwidgets_a-popupmenu.o: popupmenu.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-popupmenu.o -MD -MP -MF $(DEPDIR)/libwidgets_a-popupmenu.Tpo -c -o libwidgets_a-popupmenu.o `test -f 'popupmenu.cpp' || echo '$(srcdir)/'`popupmenu.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-popupmenu.Tpo $(DEPDIR)/libwidgets_a-popupmenu.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='popupmenu.cpp' object='libwidgets_a-popupmenu.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-popupmenu.o `test -f 'popupmenu.cpp' || echo '$(srcdir)/'`popupmenu.cpp
+
+libwidgets_a-popupmenu.obj: popupmenu.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-popupmenu.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-popupmenu.Tpo -c -o libwidgets_a-popupmenu.obj `if test -f 'popupmenu.cpp'; then $(CYGPATH_W) 'popupmenu.cpp'; else $(CYGPATH_W) '$(srcdir)/popupmenu.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-popupmenu.Tpo $(DEPDIR)/libwidgets_a-popupmenu.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='popupmenu.cpp' object='libwidgets_a-popupmenu.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-popupmenu.obj `if test -f 'popupmenu.cpp'; then $(CYGPATH_W) 'popupmenu.cpp'; else $(CYGPATH_W) '$(srcdir)/popupmenu.cpp'; fi`
+
+libwidgets_a-moc_scrollscale.o: moc_scrollscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_scrollscale.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_scrollscale.Tpo -c -o libwidgets_a-moc_scrollscale.o `test -f 'moc_scrollscale.cpp' || echo '$(srcdir)/'`moc_scrollscale.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_scrollscale.Tpo $(DEPDIR)/libwidgets_a-moc_scrollscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_scrollscale.cpp' object='libwidgets_a-moc_scrollscale.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_scrollscale.o `test -f 'moc_scrollscale.cpp' || echo '$(srcdir)/'`moc_scrollscale.cpp
+
+libwidgets_a-moc_scrollscale.obj: moc_scrollscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_scrollscale.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_scrollscale.Tpo -c -o libwidgets_a-moc_scrollscale.obj `if test -f 'moc_scrollscale.cpp'; then $(CYGPATH_W) 'moc_scrollscale.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_scrollscale.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_scrollscale.Tpo $(DEPDIR)/libwidgets_a-moc_scrollscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_scrollscale.cpp' object='libwidgets_a-moc_scrollscale.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_scrollscale.obj `if test -f 'moc_scrollscale.cpp'; then $(CYGPATH_W) 'moc_scrollscale.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_scrollscale.cpp'; fi`
+
+libwidgets_a-moc_view.o: moc_view.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_view.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_view.Tpo -c -o libwidgets_a-moc_view.o `test -f 'moc_view.cpp' || echo '$(srcdir)/'`moc_view.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_view.Tpo $(DEPDIR)/libwidgets_a-moc_view.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_view.cpp' object='libwidgets_a-moc_view.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_view.o `test -f 'moc_view.cpp' || echo '$(srcdir)/'`moc_view.cpp
+
+libwidgets_a-moc_view.obj: moc_view.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_view.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_view.Tpo -c -o libwidgets_a-moc_view.obj `if test -f 'moc_view.cpp'; then $(CYGPATH_W) 'moc_view.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_view.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_view.Tpo $(DEPDIR)/libwidgets_a-moc_view.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_view.cpp' object='libwidgets_a-moc_view.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_view.obj `if test -f 'moc_view.cpp'; then $(CYGPATH_W) 'moc_view.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_view.cpp'; fi`
+
+libwidgets_a-moc_nentry.o: moc_nentry.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_nentry.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_nentry.Tpo -c -o libwidgets_a-moc_nentry.o `test -f 'moc_nentry.cpp' || echo '$(srcdir)/'`moc_nentry.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_nentry.Tpo $(DEPDIR)/libwidgets_a-moc_nentry.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_nentry.cpp' object='libwidgets_a-moc_nentry.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_nentry.o `test -f 'moc_nentry.cpp' || echo '$(srcdir)/'`moc_nentry.cpp
+
+libwidgets_a-moc_nentry.obj: moc_nentry.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_nentry.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_nentry.Tpo -c -o libwidgets_a-moc_nentry.obj `if test -f 'moc_nentry.cpp'; then $(CYGPATH_W) 'moc_nentry.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_nentry.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_nentry.Tpo $(DEPDIR)/libwidgets_a-moc_nentry.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_nentry.cpp' object='libwidgets_a-moc_nentry.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_nentry.obj `if test -f 'moc_nentry.cpp'; then $(CYGPATH_W) 'moc_nentry.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_nentry.cpp'; fi`
+
+libwidgets_a-moc_mtscale.o: moc_mtscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_mtscale.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_mtscale.Tpo -c -o libwidgets_a-moc_mtscale.o `test -f 'moc_mtscale.cpp' || echo '$(srcdir)/'`moc_mtscale.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_mtscale.Tpo $(DEPDIR)/libwidgets_a-moc_mtscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_mtscale.cpp' object='libwidgets_a-moc_mtscale.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_mtscale.o `test -f 'moc_mtscale.cpp' || echo '$(srcdir)/'`moc_mtscale.cpp
+
+libwidgets_a-moc_mtscale.obj: moc_mtscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_mtscale.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_mtscale.Tpo -c -o libwidgets_a-moc_mtscale.obj `if test -f 'moc_mtscale.cpp'; then $(CYGPATH_W) 'moc_mtscale.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_mtscale.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_mtscale.Tpo $(DEPDIR)/libwidgets_a-moc_mtscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_mtscale.cpp' object='libwidgets_a-moc_mtscale.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_mtscale.obj `if test -f 'moc_mtscale.cpp'; then $(CYGPATH_W) 'moc_mtscale.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_mtscale.cpp'; fi`
+
+libwidgets_a-moc_sigscale.o: moc_sigscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_sigscale.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_sigscale.Tpo -c -o libwidgets_a-moc_sigscale.o `test -f 'moc_sigscale.cpp' || echo '$(srcdir)/'`moc_sigscale.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_sigscale.Tpo $(DEPDIR)/libwidgets_a-moc_sigscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_sigscale.cpp' object='libwidgets_a-moc_sigscale.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_sigscale.o `test -f 'moc_sigscale.cpp' || echo '$(srcdir)/'`moc_sigscale.cpp
+
+libwidgets_a-moc_sigscale.obj: moc_sigscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_sigscale.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_sigscale.Tpo -c -o libwidgets_a-moc_sigscale.obj `if test -f 'moc_sigscale.cpp'; then $(CYGPATH_W) 'moc_sigscale.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_sigscale.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_sigscale.Tpo $(DEPDIR)/libwidgets_a-moc_sigscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_sigscale.cpp' object='libwidgets_a-moc_sigscale.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_sigscale.obj `if test -f 'moc_sigscale.cpp'; then $(CYGPATH_W) 'moc_sigscale.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_sigscale.cpp'; fi`
+
+libwidgets_a-moc_hitscale.o: moc_hitscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_hitscale.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_hitscale.Tpo -c -o libwidgets_a-moc_hitscale.o `test -f 'moc_hitscale.cpp' || echo '$(srcdir)/'`moc_hitscale.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_hitscale.Tpo $(DEPDIR)/libwidgets_a-moc_hitscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_hitscale.cpp' object='libwidgets_a-moc_hitscale.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_hitscale.o `test -f 'moc_hitscale.cpp' || echo '$(srcdir)/'`moc_hitscale.cpp
+
+libwidgets_a-moc_hitscale.obj: moc_hitscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_hitscale.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_hitscale.Tpo -c -o libwidgets_a-moc_hitscale.obj `if test -f 'moc_hitscale.cpp'; then $(CYGPATH_W) 'moc_hitscale.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_hitscale.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_hitscale.Tpo $(DEPDIR)/libwidgets_a-moc_hitscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_hitscale.cpp' object='libwidgets_a-moc_hitscale.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_hitscale.obj `if test -f 'moc_hitscale.cpp'; then $(CYGPATH_W) 'moc_hitscale.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_hitscale.cpp'; fi`
+
+libwidgets_a-moc_intlabel.o: moc_intlabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_intlabel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_intlabel.Tpo -c -o libwidgets_a-moc_intlabel.o `test -f 'moc_intlabel.cpp' || echo '$(srcdir)/'`moc_intlabel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_intlabel.Tpo $(DEPDIR)/libwidgets_a-moc_intlabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_intlabel.cpp' object='libwidgets_a-moc_intlabel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_intlabel.o `test -f 'moc_intlabel.cpp' || echo '$(srcdir)/'`moc_intlabel.cpp
+
+libwidgets_a-moc_intlabel.obj: moc_intlabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_intlabel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_intlabel.Tpo -c -o libwidgets_a-moc_intlabel.obj `if test -f 'moc_intlabel.cpp'; then $(CYGPATH_W) 'moc_intlabel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_intlabel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_intlabel.Tpo $(DEPDIR)/libwidgets_a-moc_intlabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_intlabel.cpp' object='libwidgets_a-moc_intlabel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_intlabel.obj `if test -f 'moc_intlabel.cpp'; then $(CYGPATH_W) 'moc_intlabel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_intlabel.cpp'; fi`
+
+libwidgets_a-moc_doublelabel.o: moc_doublelabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_doublelabel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_doublelabel.Tpo -c -o libwidgets_a-moc_doublelabel.o `test -f 'moc_doublelabel.cpp' || echo '$(srcdir)/'`moc_doublelabel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_doublelabel.Tpo $(DEPDIR)/libwidgets_a-moc_doublelabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_doublelabel.cpp' object='libwidgets_a-moc_doublelabel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_doublelabel.o `test -f 'moc_doublelabel.cpp' || echo '$(srcdir)/'`moc_doublelabel.cpp
+
+libwidgets_a-moc_doublelabel.obj: moc_doublelabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_doublelabel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_doublelabel.Tpo -c -o libwidgets_a-moc_doublelabel.obj `if test -f 'moc_doublelabel.cpp'; then $(CYGPATH_W) 'moc_doublelabel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_doublelabel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_doublelabel.Tpo $(DEPDIR)/libwidgets_a-moc_doublelabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_doublelabel.cpp' object='libwidgets_a-moc_doublelabel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_doublelabel.obj `if test -f 'moc_doublelabel.cpp'; then $(CYGPATH_W) 'moc_doublelabel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_doublelabel.cpp'; fi`
+
+libwidgets_a-moc_canvas.o: moc_canvas.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_canvas.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_canvas.Tpo -c -o libwidgets_a-moc_canvas.o `test -f 'moc_canvas.cpp' || echo '$(srcdir)/'`moc_canvas.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_canvas.Tpo $(DEPDIR)/libwidgets_a-moc_canvas.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_canvas.cpp' object='libwidgets_a-moc_canvas.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_canvas.o `test -f 'moc_canvas.cpp' || echo '$(srcdir)/'`moc_canvas.cpp
+
+libwidgets_a-moc_canvas.obj: moc_canvas.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_canvas.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_canvas.Tpo -c -o libwidgets_a-moc_canvas.obj `if test -f 'moc_canvas.cpp'; then $(CYGPATH_W) 'moc_canvas.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_canvas.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_canvas.Tpo $(DEPDIR)/libwidgets_a-moc_canvas.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_canvas.cpp' object='libwidgets_a-moc_canvas.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_canvas.obj `if test -f 'moc_canvas.cpp'; then $(CYGPATH_W) 'moc_canvas.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_canvas.cpp'; fi`
+
+libwidgets_a-moc_noteinfo.o: moc_noteinfo.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_noteinfo.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_noteinfo.Tpo -c -o libwidgets_a-moc_noteinfo.o `test -f 'moc_noteinfo.cpp' || echo '$(srcdir)/'`moc_noteinfo.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_noteinfo.Tpo $(DEPDIR)/libwidgets_a-moc_noteinfo.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_noteinfo.cpp' object='libwidgets_a-moc_noteinfo.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_noteinfo.o `test -f 'moc_noteinfo.cpp' || echo '$(srcdir)/'`moc_noteinfo.cpp
+
+libwidgets_a-moc_noteinfo.obj: moc_noteinfo.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_noteinfo.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_noteinfo.Tpo -c -o libwidgets_a-moc_noteinfo.obj `if test -f 'moc_noteinfo.cpp'; then $(CYGPATH_W) 'moc_noteinfo.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_noteinfo.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_noteinfo.Tpo $(DEPDIR)/libwidgets_a-moc_noteinfo.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_noteinfo.cpp' object='libwidgets_a-moc_noteinfo.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_noteinfo.obj `if test -f 'moc_noteinfo.cpp'; then $(CYGPATH_W) 'moc_noteinfo.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_noteinfo.cpp'; fi`
+
+libwidgets_a-moc_dentry.o: moc_dentry.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_dentry.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_dentry.Tpo -c -o libwidgets_a-moc_dentry.o `test -f 'moc_dentry.cpp' || echo '$(srcdir)/'`moc_dentry.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_dentry.Tpo $(DEPDIR)/libwidgets_a-moc_dentry.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_dentry.cpp' object='libwidgets_a-moc_dentry.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_dentry.o `test -f 'moc_dentry.cpp' || echo '$(srcdir)/'`moc_dentry.cpp
+
+libwidgets_a-moc_dentry.obj: moc_dentry.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_dentry.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_dentry.Tpo -c -o libwidgets_a-moc_dentry.obj `if test -f 'moc_dentry.cpp'; then $(CYGPATH_W) 'moc_dentry.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_dentry.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_dentry.Tpo $(DEPDIR)/libwidgets_a-moc_dentry.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_dentry.cpp' object='libwidgets_a-moc_dentry.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_dentry.obj `if test -f 'moc_dentry.cpp'; then $(CYGPATH_W) 'moc_dentry.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_dentry.cpp'; fi`
+
+libwidgets_a-moc_siglabel.o: moc_siglabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_siglabel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_siglabel.Tpo -c -o libwidgets_a-moc_siglabel.o `test -f 'moc_siglabel.cpp' || echo '$(srcdir)/'`moc_siglabel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_siglabel.Tpo $(DEPDIR)/libwidgets_a-moc_siglabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_siglabel.cpp' object='libwidgets_a-moc_siglabel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_siglabel.o `test -f 'moc_siglabel.cpp' || echo '$(srcdir)/'`moc_siglabel.cpp
+
+libwidgets_a-moc_siglabel.obj: moc_siglabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_siglabel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_siglabel.Tpo -c -o libwidgets_a-moc_siglabel.obj `if test -f 'moc_siglabel.cpp'; then $(CYGPATH_W) 'moc_siglabel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_siglabel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_siglabel.Tpo $(DEPDIR)/libwidgets_a-moc_siglabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_siglabel.cpp' object='libwidgets_a-moc_siglabel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_siglabel.obj `if test -f 'moc_siglabel.cpp'; then $(CYGPATH_W) 'moc_siglabel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_siglabel.cpp'; fi`
+
+libwidgets_a-moc_ttoolbar.o: moc_ttoolbar.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_ttoolbar.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_ttoolbar.Tpo -c -o libwidgets_a-moc_ttoolbar.o `test -f 'moc_ttoolbar.cpp' || echo '$(srcdir)/'`moc_ttoolbar.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_ttoolbar.Tpo $(DEPDIR)/libwidgets_a-moc_ttoolbar.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_ttoolbar.cpp' object='libwidgets_a-moc_ttoolbar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_ttoolbar.o `test -f 'moc_ttoolbar.cpp' || echo '$(srcdir)/'`moc_ttoolbar.cpp
+
+libwidgets_a-moc_ttoolbar.obj: moc_ttoolbar.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_ttoolbar.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_ttoolbar.Tpo -c -o libwidgets_a-moc_ttoolbar.obj `if test -f 'moc_ttoolbar.cpp'; then $(CYGPATH_W) 'moc_ttoolbar.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_ttoolbar.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_ttoolbar.Tpo $(DEPDIR)/libwidgets_a-moc_ttoolbar.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_ttoolbar.cpp' object='libwidgets_a-moc_ttoolbar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_ttoolbar.obj `if test -f 'moc_ttoolbar.cpp'; then $(CYGPATH_W) 'moc_ttoolbar.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_ttoolbar.cpp'; fi`
+
+libwidgets_a-moc_ttoolbutton.o: moc_ttoolbutton.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_ttoolbutton.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_ttoolbutton.Tpo -c -o libwidgets_a-moc_ttoolbutton.o `test -f 'moc_ttoolbutton.cpp' || echo '$(srcdir)/'`moc_ttoolbutton.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_ttoolbutton.Tpo $(DEPDIR)/libwidgets_a-moc_ttoolbutton.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_ttoolbutton.cpp' object='libwidgets_a-moc_ttoolbutton.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_ttoolbutton.o `test -f 'moc_ttoolbutton.cpp' || echo '$(srcdir)/'`moc_ttoolbutton.cpp
+
+libwidgets_a-moc_ttoolbutton.obj: moc_ttoolbutton.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_ttoolbutton.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_ttoolbutton.Tpo -c -o libwidgets_a-moc_ttoolbutton.obj `if test -f 'moc_ttoolbutton.cpp'; then $(CYGPATH_W) 'moc_ttoolbutton.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_ttoolbutton.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_ttoolbutton.Tpo $(DEPDIR)/libwidgets_a-moc_ttoolbutton.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_ttoolbutton.cpp' object='libwidgets_a-moc_ttoolbutton.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_ttoolbutton.obj `if test -f 'moc_ttoolbutton.cpp'; then $(CYGPATH_W) 'moc_ttoolbutton.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_ttoolbutton.cpp'; fi`
+
+libwidgets_a-moc_tb1.o: moc_tb1.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_tb1.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_tb1.Tpo -c -o libwidgets_a-moc_tb1.o `test -f 'moc_tb1.cpp' || echo '$(srcdir)/'`moc_tb1.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_tb1.Tpo $(DEPDIR)/libwidgets_a-moc_tb1.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_tb1.cpp' object='libwidgets_a-moc_tb1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_tb1.o `test -f 'moc_tb1.cpp' || echo '$(srcdir)/'`moc_tb1.cpp
+
+libwidgets_a-moc_tb1.obj: moc_tb1.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_tb1.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_tb1.Tpo -c -o libwidgets_a-moc_tb1.obj `if test -f 'moc_tb1.cpp'; then $(CYGPATH_W) 'moc_tb1.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_tb1.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_tb1.Tpo $(DEPDIR)/libwidgets_a-moc_tb1.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_tb1.cpp' object='libwidgets_a-moc_tb1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_tb1.obj `if test -f 'moc_tb1.cpp'; then $(CYGPATH_W) 'moc_tb1.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_tb1.cpp'; fi`
+
+libwidgets_a-moc_lcombo.o: moc_lcombo.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_lcombo.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_lcombo.Tpo -c -o libwidgets_a-moc_lcombo.o `test -f 'moc_lcombo.cpp' || echo '$(srcdir)/'`moc_lcombo.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_lcombo.Tpo $(DEPDIR)/libwidgets_a-moc_lcombo.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_lcombo.cpp' object='libwidgets_a-moc_lcombo.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_lcombo.o `test -f 'moc_lcombo.cpp' || echo '$(srcdir)/'`moc_lcombo.cpp
+
+libwidgets_a-moc_lcombo.obj: moc_lcombo.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_lcombo.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_lcombo.Tpo -c -o libwidgets_a-moc_lcombo.obj `if test -f 'moc_lcombo.cpp'; then $(CYGPATH_W) 'moc_lcombo.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_lcombo.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_lcombo.Tpo $(DEPDIR)/libwidgets_a-moc_lcombo.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_lcombo.cpp' object='libwidgets_a-moc_lcombo.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_lcombo.obj `if test -f 'moc_lcombo.cpp'; then $(CYGPATH_W) 'moc_lcombo.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_lcombo.cpp'; fi`
+
+libwidgets_a-moc_swidget.o: moc_swidget.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_swidget.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_swidget.Tpo -c -o libwidgets_a-moc_swidget.o `test -f 'moc_swidget.cpp' || echo '$(srcdir)/'`moc_swidget.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_swidget.Tpo $(DEPDIR)/libwidgets_a-moc_swidget.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_swidget.cpp' object='libwidgets_a-moc_swidget.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_swidget.o `test -f 'moc_swidget.cpp' || echo '$(srcdir)/'`moc_swidget.cpp
+
+libwidgets_a-moc_swidget.obj: moc_swidget.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_swidget.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_swidget.Tpo -c -o libwidgets_a-moc_swidget.obj `if test -f 'moc_swidget.cpp'; then $(CYGPATH_W) 'moc_swidget.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_swidget.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_swidget.Tpo $(DEPDIR)/libwidgets_a-moc_swidget.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_swidget.cpp' object='libwidgets_a-moc_swidget.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_swidget.obj `if test -f 'moc_swidget.cpp'; then $(CYGPATH_W) 'moc_swidget.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_swidget.cpp'; fi`
+
+libwidgets_a-moc_tempolabel.o: moc_tempolabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_tempolabel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_tempolabel.Tpo -c -o libwidgets_a-moc_tempolabel.o `test -f 'moc_tempolabel.cpp' || echo '$(srcdir)/'`moc_tempolabel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_tempolabel.Tpo $(DEPDIR)/libwidgets_a-moc_tempolabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_tempolabel.cpp' object='libwidgets_a-moc_tempolabel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_tempolabel.o `test -f 'moc_tempolabel.cpp' || echo '$(srcdir)/'`moc_tempolabel.cpp
+
+libwidgets_a-moc_tempolabel.obj: moc_tempolabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_tempolabel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_tempolabel.Tpo -c -o libwidgets_a-moc_tempolabel.obj `if test -f 'moc_tempolabel.cpp'; then $(CYGPATH_W) 'moc_tempolabel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_tempolabel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_tempolabel.Tpo $(DEPDIR)/libwidgets_a-moc_tempolabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_tempolabel.cpp' object='libwidgets_a-moc_tempolabel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_tempolabel.obj `if test -f 'moc_tempolabel.cpp'; then $(CYGPATH_W) 'moc_tempolabel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_tempolabel.cpp'; fi`
+
+libwidgets_a-moc_tools.o: moc_tools.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_tools.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_tools.Tpo -c -o libwidgets_a-moc_tools.o `test -f 'moc_tools.cpp' || echo '$(srcdir)/'`moc_tools.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_tools.Tpo $(DEPDIR)/libwidgets_a-moc_tools.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_tools.cpp' object='libwidgets_a-moc_tools.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_tools.o `test -f 'moc_tools.cpp' || echo '$(srcdir)/'`moc_tools.cpp
+
+libwidgets_a-moc_tools.obj: moc_tools.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_tools.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_tools.Tpo -c -o libwidgets_a-moc_tools.obj `if test -f 'moc_tools.cpp'; then $(CYGPATH_W) 'moc_tools.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_tools.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_tools.Tpo $(DEPDIR)/libwidgets_a-moc_tools.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_tools.cpp' object='libwidgets_a-moc_tools.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_tools.obj `if test -f 'moc_tools.cpp'; then $(CYGPATH_W) 'moc_tools.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_tools.cpp'; fi`
+
+libwidgets_a-moc_popupmenu.o: moc_popupmenu.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_popupmenu.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_popupmenu.Tpo -c -o libwidgets_a-moc_popupmenu.o `test -f 'moc_popupmenu.cpp' || echo '$(srcdir)/'`moc_popupmenu.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_popupmenu.Tpo $(DEPDIR)/libwidgets_a-moc_popupmenu.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_popupmenu.cpp' object='libwidgets_a-moc_popupmenu.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_popupmenu.o `test -f 'moc_popupmenu.cpp' || echo '$(srcdir)/'`moc_popupmenu.cpp
+
+libwidgets_a-moc_popupmenu.obj: moc_popupmenu.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_popupmenu.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_popupmenu.Tpo -c -o libwidgets_a-moc_popupmenu.obj `if test -f 'moc_popupmenu.cpp'; then $(CYGPATH_W) 'moc_popupmenu.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_popupmenu.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_popupmenu.Tpo $(DEPDIR)/libwidgets_a-moc_popupmenu.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_popupmenu.cpp' object='libwidgets_a-moc_popupmenu.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_popupmenu.obj `if test -f 'moc_popupmenu.cpp'; then $(CYGPATH_W) 'moc_popupmenu.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_popupmenu.cpp'; fi`
+
+libwidgets_a-moc_fontsel.o: moc_fontsel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_fontsel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_fontsel.Tpo -c -o libwidgets_a-moc_fontsel.o `test -f 'moc_fontsel.cpp' || echo '$(srcdir)/'`moc_fontsel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_fontsel.Tpo $(DEPDIR)/libwidgets_a-moc_fontsel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_fontsel.cpp' object='libwidgets_a-moc_fontsel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_fontsel.o `test -f 'moc_fontsel.cpp' || echo '$(srcdir)/'`moc_fontsel.cpp
+
+libwidgets_a-moc_fontsel.obj: moc_fontsel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_fontsel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_fontsel.Tpo -c -o libwidgets_a-moc_fontsel.obj `if test -f 'moc_fontsel.cpp'; then $(CYGPATH_W) 'moc_fontsel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_fontsel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_fontsel.Tpo $(DEPDIR)/libwidgets_a-moc_fontsel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_fontsel.cpp' object='libwidgets_a-moc_fontsel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_fontsel.obj `if test -f 'moc_fontsel.cpp'; then $(CYGPATH_W) 'moc_fontsel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_fontsel.cpp'; fi`
+
+libwidgets_a-moc_ctrlcombo.o: moc_ctrlcombo.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_ctrlcombo.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_ctrlcombo.Tpo -c -o libwidgets_a-moc_ctrlcombo.o `test -f 'moc_ctrlcombo.cpp' || echo '$(srcdir)/'`moc_ctrlcombo.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_ctrlcombo.Tpo $(DEPDIR)/libwidgets_a-moc_ctrlcombo.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_ctrlcombo.cpp' object='libwidgets_a-moc_ctrlcombo.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_ctrlcombo.o `test -f 'moc_ctrlcombo.cpp' || echo '$(srcdir)/'`moc_ctrlcombo.cpp
+
+libwidgets_a-moc_ctrlcombo.obj: moc_ctrlcombo.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_ctrlcombo.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_ctrlcombo.Tpo -c -o libwidgets_a-moc_ctrlcombo.obj `if test -f 'moc_ctrlcombo.cpp'; then $(CYGPATH_W) 'moc_ctrlcombo.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_ctrlcombo.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_ctrlcombo.Tpo $(DEPDIR)/libwidgets_a-moc_ctrlcombo.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_ctrlcombo.cpp' object='libwidgets_a-moc_ctrlcombo.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_ctrlcombo.obj `if test -f 'moc_ctrlcombo.cpp'; then $(CYGPATH_W) 'moc_ctrlcombo.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_ctrlcombo.cpp'; fi`
+
+libwidgets_a-moc_sliderbase.o: moc_sliderbase.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_sliderbase.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_sliderbase.Tpo -c -o libwidgets_a-moc_sliderbase.o `test -f 'moc_sliderbase.cpp' || echo '$(srcdir)/'`moc_sliderbase.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_sliderbase.Tpo $(DEPDIR)/libwidgets_a-moc_sliderbase.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_sliderbase.cpp' object='libwidgets_a-moc_sliderbase.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_sliderbase.o `test -f 'moc_sliderbase.cpp' || echo '$(srcdir)/'`moc_sliderbase.cpp
+
+libwidgets_a-moc_sliderbase.obj: moc_sliderbase.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_sliderbase.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_sliderbase.Tpo -c -o libwidgets_a-moc_sliderbase.obj `if test -f 'moc_sliderbase.cpp'; then $(CYGPATH_W) 'moc_sliderbase.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_sliderbase.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_sliderbase.Tpo $(DEPDIR)/libwidgets_a-moc_sliderbase.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_sliderbase.cpp' object='libwidgets_a-moc_sliderbase.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_sliderbase.obj `if test -f 'moc_sliderbase.cpp'; then $(CYGPATH_W) 'moc_sliderbase.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_sliderbase.cpp'; fi`
+
+libwidgets_a-moc_slider.o: moc_slider.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_slider.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_slider.Tpo -c -o libwidgets_a-moc_slider.o `test -f 'moc_slider.cpp' || echo '$(srcdir)/'`moc_slider.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_slider.Tpo $(DEPDIR)/libwidgets_a-moc_slider.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_slider.cpp' object='libwidgets_a-moc_slider.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_slider.o `test -f 'moc_slider.cpp' || echo '$(srcdir)/'`moc_slider.cpp
+
+libwidgets_a-moc_slider.obj: moc_slider.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_slider.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_slider.Tpo -c -o libwidgets_a-moc_slider.obj `if test -f 'moc_slider.cpp'; then $(CYGPATH_W) 'moc_slider.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_slider.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_slider.Tpo $(DEPDIR)/libwidgets_a-moc_slider.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_slider.cpp' object='libwidgets_a-moc_slider.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_slider.obj `if test -f 'moc_slider.cpp'; then $(CYGPATH_W) 'moc_slider.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_slider.cpp'; fi`
+
+libwidgets_a-moc_midisyncimpl.o: moc_midisyncimpl.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_midisyncimpl.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_midisyncimpl.Tpo -c -o libwidgets_a-moc_midisyncimpl.o `test -f 'moc_midisyncimpl.cpp' || echo '$(srcdir)/'`moc_midisyncimpl.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_midisyncimpl.Tpo $(DEPDIR)/libwidgets_a-moc_midisyncimpl.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_midisyncimpl.cpp' object='libwidgets_a-moc_midisyncimpl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_midisyncimpl.o `test -f 'moc_midisyncimpl.cpp' || echo '$(srcdir)/'`moc_midisyncimpl.cpp
+
+libwidgets_a-moc_midisyncimpl.obj: moc_midisyncimpl.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_midisyncimpl.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_midisyncimpl.Tpo -c -o libwidgets_a-moc_midisyncimpl.obj `if test -f 'moc_midisyncimpl.cpp'; then $(CYGPATH_W) 'moc_midisyncimpl.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_midisyncimpl.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_midisyncimpl.Tpo $(DEPDIR)/libwidgets_a-moc_midisyncimpl.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_midisyncimpl.cpp' object='libwidgets_a-moc_midisyncimpl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_midisyncimpl.obj `if test -f 'moc_midisyncimpl.cpp'; then $(CYGPATH_W) 'moc_midisyncimpl.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_midisyncimpl.cpp'; fi`
+
+libwidgets_a-moc_header.o: moc_header.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_header.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_header.Tpo -c -o libwidgets_a-moc_header.o `test -f 'moc_header.cpp' || echo '$(srcdir)/'`moc_header.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_header.Tpo $(DEPDIR)/libwidgets_a-moc_header.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_header.cpp' object='libwidgets_a-moc_header.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_header.o `test -f 'moc_header.cpp' || echo '$(srcdir)/'`moc_header.cpp
+
+libwidgets_a-moc_header.obj: moc_header.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_header.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_header.Tpo -c -o libwidgets_a-moc_header.obj `if test -f 'moc_header.cpp'; then $(CYGPATH_W) 'moc_header.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_header.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_header.Tpo $(DEPDIR)/libwidgets_a-moc_header.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_header.cpp' object='libwidgets_a-moc_header.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_header.obj `if test -f 'moc_header.cpp'; then $(CYGPATH_W) 'moc_header.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_header.cpp'; fi`
+
+libwidgets_a-moc_knob.o: moc_knob.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_knob.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_knob.Tpo -c -o libwidgets_a-moc_knob.o `test -f 'moc_knob.cpp' || echo '$(srcdir)/'`moc_knob.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_knob.Tpo $(DEPDIR)/libwidgets_a-moc_knob.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_knob.cpp' object='libwidgets_a-moc_knob.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_knob.o `test -f 'moc_knob.cpp' || echo '$(srcdir)/'`moc_knob.cpp
+
+libwidgets_a-moc_knob.obj: moc_knob.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_knob.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_knob.Tpo -c -o libwidgets_a-moc_knob.obj `if test -f 'moc_knob.cpp'; then $(CYGPATH_W) 'moc_knob.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_knob.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_knob.Tpo $(DEPDIR)/libwidgets_a-moc_knob.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_knob.cpp' object='libwidgets_a-moc_knob.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_knob.obj `if test -f 'moc_knob.cpp'; then $(CYGPATH_W) 'moc_knob.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_knob.cpp'; fi`
+
+libwidgets_a-moc_mlabel.o: moc_mlabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_mlabel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_mlabel.Tpo -c -o libwidgets_a-moc_mlabel.o `test -f 'moc_mlabel.cpp' || echo '$(srcdir)/'`moc_mlabel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_mlabel.Tpo $(DEPDIR)/libwidgets_a-moc_mlabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_mlabel.cpp' object='libwidgets_a-moc_mlabel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_mlabel.o `test -f 'moc_mlabel.cpp' || echo '$(srcdir)/'`moc_mlabel.cpp
+
+libwidgets_a-moc_mlabel.obj: moc_mlabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_mlabel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_mlabel.Tpo -c -o libwidgets_a-moc_mlabel.obj `if test -f 'moc_mlabel.cpp'; then $(CYGPATH_W) 'moc_mlabel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_mlabel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_mlabel.Tpo $(DEPDIR)/libwidgets_a-moc_mlabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_mlabel.cpp' object='libwidgets_a-moc_mlabel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_mlabel.obj `if test -f 'moc_mlabel.cpp'; then $(CYGPATH_W) 'moc_mlabel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_mlabel.cpp'; fi`
+
+libwidgets_a-moc_genset.o: moc_genset.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_genset.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_genset.Tpo -c -o libwidgets_a-moc_genset.o `test -f 'moc_genset.cpp' || echo '$(srcdir)/'`moc_genset.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_genset.Tpo $(DEPDIR)/libwidgets_a-moc_genset.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_genset.cpp' object='libwidgets_a-moc_genset.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_genset.o `test -f 'moc_genset.cpp' || echo '$(srcdir)/'`moc_genset.cpp
+
+libwidgets_a-moc_genset.obj: moc_genset.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_genset.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_genset.Tpo -c -o libwidgets_a-moc_genset.obj `if test -f 'moc_genset.cpp'; then $(CYGPATH_W) 'moc_genset.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_genset.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_genset.Tpo $(DEPDIR)/libwidgets_a-moc_genset.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_genset.cpp' object='libwidgets_a-moc_genset.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_genset.obj `if test -f 'moc_genset.cpp'; then $(CYGPATH_W) 'moc_genset.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_genset.cpp'; fi`
+
+libwidgets_a-moc_mixdowndialog.o: moc_mixdowndialog.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_mixdowndialog.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_mixdowndialog.Tpo -c -o libwidgets_a-moc_mixdowndialog.o `test -f 'moc_mixdowndialog.cpp' || echo '$(srcdir)/'`moc_mixdowndialog.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_mixdowndialog.Tpo $(DEPDIR)/libwidgets_a-moc_mixdowndialog.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_mixdowndialog.cpp' object='libwidgets_a-moc_mixdowndialog.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_mixdowndialog.o `test -f 'moc_mixdowndialog.cpp' || echo '$(srcdir)/'`moc_mixdowndialog.cpp
+
+libwidgets_a-moc_mixdowndialog.obj: moc_mixdowndialog.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_mixdowndialog.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_mixdowndialog.Tpo -c -o libwidgets_a-moc_mixdowndialog.obj `if test -f 'moc_mixdowndialog.cpp'; then $(CYGPATH_W) 'moc_mixdowndialog.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_mixdowndialog.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_mixdowndialog.Tpo $(DEPDIR)/libwidgets_a-moc_mixdowndialog.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_mixdowndialog.cpp' object='libwidgets_a-moc_mixdowndialog.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_mixdowndialog.obj `if test -f 'moc_mixdowndialog.cpp'; then $(CYGPATH_W) 'moc_mixdowndialog.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_mixdowndialog.cpp'; fi`
+
+libwidgets_a-moc_spinboxFP.o: moc_spinboxFP.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_spinboxFP.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_spinboxFP.Tpo -c -o libwidgets_a-moc_spinboxFP.o `test -f 'moc_spinboxFP.cpp' || echo '$(srcdir)/'`moc_spinboxFP.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_spinboxFP.Tpo $(DEPDIR)/libwidgets_a-moc_spinboxFP.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_spinboxFP.cpp' object='libwidgets_a-moc_spinboxFP.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_spinboxFP.o `test -f 'moc_spinboxFP.cpp' || echo '$(srcdir)/'`moc_spinboxFP.cpp
+
+libwidgets_a-moc_spinboxFP.obj: moc_spinboxFP.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_spinboxFP.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_spinboxFP.Tpo -c -o libwidgets_a-moc_spinboxFP.obj `if test -f 'moc_spinboxFP.cpp'; then $(CYGPATH_W) 'moc_spinboxFP.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_spinboxFP.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_spinboxFP.Tpo $(DEPDIR)/libwidgets_a-moc_spinboxFP.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_spinboxFP.cpp' object='libwidgets_a-moc_spinboxFP.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_spinboxFP.obj `if test -f 'moc_spinboxFP.cpp'; then $(CYGPATH_W) 'moc_spinboxFP.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_spinboxFP.cpp'; fi`
+
+libwidgets_a-moc_spinbox.o: moc_spinbox.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_spinbox.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_spinbox.Tpo -c -o libwidgets_a-moc_spinbox.o `test -f 'moc_spinbox.cpp' || echo '$(srcdir)/'`moc_spinbox.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_spinbox.Tpo $(DEPDIR)/libwidgets_a-moc_spinbox.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_spinbox.cpp' object='libwidgets_a-moc_spinbox.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_spinbox.o `test -f 'moc_spinbox.cpp' || echo '$(srcdir)/'`moc_spinbox.cpp
+
+libwidgets_a-moc_spinbox.obj: moc_spinbox.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_spinbox.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_spinbox.Tpo -c -o libwidgets_a-moc_spinbox.obj `if test -f 'moc_spinbox.cpp'; then $(CYGPATH_W) 'moc_spinbox.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_spinbox.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_spinbox.Tpo $(DEPDIR)/libwidgets_a-moc_spinbox.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_spinbox.cpp' object='libwidgets_a-moc_spinbox.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_spinbox.obj `if test -f 'moc_spinbox.cpp'; then $(CYGPATH_W) 'moc_spinbox.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_spinbox.cpp'; fi`
+
+libwidgets_a-moc_comboQuant.o: moc_comboQuant.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_comboQuant.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_comboQuant.Tpo -c -o libwidgets_a-moc_comboQuant.o `test -f 'moc_comboQuant.cpp' || echo '$(srcdir)/'`moc_comboQuant.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_comboQuant.Tpo $(DEPDIR)/libwidgets_a-moc_comboQuant.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_comboQuant.cpp' object='libwidgets_a-moc_comboQuant.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_comboQuant.o `test -f 'moc_comboQuant.cpp' || echo '$(srcdir)/'`moc_comboQuant.cpp
+
+libwidgets_a-moc_comboQuant.obj: moc_comboQuant.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_comboQuant.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_comboQuant.Tpo -c -o libwidgets_a-moc_comboQuant.obj `if test -f 'moc_comboQuant.cpp'; then $(CYGPATH_W) 'moc_comboQuant.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_comboQuant.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_comboQuant.Tpo $(DEPDIR)/libwidgets_a-moc_comboQuant.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_comboQuant.cpp' object='libwidgets_a-moc_comboQuant.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_comboQuant.obj `if test -f 'moc_comboQuant.cpp'; then $(CYGPATH_W) 'moc_comboQuant.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_comboQuant.cpp'; fi`
+
+libwidgets_a-moc_bigtime.o: moc_bigtime.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_bigtime.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_bigtime.Tpo -c -o libwidgets_a-moc_bigtime.o `test -f 'moc_bigtime.cpp' || echo '$(srcdir)/'`moc_bigtime.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_bigtime.Tpo $(DEPDIR)/libwidgets_a-moc_bigtime.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_bigtime.cpp' object='libwidgets_a-moc_bigtime.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_bigtime.o `test -f 'moc_bigtime.cpp' || echo '$(srcdir)/'`moc_bigtime.cpp
+
+libwidgets_a-moc_bigtime.obj: moc_bigtime.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_bigtime.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_bigtime.Tpo -c -o libwidgets_a-moc_bigtime.obj `if test -f 'moc_bigtime.cpp'; then $(CYGPATH_W) 'moc_bigtime.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_bigtime.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_bigtime.Tpo $(DEPDIR)/libwidgets_a-moc_bigtime.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_bigtime.cpp' object='libwidgets_a-moc_bigtime.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_bigtime.obj `if test -f 'moc_bigtime.cpp'; then $(CYGPATH_W) 'moc_bigtime.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_bigtime.cpp'; fi`
+
+libwidgets_a-moc_comment.o: moc_comment.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_comment.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_comment.Tpo -c -o libwidgets_a-moc_comment.o `test -f 'moc_comment.cpp' || echo '$(srcdir)/'`moc_comment.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_comment.Tpo $(DEPDIR)/libwidgets_a-moc_comment.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_comment.cpp' object='libwidgets_a-moc_comment.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_comment.o `test -f 'moc_comment.cpp' || echo '$(srcdir)/'`moc_comment.cpp
+
+libwidgets_a-moc_comment.obj: moc_comment.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_comment.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_comment.Tpo -c -o libwidgets_a-moc_comment.obj `if test -f 'moc_comment.cpp'; then $(CYGPATH_W) 'moc_comment.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_comment.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_comment.Tpo $(DEPDIR)/libwidgets_a-moc_comment.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_comment.cpp' object='libwidgets_a-moc_comment.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_comment.obj `if test -f 'moc_comment.cpp'; then $(CYGPATH_W) 'moc_comment.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_comment.cpp'; fi`
+
+libwidgets_a-moc_splitter.o: moc_splitter.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_splitter.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_splitter.Tpo -c -o libwidgets_a-moc_splitter.o `test -f 'moc_splitter.cpp' || echo '$(srcdir)/'`moc_splitter.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_splitter.Tpo $(DEPDIR)/libwidgets_a-moc_splitter.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_splitter.cpp' object='libwidgets_a-moc_splitter.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_splitter.o `test -f 'moc_splitter.cpp' || echo '$(srcdir)/'`moc_splitter.cpp
+
+libwidgets_a-moc_splitter.obj: moc_splitter.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_splitter.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_splitter.Tpo -c -o libwidgets_a-moc_splitter.obj `if test -f 'moc_splitter.cpp'; then $(CYGPATH_W) 'moc_splitter.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_splitter.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_splitter.Tpo $(DEPDIR)/libwidgets_a-moc_splitter.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_splitter.cpp' object='libwidgets_a-moc_splitter.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_splitter.obj `if test -f 'moc_splitter.cpp'; then $(CYGPATH_W) 'moc_splitter.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_splitter.cpp'; fi`
+
+libwidgets_a-moc_gatetime.o: moc_gatetime.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_gatetime.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_gatetime.Tpo -c -o libwidgets_a-moc_gatetime.o `test -f 'moc_gatetime.cpp' || echo '$(srcdir)/'`moc_gatetime.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_gatetime.Tpo $(DEPDIR)/libwidgets_a-moc_gatetime.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_gatetime.cpp' object='libwidgets_a-moc_gatetime.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_gatetime.o `test -f 'moc_gatetime.cpp' || echo '$(srcdir)/'`moc_gatetime.cpp
+
+libwidgets_a-moc_gatetime.obj: moc_gatetime.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_gatetime.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_gatetime.Tpo -c -o libwidgets_a-moc_gatetime.obj `if test -f 'moc_gatetime.cpp'; then $(CYGPATH_W) 'moc_gatetime.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_gatetime.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_gatetime.Tpo $(DEPDIR)/libwidgets_a-moc_gatetime.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_gatetime.cpp' object='libwidgets_a-moc_gatetime.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_gatetime.obj `if test -f 'moc_gatetime.cpp'; then $(CYGPATH_W) 'moc_gatetime.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_gatetime.cpp'; fi`
+
+libwidgets_a-moc_velocity.o: moc_velocity.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_velocity.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_velocity.Tpo -c -o libwidgets_a-moc_velocity.o `test -f 'moc_velocity.cpp' || echo '$(srcdir)/'`moc_velocity.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_velocity.Tpo $(DEPDIR)/libwidgets_a-moc_velocity.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_velocity.cpp' object='libwidgets_a-moc_velocity.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_velocity.o `test -f 'moc_velocity.cpp' || echo '$(srcdir)/'`moc_velocity.cpp
+
+libwidgets_a-moc_velocity.obj: moc_velocity.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_velocity.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_velocity.Tpo -c -o libwidgets_a-moc_velocity.obj `if test -f 'moc_velocity.cpp'; then $(CYGPATH_W) 'moc_velocity.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_velocity.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_velocity.Tpo $(DEPDIR)/libwidgets_a-moc_velocity.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_velocity.cpp' object='libwidgets_a-moc_velocity.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_velocity.obj `if test -f 'moc_velocity.cpp'; then $(CYGPATH_W) 'moc_velocity.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_velocity.cpp'; fi`
+
+libwidgets_a-moc_metronome.o: moc_metronome.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_metronome.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_metronome.Tpo -c -o libwidgets_a-moc_metronome.o `test -f 'moc_metronome.cpp' || echo '$(srcdir)/'`moc_metronome.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_metronome.Tpo $(DEPDIR)/libwidgets_a-moc_metronome.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_metronome.cpp' object='libwidgets_a-moc_metronome.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_metronome.o `test -f 'moc_metronome.cpp' || echo '$(srcdir)/'`moc_metronome.cpp
+
+libwidgets_a-moc_metronome.obj: moc_metronome.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_metronome.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_metronome.Tpo -c -o libwidgets_a-moc_metronome.obj `if test -f 'moc_metronome.cpp'; then $(CYGPATH_W) 'moc_metronome.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_metronome.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_metronome.Tpo $(DEPDIR)/libwidgets_a-moc_metronome.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_metronome.cpp' object='libwidgets_a-moc_metronome.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_metronome.obj `if test -f 'moc_metronome.cpp'; then $(CYGPATH_W) 'moc_metronome.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_metronome.cpp'; fi`
+
+libwidgets_a-moc_posedit.o: moc_posedit.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_posedit.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_posedit.Tpo -c -o libwidgets_a-moc_posedit.o `test -f 'moc_posedit.cpp' || echo '$(srcdir)/'`moc_posedit.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_posedit.Tpo $(DEPDIR)/libwidgets_a-moc_posedit.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_posedit.cpp' object='libwidgets_a-moc_posedit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_posedit.o `test -f 'moc_posedit.cpp' || echo '$(srcdir)/'`moc_posedit.cpp
+
+libwidgets_a-moc_posedit.obj: moc_posedit.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_posedit.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_posedit.Tpo -c -o libwidgets_a-moc_posedit.obj `if test -f 'moc_posedit.cpp'; then $(CYGPATH_W) 'moc_posedit.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_posedit.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_posedit.Tpo $(DEPDIR)/libwidgets_a-moc_posedit.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_posedit.cpp' object='libwidgets_a-moc_posedit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_posedit.obj `if test -f 'moc_posedit.cpp'; then $(CYGPATH_W) 'moc_posedit.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_posedit.cpp'; fi`
+
+libwidgets_a-moc_pitchedit.o: moc_pitchedit.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_pitchedit.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_pitchedit.Tpo -c -o libwidgets_a-moc_pitchedit.o `test -f 'moc_pitchedit.cpp' || echo '$(srcdir)/'`moc_pitchedit.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_pitchedit.Tpo $(DEPDIR)/libwidgets_a-moc_pitchedit.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_pitchedit.cpp' object='libwidgets_a-moc_pitchedit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_pitchedit.o `test -f 'moc_pitchedit.cpp' || echo '$(srcdir)/'`moc_pitchedit.cpp
+
+libwidgets_a-moc_pitchedit.obj: moc_pitchedit.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_pitchedit.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_pitchedit.Tpo -c -o libwidgets_a-moc_pitchedit.obj `if test -f 'moc_pitchedit.cpp'; then $(CYGPATH_W) 'moc_pitchedit.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_pitchedit.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_pitchedit.Tpo $(DEPDIR)/libwidgets_a-moc_pitchedit.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_pitchedit.cpp' object='libwidgets_a-moc_pitchedit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_pitchedit.obj `if test -f 'moc_pitchedit.cpp'; then $(CYGPATH_W) 'moc_pitchedit.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_pitchedit.cpp'; fi`
+
+libwidgets_a-moc_pitchlabel.o: moc_pitchlabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_pitchlabel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_pitchlabel.Tpo -c -o libwidgets_a-moc_pitchlabel.o `test -f 'moc_pitchlabel.cpp' || echo '$(srcdir)/'`moc_pitchlabel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_pitchlabel.Tpo $(DEPDIR)/libwidgets_a-moc_pitchlabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_pitchlabel.cpp' object='libwidgets_a-moc_pitchlabel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_pitchlabel.o `test -f 'moc_pitchlabel.cpp' || echo '$(srcdir)/'`moc_pitchlabel.cpp
+
+libwidgets_a-moc_pitchlabel.obj: moc_pitchlabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_pitchlabel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_pitchlabel.Tpo -c -o libwidgets_a-moc_pitchlabel.obj `if test -f 'moc_pitchlabel.cpp'; then $(CYGPATH_W) 'moc_pitchlabel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_pitchlabel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_pitchlabel.Tpo $(DEPDIR)/libwidgets_a-moc_pitchlabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_pitchlabel.cpp' object='libwidgets_a-moc_pitchlabel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_pitchlabel.obj `if test -f 'moc_pitchlabel.cpp'; then $(CYGPATH_W) 'moc_pitchlabel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_pitchlabel.cpp'; fi`
+
+libwidgets_a-moc_poslabel.o: moc_poslabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_poslabel.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_poslabel.Tpo -c -o libwidgets_a-moc_poslabel.o `test -f 'moc_poslabel.cpp' || echo '$(srcdir)/'`moc_poslabel.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_poslabel.Tpo $(DEPDIR)/libwidgets_a-moc_poslabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_poslabel.cpp' object='libwidgets_a-moc_poslabel.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_poslabel.o `test -f 'moc_poslabel.cpp' || echo '$(srcdir)/'`moc_poslabel.cpp
+
+libwidgets_a-moc_poslabel.obj: moc_poslabel.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_poslabel.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_poslabel.Tpo -c -o libwidgets_a-moc_poslabel.obj `if test -f 'moc_poslabel.cpp'; then $(CYGPATH_W) 'moc_poslabel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_poslabel.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_poslabel.Tpo $(DEPDIR)/libwidgets_a-moc_poslabel.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_poslabel.cpp' object='libwidgets_a-moc_poslabel.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_poslabel.obj `if test -f 'moc_poslabel.cpp'; then $(CYGPATH_W) 'moc_poslabel.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_poslabel.cpp'; fi`
+
+libwidgets_a-moc_filedialog.o: moc_filedialog.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_filedialog.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_filedialog.Tpo -c -o libwidgets_a-moc_filedialog.o `test -f 'moc_filedialog.cpp' || echo '$(srcdir)/'`moc_filedialog.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_filedialog.Tpo $(DEPDIR)/libwidgets_a-moc_filedialog.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_filedialog.cpp' object='libwidgets_a-moc_filedialog.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_filedialog.o `test -f 'moc_filedialog.cpp' || echo '$(srcdir)/'`moc_filedialog.cpp
+
+libwidgets_a-moc_filedialog.obj: moc_filedialog.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_filedialog.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_filedialog.Tpo -c -o libwidgets_a-moc_filedialog.obj `if test -f 'moc_filedialog.cpp'; then $(CYGPATH_W) 'moc_filedialog.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_filedialog.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_filedialog.Tpo $(DEPDIR)/libwidgets_a-moc_filedialog.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_filedialog.cpp' object='libwidgets_a-moc_filedialog.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_filedialog.obj `if test -f 'moc_filedialog.cpp'; then $(CYGPATH_W) 'moc_filedialog.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_filedialog.cpp'; fi`
+
+libwidgets_a-moc_sigedit.o: moc_sigedit.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_sigedit.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_sigedit.Tpo -c -o libwidgets_a-moc_sigedit.o `test -f 'moc_sigedit.cpp' || echo '$(srcdir)/'`moc_sigedit.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_sigedit.Tpo $(DEPDIR)/libwidgets_a-moc_sigedit.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_sigedit.cpp' object='libwidgets_a-moc_sigedit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_sigedit.o `test -f 'moc_sigedit.cpp' || echo '$(srcdir)/'`moc_sigedit.cpp
+
+libwidgets_a-moc_sigedit.obj: moc_sigedit.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_sigedit.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_sigedit.Tpo -c -o libwidgets_a-moc_sigedit.obj `if test -f 'moc_sigedit.cpp'; then $(CYGPATH_W) 'moc_sigedit.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_sigedit.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_sigedit.Tpo $(DEPDIR)/libwidgets_a-moc_sigedit.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_sigedit.cpp' object='libwidgets_a-moc_sigedit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_sigedit.obj `if test -f 'moc_sigedit.cpp'; then $(CYGPATH_W) 'moc_sigedit.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_sigedit.cpp'; fi`
+
+libwidgets_a-moc_shortcutconfig.o: moc_shortcutconfig.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_shortcutconfig.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_shortcutconfig.Tpo -c -o libwidgets_a-moc_shortcutconfig.o `test -f 'moc_shortcutconfig.cpp' || echo '$(srcdir)/'`moc_shortcutconfig.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_shortcutconfig.Tpo $(DEPDIR)/libwidgets_a-moc_shortcutconfig.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_shortcutconfig.cpp' object='libwidgets_a-moc_shortcutconfig.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_shortcutconfig.o `test -f 'moc_shortcutconfig.cpp' || echo '$(srcdir)/'`moc_shortcutconfig.cpp
+
+libwidgets_a-moc_shortcutconfig.obj: moc_shortcutconfig.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_shortcutconfig.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_shortcutconfig.Tpo -c -o libwidgets_a-moc_shortcutconfig.obj `if test -f 'moc_shortcutconfig.cpp'; then $(CYGPATH_W) 'moc_shortcutconfig.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_shortcutconfig.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_shortcutconfig.Tpo $(DEPDIR)/libwidgets_a-moc_shortcutconfig.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_shortcutconfig.cpp' object='libwidgets_a-moc_shortcutconfig.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_shortcutconfig.obj `if test -f 'moc_shortcutconfig.cpp'; then $(CYGPATH_W) 'moc_shortcutconfig.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_shortcutconfig.cpp'; fi`
+
+libwidgets_a-moc_shortcutcapturedialog.o: moc_shortcutcapturedialog.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_shortcutcapturedialog.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_shortcutcapturedialog.Tpo -c -o libwidgets_a-moc_shortcutcapturedialog.o `test -f 'moc_shortcutcapturedialog.cpp' || echo '$(srcdir)/'`moc_shortcutcapturedialog.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_shortcutcapturedialog.Tpo $(DEPDIR)/libwidgets_a-moc_shortcutcapturedialog.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_shortcutcapturedialog.cpp' object='libwidgets_a-moc_shortcutcapturedialog.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_shortcutcapturedialog.o `test -f 'moc_shortcutcapturedialog.cpp' || echo '$(srcdir)/'`moc_shortcutcapturedialog.cpp
+
+libwidgets_a-moc_shortcutcapturedialog.obj: moc_shortcutcapturedialog.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_shortcutcapturedialog.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_shortcutcapturedialog.Tpo -c -o libwidgets_a-moc_shortcutcapturedialog.obj `if test -f 'moc_shortcutcapturedialog.cpp'; then $(CYGPATH_W) 'moc_shortcutcapturedialog.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_shortcutcapturedialog.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_shortcutcapturedialog.Tpo $(DEPDIR)/libwidgets_a-moc_shortcutcapturedialog.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_shortcutcapturedialog.cpp' object='libwidgets_a-moc_shortcutcapturedialog.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_shortcutcapturedialog.obj `if test -f 'moc_shortcutcapturedialog.cpp'; then $(CYGPATH_W) 'moc_shortcutcapturedialog.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_shortcutcapturedialog.cpp'; fi`
+
+libwidgets_a-moc_combobox.o: moc_combobox.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_combobox.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_combobox.Tpo -c -o libwidgets_a-moc_combobox.o `test -f 'moc_combobox.cpp' || echo '$(srcdir)/'`moc_combobox.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_combobox.Tpo $(DEPDIR)/libwidgets_a-moc_combobox.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_combobox.cpp' object='libwidgets_a-moc_combobox.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_combobox.o `test -f 'moc_combobox.cpp' || echo '$(srcdir)/'`moc_combobox.cpp
+
+libwidgets_a-moc_combobox.obj: moc_combobox.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_combobox.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_combobox.Tpo -c -o libwidgets_a-moc_combobox.obj `if test -f 'moc_combobox.cpp'; then $(CYGPATH_W) 'moc_combobox.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_combobox.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_combobox.Tpo $(DEPDIR)/libwidgets_a-moc_combobox.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_combobox.cpp' object='libwidgets_a-moc_combobox.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_combobox.obj `if test -f 'moc_combobox.cpp'; then $(CYGPATH_W) 'moc_combobox.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_combobox.cpp'; fi`
+
+libwidgets_a-moc_aboutbox_impl.o: moc_aboutbox_impl.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_aboutbox_impl.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_aboutbox_impl.Tpo -c -o libwidgets_a-moc_aboutbox_impl.o `test -f 'moc_aboutbox_impl.cpp' || echo '$(srcdir)/'`moc_aboutbox_impl.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_aboutbox_impl.Tpo $(DEPDIR)/libwidgets_a-moc_aboutbox_impl.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_aboutbox_impl.cpp' object='libwidgets_a-moc_aboutbox_impl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_aboutbox_impl.o `test -f 'moc_aboutbox_impl.cpp' || echo '$(srcdir)/'`moc_aboutbox_impl.cpp
+
+libwidgets_a-moc_aboutbox_impl.obj: moc_aboutbox_impl.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_aboutbox_impl.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_aboutbox_impl.Tpo -c -o libwidgets_a-moc_aboutbox_impl.obj `if test -f 'moc_aboutbox_impl.cpp'; then $(CYGPATH_W) 'moc_aboutbox_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_aboutbox_impl.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_aboutbox_impl.Tpo $(DEPDIR)/libwidgets_a-moc_aboutbox_impl.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_aboutbox_impl.cpp' object='libwidgets_a-moc_aboutbox_impl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_aboutbox_impl.obj `if test -f 'moc_aboutbox_impl.cpp'; then $(CYGPATH_W) 'moc_aboutbox_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_aboutbox_impl.cpp'; fi`
+
+libwidgets_a-moc_aboutbox.o: moc_aboutbox.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_aboutbox.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_aboutbox.Tpo -c -o libwidgets_a-moc_aboutbox.o `test -f 'moc_aboutbox.cpp' || echo '$(srcdir)/'`moc_aboutbox.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_aboutbox.Tpo $(DEPDIR)/libwidgets_a-moc_aboutbox.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_aboutbox.cpp' object='libwidgets_a-moc_aboutbox.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_aboutbox.o `test -f 'moc_aboutbox.cpp' || echo '$(srcdir)/'`moc_aboutbox.cpp
+
+libwidgets_a-moc_aboutbox.obj: moc_aboutbox.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_aboutbox.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_aboutbox.Tpo -c -o libwidgets_a-moc_aboutbox.obj `if test -f 'moc_aboutbox.cpp'; then $(CYGPATH_W) 'moc_aboutbox.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_aboutbox.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_aboutbox.Tpo $(DEPDIR)/libwidgets_a-moc_aboutbox.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_aboutbox.cpp' object='libwidgets_a-moc_aboutbox.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_aboutbox.obj `if test -f 'moc_aboutbox.cpp'; then $(CYGPATH_W) 'moc_aboutbox.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_aboutbox.cpp'; fi`
+
+libwidgets_a-moc_songinfo.o: moc_songinfo.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_songinfo.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_songinfo.Tpo -c -o libwidgets_a-moc_songinfo.o `test -f 'moc_songinfo.cpp' || echo '$(srcdir)/'`moc_songinfo.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_songinfo.Tpo $(DEPDIR)/libwidgets_a-moc_songinfo.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_songinfo.cpp' object='libwidgets_a-moc_songinfo.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_songinfo.o `test -f 'moc_songinfo.cpp' || echo '$(srcdir)/'`moc_songinfo.cpp
+
+libwidgets_a-moc_songinfo.obj: moc_songinfo.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_songinfo.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_songinfo.Tpo -c -o libwidgets_a-moc_songinfo.obj `if test -f 'moc_songinfo.cpp'; then $(CYGPATH_W) 'moc_songinfo.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_songinfo.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_songinfo.Tpo $(DEPDIR)/libwidgets_a-moc_songinfo.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_songinfo.cpp' object='libwidgets_a-moc_songinfo.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_songinfo.obj `if test -f 'moc_songinfo.cpp'; then $(CYGPATH_W) 'moc_songinfo.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_songinfo.cpp'; fi`
+
+libwidgets_a-moc_didyouknow.o: moc_didyouknow.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_didyouknow.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_didyouknow.Tpo -c -o libwidgets_a-moc_didyouknow.o `test -f 'moc_didyouknow.cpp' || echo '$(srcdir)/'`moc_didyouknow.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_didyouknow.Tpo $(DEPDIR)/libwidgets_a-moc_didyouknow.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_didyouknow.cpp' object='libwidgets_a-moc_didyouknow.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_didyouknow.o `test -f 'moc_didyouknow.cpp' || echo '$(srcdir)/'`moc_didyouknow.cpp
+
+libwidgets_a-moc_didyouknow.obj: moc_didyouknow.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_didyouknow.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_didyouknow.Tpo -c -o libwidgets_a-moc_didyouknow.obj `if test -f 'moc_didyouknow.cpp'; then $(CYGPATH_W) 'moc_didyouknow.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_didyouknow.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_didyouknow.Tpo $(DEPDIR)/libwidgets_a-moc_didyouknow.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_didyouknow.cpp' object='libwidgets_a-moc_didyouknow.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_didyouknow.obj `if test -f 'moc_didyouknow.cpp'; then $(CYGPATH_W) 'moc_didyouknow.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_didyouknow.cpp'; fi`
+
+libwidgets_a-moc_checkbox.o: moc_checkbox.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_checkbox.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_checkbox.Tpo -c -o libwidgets_a-moc_checkbox.o `test -f 'moc_checkbox.cpp' || echo '$(srcdir)/'`moc_checkbox.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_checkbox.Tpo $(DEPDIR)/libwidgets_a-moc_checkbox.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_checkbox.cpp' object='libwidgets_a-moc_checkbox.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_checkbox.o `test -f 'moc_checkbox.cpp' || echo '$(srcdir)/'`moc_checkbox.cpp
+
+libwidgets_a-moc_checkbox.obj: moc_checkbox.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_checkbox.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_checkbox.Tpo -c -o libwidgets_a-moc_checkbox.obj `if test -f 'moc_checkbox.cpp'; then $(CYGPATH_W) 'moc_checkbox.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_checkbox.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_checkbox.Tpo $(DEPDIR)/libwidgets_a-moc_checkbox.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_checkbox.cpp' object='libwidgets_a-moc_checkbox.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_checkbox.obj `if test -f 'moc_checkbox.cpp'; then $(CYGPATH_W) 'moc_checkbox.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_checkbox.cpp'; fi`
+
+libwidgets_a-moc_vscale.o: moc_vscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_vscale.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_vscale.Tpo -c -o libwidgets_a-moc_vscale.o `test -f 'moc_vscale.cpp' || echo '$(srcdir)/'`moc_vscale.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_vscale.Tpo $(DEPDIR)/libwidgets_a-moc_vscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_vscale.cpp' object='libwidgets_a-moc_vscale.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_vscale.o `test -f 'moc_vscale.cpp' || echo '$(srcdir)/'`moc_vscale.cpp
+
+libwidgets_a-moc_vscale.obj: moc_vscale.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_vscale.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_vscale.Tpo -c -o libwidgets_a-moc_vscale.obj `if test -f 'moc_vscale.cpp'; then $(CYGPATH_W) 'moc_vscale.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_vscale.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_vscale.Tpo $(DEPDIR)/libwidgets_a-moc_vscale.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_vscale.cpp' object='libwidgets_a-moc_vscale.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_vscale.obj `if test -f 'moc_vscale.cpp'; then $(CYGPATH_W) 'moc_vscale.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_vscale.cpp'; fi`
+
+libwidgets_a-moc_action.o: moc_action.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_action.o -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_action.Tpo -c -o libwidgets_a-moc_action.o `test -f 'moc_action.cpp' || echo '$(srcdir)/'`moc_action.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_action.Tpo $(DEPDIR)/libwidgets_a-moc_action.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_action.cpp' object='libwidgets_a-moc_action.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_action.o `test -f 'moc_action.cpp' || echo '$(srcdir)/'`moc_action.cpp
+
+libwidgets_a-moc_action.obj: moc_action.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libwidgets_a-moc_action.obj -MD -MP -MF $(DEPDIR)/libwidgets_a-moc_action.Tpo -c -o libwidgets_a-moc_action.obj `if test -f 'moc_action.cpp'; then $(CYGPATH_W) 'moc_action.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_action.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libwidgets_a-moc_action.Tpo $(DEPDIR)/libwidgets_a-moc_action.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moc_action.cpp' object='libwidgets_a-moc_action.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libwidgets_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libwidgets_a-moc_action.obj `if test -f 'moc_action.cpp'; then $(CYGPATH_W) 'moc_action.cpp'; else $(CYGPATH_W) '$(srcdir)/moc_action.cpp'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+de:
+ @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done
+
+nde:
+ @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done
+
+.ui.o: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(CXXCOMPILE) -c $*.cpp -o $*.o
+ $(RM) $*.cpp moc_$*.cpp moc_$*.o
+
+.ui.lo: %.h
+ $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui
+ $(MOC) $*.h >> $*.cpp
+ $(LTCXXCOMPILE) -c $*.cpp -o $*.lo
+ $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o
+
+moc_%.cpp: %.h
+ $(MOC) $< -o $@
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $<
+
+%.non-libtool.cpp: %.cpp
+ $(LN_S) $*.cpp $*.non-libtool.cpp
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/muse2/muse/widgets/aboutbox.ui b/muse2/muse/widgets/aboutbox.ui
new file mode 100644
index 00000000..2dadb447
--- /dev/null
+++ b/muse2/muse/widgets/aboutbox.ui
@@ -0,0 +1,129 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>AboutBox</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>AboutBox</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>377</width>
+ <height>525</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="paletteForegroundColor">
+ <color>
+ <red>254</red>
+ <green>254</green>
+ <blue>254</blue>
+ </color>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>2</red>
+ <green>2</green>
+ <blue>2</blue>
+ </color>
+ </property>
+ <property name="caption">
+ <string>AboutBox</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>pixmapLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32753</height>
+ </size>
+ </property>
+ <property name="pixmap">
+ <pixmap>image0</pixmap>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>versionLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Version 1.1rc2</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>(C) Copyright 1999-2010 Werner Schweer and others.
+See http://www.muse-sequencer.org for new versions and
+more information.
+
+Published under the GNU Public License</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>doneHere</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Keep On Rocking!</string>
+ </property>
+ <property name="accel">
+ <string>Alt+K</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+</widget>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="365136">789c44ddc772f250bbb5ebfe3a8aaf967aab76b10021091abbe19c03c679d76e08916c1c5f67ff27ff4b3cf71836bdab6498595333e97fffe73fd7a747fff99ffffdafb7f7f2fdaefa4fb528fffde77f261f8f8f3fffdffffffffe9ffffaefb4ddfe4fda1efc276bf77aff49fffbfff9afff1ebeb7fe53fd2769affe025e56d011b4ca04e8e88ad2d0595d91ecada0ab2b5ae303435c713800ba5c71f761e03bde0ddd156c7cad20f5974eb70cfccb0dc077248f7b86f88e9d1190ea8a3fe8465c5e0dabf4681d4f57d0f3af54678042babd0bf0a5ad837743fcecfe8d21bef44c57f480fb81a1171001cbfc2bf325a05f395e18ba11974b437ce94107e8f12ffbf78634fe65d7103f7bd805b236c5616ac85657ecfdac2077c0a69b800296ec1b22fa278f404fa9fe6b88907ebf0399923033c4770caf0cab9026f7cf404ed0f73e0c11d272d79047198b5f291cd2df6d43fccae41fd0038e3e0d11d217fd8b43ba6e20a41b0612f9c81001dbde01727d476588ef48760d6443cf10b13d3b32c497ee3f1922b6870a7a11307cff3114ab2bb6d215f41dfd6a0428faa35b80b8b40e9f01057dfc61887f294e0d447fcb10211dde000571195e1ae28af33f88b8ec568608fada00e803cb96a1bf827ff12f03c7e560cb107179fa069473bb978608fac339a0543f38060ad5fd3d437cc7e0d710ffb27b6e88b8f4bf0c11f4834d4071b9fe6788b86ce4c0005826864140fc6ce9b8942d43c4f6686188801df50132aa95fd1ae28a91ae505cb8159475c0e2578eef0c7145f16320a3fe0103e0e6c6d08ff2b16d88b86cbd0165fccbf03d3144f4bb7343fccbfddf156534f493158c1dfde70a506c0ffb8608faec1850e4764a43e45c716e88b8f43b8608d8f636305063706188a27d3c31c477ec3e0025bf72f16aa0385c1ae257b21b4344bfb73044f43bff80b1ae3834c415cbae611c0526fea572027d760c91405f7b808ac3d6a7212237d6bf28fabb27069aad0a28d5167e1848e4d410b1cdf70c1197fc1718ab7c7c1bfa011343fc4b766758453f692540457af4df0de3f88ecc50adae58c45d6cf257827e0c11b9bb1c28b862961ae28afd0ea012747e0fa87c1c1486488f834343fc4b79039424f25ecf103f3b783390847786488fe3013056237d6188709c7d19221ce73d4384a33d032abef4edc91045ea74dd1049981c00f5270a4c94a0a913e82805d4a01c6e1be87f7c034a8fe218506cab1f80c8b5ce370c1197c1998190f6818aef489f0d11b9fea921fee5ec0d98a88a5d1aa248651f86f897616658453f4912604a02f52f0c9140cb1bc374050f5182664eb1d725e014fb32448a8da680cad8bf0303e971082809270225e17403a880ed2d0339776a882fcdfeae88f4b83a03266ac6bf0c9184835b43a458911b2281f21930e54b07134324d0d10b305312de1a662b785c45ae7e8a508abd6d1a22818a3540cdd6e8c110571cfe0177f50340ad76ffc94025bc0168a55ac58721a27f5a014ae4fec010b13d2a81093f7b3930f02beb86551226f73fc0942b6efa060aee3f43fccae1be21b2217b3444220f7f8119bfd2da374446fd1c18a671c5d8b0ca86647c1cd05064545bd08907bc8f886dc7f9727f06381b66065acb29a06cc8f701a57affd110d13f390554d5b7f52f13b5a70f86488f510e4cf995b35303b7e85b4394c23c0566fccaf0c1c01d68c31049f87d678854bfda0a708aadef0b22c592c77ba0c3157bdb02d274d931440ff66875c3e9749dc8d50450221f7501ddb3fb6343a4face21c0bd21b91b19a29377b70154aa1e2706eeea97804a72ffdb10a9fea6ef98ea297a6ce01ef56e201b3e0d91a6a31f60465c36cf0d54a067037d87bf2b6872fe19e24b3f8686c8ec51d71039378802d36d2a7b64d4a181862d3344cef59f05e4dced19a0acdcb830c46375eb0be892b70f5d437415fa516f53e7ede40850deae278648d3e91898d0162eaf01a56901340d6864c3ae21a2ffdd3144e4d21ba0a3fed8a321bef4f0d510697aa32f55f4074ba04b0b339b0a887e561822fa2f7b400a3c5f19a248ddadeeea9d9ed363bc6fe0b6f603a8a774b863a007fb0751d647ef806e8dfd4d0365fd0cd09db0b83044a1cbcf01b5c9a30a98e94b878648c2ad68837a75aac7159d63437ce968d71019d53b3544465d8e818e6ad48581eaf16a8880ed1097a6e6c6153b02f2e5f1c910d910232435285fbe1786c8977f64434351e7c68628961f715bcb9c519357c0bdbe6dc03d9429a0543fb9334402156340699aff4144ee291a83ac4eb108473634c41567e7067a283f40877fe94f0ddca2370c11b08b1343e44b7747406d38bb05baba9dfc4184637f1348c9864106f4f88ec3730383195d039dbc3990013f3706ea4bdc9173a7fae20950aa1f2c0d513df67243447f780b4cb8221b19e28ac1ab81fa72034cd5a0bc013375f14f0c9195dbd143c9950d49ab344446a5178648f57c1be8aa0bf760a02f9502293f3bf81190ea377f1089dcdb0528dac96207c8b8e2e8ca1085ff67df10415ffe33acb221b9d7bfe46454fa62888c5afb3244be3c0514ceb9e903a09c5ba686b8cd4f8780326aab6b2081b6017536f3134394d35e0770cf313a02459da68c296d1ae23b6e7a020aeec52f907245fa07f12b0f4f40a6ac7c1370f39c24066e16992152fd95f4709a66df061a5822d7d00a7ef70c9140f791627da7e9cbae21aed87f0194a6c58981c2df0194a6d91f50f8e386d377efe2ec0e50d1dedb02badcc5de6f0d91403b09907245be03f454d62b0129f67908a858b6f6809c8cea1d0105699ade1af8973343fc6c6f6c88144b3f803e69ba5e1a22815ea3173c709a8ebb80d2f4e0d34093b309a8473f3830440ff67e62e0617501b8a37862884277fc07d1187cc613cec0699ace0424d0d12bd023606bb70212797d0f50293cdc020a25f2ad81d6e1d54007fed010697a4bf49da645658870fce84bebcf0a6611b9d269ba5319e25f0efa80d2747fdf405ffb165012e64b03a32c9140a5fb96831b435c71b1017474cfbe34c48d6fd0067427ec9c19a2e778b70ea48474fb10e8e991674b407371776e60a45790455c92bb3343046c632ea0f0f7896d7d53a293f76488c8f5770d51919f15d29cef78bf314466cf3e80829096978698274c32033345bf409fbb47ccdfd630a0385cec18e8a12c0d9173070740a92bc686b8623c37446cd7a2128e5d821e0f0c54e419a01294dc1ae28a5e1fd0e3dbeedc40911a1948e4a80d63f782fb3f809e3db253400566b80ba4348ec7ba42e5e3f6454025fc770968d2efac3430333215a8b7f505e404fdf6c810ed7a457a3477cbb89d9c037d75153e0c4ceadc03037a17b389819e4169a0c53d3344383a6f40a9e6e2d3c014c5df15f4c7ee0c91c8374aa031f0bb6f88b23e8b46ba72de56034079bbff6ce057a23854cecaf41850ce8dd601f50c86952192f0e007d0bce9153f5b27323d947503835dfa0e1ad8d65901f4b9bd8e1241a45872ff020cc8a803e2d2e4ee0abef60da469cb4049ae0cc4f6c8c0a3d7015071c5c5a381598d3d4394f52aeafec489bc7e65889fbd8ae673d20c76c6cf6e1bf8954dc0cf845f860858fa07f1b33d7d6917384f0c9173dd2720d5b3e903d023e7325da10ab47f0a68a6796769e011700b50cebd3d02347dadc13ea0a6efb0004a2a5049023535376ac3bd81b1adc4c08851cb10e97135022af236fd3650e82686f897f531507f56f014756eea9c5bfe18e24b0fa30d9afae6f9f068a00f3337c4cf5e1e00f4b593872f03a33d25903289b17c31444615bf001995dcaf01f4b55bb77b00ddc024968cac20f265ad0ff4d516de19180a1f182281ceb70c8c07b505eaafa7c040d30bbb82c8b9a435054acad891ae2819614d4e0dc4e59f2112f9f00318eb59ecc910a530cf0d91c8d30aa8f88e74cb1021cdbf0c910d47ba62c215e703435c71facf1005e6bc034cb9e2e6c210576cfe4164e57594c2998a54721f793b73919af70c34b0fccb5f7fecc91021ed3d02aac85fdf40ae9189d4105d96fb29a0f2b1f70e686e7e2333d06c3d19e2e639fd1050e8961b86f8d2dbb9216a7676040cf88ee4c3c0e0ce3f60ac11d69e8106e5d1c063d39e81c9fa04a8f484931968606706da0f65c3842fbdd93344dea64aa0a9aef836c477dcae1be25f0e4e0c91fba70fc08cf2b17364882b763b86c8cae7552bb55af8173f7bf70fd0bd617fd7c0b4e004d0c8d5bc0da494b1e3074384b43300327a5bf906408169a505a03bf2c6a580cc3e9f035a769277012da248078648b19b73c059a99fade86ddde85f267a8eea19984adb3550914f0065d4d38f81aed30e30e33b8efe19e23bf64b03637d1f8659dcf7ef039aaf8dacfc83c8b9642ee8469a2e223d3aceb979c710b5e1fe10d0c0ccd58681ae75cb4047e01348f57036027ac0e9259001b7e78608e94d0e685461f00e1464f6c10ba069c1e1be805a995e1ae28aed23401387c9b581e78639a025349d6b034f6bb9813eccab8076bd6803baef770f0cf1a55da5c78472da7f31c4af1cbe0153cad8516588a18a4501a87cf4fe808a3c0d68ca6114984f43dc3ca75706ee84eb02cac79efea5feace0dfaa1deb765d60ee4f0d3cf17d002a1fc508d070e969dbc05dac03f4801bfd0bc52129df001587f7b1210276be07149a187a00fafccbfa8121527de71cd06cc241cfc0e3db8d40637def06a69e1517f50bcf7f0c8c291d03cafd74084c3444d035c4b347590153aed87d0466f11dc93c2a61b769a7e2674f0c91d9c73343d49763bea3294351c6e64097bc3d9818a2819daf6ed1ddd45979f80868c835bb36b012e1c81059795b023ddd0a04999ec4734304ecfcdbc0628e1d20d7ca9d1303b768fd4ba15edf1e30d077f405b40eff5a8066f0fa1f801662dc1c1968d7d70daba027ad6b032d9d0236a1e03e0e05f42d97130329a6a04f35c8f466885f99bd03330aeef6a681c7d9e780e6d61701fb67886a7a746988b86cf3b34db314578c0cd1e79fe85fba2a30b7404a81593f3744397d8c26b8e702b3380654606ea6067a3957806e05833ba024a3bedb80aad8485faab9a4cb6d03cf0d0930251b5afa95298dc1cdbe21b261fc08cce88e4ed70c118e76c4b6d77449e23b6e0d3100b0e81b18b91a182260df1f4047b7f973436443775f4013fc6f027495515f8648b1a36d01ff7298022915f9be05d49fa8d9abde673773bedcbd1a18724d801e90df1b221c83125045ce0b4304ecb2636042e60228541b2aa0afe50dfa8e92b27e931922d52f7b803adfa71b4045f9f8c801cf58fd33d00d3c34709b6f19a8eaa5212ae1bd424a094a5a1f0616923f01330dcbc53d2a6bbabdd12891c84d9724728ef4686e17d1d0770d918405e9e13a77f169882f3d242e4dfe47f3393644c0ee360d317c3cd7cf66d4dbfd0743a4e93cc2f137c5797f02a838f45f0d8c197c022a0eb76b86884befc7100d4ab60da819bfda37c41597c706e6c4db8046470789809a7d3e0274df3f3d05181d6d0dce81b196e12c04b4a7a32140bb9e3c5e019ef37c1668706717d0da8d4ba598baf8477147ce9b679cc8864ba0ab66bc6588667c561a18c824c5eab63fbe74ab67889fddff0306ddbe0c0c1154020accbe7eb6c715c3a980f231226f5d3e0e3680fab38259dcb40a978fee8621c2b1bb0032aee84c0d2c8c4d0d3c156c039a19b91d19c8971f4314989b53a0d092a24b034f165d40634ad9bb8142a7efd038eed52e506aa8e2c210ad54bb0d54fccbeba581d9c831a091efe200d034d8e0ca40368c0c2caf8c7b76d1d5b293d144a081ff63402bff0e47860858f7db40deee19e84b1d025d06cc1e124384e3fe52c00de7483f9b72e31b3e1a98d5383470e3bb3190b78a4b4ff7b90d03f7b9074364d44926a09c1eae0119ade5d11990ab2d7c37302fa67014c07edb1039f71485bfefa2fd7a07a8243f9f1b7816db31301b3901d4d2757a86884ba703e8f9763402d48ee5fa8e01f7cafb0c60d4ba55e88a31f0fb616099a782ae52787128a0c01cff0334e23c5a1a62783056cb3540465d005d4dd7f68f0c0c1f0f004a6132f906ba04ece24940911afe002a52fb5f0646267201993d5c037a348efb278608d8de868115886d20a3813d4d01958ff31740e563b46f88f2719c007da02c0d6ced8a12347081591c19221ce343402d5d6f6860815ddf4081e9022a30d99e817be526d0e73bae6f8001ffd22f05e47ed1012aa0f764602dcb12d0e8d75e94f54157d33e57b7021e24ca31a0a53ce7cf06c61d7e81942f4d66408fdc1fbd08b8696d7d03191df8e9d8c08def11c869b6e6f702cad82949e88cda575ceacf0aeee2674b67d4eb1c5046f5fb067a391f80ee4045668854ef2e01e54b2735447adc4e055aee215046b5af80523f3b0234489d9d191864ba032aada83a35b025e2de10997df30b68d4693e04665a121075aeec6aaea0bf2de06773d2a3aba981d14240bb3ef804bada35f00468f95c3631b0c1f018e811f4c30e905160b6370cd1189c0e0594a0db6720d72d29070654e4ce9d81c9368a43f35901833b631787c35d43446eeb0b2874c59e81e80f01158734374481b96801cafd0bfd8bb261271aa57157c372a79b0212f9e009d0386ebe6660c6fb01609d52b2480c0ca9ed1ba27cf4de0056ccb4d23d4324f2e50da07c393805f208faf07dd7104f5a77774041cd5ebc00fda8b7c9fd81819b96ae28c9b9dd19507f56f0100d7df59751df8648a072075046fdbb3250915f0cb4b8ba423997ff33b0ba54a016f7ac2ba0125eed01ba673f281c1312f935ea7ed5d5cae14381b272edd5c0b4cfa5815bf41da0e7b9de8181a1ac998151b8434055ac3d07b42e787b1d202b5bfb6343548fb3095070c5edaf81816e85a3a40b777a0f54e4dceea981e55111b98973eedf185046250340f972fe64e0c67705285f4eae0d7404f601cd129fad0b34293c039473bd0450037bd30118fc6b75360c34b043409baeae5e0554a08f5360a67e10dfd1d56a978d5743a4d8b5408f5efd3703cf0da9206ec049750468c07d7a2dd048cda681a7c60c50de1ef70d91fb9b2472dd55e48edc0206dc91ef1682a8c849f264a047af70948c5c9d26061a941ca83f5109a34d9eba3894b7808a43efd740456e032a0ebd6f034304fbc05809f42a50a7e6d4c0f4641750714837001587db1340a392dbf1743275deee3c005a8f7b5819e8e30e010daa1cdd0af4b03a03346fda5d1822912f7700ad603e7b35709b272e5d2d15dd7d3210b02360a0f9ca774304ec2711743952e60e28e98f1d2f818a667ce31f30256fb73e0cf1a5cfd1839d396f998098396fd7de014de72fbf0d34d23d01d97019d563e671dccd6d43c4f66c0874553d041a65f94800e5dc3e3fdbd54340de32704bba0334a775b40968c5eec9d2c0aabd025022dfee03152335fb0a7afd59c1d32a3dd2b6d3e3e1d6c0e37d0ad0f425492e20810a7d8746d0ce4b01e9311e18222ef92ea0dad0db04265cd17d0868960d44aa6f1968e9ce018d9f8e041a1bdf3e0632d597d210f5e5fcc2c004c48f8181880f405d854165e026fe0268ae717d04686af166d3c0c2fa53032548bfa23568fbaf8678ce9eaf03a53a46fa978a1eecd11b30a53bba9705349fb83546f43b2eebd5102881ed4b4364f6f2544046f5e7809aad411fd098c166c4b6a37c49c60b40e3da7b29a06c18b5057cc7f71ba075d245cbc0f44202a88336b83444293ccc051a215907faaa5147806601cf8e0d6cb6ae0c742553433406478f80d6c18e3a404525bc2b047458c77bc08c8c3a8c52b8da941810b1ed3aa3ee9e0165d45d66606a7101a8129eac0bc8a8610ee8693e7f01a65a37cecfbaa56bdf021d2df19e005d6e16fb7780326af718d05adaeeccc060c6dcc09908fa593fdff60ce4dc09a0479ec3b18133223601adc9bbb80034f33efd35d07e0c808a9189d809ba8268fa1ebe8109bdcf0e895c5324f2f6a72065af46fc6cea8c8a15332b887f79b802c65cb1fc32d0c01e0b488fee3f40ade5edab21d2636b0b986872e9089871c50fe1a8f39687e66d401b515ef80ee7dc606a600c760c78b0fcd01049f89002caa8a31ea07cd9cf01cdae1cdc1ad8797060a0d55e07b466e2902f6d9ac7f8d22550ff454720b2a1f797ea378013b90494a657db801662e4d7019eb0fb3c32b09b740068f4fc9d2f6d968444a1d3159aa1c99e013d47edb400ad723d7b36d033181a580fa3800d80835f408dc1622420e8b75706ce867a37b0a05d5faac1e1bdc2c016805d40ab4b874b604a8f6da0049ad15f5faf0c9c861379db6b1ad0f88e199052a38e084743012d437cc7220a5de6ac6c19748a4401545af13f10a82dfc07a8be9c7e03330d3245039bb9a5cb37819404da1c015a5b7c780a94ea3a5d0ba80dc3c2405b7807a863743007340ab7bd6688f997d91130d10ab32b43e4cbe13da02523775b86b86283d8367dd848e4b801674db726d2947f69ee52ab2bd229e07c2160cd27821e55ec6f22f5ee0950364cce0564c36654e4fc6f11c52bd0d198d216a0fa72fa6688549fdf026aa5aeef0075ae465780eacbe535506a75e9ab8141b73560ac5be30fa016f72c3744c04e6e0c11f4d3c2c01cce3f60a2698e35033b0ffeaee0108d0b402b76476700cb3c9384246cbabd91732d036721fd02298f4d0744bff9c41d28ee6285f3e5e101d03aa5c919a0d50c69b4c9cdec1bbb387f0dec914800ed39bb5a03f4fcf2bb0568b56db63030c7f70c68bde5596288a2fd786e887fe9ff01c3a597023d25dd0095a69fae0c2cb0bb053430b31345aa683a2d11db2190d28eed8e80fab3825984b4ef246c2d0c1ccdb907e8797fa76b882b76a22bd94c94716bdc05340d56f0a5ca8656b60968777e771df08ee53ec0f869ebfd19f0b970af0666cddf012d8048868668e9ca6f816613ae800903337bbfc094908efe80a53c5301ff7224d0b876ff5a40d0d781ba956257c98b2182fed306528d054f80fa13b793b8250dfc40b3f16e886c58ec03caa8bb47435cb1b105a87a9cc6ad71a0b51badac02940de91bd0d7e0df27a0aed3f30850be1c3f1928fcc78096241e2e0c3c25fd18985e5807b424717a29d07ec24340cb4d8ff4b35a5f78f1cf405ffbde1019757e6388902efb021e792ea22b3948f5343f7a33706bfc02b49cf0df8d810340c9176565b23c0306e4ed56c740c0e28ad25939191978d4e801ea381f1786682eaaa862a59659b47a2d400366833d402d5dde07786a4c926760ac91cd134039f7b50be81cb4dd9e81f51f9f067a7dfe179dee416cbb5aa5f6706260d4fad8101568f205689de351d497b24e422ad014a83f71b388b23e766d78b8079484bd88edd8e385bd1cf04ee17740b13d6b0b74dfbf3030282bd0795b879b8648a0f18981118104d0d2d96124d038d502ccdb21c08abbe4fe0b483539ad2b52759df680923276f001d49f682ee26e5a393dfe5d1bd81a1abf52e9512399cf003d592cf600ed361e1d18224d6fdf0025f2e009d036027a8e5557c7389d3d1968e809a913e8885f49f50cb47b65e0c4e9998176fd04e89073d7b702a66cce33a0abbabf012891cff42b9adf3fae808cfee9fc1bc8f5c437018a686192d8f9d8403c372471dc690dca97ad36507f56f0b21af94e27cea8bb9e21f265192579e251c9987c5c415c41d769e2b52c577c699d519cba720668a6f9e112d01999378f022d5db9067462ca5a61a05ddf30b08f2faac724d5eab0ec9f211279f75940ce1d10d25485ee780ce82eb67b63889cbbfe127459dd710cf41992df25b6cd277a17514ea77eac7efa00b428edf8d5c03a364197cee6e41d50e1df58009a6b4ce78648b1873b40834c9d0c5022bfad034ad3e7682ea64ec2aba1215a98e4dd1069dabb027448d3c1d0c044596560c5ddc0c0e8c631d0558dba36b0ab84d8a65a00b1db36b0cb7707c868a5f6f5a52c7d6ba58706a606b680fa13691a37ad99332a8e8eaf4171795d18c8a87d400fcd370b033b63bb809ea237ae00cdef4ff6009d45507c03eac0df3c016aa56e4f0d9c7117b572e69cebbd1ad8bd3004381e27999486b89b3efc0854604e0d3cab3f008a6df711d0eab07e056849d1d5818189f60ca86894da37c094fab2f705d49f28c9abe2d06b3b1bee9606f6abbf033a6ded7edfc052c06b43d4a8640cd04a2571706f0d99561fef01a56689fbc094d88edb01a98e6129668648e4c539a02387d2570189bc9f1858bfbe34f0a475076839d0e186817d9e57404fddd17f40c68cc4fdd8c066b8db80e6b382652461c769faf8012860cb3f882b5a378608c7c51c206049551a1800f802746f58be019af45bef017daa476b0dd0b6f07e1bd02edfc34980b3a1fa0674d0c2f9ba81ad7ffa17adedd9db35c46d2d36f5ae20e2b2c8013d799e1f0099527dd3c092f77d400b75b6897ef3891626cad8dff4c25d0ae854c0e19e217ef62437449adedd033a5cad756ea068df013a3aedf1db10ede9a97e45893c98015ae5fa1405b7eb348d33ed6bd036d7b34703cfc81702dd1b885caa13862617862863f903d06798e1f80c187479c3c328a019508eea3134f0129528a7a9d3f47e0f509adeef1a7813c90ee024bc35305a9c1a2209274b40cb814e4b03f7a84f433428d53f8047e2a43c05b4cee06c135097f6bb6b88b2be36014a9d67b0618854af0a60ace7cae3003f681eb401e5dcbf0b03eb836e0cec1a980934b6e57fe1e9642b077abae16406c6a4bf05d4b9cb23400333f9b721326a6f1d1830d677d701268cd29e105b1787c37720a5386cfd01b782885ccfc561f266e0c4c72b40637d4961a08bbf0034ea747300e8c483eb149812975e3406bdb4ad75c11f4087c7fb947ff153c1f609a0341d0c047a8a26a4a996bf0c760da4fa42a01b4e618814ebbc1b983bf932c4af5cfb57541bfa0616c6de015a6473350558dad41aad19581aa9f42819944d778071977359f42f13e61a4fa3f0f79cd92743200536c8cae62fae88c63173defe26806af6ee05a0c88dbe809c0988f211d06046ab6d887afb6f0f50adecb6000d63e7d11864a9966a0cae0d9173a54099bd9b01cadb930743e4edfe994047eb7d1b18eed83144221f09d8499e5407064e7dbb37f08e90634007939c7f185839ac9096da6cadd88ee929c534690d5ac974f214e09c3b6919786e20d59b4fdce7a2b9c89d733faf80726efdd2c0bf7401057d796060a9c62fa091abb767035b43ef80b186c3760c8c4b29603ec9266e05b91bc7741fd0d69d9f16a0bcbd3d3444de7e648056dd1ccf0d3ccebe08b4c06e6c202bf52f1c8bd7ba7e37f016a26d43a4c7443f5bf094743901e8c324e329a01555c751e772e55c323d03322ae126f9d27ce22e16f5a570cefd5c1b085817d0bd727c0768ccf1b7050c48f5cd1d40f952dd023e41e61fa05ad98d542f5c095f0780527d7e6360ee7529a01d5b3f03bc0ce749a051c9a5817cf934d0e7cf01464793e99120a50b17ed7ad1f43fa32de4579ac6af81611c095143ce73d44601d49f0869a4d8df5449d2067460eec5b38191ef3340436add0847bf59abb28285409dbc8b8580d53fd39681a5f74780761d6d8f819c3194d709a0344ddb022d151d00ec1949eeb6057a7a2d0ddcd69606e6095301657d6706f8dcc02b60c2285cbce4af010687cf045322d7eb1ae2f9a5da0aa8738ed35f7e814c39f70fe8535f8e968648e424eeb70367d4efae811af50668f271d403d4b0fdec0113527d331afa41b3262202f605e42c5e18f3a54ae456b72fd0429d7303379c0701f7fdf32340a7245ebd0313fa30fd1130a51f542c81194958467d19d449c8534109d49f680b23e8a51368676ce0ecc10ea0a6ef77c710793b4d008dd17fcf018dc06fcc0ccc4547b12c539d32529c010585bff564e06cec7b4069ba3e1790a6b316c07adc64fa6360ffcb3130d50610fd8b969d9c46c35636ad7234e384a36e0c78cf08416f3eab5f59466773fc9740b70692b00d909549cc25f59a290a7a3951e8c67fd17f36c497c629de35f8f0ce630171e9ea5ffa2ce2dc6c015a9fbc3e33f014bd0568d9c9d98321eafe4d69889fbdfd314415bb4e00ed17cbba028e0d88a35b7be35e9ba66ff80d682cb8b503f449f5d31ba0fe448d8a9b67e534fdde03748ae6f40bd002ccaf99216ed14905e8a4451e8aaa54832af7db80ba3debfcac13e8e1c240e3d832b099765d40172ece84ac410bfc1f160606760969aa7ed0cd8740cf4037c0a4cb40c429a01555170aba56541d11b9e61349182936f13cf2e73fc00b520f019d40f5716688ef787c3470d84bb4741397d32c0114dbf13f4304acfa02b48862ff9f2152fdeadcc0a9b39f02aae9f68580499dfe1aa01bce2ca23fe9b569fa72811694f5b68194d9a6f613d063fcf46d0bc8788eda4f0df1b32715507fe2661171993a91cf87066e7c1b80560e7f7c18e2b1e951dfa17c79e9013a7c6ff40a6890697d574071f8893eeeb4594b1d657d01e83c94e2111873c5da0fa07c99968648f581be54d9305d077420d9b6be4307d60dee052ab867800eac1b45499e364399d1773807c897849bf8b4eeb1d138921e3d2da1e96c02ca8691a0feac6011393773ebf07601e844aeb7d2c01052a4e9acd937b0fad9fb0ea03524e35b40c706acbf020545aaff00a8226f2680522cd67dae8059c0be81856df7021dc2730d683dcc566660f64d576899c5f6af81592f02d6d3d8d631bfd2d3896d171f40979a7db509a440f206f4a851ed470115a8ad5fc9182cbfae8042b7d77f8032ea48e1a83f515f569079c34392bc1a22b6ef3b40a92bbe814a7bbccf019d4d79c115cd12ddd515651f5056664b40bdaddf1340a9feb666e090b76340cb5fce6f039cc8ed11a00deca707404adefe0a0a0ddd5c03631e01e398d1e69dcb24d0c99a20a31fb44ad3ace3a2fdf16960577c195097539ea326409f7bf6e40118d3a0ec9c008adc73cbc0a177bf013dad1bbf7d34d04ffe0174f2c2e9958187e65760daa367300266d4ec63fea5f9448a455cfed6f3fffb0674b0e2bf2f4047a725e78096bd2e2f0c2c5b9b002a300747018edcbf730375eedec0599d2f80b6449c170606fe5b80b6bb5c9702dac2de0ce8b1afe0ea06c8a8737b03a0a02f75ff6988a0b797c0207ab049acdaab61cc6a8653a0f944a3b4ba3566a993f06117a8b42c690acc34280b6894b6f5be2d500f25522c757aacdf18222ee50ba019bcad1f43e4dcdd1a906a27e810d0fa8f8b0ac849a06c66606e7e0e4ce8c08fb9a229762b984f00a5c7e819a83f11b9488f9e13e8e30b70022d0cf43ee700ab0892c73fa058ce0015cb12f053d2db39c069274932023466906c02139e09f7232e3da769bcf261056c981a08343b7b0b682bc2e8d1c092912940aa27f1e8d5808a94be34271c170f06760ce93b741e4afb1918736f687f02531e022eef80594032e35f9c5127bf40fd59c1e7ea1e9565ca97d6cb958132b60d6895fc4b69882b5ef702521d77fa790074b5fdf80bd019110767014ec2ead3c0fab1b181f9fd3b01e53466cd6bd0faf5cd6b03ff3211301071fc0c68a9c6e52e50501bae67409f06a57762e068ac75a08ad5fa49eb4240fb71ff084cb9cd5f2e04e44b12ad65d6cc0d444926c5ea7ce1c1fb06a8ff56f0b57a6acc72e74b0c8666b9b22149360c1cb8bd0e68ede8f8d5c08811df910e488febb879e64ed3c9be210aee92efe8e938988b89810374e68016c88c6e00a56977080c80e13ba09519570b0129368e8cca9bae40fc4bcbc0aeb47f404a593ffb05ea4f94d388cbdfb0eddb25a0def8766588242ca33d2dd20e45fb857f710b13abd36bd0deea83a851851368ba666085d9a680f9a8715fc063d354902ba31e018df6ec7c0848b1e11028bbaca84a013d02b6a312164d431ec5922f6d3e2b98471bd4777abc8c0dbcf9fc0ad081b9c98d81a21d95b0efd9c8f119a0638b92350321fd05dc48ff181876c9029c1eb343036b58af0554e43921ed15ead2be0bb8df769e0d51603a3343a4d8c514e09c9a24a67d6a98d18cdf4533de6f3e71e38bb670e014fb4a01a5581989dc2ccf6610f21650912ae780a25f6c053872e7d78022f7fe64a09c6e027de0b214d026cf07c080f271c3cff6c63c9cdd5e00d394bd1afad219abc2db91a683ba67c07e20bea3994a8c7fd90654c68e2f81fa1377d32896e55f02457facfc2b30574057a3a317803a350751924bc7f6f35640668f3e0c3cbe6d193856e2cc1039f72ce05c8556bb3230d6f76d60137c1fd0992ad99a81273ec2a1144baa1630a0049df12fcd27621b71192b815a1ff1b3e354cf0dbf6d0307e7bd1ae829ed001c879b2497408ff4d8dc05748bde5c37c4d37cc5afd4d523fa0e5bfc8a13e87b60e0d8a29181f7aee88a922b6e9f0c0ca86e19d89a71028c1921b92f019d6433181b386247219d900d97cf021e128b2130e531f23cee0de33ab2f4d7f9d9ba6647e18ff7e0d530e08e7cca97369fa884f11d95336a12fdf5ca19556e1ba2ee2fc78096cdef7e1bc839fd8b6612bfef01b596a5c0cfeaeb005999940b032f807d0774b6cb6e1ee07ca1ce55ce97dbcac02ece852182fe33013460d6be364481e9b40d1cd0f604541af91628e786c4a537056e9e0d3ccf4529ac9473ad0e4958f79c222e574ba022a3ca3d437ce95bc476e20af4ef07e8a891ce0de44b06687f43750ab0c82629ef00d5a85164f6c409543e1b224de9a04d7a1a0e3b7f30b01c2835b0d9e90cd0f6b0cebd802310066bc08cb27ecdcf66ed94c3a1f9d93a0919bbb8067aac60ee901e4d9775f52f13625b17fef897935ba0feac6011419ffe2561618854dfda01b474656f0ae8e9b5ec19224d2713c0657d0bc8b48a6064a0f0b7011d555a6e00852001948467717f99f6346dfc43c09c2fe31b039b36e786f897fcef5fa2e5af3e000d53167d01f3519797c04c85ffdac0c1df2f02e66f2ff98e8c834992310954f724a3c9797f057a2c8bbeba03a81ec944dfa14514ed7ba0c858a576088ce396d43a2172cd272a508474e676eca532d08c7f021acbf9776888d86e6c037ae2a367d0004326fa955c79bb69605ddf04d081753fd1a79b39d56315e30a18b6cd0cac40bc36f0a495008cd1b7063d038b6c3680198b28ce63a87396b5c9b99b2f035314858177c62e802ebb6c2a7eb6bee1c4944dbc6eae868a5bd2e40998d0973a2160cd6705cb5522e76d27f2ce2790aa7b2ec854a35220e756b0d636b04e6901a802c514560d1a1d2d77037a7ddaa03541c9e3ca470b509ac6a1222b6085c89121cafafd1630e38aee1fb00d693340cf84ad9d21409ab686f7806a43770ae404acf302140cc95fbe017d864cae6640498f6d44389a4f349f911e1da7fad31ee0a2fd63e024df27035bee6e00adec7a5e035cf8bb8053bd63a087f21ed0ebd1a0e467800aeece23a0349d16065e1f7e696021e8a921522c8e7f6d4e9fe75f2e0b038f2b9f060e32febb8263e0fe09680bf303031d921da0c3775c2c05fccb99a0aba71352bd6e0b3969513fdbe3816692039a7f69f701e5fef01918d05f9f1c026306dc3beb01758160cee205a83fd1e44419ebfee5feb721bee365026894656ddfc06aeca581f2710de4baf17d0085aae91050f9586e0315f932ba08d0d06f52bd0115a97eba0b4ca8403ff30067f6ef91818df48981856d070232eaa70374f897eb4f03c79eed005d0633e275a60db092e98c34cd520d773c027d9679a60b40fdf5fd2ea035139d2f415c91540a47c5645bf74540037b41aa371d9f28eb7bc094aee409bfd27ce2c6b7ba37e4a972bff5726de0a0b84f4099bdfecf40f49f01c6d892e5a3812d444f400e2c4b010f671b23604071189f1b22fab12aab86528bd2a204359b283807ad02743ad056d4a8d459f9b2616015c1bb81aa7e29a0387c7f035dfee53407b294598d363060c1617b00942c3ababa079451dd6d60c240c47c6a601dfd1898d161bd7a08a82b328bc1f88ee6138d6354c29e322aa95e0086f692c719906b8de21c609821994c0167c3bb21e2b21e05b7e7f4f8bc3170f4d19b80243c3d37c4bf3c0f81947f190e0c14dc5b0155bdb734b007ef02c85945d02d0c91d9dd53a0107c1818d96c0153e65ebbd706a6f4da80b2e102683ed1f2c7cf66ae1e2f5340a95ebd1aa82fd786a80db35b40e385eb9981fa720c688559f50828e7c6578072aeba03c6aa2f1706d64c445b98f59484b791b759dd16d2755a33b09447d0251b7eba80b2f2a96fe09d5c6f028a437fcfc000e2d4108de34f0568de74676ee0b4f937033dd813015f7af60964fcec4e5bc0adb1ab5fe9c7c3c8f0fd0c283585a55fd16364575f3a89059849951ab8796e0153c61c8751915703fd2b8855d079ee3d892f0f06cac70da023ec975d036b583301c561720f146a71af045cb15c37c41d79a99fd510e3da0c60003199ac01a59ae04bc0fb1b3e004648927134394d5de7cd2c842363017792dc1b78bd2bffe2cc7e7a36303ed635c497fe1b0199ae3834d0edc9013d235f750032bbb52472f5dd94e5c8cf06563225802630afa3e0e675f78a1bf08d81ce043febcc3e5b00f5df0aeee3570a6576ebf11a50663f1c1ba8fb29a0bc5d7604dc3c777f0c6cb8bc02349c5e5d021a1c5e3f3444be4cb78052edc78381fec719c05c5252dd1bd8e917d5b4e8a9566ec4234ffda44e6d381d03cab9c74d43fccbf717a009ff2ee951b7dac47609f4d5715e1858a4b70f0cc8eccea18125459f0296045cf78152634a8f809659b43303d3e8c706a6057360caf2ec9bc410e1681f0133162f9471272c9a3edbea8a9301507f56f01efdd3becb0729d6ec098870fc760c118ebd9980e2b0b103a8383cbe02da95166fba5a0175ff16d0dda35a025a9ad08dc6b15f37b0bc89f50850cebdf60d0c446c09b87bc456d91a58ed92c4ab0457c0fab15d40cfea03fdcb40b91f79dbaf9fb4236f1f464087a9d6e32fa0feace0333a3503df6f974700699a4c760d9c12a02b3487b37620a0126ee95f94a6ef6d8031e9c4bfa22a36d51595aad88521527d320318fc4b2671d31ae8a139a94e00b5b8dfd1180c94a6adf2c9c0bde15da03bf2a721f225e65f6ae8930dd7d7029eb4ba77c0807b76ae2f1d53e7da3d03c383436046beb449c23ae7b8ab178096f2cc5e802e2deef536903298714902d52d2ec3a58740c1134eb56de060b42da04f153b3907ea4f14dc0858e92af67863e034ad1780e290cc4f04dc6f1f0e01cd363d9640a9bef68e2152fded01d0d27bee510d44f9982e00ad93ae4680f6e13c45292c7b0c6624935f406df24b02d05a2695fe4559791ac5a1ac9334cad88cf4c8349d1f6777d4a0f241912a33ed5e483b065ebb7b010cb8e2fccec0dbd4886d56d1c05e64c0440b522f05dca22fbf81a9464862a8a25463d06aef031d96249647061a25f2b6e9f5c7bfbc0219539c930fa0c8e93a9d03034ad029f9d27c56308d6a3a7673f1d5136889f71ba0e9c9f53fe05796801a83ea1c98aa315837b02137726edc538aedc5fd76ec8529a36fa04bf379b306e82160f30c5046c53e9c15b055e5de1039f742389a59f168b54f0cac3dff36c4cfae09aa94f77a7d005a9674db1768a8334ad0b8ce399eb3b781ae327bcb40e7dbc003de3549986b29e0e503d0a74139e900f56705f7d17c56ceca590f18a8ee1702b2f2770c68be72f301d054dac635a0967fb20d688bc8e40e607b58b24c0ce4fe1cd0597b37fc8b1f78d705ca979f8581e3a30f0d9151bdccc076a84d60ccbff467065eb87e6060a5ecab8151eb5ba0e2572ede0c5191f32b03ab082a60c68059375a98aaaed934172dc0b94f48f3949a7dbd23206fdbe44bae756cd7bb02ae481f819c05219d5f03071a7681820180eb3540b7936bfd8b5a87dbd4c05312395797315a9857034bcec8ece613ed7ab4631397c2971b6020980934b8f30c946a5032033b969f004df9ee7c019a385cb60195c24994a049733e50fcec05a07afbba0bccd8e2fe19919b7874746d0d50917a3e35b00b6b6e60575acfc0905a6260979ebec37b8a8e0dec069b18e839fe1a7817380954df7018504d05f4d7e39de435b0c42ab98fc1d0495d0a7949f93d9032cc70dd13e8fef202f4d80270fd24a095ba4c0cbcf7ed0ce8530adb434314989311507fa2bb11756eea46e9f90dd07b577ebb00b99f2c7b06ce429a029a585ecf0df4603b805ba94360a6566acb104326cb48f5ba5507266d03b5e10650efe2f905e06cca24390118f84fe65160a61a946d5dec011aeb9bf3b3d9803be107b175f928be0cdc1adb86286383c21005a6776ea0fba52b3423717663603dee8f8143443f0c91b7bd129802d7d1659936532191fba78072bf3312e4dc3d8640c923cf353f5bb730acc71d002a30279b40fd89b844bb3e7381f9fc3044b1fc9a0363e07bdfc029899f069e817240456a7b024c54a41e0dc4a507b80d8a51fc66b313ad6514ba9953fde9c9c0bec60d03d3e82f06f69b0e81a972bf32d03adc1b38b43b5a87595d91a3af3dff01a6a4e9f108a83f512b5777a0a2ed347dfb034e037e0748d32456dbae8034fd002a9d9a7068a0d52e00763f25b36f60a624dc0c501226cb7ba04b9a9ef602b28aeed7cd3aa0048aa9a315303aba66e0e65919a2147e9d0033fee5fccdc026f87f01799bc25f740d1cd9fe03745206dd087adde2128e5fa0d0526242da8c3c04ac1b98145e025ae778b9059454b1ee15306668af730e54f4f96f3360ca3dfbe422a0f9448aad1a94a2e3cc8e61fda2e3cc9edd009560dbc0d8f8bb21f276b10168abdbdaa1811ddc1360ca2a93c7c2c02b0e7203dbb11f02b4e93b99a440478d7407d03ecfd91cc874442871f1b4cfef1550912fef0340c5e1b530d0383e1be23b1e22d53bcdfa8e68e8d70d2cd2fb027416d2e51a30509f4ee0bcfd01b482a84dbe34ddcd683ee70676603e0113c61d66bbc08ce6735806349f087a04acebd6f2f90370663f19381ef8d310bff27000286fe350e61aa66a3e0b036306fa172da2d8d835446310fbc59af7699395932ee0bc05b292c66074074c7856ff3a0b70bebc560636a1cd810ed05f37b0c77b60e0cc8c2f4364547a6aa031e8035a5e99b50c11b0fd3740c7f4b4f41d85ba5fa458dd18d0dbba0058e3dcbafc05b496b63b012afa7429e9d1bc703e9acf19507f56103bda8b5499dd7abb31f0cec71f60027c2d0c6c62ad0065f6e2dec0cb5ce680327b3d9a8bb4a7177ecc86001376c9b46b603be5a581d53f078086901e75c580637aaab88ba5598f9cdb89929c3ab3972f06327bcbc073f626a0e662d80634467f496c73ad94ed1c19d846a0ef98b2b8a54baad7b532827e4b6c9baa1c702b20e74ef8d2e613018b8adc73ce3d760c9c6c7c084c546fc786f88eaf0c50cec5d9e92b886afaf00ecc742a4fb4b83d9fbbb1b907b09a2199ee035d65e51260ee3599de013d65e50f90d3b51e476c7b75cd66e51f017336c4f2861544def627066ae5a6817df33b8648f5b57540eb3e774e0d64c335906b7087e8e75a33713b00a67a9adf30f034af2b663c9a77a261eb296f937102a4392b768f0434d2976d03cfc8c7408f8a7c72686005401487ccb93fdb01a6ea7e6d19e25fbe0f809972ffce40357d0c50bd6d6d5f035acbb2b507b01023992d004d0d4cef0d91fb5302e6b982c704d0795bcb16a0079a8ba8b759c6deb72466138acce33071da5ad1cce9f09a7b7e25d72ac633425ae72def267d07facc8b7596c058e37444bfee4d31da931b989de55fea8a1c70bd0e741943e9ee09c8dbee1990e6cc9d7c09a8fb173706ce73bc047a340627e45cf389248c062577ab3d3906a66a0c2a03c5611370ee47d0f3e614e668d7ff80c30952408766febe19a23178280117871fc0c5610f50076d7907145a691f2539af1f34e95b6e03cacaf99d81359b8f066ec02f067a062320d390496260c7e1b181e3a4f60574372e4a431487bd3520efb14c7cdf10d17f7c07fac044011b305e78a59fad782ae81c003356cb5d3f1898f0271ccdd347042c37d0d93c073a3c267473034f2727062652c7401768ef18582aba0ba4f43eafcf0c8c7d9e1838e26f00f4721695f4808c66ebb405d49f15c41691a250c16d3d5606864c7e0deccffe0438802b995d1b28da912f854bf2cf07a00363361f01774872a0a7bbd82ec03c72b2bc0598144e9684a36eb6d8e8182d6ea10576ad98c22a0a95c2d6536ee010f30d03e75bae0b18c82ccf011d3598cd0d513e3e06409fbbd80bd1cf4bad0fda01263c6876e2a1a870ee77c640ca6ce4e58f81dc1f1a3870aa6560cc91ac6c6e9f513efe0968c7ae3b808ac395ae5071383906eabf48b1b857f65d1c9e8e010ead4ae65f06faa7d148f79bf3e6a331b833d0d23d021d607665885bd2c39b81919a1f402fe99a6d1898f7280015a9d919a0a6ef610c68e1c13435b0c8661f605634492281fa9ed5388f2e7edfc5a1ca0d511cb20343fc4b496ceb7acae42321cdb52e78780a0c623023b927faf99839f1aa03544ca35f11f4ba41216f09bacb47e701e8a9049d001905e6b265a0a5bb15706becec1898f7d802f280e13be95117214e2bf8165082967b40fd891626823e70098a03da56408189341db8b978e50ae7fe43d71077c2c510d0c1466b47065a980c70eef700a6af93785b780dcc8b25e3e8f50db28ac62016a317036765b26de01d212f02ee627136430d7df5a574855aa9bb789c1d146d2d035e021dd607753e812e99ddf900728618dba5809c6b2740015c8f0c3cf07e1b28419b067ad2bb06e65f888bb3f2f818a83f91519162a58fb49b4756364b130218972add3abc1f1ae2573ed6005a87d6ef27a0cc7ed80352eafeefc4403fe8125071d89e0219f797d903a08d06b33bc0c5e10a28995cda8b44f61a81d6f72f40deb63e7301b9ff750c0c80f4dac04ed02e30652fcfd91c98d14349895c5d4de9385f00cacaced0c0468316d057bdcd0cfda8b704bdce396e059581574ef50cece49a01f56705cf912f63e7edecd4105ffa760b74b837cc4f0d9c2df705e8c8b2cf3fe065501f866850be0f01e5fef7ad81ba7f0df474bafa0220f75b9b05a0dc9f3f036e1d22b6e3e6188d0818ffe2ac8c25672b60ceb30f947a5d03416f961e448392015a7b1e2ff9ab61c6cec7f186819c03ea06967369bb023de1f4803e55bd9b19e8b012f43a2b39fbb863a0bb9103a5aa7acfc0a2b48121fee5eac3c02439d9d05014984b039b9ce339bbea75b46775626084243770c6cc3dc07b0113faa7559db734062f40a67783750c2c24ff06b44671630fd0015cb325c0f29764766fa0b37903e8889d78b1770d3a89220e562c2ae7fec3cc10b5f2fb1f30d6f286c4c0e90d070626fd22b3ab3af77999ed3ed057af8f146bee0e912f2780b2f2f2cbc036c61e3006aebe0dd4fd8e816302ef0c8cd28e0dac93261b9adf09e81a78c3e5ad21e21287331613e57eebdfaf211279de07d43abc1f19681d4a2027b37f7b80ce735cff3090d9eb0033cdc96c0494caec3d8089c3649603537a06cb1d03ddd148e4667b7aa4d857dc7026f5e32b876666804e25feba15f0e4f9b206a87cbcfd1ad8ff7264e0c93333f08ea167a0d2a14407c08c26e72a5aed49d3e1882f4d819212747d68604bc48f8185a09706960355808bd4295051822e0606c6d7df0d3cae902f0d45fb3136b08a31526cea02b3e81838df3207ba5c116fcb5a014740b60d3c6a14404a67f363dd10793b3f0668725a5ffa179a9cd6cf2790ab77f10bb0da25595e032a30cb5d80836b92927fc9531e236f097a9db7f4830e01e5ed6766e0dd3e1bc004b8253d0a56cab62e47409e736ae43f0353476f4049f9b83a02c6059b04d60ccc8aee0115ed47e7129814ecb2c90d2cd5e81b180b6e1b783ab902a6c0c999213adf84c3c79d2671be43d19c6e1a49f8f96de045c50b20e766c1dcfcccedc7a6beb4d00eee7d6040cf8039ad06683ff42f6a3f6605a0b54e67d15ccc9c2f5f47063608dd0253a0dd31303b7b2288999124e9023a90ec311ae95991652c4d3803723d241e00633a1397ba624a365c7e18981a20e8cd27eed9ab82db6ffb00d0876d20d32d7a69e08d3939a0547f6803a4696bf3092895a61702eec8f3174035eaa102b4dce3a608a8d39431831d4069fade37449a3eae19a27c3c65c08cf6f4b36b88aa7ef61350a43a1ce90ce869ef3d71a9b38169f46760acd984d780e6b382e9aa03dfff3b54f5f508e8a9d9aa0c11b0b78e81136337804cadd41250aa2fee0015edef23430c54cddf011d8ef43b3550f8770dac834d0072aeb5de17a82f750eb0482f898e510dac0048e2dd82fd4e9d73bc07ef18d099b28b0c50bedccd0c9caa310e28dac0e527907156c538052ab2614812369f153caefa0efdae537df16ce0d513c780cae97c0fa828968bc8fdae97349ff1a5aea6e5c0c001e406868f6304bedf755c5e7303e5f411e800d7f706cefd3a07baccf16da680467b4ee701cd67059328c9a963fb7a0c642a741303bb49bb808e08fdfc0178536febab0fe8a598b125a2069d0a186fc85d01af4899011525e861c3c041712d80b7652533fdca548bc1a2ee372f40657f8360467a7c1b18c53f1805384de79706b676bd1988dc39d065bea1b56160bee110c899d11c11f4e613cde7ea1ed5ef39d5a35daf41a9fed236b03dec1850aaefdd019c199acc334015f9e70b50aacf8f8031a9bed90794c80fb706127900a8173c57c03863267988f2d1cb98f04f1ea640572b327781946e4f8b9fad6f6b6c2388c2df539ab6e2bdb32b8854ff9c01297073688854ff3a30b00591f428585c9bdc1d1b589e7d6f60877f0f2832e2a2ef1833437342c09a4fb41f7145e69c8bb5b42b6030f404d019bb6f5303a7126f02ae400f002793268f7f1091fbd5cf525f5aeb9f80aac7fc1598e9e97511905524f24514feacd02e8a4f02e644fe9c1898e1bd3490c8fa0e9de619933a35b056b2f5fd69e0acf017036786de0139f5763d15d06c5d3d02fd8c294efdec94bee5304ad0ea08cc48f5c8cadca9fe6fcd10a9fe960205f07e62e0d0ee7b4067317efe1a88dc3130a653b375004c54a376802977c2f91ba00a34ff1790b5591c77fa1190ebb0fd8768a473a7e9f4dbc06324016b26f4a3ee9740ce6cc2781ba8729e5ef9d9fa319163df23f757db275710af766e261348c2a713406741bffe0125790b508abddc033a9bf26b00943c9a2f16804e28fb9d013a396ef319701246252c9c62a368d88a423b423ef915a747bca46b059ceff063887f899da0cda406579caf015a5d1ae78ff59b499c2863271b40fd89ba1f41ef3b81e806f69d406f3d402f807d3f3550c6d6009d4afcf508e828ca873ea014fbf90638c22d797c3190840340074dae9d003375d06e0274024432ef00dabf7f1a79db77efe26d246046f393c83909abccc0e3db3fa0d024d78f40b7822d031d6722d7fcc52d3a6ad4c0691a27b4f79b3365231c711adf0a78b5c0ba8137e66c032a961f27808e91fc7a324409fa6e013a35f25bffa2b3f6b60e019da4b7ad8029d5b76f80991e68ae029a575c44aaf31d4af5647e00741944584463d0cc367136c33ba0358a7bd13f1d28915b7148d30a580d75226080284e03aea1afb75544ad1c349f48e480d289bc3c354422bffe01457b0828913fd78112d86a19684f134087ff7eeb4b95c83f3f006fc84de25d47354c29fc8b350385ffc510d9f09b033a8a7263dfc0fe97e83a957ff9d2033a540f9e804be7cbc32b402fa75546f5289da631b1dc00a97e4f7a140360ff0828392c6a3837f040530163fa30b378062aebdac126e74fa0fec4cfc67d6eec8c7ae918c8db1c1870c5f39781fab263202b370065e5d7b381ac1c02caca8d03a052fff4d71079bbbd00f4f6e38d1640deb67ee7065ee5130ddb5827d9b4767a80326a4ef4eb7c6168af6b60796574bfc65ebb318d818871d1d1b00b2956e71c335684c339f7991ad881f92c6048ed35034a1d78f908282b1312b960e1633289d18d71fdc8cbe62ff2a5f944ce45d7a972cec529012ba0129e1968e97601e5dc77098c7582ee9181cea67e4539b7fe034cc8b9dfbe819bf80298026b4381b2b20066caca6f43d4cadd281f559db7dcb44e0ddcb4ae811e59f9b065880e7c193dd8aa59b2bcfa8e837f00d9d0babb31c4af7cf2a575be3066f069e0dd82f19454359f6882233d264ef5590994c0dbcc40aa8f8131f07b6f886cd8be0394eabb6b805bba488f89cfdc59fc026cfa4e167340857f310594400f9b40c6fe6cfa9693faa18857d5f22f7502f15695474009f4f460603fe19b8137e4921e45c5770c4f0cbcc89a2bea34655ddf35507f22d5a38a4d9da6cfdf06daa0174069babb0e4cb41c289a8ba952acb5f30338c56640a604fa07e42c8ddc8b9bc5d471b99b1a78c3f6a52192f0e70e9870c5eb2330d591a9fc4af389563b9a8b9963fb746a88c83dde03bc4fbcb51c1a38a2eb0f38d67b03d099e59b87804ee0debe0566ea4a463fe8ef3cd8584a5c438f7ee1ded24019fb0254a46604dd0d6c45380aade75f6c011352ec977fa91388ed9491fbb3ba2d64d1e2ea67076d473f8ea15d01bd8b070367fd6e0095ae383250e7ee8109f05e19385aef3940a779268f2dc0d1ff01323a029b37018a4bebedc7c0f4d304d0fa8fd3bb80e613ed7a84a3e3c83dfc028acbc6d240d01340ef24df6e1b387695efa8e3426dc800f236599c00c425597c03390bfce7170175d039a07eddc023cf7640bfcdb6ac61dfc0f17c1d408b9fce4601cd276ac3eaae3ee83ab6cb3343c4f62d03266a4f97066646a27c74f3b1069837010d880c8f031cd2f9c2c0f8fa21d0d13dfb014839196c9c039a463fde0a683e5170e35f52c7e561cdc00b4fbf0095c2f5234087ddeef02f753bc68b58724059b9710b642a96c7409fa3b1164786b88b3d47d14e9b3588512cdf8019937e07512c5345bff5b930b06d6f0a74d5b0bd04349f28c9118e9e23f73b0074b6fe7607d079e33b8581821b65aca763ac93786f640d9cfa962c3e039a5387032640c6f8fabf8f00452e4922a37a755cd81ff506282eb33d03bde00a4881e1872112b9ea029a683f8e8c5abddb7905b1507890393d6237470dbc61bb15bb0656c043d119a013da77fa06f6e1c4cf36c737b22c6913d0d18bbfd116660e7aac955c01b94f38fa1e1d3d12c40af7e17b0a64ac923f8ed661f55a95885c2450eeb844a77705749d3600c565bb67602c270a4cfe97d95da0643dee63b441795d70b9e1f0b37d8d4c7cdc01c4a515af215e015b210f0c1c6af604642cd5182e0cbc45e417c889fe5e228879d3e4fe3ca06ed959deb00dd49f887ee44be1e87ffe01d371d15c143ec37d872b74946db288142b0a9da6156f84ad1fe67512f82b5738e8b1b2ab863c63c7d0a981771eec19181188a2bd5af819491805b7efa0c7e6c041bf79a367446ecb40b13c33909551d59b33dd18b5be0558ba9224fc4b5f67bb7cf22b0a7aeb636160248f80f50be0fe02e8b300e22e03062ac95f8688dcf63930e5297accafd41fee623d0307c347c0068e7eecc05c0137e014e800ff760d91c85b17c094f458c40d67e066eb296e6b0347eee5c0c0211a37409f5b52bcf2a1019e2b5b27c08069b093c8ecd55f646554f5d2418f178dd6a0a0ffac19986bdc0774fceb1eff92a7ccadbd454fa9ec17ac33f8980384b415afab6c8090269f8668b6e2adb2350c748c5394b1b2f9ac205ec630183ba4cb918153457505c77ab7be5e0d8c3b4c01c565fb09e094a2e48e2b8aae0677221ce33a606c225902257016756edc7ce2361f0d5bf517d24b030377db006f606fcd1f0dcc688e0085f4f70bd0cbb0e99f56f57d8e37b146b1ac1cb05811b1025e423d01c63a5a2f0374bcc546dc1b260ed86469e0a4c50b8093d15b6fb981b29e0808fae716d0d39cd6af21427ac0cf2a60ad8f998137d26f1b38b2ec07a8588f7b7762e0bda2511c26832e8df4711ba83f910d51b3a78e5c55028a5c1c14b7023a68038003da9269346c53b5c9496c22a94107b53c9c0284b4f5b134b0f46d139800cf530347a81c031c4e90dc47259cd6918b1bcef135507fa29c46eb30735c76360cbc5f7d0e285f365f814c23ac91403307ec6168888ec0d31a3025a4ad28ebb3ba77c950e70e507f22d557ad65d976c0e2ece315f0ca876d40e705c7ab2756c0b28225a0c3a13ff60cd4864720d758f04340dd1360589f2b728d18cdcf03eab8449afe3b036601496b3760d0d6f9303b01cd279acf5546951d073d7650ad80a077814c8723fd0a88cbc621a0a07f57808ef7dcdd0ad066c9d64b2ba019538c9ec10e3065d2ef6017202ead9d6703b33c65401db978b2b8cb01b6da27f7fb40c6bacf5362db7c22a35665acec3ab6d521a0d8def7053a9f3f0572e07568e0949111d027fa6b7fc07befb380bce098af68e96a983233725f042872ad38706a05acd97c36307a7e0274b862fa6ee0089573014df0492472b7f944598f8c4a1dfd494b406ce7ba42d17fe91a1871de35f0eabc5f40c5e125c2910edacc15bc1c021de2f2d403ba8275802d6649b96fe0d4fb6f20d3cee9b780e613918b02d3735ce2d0aab2f71797b981f3a51e00bd5f7deb1850de6e2480cea6fc59074ac6a57e225f7a799b8d5b6bfc8a77a37fde0538b671b6cb0a78e9e1b621eed99ffcec803d9ac95d01b0ffb6751205b7d77ce24ba338648eed7c13d0b1bc14ba0638c7f906e813fdaf7f40a981998b0085a3f59a1a786a7c067a01c318caaa61c6f4f55de47eee80c51bfb6a50c0e61b8608d87d0f50c0de0a40c7484eb962a01da9f76b4006ecf50dd1380e5f029a4f8463d5eb2bff4e028f33325710e1887b7659f8b4e897852102769f017aafe84fa458e170c4cbe357c07bbdde815cadf65140f38970ac6ed165dfe198bd020a47bc74b9ecfbb8e4fbdc10e1783d0374126735334412fedb027406e2dbc2c092c416a06dd07bfc6ca18780cdc8ecbee312af575b015d9675a0a0ab70a72bb47d70182dcc6a2a31523d0affc0b17dfe3170f8cd0ba02364b74a4027e9adaf013a7af1731b9802dfe706ce1089f468f64646f4f723e80305bd95bc18683ef9d2e6413262bb0168efdb3601abef5264f626507fa22447a12bffcad81ff0e2c43540b19daf1bc8fd0740fb09e3c5ef6539d0c6adb76f40f384fb870696addd026541137c064c584a3c8cbabffa8b80ad1e02cab1c3112f712bc73e0f76ad63605fc129a09338e31c8172ec80c5eb6e57c0ced857a0044e23a4e3e613e1883bd0df31b42fa98133779680ce627c1d013ac06f3d5afeaa502ff829f2b6aa4b1def16fc00148e7815e90a78a0a900566327f1c2e41510fd1760c2c0ccc95540f389c21f756ee2b8c490c90a18d93c00b405607dc7c0345834e393fa96c418db3ed0610cf66b0dc819b7242b274dd98ef23102b4b2fcf9c4c0ea5202563ff3b105716ce018b828c993ba5cb2ef750b18976cde206075f4d9a2da01ea4f443f9acfa9d363dc0314fdf2dbc0b9e72f804ee27c3d3744c0b61f009d2cb8194df0b4dfa5d57e8f249c2a72c3f7ae81ede93b0626eb5bc084cd2cf77fc0bb8e0858dd8b618ced1dc8e9c30c5f81fa13918ba66fe6c8c5428c1a742eedc7c8c04e9d7b4091fb172579e633107f9f8094a329e239aa9c29e8c3f73f60d47a6988f2f1fe064ce38ae13b5734f5218af633507f222eabda306e3be89f2706cefe3900b4f162e328c0273f7df7028a94952a8b7640bfe0896f9605346f078f62790a6803d97c044c81a40266c0681ed07c561007a38d3b0e7ab56fa0fbf50ce8ccd0f78e81fbed4e804fb0db3a0174ced5fb39a0b36e3e2e000eae4966b38041a10d5384c3417fff3450b4270165bb60e6ac67e0b12912b9d37c221b56356adc9cc6c77b35ba0622370374b0e27d24e1dff17cf777800e687b13a464e54609f418bb88299b71b72e633c03457a7415f42169da000b41a74007186d07349f682e222ea9835ef601ade77f6f013a35f22ed234755cdef81785b4b5f612a09f1dc6f2ca15b020e4da40c7b90b74b9a2f5078c0745c14d9b4f347dabc78471cf21adf60cf4d896014ae424162d8e7b2a1fadf528b83dfd6c6bb66360ddd60690163c6afc1a0858a47aaff9ac200eed1e670ec7dd0fa037c2c6db8f57c0be93a8a659aeb5b49377038ff75182b2fe8447c045340659fdd4c89c6754b1ac0e7adcd60ece81547b01db06bee3d9c063c22fd0e38abb5303b3096f40cec8d52e21ad6f49a418d1af9328ae3826facd27a2bfea7f8c7347ff3b322a77f4bfbe001d6878bf007482dddb3da0f38326e38092599e2456338c73c5b6f5c1cf2a72adad1703eb937545a6f4b804fa0cccbc6f0a1833383e0c683e51a3a29c168e5cbc2dbc6e5df556b7cd03a0a3d66102e8dcaff575a064d7e26f54d3e66c1b86c3a2ce150e69726ee039ea0bc8b58b33dad3d5a900515fa202f51db078c3f60a222eb16fad06ad3e5ebb3270f33c06747ee18720d581867b80ce30fbd900d8399d2c3e02dc6ac72989cd987d047df8be6d6010b20098c4481e7a823eabf63e819205cbc771b3582ddb8bcc8e2235706ce32dee3528b68b5b4071b99f033a72e8eb0da89818da8dd672d0af38bd21b6cb35bd73821ecf0d2be029690be8335fb96809884b0cddd4a0b83ceb4bc7dacaf402547d5ea0f40c4c58ba7212957035f111b91f65ac746ce76b068efbb801b496f6fd0ad0114cf75340a7ae4437705cd6bd0d4e487d0a18a4c4655101131afa1863ab7bbc447f181b401ae0c16a7d080c80e328b8ab479cb85746391dffc5e509d04bece3748f1544e462c3430d3a368076bd81f8d2fb19a0c8ad25c0a4c7f6d248d33aba7d76c7ad017d20def65b83829eac1b5853f30c94c049b4a7abbf156caf4615c6d55f5c7e0c1197b50a50395dbb041497b70150b121776b0ce8dd3e6fff02ea9e6364d45d14a9aace5c56ca5e03459f774e97409f6d8c0717007119bedf1a78f2fc06c6406cc61f57cd2722170934c9592bd95a5606164ee700914b6226603cd1970ee9e44d543d92bb570387888e808a0a7412b7c649f389ea111d81a9c311ef7f59013b207e0196bdb67ef42fbcc8a975b70be86092d7a840d3a2cbd68ccf28dad3ba5d67ad64b474d366d544a429ffe2902663038be21706b6854f80095750d51b60615b94d369f389d846259c39b6d329c07abad6f8d710b1a56730cb595fd85adc007d1ac7cf7d40e7f6bcbc004a8f789dc7b8d948cf4aa648c259d161c7d076548f59d33a468312995d3f47f14cf8b60710db611c46b8026e6b77c014388e9bc5acf944e456e951b51db9788b590d5a3db8fe0711dbf52d6040a7f7f79f80d8c6cee9ca7bde5bdf8f017d3d7bec5f053860c9938176ec0c98f5d9883232705bdb08683e119755f5a83a0efad7af8115bb5b400e2cfe0105fd8fbb35400790bf5f0468776d32fb0ca86b1487574c814a53582540d087b17776053c6915860869c2cf8e3533f2fc047419cadab905c6dcc48f3f02aa3625f96407a83f2b88554855d7e911c7beaf8021c639a0f4981e1928da27801268a17f29f5c833067442c8da05a0732636df02bc41f9e300d0ab6bbef9176fc9dc680734739a51c6d6039c40f3998195906f069e2b77810e895c12d29a18723d17540ca9456c5327d0cb33a0773d9373e95f8a1d028516a4fe007d9dd6780e28c53e8e009d23f07e19e03ddeeb1b80b6b96e8c0dac644a039a29ee68e9f602941eadf52540f487ef3786087abc43b7795718b03702520add716454da7ce25f5677d3aaf717fd6343043dce93ae41e9316b1b78f63807067ade9f007a25ea5314879e37c16f9d02da8e5d2e0214f4e1fb9381d5e9bf400aaced00150f01c7c380ba38b0c22c01521a9463bea3f944f457cf1e55e6e84f1280b7ffb4aa2d03cb1a0f0096bdb6e2a0961ac60cddc4d2ea2aab83cefe971450d093d21057bc8e811e701f799b359f0858548ffcaf581680de4b1caf66adf2a2ad46fadac054c926a0edd8bfcf403f63ec33daa0dce18837c1af200a6e39073260af054ce9c11e77039a4f7c4714fec2218de3e76b18a87711595978bbfed727a090c696ff1a4a363c24512c0b8563188fb32be088ae43030b86f895ba1b1ce5f46b024cd404479d5b1d2f16418f2fed3be8b38981f5a725a037064fa606cac78381ba7f0694ff97bdebda6e2357821f33ef7594453e3247052a4b6f139973e6d7df2ea0070a96e37a57debddac5f1a1cbc3e10c80424734144852203df0b474ad40ac4b70dfced3cc697a8261d92e8e19f72ef3ba03748ff78502a7e9ebebafc840d94e2ed871c9b8e5f3425f8effdb77b1f7c83ebf5ce4004d7bad29e0a775bec70eb0374d6205d297b367d60b10eaf269771d09a0398ae8d8899b3d4d8f46ebebcfcadb699ea3a57a367db996ade966007541a7576414b066b50089af9baded4ccef27ffb2b9684be7bdb71d1013ad8e915e9dbaaeee09fa4673ddb627306d01c01bb38728fa606fd2c6ffd4ca8ef52b65a8eefa70987752b3d7cf7e8366595805ac093b5025905cead3435d125fba4760d0a9e9f345120523da86bbf128888b65fe9da1e0b329186381bf63982f4575a8b0707687542fd15b101355fdbae74c608b292d08e7ee89ec396c41420ed315b365180f4e4d1f6c602a79a698f6d5981f4dc9542a840ba5972d95420dd1e36b313377409439e5dd74379520d608e150814b8b08f6efeb39d6c2550244faa5ace8d03ec15a58e02612af85a0aa4271896ecc845a7272af74b7a85dbc3bb891448d23d01766ca34c7ab0f7c85340e31e189715488f785cd8991c65d58ec2d6322a62ccd7feac1dca2848f383726305d2d7f72f1da0c6d9408130abb241df36883417ffdceab811ffb742cb0a8bd8f55867ea00fba4f67c3101c2b40bbb0ed0a5afaf40942e17f6e5621e18656f9a2870a4ab43ce5720d64d2435fb72b1bcad1e6d5450c0d797ab060ae8cb21b8778056a1b97280b50a6c728b01d49a1f2910e95792b903d46374ab40ac0ed573bb48c7fcdf8ead159e89eb0f5b245280f4f55776814dd2bd809ecdd80d137917dd80aa57a4cf01eb3d3780faa4730ac40ad85d8b61222bbffdd9d9428113353576770a6454513c4faf90ffed609bb18df678e6a71d978903eca317b70ed08cee8d054e35391fa5b602e9019fddb202696ae44e7fc56d855cde594016652d2874610199b86a79ee148835f21e8e14481418de58401463d5600b0a042af86c6831da77ef52ea39c0becb225220d62bece98306b05724fa1599b89acb72ad40fab6f6dc15010ed5b0b287b819407773d42d20545746cd2d903dd5a806b216702f17dc39c0ce53af6581704f81c2d601d6d2eaed2990a8e539b21d74e05ece16ce8b0edca3b7b30aa44f1aeb574eb36969ac4481744f62e15c01ddd88755d502b2d2e9863afbfa3229b36a67db3e3d489f14f38602fbfae841df017a90b53e984875ad90aa3715d1a81da4cf2133594d62a3194487cf4379ad40a2b2d296f58e0e65c9d19b2e2ce036f76c8b0ed0a4673b930fe9b6b7b3f0d002e9a3b7160507a8c973afc0415613b8770a1c6996eba8a4c0a9dab7b52b05b2a17a8ce60a446a14cd2d818edcb49c9d299028d0b5cf71741ae9f6e382ed7531ac6cd4cb4beca31fa50f060f0ed01a00070a1c5ac0b3b52a0c60276ec1c897e8f834d0c4d86e600159a554d7b6f7384eef8160e4007b8f5c0a1c2950bb53e04427ee38ab40a083bdcd2890a89297180b2712a3485f3f3ab180bba94d803080fa716f153856a07ce9003bfaf6e080e8347d3974ed409d66f675ae974205d2cd5ff1ca02eea6ded601ea66182a70a240ed5e8153b56f9733051255596c991ed114f65497b27b1304d84f756d7b8f4c662fdd17ad5f11ed42e7baedb18c9f1aabf620496a1bfa1cdea503b40b8f15385560d57380a69a3f2910a9f23dd59bcaa2a371b11b058e75a08a460f92c9116a9fb653c09d7960399795f543dd83790b04beba3bd6f657b2eec1fcc4017accfd430a689f467ad330a357ac91029a69bfbb7280e6491f29e05bc0ebd51488351f666287d297e553f34f6f15486bee14ec40f9b27e68e981a502e9f1f2392b2c7c91d9562109060aa44fea5fa4803ea93dff36629e8e05fa46538a02f71ce38202870ad883bd0508d52f65cfe53180aeeb7606b97d495e6c17d820fd59d10815487f7674e800cdb61d2aa03d86f5ad0241aa9f161ca0eaa8e58bac169156bdb7540fddbbd8038205d077f16ccc3312b3409fa3345220ab066f6ea840fa1cf6bc35036852c98d02e983156307d807dbd839261a7ca4559a970a6423cdfeb1938e1abdfa4f170aa4fba3b62505d294c4cd9d02916e9a6858452072cf610f5f3480e6290d1448a309b54705e2500f84e92b906842eac42ed25174126908cb1299aab5f6c78d02ba9d01b6dc471467d2cab523fba47170982651542c20f256f7596414481fcc9e436300cd63db2a1029901f3840eb5dd8918ba54f55ffb0622d394d2b928756954c82e374ae6715384d7f65ae40605fdfebd83e4da40bed15552f05f4d1edd9b502a4cf610f6013204e1fccae748928a4da1fa64fe3bdd3f4eca74d6c814ca2151f27530bc82aa545ef1e14886d26a4d71d5b403a4873e0f715d09f6dd9f36f0da025db870a240a2c0716700f66cf3b89f7dd83d9d87cbc2f43a9958d4f2d90dea365ddd806d03a68e716909b6a08aba540a0737d6844527c202fa70f669fe3c07d257806ec57ec31c402eca74faaf790e15627a4591de243b743663eb780c87d3dbde3588158cd955dce02eea6c1b503d4b1bba7c081afea57d301ea50b5c370749a1eb1d439b14078a4d93fa39e05d27bc01e306e00f5c31c287098e6c1e61538d2b4d7fc9302c70ad42629a066b53dd84a8cdb6355261a76061da73785d5a50ca06e97810247be263f3d2a90feca26afc089caa8f15081245265e2d20232a9d4e0ad2820ffdb97332b5d7c9209550bb6a5e408a8d0b2c711b294bc263d0fb70a1c2b50ca2a70a22956abbe02994043e06d057c55696db9e4f8344c73262a0ab89bb65b0eb00fd67d50e0c4577563a180fe0a8ae70af86a9aafece89f8adeacef62d990c9a4b57edb96d919f7e8f3b502a7aa3877821408b400795981aca69b169f1ca07bce360ed09d3a9e0241a0dc1f2810aa57216fe75886636780f2b50227b11a9a9640dcd2ad01ff950269bd1c5b7921ce5275b637bd5440df05f19e035453ca2b90f135dbc5722e1b1fe88419db3ef5d32b105ca580bebe7fa640da1fb32707e861c74d07d8fea84c14f0034dbddf2a10683665fe428138b2f3b46a970b5f7a443365edeb07d90315af39dba7817b0e5bf3cf00ba33e54c015f013f768096f9ba4a01d550765b05d2e7a8d9970b64bdb4f3b478a0405619658f9c8ac34c909a0976e4c2f04065830d0c5132ea73d8d3900ca03bda2f140814580e1588d5dd51d3afc8cfaa7562df25ca1ee902db8e2ce0fa7474a040a840616701115b1ab2b97380d610992b2072cdf6585d8130b6f728d95f89b3d97497cd9d02b126b5da03fae2d8fd6cd7778066fca740a480b771806663ef29a05e386f60055f1ca7cef2d8525dd4220df8d7331670378d970ed02cd79d02b1025e4f814445d2dc4e98244ea32bdb63058e55bb18151590f1b7bd6e045fc25dbe766ceb390bb85f89f61da0c9b5e9158902b3d801ba6a2b20aa806e89385520a3b3b0f76001fe6f5fce8c4bb29f3dd1e9505c2a10e88698646301d17275165e2890feecb89202912a027d0bc8fc507bffc901eab66d28b01fa88724e3007553ee2b70a0337977ad40ea10294f1410f65bbe6415486235de6d271fb8e7b0a7ec1a40fdc9270ae87320ec3bc06a8e76f7820047fa60a59d02c7ea8828b71ca00bec5681d35097f1860354ff3855208ab4d262c1023254f61ed56c0aa403655fff5008a402f8568140f758857716a0b7cf12c8b340fa2e183452407f763355e040af085a0eb07c997514385460e42b7014e9191003058e0355697d07a81bea52819348fd4123054e438d36dd3a40a31a7d05b2eadcd9a45fc9ea82b24a7fd65729e69d59807cb0d3329302daa7eb5081fd581f2cbd623fed64db6347d9d37467ac02ae837a1b07d82b6a070aa41d344b1ca095e3da0a1c059abf9e7580869fce14d02ec42cbd693ad72799148855bb785020a35efcee950259d5617245057cf58e2e470a84ead62fec2b10c7aa18d9c13e925ed57dc05305e47fdb41766a1fbb97b3a52904d09783f5d21a4037f41714385620397280cab99e02597ddbce42015fdf253f5420b4ea86d7ab3ac08e4ba5a240a2e275a43f2b7cd0788351ad793e8ef6badd6acff37114b0e736194087a1abc0a9ce64bfe9002dd571a74036d40d970f0ed04dcee94dfd5013fcd39f0d745c8a8902a1cef5d9a1037475e82810a9105ffb0ac4aa7fe46c9f9e70a9b7d3724f8183588faa6d2b7094d8079bcd1da0476fda95ff34eba72bcc8d02898a689b9dcef8945a5aeb92055c17f67b0ed0024bfb0a9c2810ed39409d08a70a689f7a364344804ca8ce9d3b05d24eb6399b0204ba5c6c0a0a24aad1db32e77419e8c42d7b0a9c245a76c4ae7419f76095aa033432d255201dfd76e0003bfaf5ac0299d4a3b84b015d82673d05d2e9606bca0ae0875a4e6aa340acf1a8a15de8592ec7ce8fcaa302f2f0b6c7ec7291750fd68503ec734cc70aa40fb6ba4f01ed535515b2699f62d65740a7a5d74e81503b396f472e2b825ed32b770a1caa76b16d2970146b51a2a202a7fa2eb9b202195d827bf729a02f371e3840b799184b8b69b0daa7f63cbe849b3475f2f71da0ee8e8d02be4e98fe42814087217c74801e623f55205256ce060ed034cf7307680277518138e5ad5da5fc644f45d2ec2805224bb1321438d025787dafc0913a55e6170e50977c568163edd365fa957426577d054e55ced5a629a0cc0eba0a6454fbcc8f15c8ea3d6a170ed013726f15f075a0ecd11349904d4b4115eccb05aed747fb0a68af63b27280edf5e94401ed75587fb2003ac7bcdea502e930843d056235346b4d051205aa5307d83861d74e874086414358eb1488547896143850ab60364a01bda2e32b70a80b8ad74d011d97e29e0247ea505d8e1538510d65749f02dac9eb8202a70a58eb44804c3a94550758cee5d29fcdead896d29bfa2aa2d70f29a0142bda2e0c5daf6f6f144827ff72cf016a69dd29102ad0ef3a40fd1f670a440a4ca70eb03f5b4f7f254e81ad03d4d28a154814b027071a40fd85fae8c9beca4abb695380235d722a530768fca5a2c0710a5c3b407d064307e886cb8e02276aac16720a9caa5a3c3b562013eb49bd430768359c590ae84015460af84ad3e9630ae8b894c60aa436f2e42a05123b94fdb202f2bfed75bb6c45fe81ee35b7db900438d18d9f919d0e6289eb4cae361548c776d451201dca2914488772dc7480ee79bf53201d4a7b68aa00e940f52cb323a198fa710305f6d374c22705528a4d670a1cdac5d1eb151da0b1d79e023ab6988d1da0bbd2f4c192e3505505a480f25695bc88c5a02de0394013c9b50bddd86e4f14c8467a4ac42005f48af9a5036cafef6e1448f5d3ce690aa821315f3840f350e60e50152eedb140753aeb5233808ac6f41e81ae0e85bc02a12e06cb690ae884d9a6cf11e957c6cf80ea747628633fa3bb490b56d98cdd606f4e1da0349da4809a09f6704e01522297a70ed0429376858993d49f3c593a40771d5d2b904e98e593036c2737a0c08102b634b8015434e614d02985c1b902473aa5bab70e50ed33bdc7910ea53dd84a80d4033f9d3b4023de5b07a872b550e054e7a9df7080eed1bc4b81580f4fbb5720a35fa99d394045e3d201ba4a3d3840d5c0e77be826d6490aa84d68f7790a90553fcc74e500ade35c73806643e51ca075add35ff195739db903b43af28303d4cb72e500f5c3741508d445d02b3b4033654b29905a9e6d07a86377e400d5c74e1ca0f52d2f1408f58a4dd101da415307e8ba3e4b01a5e938fdd9d40f53dc4f017521d9e3a208a8d9b49c384063afee2b892e6c697fc4b11d86e28503ecaf94330eb033793b4c01fd9552de01763aacae1da0e962a70e5063f519d0aa807685e18e32fbb6553b4f1347c2c25881947385030552ce8dda0ed07a397d050e1518371ca0993b3d058e1458dd3a4073588f15384e7359360e50ffe99502270a8c9e1ca0ea68d3019a77b150e054af583e3a40adb524055499881f1ca0f1db890219bd423d35494a53cfee8d34800652d3b74d731546890374b7e0d201766c07be0354e96d39403366d60ed04eae2be0eb3deab70e5005cd7380c691670ed0520c6b07d8b19d6e1c608761ba7580edc2fa4e81407f7671e4003bf9876b07d8e7283d3ac00a605b8bd100ba06cd1c60f5f57ee200fb60d5e72bb43874d701f6c1a6eec154004ff71508f539468f0e50efd78303749bfcca01ba35f4c6017a4e40db019a58bf73802e6c2507a87c79fe592d8c564b015de96a7305227db0cdd8011aa03a76804ad3d8019a5670ee00db63f5b603d42bf97c85fad89e1ca02956296f23edc26ac6012a92720e50f56be000dd40367580ee7ddb77808edcbd03549aa6c390aea7d5746ac7fab60dcf015a36a0e600dd09bae7004da02a3a408f365a3940a7f6f357ec400dce1c6007ca567a26a0fd517a70807a25330e50ebf5de015ab9d63dbaaefcd1c601f6e52a33076874160eb0f1065b32c4001af17e7e0ecd0b5e3a405f2eef004d474e891cab9c9b161ca001cc9103b4b2a0eb421538f39603749e961ca0dac533a071a0aa03b4f2827bb04403104d07e8fe97f46d9374e2ce1ca0c7ced41ca0274dec3b4065c38303346dedc4011a9049d78f44c77675e300d5930f1ca0c712450eb01d34764faa833d3e7480d6ed5939403be8c9017ac4e3d2014ae4b903344debc201baf23f3fbaed8fc9a50354c7bd76803add1207a823337480ed8f613ab6496aaeb80753bb61b77380168aeb3940fbe3c8017a98edc201b63f86570e50d75edf016a15641da0543f7680ea1f8103d4687e7e74d5f99fbfa2f3c38dbe2a46836740ab57961ca0d90cf86c9fedb37d60fbe4e167fb6c1fdf3e79f8d93edbc7b74f1e7eb6cff6f1ed93879fedb37d7cfbe4e167fb6c1fdf3e79f8d93edbc7b74f1e7eb6ffdbe67df4033cb74f1e7eb6ffc3e6b716416b11b616d1473f89b64f1e7eb6ffb716b716496bd16e2d3aad45f7a31f46db270f3fdbff55ebb516fdd662d05a0c5b8b516b316e2d261ffd486c9f3cfc6cff276dda5acc5a8b796bb130245cb616abd662dd5a6c3efac1d83e79f8d9fe1fdab6b5d8b516b9d622df5a145a8b626b516a2dcaad45a5b5a87ef4b3b17df2f0b3fde75badb5a8b7168dd6a2694878d65a9cb71617adc5656bd16a2dae8cdbe6831ff293879fed3fdc8460d7adc54d6b71db5adcb516f7adc5436bf1d85a3cb5167badc57e6b71d05a1cb616471ffd9c9f3cfc6cffd976dc5a9cb416a7ad45a6b5c8c2033c0f9e0f2f301ae91ebc105e042f86977cf4a37ef2f0b3fd171bbc36bc0ebc2ebc9e21611fde00de10de08ded8f0f012de04de14de0cdefcc31ff893879fed3fd5e02de02de1ade0ade16d0c09b7f0766216c2cb8930849787578057845732242cc3abc0fb606fcdff110fe1d5e0d5a5fd2121a3cff6db1bbc06bc263ca1dc39bc0b4342917b2d7857265a28e035bc1b78b72f487807ef1edec3c73ef97f9987f01ee13dc1134b601fde01bc437847f08ee19dc03b85978197850ff87f509ee167fbe506df871fc00fe147f0e3d6e20ebe187e059a857e1b7e077e573452f83df87df803f843f823f863f813f8d38f5d9dff9b3c843f833f87bf80bf84bf82bf86bf81bf357feee0e7e0e7e117e017e197e0cbd85484909f72f25fdae057e1d7e0d7e137e037e19fc13f877f41df8c7f09bf451e8a52ea5f91842209fd6bf837f06f0d0985aef7f01fe03f7ee02bfcd7784819e83fc1df83bf6f287700ff10fe11fc63f3e709fc53f819f8590440e021f0110408420411821841f2c9c67f5743d046d041d045d043d0270983018221821182b108435a86818ce9c53309451d1549184c49c26086608e608160f9816ff19fe221821582b52195106c43e2055b043b0439d3e4431e41c170f2d050744b511914119410941154105411d410d43ffc5d3edbb71b8206822602e1d839820b0497085a08ae105c23b841708b4038c680a18955e40d09a7081ed4260c1e113ca524dc43b0ffb1aff3dfe1218203da81c12102a1dfb1a1dc0982530419d3b2e6f30942909c2fa9187a4ac5d04718200c8d01295f597df84b7db62f1bc208618c3041d846d841d845d843d85712860384439a85e108e118e184240ca78c1386338473840b844b842b846b9230dc20dc7ef84bfd477888708730472e89c219e68df4930f3218c5b4c9e712a9189611562815c32ac21ac23ac2865a8c61933a6a7886f01ce105c24b842d84571ffe769fcd3684d7d477c21b84b708ef10de237c40f888f089ea68b887709f0ed2f000a12cc7f7c62c94613d32243c46786248287320a3241449f80790b0f5dfe021c22cf5c908cf248c3c443ea2005168fe8c10c5881223154f10b58d767a84a86344e286da69d4a5ad18f510f5110d100d118d108d114d104d3ffc1dffcf1ba219a239a205a225a2152219af0da22da21d2219ee3ca2024918154db450549e716b514454425446544154a56326aa9184515d49183510353ffcd56cfbd7f310d119a273e3fc7c49c20bc340d7028a44f2d0aaa6a93c141e8a3c141e06a053877fcad72f0d2d2f11b5484b118fd115a26b1378fcf8f7fd7f6b74bc45373419a25b447788ee113d2012f009d11ea27daaa3d101a24344b2b01e233a31517b196ea15c065116315412c61e4918fb2a09e3e0c3dfceb57f370fa9a8c42195c93822afe2d8689e05958471f22c0fad5e1ab78dca9a2763c5448c3be6c391fe2956a568aad668144ec65d1592fe12710f711ff1e0c35ff9ffaad1dcf00e110f118f108f114f104f11cf10cf110baf9646121a120643062ae215cd42bfcd38a117215e23de9084f116f10e710e713e256101b108cfda87bfa36dff621e22165e951157e81d8dabc6357a4261481e46cf4a695ca3521acb42d840dc447c46aec6e7869617a9784c3d37ca4359448d54943bfb2b0a4646418a88e5c3d36760e39f185c1183f115473396a5f606f12de23bc4f7881f10cb3f3d9184f11ed5d1781ff10179180e4512d231130b758f10cb3a7b427594249411cf20ce22011d33a93afac9c3df31548987c4a7599804c6e95241121aa53431d2af80c4988589b404491b49074917490f491fc900c910c9c80433b62a0fe941cd20193ff330992099d285432a16683a86e7486622873ffcf5ffab0dbe0ceb1cc902c912c90a898cc206c916c90e490e499ef189a44012867b488a340b931292b251474748641a5491d490d491349484495325617286e4fcc3dff1cbf66fe521920b2497485a8627079466146b3650716afc31594abce40ac935921b24b748ee90dc237940f288e409c9de0b1dd528a52254ad30d4b49b9487a29dcab4102a864deaa8917058c6fee05330fe0dc37a88e408c931921324c21f5916b368036d0f6d1fed00ed10ed086d3140ae993e4a8df486be99608c76d25aeca3dd46bb4312b6bb2461bb674898d5607d72cec0637865721e1fff9c94c67f250fd1eea33d6068a13d343ccc5294b547868a366a7f4271d796b199a03d457b86f61ced05da4bb45768afd1dea02d83b4433ba792f09984c6381412b6f3d44be5feed02da4552b15d2215db650ac67685ce9bcfa8c6ef1a53fa63aed9ff220645976957d1aea12d746aa02d7d7e86f639da32e29768b70c09ef280c9584f7685fa17d8df60ddab768df3d93b02dfff480f623da4f68efa12d443da0bc6dcb8411dd75f0872418ff4b79788cf689892bf469bf9136267f8dda699e6c8c65513c453b8376161da0e3a1e3a313a013a213a113a393a0d346a7834e97996ec1069dde8b04d454125a61684928f25078286ab050b1d337827188ce009de18777c8bfbda13342678cce049d293a3374e6e82cd059a2b342678d8e8cce169d1d3a3974f2e814cce6fa2cd5516e2cf4ccd6de163a45744ae894d1a93c93502461a78a4e0d9d3a3a0d749a8c097b029ea1734e2a0642cbc30f576dfe7d3ca45221169abfe0ce09dfe4c1085b021b3cac99d0459e824e0463e7029d4b746484aed0b946e7069d5b74eed0b947e7019d47749ed0d97bab8b5a1968192896a165201b9e9b50913aea3e5db59d7d740e3ebc5bfea58dd660e790fa4be788867de7181df97c8a4e069d2c75d12ed0f5d0f5e91aed062677744012da0c524f34cc31ba21ba11ba31ba09baed679bb0db41b78b6e0fdd3eba037487e88ed01d3303b93b41778aee8c3b72ba7374171fdb0f7f220fd1fd56c62d0386dd95918732006b5251a413030cf2c50dd5cbeed6785c4e28ebba3b7473e8ca1016d02da25b42b78c6e055db9ac866e1dddc6f3260c6120b9b742b7a9f40bfc17ac2bf0876cb3886da2a686e7e89e7d06187f6e94c9c00374a5eb2ee8d6ee5ea2db42f70add6b746fd0bd45f70edd7b86e9bd0b741fe8951112fae75447a3a3b4ec5a99917a4f18f888ae306acfc4092d09f7d13d60f4bf7b68787844bd37923b1f2b0f45419507601288b0f7e463b5d33f8e87e89ea29b41378b1ed07ba76ba851c47df47c934333a676da0b289a447b6498616d36521cb1899e9904645a2f442f422f462f41af8d5e07bd2e7a3df4e43e03f486a49fe59e23de4bd63168f15e7384e4071fbd91d9aef1f17df8e737fa637a63f426e84de9b5eecdd09ba3b76064a2b7446f85de1abd0d8313c1157551666f0f6813f664914d98c3ed4987efd0cb3152dfcba35740af4812f64a8c13f6cae855d0ab9287bd1a7a75f41acac35e13bd33f4ced1bb40ef9221ca5e0bbd2bf43ed207fe67f1103de9a65bf4a4bb653c1ed07b44ef09bd3d786d5307d65c436bbeccf0bdb78f9eb403f40e2991848d91e18c68aa22cae8f84e1b1d2d324e47e81d9b76629afcf594265f2ff3cc37e6b5f5ccae45d342bb2b2a6d4c0437cdfe2bafdc27631d1bbd43a3f6bc5c3e7c69f016e6f9a7e8654d5df7d854d464431fe87bef35b86bec57cc77cd4d7837ff4fa8f6f72b432c62502821b640df473f403f443f423f463f41bf8d7e07fd2efa3df4fbea178d0a14837d6943c609c321faa28ee6586026a932521f3ca03f467fc25d1442c2fe14fd19fa73f417868155cac3fe92fb5165e6f457e8afd1df9087d65bd3dfd2441425abbffbc06ef9a378280393433f8f7e01fd22faa5b495d1afa05f45bf867e1dfd06c3f7fd26fad277e754504530f62fd0bf44bf85fe15dd2761c0e882a8ac547bd2d6bf666b0f49d7fe8d69b7c6f339e4bf724ff0ebeb2df2b2f126777a87a8af840c0e55305ad3512eebdfa3ffd05a1cb34c43ff11fd27d3f64cdbff0bcddee1c9dcf3516ece9fe81f58d2722f6c2f9b52f4c387f2fd86beccfb23f4e5b14fd03f453f837e160360e061e06310303cf8520c760aa288520c4687f4ca4427188418442cb5d66e631033676d9060d0e67ec278c7b4b54107832e063d124fe8f79287833e0683b73c1c0c19031313b133fc40d5f45d1eeafaed166fb3df396d5f5fbf5f5e66d76fbb84ffe0fa8dc188c27030c660f28284afdb608ac10c03e9d305064b0c56148c8335f746249724e4604309299c1c6c49cbc18ecc7cd906395a95223fe39e49e61e6290d70ffc5cc0a0f8dce20a9bb07a5032b14ad3c2b3675a5a42aa6c2c182a9a30e3a08c41e5afb1eebb84fcb22945537e2a39ff0466d2bb36a832c36950332e991803e14c03832625e1e00c83738607450c8a3568c4a0718a1abf68284ac705b7320d2eb87f622083db62907020f7bcc6c0ecace72e8a1506327fee30b8678e8748ddc183310e1d0f7be4e1e01183270cf69ea317c2c348e6d5fe0746a12c0fedcafda40bf6e0e02fb56f4d202319ec42de53d5cb2de4181c92845ce78e3038c6e0e4ab6c24214f31c86090c510187a18fa24e43060847d281f22aaac3420af308cb9060b398709866dd33a46785e62d865468ea8b5c31e867d13081991ba2c637384e1c06c803a37fb832b2f789b52d471d24a4861233d4650ad5804f27088e148dffdaf76dd0f52712f15bfaf9b8c2f8d6daab8ffb8cc9cd012f373188e319c908ac32986330ce7182e305c62b8c2708de1861a69fb02c3ad9181d9e730bd4d581bee58e2292a6398637c22a96398c7b08061919b7afd3b0c4b18cabf564833fa45a5ffab64e0b0a63c1444f8f99287c33a79386cd055336c7ea0d7943cfcabc4fb4bb32a9d3dc3330ccf31bc601468280c69617845367e838aae0daf31bcc1f01643198c7b0c1f307cc4f00943b9add0521878486929cce41ec52a5bdc621b1e19a21e93a8c25261a61878c313f253c4a9f0d33ba65075e414716a65a913a78e905447ef68438ac5481db5458bd49789728a61e66fefbd1f62e3e37333b434ebe0df4b4bfa3f445b112d7498c5084cf11d7918f918051885184518c5182518b531ea60d46588a27d8951cf24ac0d98ba1d703b2f4bad25157a65467d8c06180d59e56934c268cc1a33a309134747538c6618cd315a304e483fc29c9e52cbc3d1f22d0f472be5a1f784d19a8f3ada7c5420f1efe4e14f4c29e9942d463b8ca4a3f31815cc32d9e2687d5b2abe69a32246f26719a30a46558c6ac6b33a262d47758c1a9c13a32699393ac3e89cfc14f3d251b4336659374bcbd1059db1ed0ac9195e282d4797e46418aaba6b39296aad68b38e8d56303a2a263239e445aeb8d0fc5d1df83382f1251b2d21a90a192393d6c4f4777112bd6b56ca0b6534af31ba618acce816a33b8cee550c8e1e309271110ec8e8ef73ff8408c3d101f5526e6592eb0fd3e3285634084747f4caf4e486c7189d60748a5106a32cc62009c71ea226b5dfce39c63ec9d6695035151e5a9128b251786843f92f7938161dea808935618471f85199dfff080f7f64328da517624663c709c66d8c3b1877b9648e7b18f7bfafa6be69e301c6438c47188f319e603c65e2cb78465a5a69d9937f9a63bcc078495556c8199d9399e3957252a4a5884ad23256696939395e2b27c71b95939690563cd298349a6ae81b1db5c58a1be32dc63b8c7318e7ffcee5ecaf51d135c349e317f8f5ddcf264f45c6aec024b5b1f4808c4819e30ac6551583e31ac6c28106c64d46eaad6f4618383ec358d6c7adad7a68ea8e0a78c184b581296cd12b305d662c03d1c2f88a396b24e1b5cdde6692daf8863c1cdf52f4758fbecac3f19df2b03b230f7b2d13973ef92813f19b3c1cdf7fabfddec9347e30247cc4f889cbe4780f6301e5190eb9768a293f3ec2f818e31312f2c739393ec5388371161360e261e2631230ec310931893089e97415c37292183d36a0c014553632a2328898b56339a9a232a69d2972d21252e4a498974e71b5e2d1796bc568141d75d2c6a4c354d54917931e26fdbf7339fb4d543406fcb3b3e7673c3ddc383f1930517b32c46484c918930926534c661cc1c95cc5e06481c91293154314cc1a8dc840ff4c0315dc597f82c91a930dbd32932db346273b4c728cd44fa4330b9814750bc5a48449597f9d99311386e92d0f2715e521a95835b41cbee2a1084fcbc349953c0c56888b7f000fbf4dbcefb65f9e4c931a26754c1a98343139e33229e324eba598ef1cb373fad344420a212717985c1a5af648cb498ba2f207c939b9c2e41a931b4c6450ef30b967b2b86f42209307725244a5d2f2914aac884a6fff59484e9e9ee5e4648f425208e9cb6df75f1152cc48918d623732bba0c8e8c8e4c0842b07981cd28b3391e978fc5757b47f8a8aae59c5f51bc62475429a64262621a660206b9f70e914930c265966c970554dc5e0141483530f539f0c144534de43274f31383a64987e1aa4b9325326ac2575ba46a7e17390d0bfc734c254ec5b577774826982695bf55266b10d30ed280fe583e56177a43c9c769f7938ed21a8632a2accece378f817e9f7cb8474b3672afd35c474c48307383663a6f64e2774a04da7ccae98ce98e8d4ef603a675592e90253e959c1d798ca9582ec30cd619ac754ee50c4b444db72fc15720a21a7654c2b985631ad311a39adb30091e8aed6a4ecaec8c96983eaabb52a3de3869d369f8dc9e919a6e78c5b4e8d25393512d2b1519455cb4696bae963dac2547e5466d20dd938bdc5f4eef72f67df62e36fa1e241aab56edf5892ba71be7b4153b07dca14dfa9f044faf0912be6f409d33d4cf7550c8a35d8bdd7cd139681ed16d3d6a243ba46fd4b6e9e980a37a4a38e303dc6f484c50ea7a79866189f089ee81a9d66317bb555821b9a661e03834233117a9687d6652acda5b6090f673e66c1fb3c9c85ff211efef894b2f366664b18488f07cca9173b811b3d976c9d9d19b0d024fb7afc308b1965629dbc166609666dcc3ae6cf2e663dcca42b07980d3193ee1e6336c16c8ad9ec99992f09399b63b6c06c89d90ab335661bee011742ceb6149261ac6e1e1192969056428697ea809dede87a159555c4e32c4742cef2cf6c9c15a8a95a357556a48938935f2c635661aaddac8a590db3fa5f5dcefe12151fbf4dc5373c7c4145d34c20043379972653b46767a62e5e05b373cca42b2e290645791131689da2ce1ab479db8e81ddc06c622ab1bed3ac650e2794debba241183c306b945e1919cd6bba466737340867b798ddbd15c87191a188d93d6966fda5b387e7d085f0d0a5b67d8d87c3e6479575ff9b79f883f369f6c80dd4930663b589e872430e4c7f289f1944920fd2b8580ea8b44445bab3a323f3679175f292323fc840ca05d1a1093ddd312351c678f684999044a82ebf7288d91166c7989dd061e038393bc52c8359167360ee61ee3f4b4821a44c3211928315cd1e21a458927313a5a4ca7a46092966a488c77988798479fcccc679a28904f4a91ac1386f63dec1bc8b790ff33e05e35cc0e16f5bcefe612ace47988f319f603e35f54762e6d6cf6798cf315f60bec47cc5d8a08841e714b579dbb2d4ced79681a6e2e83eeb3b7922517deaa2f30d2384f32d4bcbcc77dc3f31be54d7e83c4712cef39817be9cca9466e31bee69ea8e29f48472423cc7c39729a6c2c377f5d279919e9e8f7099fe233cfcee649a97302fb3a6483832ae6a694393cbbbe33eebe0deec31bbc2bcc2ecde4006be6aceee917950a3537bb231aeed6bb30fad04bf2b8a4d6bf188799d69507287798376bf9f08515b8b26e6d2ce303fc7fc02f34bcc5b1aa8b4849ccb0f5d637e83f92d5340e67724e4fc1ef387571ed7e113b3eae68f1a9f9c3f61be87f93ee6f23af2d7a3576c9c1f1b35555e5366ea29e6f22b59e69dcbec597858f8bf6139fba7a8a8245c045884584458c4a6c64f158b048b36161d8625c48c5f742906173d2cfab42f343618290317035144ddf6255375db94b49039106521a3dfbea341d89f7013d3a480c548bd328b31be22af9816638dc35e9379a45ff2d0a6987e9b87e31071e93fcdc36f4ca6c594ebdf62c6223f2cc0ecb3d088211b794582e5ed19ae2c7ce0c9f0cf5b8b03564a97b5b39f37e5f14c5b2ccc09afa6c95fbd22164b5e292c157b63b116ba929f830b5371fd9ecc1449bbd840f4abc50e8b1c1679b52a45322fe4eb25c80abda86051a5845cd4b0a8d38c14ad5508b968d0a9f31c9694076b62714636ca32b190b9780951b116570c7258355504a3e8a88b6b2c6eb0b885c86d790c11293211e5c1fe221b7f1715bf692862f184c51e6be1491306fa47904161271fb2f7fa89094bec6121b85c7cc294d1ce5653462d0323e9db53266db3e6efc896dce630d9e084e8a28b0c8bac094bfd5b2cc1ac51eb95597a2fbc326fda84a412a594b1c14713afef3dc7f1bfe4a18b1fbee4e1d2270f3f2274f1751e2e839f687f918acb10cb88cb21c7e382ca497c489fcd3266b183f10519d5cbd19b4ab3a18565c2a3b3966d2c3bc6b05c63d9c5b2c7c62a5dc7fc301df15f270d73f07289aaceb2cfa43959713d51775b86d572e7116b5d8ac88d57580eb01c62295f1c6339a1905c4eb19c6139c77281e5124bb966ad845c6e4848b121455f15f128faea58aed962b9c3527e2b8fa53c7f11cb1296652c2b5856554d15c198c82bc81d64e01b5836b13cc3f21ccb0b2c2fff4c2a2a0397f2d857585e6379c3cd4ac2c08ef4b950e50ecb7bf5c70ce45d1eb07cc4f209cb3d2cf769d28fcf540bb59b27a8881e617960d41ce9ab431ecdcb018a189c105db42da379c45c9960ca5c99a1f4a1fcfac9373446cc42ca37ab942e4f1927ec0e9e7968b720becb431bc79f54b1cc9087fe0cedfe9fc1c39f62e06f61e3322bb4a175be0259174e8dc33ac2cac3ca67a69b106915601532bb572467d7ecfbf4662c961e8386447c82955c1f6395d0c72d7f12042ff00758b5797da7c430d4aa6388dae13de5ce2bb1d63614b3fe155523599b8593ab1e567dace48b43ac468c8eacc6584db09a6235e3fef1d906abb91252231ff2d30bba73564bb271b5c26a8d955c269f7758e5b0ca6355a09a1a8d281857f2d3f25265ac2a5855b1aa6155e79eac5503abe64750f13bda295667589dd30e64d5c90e5617585d62253d7385d535932e56378c30f596584927df6175cfe8fcd4a73346186877f1da42a3e6805eb132684d481b1dd12fba7a505db457648470f588d5931a8423e9f6bd6f6f8660f44f94526ea4689acdbe4375d288187cc343eb2f7d99d7f69287abfd0f0921bee0e12fd3ef9709a94e1aa1cd01c3448331779489c812a127b24b245e542167847b42bcd5215647e49bd0ac53a6eab23a367b5eaeb13a61ca2f0fd31a529ff16fcc9f432282af4eb1ca188bff891e70a1e82a4be5476e28b7253343662d0a27a787b2049093913036a16db906d61ed63ed601cdc8b52011d631d6098f85127d352e330e696d48118f83952aabeb36d61dacbb58f7b0ee633dc07a88f508eb3105e37a42c138c8633dc57a86f51ceb05d64bac5758af79fd37a21a3fc2c6df2b12d71bacb758ef18126495d72c8bf7ac7358cbf3174cce93bc69d1047b9f343abf2ed1cbed9f71ef9261a031056fb02ed3292a62904647990bae6837b23286d209158edaf4d4ec60b2950e4de1ed75f507aadf4f4827a7940e06cfc6e14b1e5a3f8d48cb3779de2f79b8ae996cef7fda656a78f81b19f8b36c9449b3ae63dd20e54440891a2966ba6895eb26e59eac9122cd44b2097fd66764ddfa9c0413bda5bbc7a8eefa8219f7ccf73da526b3be34194f97fcc0fc4399f72d5e2097adaf68f477851ee6f83b61af3073748cf50dc5a688d6d1807a917072fcc88540342559aafd2b3a8448c85bacefb0be678872fd80f523d64f58ef61bd4f7d3599d1805ccbbb1cd2c53a30e1c7f59161a3fc843cfc29d619acb3d8001b0f1b1f9b4005e3a0844d48ed6e1361136393b070cea4834d1b9bce3f4bc52f44e2a68b4d0f9bfe33030379f80136436c46aa888e1eb019633361aeb68dce6fa64c13b52141cb403105792a68df8a4131f8b98b570c8db151526465dccc98ad264366374f044fdcc12424dc48fbfe1e0826f108a958ed62ac110b310e5f3a691c0f592daaf976df93f7441e5afb303934a1fcff120f7f908d9b25362b2e8af3f2b3cee95f536a094944ee6dcc39e6324e42a4a96197302dde72e1dcac397262488c324c38146566b361930ff2573abbc78c3bc9659b2d8b2688c223df25635bdcb726641e9d60b37bcb498a5f635bb66fe8ef111b75b1a6d6bac96193c7a6804d111be14f199b0a365526346f6ad45785906240da349d518da6a3b07153c7a6814d139b336cceb1b9c0e6129b16d96805e3e60a1b79c81b6c848d77d8489fc8e4967779c266ef63a8b8d9c7e6801543c8405b61648acd2136f23ac7544427f216271a1814457473aafe98685f4f7de91b066e323405bd6d6b31a45354b48ce894659da46365c99351ee2626461f7240397669def6564cbe1fad68f8ac94f6d7f4d0d02b53339b0f4d529b90d0c50f5d7ea9db07fcffc2c3efb271eb61eb3fdb7b62a98be6b90d98d12b524b7415618b0834218fb0c8bb23f1b6217dd92c96be331b40976607da18de3ddb3632e72d1b2b7f1bf39fb609afdcb6f92d4b4e61a6dc6adbe16d45600eda1495f25bf28b2278c5501142f6f2d87619d8f4629aa95e917e236fcc08cab6876d1fdb01b6436c47d88eb19d603ba578dcce545f15ebd1b1713bc77681ed12db15b66b6c37d86eb1dda960b4aed46d0e5bf9c502b6f282256ccbd856b0ad625bc3f69be1feaf51f1d7b4d36d03db26b6672c034b066e58386b7b8eed05b697d8b64c52e1817a44b7d215d7d8dea83fa67d4977a89581e1be31052fa988f6ed99132b8ac1ed2dfb53c4e0e08af52c44b59185759a31e74f649ecf9fd8defd301926dcebe4578cd5f7c84df75b99030fa64d4948cb439bd7f6233c0caffff98df9ff140fbfa4a2205b61880cfc1e5d2c62f8893812fd530d3f7382b965a04830117d947b1943bf1da9257c133b7e3132352a334c38e4a1762bd332f4744b1390478be478cda4c8b556be25e414de9296c29903de9606c9d6a8b2232324db547d45079627911521aad29214414d07acaca939fa93443c6e0fb19589788ced09b6a7d866b0cd6207ec3c9e616ac5e3ce6782ce7243368aa6ba0bb00bb18bb08bb14bb06b63d7c1ae8b5d8f8271d7c76e80dd10bb117663ec04996237a35ab89b63b7f827a8b85b62b73247971b06764dfdf2dd1abb0d765bec764cbb175370f4488fa853447b1be6c7b4e5a572cf0c8c8ecdd64153da70c7b0133d70a2f0ef0a5ce0c4c217abbe57c4ce0cab3da7deeaa2bbd24f1d558f5d9995d7ac524a0f4d9fb5f38484a2a4ec2ad855c94652b1cab46fe1a1dd7f68eb44591e4e1316ec78c9c37f3c94ff0ff2d0b151fedcd578acf9aede5ad4b06b50fac9a4df3539fb65784627af1828e3b43b237364b4844bc23d0694eee8d19edd60778edd05d75131ebd9f22c1d3bcfb1c93f8992234daef427a4288fddcad10720b41c65c9c925484851629936754b42526bbda00ebc361ea095c96f14292db36777496d6ad7a23f89e73c17e876dfc9dcbac64e9ee416bb3beceeb113ca3d9a79f0a4d6e3c4c76e8f6cdced6377809d50f408bb63ec4eb03bc52e43f96305e32e4b1d3507e43ce47cfa5173017221e31cb9e85b16e3af6ba78681b918b9845ed0b0ca8277c9c254a0939f6e23d741aecb24fbf13e6312620ae67a0c0ce6fa9a1f933321c1fe90c5d47243e636e546ccc4c88d4dbaf60ab98911835376a058fb2206a56f450d1195444656c6c2fa45a7117253e4663fb7c3238ca8940ab5ac52daab2a096535240f2bc8cd898848141eda7dc0b905bf22eccd2d599f26b7e2fe431bc75fedffd77928d22fb7a60034f44b5b0fb90de58f0c0c5d2fc6dd2264103125a24f744e211e599752aefd409ad19336fb4e0bd7da725bc3cf2cbf2be39ddb195adef1b6424811aa9690b1a712525456b1247339da9062b7e4f27c3c993ab258c81c72d6a32857ed36bc5b2415e606e40ac8c9fc2b2157464ec6be4a454894a25c8dca6a5053368aa69aab23d740ae89dc1972e7c85d2077895c4b0563bf451d357785dcb509cdc99537c8dd227787dc3d720fc87d3ddcff6b3ccc0909e5cf7d66a50547a662729ff9063999a687c81d998da0f2bbc7340517c7cc505beef1ecc1dc09f363ec260961605232dbe76f99bd14dc3399a97d45c5c18ac1f8d8745d426b5cd6b89db1ea5f9e0a9a3b452e835cf67595baefd534f26a4c317739a5b3875418a62494269ff36001451189c243a1ebd8e7f6a8ee947513fb5b26e28cd6c87b7f360fa93d7ebdfd0803857e79ff25fd900fd216221f715464ea0bf7568f947ba23d0a43847b421b1924ffded4ffb9453e463e6193b533df7ed51268b3170c4bbcd87e4bbeeec8f952660aab85db8e90b22acbef52653d45be63c4e30879135096d5c1b27163669268d1c103fdabed0e3d7ec2c6f008f91ef27de407c80f91972f8e919f203fa56f80ae82335556693a5e918df919f273e417c82f915f212f5db4417eab82d13a6ff23be473c8e7912f205f445e5e4abe5841be8a7cedaf52315f47be817c937179fa423766d7729989e9f933e4cf91bf604c62d12503b9076d435370d46135271b18cc5f3224e8184867cc3d5d599e492accb7e8708e8f986e2166b6749a283b748a8ed8b12206658595fee778c99b5e237ff3ba54e4d6d62e4a2b777c8587a294b2f8cd13f2b7544aa5abf3772f84e193f2706b3414e161a7ce00a35cdf39230f3b07c8df9387414267cfb0f947f2f0db0cfc2e21df13802f1868db83f19a6cb8a94cd44e2183688fa249d25e9f290349aa947b34e27fb8398a5a66bea4a5d0db1252745af9b9bcf1958bca2a4aaf8847cb46792a963f19d19d435f42c869e4954d2832a1412b0bbc3a724accf5f16e5b8b3dfae5f3322d64a2ef232fc37c88fc11733b648a58d33188958d1d21ed31f227c80bf333148cf92c0aa02bd566a586e774de143c147c14021442161a2c44dc5854885148de4985fb111e16da2874e8bf5dc8e72e4b2d8b165a30bbb40a7d1406280c5118312a388ac9c0ed150a636e95e8ad79f0a04dd41645d4d63224038d338689da1e77cc0c22d30f1b86645d9e9aac62d281d2938509c5a03d12944323379fa23043612eeaf11b1e6a19b16736be158f2cb22692cd860d0b0b0abd574a69ca432167c1948ae226fd31d36e0a661330eb79ef58bfd4f1d0e7a17a28acff0c1efe1403bf64a37c786101be47bfb4153674bac8d21867280045465906be21e1cf32f06bb47432d311d269ad227b6579766ca447e791ab83b05164a3886b3156c5a4119daadd35e901c7ac5614839ede65c498e73047bb51d4b0a884c216851d0ac2a23c0a0514648a97c8c65eddb0718f6ca4a62a3d5046a1824215851a0563a14eff4da1c188bf75de0ce46e4d14ce28150be7285ca07089420b852b83cba4b979b57fea5d2a166e5190b9788fc2030a8f3cfca33d62561acf1158b29c8748e0c2130a7b28ec332a68dda12341e4bb87281c99fa31f6ccb39666875a06062366e4fb97a28832d6ea8b2e3a673f2c3b5419d6374ca2106d62744af3db8a41b10bac4b26dca0708cc2097c59686431f2bfc643c7c6d7fb1e27a490534a0b866f6f9452f2708ffa0883190d86f8c316373db9e452c743b133ff201efe32036dfbbe007cc3c32c75429181c2016bf809316830a43cb4ba6811bf81876f9ae5a4f0dc12527ebae8bdc34659bcb76dda8df4ad6f9fd55406398c4f759570c92ffa5453a7472806288628469c94c5184579f8368a1d14bb28f6a83b0dccb127968da2a9ce368cfe17fb280e501ca23842718ce2843146a1a208469151ab228a53146728ce515ca0b8447185e21ac50d8a5b16412bee50cca19847b180a25c5c42b1cc6d1cc50a8a55146b28d6516c30252d09a9850a0393a9297f7c46a95b6ca27886a27cb8a03b54183859d01dba3945f112c51643f3f1929563b468c51119689d31cc983fa322ea8d994cef4d98fdcbdd33304bd5099d5ec52b3adba865a487f24aff17af51bc31e57081e22d8a77a29a7ec9c337547cc9461e08dd3e349ed2639343337feba171c6a1f476dfd46bebafcce6c37bf250be3b0e78bec5b4c7faa5f4f7f4ff0c1efe1506be1680df67a06dc57b141f68a45112fada848a6f44e26f27e19772d21292fa6a5edd39f254c2c6d5131566b15a197b4cd5d4a1394d8193ec5c1daa9c7642a747e39028b100642873f790c1ebe2138a7b28eea37880a25c73644a33f4186856d9686a0288d1583c46f1044599fd1914b38cf897402a3209ae809287928f528052885284528c5282521ba50e4a5d6e84ef1ca1d4e3e7529f7f2e6fb48d8be654d60a7da13627c62fb0087220f719a034446984d2985be685813620b138615470d4a52918eddb03cf749b12f70af6b953b43f620919cf87278f3431d59cdaccb967c2601a9d17cb5fcc7e51f24b532aff5cf2e64cda2ecd509a2b09a5c9dc2b2d505a7e69227ec9c3e7565ad1cccb2de87a91fe94ce7c97870c24deb3cc3e8f7c3245314aeb1745846d719ad73cfcc7b73ebde0e12f0b40c3c0172ed01f63a06da50d4a5b4e7afa4e5cf355243e4bc5e4efa5e24b2149dacf5459b5a6a3b071638cc676cfa4ecac291845d19279667554b1186db05104a3588c62144515664e7a117371261b967b28ed50caa1944749185544a964121d8d6c945962d9582aa354414966987caea3d440a9491d7527ec3a633eea4cbe788e92f0f312a5164a57285da324aa4493871f8762b399a3c8a5c9671e8a7cc2121574c364e8891106f2f00fe30eedcb776f51ba43e91ea507941e9f19b8dc6354b0b37d71eee780d9a10c09de9281c198b97edcaf34626050de7130a6cb8ad6729d8a68778f8a8328a2b278c92a26fa8e138339e1e4535a153ee561ff11a53d94f6d3a21b3fc8c303860145be494f8ab8db4edff2503ec85f05145129ab9ef4b65c690f99111ef62e9f83f8cb8cf2702c6bd3e1c7f1f077a8a03fc740e5a12ce1c7540565c6330c986513fdf0251b858a3fcb43ee559345f7849919f33ced10f93ccdd22bf0e3841495d8b1516c57d1a9ac9a5a3a558b717df9ec4a95c9b73ee32c0c67d451d74deaa8dd48238da50cfd37a52cca403c45d943d94739d0cad3cf9a6a86d1ff724835b51ca11ca39ca0dc46b9837217e51ea38bd100e53eabdd94073c376ebd663c83c7928b5dbd652b0fcdd1c879c621622300fd9d39ce112c739cb47893f208e531ca136e9977b969e52919381dd319539e3147941e51bb5fbe681878afce98f29c196adca4766914d13e7572d1086c7e8c280b34a75becabf6bdc6063928f2bb0b9497afce62b0ad27f75ca1bc367bacbeaf9a6a6befd3d2e3eefb21d732310e450525f7def070caa0e2b06af24e1fa9c7dae0a1f07030240f6d10bf77c57a6d96871fa397fe820afa05037f8e84b4074c2b6f50de52e00466930b8f507e4883846968de862ebe4d1bb9a0bc433987721ee502ca45944b289751aea05c45b9c6cfb1e075941b2837513e43591645f9f3e2fbe251f4647924958d19e6caedce985be78fd479233aaa7fc31c202b15c36366a8d3465a9b1d5b3eb77189edd416f25ca2dc42f98a4504cbd728dfa02c9d70a776a3e84ec2c6f53e8dc6dd1ecaf2520fb418cb8f8c6a94851e02ee934b7df9d68139c72a6f0e6fdc986d10639ea314d6f57471c14500b68be6e00d21b6305c7ef418e513944f51ceb068853a63527728cb37855a3ca61bd89306cd3625980dbb22062f680ab200c29e49136d6b6d5f7a446fb82a6d4dc82736815fa78896b3a800150fb9ec3bc7a2d8e6fb544d73eb1fe561c5a74cb3bbeffdf92ba5545a25d00f5ba3fc770f794da74e0dd6f2d0062dfa5b54420de25b1e5622c6423e266ef19346e01bfafd1c091d036dabc4a824265a30d1f4179b0ac36c9897e2d1d735f565eb4f4906fb5974d74a1b950e2a5d547a18dfffc0cb4f528ad651e9a332a0f0fc9a0149813ce3c3e4cca1422399584375ded8a846654473d1517175f4ec47152a56c6ac1b402a26d4eb2a1354a6a8cc5849a932476581ca92ce06a6650d54c5dad418f7afc8cc58a3b2a1f3a6229366874a0e953c33e092d6f33973c98235fc83229b3bc3b8232f556019d5ad7ca5888a3c4619950a6b376d4eb8498249143d8a4131052b552de62ba660a5668efb2c9181cb0353a06400bfc5132678d6d20d33fb4411e5e99f317371572726e121478d7dbb6fcce9342c613bb0223ddca0fbe0dde3896ccb1b139107ecbdc3c377a858696ac4829d76a83ca43c4ca9f85229e5c14f0d0d5a88081ddfe80ee097418b7991496d3efe601ebe6704fe3409df30507978868ad0ef4a3345adefd426a3552e4cce9a212703be8fa4c14b7ac848779ff82d2712bd3b542e5169a1f20ba50d841bd7accd5eb96111947735589958be39725d1e461e3578a4fd3394297e4b7371d07e45c5a8ca9a7ff3ed3315c55c5cc626f966c46ccc8a3ced3d2a0f2cc45a7944e509953d54f65139307b766a9c55a2a6b27be58243c6182b47a8c8e713c3c653543274a5da0ae2c2497b4823c969ca520d4a867e595481aa87aacf22a2ab1b16117d199348f25ac5d01ebb4b4574a00109af856ac00451630a72abc462c50d28cb440bfb6e66d405a89f6718e0910e917194c172aeb5d92dd7b86a886a846a6cea857f8587621c895e5a4dde75d5bcc3c36a9bee16e676f7a8760a0f3568b1a74d7acf0ac35e4dcfe5b6ce52f956b5f3eca4e1e187a993c6f2d0abff793cfc2215e67792d0b66a973e49d164589af251e34b3296f2a7cd0b1595b5daa376faa54814a43079feab0cbf58265519f8c15fe9141e3e551da23a42758ceae49d1f951f124d551e8c4fbea3535e968097549405c2eea2b252d12aa842c5c582e1352fa0ab835a5f0ed529aa3366ae4c5a2c54559da32abfbe642e4e75c5195635051dabd2b68c40e4ce1963acee5095efe6512d302bd595f797261faa45544ba89651ada05ae5c104b66c4cb5866a5dd3d3aa0d549ba89e694cc22aa27adaeec80624e80e0d27a64ad08531058bba6d57de6bbe6356039d3123faae64eca42ba44364986cb0574cf4ea39aa17e6acd503542f516d31bcf95591f888aa3cf9f50ff1b07ac3d4d0d93d95086ef6add23eec9e29155dabde9a74b69aeec4ef34a9c78a526a4f0216a5d43a691c0f57fba8de99fdf81fb2efe91b0c7c1d8af815127e8381cac37b92cdee21143d53ac0b7b8c1637c2c86c93de94117afa51ff8ac8abeade5fee179faf56dd374de6d021aa47a81ebffd2d518699799741f58416238b1a1dbda2a2e86c622b8e06b415a7235618105b71b1682d0e4cd9ab22f7a7c77ba89eb238723563d898d5c33caa59d4809a879a8f5a805a885a845a8c5a825a9b89a6b50e8b6ed4baa8f550eba336406d88da08b5316a13d4a6e618829ea9207ac8f4b4da0cb539b3b4c70d3a4547fbcfc7ee520c0ecc36a5be61e0b8b578e0e3d11933663abb988293a679858132d0a6a78dcc7e259b032c5de1dc69e106b5056ac625d333adb64261ce5efd2a0f3d0accdadad4c2f99e6a5adbd0d1221aa6cd65b33ca41d68a8681b35d57b158676e7a1350e5d469b28a5c9c52b278d3f639d9bdaf6cfe0a175c31806feed249456db194fcce839776c15d1f6a8e550cba35620196ac59ff094d6fea2d399e91a5cb99587a6d5ca0865d25750abd2ebf0f217e9c8d9198dfa94abc9aec8cd53eb6b8616ad07b55643adae1ed461ce5211e30bba3a3cb333488cb15a03b5266a67a89d7367c36ef7aaea71ed02b54bd45aa85da1768dda0d6ad26f77a8dda326847c44ed09b53dd4f6cd2903c7ac5c484a5f90815444f7a98b4ef79f372b4d85ab07acd1ec9f213aa018f42e69b86e720c48b072cc23f749f4762ca3363de470c86ac295c56c1714a5c332d0bba729c8586b6a1d6c65ed3844ed48c5a02937cc26cbbaa89dbeff2d13b1764c135114d4ef8ac4da09ab4231823fd09dbe8e8aae9184d5e713660603631cde6bb9445b1eeaa571689da5e1357ad71fcdc33414e1dadf4e42f2f094e3376ed1d890592ba35ecba096451d9603dc9351f77e9487c3b23b75e4171a35d2fe9e3921dc7bc5c3ed93e1e716751ff500f5f0151b455395a5a41ed17f2316a3988beb0bb3a09c70eedab8a2dda5b1ec3098c15dc51103df2c513786df668e985022e8a31ea39ea06e4ebce299103d9e0329429247d0a527798c4d1b98e33d26e6743ab940b847f686fc9663e0e801f50e5d322e51dbd650b35b25c446952580e7498cd41d3aafb33caca8cdde8dd19f232de94b27f0890624c8c053cdc5173bf9a5bd50efd24d5def19761dbce261ff89e2aede4f0f127f8f87f501ea434e896ff3b03e427d6cc4da98a71ada0a344239e6d3dc3f374bc2376569ecb643d1696de4b03ea1526a334bc538ac441fcdc32f18f86d1efe36124aab4f519f311e2073b47d8dba0ce702f5e53307ea2b4aa12f8db42fcd453315fe5a8f1ccbc3dbb3c4d903ee19e4399951651475f96b45960621dee655d82331e9e9dc916c028ceb4bb38bf29c545c25d4e8b8edc0507199382ad2ee9a6ce80bf1fadcc2276c8c657e6cc9c651cc1c170a3473e895689842339ed0da32a797a58d1be4bb3c4a8979a187b403ad0cb40cacef2806451775a52beab9e70c35c6245af04518ca5c14e957625cde0b51cf3341afdd51064e4f5fc940bb1b465ed629a2a286d40ba817512f712ebd2ebf6f7878807a99ffcaba1b5f1189d2b70519c1ca777828c661bd4a1e8a526a2b233a9168d9683fd8e3b80b190ac37a8d9143310ead52dadee716fe7a9d4ae91b274d34fbb8faa5c613f3e324fc3e0f7f9c84e46103f526e3ddf533d4cfc9ba9782883c7c2fc427cbf0eefc3d1e5efe85ee985a9a1913e50bd594e7ce833b861c22d32b58a2de42fdea151b1902bda7d0886ae688a2b22aa86fa8d86e5341ad5f1b27ea13772a885ae827e814e8ba8ce59f6e90e48c78bc252719ee33e5096d63718a0353b4f780f8e684dcabd668078a162aa6a0c8c0d113cb69db149997a52be8222a322e1fdca37ec7dcb4fa3d53b48b11439ded1b6e22e166cbf273505eb550938e2f2ff832d9b0fec0a86cdd64f9d76511d97b87876ca06a4a967e4d35dde3059499deb7a858dfa7409bb6f5a451aa9dfd17f5a00eb510862083071586aa94be38d3c2462cde18871fccc3d414fc0061a8b24516cb43d48fde325079f8858384410b9fbe01e6bebd0cf45da1fceb1e67a33b995fdcd5cc5f5faba6dc0d605453fbd8d29681b9ec80d908f513d44f5f198d950be3fb1d9b7272665ffffae695826aa92852d1efb516fb46108d2897b88ff686c7c4d7338ce9d5b3ac4bdf0049e5cea29326b22e778c86c7261f847862012e8e78cd66428fa868a1e326fd313636684a5770cf2e43f3d0ecd07082866fdca1fbdca95419ab3386e9411774027347a8477ddbca4061a0dd2a615be9048d008dd090e4d82c522218fbaf8ec1703c14854b58da88becac39e71d548a3ccfc3a0f1bb149efae9862a4a658b0a5a228a8f668a7be5556ab465a0e986d234ae9cce7575ea695be310e8587d53b13b4f889aa1cbf9587ef91f0d779f85324fc91d6782fa98dfbebefcd165ebc5c987f9d84acc590fa48e5d9b8db6dfa4a359557b3aaa903d9454683b56f2d6c6cb4d1e8bc6263def8f4c562ec15e9441d0de9412dfa68745921b2d1a382dacb715fbf171acf4d9e5e4ae64ff7b9c12f3a6044a1b3e3c956ab7bf2aa3c658d50a125dd9ec7e60897277ec8f5e883291c907e364bdbe5888a749daf2966e91185392fc48604739a9b164e99982ecfe3cd68a50f6e28036d34825bd2727c0bcb40d7db621e4f4a4c51ea65cdc14fa6e0b7d760aeb6289f7aaef01bd5741fb5352fe87ddd5523baab5cf30d578d18878d3eb9c4c3d5ea0c1ece8cd013ca8dcc61a3b6c95f2d09ad30b47bf06d1a8d4d6713a5d4452c5e1a87c2c37f3ca9ed5b3cfc5348481e0edee1e1dcec4b6a0ccde68c146c8cbec534522bfeeabfbed5420f08ca84f852351d1cbc4058d88b06b665afb4c6188d091df72f4329c11373c4596ee7863aaaa87cdd4713cc301e541e16304eabfd5f1ac1784de78da8a9b9913926fe8e392e4cb9be60b84fd8d5ef9166b93e4f895c9aa394c4f69b8eb94342f44fb130ed5ec1780f8d29cdce948194b7db43fa69f32d7a89bae6dcf9a882c6cc6c1c395519280c1c5fa131d7f409a6dabfdc02ba87d91d1a0bc396d747d0e46f18272491bee4e1231a4bb67778985251be5e5e9bf0c65778580dd1305b9644be313f6668b2730768acc9c697cd9250aee934cd9e43e329952f5229cdaa30eccea9940ef69f95d2de076cc6ff381efe3809eb32729b777828c6e1a4c8d831b7d23b1e6ebff9b6be991f5f96c4f35f070cad83d45a8307af40eaab4635758849a0d3cbecab4927888810bbb1b17b959463d9b8d970ae0ff3dc1914ce583e90fba4626e5d9f3499aae2f760020646529d938d9ec7981e8f649107c8d1ba63b8ef8ab4145593f542f7198867e9de4b3d5b57a45f644eb01b1d92c936397b2e066ac76c962fd30e14092c0cf44cb5d85dd314d2be65565a30e5ea268a067784e68d486f3fd32f6aa09143236f56b4e3774ea1c9fb543ebdf6575c357d5a802c0bf0351efabca051b07f7d87878d22fd9ced638ab8e846a9680b07bf699684a2918a65680b43f52e34a7d4e676bf148663a17789c290c6e1479d7ff8bb78f8db49c8c05de1fdf8c41824a150f1250fbf57809df346ac94d7f54e481b1171b9f5cbdf352f3b35ed053fe94a8d5faaa6fc57a3c1ea65f60539358dd7a15146a3425fe24bb3560caded01ad2f56a61b52156cdf6a94bf5135c1baa209f45f9aed8b1786398f94638d9ad9f1d02727c5c6e34624232afb83f47c48d11deae49e9fa805c8523145d28f46e093c603c522e5593d3d7354c1319f843bb94e59f79546e01d555059355e31d090b0d130b98d53d2e66ba74109c768e35dbeefaaa9ef314228bdf75557cd13d55ad14e7befbb6ad068d2b4a3afe5d894eebea1da69d9f8b209427064b6263e3d870dc53274c230efbd12865629fd8843d7becac35ff494fe933c6c9c69fdd2d18bbcb3c6f977784803cfea3c2fc9b9a06249feb4d9dc4f9b3d38aa73be02df534dad066b5f30670d8c2dfba47181c6251aade778234dac191a579cfaa311d9d8b8261b6dfa9ba8a995717a28953931ae714309d6b845fdde6c7bf769da8970131bcf9eeee8b5a8c1da53221b77e6a0c83a73b2c5fc6b88095da2d929f7112330a932bd8e07164494c9b68ebd4d881123f04b47a8330583056a25b248b44a79f76f9cca264879456fcd7b3c34ab55cb88bb6f64d544683c7ccd55431e8a34e3b9bf3e3966a9d85f918d9690f683208d47c62ae89e797a1686a3b9562b7d230cab77a6e4d42ba5f4dd8a387f040f7f8352fa5324a471f8958c36d19a5626c99b652c2c096596ec7f4f1e72678dcca45720931e1f6999581e3a2ae6d69ae0fef279c8319f33c621ce6b9af2d0f495119b227b3536e3a37180c6e1ab57b08938fe986523da5d6337822e9c41cc3db5a39cd11b23731cd50b424625fa7218720ce0774df2e7b971b496cc31ac2b73aef50537c88bf239b8e43e0fd1789789ee94ef99123bfe88f906cc532fbe5241bfece7a12c0147681cb35293cc8dda9a7f7e8387364e58b3cae717f250ba5ac49d10f51bae9ac609d9ce41799787a768644c82e81939d66b926cc246d13f8590b635b204e59f9aa07bc6af3c0bc3976ed2a5ff56187a8faf2b794fad1fee1f60e3efe3e1df210ca535dfcba4e14624732e97e85132952dd8f47fa41c3a2917b49d6a4a3fb83c95e890f2676df5dc848df252b2f6f7a07f4d296a679bd1480d629cab546ee57ac7e197c146f7ee9518cd00cd10cd179aaa8dfeb38ca771ab762a246454a5e998d418de1009c9805ed59cac2a94be36b49c8394db377e9d4b52ce9dcdea1579252b35f5e902dd5df26e724fff868ea2d5e333fda40f6d65ca77b7598b71db8c919c5b8f28fb4db841474be13b07068bd814a117b4df9387c794751a99f80a151b1113bea9bbbec7c366422275a70c060a15a973fad451453652057dd40f8290a567bcac73a6c230dc71b7a18d197e290cdb7da394be340ea7ae7da376e3bf90873f4b423a69de739626664bae4c269bdc68c11f4b2b25f168e6a94787e2ae67323972c63df0b2d507e4a14c0bea632ff065a0f4631ed640be6ee69f917e16a90f4c77198f8e8859697213db9a6d738acb02cdce3b2fc5ca038f1a751cdc1877ce9339d7b16d94c9d01cdb18d392ec46a4999879425169932d15ce97c7d409f7341dd4289fbb33d24f56ae7065aa9064b5cac19b4278cd2e9a3d34fbdc2a41633b3644722740ed995df3ab37a723bee561deec24ece1bd50bec79d4db56f46f3f33e79d8c3bbae1a34078c37b40f4d458c803aa790adbf31a5130d27ed0769220919b86f53896d0e5f9c63f13a66e8846178f5c53a3efda2fd5d82f10fe7e1119aa3f7792892707c451e8e4d442bdca039feb177f69d6a6a3879436af58c9c943fdf50d1e6bbbfe621fb41c0e6c4b18e97e54cd4cb215a7acc542293dbbe6c3649a0394573f62af4ff4665e5664b63000b7f849622ca7a4516c31e24dcf120eae52243a7eb68680e753ca69db9be66facec8165c1db3e8e3c816a4bc632fd922232f63805fb6a634592396681ab269f1ef17e740490f8834fbb68928fd204cabbd17ca97c6f5cb3a54bf9e55434f4ff2aeab06cd358924c2ad63cacc3437a66e62c092a4c249d704115cae11126a024dea9eb1c270da4773cb98e12c54cbf0ad87c67f8f877f979afaefe4a12872fe2d279928573b93f556effef8193d66de505ea1b97b2658df9aa3af79281aa9ccb937f290a4dd270fadcc9426976d1fad6c7ca6a25c231a9de8726f7848f595914c7eab9943338f66e1d9a7fa663387a325f71fe7b5fa38cfcfc9d036a67c5b52a1b5a7eed8c40691787299ad4329c4fb5a22ee97ce986611cd92d90478f9aa0e2ad9985291dabb4945fe9689f86876fd46e65b5f5091ab55c9ecf7fd1a0f4d78439372bee46119cd0a4925aae6f8864ca30f46085945b346eec99ff25766bda52474c58247eb678dd491309aa539346fc215eff3f06f62e31fcec3e9fbf35226dcf2c8d450cbe88e9bef440e5ff3b06facbe661dcdc633bbe4c5bf544da50d4c6cfa0d152dbb7cdfa9a644e4af0e31aa29955e6ee3bc79c54393d8c5c710a16ab5d6a64c8b3334cfb9e77831e619d4cd6f56cd79a917d882c8b6baa43b5ce06bc4a3c9778966eb0b50da359a37667db9258596c11715c18d6064fe6d8b2ff86d13b1b4249f656d7ad7447cce7dfb8acb54d638d278ff1d1eae6bd42aad6acae4980b53a5c610d235f92bf3d70e58fc4248d8bca36bc716a1b124ec0c95844e237d2776ff2d1efe76a3f1cfe6e157b7ff4eb99bc15a3b32ff9af73f7552176740798de6039a8fafa49c4c2f3aebbe504d99d1e6bfa39ad62baf5453bee0e533d2b3e18dcbb73c94bf0a69b9c1ea4979680dc8e6139ac24061c281296ff56354fcb926f73f44f3086d13746d1ea37982e629cf57b4b533ad5f4ae4951869ef56e6a7f7f8cae89cdf3411e575446cd201f69e6a5a2fab72fbd58d882bd650dc3ebd270f33a493a897e3c06c5f3a346aa721a46bdc51716cfee980296cd3e41509df48c2f74988342cfc2354fc0d82f15fc8c3d01c212af692d84ea280090fd7a29364d3579a7c372f891c683cd097f0867242b6e29d2a9cae5118f67186b7a05838321d9d6aea594fcfc93342723e1ae7e1e53baaa94c7469325fdf3872282d8ded7ae651427ea9964f4ad8deb1d2dcfb06de05ce7c9c05efffab68bf6721cee4cf186709a6039cb55f5573a7f00fb8f9483aff5d1eca0a225d51dae3e76fb96a7c9299bb7edfe3a1bca3dce19db251290f85edc24361e3973c3ceb30f82e223139a0eb45d8d83115102d276d93cf82c83fd968a1084faab2af49c862505f25e18ff3f07751f1cfe521b7ff362aef4c26df9070b3a699349a50073beb3e93507ab6ddff6e6a127fe2ac47da084f9cce29cc2139976ff929443aebbfe5a7583872f14b6f8df561bc14924593e62674b5e2f1a56aca485a59c5e31b1e5a6d96de8e15ce842a439c8dd815a2b54a3b1bff8fbc336b4ade79defe8bc97917fb7208ee22fbce19b8032ea8a8f8ea9fbea62793c92420e2f2bd7fffa76acac2881893f9a4af5ea687aafc75114fdadd21559fa8fa1c5a8ac5f8556ea8d2a4ea0b55970089ff65f92babf0064128d353a976febf6239e4d7f897954015a73102a1129c238074d60d0abe6d0e9952e6102ef41a0e518a34500b11ddb6c2547da5db1c88621377a51cbfd90a400a9332f8359b41f621598edac5dc468e4a96c21b6e7c646f05a12ef457e33b34febb1c52f58daa7195a5ec164a3cf0e254f5146d51d54f424c2aaa24e2f4b3980dcfe30fa07590d01c0a8a3c33aa256c781256a1ea477798584e5683a7235c9db935466a0259d29427d389ea07e148536600c41ec670c8170a29909952777e3eb35a468382ea1e55f7a97a40d543f42838cda3f89619ab1ea9ddcb5ac0af7a4cd513aa9e52b542d533aa56a95aa36a5ddf5c064f720f783dd266592a16562a43082bad58754335fe60cbcfffe694826d4c63513c517ee03cce1ecaf2287e08ae599baf7ffdacaba481b3de628a4cc36206b44e1fd160c61ba90a9b14c0e3c12f78f091498a6eee6139a578cd865045473742f8b97318e5f03b34feaf71c8a2f4a98d6d09ef0bbac3e2418ebd294038f6d4c62333bbff64ec1a16aab27d6ba23518a308186c148f689ad082d3468edfccd6cfe613d0925a3f9e08a883667b098ec8c09199cb21cf66d47fb525c911e250ac655518b6ea0acc00a5475465e4da1887ef54ed50b5ab468faa7d9c7f7510ba71e6e6f2ef82904b4dbb1902e4878a2de1c45a7811cba1807a920d6feb1d328c2ae639c763ae3c8e72a831e3471e7e714da806ff6049f52871381ce2398bb5f34f30741355a486ac602a18fc2d5b4b6978a117daabb5857e5446c9a5cd8a69770e77a3f11fae6bab0e637a168e1fe11c5eaeb0425c76a739bbd17431879eba49f0bf7d0ecf637a8d507544d504f45535a99a35581c3224acca0e1211697a05689d280ecf15369e10b786bac811ac036ac324ca871b0e71dc57b6510e5147de068ab11cf24f11906ce80b655f5ebe0b13e5b8b27ba62becc21cf2c0a3e700a711e550c6d85f3321aa550ca3ed22f263053531498bc3108d008fff10707d8db18708d5cc611257d1aa1a5f9aa232a9ad72ad610eb14cf451af1564a9594d2100c3ee9f3009f616ea5b6506abe950a65e27093f5f4eb1bd73b801c52f4553ff650e3331a2f4d2436de451170b88d0daf4892aa54094c2ed3ec545f773b2ea1e84da1c50a54c557e18e79468bcc35c39b5d429e0998125275121b55a3c339c442203664b537ce6c83dc2bcf11f42623acca1e8d82ac570284120348998c770c817e7504514510216e190079386ec42229ec31365ee98e4580ed90cca1bf801217ad5b89146a9e2f35b2a9e19e1500da088f59c7c7a571a4b87433c4ad45dde10aa41055c3252da76a91eaf2d40c52273f20a1a792cc754cd63f00b1e6206a5ff5a90a6df7241d3178ce1660eb7378cfff07a8b6885f7b5da3c78dcc56a71ec82a6b6b33c3cd32e9f7078a1f6cdf2d9a36a419944db1816a94654f3b4b0dcefb9d294ad416d8c691a95a63cb91d690acbd00c62a458c6fa2a0c041c0a9c557239648aaa2a498018cf853bf0179b307a510e3d49998c7032b11c4adae0f43096437c8b297ea1656ad41e4e942d625928b11c83a20c29eb630eb193763c87ba088e1d3c349b19c570084adbb84a6ec1b715aae1df45c4959cbe1828c060eda3d646d0ec4359bc27b87f672b3df8351378fffe251bb8b331dccce19634fe17eb80b7e4f0b0e472f8d0a2f7155ab83387ab6b7f5bd9a4e6909d43bee817e209b4f441753f824bccf7af36a1dab9a64e9073a4294f622c458d444d31f5ef5c690a0977174a1b626bdb67606c38e4f9ca735a78b339844954868b4d659443660ff192927eed700859db5239f7380e79f02f1ec882c9883d04660d55d4928ce7b0acae098b73a9d77338c450e1507e4f205913110e95137bac7cdd2887fc86137889916cbee150addb38582a7fd2e2b0c60faf823689b89b97eab1ab6ca3195ff00363c742a9df3f45f15f5d8f5fbb727b25de1de89ed9c2e1f514f5cab56b7105b57358bbc13d600ea7ed780e6bb7549b526d16a850788349d745c483fcce8d9a6a1959721389f0fdc23152e90f6fe72a98344906381c0a4e558ae150a4a9543c4775e97e573b69fca3580ea59c1a65ae711cc2deaafc5e2c87d0847baacdcc753c87680afc8aff5a42ac663f703b6c035ff19aafad3a818834e56ff9af2312935cc3a12a57424df928cce19c6e6aca6a9d086992a9c223d88c4f12129f8852b5bee4e739dc4ce39739fc239358bb73db619c174020f6337903879779044b6bf7be9638099c43e61029c4380e214a1fa8f6187028314f9835cb21e4d7ec223ad214e1d092d27b89d0c1b3ae3e6838e4d923ed03ed1829ece1cce510b6f755c316b587423ed31be590876444f81c6239d4beeb553c8700f50267be8e43fe2878ce47f11c2ec505552b126d0e83f8aa02122b27daa608cea5117f62a09ccc351cf21baaa41a94584d316a0bb4877a3a0f4ca2dc7adcfd213411bb275b571ac78ad25fe5701d8dff5dbfb62f71681bc3bb7dcde125abca277df9ec208dde2ac4e7b0f64cb5177f2ca9f60a42d8d4d4dea8f64e357ec4b25d2df96f28536d8f6a7cbf0fa876188653c2a1cfca677ba3d909d58ea8764c357e71eaff3a7f4e856a6754ab52ad061b683834aea06d0ccbaa725560732094213db06339145bca0f8b580e7185958fa7a4a9cb21a2355990665c4487437e0fff2e9ff33a0ef934f8d7a5462f86431559955c259f6134ab81368a43adbad771883710e9456a620cebd800ebb68a75bd2a122e7929a0c810f21cf81e84c618fe368751147f81c31f41b1da0ead091af7b43164089fda485db02e9d3c51ad11e31caaadb3d670d8a45a8b6a6daa75ac831b46976abd90f5abf5a936d8ee77650c80ae24f4459a3a1c02bca5ceda3b1c221ea3fcb4722786435ca5928a49266338e471a08aada5898ec3218a63e7f829ffad580e5147da80629f5c8738c42392f5ff886a09aa25d5332b45b574dc3f5e568fa40cd5f89197538fadb1ea01eba3c806f34c55e4aee390df8095fb647198c7eee5cca157442537dfe8cb7d3f363e068ddf82507b86bb71b8038a368dbbf411fe3193b801c55a219cae286945ca1c22647a8fc575574c4531e41cc67258a76072d43daa8fbf4291fcd64473583f57c6f3abbf7e41f54b5d54c9bc4539c4fe2a8950f6c2d843fea327aaf2269643ac4b5071cb0887b8475a0c27e239c4c5bf44d8691d87381f9500140ef957ea5754bffef2bf1f1a69aadf307bba930d9f3f9316da14d1e6d0c3a3044e35423554bfa58f11467d8ab5bf6727585a3193e4840ecb7d0742a348ff924343e3260effc224ae43b13e0b2044e7887c00218ff7151289f539d5ef629c4397c3fb8d903ce0695d7fa4fa428d27aa3fc73de0db08a24e87915fe7b1a4fa2bd5dfd4afbf43ebd657915f3fa5fa878ebb38d214e0f9b045399495078771ba54a4e9812a4888b587fcad14793ab7553844427f068bba8643dce583a4ce22f29bebcf9b2ee3971f4c25b5aaf8423cc0351caada7a256b1587659a5c6283d10f0f1d6898c3f9082fce3f7097bfdb676d6c43f837d2d41e3b72f8eb28da1c5e0fb02fa22852865036a64793bfaab4400f713826d95a593b8d6b392c517d4fe7e531dddf42397abef7f57da5b8ccd4b956faca9e4c07aa60cd8fcdb0e9387cb56abef9130e2db7f305124eba7746a5a98a2b86a4a9cda13872124175381469ca2302a1be47675d8958c67028c571a6c02dc61e8ed509bfe23584a8c3d211d58fa97e42f55378c2f50ad5cfa85eb5061fa9e1d9c48f3976a4eb75d730f269c30b9585d115bfd634cc21ff88ff057647eb0db5af285be613ec5dc1040a87d2261855a63b0748e321fc8f38fc0d14b7e7308aa2cd215ab6bc610887b2f9aed7a7f767f1077479f7c761c0e1c593c56133461dd586e1dc8314af846b68d8d4ac7323ebadd0fa26899a4acad124f401733b645ad947125750f0abdb1f3e0ea46908c2579d42e0730b206c5b67d25555781701879501d57b2a50b4b7c673b3878a4bb1ad6366706216873ca07b55b69d2d58f01755cfb5e54453c4306f08d5a0c14f0e5e2ebf4607e163eb730ef121481125fc3c47c54feb5b9b758b3daf0fa048cb046378778cb617676a0ba7f91c0dda6e1fa89ada0d42478efe5fe4f0ab28da34d6adeec0e3071843db1e9ebf60117065121fa47938ff84439ebb4e8e9e01d87b7673f44c573d620730deb5590badb44860769a83b2aa98cd2c5b86e0ef26b42b28a0da1ce22970a0a5a9c321d8533986780e93f840ac9c541cd6d7454db6918b699cadcde189ea445acf586f534f0a592455529b55f07f64b288b14ba52a4a08a031540217c47e1aa2777343856a12a185c5125095cdba99e17a96ea39f20a88d04c4fd0335f38c4968673d843f4d87fa6c5ecab66d00ecc7c9fc3efa06871f88fa0c8e3681a24f1d9399c1e8438c42e7c2bd8c3a79ee6d009d2a8aa428bc37c78b625d47477cab8932a78387039c42428b8f39599915a169b43e68a359e1c9444854c62b4c4b58c002a570fb434b5394460f3c25deb6438e4e92ed5a4510e6baa8ae05065f3f9c4820ccaaea35e341ce2feb27a84d3ebffb441c1924559e52c1ee6060ef79106c447c9fa0cdbc796c206bec8aba1b3c03f58b8787c450d8f1a6328d28b67d8c3f1b36ed626dd4ad12bf15d2dc37f127fe413092a3b08adc7ef7f92c35f41f1a81a6c008c9ad202086c4c749086bf7d2c83c3c679d35e666182340e878d8bd03c6b5cba108a3dc4a3fdcd2d1fe5af8dabf04c552dde94df15234d91eeb38ad75046d3a28615636cdc28a537733994d649fceb538ae150d61089348d7288751b6af57ae3d63a5e81d967ec8f9b088ab01e467d6c5b3d6bac513f578edc43e81771d37d1711eada7a8e9cde85960e8b83ca67b58143fe1cf97f8543fe7073a3f1d3535cb7c97594439de1e00bd29852630602d9187e289f7071ad396463383d43a7e0eb2c16e6a3ff4565736642558a5ffedb1cfe9249fc2a8a8d79d0fafafe114294f11363b8f7a8396cdcc9568731411a97c3709ca6f110c3a1a02875d5f641548df5c21ce67411a9c8c8d04a8b842e16b3ebb9f948e3d1b236af4a89295c6d0e550d9a82edc88550b377a1daba2463382cab04037f60cd02a6b1d07747078112a1208d09d5f0adc1d2ca25bc3ef3bbd882c297a6a79227341c26421c4ed42a4a3eb88143e93cc0a62f669dd4089f76a63a38afe3b0f1047fa1f10c63d8e0ff6b490d7ee2bc51e35d1bc327b5cbafec6ae88d68fcb4c91b045dffcb1cfe298aa7e360e5219aea167c4ba89c43d1a58d9574d1575514af88984d5b1a429bc3f11335c219bf93b8a66c3c30dd2fddf2516689e7a89d33ac4ffce5114bddf02288915ee8ea67c3e1892ac2ac5953bcbed4bcb111733814db72183186c221cfc5632559a31ceeab02319c6739f0f4f45639ead6a02227aba3a60e87889a1eeaeaa246490f3ee10fbfd91c7f78cdf20f27d7210ea5258f08cb751cf2182bbb8acdb6221cf290ee24b3985e8cd4e007ae0a5f37f6b1e57de340ed0e708eedb11a87d438a2c631354ea8718a9e34d21c71b261af98b140f8bfc0e1efa9d3ed693cbad43b9661c78521c0139328106a0e2b74bbf4393c454384a373b43f70385ccca87116e2d06933632327ab10a2e5dd0d3bd692d4c82119d80e49d372473783b0ed21561b4f2d3355534d2e4a60c3e110ed4c1f41f2346ef92f4eefd277651d7b3851667ca0ea57e460c92c3e5479c223fc74bf1be2d054969e26f44f9d60a970c8ef44e19ef973ddc838560e70e478bdae070ad65f61f4b0363f11b3540a953d0dbdcb88cb619d1a2a90d36852a305089ff9a971821ee78f1f00f2f602fb0e34d86de9508395540feb80c76b43a35fe2f02f43a65fe0f0ef503cf42b4bcfdf5056fad0d4281a0ecf7942f735879707aa1190e210edf4cefdda6e15bf39bfa086558656bf8e8750702aabc51351695ab33844d1e95c77fe9640a52d4dc1492b244d99d8869dfddf572d12156f0e8712a141b0e7317ecda118bd587b0851cd7fc88aeed61f554598e2f0c46fc01135862bb515397f327f422c87481eee1a8095c1ff17da9f8b4318c7211fe7ff8bff503454d3485023498d1435d2d4c860af38ec6a7e85ed3a5e736a53d71a985c5e604f01ef921a8c2e8bd83c350a1b44e9ff08877f80e2661a0d87e34770f83ad4f8c940478c7b6a1475129f9d4369ddc5d2f4f11806d07078b98ffe084dabaead5659cba196a617312d12514b69e6f76528407a60ad339cca2650972169cab370cfae44d90f6a4a9b9e6b0f8f5536ffac1bc3a148532cf8788de11031c912359d92bd8e2af4292259caa77d5b64a791c627d49ca8c4661b0f827a068f0979fa4836dfe1b0f4ed18ace439f842d9ada56c0ed125718929e170d83c473ca67941cd4b6a5e51f39adece6832c06e028f254038ddc7f6a9f7f718f36bc079a3846bf3869ab7d4e4e7d08c9a73abe8f4f27f8dc3ff16c5e69d5f565ad01c8a491408c121bfe75e6d06a6383c7dd4fdb998c3db67f884c2e1d339f69a6cdac1c0cc260e25c27910eea48880cad2e270147078d6d52b0f6d8790a7141fb4a52993e9708810e82c1489150e459a1eaba6a6f16b7f2f7467803087b8ec224d9b8fbba0829185a9671463382c85ce3f3a9a0b8cd81ff138562e226b63e9c518e550ba2d63e185c3e1133612bd7da2e6b3c26849ab5b583f3186b7d7d8cce36e0f9ddd91c7ea6156f003faada9b6947cc26e59fc2bcd576a3299efd45c51f3834eef7f95c39d515ccfe1dfa0184b63b3a49dc3f103387c7fd728cae0d78b0235cbd4dc036cd7fcccdbd71ccafe929357b44b40f53dc1756c1e6ccba1387e48213442011854a8453814152aed6d9c36c130898980c3c3579743668cb56bc332d486431dec3972213cd6893815b089ea52b5e010dd2ed86e1c224eb31b8dcd23e5468639b46bbbf960a4e5a97a006543fddd9c38cd4c55fcf0994b36df6da531c295440b0cab3771f3989afc810324249a7c132b3086e3398ce1fc8aee73d8c5f1a548cd3334d1643f85096c56916466e7852709cf99c73d6c75ccef6729dbac611bac669d9a0d6a36a9d9a2669b9a1df45c6ef27ceb51b3ff7f90c32fa3e8d0785856a2b48f4d54aea7b8a0cc9e3df87237f9d93f544ee0a9ee6069389cb6d0cf6baad218cd11352d55595b0fa149e8c3c4cdc21cc6d943e9e0846647e176dde2bf890c2b7762383445a4b11c1eabca6c533d63735856abec19c5633b23fa165cc02ad6b06bdbc8e7d94ce20952676392a2661aa351a366064b2beb4f4836d60f903974a0adbf47ec6125f8e971d285102d4f55f55939ba2546c021ce8aaf09f284712d6d70d1aed476030221b39743a2c22b204fd8cc53b300cdc9c670baa7b6a353c6904ddf4303c6902194357108e6a5304378cef0131c8b543ff02d160994e9ad43b74318d57bc5f3356bd722b50849b296877d290f9ea835a6d6845ae73cbbfe190ebf87e2ee34b62e74e6902f225f4abea66212cd68f095bac4936cec216dc8cee1e969c0216bd19b3b94d7b0a3d8baa296f538af472a696c63286821a06a558a6ee650fa703abdbae1c8d1271c325ab5760c877c7cac96b1470bbb919fb850905b4f96d68d5c3a5c6dfebb2759f28bbc9b4e79b7241824646a776ae37f64662d65662c4db76fcda1953fe4ff25caa13878535a03a1b2871feaf4bc351c225cd408b6916addd2f414556cad2936156dcde8f586a665bacfd26b01c690bd4151a4a8e8e80510b2e7e240789ec76e28b21f56e50ecb74d860de26b06bdd79169ff9a8b6b2835d3dc7fe451f356acda97547ad7b6a3d50eb915a0b6a319fcfd4da76c78b5d39945dfefe111479b4963a48b3542b9e5649d7243eb5a9f54aad3788cfe35e0c877767e093696cbd536bb589c3508da8bf5385740ddccca16056d9d3e904db219c2a93250e67596d8f11e59091b3eb36112cb1d2860c1bd3185d60b1afdad28412210fc1753b9d4b754b3c87ba3f5dd7e550c2a476d14feb23c46168c5534494f24035f623864921463944365f953db44a7876c89892e610eddbae706e620c5b65fa18528b9fbf27d4daa7d6810ac0e4b4312c957578868de151176ea1ac01308a94270ccba8e901a89b0cb134e7bd885d6bafced0035e7683c48690af105cfc090c36fb9cad436a1de1f3a7fb9a6afe109e840c70eb985a7c26a7d4e267c419b5aabfc6e1ae28fe0a8dad1aca4a5fee711df991c6cf36c724f2356ad5a9d54086b05a8028b539c47e40a7689b77c57aa349ad96cb61943d7b48ecd15ec414e530a4422f42bd49a7a4730cb2d3d33a0ee1885a6986c65500219f8074958fae7212695aaf05bf783a0aae9b772dc1de180879483096cf279e432bb952ef8439dcb3106dc7700869dad1b987751cce92ba5f965d1481cef97e93c58abf1b6cab438b1b2c716263e825a8d5d5c6503cc3ab8a56a46f96226508f71ea148c52d647ec418aeae106238cee9cd212f4b60af3c4487b1eb81ca4efb35ccec043d97002ad38bf4581e9fffb1af3dcf855ae2c34678c1cf881eb5fabfc9e106143772f8f328b6d4357a684154088707be3ae551bec1956af10d1b8143367ac2e1e9a3e6f0e61e8944760ec16122c461adf30984a236a10c2fd7c44b3321e4d0cde930d4365fc2a188f4cce2e33476ff0be37ad555d37ee3224a50547f54326c0f1378b3feb48a8aa39aeb96542535656a2e5c0e85bd03d505dce6d0ac39ac5ae2534abd030eed759869bde829cc21fe9c6a97ba9ec3843ac39b902fba6f381ceacbce6f6ba5a0485f8e68b9a416dfc18c3286efd8f3d83b84a414452ae199cd8a7475a9d6c715f14c6f65b5317cea00b9c953fc463d9f8e525e0526fe130e7f08c56d696ce5d4dadf0bc8063689fc7813696a3864f9f1c6f630affa73bd82c3a373cd2113282fd8395ccca855087358f99c4331899565204d6d0e6b87210ec5e2890ab51b04e3d9efef5dc14ffd2020990e2df66d5a91d89a8a7606d9c2816e136c0f3ed22a06bfd2a6d07543df2af9510965b1510ef924cf549223ca61cb5e4b15d6a5b0c0762ce70315e4c76a5f2a630fa59f4de5622d872c4a91de2c079fd3b2b6194616f11417bcedc13364457a9386286d8f11e77c4dc318b26768361e6745badf82228d85d028d2f60410b2316443375b50a50563c88af4b2b8d51ec9d171cd9f79fe9bfee11fa2f8398dcc21bbcbac28f852429ae60393283482c326b52f6238e4af92481c3f51fb92da57bb70c8e750a560655388c3b7902e9d2a8f0b4b19aec25d4955b1a8ac6fb239acf7431ca228d48a46d613d09c2c11a577f8c18b5e6e8f00e9180b2342eb688f10f9b0af5b288f9f527d3a3ef02127b2b8f1009fd958a876e3077a546748f1873a5f9d86da254a87a87ad88e19da71c20f2a18fba843b278a1068a90f6a97d8d2e21b15d6dd836da1cca0658ed1b1d9e593d61d56ffb963e1ada189e3f537b1a1843168aec164ab5a3ed161edd21ac60c233acaae0e094d4d6d18fda18a2fdf44ec6b03dfbe538cd9fa3b88946e67032c245640e214d1587621265c045bca7e33492f8676f210e2baae61b3b72a5a93da7f61db5edf516db71283d638c950be9d28ebb899a54ba9c755d0ed93ec8c113aba14673a163aa4682b61f42abddb71c75552e675d345c4fb427dffbf247b99f7c183286c2219f2732f5dffbe4d05f2928b369b70057ebc8da8ff009d9184ef819ba4082818de16a42f336d20cf30e3c3771db8c5b28c690a74728461a09cff08cba7fc4f3fd92edfff52e109ed59b2f995f0a99c671b819c53fa0b1fd840718385ce09ab2cce0e79c83222b93f633387cde8773281c4a618dc46cd84eb659b92dc31c7e6cc5a14853c9a73b1cf253bc9273a569e54217d694edee4f17bab0e6d4129f3c9bc7e3506744f44a9a864a433f1ffb5837c89f13e61017f3f00d366a773c1e54cbd3b1cbe14a5581d6dfbe5b6b8a51829c463569644b0cbe146dbe6b6f688e78fc46ed7718c3c70f9a3dd0790e614c49183e96113b59e7168a226531755f74c333df51a487756aaf7e2f85b886c3bf45d105b2fda1f6fa2de26aaeae7416912fb4ad4e5999b44b210e272a7b613864e7b05dd630b7f7f0b127afdb4238557ed7a14a0f3a8150d997cff10fcb93408506632289f5408896559925d619bd86a2a3a76a1bc6f63e72e8303b1fe152323577f920ffa88ede8d2a2872848fdaefda10eacba82b758ed40aa6f267549c6239059a38bd2305c2ffbb64dba31cae94f93d4850fb0020f1e7b70f556f9b8bb5e53b389e8296c699f36f1d21ca5551fb4c45b7a6691f539b1dc2536a57b0d8b77d46edaa4abb4f50a7c6c670917715a9d439da6e2114e932ac480b3f109e59f003a2f6aba9fcf51c7e1bc5dd696cd7f10c6351c17e3642358a43631205c5a32eb51b6887b11c033cd6a218297f77d83a5288eda6cf614b135eb9f804bf5020741e2a1f152b27fbf2496ed000b6affae122876e71680eda0e6159ed3953ee84384440e830a68aaddcd19d328ec39bc9ecab427059a918e5f043ed8ec8a09a088d33a40c3db6471bd28c87a16d2d429dbc55b69d7fea242dcc38551d0cb08229122c9581561a4738e7180edbb47f888748bb83329a36dfdf1ebd66b4319c3d861286d16c21bb85b18a941fe8ac48b5311cef680cdb7dd4be6d5de9f6d31cfe5728b607b8827c29c5455caa1635c6248a3a6565d2e69b3752fb339feafd996567663189e030e17398d41c1e277507a758f61cb5290118ec7c980c628cd24d90679b7d9550ad229ba8cd035d2a98554d918d6f12657b7a7b85a1bcaddc8974ce9fe8d5ee91125c9c0f56212762389c5c6bb3c63ffa885df8ab4aaef9dbd85e89d8ad71be767b19d917c46c8768776a4355da353e79355ccb21dab7eda992eef08e34ed14ddded17e46d94376ecf945965e07b4c8d15b8d6e8e600cdf2c452a6e61f926523a1355a42a3c2309c3ddc23307396ae79c851abfc36179fcab287ed963140e5957084592cdb74d225f7d76d3db796a17b0b249e4a840283ba4f391698bda45b56fe90375acf8beaca9dd667ca84d20f0fc0ecf57d91ec3d9a86c72adb76d3a4eea72edca05fe17a12eb087b266376773a8fcbad77067449f43ac545cbaf6500083e2cd91b5e96f600fa512c08bdc2cb9a128255f2ae911b587278010027b1cc3e16aa8174ff2f128873c26c2e1682d8733f53f328a3a48e373d8f1e8a94f9d317526d439a7ce05752e5177f671469d2b650cf341c2709d5bb859919ebfed1823ed5cdb0ba60c8dbfc3e17750fc691aa973838bc88f347111259bcfc2c3e6901f8a9d5bea4cb13373c0e1871a451c613bd999e1ce75e6d4b9b38dc6e728b269e213e6d936559b3785259ca2abe4ce6369012833582ce4b16a82845d229621eb57b9d0752d666553596d9f24e438556c467fda109a078aaab97121141b58517d74a210cadd94538a42a8777acae1a362b797c17f7485afb11c96de74ce730387f204c1c20b1fc277be8ff76830b3e017fcd07ca4ce02c6f0fe0ec6f0569592ea7a6ea5480d8476fd9a31862ca32a775a917e3f3cd37aa0936594c3cd86f17b1cfe098adb00499d2770c857f35d385c06d27475ada335fc50ecf0b3ea45731840f8a1a529385c22c6dd79a5ce9beb82562e3670a826b41ab01e0335ef2de4641b2348d0b03d11661cbd073f73663b84aef50bf651f35d416b68fd59d98b72a8a235680e10c3a1a4ecf911f011d70843a4e9692278bed81c1a27306a0c97ea3ac89a2cc733140ec5454479da3a0e5563a8b1920f81317c47af27be6ba5257556d4f9a04e09c6903dc37107d564a69efbfd0d6e21d64fbcc7242a4c095b9030ec51a50a6338eeef6409cbd4d98b85d059c4f8d31c7e13c51fa2913afbb88eec673387ec73eb6cbe254dc16101d9a4ce01f4a73186e53e06bfd01c1e2a7b7844d537f74f602a77e2398420f4a7e66aa8770b8e6ed309072c224d9925efdabd9e6ad322ed076a697aa5e7ba19a281a3053496fe0c1943234d51c51ab7e9efb1ea582555dd510ef97f9702b7d85e18e204cabfef70b81aea608c6d0fede54e52f48396506b381417f138a97b07778ea9dc4343ee490a26b1c377ff541b4359ecfbd684223dea6a456ad616da101a457ab00084d184e10ec6f09afde1c20608a38b897f94c3cd28feb4618c05923a15aa3ce3826a1771a8a5a92412d924f2b3901f8a2f45ea9c051c3281f33b0c3189932bea5471f33a35ead46368e739ba19429988e58edee321842236698993a65731fe24c2a1477ce9b4243e561d81a5f985cfa1326e09ab33a2af4b25b62435dffbee0e168aed6cd09acdb9b0a8b6e9c440b852a5e1c2b603a1708893bc52ef0c43687a964ac14d2c8713b56eab3c8e17a5b08109ed3fe3a7cc61833a4deab4687145377ca7dad4e9d0f9133cc3fb9c2ae9f6ebb99130b4dc4214731bb7707dc2d0aee7fe9a31ec52a747e3631e5b7268d3f8131c7e1fc59d68344052a78fe7596780cbca1cae2e914534d2544c223f14efefa933f439fcd010f298adc0e1e331754620b693a04e32def03a8ea203a10c04604a815235c8496ad1414e7cb6a834e537cb416160bfab8be61c697af81a48532344259720d576d1c4bd5af81703218c7342c7455d63a8ce4a7a69c736a4514ea00a11c77128c198c9753c87d2e47bbfbb9e43f53ce23fcdbfd8e67b9442e9cc451b8df1610fd3a8a1b9eec11896cab8c5e55b881aa348d7b9853f1b9eb9a8502723106e407173438d9fe0f04750dc9546eaa8d278561741a866a94da2e1504a6a3ab9180e61128b681ed5516feeb0492caed5c0958b60d3a5288432350fd4b26057bccd61529c2c9ca850e1d91e62d042471e03696a5cc1d3c3409a86384c88fe74eda1c026cc38d77035d20577fc66d718aa7f734ada74c770a88a01f89ac47228c2d55bc3a1ac819282ef351c6a61cf5fbb8462eedb2afad0cc87d4f5a83bd66152ac096c05094356a40642c72d14456a270c837aeef28e8ab4d9b1215c47e336ed6dbecde1a728fe1e8ddd0974055f537111a5e0db4853536eca72a57b0e0eaf525a945e6730449a560ad4bdc0ef762f1d0e1d0bacd3ebf83602a14853e956ea36143c65e4e2a5e978ec1e94b8883de9fd6867284b216c47b3142806cada4b9c42290af1031d6328038504af311c96c73a83e2fcd7266d58eee8a8669443d1ea530a5c44a71dc67e573b90eb38949636dd2bea5ec318ce966ac79801756fc87b823144e78b048ca1ad48e3dd424b91b280b213861ff51d1386dd5b6cb718c7a143e396cda6b6017223873f88e29768ec4ec1210b0c961952558322892b375ae3f5a83b0387c639140e79f0b7c2213f29bb73eade6dfa73fb6a9fa958088d1645cc731263274f5e639cabd370e3333928711d3b2ce9bb762114a5fec649dcaf46ba41636cd69ed1e55f897288d34ee8b8a80ba1bab36c9311228a405842584b67021d0865e09191d02ea20da170b81ae9874e3448a3874ab176efa9fb803ad2db3b6c53c134761fd12378f6a0abd84c3db73186f6b22603a109cf18452ae199dd1469294fddc5660e0d8adb73f8298a8a432708f15514bf44e33640769f10ece2679b846a10325d04d2d42412d967e83e236fc11c1a081f26f82a2e62f7054fcaeef2f3bf28c52222c962a56925e74a53891c229916793fb364773d13eab4d5b295ed910e4b4e64976c61b2e116d088b094bf155f3d9308aad83ec2890a59f62132d5e1b03cd691cf380ef153d9cb2d9643fe1cc93dc472b854db989727f1c6504235fcd32ea3f886dd452f3ad83aa6fb4edd155a39798728e9becf07256ca68854d7af596ea194b099158676c27087f0cc7196ba1f0ce1961c7ed5246e08e1f81c6e46f1670de3a734764b78aa3187d77d1daa8995a6fc98ec96a9bb177078fb84c128f2b7dd7dea1ee026750f3f81104f6e2596d6a1587a931a9490411369aa77bd0ebf591610bbfea44f9d3922a905f94c118a65697f1896a6c61be4130867edb534357ee0475c3529b6b549c640f871a24b5b27d72e84522e23b1ab28877ca156439d7b58bbf7a82a1e5a6b0f47d43d82b8ed1e6373dff3264c62f7043d825fb3da18ae6ea04851cf5d088a481db7d028523b6128e199dd12865dbe98e75fe270e756a8eb39fc3e8a3bd018cb64b702892fa11a7611ef7d1751a4a9e190b50a383c7339e4a139ac2a0e6b9f708809a4ba684a10621d8dd21ad03189076ac7eca834051863973a87e48f9390912cfb853822779d84a11015ceda6b0ecb63bd163ecaa196a6f3780e459aca3f15e5908f8fd5db1c63283ea138d5cb35bd12e5818282ef380ebb75eaaae63ddd2636159df3911675dbe8d4c4c670f688c4bdad486d084dfd9a2852e979611286ddceee2b0cc70b51a45fe570fb98cd86ca9b30873f82e2ce341a20bb5da80bbeb2c64534d2d4b88892bab8dba36e4f074bbbec0ab2af3fc466eeed233dea7c834768235f9dea604695707c7ca236546b63ff2679674ddea652e7663a321268043ac64ed7fc51fa33276834584fe2330f54fb0c233ef933eb1db55f7ccb3a872bb4d0af9febbde0f7f2c18f360cd99b1e7defafe2ff7a5b6d2027ec9daaade03ea2dbaa8d75edb5e06a065ae3f455e3c6113e99cfb0be8f7fa7ac9e44e8537c88bf221710ff4e112b9e6c0ef9470dc29b6339aca7d445f63796e113e826f039d17fb39ba46e8aba696d0c6fe46086de573a3cd365ad98a32ebb6d85f06d2d528fa8e7516f1c6a00b59b223dc8516f6220dc81c36d32191bea51231c7e8ae21fd0d83bc7356599212ea22cbc70a4a934ade10767ef021cf62ed57c6a51ef8a7afc0937d4bba5de947a33eacd31cff8e6b54a018732b3eb9720e7f04d6d8b7d87b90220dfb47dc0f2f6117eb7d6a3690288361678ffbefab677a7a66f0dcb8545dac9afd7abd849827f85df80b9dec7b7f52e7ed494d50c87584a2fa3bd8f3f87dfdac7c9608cb05f227fd4714bfff5c6837adb18834f807f8bcf049fa9febaa008f7f24abb8b36877217c4e8d96e61bda2a67b021fc867c89fdfb851a7d15667a59e1d7cb9f8a7fcf8c03fa210aa97825c8570c81f1ecb21ff0bfc8663b5e1f66aa4af7f5d3da77af7d47ba0de23f516d47ba2de33f55ea8b7a4deab3686fccede9b4e18f6defddbbaa21edfe512f5cad4db535ff78122de7cf0dd15868b0bea1dda10eecce10614372fd188e3f00751dc0dc8de11425e08992a17f1a185ba41c3219a9a7ef835dfccdbb1e2503dbc7ba7749dc46069daab50ef0cefec55e19bb119a9a933613b23cfd403e53549759519f2206743c41cf22ce4d7550a42177a17417f1c08781faac34543cfe3c975509252b6d613c9d4e439ed48d39a9ad3356b09bc44475b1ffa24ed6ce199dec549a55b14c0d3842f4d55e745074209dbca820f73efd8c6b6d54e6c3a8074a42500632657469a382efdb529b2189f8d67fb482f2f341cf2f1d8dec16db5ea979f38fc5a1e7c8d1b2d4a7b351a8fe016f6eaf82bbd06f59ad463d2da30862c70844351a4bd8efab61b2cb4c72ab68956a43da6ba0f3b198467764a18f60654d9ff290ed7d1b81387dba0f87b34f68678b6f1c59d2d826c7eac34f5f84ea8a2b69e42a29744ad70c0610ab793399c5ceb5ed786c3da9b36623684d2581a2116352f9b0a5de33b2d27ba4d46c0e152a3256b5b658983d1a807cb500847a06ddc6892cd6a06366e2e876ab12c9f616d14ca164ed45633f2b72444046c1e3487b2ae3296c3e3a4a9eac6e7406a1e5a2128157191b09348fa533f5dc14710f954f5a2c717f8118b6a9b43d9cb691d87fc3843e5b7bae0ac08f89dec19de2ee0c9df1d534fb5aeebb1a2c9224c7afe8c92ee8786cf610131d25e4e7d9b8f710ba584ad57c0900650bbad3084222d3a107e9fc30dd5a75fe4f09768dc06c8be6ab7cc6e37eb8d56562fbc70a4a970c82e44dfa3fe98fa13ea9f8340e6900773d8bf00872c6ffa97a10f97693156d35af6be8c192a665357ee13db2519b521d4264b4773845f8b3d54bd24d47aa8241ad8c09f3c539dd748ed3e5f850264ef0b6f56b53b7644a43ad366cde6900d114f5cf9ebcc39ab5033d05ead871732d7d17b1b6909558e73a4718d5e70f9914474daaa07871d5592c7071e3d9ee230612d38541908292be51ff1df351cf2bf36b55cc4580e25e255afe9f7f7afa8cff7f786fab7d49f527f46fd39f5ef90332c9551d27dfee2ebd277481eb675dda29ba80862a485503d7769f56563c88ab47f1f85f0dfe3704b1477a0710390fd07d537b1a75cc4c22617919f9afd47ea2ff08cef3f6908c5243287fd671464f45fe2395c8df45ed0eb501425f6f978d0b981d68d0e2180c3a4bfc76052ed73e887289a93d02a5b1e7bcf4afd26dd8825d3bbcd5f670e83d0a85a9114bdce1f277a774725adb5f9351c4eaeb5b5e4d76c27db47a1b4a114a34b530cf1f11c0e8d8b18cba1287ff4daca507fb9f6bfe8bf52ff0d89fb45417328297bdcd6f7108492b537256cdf5c61d85f4515e9bfcae16fd31805b2afba188c7d1751b2f9b1d2945d880e5fcd12dcbf7ed987304dfd3d3aeb61e52138dc8fe790ff297bb7bd288a00a9e64e68691b113a7f55f8562df9526d2ff02759a98abbc8afd988018043bd8e3608c9bee8108893364033d25ae8c2ea3446476f05611a64e850f3892e3773ae6dd92f4097d316356b7328944aa45439b14185f772a26bb2e55fb039e40bce1cca32ae68e360e1509674cc54bfe0fe01f50fa9cfc81d53ff84faac81d912b2853ca3be7ae2f46b30862c70f0baaeeb66d8fdeb37b4221508df9d12b66f240cfb4deab76221fc0d0e37a3e8f7a759574ab2038a3bd36846bf4dfd8e0a992a1751b2f9b1d2147bdcf1d5ec525fc53ffb7d40c883699c318103ac1fed0f314d11f09c2af1e673084956d98422f6cd6d69908c6294ee4f9ab489eebacde72c66adf11062499ab5c9b7fc4ee150a226e66d126e61f16927f1f877d93facb7428b1e0486c9b5e6102b332ef53242a5459bd2ac6d12d7365f8cdee45a73c862d8f67b652192cfa12e300aaabae7fa1914e2b00a14657db3db182a0951cd974e2fad5424f7f97cfaa89b791ad3fdab122c09ea27e119f6556cac9fd609435c8d9cca127f503fa36e6b56bb85fc2c964515d2249f15693f47fd3cf50b5f3686357edcc7b885bfcae1061afd7dd7365475fd3d8d03a281879cacb888a6e03bd64564cf7e30a6814a030ece030e071734b8843d1c5ca9449cca92f17fcaaf85437bd7cb581a255e7adc0caadee41299ce8292096ca8297bdcd291c6e36430bf51847da4aedba98e52d60ef5fa3d838108c57ad75d025f1b6a60a28b7185e49a18a8f3c0d4974d315a844318e73dbddecae150aa49c5458c722855dd92ebb739948bd32ae980aa0de1beb2fc5de5f14acf72dc9a6b1adc00c28b3656fd3e4c68704b83293cc3817a320ee6ba840dbfebd7cd0ceed48fee3584665145e519cfe8c1036eebe0719784e1604183a7ff84c35814c31cfe068d3b0039e0cbf402bdc1aa63b0c4c32f244d875a9a8a8b78d4a501df9237ed690cde69c0ec7dd0a04483320df668b01fb852ab91c561229e438322f26c130d493d15e4f77886c916f36d950e61a896ca3234151848faa9741c8f7a472506f783d20209541e5f859e7de28822a8731ef026b996b6ca3a067f5d0d3e014948d6275afaca28bd85a4a97d0b241e53ee041c3a775ca2c48643bb8046dae4d8ba9485289e2c5dffb43350dd3c580ec8ff32f357184aab0189660f0e687048037e714c83131a9cd2a0428333ffc655758c54383c5763e0fbd5ec250eea34e0676e530dc6cff7de079daf43c873a64733da99c3dd52171b6814fff03474577e03c52f01090efb8a43cb4534d2d4d47c0b87cd2a0d063418d2807f314183645022235193410accf014977267e190678cb31b7b2c8d678f2ab1ae2a5aeccf046c55784112129430469530179be350418f4c4a86e7f44e73c8b353a22646ebf22ce7f3a9d780b76df7f803017cd5ad104211420570b2536a272ac4f08afe5c45aad826aa519afcfb6cc9eddb2de7c0a714e510eb09c76a2de228c42196fc8e705525aedbf66b7d70ad3efcb61749edc10ed234c8d0201b13a1610f7090a3415e270c3faa0187a864bca44181064508d45e3f7c5b1f694834f46838fe1a844b14733384bfcde136281a1ac16128a3f507347e0ae47042677b0882898b680abe63a5e9ea9c863c2e54063f8dde0ac34b7ce56f8757687439bcc6073a7f22ea1c6eb68db257a6119c6c859c8717ff54ca569c700b1b13a9d2740e4a3827a4367d4118ea176a1db4d9e05f9785854eb6b0f4e637351dbb1cc247dd8bbfd7aba1ca6a74f429b9ab2b869ac3d885bf7c7ade75385463d5944ed402cbe10d9635cd47749ba55bd69f031adea237e97d0e897bf61dcca28acbbcce52d8cb9ade8b6e1736164ad29274dca7e1f46b1c76d90e3ffd3b1ccad8c8e19628ee4ce33a2087331ace3587ec224a369f1d03bbb0462f475421d3459e867788911a0e798043b593e9f081868f91bff299318c0552fa3ef057ccf58ecbe1c9ab0e2d3aa646d634d8d495defc0e8b1687d219c0ed8fa60221d1150fe58926b93c7639d40d8b231caefc2d87e338d4d2544e295ad82deb3fa21082c3137d86b18d30440f0f17347e4619cdcd19cdf9e63ed1f0199b8ace1ed17e06e199824e18462114b7d02caa3009c3dd7a5e0c5f9a2fef02e13fc9a1dcc275634b1abf03a4c3a46cbdc6979b9f7ca6e05b4ca2bd1cf1e80e55a6f7f734f433164ce0ed025ff9dbe12beee5f08d86ef2e87eb8234dba0286d3ca5579209e1484f4176fc9cf92dedc9740ace1f62d04c9a4ea6becab66b60ecb481e99f6d8fd29b5ef5bf5411143b30234530b62e0d5214a7ba278d7392c18360e2fe212997995cebd2992887e204ae46f11c0e57ca1e7e20523a3ea2f91c4b9c862518c3eb5b1a9691ab308ad45e652f890a815062a4df4f181ed669b86720fc2739744235ff218d3286fb501dec229e5ee882ef75d254aa4c87077476177088e2297e7da84a9f7a343c7243171b82349f0e4151622d365db09347a14c83206756afdb07459a3aef943513369c2bbfdb67d44649632bb30d68c824ee050d3b9c5b23b56fb11cca563c51db2b825c121b0e842247a5fc35cae1f0181d688627343c45e78bb363d038acd0f00cfba82dce91b8bfdbc77edaa2486d088d22650825462a09439e0f3c2b3eea5f4e182e2e6858b521fc2739dc6c0f7740f19b400e6b78e0b10f60423551692a1cb29819b33de4475d23c421046a13bf386cd17bb8d7a8720e9b2f591e3ba2381be9bd681c0e459a3a9906097e8a18767c3f479acaa23ed715bcd0b6288c874e36d8a898ff4ef7f08f7028d2f438e942a8ab494f74f56c944313f98c42288d30e489e01ac3b6b27e1d1a7669d8a3c535cd5e69d8c7e6be374750315e2fac48e320d4ad100bee0ac32f2b52764a87ff34877add9a991f3f4ee30e400e47b8d62654232ea24853b7b0260f2f7fc8775dc56904c2aea7bcc414124dc3349d66d671b81b8af8adc9754c27a58f13bdfd836b27e72115baeee06aa42da78d81a4e0ed83267c225d2d0c2ac2928e9afac977874351981f27311c0af3b6edb50233ba8f4eec02fcd5506f0215823043873dd4730fb37454a5610efe218c21bbf479f4806615d39868453a3d0841288af460a1dd425b91eeb6c2b0c58f838203e1bfcaa1b92bdba0b81b8ddb03392cd248557bb38b28d97c7e224a4753579ae6116a5be469e4690e19c2a9aaeb1f8d6934a1d1398d2e3670b8238d3cff24001391a66ed8534bd3b92b4de5a08db1eaec8219ef2027a908070f693f510eef33b1f417d74b3ed0b9f872e324c1e84068d4f27e3796431d8fb117e09b00e93ca55b451a08cba734ba44e319e670a4aa7f46d7e07074036378ab5ae5a31b622150a43684a67ecd56a43baf3064453abafd12843f92c7ff36877f40e3a7408ea6349ae1a24b36dfb888d1c21a7e944aa86634d71c3284c2616949a33b1af18f1e421f0e51978d1d5f4351bae547a56934ec69c22aced4771a4ff0af7bd7ae0a95cf14065c364e43fd0b0d8a467f462194788c6b878d3b3ad27ee0326e7b43d1ba710b0e75870ec3e1e811fd4859858e9f69b440bfbcd1138df8f58bf20cf3c855dc3fa8c633d758502aa9421b4251a4f6a28a9df7301c2d692ff73fc2a164c39c1bb3258adf043216cbd12b8dde10aa312ee25a69aa4235ecf18fde61090d873c18cbd10a3775f411fa70cc9b780eb7a7514b535917eb5cb4b19f27705468399ca6e7192c076deaca639d907032e912d471c050f633244d0d24b258b13c76395ca9558527afeeed367f4b608b72c89f29eb1ea3ab2b66ca18ca9a606d0c4bd891f289a19dc2450484651aedd1db111a934aaec256a402a12cf0bdb7200c12868fd831668726f9cf656ac428d27f98c3e8d3faef693463b44f95393c01934574b217c6244a367fcc46ef804687210ecf78061ce1fda3e35010ff330eb7a571a62a45e77e3ff900b944bc3415db651b3a593fb10a872845523ac112e66d12d965491a8196e3d209cb895e946443688624186339940a98a83114d88c8be870b89c6841cb1c36cf11249ba8fd2a1ec688918ef886329c153408bedb43ae62751e52a406c2e35ca048838d44ad96a4e5af34801a9dd1c88d91fecf72b8038d3f02e4a8a639942ce260192f4d2554c322677e4da3bae6f0ea195f791e8c1a4077d40c7df2761c7e0a247e54eea890fd3040519c259ee80e5da242a307c5a0d970ca4ea6368433d5653876b7b3c9b5aee48c6614646b9a28841256711224e66f49f0d3b18786ed6315957120343dda70d75a346aab7d7ed4fe4d3729a40d471d1a75e9ad8ac6a40f0de42a58914ac2d086d0760b6314a94a186ecfe121eba01ecdbc1d38fc9120cdef70b81b8ddf0172d48733a05dc40dd254b9887c5f47031a0d6934520ddafcee6623f65592344a61811f9ae7071c624ad586aa1ed2af47adf7b066772f1f0b2a962645cb236b6aa741c6129ddd2e23b5a03d5d867a7ca155285fe7b6ea2525f37e96d4bbc4d824d455396be92d4482845ef8169cc69d46749c1ee922ece81d91f200e96a651e0dd80ee024be331d5a48ed6bd9298b3962384ce033f9d28dd268c156b7dad58d3234cad22847a3bc5e713f528b7d47454a10253cdc237967b740893125269438a7c4c556ff66e2727d8cf49e1257eb20fc873974427f3f4be30e4026aea1438443c95ec44a5371111337a8034edc52624a891925e694b8a304df89074a3c5262a1bb9b098a33d5af85271c33c328a259db480dbf651bcf3c44eac31c9e64b16697c7deb31ea8f6ee612aeb162c2d9465a363c503eab675ef8c8cae113f48e81a4e9b43c90738c613a77a15aae71493283af3b8a17bb7c99015b7b5362892d1507ffde435e0706955bd9ab891e150e2b1b81435d59a6d8c955c4c94fc8fd5192e91be7a08e4e0845d5daa6233f28189274a3c53e285124bf4bf48bc52e28d12efea472b4a7c205791506ba613655cb1c41e25f62971408943f542e83aa6044f80534a54287146892a25d4c28b449d120d359a9468a9d18e87f07a48add10663f84f7238b9fe1a87dfa1717b26131db4fd61d75c5c445de0e64bd38756489a26d41a9c442fd0a5c7377891603807546338fde57cc2211a8ab67816c6d8bdfa39deb9dffb5caf8ae1c25240d54ee2b8ad53fc3c296d6d292d61f82f9a193f3bb174e050a734020e5b98f48e0a15e1e71c641e0ed582afea3446970a8708632603148dbf6a73288b09f969b2f4abd8cae1c0ec4152ae093e410a4d1d0e4fa5751d83c402a148375514d03c74b005502241892425d4f924d208cf2432be35cb6a396a179126546fa8443e2861dbe7fbab4c68a2b8ad224d9282f07f8e435d2becd752fd0d8d9b994c7a941c875c44c95e38d2747509699a9cc01e26cf2979a1394c5ee2ebe890925794bca6a46a1ec313ee433589504b90e2e95a2a995a7bdb9643d6f35885d452daccf7278d8cd4689da937289b26cbf66447241dad51bb4dc9a43fbed20659ea726c18f85b73d0c0261c4a5b0d27c3de562d64cc6208fbcef227c8b34338ecaaa783f973fc42fc40f387ce1e35ed9263e4bfe518433e92bc85187e9c91c713ab86a4c5f40ca9a3e4941e4b9454922139875b9854d2bab7722114b730798f166cc907dd854d7a5e241fbfc0617241c9a7ff590e2585688710fe184807cb245fd01774a4fca8855cc41869ca1c2ee166245f29c913e25d8d95ffe283923c0fca6a5e7ee093cf742bd1f580b18f74b62d87e828051317fa912c235e8df4c5942ebdd2d3adae1a93b2273655cd82d9753c79c3aa7f7ecd47ea6a5d2c8b4367a9919820a977b179d31c9e6bb9682715b4833ad24d8da5ef9b2cd845dfb7b3804374b252123d183ddda28ecf1663a49f62337f71a3c361f994927b94dca7e401250fb10a74c02f18bc634af2ade49faacec5fcb8bce49ba5fe74b21a40c8eaa672a7131512237576d5de9ec34e9992351fc25d8234ff1887ff2d8d78bed629d9d0a19ad28795bdb06a4d8d344d36b772eb794a95deb4cde17939e329ebfa819ac3066dcd614a94a4fbd3fdaeaef6823d546ea17c8b08cac1c69354f44655e8ccdfa42dcae134a1fbc4d89edb3617842f05ffad2d3bd38143d406582ea29fb84fb628d9d64ef26844c90e1a61f0d764176da092fe2aea645f759d496a0e0542a3484d1d69b4846d4b0ecb7c1a030bc2ff510e3f221555bbd1f85340268728621217514bd3d79034d5cba08608bb75d92be019c0732249c91425d36a642899a5648e92795d6f19e1304aa3e1506511b085cb671caae08a5db33af365a484fbeb6ae6c92a75d9b35eb63ac44e126a8e361ea9b2c411930c9404a0d18a465b3abbbb08877b795d351a6a9aa674e97e572f2c3457b5ac167048e7f283a53abd7d0469cc1b7007476ebf9cd5509f83e4429793b03154fe5bff09d73659a4d20b96fca688521e4aba1f1a94526d355213889794f2c053170184922d348d67a25dd852975b7198baa2d4f5a710fef31c1a1df553347e13c8d40dee043f148fea813495a8a9bd0c6ab280b3c14fe2d42da5a6949ac1337ce8a83801df9b391d5d53ea4ef7565bc3a14d63c0a178928dc7f8a422f0aba9f72bd18558a22d4d479a437ed150bde555298fde29cd583969f4563f0f1d7c506b1744853ab94159866fbe95fe54d34478f191c5a194c83c841743208aa36cf2992a706bdde0eaa98abf6048ed9ba9cea9aa6dd8843da9be329f96baa794eab3965205b729369bef947aa2d433aad8eef6b0ae22f5a239e49b955a061c1ab75014e960a91755f01db74bd85e542429f5ba09c2b326a5deb63186ffe31c7e87c6dd984cbd439630879f4ad3d44adda70f4a9528550e384ced516a9f520794526189c67033877a180e67496debe0da8539943ef3f5225e37fc30c66ce84a5350a79ee58dabc0d0490d8dcda1388476f65c88b53790107324189b23959c0ec646fb530887aa498cf2e8c28b920c871fbecbca67e2686003bc6e763cd31c8a45d510f2879c50ea585d7f7e714aa90a565aa4ce28554515dbea865235ecd98437d4a15f520dcda1a95fdba048b5a1537e47aab5b61b0d2b5294ce78dfe7f05308ff0d0ebf4fe3f64ca6da94ea2054c31cda51d368423fd5d57d84523c03fa941a58634829e97134d18be8b7e350bf6e9574c00346e312dfde1675eb6e48cd4bf026cd97e46d4885b7fdd10d3a791fbc6851671b3ac3a1084bdb2209b1f60612b1d21479ff7d8d5c5b754f753954d89423bbd50b87d203d2ed0d37421e12bb061ce0111374a69b9b2a36ed22b2224d25e8698222d2946cd4a1faa00f56944a512a4da90ca5b2c19669a91cee572aaf3934106a451a5e5461d773a70a9452bb3ba589d25e5c095b2f02e17fcce1f610fa1c86da0d455a30fc36901bb04c8f293d813e91ecc566699a3cc343377dee6e94d79f207697bea0f4a5fed82f710809b71fea4a26bc356e546ade377dd5123609ac9f85df06e18ae395a596b246d71915ea7388992da9b980ba84ab42e5a074c837a68f7f4be29ffc74906c61c0e19956a1d175ba7a4ba623edecc5d703a9de702839cae8cd9bec0516fc81e92b64890ede90a5485f53fa86d2b76ebbba7e036d48d36a7b8ff40cf72bd5d51cb2a2e90cb42235256c50a4652a5fb9256ce939a5ef1487f731a533e9873fe3f0c78da1c5a10c49e54b21ff57c74f01698ff423a5177834dad2b4d20aa4a9f4359515fa5258b328a0e03bfd04517a53a5c919346afa19adc1d22ffa63916a5f43e076233e6ca3b6bf0e1d997ab295af9bd23086ceb67e0f6a19aec3a144741c692a4dd022956578c484a4a9b511af147fc6ecce9bd4f9c0e88a0d295573623fe69379b6a49794e667e202add399c687311658a4f9e9f94ee9152eb8acab403db7aa2395bdec0f165a8e066ea1a54865db26bee3cce19675a4c7594a7ffc1484ff06872b2b99bb1b8d3f0e64ba84aa9acdd2549b445558233bcfa4cb0187fc22bd47697ef4fa1d2b300bbfc561fc28a17d751839a52dd11ab4628e6814c5d085e6fd48c73c1d15eaacbeb5898d1222414e4782ce463ad9101c0fb6aad79d6c62384cfa7e609443354fd2ac5a13747e81e6dc3216b7943ea4f4117ab12df228257d68ea4515b297bd10284314692b1bb442942e6c2c7ff88e6f59cfbd6099731c07e1ff250ebf43e34f01993e51a19ab1ce5e44a5a9bdfce25c366363ea4e35878b6b7c4d5e52ba42e933fd9998c1bfc0e14c252a1c63cb5ab4a28abced83534fc76066c91087a8b677ac9fa54203433712db1b8387940a3b211991a6ba1e2d0421cef9e344af2a8c2eda902e38d12a36f9c07495d235baa882c0f91d4ad8265794ae53ba815e6cab1bacabe0dbc13785bd06af1f03a1bdd6de2caa18f7bfb0d237b968be5cfcffc1e13769fc2690e926eecaf9dbdaa8a969b9afa5691e3320dd8225140eb5346d53ba6338d4c6eac7876e0f113e285d7d9d839281108fd1ccfba8f5b3a5a94d42b0ee364cc872e24b56074565f7602a47ee98a7fccf4fb81c4a7876358ce130ddc589a57bba67ecf90779ec16b20bc74ee300eb2ac6f75804632b5221b07267b985be22351b897e49913e75293d5c03e1ff550ebf4fe36e4ca6d90f492817d197a6dd4e204d9d1a375916dce4e77492d229cd210f48d3341d357fd71eb2955ba9a57dce71c5864bbea7362d931558e2a78949940d926c128204a005c33ce5b7668a10a29708ba1c6abb17e570e6af5a9e0d5d1475ac75ecfe896186d219154863df2c07b7f026850587e93ca50bd851f4728595be78265e69456a43286ea1a348a5846d7b458ac84d713d84ffb739fc4120b7c732bd50d97c254ded5a537bf945b0f585dfe13b43c04f386420331e65c694517f1161771544e1f1e3d2b4dc8991a6402eec948a345d8d82f7082d93707b42a342ed84841c54ab905c426643fd09510e252423b43bd2147533237f078184f5a7958195f3094cf129b552e8089c39a7cc05652ec1e17804699ab9c28afbfb3cc233aba4dad1de52a47c9b04425b91dacb7cbfa44833d794b9f97108ff530ecbe32f73f8e3406e4034730b17d191a6b189447111b13c9f399c06f690c7b44e99191d64f487a3cb93171a3f8522760b7555a88e8544a5a9771db693432d2c43d66fa457fd45a3a3a6258ccd9b94c2448fa3c6e0c40f17bbd2547d7e2284a2f95bd2a4c3a09e9903c28b0e65eef0a3cc3d36ae600e330f94794457041d9e092b52213080d052a4d278e64b8a34b3a0ccd37f620c7f99c300c52f72f8db34f2c83cabc7e453246a6a9944bbd614edd95f28c363a908ac61b06dccbc524677220bec61747c539ac6aad0e544f57d091dd475734e08871f106eef898456a1d1788934b0704ddf5097a4b9290a159241fc33620f25c083cfb7b625b77d5113837d4f52e61d1c2ef949b7c207be33991f6ab07dcbe9b61708cf2c03456a20346ee17714698d2d6159dda97f57947e83c3b2bf5f8284ce761bbfc2e11eee50549a46a335469ade3f60bfeeccbee6f0ec042f32079439d413771d84df07325685cec46f8ce42d65f3d0f883b6e61cea2688210e877e7e2fc2a1a48223290a958a98681b1b40a8b6dcf9108b3d8ca0a876d758f9af53f7b0849522da22668e28734c9913b8889953dd10717c0fbfc08e911a08c52dfca6223d2c52a64299b38d1cae85f07f8d4393a7facef8310eab6873c0cfcb75d2d48ed698ec055cc49a16a5cce1d931cc63a64e4fa79b8ce1f78194dc3df08848535895f09b1ffaae9de45f7f500b1a02a75171581e87a5694227f1a2056b623f5dde4671d2d4a26e9ef2bdca6100a74471845edc8806659ae09021bccd628d2f8eb428d3a64c07dd811fcb78025ee603456a4368dc423b46fa51ffa222ed52a6e7df977fd739fc3687a5b8bd44be09e477d31eec84f455d56f589a9e5e04b53512ad395804d274754399019216c2e1531faf33fc141f7d0dc21dc88caa50d1ab48183a7066f56228fbc3459a221be985688cdd4322c80a86bd41e9951a1b92d1d274e85a3f1d8ff121343b79ccfcd841260157502094186946e569327c928768e52ce119c9da9b558542a0710b610c7755a4f53965d29f41f84f3887dfe6d00e9aff388d3b6399c9f82ea2254d63a335469abebf5126ab15a97008699ac3ce19dfe77033a29eea46614b53a10b7a75e8be5f56453a07a5c0d0fa4c102b9b9c3a12549ae747a5a938fc31598a643824630ddddc356e674844cb585f14700d9f26a071aad2f7e943ca14294bd8c950c23368cead14e93a08f9b96967edb3de1762a4d9b1754dfebfe5f03780dc92ccec048f4c7e70965611696a456b2a77be345da2ac915dc4ec79c0218f748ab217bfcba10c59a117e2d3d3693ae79d3a56990a1d944216e7a08eb20c43bcc9d2874868d40a81464ca26c95e14028fbc949f622b663321bdeec256ce075065f6f17c8ddf72f287b45d96b84679edad8b689c588b42195a84c144253472a1b896eaf48b33794bddd82c35f740e7f2958ba2b87bf47e33a44b35344c9ca975a9ada356ef1d19a219a9a2e33949d8538e4d7d9f9af4338b37cbc305daaab77f8cd9e5a323f1bc51d0c43ab0aaf8355c8b351449a465c41f016e6507a58e93850c4244a7427ca61f60e3fcade03c2d90a256c8fc7b49851f681b28f70c5df57a89e6119d29e68b7d0106820741569f90b8ab47547d9c5af1ac37f80c38f935d38fc4b20cf3a9455debc444dd924f28db44da21dad3189c4f13d659f7590061c4ef022fb42d9e5afa3a8a5690824df1b8c93a68ef19c7ada6a85384ce9504df0ad02521a9a4479d32150274531d429c18834c5a77da8288e0be12b65df28fb8e9d0c99c3f3221d9d537645d90fca96d0f6e2b18cea197ef0b1223dcee91d0b0d84adac86d0285259e6ebac30dc30166c75cbee93eeff26871ffe662f3b70f8fb4c628af457b86db6348d466b6491be49249659c9ec51765f73e81581e203237df01726d1f1f1a66ba4e92c4e9a8a45c5764ee17796de42cee4ccfef56104b964589a86edde43dfd1a5ba1f8f642f0c84cd2c650fe110668f28cb4fb113ba7dc21e32e7ccc629652b08cfb02bbe4a6a45fad00af213b631341b188a22e59bf805457a1652a49b38fc2744e9b73994364aa682f19be34bca73c34f319388b255dc12234dc52406d19ab04994680d3fa179966455f642381c8f904eccd671cf7e9bc3a80a9dc53b7eba838663279981f224569aaad84f30f9740847bd532faa0a12f7929d1f39c8e159202199687454163a05c6b041b3374465b24d1a3e52b6852bc9fe61b68d1eead37dbf7ac6d33152d9b1d08150ba3ff113939f9b08cf2845baa531ec9429dbf9be31fc12879f42d57c59f0881cfc0d0e7f8ac66d98b4d7a1c67098521c7611b6e68768d6d3d254a2354e6d8d3189224d7996647b94ed071cb249cc0e28ebd7e9ff1e8a927e700ae8e21d3f4f7724713e41ac5668fe992c5f78fec9af9bffc834bcd2ae60c40f94651c224d1d152a9a4843c866308176c0b868aa90a0b18707d90d6399a27107e199fb07159e59e8d299901c356ea19fb5e7fbc5befdf6315228d2b47b597e42943ac87d89198170cbf1431cfe2c8db1582e27f11beec998a7fcebf84efda696a648e85bd11a59096527304cb4861fd5d90c6555028327d3585542b279ac37dc5bf81b26312a4da7b18e1fb4a5ab42a7caa2ae46e199e7ef1be39cfc5c367e8ace4b64059b66cb2a1b4569b711ddc14af4b0f099cd01c2db076c2c79ca2a340f17315ba06c11ebaa513dd3455c7a751552a49a401f42be2902a128527e866ebf87618e50ccbd2d879bf05b272cbf6ab8becae1964c4638fc88ee22f29b40ce55d65b1ee7f1c670185cd69ca7b3179248149358a9fa2ba1c2e5a6fc7836d23437d62e22ca913f0064fa70d363f5a73814cf2d4ad7e43a469a96c3d5e7334f8171a2a466082dfd998e3445bfb64ae47f49f959fbe0ffd2a672a572fa31298a91aec5c94dd0768d2164e7f03a8d084dab43b973ca5d50ee12d533d8d3b7802b6c62a45a888621341b181a45ba658cf4ac49b9abaf1ac3a8adfb412fee9b1c6e00f28b1cfe0690f2d45f0de37f3ab59e733975fff8693aeec3d1dff75015652730ec0d30245a23d23477a3a5e95825a0f9ebe48c72b71b6fea0f30b9c9f173f4aa684b3c772282739e72cf472f23740e9ec4fcfaccf35b81446dc5c837b65665ac91a6c93ae5a6a89b91947d6989654d39b54b4f6e4eb93be4849edaa81f64d16114a94da00da19db5dfdf4e91d6ae29771ff7748b979a7f134df91908bd17193693bb72f883400a87a69eceb88bfa346c0e1fd01448a4e9ba688dddcacd48d316cfaa47ed22f2ac9abdc324e6165b71f81d2c67142f4d63919ba9065051c1591ebb76404c59f4d75d112b63e84bd630877c843f1906d01cf47f85cfad7b45b92714aff1e5e28b76935259fb3dcab1567cc1e226596ecf8f39a3486d0205c268d67e4b457a58a4dcd258b95faafffccf39b481541c96c21bbc7c89c3ef03291c4aab223922a7a1037dd6d4d9cba1439e98445b9aea684d9c491c3ff8d2f455bb88ac4b9943946575b63589df1a49edf8d9f2692e952bce3b5351152a8233224d8791cff4b4040d49539f2e5de0163189e20bc498ca21e5dea8dda6fb57bd79963742da905fe7de75ef195b919a6edc510825462acdb9b757a4b915e53e76c82bfcb631fc250e79581c1a1477e3706726b52eb59a97c9421bf15e9c29922ba9ec854ae89b688d74dd771218d7ea390d69bad4d2f4c997a6cce15c02a7f5dfe730a5556898ae38c78f6254e8ccf3db52840fda5e9f19a22302022dded649537c78f8fd8327ca957126b93dd8c0ab14209cb69033cced53ee006db8eef675c29021acdcb910569e0161346bbfa52265c9933bfc6d08ff5b0e6d452a2713e650c6f739fc12938643e3224ae4462fcc73383cc2ad0aa4e94693c853446a6b5e8748e8e7fc6cbe7008abc873ebe49739a46d1d3f319e1a0c6b8840707f3d569a2662b812fba6256b9c34b54c25667cee940ed42dc89cc0069eb22f9aa6ca019dbd51aea21386afaa45a514737706f110ee5c479a3bdb2dc9fe8f8b52835cec39afe3d0140dff1c90ebe044be3bb2e44a8e44a7ce70488775c81b89d64413184e4e5fa235e86bcad2b41ab88858bfc38ffc1ae5fec02426234985b5d234aa42752c74e6403bf47bdbf81f8891929ec59ff2163295f8910f61659fae935499d1aa82d0e8e903ba3f4daee8bc4db90675aed01a581a40f1d3cd760bf982cb3010caf2c2afc648c70b2a15ff4d08bfc4a16debb639f9380e635a2dfc0e8d8649535217761163a6144c62534bd36d4c223fb08f7348608cbb946b0559c4b93f72d320a7ff5b43652fdca4422a5a1983a117dd870f0295b8dc7d142ddd8d2e72d1244f1bc9ad195753cff85c1b9708a1d10efe68ae8b74057398eb51ae8f84a15e61b80c1215864003a128529da8f84a1de953975a8d7fd6186ee0d050e79fc9974f7e4b0e7f194829fb90508d1c51cb9dd670a89eac6212f91ea3dcb41c2430d699c48faa92a683c0457c1ad37913af7fdd2492ffaf850fea661311e3e9aa50d231e4e8c118af4f29fce845936c44ac34555b622808873ab95aee534e65747309046918c55c52270c5fd51a6b51a44854442ca1bd67d3971469b945b9d4df40f87d51ba01bcddea57bfcae1ef0029ea48aa6ae48824f1a3711a7098c63d630e8368cd7a93681218fc08674d95cb84a42973c85f1138fd6d2f319a54a0786f30d096c1417c1b28db8d68495224e6ba797e4169c4244a548c1569f25271d8875b78fb44b92ce57294cb53ae40b9225ae0991236a3486dfc6c63f8d4d1dbc56caf48f3c4e7f06f1ac3e0177de4ec0bf8d5b19ec3d5f0eb1cfe2890c64534ad90449dce86c1cc33b370d0d3d90b234d25a72f2b30d69944f667eef629efe90550224d99c3db0730b95b2e71ebb126fd908a73fc62a529c539789e5f3bba5d364202609109a4572ae6c780104fa81a02a4a525e527943fa7fc05e52f69dec10a4356a4ab2b84be8c228d4268777fda5e91e6afa8dfda19c21fe7701d759bc77780f439b451fc1a873f84a5bdea4a1f1cfa3d5afc69a75d2c4292d74853db24caa2c47526f1324ff96bcadf84a4e96d1634f291dfcd25525cbd0bc5e524480b75dbf4094561158a1b19e7f5e90e17ceafcfd4b6aaeab83b1bf89df95bca4fd5bab03ed4c1d13912f7ec2bf25fcccfb097a8a3484dbb277b0c965a9156aa5f5bd954bba66667072df7b3101af0f4648bdec1adc70e46d2e2d0d0f82d0e7765d2751113b28447a5dafc4ba30b2089f2734853c7249a4589eb4c220baad50de5ef108ae039c78f7f6d1255d7a3fcfdaf9a445c1037404af1dee02c15ad80d114392a54a4a93b4ba28532fe71e03d8c99ee7cc7f30f947fc495b94e2351c1ba945fe417947f42099b74614306481215853808fd5d44bfbad6beb4f80e84bb71e87fbb8ebacf9eaa3fcd6484435d8e98fc2114b7c67239d155044bd308d0f31701686d609179a1a529cb1e89d68849941652b649e4f92126f141adc0b82f509e55d08b368986431e4c667e199ab53f3b7444c451a1293ffd10be7f7a7d7df4a0a342e3bd3ebf443ee20aaae79d3bdd4fdee9fd166b7c9317d8384df216d719cabf62c35056a4b2a84262a4523ae32852265056369918e9f6fd484b79ea7e8bc36df10b89cccf0af4ff1cc8751cfe38849fc1394fe9821ebdf06aa49ff7ca45d45710d7c817ab469a1a9368ba9b3a26512a4ed9a561c7e69235d81be5dfb54964cf50a4e9ec0d406607a826597b29bfc521ce5fe766c3f72f829c06261a0b0d3b78fa9d928075de294d68fc3f64dd6feda606733dbfa2c9291e406c81f36acfa6d347ca97e89e9f5665caefa1e78534c9f7fada2d940db4dd61c548b757a4cb2ce56362333f620c4322d32e67779a06fd1b406ee0d0da0fe86f8629ac53cea1ba8812aa49594f32bf934af7037e85485359a4efe4129d45186212db131428e70f22d11a85227b8cf9c32f5dd32f5d7dbf8e2cc64645de6fb2fc61baa42946e813b2f1d254ade58d99df2a281d7ccba66ff24af923254d8f0161996508937942f953143fe82e6c8b2051610ca03d7653a4f90a1d9fff148438124bdda77d9f7f92c91d81dc86c3d11f3169a4e93c2573480c60e8f92d1692bf0e7a58161c6b124d2e31b454df37892b7ef09f51beea466bd0fde10c76325ffb2514719f64e56114b9c88a9e3869aae98a391895a62ae01c33c555d31afd3a778ab66bcce12485029a0e2b73d57826dfa07c13e1197e6699acbd242a243de858c2dd14697241a5a79d8d61d8b58bdf293db431f34f01f90b4ceec0e16f028995e0da45b4c233d2e09dfc69943247a87beba7809549e419609bc468c0464c22d25f3ccf5a6a65f044476b6e1fc0213a553f50bebd519d7e63f004d2aa3b7c5c6f0f1ab193b1d234ac42f53bad83c1034b49d30887feaa8e7c07aee0fc8e2ee734bca4bcda5734dfa36a8af27d28d2d54d102335890a40181946916edf21bf7547f9c1f610865c3bd3a82ed24c609bf1634cfea86a551c2e23fb10c28dd9cce10f02990c5e88345d0536d077110d87b68b78a4a3a6fc00b64de2be170ad8040ddd7c93785f403f457bf9854853e6106344f9d8d509df1d5a9ac27c6d81dc2c150d90ead686b3f88361de4816acc44c747ef3132bcf119e44373518c3db05be85344d503e49f9141655b022bdcc8714a9583f67048a748ca7e1368a744de98ccda1ebdad94d3da23d047662f2cf81dc8643bd93c40e1c7e9bc9877ec0a1f411434ccfe770838b587a42fed748d3ed4d2292d1f768f51d3289596d1279309ff9f4af98c4991717204d457d3c1dd7890648d5c5713f360e39897ec54953862d43f92c52f6e71ff009994664297294cf53be804515a248f942b98a343c76dbb32975152de6f61fb211ea368f7f0ac86d99fc944343e38e1cee84a59f30d4af552d81c5a1eb22ead6808e34b54da2e9f92d26d1046c90c350269185d6a24079553b123589cb3c802cfc06847e1d59549a467cbca8e02413209da7ec23e69d91991d6327f5a3ade051618cb66bb315b285b2c77d614285732a5c84b2f692a88885d028d22fed22ca8ab493096e6ed0eb71b8712efd334cfe0e90711ccad66b3fc0e17670ea3fa75e4bf622c421c5bb8852f256b8f4a58e1fad899ac44a35c624f2242b5c51e13ac64bbc39038a48634468f9993174ca65b48d8aa98c49c5074895b275d18a788378bf72f55d0e73ea040a37289d292de9e61e5f19c5c22d15a6ba15a251a4c62d646d1fab48bfd482ed7a488519fe23afb2fed1fce914fa0b267fc6486eed43fe3d8791a193cef26d52d7d6855456d66f921b71114b459dd037397d4631eb0526d156a78e49e4a77e61ae5b0cdb81533689952268f48a54b8fb050ebdb825ce31d2947cc1192656e23aa918e4c2d254c5f113aa6adc3a58b84754a6f04085472a2cb067d3e44af5053ea4c293de3b4d76f365456adc42be74326c456ac748b74c541478bce840cb6c9b34f5b799fc1f01720d8701187fc2a1bd1dca7262fca2e0618fb968b988ca7fd031d5c232de249a1cc6511ddaa9db41c0c636893cdb0aaf58a41f1b38952d6fd962fcb4a3d8943a324cb2f0c18837182b3841972ac1ddc61bc40c503dc57d08dfe00db2f52bbc233a5ae0231f7495c642a742890a65acb57f7fd76bede116aa6c215b42c321bf96216ee19714e9d93e15f64253dcb376cbf96d26ff6d20377368fe8d5fe6506feb677f6b95d1cc3cff32b95944bc6e14e820e77a899b0236056d125717aadcb41574ddb74d224bd38b8e76147f348dd194d5b7e1dc7dac34b504a75384915521e588d7b70a2e5a705c95ece2c5f1397a5b9c5fa0e54c611f7fab7080c633de2915d8181ed1c7bede2e46ea488d5bc817cd7028c356a45b66edeb732a1cc7cf6f4da35de7f84d26bf6524ffc887dc89c35f0532e9872efc6f259f16085192ab1358c8a92f4d674a9ae6293089fbbe3ad528fabd1565531a09d888493c58e0d95f38a1c2a90ad858e535d333a0281bc1f36bb493fa05691a76fcf06d6c58c5cae2041724569afa79d7f0712d4da950a1bb337ade47f1da2c4dfd032a9c81c3ce1475a48b736c1723fd4859919afa35464e86cda1de386deb18e9e2820ad54f26b7673621ffff1148c5e143641bd0b51cfe069609bf9b83ffadda25d38d91aac6bbb6853462354824da390cd33543da0d4becd4a8533189fce02fd4d0eddb9844591f2c390c761119451e6c240b3f89a22d4d438233927ed03e5e5885aa83c998008c0a74c548d30fb6780d349b6163c8de209a7327a9d004f6851615da6885e8f5827ea4d2fa4916134639b415e9962dd80a1d2a74b799e26b68dc12cbdf52ad7f00a4cfa1d96ac28cad38fc112615877a5eaa23baaecd3280e2225a1652ee997611bb0bca7483bbbe8d3ae549265ee2eb900a3d2af443390c3b60c31cdedeff54bd5b485a87b5a5462e0ad23a69aa44acfbce68429f3f960feef5d09ceebc88f687b70bba519b5ef11d2f0cb09b2f2bd2fb0262c8fc60e2c793c9161a080d8a2c28647921b2f657349c6e01215fe1d19726ba1fc2d9bc56ee7f10c86d39b469342b71771c5fe430544ce7effbb5c1459cf97de0c5bca48fad720d65128d3a353dddcc96893c9960124b084588492c24fc6d837d756a0236cce17c0e77b1b0a0821b1dd97900cb2833532fbe180d17272e403afd3c51a1f01e51817dc2343cc3490a10b2496cb256cc50214bc372b0a5363f984ca2c28150065f3d40b87531371469eed3184974baeb10c0e734fe8b40ee601ee338d489846f72b83d968998221e4b76da0630e4225aac52ab817e8a8e4974d4a964f6d924cabe34fcc8e739a74d226356d814b06114f97521be87ca2e1c321e4a74449173bdc13869da94847ef4d76768611a3a9267cfb04845a2a2a797353184a52515c7549c6079a16ec1a614a94954c442b843c38be239152fbeca616860f2983e29ff6781dcc061e24739dc307c0e03177168fd936103380b056f42ac162fe34da2d35ed14e27569eb5495c66a87885fa12b32d94a028011be430e61ac5e275ec529d5d38dc5e9a4ebd980029ffbaaab6097328ed18fdab747a0fb7b07883cb5bbc45c38b99720efb7b549c52e739680abcba08252ac6aa2e37c4a152a4fc2cdb7e7961f6898ab3afceeccf69fc9cc99dddc8ff8cc67f81c391e6d0774af5a9fbb25357fd4e43d2d47111d5837f1fe51a8e4974d4a9bda137d46941f73865835078a5c669a04e9d74a23689731cc9b95668471425ec398d485355f31db593b101d21869aa1ae168f9509cc3f4dd3ec12815efb0daf0791f35a5c57b2a3e608daf6c53e1262a1efd6171681215ac32b6710beb736ae5bf300d76a3f1ef81dc78aa3b03b99ec379ea0b17f19b1c06c1a184e670ead91cea259e9b5dc45211dda0eda960a3e8a853899df2f41293c8926c7543c547ecc766ab538362a04ee738588c6fe5f06593a824807b3c927ef0a56934402ac99ef052a05942ef7e517c42c9e879912a052a3ea31954a18e6c61f1858aaa8be4ddbe760b255111b8853e87c624dac5dcdbb88587ac845f779f129fd398f839207795ac3f6a213fe3d0dbbaf2fd3b433a3e04c1a1942d3bad15686b5c4413472dbeb913623fe228da0b85797af1cc132ff1324fc577ec74bbf08b4e9dd8a9a078e5014594bcfd80a38893b756c73737788333bb2986a7ef9ffaf5c8d4516da686c748d68f0942947dc2b3b992a67c89d8189668f608b7d06ce52b8ad4ec558890b2c5e10ec5dcc532f293db5b981da6bbd018bb63cacf03f9ebe6712387f1fffc6f8c8455d73af40598969dc17a50df45b42d64c845acec53712f34219cd8a9e328ca827db6036212bd1e15f775c0c656a726b32f8e22a3c840f21bbe8d627cd8332c4d7df0bc506ac720a7f778b2e7933a583ca08b051df7b0e2feaa4ec54364f0ba47543c22ef10b5b5d2754614a9242a243718e5f0abc5dcc5639adf6f1127ff092637d0f8c7407e8f46c5a1d9efe5530e7f8bc984553f30d436306876e0afd1d675fa2987cc50a6313970a7456c1ac36e763a5113914de2926898a0e20902364e66df2eb2111467af78cff750f48b45872e9caa9241fdb3233d394470865b5a36653bfbd5283c8d864a94b2feac20713fbf838b787a4cc5332a56a958d39db96545c5c142bb85129b8972c8afa5ebcc968a74c18e687d0b087f94c9cd34fe3c90bbd0b819488b437b0326b306621beff947c80cf296099f437f27f738173144a62d561357d857dde1709da368d4e96089903d9bc4c6848a0d2a3681a29dd98f3a8a8c22bfe6b7e50fbf1341c5c9e3529b2508a358e4941b998d1e24e9c66d1f6441586c51a645c5364c2273d8df53a19a0e15bbd82b86dd42a95f3bce410818b7d0406838b413155b96ce147b7472b89debf573643a349add8a7e06c8bf308f711c1a1abfcae177b00c5cc404e852d4690ea79eed2286380ca4a925568bfd189318cd28da690c9e85ec20b142c36eeff7541c60a585761423eda40c8a47298d62915daf6d83a8c6c1f3c14b451ac68efc83ce844885d64c9b83ec0d9a059c6536836cd293544c51314d67477ab38aec0b1533f456f79b91e675d719c72d743814455a5a6dab4891a8c87e2328f253d6321198932f03f947e6716b0e25abfe1d0ebfc6a7e5222af09a3a1b960d0951bd7c3b20d3ff4ceb3dc51c75caa1f9319cea12f0d87a3751a712b0c176627b54cc53b1a0d5a9e328daf56e6c126fef703cb3a462d1e36702b9a5301abca9ddee212423d5bf938cf1f1ece5d131d2d49f37624e757ffe245f172c2f3c3df668e2d139389c5c51becd1e2dbd35d1ed42b2852651216b0b1d0885435d3af38515151e5d6e9cc7df67f2cf68fc6bf3f85f70180fa7bf10d1e7d0501736809e6d218d1ba90bbefdf7781409eb39ead4ae7793221b9e7cec26c97a28afc7b2157419479151348ea241915dc42bfe5b37389eed33941e4da959c23aa900bc91035e64a8fba47738b4903b66c6ae43c8c1dc4de8ec31d89d4ee72d46b2771a1469f64d38a4ec018df6a9724917552cebe896e9a8ab8a48955b286b7c4db69091eb76421c763b5f2d9df1686e29d21dc62f3169d1f80f9bc7cd1c26fe8e431efef50a62a4818b1892a621eaa6316ea44777e883b21945bd56b81c52a7ad2ce628cbb6bb3d8feeb53a1547d18ed98451c450eff1e8c1a3478f161e3d7d615256f6a8fde0a3e8cf80e34baa4e838de8f4c106d52f81a87db04a54eb519e9f02cf585f3fadb310f5e8051867efd88ba56c05d9d1bd479d2dbc2fba6e61944349546cbd7ba147af1ebd7d2587fe834c6e43e3488b8ecd40fe77346ee630f993987d6e12930e87c6218cba883675515619548fde63664c6cccc64e639cab4d69d824be0e3d5a79f41172144d72dfce64088a2c530fdea8f4e251c9434f6cc6789faabdcfeea2bacdece0318707cbd0bd3f9dd3f8842a17f64184641afccef02c612cbb098f0eb029051b7096ca8f47b4c70f85438f8e3c3a266f8faeafe9f612198b45014f1928520b421906c2afaef13dcb7a74b27e127f1fce9f6252d1b88d79b40396213e7f4eacfec31c26fc38edd0262a223b53510b1975233d3a7503a751146d4791d5a97494ba2c2993b8a47386aa42e927cb51b4c2a7e74d8fceb48b383da1d5823ef8949e69c6bfc552b046737e43dda38647fca2b5e9eef2b7072f541b871ed86c1e5b1f54595a65f7ea9dd3048edb2b45f96b8d9f1a6d9492c26857d439743cea7ad4236f4e7c31c64d3a7f6cbed49a2f877499a1eb1b9a3dc05df4fa5a971a0e7533d2add7f8965b1ef5b783f0fb58fe08902357ac9a6546525f29cdac6523401d42fb75d75171388b9408f91cea29fe471c0e837c49383013e322468237d1f77814c9250a8776f8d4a068ab533617b25fe2dd1e8addd8241a47f1b0c736d0239ef7ec958d68f94a4fef74d9a2c3735a9cd24d1a4c7ef0c4670395a4db8be60b73c8c639ed518686474187585b70f2a5aee460e8ca9360174a9e07876f54ff80b594cdf0e4a69c75a9f64627afc13bd3ac84f99fcd7994c773c12be0c49ec71e15c8634898a806bf100ee9f19d5edef8ace8ba4dde3e3f2ce8f9909e3fe8e2044f1f3b51b1a522f5881e4fc246e30f98fc0e8d236d18053cc0368a19b2f5d82e7a75171a7d0ecd8470511cbae9ff5fe550e74b920e51b601d415dee1c08c2356c5487a3c479cf21a1b453b7c6a3b8aa24e1ff75507fe26eaa1473cdbc69e37f1bc73cfbbf0bc4bcfbbf2bc6bcfbba1c7b186f071422c1a794c2e611b27fc9e5bcf9bd25d89962c08cb9e37f3bcb9e7dd79de3d25ebfede4ffe95ff38a556890e2dba78c01be4c7cd18af655d188f7de6f01076529ed959e68a4fec81ea49cf7b54357705cf5b78de93e73d375ff829a34ce269aff9b254f67004937875040e6fcfc9ebd2c5215d146891a69b7dba9fa3e4cd53cfa6ad207ca1dcf34ed1c89f62723387fedb8cf513f6ec96d9b2f1263fec640884b245fc77bdc72fd018e6300a6484c398c29c9f4431e96bb088ec8c8991465cc4c87b3c6f890a8f4f51b4b76d2b7dc02cb0495c5da3feeb9c3fe4d5f3de3cef9d16279eb7f23cb677250f68ed0142368302e1e40de32d4def27304a6c1b674bcfdbf7bc037a7ea7fd0b624e2e339e77e879479e77ec79273ab621b3642f8fc08c6c8aac75d1044672ef597f2b6a96bfd64b08cca8777ade29bba69e57f1fe5f75e7d59cca0eb4ebfbf3334edfab9c439d2b70c006279ccddd646000639b60a8fafefbe9566b349ac880edbdf7b7aa8bc22ce28c9e793b49822b806b801bb1c437bf1560b72727c821eb617b722dc0123032396c4f76148a288cf2bb89e0517873fcc962fe40cbd5784774792af24e6ff1b272b722c4fa29999581d46f4e0d4606632596da7e973674e82814b310fe318d051c6aabbc7dc7ef901946cb7bf713499795216251a511e85f5e9468068a8c22724819425945f49694cfa8d545ff8406e5e73da083070f008f62fc0cf00480b72f00af006f04219a8da0a233b325ac73a27129bd567459fb88ca16c0368d72d61cff82983c455ddd01d805d813a385b80e284f73bb27ea8f89f8e4f459dc76283dc3b10a0f856b21eebaa28f711ffec0033144a40f8164f0985843e5b6acf664286a23d24367246aefe2b3dd9ee09f673187931949e24c88f75b61f5e94a815fafe78aaf85683d88d101f9e48d27aa3762a81c7e90a780474933798e9f553c58ff84c94821e280d94877f1e132af6259ab0864b6c1f3ef695cc561053dfc4d3ed9350db7b2ca9614c01521a29aa0202f936039f12a5269142581dce04643ed9e72898b6d6abf7426d402363b10f347b1e8a16280e582e581e5831580d505ab07561fac10ac016920b12721fc5c90a148a2838ad1e3744e285a43b04660bd0bd4c6f737921d70c4c0133d5f7807e203ff770cd6077178e1a9f1c486702272cd861a613c32d035bd7d04eb13ac2fca122187d6042c7c267eb7195818fea137fe24393c11b0a43ccd39faa8782acf047ab093397188deb244b13d699330a2240681f818894b0cf67cdae2627e47cd370b871a1bfa67e4a5072fb2c44f8da6607dd3663515138f559834ff34358d4338d35408f79618e87a5f776d1b0019cdbcab9a59fd3d1a5772d8f9450e2b81aa7e466ef857dce0a6565294afd548877245c6dd29588b047e7851e7f40c7aa12363ad9aef632aaf79871416d26a115dd10bc4fc5ad8afe2037db607b0d02345006a60d5c13a010be13c03eb1cac460c617720c68ef8bca2d0d1be240ef10e65535fc142602e857b2ca618582ec4a945ab157e2d69f487f8864db05a605d81750dd68db83e93dbdc07e26e4caea91a825123eefd12ac5bd179a080b0df127d7ced1d586db0eec17a10ce908c381c0afb5db49e8533165f1792c3baccd36c218a9443b21e9146c9a12ba6bee89ed1a581c5107d72744d47bcbcf7a19a1e45c7ca02eb09ace7fc693ab903f73db320a0f9bf9ca2649f90dd421dad654de751f0680c8c7e23ce30e75a451a15d899cc6ab8fd0fd0f8dfe250c2c6df75c74cbac48b79c41be2edd30f805634832ba24e1dd0edf850bebf0052d7ea2a5f945a253fd3e57b5eab66d6a1d186630e1560784a92386f53cdcd6fd2001de0284796de28496375c0da026b1b2cd4db5db0f6c0da07eb00ac43348230bca25b8410a3440e20316274bfc03a02eb98a84614dd06254564084a0c60e888cfb2016c0b6c1b6c076c176c0f6c9f50c45871d95428e2383edb063b00bb4b6bc90d5e4972ed1ed87db043b007c2f205e0a56724d02787810a0e97751934de925f7a366614c5c70ea1e87c88e1adf0f68587cee7037d2b144378a6f5a3bebf456328161ecdccc0ab151eb4dd2db08709bd32f163a24c23129a69e33415dbd4ce79025b399071ce59d2627ee2ba4026c6ccaac2e31fd0b892c3ad7f9cc38ee2d0744dd58ca7b7b60a14f7559123e14bc8eb196f2a9c7e1c476db40dc6a98c73cce6529e0dcc9288a3cd9273825007be17a256539285cee7cc21d5b2dfc11e83fd4121a2fd09f617d813b0a760cf005dd3cf2b05e108c1f8067b41628851228ae4f49b3cd58b39d84bb06b6023159e14c3232ae579289b0bb04fa8226f9f9270612419e0b5e315ec33717b0af639d80db02f003576ef10eca66823b12df1d1c5f71453fc025762e0081b2f2bb7c4a137a3e0109d52e75d7c35c5702993a5f820feef3dd8d7c2db451a6589ff81f2a55648c9d25e8732342c86f8c552624835465f5c1e8ab727ba2e6833632a1af176aec9fd4f951148e6805e74d4e34540e662b94c360fe45e02aa00a93687ad587b8c80fc551a5772b861aae687ae697427da108fa953cb2b6ec7ed08ecd5c46b4c45474a576395ebd201fb06ecdb2853eae7d40c4d495cf84a1271388e46b4cceec781ec47f1da1344fa0e75056c1ccd0f603f82fd043632f902c4cc1bb227ed5b0c90ed90989c5c508503f944c7f5fe84b05ce033f12ba10bfd49c5f4e91e410e6760e39bef80bd0bf61e95f55087e7f8fefb621bffeba03d7915e879da08e111d8c718605219c5b15072c1b1c171809609961cc29d724a5b975439b470d422722331fe06c713ee99700f0945782449b4faa2f12ee6f8db7d31ac9318bedf912f803f7ff616af5e437bcb7c8aa6239a1605a886113fdc51c0fe27e9763e8a2693bce0bfe19a3613a056a171d149b4da523522af12b812c8c14e9eafb8aa13202ca8ba6f44237318259dfe250e25721de5e59393d051d4694dd3291cf63c135a176d899172475918e396880e38beb809148a9c20cd95448c12491297b1240e1e2961335e8a564f8c6a524feec0092865ea74c1e981d30727046700ce109c11a0044908c11903ba7ca18c15d13b452ce7bbc2ffa46a87ff090eda17f088c737070f9c29383370e6e07c8b69482ef1e0019c05384b706ae0a02fdd04e7049c53944170cec03907a701ce053897c41e4238da15ee2939a520a872282b16edc95404be18b854c48777516f138ad63d72084e532c9ec843c62b02ca72b741aef8b82ec3634789e1e8988e4cf00a4e0b9cab1484ca169db8bf87522676e27f8b50347ddae5a5c96155266b4653eb6027ae04560732676191b5802c66721d1a4d0e0b68fc1b0e951ba9c1c363aa2faee46f7462ad63ea74f6656a67b25b86479a5a175ca7d1f07d2e71d45ec799520c1a5112f55a35e6f26d14254e29718a0152e3898626d73066bb9465f9d8c5310dce0d38b7e020906d70eec1416070583f81f30c0ef289a3f643da9b18be8aaf5762efeb458c518e302694b50d7ca48f08e105628b72b3e39644715bdc2363327142ad678816b28d8ab707ce3e3807403de81762811f7144b57be7182c4b468343b2480cc5574bd8ef24a15fa83328e9f7323844bfb443a99a7a1bdf9e9c521443041ea35f147ce78b9c702d86f5ae5a38035f8ec7c717e26244bdacb946b059c656b69d7c5c534c32bd49212da2311fc8452731e2f17417e57572818c93ae9bb5e654d0c96a346639cc02f9c6b9905f068f363fc91c6808c8063b713991a9d3ab0c9b8950f6ec9553f1a6c0d3256f7570e53b70b27b7949cd30ae954cd81892480b642425111d3354061c9a28898844f04ce5b5a92f00af1723706d701d705d703d707d700370bbe0f6c4d7409c34c0ed138168cb6dbac510f1eb99bcd3494be6545f54d00847e086e00e44fb16df19dc21b8f8ceefa27925bc6f7289ad4770c7e07e80fb09ee9718f489c3700aee045cbc45e19d910c2284ee9e70f785fda422c3da3bb7958aaf0b724a510fe1012551a2f84ed91a746dfd0be15fd2070d1ee85a834e388aa1256748e915bed1691f3c813b2f84908d0345c5a15c25a0084593495d8cc9c49625402698546323724d57265a55ea480f922a75856a349ae5378e8fc2f215902b71a8edad64ddc55257f34d1d1aad78d20a8f6c7c99e4239b0c02590353d4711b4422cede5615a784dfcf4b15d33900f75b9513fd2861a317c86049bcdf17ada1eced7aa3b1c8b5441ca0bd2d31bf21071263b920a0410cf7e02ec05d5292c6ad815b07f704dc5370cfc03d0774f66a2d702fd0c4f08dec73416d37bd193d82042296a34bf25a3168aca3fee165a2092ebee40adc6b706f28ad8a1fdadb02f716dc3b7051c4ee45b7293bb991c007a06d70f6093f7247f7549a94b4b42dec172d86d4566ae1d5e13292c419b9a61819bae754ccec4ba99f3f9026bf4769520c8f7917448f265e808b1c3eababa4692914f1fc6a495c4a0e539a99b1446c8986c05448f324878d95ac8274d261648a46358a4a06fccf84315b120fb5ea16d2f8530e6333c1e3cc55d28548f0c66748c5eb05417c22388c82c0e565320edc52c268c481eac9e907a312d3610fdc97a4771ad5305812f5ae6c24894023524b22aad3d79242291cbe9309a51c6109ee2bb86f94a471117264661bdc1d707701c1381d88fa9798ef294325b4cec926c4276149de6948c1e4e7b7e85d8b7794be7d700fa84cef1e12ed2853e82bce8ec145d93c064f88de8020f400f00a42496029839c237586f488f4480500952b500c31324431b47ab2784885118a12cf8ec4e49362dde51dfabd949e698c68fd286f21dad7717a068fc3f2465c85e0d93910e662b9e824bcd3123fd68c2d3587788a8b43ca5c2015fc9ac365c67d65027543d28a94c9dfd09860d2882a23abc261673578ba59362f984ee08767eb72a60cef678f389f065e73c558e43be18ec671a0218cecf1673d5285b4ae32bd81e780e7c6dea9da39f826924499b0e1bdbb6d3922dfdbb124c2b918ed53ee74bcc0e08ab4a53602cf03cf072f00af4b7ae8f5c0eb8387c37700de103c7cc2bb18fb68248f5c63f41c22135dd3cf2bf0c6144652f206c4b009de07789fe07d813711bd3792a9e70e78532a54a00b8a21a53707f42411b611c68d2e150c511555e1fe44d52ae0be3d3915b69c63a13994924891217eed1990b0a3bc0f7c6a57189e50df82358ad23353f248eb78ac1680feb979caca0dcf9de19dd2092df76699497e894ad83457e67852402adf475723cd71a83cd2b702e7f0dfa0310fce2a1cf21a2a7a958748f1cc2ef5b5f0636bb964784745f976da696102a75179caa48e3fbd280e8cddd74e9c4333e381f71740d272bdd3d41634a809ce218dcb915c851e910890b13a5514becec5cc22efb41e0a62ef043cbc458f149f700e5e033c04e6123ce4aa05de95f86e8ad9940cc345c40f657086b236a6fba887fe9e08af297f33a4b5fdc1bb06ef06bc5bf0eec4cb58ec9d81d706ef1ebc07f01ec17b229f13eec81d255ff48edc51d94d4a5ddd80c1e79c6a866091185286863b4bd93a949e813149fa6c97ba85460724f5f33bca4851e636f248f1205878a09ec17b499fbb942551548950be86e2c1e7053e72fd586d7882b48a66d3ada540aa6a64a227aea31ed4d326ca2b73ff2a8d1cc79572a8e689749404e5361c1510183b9f2902193fd3ea8f318db928b2dc2582c3adf85aa0008b82438e451361405459e2897c913082f79ae39df254e054a71b4ae2f737357991771a08e740ccf6d157a406948f5d6a4c41f7cfdb010fd503856b0b3c7c73fc7317bc3df0f6c13b10e7afe01d8ac504bc23344adb50e31b7a9837e4a0865780ef306a9148765bc247fc8e29318388a142ee5c51f35af71a7c0b7c1b7c8720ac8d88409641d93aa3a638715838b8151f36a5672484141c4a3d24f5864731b8a32601ce91ce0ea860c8e91974bfb5474acdeec7d4bfe6bb8aa5721453582ea23d4b6461b0d0892d4ab7dac18aec4e1645dd4b60e6ea2ae52dff111a57a9a2e6507e15aeda2d231d3311e2287c63fcb204227e29e34f49990e1e38fb626a5d0e755170c81a18b73e6d2592da3268041f2ffbb31845ce9d2aef544a2202c3091b94c4a04fde29ba6ded2bca2bce6fc83bb506b23deda83d399765ba63d1ad83ef831f6070087e17fc1ef87df043f031503c047f2896e88ee2e32342919234d762ba20bfd45e906b1ade08c71357cfe22200ff1dfc31f81fb42d31f573ef89dd1bf03fc1ff12d31d6ae326fcf036c43f6563b78290c342d9d51d7ba42a3874cfc8231d5f895997facbb547ba3c551e29e748f157d79662e708fc49cc52f6025a8ee2325245bc634a62812915d59268e678ca99646f0b6f75871abbb8eb55d82bd2f84b09d57c0e75bed83c5e598af0967e6d31811be0d71709c347b2de0b046ae3141d079a2919f63ce31efc380e54b922d57511293cb73bca07c19f8aabfd44a0c8dea94ed868ef1463249e87e12d6815509a9ef749658cd6a7800f3985af4e51d9b226823bf067e0cfc1ff067f21395c825f03bf2ece3df04fc03f05ff0cfc73595d1c9377ea37289b3a98919b3abaa219fddd11087cce05f897a490037c9326f82da08502844ccf4823025f2831e38cca2154332dea7d6a61738fe90ad23fa14a0c7ada735930e41c295e71a866f38c4703fc6b737d003ac559144bb0ac4705273e11c57e6c6ca6776ae739b1290879b0f147730924d5325a348df0bf47a3e4307538ca4152bf3983df0f096c0e94e17d7c72ea0a4a1c1a09d2b8081be54239144969a0ce9e717c3888e6d7c429b54bf06fd281229713adcc3c8cc690bc538ca0165df24eada1acecbb94b399fae4ec51367229860b113880bea58f40b6c1bf07ff01fc476978fd46ea9ec1c74bc02b0a23a9e27800fe1ba1b84489c6abc3841eece3cbb7a84cef6fcbc5e090c01d99f9444f75176f113fd24024903ab997b2991b7d5d592db4c7e48e6a19fcbaa45bca918ec5644a330ca98fd497cd3a81ca91a2cb4deb9a2e49fc691db7b9b8ba1157577422b867850dcf75398aa971c2ae879af36eaf8e2d2fb6d7c8f1d03894576dee0728eae4d619a0b569fc4783c62487d541d2aab5f28515f1636b9d28c3ff324f92e250ffc8ed98c6b8814676faea24b5d64015e236d5b0e013a0a3f903272e639c0a5ae7050345d33bbddf8fe761608c8728b6afa92394cb89e89d5231d0a5886bf28500102736deee091bf1db07ff009d52f0d1294537ef58fe1a80c012df57627ea0509cb420b021704815272df24ec3292d2e13b8107810f810041074913756bff6642827343d1381f63b2d3fc3891986b0652902a9706f73cd50ce756a531f69f04449a6c183fcfe6d99238dd635e5d699e015821ea083cae7cb4491e761e9535905451d28b277ba32d9635620f1b5d96012eff39b5f6cc7c9982a532b7281fccf048d1187d541625a2c8b8c83ba0d04b0083fb6e61619dd77d569a8e73501ea5ca839154d7b9e9c95d1a91aa981320831e6cb70e473fd299a900e1453e544e59d02e54e3950c4411cf4c83b9d3f52451139f9bc17a72efa8414b6a1771a84100c2018423082e01d8231041f107c4280c01f413011f34308a610cc28833af6c510a99b0bcfa1cc4d7720f61a107c43b0806009418d6023f0dae482a23181f60bcdf1857b71fe253e6cfa68544285df031b4168ddab4205cf6cfa5ad23747ef9aabf6e86cf37617f81b4763b1f308413d71e2f02cf0c164145988b2968b22d72418453b88f92c31469725919d4f7dade74fe1e0a84aef68d114a7d4f4a5bf75532ba12839acc29282678bf06b3662c33fd9932c22b0440073f16363cef59b5f6c17fe60ed919a95091d1ceaa96eac81b477fca5f2648c0721c04fbf8f666378e498e9ca7ec23bfda074226d1be8c826cc134afacff629e7d17ba306b199454ba1814528766b109c427006c1390408d505049710342140f5bb12a748e6b5f8be86e046ccf721b8a54091e875284af41c5a152e68030a2c4d997f25e4be6b8a3dc26f80e12807845427c44fe4e635091eb13746861fc95c216a63ea3a701bd43a33bfa6b0900b15a9b0102f3a18243fe195e2297dd688016b358a7970aa646691679be5d0443755f6e080a8bc7d746379fc576934382c21500ba049e0d538362487b32c1b08a0899f4960fc715bf47df227a7747273a1391ac88fab56b8669cec8ee6dd40f09c988dc181626eb31bba70184de108a6497a871428f63aa43318287a73d9b1d910c3256532d14125145f809c3dfc880e045b106c43b003c12e047b62893e27427820960e048794bc098e08c5e0507c3d41700c5d21eb108e6c16bda35490c3bd3234078a7d51d9c6edcb807026979fa1f651d941daa1d986f865bebe69d938fc7a0b5b8585e8577358c8cddcdcbf4661e1490e845914e9003ee69cf1229de484b6f66c57667ab4371bd512d34dde2b9bb9abd398caaffe4b284a0e8b08d4025844e0851f1bfec9715d0981550430f559fc71786b07793fd5380acc189f183d1d46aaa5ea28d01ea9298c3a687c7f812ea8c5dd348a66a0c8533116aeaaec2f76e438ee51dfd9f792321fcebe387da34a867f81aa4878d823e1d6114571f6065d0bba36741de8ba24895d0fba3e740371d2846e17ba3de8f6c57207ba217407d01d4277045d6a8b11cd670affd05acf64349fb02d06b72c839c1a559918a8f35c0a32a8cba9f75bb40c54f04861e1cc5761a1ae16a283dd18aab0102f3a57f8d1e37c08d92050282ee5a1cb3ea108452e63688657469517db8a136332c0ea69c115815c49e3bf11312639ccbaa05508bcb833cc5734961058845f2e81daf08b99e58a1484268d9cadc9c681ac81ba078a27daa8bab0ccf70caf69555c730d1bced9e86d83e3bed3a5f24ebf17547c0bc734c44743aa077cc9e66985e21ba9a2b705dd0fe87e42f70bba93f604556e0add1974e7d0fd86ee02ba4b2027761fba75e89e88193e7e0add33248dea10835b659f5200311484a18c0647aa77943231247de482d21cdf3335bd9016bf688bd19e9c5141612174cfe3feb593b10a0bf1e222c342f17623ae82b4e7c2196c6d9a106ee32e81368965c23ba5d6e282a8922b815ca02e68effe431a75f4f88f0b63c4e10f096c1d248c3dd58d0934f1d39fc592184fdc2c3d108c59dc711a952bb493c31ea96c2ca63fa3693bd06d40f7224691d2a746cec60c1439778ade293c53ac853a33f02967f3b14f5572381333f41eb789169a0d38872014bd47e1a1ea5e228dd045194455bc82ee35746fa07b0bdd3b298c6de8dea38e11c35f0d9a4acf86ece1ad33961a38e286b5a845a64ed4b98768b2a3e09c57a0a1052f3cb9100e7caab0906754b897f4b517db2a2cc40078f004dd07b13ba5218b83218ba2c9a4aed47155b01c456d29ef3415617258c8e7376fca45a5b988bf4be32f34c4ad4123d7f17f89c0b3a9b2e639dd328dd55dd05cfccccf0263b9e59cc963da8c23a59bc5f998728198cfaef648f5bc55990a07df85ee638ca2993ea59ccd51dc02ce8122af28c5950c44d16f52ce66e66048065d647e5b66508418a2ee3d43f7457ccdc418a97b852e3aab1de8a25a6e43173dd25d49e39eecff1c492db5e4ba322302cfeacaa6ed37245039a2f0205a4f14014ee634f383edec883ad7fa4bb5ea0c5d0ef083f6a9170ffde77934c717af20e6b4a6ee01740f1374554731c56d098af8b659ef94b32f8a8a667ec74cf9648b3fa5b1b041fc9751643d3cf911811a3f2690ed729f0c1fc197d0dbfe8c40fe387ca679a0f32792151c2f5dc41fa8d55012936ee4834a184f511c8ec475238162f01a2f9f612e63c3fd6e18289ede534dbc5617e31a15f7470331edd39c8c7e8d5044f9a2e9480fd03d869e10f8fe2347345e69e9fd9e053d1b7a0ef45ce861d0c8753fa97804704d4a1ffa9f356e9121025b2f948ca9b781963fdd95e2a90c09a45b9a1b39a64fff5a50d3cfec80d623e5dc8cd9448a782f6fa01740af4b63805bc3345d09472683a2ec82502140360f57c4a46ed0594611bb7e93f2c98aff228db5f92a6dfc098a1d83c3bf2010edea49196b6396c08af8991f87e7d2ec6e5541e02a08358a6657fe523503a9a0512dcd70c9352be8f5a0d78f51e49637d5677394ced98c8e687c8fe57cf65e40053a44f1d4a2f4e9a02d2613e9a09e51bdc1dd15180df642e1be118ac309f406d01b426f04bd77e88da1f711b5a1c9feece60bdd69be44b3071f984059129c93eef98db491a77a2a73335d9a683f3b5213edf5126cbc15e98cb60186de27f4bea03751bc992852f076526814ae471471cea64442359366c286f33d4c60d1848c52795c3b74dc8046fd5575e8f837c21871f84704a29dcf94e11338ccdb8c4036bc1ff5b81a87fe32ae555481d09caba613a75c69e486725bb6bdf4a6d09be5a3a82746c5e95399b35974a9becf287a7289b78f3d42115d4459d36b4f5e695535caca84d09b8bde8378df17e36341999b4be87d436f411329be1ad05bca42bc2dd56f162ff1c4ab1e62f827d7e4968493c9fb7712c2279a40eced53fe367ca792bdcacd3ca9b98536e257131d54c23af44e44ad23f62fa077aa742f42910e4b36c55d826209843265aaa6776b02d925296a3a2d07722d795c97c612615c41e3e6284a0eff82c018bf3036fc933dd575034ef3b39a8d9cd53496c9a5bbaa40686aa39e45a5a7cf486184de19f4ce731c545645b3cf66b14d19486b44e9531cf71ac5452f8122d429f3e90c450f9d5284ed02634542717020c66df185e4238d4de8b5a07705bd6be8212db7d0bb23fcd00b450d44025b8f8c1cadb6463d6b91d1566a4f54c0748f55c97e7440b9194e90b6d1256e8b165e5fee45ab2e2c684f049ab05bc212d07b80dea30252ab22d35511457c55ca8f35f1338735cfd3cf2de5ff2fa231df59dd10c5a88eaf52290d038f559998b508bc1691d5e896b5b14800f3f1333eab75925e50e3d498c5bf018745b6e840ef298da2779c4051afa0c1133270c4bf2324c784e2c04f38a81245caac7cd894b9714f64b8f82c2e8ec4722906285f67e2fd009d55e1a230be00b18ada85df610b7adbd0db81de2ef4f6a0b70fbd03e81d42ef087ac7d017728f8a36413803310dc4ec55f47ce88338fe86be057d1bfa8eb87718bcac2193c23b13a36fe17e40df85be270e2f44e7544dc4c9f65a9828725191af629cb3512999668ca8369e45a1f3f3258d35e59315ff88c6b5dcd4b2d0716d1a937dde7c80184886642d0235848504d644eb5519fdef39bdf35a04f2a7e01d3a9106813acae7549e79683686906d770c7d3fdebc2d1745bdbedbf8845084674211850851c4f0cc47d51a52daa67b1aa3480d37e864de884f8f7a6efa81687c8af7908491697c0fa1df857e8fe4b1df873efe3980fe10fa23e8bf8bbd67e88f45f3561c5fd3dafb7de4e713fa5fd09f407f0afd19f4e7d04708172877f9ecc1a5703fc54728fc1dd1fb14dd1dc068133ae2c3a7fdbd6b5371b705fd1ac0beb8fbcc41d16452a3a8279a65c58409d43d1e258da99bc9e3dfd1982b8ccb6846c1f2b2401bd743b160be0503a94552a52b3723b09626f0e221367c02a755d70d38f1413c9d26814623a29a54fa7308b9f1ff18c7683db14dcd4a149d09150918459a9631a4baa27f49394c706551e18c16d4b0df857f4685fefe09f491c6334adea0838a28a22193235bbcf72590e7d06f40ff02fa97d04732f3e95a69a2ff203040eddf89feb5086734a96a7a289c36ed37de1b8b1ef27c251c0924d248705e8bce23f46ff251e49e0d9eae9d1dafda0b0523a75ad28253511eff5d1a799a8e8685f37c752baf01600d14f3e65b647bdc748b2932c9a89438a2b10066343026d05576b64db7f81ca6b18abb1bd37eae7aa0529315f5995b360be76557e1d0dc9f688143ffb61045734ec654c428c6aa7820a7fc7d5289bfe70a6f8fdc485a91cd973ddc4fc2d9126e0dfa77d0c7c7bf63614c0229de7bd0bf87fe03f41fd7c3efe299740fa11a5e8825d0da70fd4b9a5d857ff606e2f19e980cd179eed0dee31f3dd1bd11ef360189afc23b6f28b94fd07f8eda7d157eaaf650a41e75b902bf99772daa6a6c208fbf42e37a28361361adf9f5d48200326598d0c6aa2826e75b5499b5a4e73d51995e32b331816c171e19dec1e7b3cfb99ac0e8b3e88a30cbd7735d265e5efe144269d07f81feab383f4e36be45257e7369298c15cf0e9583aa55f17b292647c2f914ed1beeb6a1950be1918a13b449e88970b6a1ff26025b7ca07bd9115f5315319af62e81fc42cf1325149f8f7ab52b5e4ec41045ec5ea65ec66c14f205a8b7be402943d8be2f69e7a9e994ee2c3bb4f9d4e2354163bf05fd3d92c7ee95e8bd933c7ea088dd92838ac288408ebea45aee43ff403ccce2e27bae715f0477866443ca9232631579ac183a16d3b8913046cbc4945f2cf4bce4aa34a6f33415662d15cd99e0ec0e3aaecc8f82a45695c0d654d9d996bcf34abc15a57cb2a85331c35d711db9d88e37d3dd084265d701a9a24651b783eb6e9b742fb8938815e19ca6f08f97545e77d1c93c94e9cd86ac4f0c694aa1752bba75d103e1218a475218f772680ccfa07f0ca180106885b8d0a2fd6d429bb63d45adeba3e2bdd1d68bbc6738de8e5fc4e4829648f53ff369c4e70f2fe5fe6db40607d1d81b097450c36f258fbd0f726519c8600f420742571c3a6a8cdad1fa973ca649344e923d1b05399eff75342ea2a5d252ad3f8c287f1c3f596f7fa4685c81625e9ff766b396f441e78c2bfbae488ea27115816817f7ca9846ae7314e57b4cb1a50fdaca9fb1a5bf3fb780f055aa62585888623d4edba00dcfd4cc8c271c34f7d4f8a6e7ef338ad648eedf16a118be53e66634a024eaa826604cd53f9a1e31a25985b0a0e44dcf82d013bd27087d3100caa6eaa091390c0308bb10f620ec43184238807008e1889681a305fc5f84754efb84cf7769eb454da3771ed3f8d8a67de0960d452302ac69b4be207c57f288d1636f5ff9abdd6b11ec886097f23acd0b08c7800e393b6c3c12a81cf5a442064e89f35c99ea4096ccde28d29f3569dc3c682cc9dfd4d5c60de9da46bc19d90a14937dde3f2430db0fa02b13880a2b1b0b23a2984b60f32c367afc21470073dd5d7c9036afcee097fae65cefda18427650c34f71d54ba0c8b3f897b734494acf1be6cd6a6865fe235943efd214f8de16cd57fcfea4350be113c22fde8194c245eb5eeecae4d0726cceb6f89ad33a37e144845d6a10ffe898da08e114c219847308bf215c40b884b006619d68b417691a71b4a5685c5a62d220fdc45b6412c5f3be4f7fe2fdc527fd49ff2b6573be2dea42caac441483c96e93d4127dd7774bec1f418807f6964e349d5cd7b0073a415ca6e2fe8d950ab9b13cae1f37fe5ed0585ad8d0282a37b510c5a8cf3b5743f2bdd0551ddbe5bd325c9cd051255124b59121bc9c2b6b7694119f6e1abf984033dff3409f98faf2b95f9b1b8e37e3900feb2e4ac1a95a602a35390351e4d53468e3cee446dfe33a95f8fba7e2d1a7d2a25edb063c5acbd0ea538d1ec3c5c1ad2c69a08f7a22ba35f18983f8517828fb37b2e81f62940884e239840d0851972e216c42d882f00ac26b086fc469281ab3348dd639dd5f6ef10e8db48e38ed948aaeef276d241e3d9396fa476835b1289e1248086f493939a4ec85e4c1ba0f82ae057710b621bc8fe37ce5f2443492ddc5c3831d253529a7b1a13cae4563b5ceb83261fc49c5bf1a8d06874532f853024b2bf53a3b1aa75eb695422284e7736548269de68755d1a62b2fbd055fdbfcc296a582c635c5d0dc8f9af6184ea148e1a24ca2365dcadc703d8357d3a877e38d4d0781f05b72566e87a6e7ce5eb58f2a6a633999704413f0f1fdbd1d3119a09b2adc2d31c0b388fe2abeea01c24708d16b7d86f005c257492386881dda5a03cfeb101fbc81701b42fc7317428ce8f621447a0ff1562c77c4d2a6953896dbe0bcd10e8d8399daf146d2183bb448e3744e34b254da515459bb148b1772624f8e48211bf82947cac15157552fa6112fa0ba830a0dafbf4a27a5547266cec4f21fa0b162d0f817c2a8b68a48bba992c3950456f4423720d02c51a472a45a00f174b2a74a7eec7602451d6aea68934eff34ff9291f5992dd95c3ab5d7134313c5f058ada6919fb93952cbbde935a646ef34fd6f2e77ade936a89e31dba7eaa2fd4a6dd9c39adc5cf18e8471e0d28cfbef9a7086b44271e0894f4fcc30489b5314894123ca54ed0a90cc810d0307062e0c3c18f8b45cea208041572c5df181fef0544e2faec3a007833e0c427a1531b92fea5f068de3048ddaa1456f76be4334eac0d2a411fdd5e1250c063018aa1043c7fc711a5c248604fb32daafd140529755a8b0c4a7f1c480b568ac52e1f8278531db7c630e9e64d06870f817046edc1397530b895c53d51627dfdc7c9a99fea1e7340abf6aea7be24fb383d54a98c721a13818a9c58853e1222f6f930a17797206868bdc865aab53b8f82597d5182f55332a0a234d1d74e496bd355a08e3ab2577387c10b581f8fe80c1bb78f00889f72ff0cfc5770b06635a036e80fff54946ebdf7c89da8d58a0078e7c7e291afd210c26d0251a613085c18c69a4fde1c25d5ae7df0b634f55bba94c6322b09c128718bb0e3a30c0ebc2771ce16769c4d37a11add5408c19fe6a2e8d0c241a3e9951641af59d1fd2b8819bfa47c2a868d41c6e4660c9c8fe95aed492f40c6753532de3fab3e823e4fff2441bfd43f8fb177d49fced8bceba102adb3b81c12281a2e9a3f2f236ca479573ff666f346591e74985639a293f3ba2eaa2dfa45affd739ad118e11237a8c7e43ceb4b028955a1b09079507e5ae26fc5d4282b655944b0f4f173040c51bc3e08416bf199cc2e00c06e73068c0e00202d44c54ad2f18342361641af19953e5a60e505aaf6170c36e2ad19812468410a417faf942c5fd8f90dae22ea7f2f0cac09e7d962c907872b97b912e79615ef4f890a4310252fb356a401ea8eb2fcf68d54c56af70fc4784313b7ea6b6c1e1df696049a768593b4e49435c141c529af43cb9408ef105284f3b8b6b3e5cf6d1e57e5de4d0bf823af8a2a0712d0e51157d949ddb048a6649837d54ef282ef4eb9e9be91ecd94a7a55097e4a37e1cd05a3254d5d8077450bd3d18b4a9dc0f23f1d584c13d0c1e803627fe242fd1f1447f24fc6de1dea001923fefd3b2a8836718bcc0e0551a2a36aad6160cb681a63b93304a0955c2a8dc546f64048d1f72cbd40695f8c339150fbd81b0f1889d09b834da743cb9b4e1a3bc2c4639b6148da887bc38030f064ecbe5e7729234928f3a3632ab0d3554748331bf2d9f387a5ac4e46f048d9b08e35a28460d3aed89daad359a8f5f9e8cd958034b085ce982e674023ce4d721f1718ef5f3e597e649250e5f74581333a7f4f920565bedc9079ae81f0beba23d598850881078ffe368cfba2dd5bf1a0596201092dd443dc39c2dc5ebbe159534d0477de80be78036756361c488717947abcb34de297f738a9c2393fbe26842ad330d97e234741751b2c26ba98a53a271b80b8303181c8a192a247aaac7d420d0bd852188da1d0c2d18da30746829714671e8c2d083a10fc340dcefc2b04b0d34769338bf78164bd4c026f5e5e027c29b9e2a458d727840783ca92545eee82c2432de5c7cda8e992107d54b848e591a133561b3f078aeeac96c9a46d53a721ecd1988d60de45957ebbaa97f248cf5688742dd0b9df956490e3726309b89c91258dd055dd90d97cecd7011d255b38db3e4e37d9a1c7469e2979839959ab4712177e4ebe3b0b32af770a2eb3811cd37717e2da6a970919337754adee839c46ab1a9a55a6cca14c6619d6afd248cdfb4456120579d1a5fc1b007c3be9a2a817e69ff525ccc49b530841b5dca5d3146b4263f6c8bd1b55c1dfc0886210c07301cc270241afb307c87e198dcd7e1070c3fc5cda178f3c4912d2cd980ea3c284387130d093420543f102f4ce10e2f3c19775dd2742776200f148dcd8ea29189e253402937237a4ca5554d1a29c56a943af06d75d0a869d4c3c944918167f9e5ccb9298c7ce7d785313b9551ce3b515ac71fbdca7336d6a7a9e2886e16076e4e60855638b30d801d21ee8ccb7eeec55d342db5183fb3559597a55a8f4641bd9d0d10a38fb48faa57ec1f8dd5d26fbcde945e59430b23d5fa8d88d17e85e1170c27e2ea239623f743b6652366326582c1db1cd50cbff3a1f868d1568aecaca23c06288373723e5d94be6f182e441d083c36c48f2d0be14d170d864b71e188bb3a893f4ff6e181a8fbbcd4443963fc681a9143dd334c51e2348e1b7369d4401266e62ad56122a79aa531258c4c23effba0c77d5f4454476a79a9264cfc5418f59ffc3e1cecac39ad84e3c35529fe9510aeccc4fc90c05c01d404ea161cd329e28c79ea43f9044350865faa4fb52517fc0bd79c5e74e788ab4cb8c866c94de759183979b3f0d48429bdf49b16c6198a580df0ce969f78ff70979ab0ad06f5b5745b54ca436dc488113dd5cf050c4f8076f6f569d79ada250578ad50ccb6c9db7c77ca20948e280ccf60782e8e5d9954906e278f189d44387d52577d3b8826e2641665a78111352772b39b3e53d9cc6a421b1fe2c08fe712645338ab85b19118fd7d618c5bfdce8d446079398b074692c6148a6dbdcf270f959cf4caaac6a00c8a11871b8782ff0502532d38bafa8ff7a986514b7f227e2bcb2a9ba591ed2e920d711828ae81e2188fc649dc149e0a1ad14d1d455bbbe50ae35b1d8511860d9ae93bbc48bfb9edd30488ee0e31f611884f3c71b2ef6cf14a4585d91795e07b380e9a945f4127162dc521e2c77750fd3ce4ff1e10e6bd6e62965d6a54e83f79c221cffad52dddd9d9897db96c29f74e510c6fc48d253452bd510373277dd45442b5581855f9d18f01a8cb65e979c4c66194b108bd92dc46f413222cd9713d35b63ae579cc4d639fa58a6d7a152a9fc67a6deb3aa2ff0c815504d0c4efa2adec6ca28cfebc971dadc98fa36be7a08cbd9c8ea2815c57caab8aa205a28103a5401831683423c6f7fb781f9b110672a84b2d185ee57ac5a27f4faee9475fcd0fecde5013f6bb257a23c0d81209b477147e1a429343a57bd7946ed9bb9299a70e799ebcb6854a39d8e9e5d5358a1187722da9adfce18806d1bac04d49da7974a652349a9e2ae757cd3a472a85b3521855b5230200cf1abe0f478c3a8b9e12468d62e2371a0b58f3f2140957b991be36993fbf5c18f3502c5eaf6d2d088baa117f4460ae009af89d7c913587ca4e9fc9f07fe94c275b5279ae86c6afa89b2f71a9da22c5b0d21a5548a3838ee24d3e8ac3334aa5ea8851a65261780b430ceadac571e9987042a1431aeda6185f281aaf86c29722d970c9c9fc94c811789f0461b8a4c9f871e1c19319e0375ee99c88c29f7f3556adf0451cf2c8d37e290259a20ca74f71184981d934f6538a68a45c4e9468a18a949b9f502d12467c49a20b674bbd8f1eae39284640eab6673d50a905ef2029a177f41c72b3cfe3c74d203768978d39fc890cae5b0ffc4502b5ff594420e3777248761d2a2385bc8fbd2026535f44cbf3c6e6f1a1348055d15315b743d168269a51cd6caafdc9c208c37bd1be07c787e1c38a37eccb702e45236a20fe2967035392330829ddc24092fa5dca628c276b303b8a40b9b7990a78f8da1c31a6b42ec7066a111ab5ecda49616864ab4d42e9adf0bfe8b87989a8c1a49151649678809147eae5d4368a68e4528766004fd0d9342795aa872e0fd1d4a43cbe8f0fb2b49adce29f4c6922dd10c5a5ea697e82c9cac21871583e43623347f457085ce982160920e3a709bcb1c8fa5bcaf011e5afeacf72e3135938872b736d6ad2ae1b5568a462c3f995f87c4a73f8e18ac73a0c1fc5ee050c9faae766e90d4d1a4903efd3b20997307c168b96f8eeaa4d79599d2a5a2a3da84d3fc1cc16a6b2f9fc3473a2304759a424d98a4554ae48e45ac2fc2030951dd5c3d2acfb3384fcbf7aa0f238a48ff31296fa265c6b4949284f4528af9de84aa92e9cb0075b228c090effd011cdadc8ff1981590134f1bb7b23bbde26bb75c8f0417cd5f93c4eb4b6e4352f6785d5d2a381ff8583ac424e55d8dbe253c0f045b46ae2c3139fcfe2fc4cb4f0301e57cf0025dfb025eb7b97054fb028f0e3c59afe312b592f83af029c7da998f9cc772993899654b4a6561bf4d5f8e43903095b95e9c9fde8a208b324c84ca962b18f6a70f8a73298db10f3170456c1efe194ecba4f765ba35b7c02be55ec329da97a63497f42f64a84f7f17a4f34ae556ffc07cca2dea030da03ebdfe5108dbcb8bc186fa5e8a5498846ac3e3b3ceae26b7db11f9bfad0f25264616c5901c26ac91bc9e11fc960ae235ad610531a07e61258510073f143bb7921bbfb50868fe36bf19d39cb8a5f492ff150d29690faedd442306b4ff6ff7b34b22d545ef49fe79097ae21b12acdb8145191b80e86aab8af8753495740c9dc8e2a7e66ae30a650ccd2b8661ed5e4300961c5e6985f71447f97c01201cce2f7f04e76bb24bb7923c307f125f856f4fe5ff495b8e458fd57f3c9c6434c7daaff451a8575f1b7fe6a76b9411c9abc7046c5fc67ea38c7d34de550c9f694afe898fb3d61dcd83b2d459139fc990cfec411fd53024b04308bdffd92ec7948d63ba65b52c86da9908772858e0775ce5634a327eb22780ec2adff268d3277daf97d6de4ac0c57cff5d227e584301bf161f4d4c0e031609685cd446bee64ab9631f5b14418abc78abf8e621e8d06871503a1b8566374fd95c86095507025812bd330e504a604b004bf9b67b2fb1ad9dd3bddd2832f4a21591ef5b9acd200d48a960898daff611a7feca9f28e34948011920143b28af48a38d123419feb437596d9f8bcf32558b564b4d3658f3f12c68d7dd48d6afddce7bd66a376ec95d57e5f064b32316b1158248029fc10b32c7ed625d96d479a27ad434fa3f7399559d68e71824b5bcfcd15e8f0f8e090ed6f981afd53234f75b0b39a463bdab99e8bfe97727e3d1e8d44f75246b5142a1df5bffaf4f159e333c8213d3d28cf2f9f6b4da346b19cc6a235018a44b8bc41e71ff4510d0ecb7dd1fca4e8fa32b8d211fd45028b0450ab1f135888df1ed9c319d9dd58190389ef891f8adf509ff51478d985e77432f64c4e3f0be1afd1da84c650a85dca1939b94fab6a92c653cf0b05e1afd64d119a162d5cfa0e3ec850e1a9311d133e3bf8279f2f0ee057d2981246a6f18f84f19ff4512314230eab54264a92a29bc9607547f417094c0920e2c70426d42f89dfed8eb839277bda226bdb745f2b645fba5545e0e9c0c66c796580fb424e2c5ed759b5b813ad7a635d25026962a1a046d3c51b8d0c3a7d6d3af2789cf908332d2630fa5ce02d3d81e97a57475b3b1d7887cf02fe179f972a342ac18c68dccc4d4d75ae6a1a53d31d2b76ae16a1f8c39246cce1da32980be1af3aa2bf4860d605cd11c00c7ec89e891fb28776df25bb3d26bb99cbdb737a15be39d73cf4e048fd22b3d747ff3a1a581d3af2b57965a816742ef16d9b727d3499041230590f397afe82fada10b953b979289d7deef0d2f3e5efe9eb315d0c0c339302061fc1e3a98f2447d468f8201f6d3c326bd1a851d7c2c8345677533713c6eac99baa3eea7a999b88c37fd217cd95c1724754d7033726b04c0023ff33ab7e29fc903dc2ef91ecae4b76bb2ded919e86ef762347a7e9a1a5d24ba966576d3492e4dcabf7170ad50cb468163c3e52978d5a78c44ca140a3717946e79b37b7ea835436901da43b940ee5653b1075e567dea9ecff6585e00a1fc49fc331761133f85f74303d753c7f48a3e63c4563b99bba56c4588ee25ff8a8d9891a1914b9bff4577dd16cc6e217653037175a9dc08400eea505308b5f2c7d117b0c5e1bc86e1fa4a1263c90e11dfc2f7c397e168db3b7c4af30bb5bf52fd266ba7cfc423c0e78b83818339f937a66ae23a787ac997ed4d7855c31c9765dc7a16f9b0e3833c3d8a4e4911ee4e399a49181e4e39fa5913367256f9beba65611c69f448cff7cb898e070dd2e998d7dd18a32984b204398ad46a408cc16218a0834fd4f1dfb95e3a7d963fc6e9fc8da16d99d4f767b2d1f017a37fc1af80df578d214f16fd1c6579675cd7c872c9f1af854a05531d64ae9c9a5d4613ed45911c33ff960e2ada2d153346a79ac4263d6075ee9a6ea5f51924afd398a7f1f2ef2be6b2b6bf41bf9a2d593a259192c77448b08acae8129024d01d4ce6715fc62f6d0aea4b5c8ee84bcf5e9e5f85934e66a31423cd4cc068394f10f342df769e6fb64f9ccad0a54f7f1b2b304f17ff10d4d72f00e1e733cc81427ef28c73e4b63ca53e50be57d943f5bcb4d2dcfdf940be3aff8a8e5258d4d518c38ac0861795eb4a440bf6e34982b83b9a1606e2e3497c02217d40cffccc02f763eb5e79995be147b37cac24bb29b1b32bc83cfa1f7f4e41736e8d2adadda78941759f6f9b9a09a6466992c1fd0b940eaa1ccc24897bc1a1d527d0943c3fb1bd368068db96e6a49c4b8168a268d8528baff3c8a3cdf625556a6a87de48729999268702d19341dd1742626a3815917b45000f3d42f96be883dc6cf04efd697f6aceca6a38cfe6cd167d1588c069f369deecfb767fae6f8a3f097a65e98a53405672e9645f53a13484eccf28378ab5e2e41c2a34787eb51e58df95a5646634116a78a9b6a6686aa478cebfaa8ab9be0fe10c588c3df0d08cb7dd1a2da60151934db62528ea8598dd88cc054ea258d5f247d59f64cf01472b6b47bb28706d9ed476cf4846bfa1acc9556f212c39fc35fef4e7e731adf9dc438be374836f934c94c8dec845af6e3ffc55b3eb07c9b0aedf4a7e051bdefaa10ba3a8da9a0d14ca8a6dcd48d85b1bcdcff47999b9fb5bf490eff14c2a2027d6e4a665d19cc3aa2a96260ae175a48a0218045ea97c62fc55e06bcf636d95da0ec4128bb6dcadb7bfa2cfc62f8b5f93a9232ad1ef8d3e84b3e290f59a76709839db815563b7b7c2711893d27729894d43d5366966d72fd49131bf33df196ae111d196c1f2bcba5517f50118d2937b54818aba452b33eeaca5affaf646eaaa298b34455c4e1cf21ac529ca89e924995255232b8d2114d1503ab10582e8045f869dd4bb197a50ead7daeecce53767b22ad496f821f4a40ee4585cd9479f40d392e45e330551b7e7ffc21f80359f069f41f47816ea457fca77626b30a56d1a5cc8a185f1ce9fe333d9f2a37d1db6669cc0d1a7325375718737d542d8c157dd4ff1e8a5cb73021ac9c1adda038510e61892f5a5506f31cd12a04a63530e37f9ace670abf5cf64cf012c8a17d47d6356c46464fb355cd837f8b36ea136059be4adab5b214a27c4d8995f354b9dcf4ab650c7c97742999498d4d9a9cbdd5e498912a75fcbdd3cbf9f86b14d33416086349c4985b63fcb98f9a6d0d5f9144ad5ccfa886a2c1e1cf21ac1e10aeeb8ba692a2e53258140a56d5c056023f2d8025f8a5d84b806722378b6caeacdf49190c5fe9710692b091bdacf4139ee2642c1b5f26b840a22c0927fda22b45a6c65233a9b2c1db0991ccf52a73e1c94db7e48898248a5eb593278cd5f02e12c65c1fb53a8a2b0bfd1bd4333645f1fffecffffb3fff1fe8219226</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>doneHere</sender>
+ <signal>clicked()</signal>
+ <receiver>AboutBox</receiver>
+ <slot>close()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/aboutbox_impl.cpp b/muse2/muse/widgets/aboutbox_impl.cpp
new file mode 100644
index 00000000..9ea20aad
--- /dev/null
+++ b/muse2/muse/widgets/aboutbox_impl.cpp
@@ -0,0 +1,10 @@
+#include <qlabel.h>
+#include "aboutbox_impl.h"
+#include "config.h"
+
+AboutBoxImpl::AboutBoxImpl()
+{
+ QString version(VERSION);
+ QString svnrevision(SVNVERSION);
+ versionLabel->setText("Version: " + version + " (svn revision: "+ svnrevision +")");
+}
diff --git a/muse2/muse/widgets/aboutbox_impl.h b/muse2/muse/widgets/aboutbox_impl.h
new file mode 100644
index 00000000..4584de9a
--- /dev/null
+++ b/muse2/muse/widgets/aboutbox_impl.h
@@ -0,0 +1,16 @@
+#ifndef ABOUTBOXIMPL_H
+#define ABOUTBOXIMPL_H
+
+#include "aboutbox.h"
+
+class AboutBoxImpl : public AboutBox
+{
+ Q_OBJECT
+
+public:
+ AboutBoxImpl();
+
+
+};
+
+#endif // ABOUTBOXIMPL_H
diff --git a/muse2/muse/widgets/action.h b/muse2/muse/widgets/action.h
new file mode 100644
index 00000000..74635f0a
--- /dev/null
+++ b/muse2/muse/widgets/action.h
@@ -0,0 +1,32 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: action.h,v 1.1.1.1.2.1 2008/01/19 13:33:46 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __ACTION_H__
+#define __ACTION_H__
+
+#include <Qt3Support>
+
+//---------------------------------------------------------
+// Action
+//---------------------------------------------------------
+
+class Action : public Q3Action {
+ Q_OBJECT
+ int _id;
+
+ public:
+ Action(QObject* parent, int i, const char* name = 0, bool toggle = false)
+ : Q3Action(parent, name, toggle) {
+ _id = i;
+ }
+ void setId(int i) { _id = i; }
+ int id() const { return _id; }
+ };
+
+
+#endif
+
diff --git a/muse2/muse/widgets/appearancebase.ui b/muse2/muse/widgets/appearancebase.ui
new file mode 100644
index 00000000..7c9a3e97
--- /dev/null
+++ b/muse2/muse/widgets/appearancebase.ui
@@ -0,0 +1,1764 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>AppearanceDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>AppearanceDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>591</width>
+ <height>597</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Appearance settings</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>TabWidget2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Arranger</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QButtonGroup" row="0" column="0">
+ <property name="name">
+ <cstring>ButtonGroup3</cstring>
+ </property>
+ <property name="title">
+ <string>Parts</string>
+ </property>
+ <property name="radioButtonExclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>partShownames</cstring>
+ </property>
+ <property name="text">
+ <string>show names</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>partShowevents</cstring>
+ </property>
+ <property name="text">
+ <string>show events</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>partShowCakes</cstring>
+ </property>
+ <property name="text">
+ <string>show Cakewalk Style</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox" row="0" column="1">
+ <property name="name">
+ <cstring>eventButtonGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Events</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>eventNoteon</cstring>
+ </property>
+ <property name="text">
+ <string>note on</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>eventPolypressure</cstring>
+ </property>
+ <property name="text">
+ <string>poly pressure</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>eventController</cstring>
+ </property>
+ <property name="text">
+ <string>controller</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>eventAftertouch</cstring>
+ </property>
+ <property name="text">
+ <string>aftertouch</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="1">
+ <property name="name">
+ <cstring>eventPitchbend</cstring>
+ </property>
+ <property name="text">
+ <string>pitch bend</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="1">
+ <property name="name">
+ <cstring>eventProgramchange</cstring>
+ </property>
+ <property name="text">
+ <string>program change</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="0">
+ <property name="name">
+ <cstring>eventSpecial</cstring>
+ </property>
+ <property name="text">
+ <string>special</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Background picture</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>currentBgLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>bg</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignLeft</set>
+ </property>
+ <property name="indent">
+ <number>-1</number>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>selectBgButton</cstring>
+ </property>
+ <property name="text">
+ <string>select...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>clearBgButton</cstring>
+ </property>
+ <property name="text">
+ <string>clear</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>arrGrid</cstring>
+ </property>
+ <property name="text">
+ <string>show snap grid</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Colors</string>
+ </attribute>
+ <vbox>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup" row="0" column="1">
+ <property name="name">
+ <cstring>aPalette</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="title">
+ <string>Palette</string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <property name="selectedId" stdset="0">
+ <number>0</number>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>palette0</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="on">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>palette1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="0">
+ <property name="name">
+ <cstring>palette2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>2</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="3" column="0">
+ <property name="name">
+ <cstring>palette3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>3</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="4" column="0">
+ <property name="name">
+ <cstring>palette4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>4</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="5" column="0">
+ <property name="name">
+ <cstring>palette5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>5</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="1">
+ <property name="name">
+ <cstring>palette8</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>8</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>palette9</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>9</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="1">
+ <property name="name">
+ <cstring>palette10</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>238</red>
+ <green>222</green>
+ <blue>222</blue>
+ </color>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>10</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="3" column="1">
+ <property name="name">
+ <cstring>palette11</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>11</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="4" column="1">
+ <property name="name">
+ <cstring>palette12</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>12</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="5" column="1">
+ <property name="name">
+ <cstring>palette13</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>13</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="7" column="0">
+ <property name="name">
+ <cstring>palette7</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>7</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="6" column="0">
+ <property name="name">
+ <cstring>palette6</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>6</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="7" column="1">
+ <property name="name">
+ <cstring>palette15</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>15</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="6" column="1">
+ <property name="name">
+ <cstring>palette14</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>14</number>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>addToPalette</cstring>
+ </property>
+ <property name="text">
+ <string>add to palette</string>
+ </property>
+ </widget>
+ <widget class="QFrame" row="0" column="2" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>colorframe</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSpinBox" row="0" column="1">
+ <property name="name">
+ <cstring>rval</cstring>
+ </property>
+ <property name="maxValue">
+ <number>255</number>
+ </property>
+ </widget>
+ <widget class="QSlider" row="3" column="2">
+ <property name="name">
+ <cstring>hslider</cstring>
+ </property>
+ <property name="maxValue">
+ <number>255</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>B</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel5_2</cstring>
+ </property>
+ <property name="text">
+ <string>S</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel4_2</cstring>
+ </property>
+ <property name="text">
+ <string>H</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="1">
+ <property name="name">
+ <cstring>bval</cstring>
+ </property>
+ <property name="maxValue">
+ <number>255</number>
+ </property>
+ </widget>
+ <widget class="QSlider" row="5" column="2">
+ <property name="name">
+ <cstring>vslider</cstring>
+ </property>
+ <property name="maxValue">
+ <number>255</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>textLabel6_2</cstring>
+ </property>
+ <property name="text">
+ <string>V</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>G</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="4" column="1">
+ <property name="name">
+ <cstring>sval</cstring>
+ </property>
+ <property name="maxValue">
+ <number>255</number>
+ </property>
+ </widget>
+ <widget class="QSlider" row="1" column="2">
+ <property name="name">
+ <cstring>gslider</cstring>
+ </property>
+ <property name="maxValue">
+ <number>255</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QSlider" row="4" column="2">
+ <property name="name">
+ <cstring>sslider</cstring>
+ </property>
+ <property name="maxValue">
+ <number>255</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QSlider" row="2" column="2">
+ <property name="name">
+ <cstring>bslider</cstring>
+ </property>
+ <property name="maxValue">
+ <number>255</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="1">
+ <property name="name">
+ <cstring>gval</cstring>
+ </property>
+ <property name="maxValue">
+ <number>255</number>
+ </property>
+ </widget>
+ <widget class="QSlider" row="0" column="2">
+ <property name="name">
+ <cstring>rslider</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="maxValue">
+ <number>255</number>
+ </property>
+ <property name="tracking">
+ <bool>true</bool>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="tickmarks">
+ <enum>NoMarks</enum>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="5" column="1">
+ <property name="name">
+ <cstring>vval</cstring>
+ </property>
+ <property name="maxValue">
+ <number>255</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="1">
+ <property name="name">
+ <cstring>hval</cstring>
+ </property>
+ <property name="maxValue">
+ <number>255</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>R</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QListView" row="0" column="0" rowspan="3" colspan="1">
+ <column>
+ <property name="text">
+ <string>Items</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>itemList</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ </grid>
+ <spacer>
+ <property name="name">
+ <cstring>botColorSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Style/Fonts</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox18</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>QT Theme</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>Windows</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>MusE</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Metal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Norwegian Wood</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Platinum</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>CDE</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Motif</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Motif Plus</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>themeComboBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>190</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox6</cstring>
+ </property>
+ <property name="title">
+ <string>Fonts</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Family</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>TextLabel1_1</cstring>
+ </property>
+ <property name="text">
+ <string>Size</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Font 1</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Font 2</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Font 3</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>fontName0</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>fontName1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>fontName2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="4" column="1">
+ <property name="name">
+ <cstring>fontName3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Font 0</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="2">
+ <property name="name">
+ <cstring>fontSize0</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="2">
+ <property name="name">
+ <cstring>fontSize1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="2">
+ <property name="name">
+ <cstring>fontSize2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="4" column="2">
+ <property name="name">
+ <cstring>fontSize3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="3">
+ <property name="name">
+ <cstring>bold1</cstring>
+ </property>
+ <property name="text">
+ <string>Bold</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="3">
+ <property name="name">
+ <cstring>bold2</cstring>
+ </property>
+ <property name="text">
+ <string>Bold</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="3">
+ <property name="name">
+ <cstring>bold3</cstring>
+ </property>
+ <property name="text">
+ <string>Bold</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="3">
+ <property name="name">
+ <cstring>bold0</cstring>
+ </property>
+ <property name="text">
+ <string>Bold</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="4">
+ <property name="name">
+ <cstring>italic2</cstring>
+ </property>
+ <property name="text">
+ <string>Italic</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="4">
+ <property name="name">
+ <cstring>italic3</cstring>
+ </property>
+ <property name="text">
+ <string>Italic</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="4">
+ <property name="name">
+ <cstring>italic1</cstring>
+ </property>
+ <property name="text">
+ <string>Italic</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="4">
+ <property name="name">
+ <cstring>italic0</cstring>
+ </property>
+ <property name="text">
+ <string>Italic</string>
+ </property>
+ </widget>
+ <widget class="QToolButton" row="1" column="5">
+ <property name="name">
+ <cstring>fontBrowse0</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ <widget class="QToolButton" row="2" column="5">
+ <property name="name">
+ <cstring>fontBrowse1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ <widget class="QToolButton" row="3" column="5">
+ <property name="name">
+ <cstring>fontBrowse2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ <widget class="QToolButton" row="4" column="5">
+ <property name="name">
+ <cstring>fontBrowse3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>textLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>Font 4</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="5" column="1">
+ <property name="name">
+ <cstring>fontName4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>textLabel7_2</cstring>
+ </property>
+ <property name="text">
+ <string>Font 5</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="6" column="1">
+ <property name="name">
+ <cstring>fontName5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="7" column="0">
+ <property name="name">
+ <cstring>textLabel7_3</cstring>
+ </property>
+ <property name="text">
+ <string>Font 6</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="7" column="1">
+ <property name="name">
+ <cstring>fontName6</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="7" column="2">
+ <property name="name">
+ <cstring>fontSize6</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="7" column="3">
+ <property name="name">
+ <cstring>bold6</cstring>
+ </property>
+ <property name="text">
+ <string>Bold</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="7" column="4">
+ <property name="name">
+ <cstring>italic6</cstring>
+ </property>
+ <property name="text">
+ <string>Italic</string>
+ </property>
+ </widget>
+ <widget class="QToolButton" row="7" column="5">
+ <property name="name">
+ <cstring>fontBrowse6</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="5" column="2">
+ <property name="name">
+ <cstring>fontSize4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="6" column="2">
+ <property name="name">
+ <cstring>fontSize5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="5" column="3">
+ <property name="name">
+ <cstring>bold4</cstring>
+ </property>
+ <property name="text">
+ <string>Bold</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="6" column="3">
+ <property name="name">
+ <cstring>bold5</cstring>
+ </property>
+ <property name="text">
+ <string>Bold</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="5" column="4">
+ <property name="name">
+ <cstring>italic4</cstring>
+ </property>
+ <property name="text">
+ <string>Italic</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="6" column="4">
+ <property name="name">
+ <cstring>italic5</cstring>
+ </property>
+ <property name="text">
+ <string>Italic</string>
+ </property>
+ </widget>
+ <widget class="QToolButton" row="5" column="5">
+ <property name="name">
+ <cstring>fontBrowse4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ <widget class="QToolButton" row="6" column="5">
+ <property name="name">
+ <cstring>fontBrowse5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>applyButton</cstring>
+ </property>
+ <property name="text">
+ <string>Apply</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okButton</cstring>
+ </property>
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>rslider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>rval</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+ <connection>
+ <sender>gslider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>gval</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+ <connection>
+ <sender>bslider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>bval</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+ <connection>
+ <sender>hslider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>hval</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+ <connection>
+ <sender>sslider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>sval</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+ <connection>
+ <sender>vslider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>vval</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+ <connection>
+ <sender>rval</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>rslider</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+ <connection>
+ <sender>gval</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>gslider</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+ <connection>
+ <sender>bval</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>bslider</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+ <connection>
+ <sender>hval</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>hslider</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+ <connection>
+ <sender>sval</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>sslider</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+ <connection>
+ <sender>vval</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>vslider</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>TabWidget2</tabstop>
+ <tabstop>itemList</tabstop>
+ <tabstop>palette0</tabstop>
+ <tabstop>palette1</tabstop>
+ <tabstop>palette2</tabstop>
+ <tabstop>palette3</tabstop>
+ <tabstop>palette4</tabstop>
+ <tabstop>palette5</tabstop>
+ <tabstop>palette6</tabstop>
+ <tabstop>palette7</tabstop>
+ <tabstop>palette8</tabstop>
+ <tabstop>palette9</tabstop>
+ <tabstop>palette10</tabstop>
+ <tabstop>palette11</tabstop>
+ <tabstop>palette12</tabstop>
+ <tabstop>palette13</tabstop>
+ <tabstop>palette14</tabstop>
+ <tabstop>palette15</tabstop>
+ <tabstop>addToPalette</tabstop>
+ <tabstop>rval</tabstop>
+ <tabstop>rslider</tabstop>
+ <tabstop>gval</tabstop>
+ <tabstop>gslider</tabstop>
+ <tabstop>bval</tabstop>
+ <tabstop>bslider</tabstop>
+ <tabstop>hval</tabstop>
+ <tabstop>hslider</tabstop>
+ <tabstop>sval</tabstop>
+ <tabstop>sslider</tabstop>
+ <tabstop>vval</tabstop>
+ <tabstop>vslider</tabstop>
+ <tabstop>applyButton</tabstop>
+ <tabstop>okButton</tabstop>
+ <tabstop>cancelButton</tabstop>
+ <tabstop>partShownames</tabstop>
+ <tabstop>partShowevents</tabstop>
+ <tabstop>partShowCakes</tabstop>
+ <tabstop>eventNoteon</tabstop>
+ <tabstop>eventPolypressure</tabstop>
+ <tabstop>eventController</tabstop>
+ <tabstop>eventAftertouch</tabstop>
+ <tabstop>eventPitchbend</tabstop>
+ <tabstop>eventProgramchange</tabstop>
+ <tabstop>eventSpecial</tabstop>
+ <tabstop>selectBgButton</tabstop>
+ <tabstop>arrGrid</tabstop>
+ <tabstop>themeComboBox</tabstop>
+ <tabstop>fontName0</tabstop>
+ <tabstop>fontName1</tabstop>
+ <tabstop>fontName2</tabstop>
+ <tabstop>fontName3</tabstop>
+ <tabstop>fontSize0</tabstop>
+ <tabstop>fontSize1</tabstop>
+ <tabstop>fontSize2</tabstop>
+ <tabstop>fontSize3</tabstop>
+ <tabstop>bold1</tabstop>
+ <tabstop>bold2</tabstop>
+ <tabstop>bold3</tabstop>
+ <tabstop>bold0</tabstop>
+ <tabstop>italic2</tabstop>
+ <tabstop>italic3</tabstop>
+ <tabstop>italic1</tabstop>
+ <tabstop>italic0</tabstop>
+ <tabstop>fontName4</tabstop>
+ <tabstop>fontName5</tabstop>
+ <tabstop>fontSize4</tabstop>
+ <tabstop>fontSize5</tabstop>
+ <tabstop>bold4</tabstop>
+ <tabstop>bold5</tabstop>
+ <tabstop>italic4</tabstop>
+ <tabstop>italic5</tabstop>
+</tabstops>
+<slots>
+ <slot>new_slot()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/bigtime.cpp b/muse2/muse/widgets/bigtime.cpp
new file mode 100644
index 00000000..16cfe071
--- /dev/null
+++ b/muse2/muse/widgets/bigtime.cpp
@@ -0,0 +1,442 @@
+#include <stdio.h>
+#include <qpalette.h>
+#include <qlabel.h>
+#include <qcolor.h>
+#include <qlayout.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+#include <QResizeEvent>
+#include <values.h>
+
+#include <qtooltip.h>
+#include "globals.h"
+#include "bigtime.h"
+#include "song.h"
+#include "app.h"
+#include "gconfig.h"
+
+extern int mtcType;
+
+//
+// the bigtime widget
+// display is split into several parts to avoid flickering.
+//
+
+//---------------------------------------------------------
+// BigTime
+//---------------------------------------------------------
+
+BigTime::BigTime(QWidget* parent)
+ : QWidget(parent, 0, Qt::WType_TopLevel | Qt::WStyle_StaysOnTop)
+ {
+
+ tickmode = true;
+ dwin = new QWidget(this, "bigtime-dwin", Qt::WStyle_StaysOnTop);
+ dwin->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
+ fmtButton = new QCheckBox(QString(""), this);
+ fmtButton->resize(18,18);
+ fmtButton->setChecked(true);
+ QToolTip::add(fmtButton, tr("format display"));
+ barLabel = new QLabel(dwin);
+ beatLabel = new QLabel(dwin);
+ tickLabel = new QLabel(dwin);
+ //hourLabel = new QLabel(dwin);
+ minLabel = new QLabel(dwin);
+ secLabel = new QLabel(dwin);
+ frameLabel = new QLabel(dwin);
+ subFrameLabel = new QLabel(dwin);
+ sep1 = new QLabel(QString("."), dwin);
+ sep2 = new QLabel(QString("."), dwin);
+ sep3 = new QLabel(QString(":"), dwin);
+ sep4 = new QLabel(QString(":"), dwin);
+ sep5 = new QLabel(QString(":"), dwin);
+ absTickLabel = new QLabel(dwin);
+ absFrameLabel = new QLabel(dwin);
+ QToolTip::add(barLabel, tr("bar"));
+ QToolTip::add(beatLabel, tr("beat"));
+ QToolTip::add(tickLabel, tr("tick"));
+ //QToolTip::add(hourLabel, tr("hour"));
+ QToolTip::add(minLabel, tr("minute"));
+ QToolTip::add(secLabel, tr("second"));
+ QToolTip::add(frameLabel, tr("frame"));
+ QToolTip::add(subFrameLabel, tr("subframe"));
+ QToolTip::add(absTickLabel, tr("tick"));
+ QToolTip::add(absFrameLabel, tr("frame"));
+ fmtButtonToggled(true);
+ connect(fmtButton, SIGNAL(toggled(bool)), SLOT(fmtButtonToggled(bool)));
+ //oldbar = oldbeat = oldtick = oldhour = oldmin = oldsec = oldframe = -1;
+ oldbar = oldbeat = oldtick = oldmin = oldsec = oldframe = oldsubframe = -1;
+ oldAbsTick = oldAbsFrame = -1;
+ setString(MAXINT);
+
+ configChanged();
+
+ QFont f(QString("Courier"));
+ f.setPixelSize(10);
+
+ dwin->setFont(f);
+ setCaption(tr("MusE: Bigtime"));
+ }
+
+
+//---------------------------------------------------------
+// fmtButtonToggled
+//---------------------------------------------------------
+
+void BigTime::fmtButtonToggled(bool v)
+{
+ if(v)
+ {
+ tickmode = true;
+
+ barLabel->setEnabled(true);
+ beatLabel->setEnabled(true);
+ tickLabel->setEnabled(true);
+ //hourLabel->setEnabled(true);
+ minLabel->setEnabled(true);
+ secLabel->setEnabled(true);
+ frameLabel->setEnabled(true);
+ subFrameLabel->setEnabled(true);
+ sep1->setEnabled(true);
+ sep2->setEnabled(true);
+ sep3->setEnabled(true);
+ sep4->setEnabled(true);
+ sep5->setEnabled(true);
+ absTickLabel->setEnabled(false);
+ absFrameLabel->setEnabled(false);
+
+ barLabel->show();
+ beatLabel->show();
+ tickLabel->show();
+ //hourLabel->show();
+ minLabel->show();
+ secLabel->show();
+ frameLabel->show();
+ subFrameLabel->show();
+ sep1->show();
+ sep2->show();
+ sep3->show();
+ sep4->show();
+ sep5->show();
+ absTickLabel->hide();
+ absFrameLabel->hide();
+ }
+ else
+ {
+ tickmode = false;
+
+ barLabel->setEnabled(false);
+ beatLabel->setEnabled(false);
+ tickLabel->setEnabled(false);
+ //hourLabel->setEnabled(false);
+ minLabel->setEnabled(false);
+ secLabel->setEnabled(false);
+ frameLabel->setEnabled(false);
+ subFrameLabel->setEnabled(false);
+ sep1->setEnabled(false);
+ sep2->setEnabled(false);
+ sep3->setEnabled(false);
+ sep4->setEnabled(false);
+ sep5->setEnabled(false);
+ absTickLabel->setEnabled(true);
+ absFrameLabel->setEnabled(true);
+
+ barLabel->hide();
+ beatLabel->hide();
+ tickLabel->hide();
+ //hourLabel->hide();
+ minLabel->hide();
+ secLabel->hide();
+ frameLabel->hide();
+ subFrameLabel->hide();
+ sep1->hide();
+ sep2->hide();
+ sep3->hide();
+ sep4->hide();
+ sep5->hide();
+ absTickLabel->show();
+ absFrameLabel->show();
+ }
+}
+
+//---------------------------------------------------------
+// configChanged
+//---------------------------------------------------------
+
+void BigTime::configChanged()
+ {
+ setBgColor(config.bigTimeBackgroundColor);
+ setFgColor(config.bigTimeForegroundColor);
+ }
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void BigTime::closeEvent(QCloseEvent *ev)
+ {
+ emit closed();
+ QWidget::closeEvent(ev);
+ }
+
+//---------------------------------------------------------
+// setString
+//---------------------------------------------------------
+
+bool BigTime::setString(unsigned v)
+ {
+ if (v == MAXINT) {
+ barLabel->setText(QString("----"));
+ beatLabel->setText(QString("--"));
+ tickLabel->setText(QString("---"));
+ //hourLabel->setText(QString("--"));
+ //minLabel->setText(QString("--"));
+ minLabel->setText(QString("---"));
+ secLabel->setText(QString("--"));
+ frameLabel->setText(QString("--"));
+ subFrameLabel->setText(QString("--"));
+
+ absTickLabel->setText(QString("----------"));
+ absFrameLabel->setText(QString("----------"));
+ oldAbsTick = oldAbsFrame = -1;
+ //oldbar = oldbeat = oldtick = oldhour = oldmin = oldsec = oldframe = -1;
+ oldbar = oldbeat = oldtick = oldmin = oldsec = oldframe = oldsubframe = -1;
+ return true;
+ }
+
+ unsigned absFrame = tempomap.tick2frame(v);
+ int bar, beat;
+ unsigned tick;
+ sigmap.tickValues(v, &bar, &beat, &tick);
+ double time = double(absFrame)/double(sampleRate);
+ //int hour = int(time) / 3600;
+ //int min = (int(time) / 60) % 60;
+ int min = int(time) / 60;
+ int sec = int(time) % 60;
+ double rest = time - (min * 60 + sec);
+ switch(mtcType) {
+ case 0: // 24 frames sec
+ rest *= 24;
+ break;
+ case 1: // 25
+ rest *= 25;
+ break;
+ case 2: // 30 drop frame
+ rest *= 30;
+ break;
+ case 3: // 30 non drop frame
+ rest *= 30;
+ break;
+ }
+ int frame = int(rest);
+ int subframe = int((rest-frame)*100);
+
+ QString s;
+
+ if(oldAbsTick != v) {
+ s.sprintf("%010d", v);
+ absTickLabel->setText(s);
+ oldAbsTick = v;
+ }
+ if(oldAbsFrame != absFrame) {
+ s.sprintf("%010d", absFrame);
+ absFrameLabel->setText(s);
+ oldAbsFrame = absFrame;
+ }
+ if(oldbar != bar) {
+ s.sprintf("%04d", bar+1);
+ barLabel->setText(s);
+ oldbar = bar;
+ }
+ if(oldbeat != beat) {
+ s.sprintf("%02d", beat+1);
+ beatLabel->setText(s);
+ oldbeat = beat;
+ }
+
+ if(oldtick != tick) {
+ s.sprintf("%03d", tick);
+ tickLabel->setText(s);
+ oldtick = tick;
+ }
+
+ //if(oldhour != hour) {
+ // s.sprintf("%02d", hour);
+ // hourLabel->setText(s);
+ // oldhour = hour;
+ //}
+
+ if(oldmin != min) {
+ //s.sprintf("%02d", min);
+ s.sprintf("%03d", min);
+ minLabel->setText(s);
+ oldmin = min;
+ }
+
+ if(oldsec != sec) {
+ s.sprintf("%02d", sec);
+ secLabel->setText(s);
+ oldsec = sec;
+ }
+
+ if(oldframe != frame) {
+ s.sprintf("%02d", frame);
+ frameLabel->setText(s);
+ oldframe = frame;
+ }
+
+ if(oldsubframe != subframe) {
+ s.sprintf("%02u", subframe);
+ subFrameLabel->setText(s);
+ oldsubframe = subframe;
+ }
+
+ return false;
+ }
+
+//---------------------------------------------------------
+// setPos
+//---------------------------------------------------------
+
+void BigTime::setPos(int idx, unsigned v, bool)
+ {
+ if (idx == 0)
+ setString(v);
+ }
+
+//---------------------------------------------------------
+// resizeEvent
+//---------------------------------------------------------
+
+void BigTime::resizeEvent(QResizeEvent *ev)
+ {
+ dwin->resize(ev->size());
+ QFont f = dwin->font();
+ QFontMetrics fm(f);
+ int fs = f.pixelSize();
+ int hspace = 20;
+ //int tw = fm.width(QString("00:00:00:00"));
+ int tw = fm.width(QString("000:00:00:00"));
+
+ fs = ((ev->size().width() - hspace*2)*fs) / tw;
+// printf("resize BigTime %d -> %d, w %d\n", fs, nfs, ev->size().width());
+
+ // set min/max
+ if (fs < 10)
+ fs = 10;
+ else if (fs > 256)
+ fs = 256;
+ f.setPixelSize(fs);
+
+
+ dwin->setFont(f);
+ int digitWidth = dwin->fontMetrics().width(QString("0"));
+ int vspace = (ev->size().height() - (fs*2)) / 3;
+ int tickY = vspace;
+
+ int timeY = vspace*2 + fs;
+ int absTickY = tickY;
+ int absFrameY = timeY;
+ barLabel->resize(digitWidth*4, fs);
+ beatLabel->resize(digitWidth*2, fs);
+ tickLabel->resize(digitWidth*3, fs);
+ //hourLabel->resize(digitWidth*2, fs);
+ //minLabel->resize(digitWidth*2, fs);
+ minLabel->resize(digitWidth*3, fs);
+ secLabel->resize(digitWidth*2, fs);
+ frameLabel->resize(digitWidth*2, fs);
+ subFrameLabel->resize(digitWidth*2, fs);
+
+ absTickLabel->resize(digitWidth*10, fs);
+ absFrameLabel->resize(digitWidth*10, fs);
+ sep1->resize(digitWidth, fs);
+ sep2->resize(digitWidth, fs);
+ sep3->resize(digitWidth, fs);
+ sep4->resize(digitWidth, fs);
+ sep5->resize(digitWidth, fs);
+
+ barLabel->move( hspace + (digitWidth*0), tickY);
+ sep1->move( hspace + (digitWidth*4), tickY);
+ beatLabel->move( hspace + (digitWidth*5), tickY);
+ sep2->move( hspace + (digitWidth*7), tickY);
+ tickLabel->move( hspace + (digitWidth*8), tickY);
+
+ //hourLabel->move( hspace + (digitWidth*0), timeY);
+ //sep3->move( hspace + (digitWidth*2), timeY);
+ //minLabel->move( hspace + (digitWidth*3), timeY);
+ //sep4->move( hspace + (digitWidth*5), timeY);
+ //secLabel->move( hspace + (digitWidth*6), timeY);
+ //sep5->move( hspace + (digitWidth*8), timeY);
+ //frameLabel->move( hspace + (digitWidth*9), timeY);
+ minLabel->move( hspace + (digitWidth*0), timeY);
+ sep3->move( hspace + (digitWidth*3), timeY);
+ secLabel->move( hspace + (digitWidth*4), timeY);
+ sep4->move( hspace + (digitWidth*6), timeY);
+ frameLabel->move( hspace + (digitWidth*7), timeY);
+ sep5->move( hspace + (digitWidth*9), timeY);
+ subFrameLabel->move( hspace + (digitWidth*10), timeY);
+
+ absTickLabel->move( hspace + (digitWidth*0), absTickY);
+ absFrameLabel->move( hspace + (digitWidth*0), absFrameY);
+ }
+
+//---------------------------------------------------------
+// setForegroundColor
+//---------------------------------------------------------
+
+void BigTime::setFgColor(QColor c)
+ {
+ QColorGroup cg = palette().active();
+ cg.setColor(QColorGroup::Foreground, c);
+ QPalette newpalette(cg, cg, cg);
+ setPalette(newpalette);
+
+ barLabel->setPalette(newpalette);
+ beatLabel->setPalette(newpalette);
+ tickLabel->setPalette(newpalette);
+ //hourLabel->setPalette(newpalette);
+ minLabel->setPalette(newpalette);
+ secLabel->setPalette(newpalette);
+ frameLabel->setPalette(newpalette);
+ subFrameLabel->setPalette(newpalette);
+
+ absTickLabel->setPalette(newpalette);
+ absFrameLabel->setPalette(newpalette);
+ sep1->setPalette(newpalette);
+ sep2->setPalette(newpalette);
+ sep3->setPalette(newpalette);
+ sep4->setPalette(newpalette);
+ sep5->setPalette(newpalette);
+ }
+
+//---------------------------------------------------------
+// setBackgroundColor
+//---------------------------------------------------------
+
+void BigTime::setBgColor(QColor c)
+ {
+ QColorGroup cg = palette().active();
+ cg.setColor(QColorGroup::Background, c);
+ QPalette newpalette(cg, cg, cg);
+ setPalette(newpalette);
+
+ barLabel->setPalette(newpalette);
+ beatLabel->setPalette(newpalette);
+ tickLabel->setPalette(newpalette);
+ //hourLabel->setPalette(newpalette);
+ minLabel->setPalette(newpalette);
+ secLabel->setPalette(newpalette);
+ frameLabel->setPalette(newpalette);
+ subFrameLabel->setPalette(newpalette);
+
+ absTickLabel->setPalette(newpalette);
+ absFrameLabel->setPalette(newpalette);
+ sep1->setPalette(newpalette);
+ sep2->setPalette(newpalette);
+ sep3->setPalette(newpalette);
+ sep4->setPalette(newpalette);
+ sep5->setPalette(newpalette);
+
+ setBackgroundColor(c);
+ }
+
diff --git a/muse2/muse/widgets/bigtime.h b/muse2/muse/widgets/bigtime.h
new file mode 100644
index 00000000..5e173cb0
--- /dev/null
+++ b/muse2/muse/widgets/bigtime.h
@@ -0,0 +1,55 @@
+#ifndef __BIGTIME_H__
+#define __BIGTIME_H__
+
+#include <qwidget.h>
+#include <qlabel.h>
+
+#include <qcheckbox.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QCloseEvent>
+class MusE;
+
+//---------------------------------------------------------
+// BigTime
+//---------------------------------------------------------
+
+class BigTime : public QWidget {
+ bool tickmode;
+ MusE* seq;
+ Q_OBJECT
+
+ bool setString(unsigned);
+
+ QWidget *dwin;
+ QCheckBox *fmtButton;
+ QLabel *absTickLabel;
+ QLabel *absFrameLabel;
+ QLabel *barLabel, *beatLabel, *tickLabel,
+ //*hourLabel, *minLabel, *secLabel, *frameLabel,
+ *minLabel, *secLabel, *frameLabel, *subFrameLabel,
+ *sep1, *sep2, *sep3, *sep4, *sep5;
+
+ //int oldbar, oldbeat, oldhour, oldmin, oldsec, oldframe;
+ int oldbar, oldbeat, oldmin, oldsec, oldframe, oldsubframe;
+ unsigned oldtick;
+ unsigned oldAbsTick, oldAbsFrame;
+ void setFgColor(QColor c);
+ void setBgColor(QColor c);
+
+ protected:
+ virtual void resizeEvent(QResizeEvent*);
+ virtual void closeEvent(QCloseEvent*);
+
+ public slots:
+ void setPos(int, unsigned, bool);
+ void configChanged();
+ void fmtButtonToggled(bool);
+ signals:
+ void closed();
+
+ public:
+ BigTime(QWidget* parent);
+ };
+
+#endif
diff --git a/muse2/muse/widgets/canvas.cpp b/muse2/muse/widgets/canvas.cpp
new file mode 100644
index 00000000..ef5ee0de
--- /dev/null
+++ b/muse2/muse/widgets/canvas.cpp
@@ -0,0 +1,1405 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: canvas.cpp,v 1.10.2.17 2009/05/03 04:14:01 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+
+#include "canvas.h"
+#include <qapplication.h>
+#include <qpainter.h>
+#include <q3popupmenu.h>
+#include <qcursor.h>
+#include <qtimer.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include <QMouseEvent>
+#include <QWheelEvent>
+
+#include "song.h"
+#include "event.h"
+#include "citem.h"
+#include "icons.h"
+#include "../marker/marker.h"
+#include "part.h"
+
+#define ABS(x) ((x) < 0) ? -(x) : (x)
+
+//---------------------------------------------------------
+// Canvas
+//---------------------------------------------------------
+
+Canvas::Canvas(QWidget* parent, int sx, int sy, const char* name)
+ : View(parent, sx, sy, name)
+ {
+ canvasTools = 0;
+ itemPopupMenu = 0;
+
+ canScrollLeft = true;
+ canScrollRight = true;
+ canScrollUp = true;
+ canScrollDown = true;
+ hscrollDir = HSCROLL_NONE;
+ vscrollDir = VSCROLL_NONE;
+ scrollTimer=NULL;
+
+ scrollSpeed=10; // hardcoded scroll jump
+
+ drag = DRAG_OFF;
+ _tool = PointerTool;
+ pos[0] = song->cpos();
+ pos[1] = song->lpos();
+ pos[2] = song->rpos();
+ curPart = NULL;
+ curPartId = -1;
+ curItem = NULL;
+ connect(song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool)));
+ }
+
+//---------------------------------------------------------
+// setPos
+// set one of three markers
+// idx - 0-cpos 1-lpos 2-rpos
+// flag - emit followEvent()
+//---------------------------------------------------------
+
+void Canvas::setPos(int idx, unsigned val, bool adjustScrollbar)
+ {
+ //if (pos[idx] == val) // Seems to be some refresh problems here, pos[idx] might be val but the gui not updated.
+ // return; // skipping this return forces update even if values match. Matching values only seem
+ // to occur when initializing
+ int opos = mapx(pos[idx]);
+ int npos = mapx(val);
+
+ if (adjustScrollbar && idx == 0) {
+ switch (song->follow()) {
+ case Song::NO:
+ break;
+ case Song::JUMP:
+ if (npos >= width()) {
+ int ppos = val - xorg - rmapxDev(width()/8);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ else if (npos < 0) {
+ int ppos = val - xorg - rmapxDev(width()*3/4);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ break;
+ case Song::CONTINUOUS:
+ if (npos > (width()/2)) {
+ int ppos = pos[idx] - xorg - rmapxDev(width()/2);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ else if (npos < (width()/2)) {
+ int ppos = pos[idx] - xorg - rmapxDev(width()/2);
+ if (ppos < 0)
+ ppos = 0;
+ emit followEvent(ppos);
+ opos = mapx(pos[idx]);
+ npos = mapx(val);
+ }
+ break;
+ }
+ }
+
+ int x;
+ int w = 1;
+ if (opos > npos) {
+ w += opos - npos;
+ x = npos;
+ }
+ else {
+ w += npos - opos;
+ x = opos;
+ }
+ pos[idx] = val;
+ redraw(QRect(x-1, 0, w+2, height()));
+ }
+
+//---------------------------------------------------------
+// draw
+//---------------------------------------------------------
+
+void Canvas::draw(QPainter& p, const QRect& rect)
+ {
+// printf("draw canvas %x virt %d\n", this, virt());
+
+ int x = rect.x();
+ int y = rect.y();
+ int w = rect.width();
+ int h = rect.height();
+ int x2 = x + w;
+
+ if (virt()) {
+ drawCanvas(p, rect);
+
+ //---------------------------------------------------
+ // draw Canvas Items
+ //---------------------------------------------------
+
+ iCItem to(items.lower_bound(x2));
+
+ // Draw items from other parts behind all others.
+ // Only for items with events (not arranger parts).
+ for(iCItem i = items.begin(); i != to; ++i)
+ {
+ CItem* ci = i->second;
+ if(!ci->event().empty() && ci->part() != curPart)
+ {
+ drawItem(p, ci, rect);
+ }
+ }
+
+ for (iCItem i = items.begin(); i != to; ++i)
+ {
+ CItem* ci = i->second;
+ // Draw unselected parts behind selected.
+ if(!ci->isSelected() && !ci->isMoving() && (ci->event().empty() || ci->part() == curPart))
+ {
+ drawItem(p, ci, rect);
+ }
+ }
+
+ // Draw selected parts in front of unselected.
+ for (iCItem i = items.begin(); i != to; ++i)
+ {
+ CItem* ci = i->second;
+ if(ci->isSelected() && !ci->isMoving() && (ci->event().empty() || ci->part() == curPart))
+ {
+ drawItem(p, ci, rect);
+ }
+ }
+ to = moving.lower_bound(x2);
+ for (iCItem i = moving.begin(); i != to; ++i)
+ {
+ drawItem(p, i->second, rect);
+ }
+ }
+ else {
+ p.save();
+ setPainter(p);
+
+ if (xmag <= 0) {
+ x -= 1;
+ w += 2;
+ x = (x + xpos + rmapx(xorg)) * (-xmag);
+ w = w * (-xmag);
+ }
+ else {
+ x = (x + xpos + rmapx(xorg)) / xmag;
+ w = (w + xmag - 1) / xmag;
+ x -= 1;
+ w += 2;
+ }
+ if (ymag <= 0) {
+ y -= 1;
+ h += 2;
+ y = (y + ypos + rmapy(yorg)) * (-ymag);
+ h = h * (-ymag);
+ }
+ else {
+ y = (rect.y() + ypos + rmapy(yorg))/ymag;
+ h = (rect.height()+ymag-1)/ymag;
+ y -= 1;
+ h += 2;
+ }
+
+ if (x < 0)
+ x = 0;
+ if (y < 0)
+ y = 0;
+ x2 = x + w;
+
+ drawCanvas(p, QRect(x, y, w, h));
+ p.restore();
+
+ //---------------------------------------------------
+ // draw Canvas Items
+ //---------------------------------------------------
+
+ // Draw items from other parts behind all others.
+ // Only for items with events (not arranger parts).
+ for(iCItem i = items.begin(); i != items.end(); ++i)
+ {
+ CItem* ci = i->second;
+ if(!ci->event().empty() && ci->part() != curPart)
+ {
+ drawItem(p, ci, rect);
+ }
+ }
+
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ CItem* ci = i->second;
+ // Draw unselected parts behind selected.
+ if(!ci->isSelected() && !ci->isMoving() && (ci->event().empty() || ci->part() == curPart))
+ {
+ drawItem(p, ci, rect);
+ }
+ }
+
+ // Draw selected parts in front of unselected.
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ CItem* ci = i->second;
+ if(ci->isSelected() && !ci->isMoving() && (ci->event().empty() || ci->part() == curPart))
+ {
+ drawItem(p, ci, rect);
+ }
+ }
+ for (iCItem i = moving.begin(); i != moving.end(); ++i)
+ {
+ drawItem(p, i->second, rect);
+ }
+ p.save();
+ setPainter(p);
+ }
+
+ //---------------------------------------------------
+ // draw marker
+ //---------------------------------------------------
+
+ int y2 = y + h;
+ MarkerList* marker = song->marker();
+ for (iMarker m = marker->begin(); m != marker->end(); ++m) {
+ int xp = m->second.tick();
+ if (xp >= x && xp < x+w) {
+ p.setPen(Qt::green);
+ p.drawLine(xp, y, xp, y2);
+ }
+ }
+
+ //---------------------------------------------------
+ // draw location marker
+ //---------------------------------------------------
+
+ p.setPen(Qt::blue);
+ if (pos[1] >= unsigned(x) && pos[1] < unsigned(x2)) {
+ p.drawLine(pos[1], y, pos[1], y2);
+ }
+ if (pos[2] >= unsigned(x) && pos[2] < unsigned(x2))
+ p.drawLine(pos[2], y, pos[2], y2);
+ p.setPen(Qt::red);
+ if (pos[0] >= unsigned(x) && pos[0] < unsigned(x2)) {
+ p.drawLine(pos[0], y, pos[0], y2);
+ }
+
+ //---------------------------------------------------
+ // draw lasso
+ //---------------------------------------------------
+
+ if (drag == DRAG_LASSO) {
+ p.setPen(Qt::blue);
+ p.setBrush(Qt::NoBrush);
+ p.drawRect(lasso);
+ }
+
+ //---------------------------------------------------
+ // draw moving items
+ //---------------------------------------------------
+
+ if(virt())
+ {
+ for(iCItem i = moving.begin(); i != moving.end(); ++i)
+ drawMoving(p, i->second, rect);
+ }
+ else
+ {
+ p.restore();
+ for(iCItem i = moving.begin(); i != moving.end(); ++i)
+ drawMoving(p, i->second, rect);
+ setPainter(p);
+ }
+ }
+
+#define WHEEL_STEPSIZE 40
+#define WHEEL_DELTA 120
+
+//---------------------------------------------------------
+// wheelEvent
+//---------------------------------------------------------
+void Canvas::wheelEvent(QWheelEvent* ev)
+ {
+ int delta = ev->delta() / WHEEL_DELTA;
+ int ypixelscale = rmapyDev(1);
+
+ if (ypixelscale <= 0)
+ ypixelscale = 1;
+
+ int scrollstep = WHEEL_STEPSIZE * (-delta);
+ if (ev->state() == Qt::ShiftModifier)
+ scrollstep = scrollstep / 10;
+
+ int newYpos = ypos + ypixelscale * scrollstep;
+
+ if (newYpos < 0)
+ newYpos = 0;
+
+ //setYPos(newYpos);
+ emit verticalScroll((unsigned)newYpos);
+
+ }
+
+void Canvas::redirectedWheelEvent(QWheelEvent* ev)
+ {
+ wheelEvent(ev);
+ }
+
+//---------------------------------------------------------
+// deselectAll
+//---------------------------------------------------------
+
+void Canvas::deselectAll()
+ {
+ for (iCItem i = items.begin(); i != items.end(); ++i)
+ i->second->setSelected(false);
+ }
+
+//---------------------------------------------------------
+// selectItem
+//---------------------------------------------------------
+
+void Canvas::selectItem(CItem* e, bool flag)
+ {
+ e->setSelected(flag);
+ }
+
+//---------------------------------------------------------
+// startMoving
+// copy selection-List to moving-List
+//---------------------------------------------------------
+
+void Canvas::startMoving(const QPoint& pos, DragType)
+ {
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (i->second->isSelected()) {
+ i->second->setMoving(true);
+ moving.add(i->second);
+ }
+ }
+ moveItems(pos, 0);
+ }
+
+//---------------------------------------------------------
+// moveItems
+// dir = 0 move in all directions
+// 1 move only horizontal
+// 2 move only vertical
+//---------------------------------------------------------
+
+void Canvas::moveItems(const QPoint& pos, int dir = 0, bool rasterize)
+ {
+ int dp;
+ if(rasterize)
+ dp = y2pitch(pos.y()) - y2pitch(start.y());
+ else
+ dp = pos.y() - start.y();
+ int dx = pos.x() - start.x();
+ if (dir == 1)
+ dp = 0;
+ else if (dir == 2)
+ dx = 0;
+ for (iCItem i = moving.begin(); i != moving.end(); ++i) {
+ int x = i->second->pos().x();
+ int y = i->second->pos().y();
+ int nx = x + dx;
+ int ny;
+ QPoint mp;
+ if(rasterize)
+ {
+ ny = pitch2y(y2pitch(y) + dp);
+ mp = raster(QPoint(nx, ny));
+ }
+ else
+ {
+ ny = y + dp;
+ mp = QPoint(nx, ny);
+ }
+ if (i->second->mp() != mp) {
+ i->second->setMp(mp);
+ itemMoved(i->second, mp);
+ }
+ }
+ redraw();
+ }
+
+//---------------------------------------------------------
+// viewKeyPressEvent
+//---------------------------------------------------------
+
+void Canvas::viewKeyPressEvent(QKeyEvent* event)
+ {
+ keyPress(event);
+ }
+
+//---------------------------------------------------------
+// viewMousePressEvent
+//---------------------------------------------------------
+
+void Canvas::viewMousePressEvent(QMouseEvent* event)
+ {
+ keyState = event->state();
+
+ // special events if right button is clicked while operations
+ // like moving or drawing lasso is performed.
+ if (event->stateAfter() & Qt::RightButton) {
+ switch (drag) {
+ case DRAG_LASSO:
+ drag = DRAG_OFF;
+ redraw();
+ return;
+ case DRAG_MOVE:
+ drag = DRAG_OFF;
+ endMoveItems (start, MOVE_MOVE, 0);
+ return;
+ default:
+ break;
+ }
+ }
+
+ // ignore event if (another) button is already active:
+ if (keyState & (Qt::LeftButton|Qt::RightButton|Qt::MidButton)) {
+ return;
+ }
+ bool shift = keyState & Qt::ShiftModifier;
+ bool alt = keyState & Qt::AltModifier;
+ bool ctrl = keyState & Qt::ControlModifier;
+ start = event->pos();
+
+ //---------------------------------------------------
+ // set curItem to item mouse is pointing
+ // (if any)
+ //---------------------------------------------------
+
+ if (virt())
+ curItem = items.find(start);
+ else {
+ curItem = 0;
+ iCItem ius;
+ bool usfound = false;
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ QRect box = i->second->bbox();
+ int x = rmapxDev(box.x());
+ int y = rmapyDev(box.y());
+ int w = rmapxDev(box.width());
+ int h = rmapyDev(box.height());
+ QRect r(x, y, w, h);
+ r.moveBy(i->second->pos().x(), i->second->pos().y());
+ if (r.contains(start)) {
+ if(i->second->isSelected())
+ {
+ curItem = i->second;
+ break;
+ }
+ else
+ if(!usfound)
+ {
+ ius = i;
+ usfound = true;
+ }
+ }
+ }
+ if(!curItem && usfound)
+ curItem = ius->second;
+ }
+
+ if (curItem && (event->button() == Qt::MidButton)) {
+ if (!curItem->isSelected()) {
+ selectItem(curItem, true);
+ updateSelection();
+ redraw();
+ }
+ startDrag(curItem, shift);
+ }
+ else if (event->button() == Qt::RightButton) {
+ if (curItem) {
+ if (shift) {
+ drag = DRAG_RESIZE;
+ setCursor();
+ int dx = start.x() - curItem->x();
+ curItem->setWidth(dx);
+ start.setX(curItem->x());
+ deselectAll();
+ selectItem(curItem, true);
+ updateSelection();
+ redraw();
+ }
+ else {
+ itemPopupMenu = genItemPopup(curItem);
+ if (itemPopupMenu) {
+ int n = itemPopupMenu->exec(QCursor::pos());
+ if (n != -1)
+ itemPopup(curItem, n, start);
+ delete itemPopupMenu;
+ }
+ }
+ }
+ else {
+ canvasPopupMenu = genCanvasPopup();
+ if (canvasPopupMenu) {
+ int n = canvasPopupMenu->exec(QCursor::pos(), 0);
+ if (n != -1)
+ canvasPopup(n);
+ delete canvasPopupMenu;
+ }
+ }
+ }
+ else if (event->button() == Qt::LeftButton) {
+ switch (_tool) {
+ case PointerTool:
+ if (curItem) {
+ if (curItem->part() != curPart) {
+ curPart = curItem->part();
+ curPartId = curPart->sn();
+ curPartChanged();
+ }
+ itemPressed(curItem);
+ // Changed by T356. Alt is default reserved for moving the whole window in KDE. Changed to Shift-Alt.
+ // Hmm, nope, shift-alt is also reserved sometimes. Must find a way to bypass,
+ // why make user turn off setting? Left alone for now...
+ if (shift)
+ drag = DRAG_COPY_START;
+ else if (alt) {
+ drag = DRAG_CLONE_START;
+ }
+ //
+ //if (shift)
+ //{
+ // if (alt)
+ // drag = DRAG_CLONE_START;
+ // else
+ // drag = DRAG_COPY_START;
+ //}
+ else if (ctrl) { //Select all on the same pitch (e.g. same y-value)
+ deselectAll();
+ //printf("Yes, ctrl and press\n");
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (i->second->y() == curItem->y() )
+ selectItem(i->second, true);
+ }
+ updateSelection();
+ redraw();
+ }
+ else
+ drag = DRAG_MOVE_START;
+ }
+ else
+ drag = DRAG_LASSO_START;
+ setCursor();
+ break;
+
+ case RubberTool:
+ deleteItem(start);
+ drag = DRAG_DELETE;
+ setCursor();
+ break;
+
+ case PencilTool:
+ if (curItem) {
+ drag = DRAG_RESIZE;
+ setCursor();
+ int dx = start.x() - curItem->x();
+ curItem->setWidth(dx);
+ start.setX(curItem->x());
+ }
+ else {
+ drag = DRAG_NEW;
+ setCursor();
+ curItem = newItem(start, event->state());
+ if (curItem)
+ items.add(curItem);
+ else {
+ drag = DRAG_OFF;
+ setCursor();
+ }
+ }
+ deselectAll();
+ if (curItem)
+ selectItem(curItem, true);
+ updateSelection();
+ redraw();
+ break;
+
+ default:
+ break;
+ }
+ }
+ mousePress(event);
+ }
+
+void Canvas::scrollTimerDone()
+{
+ //printf("Canvas::scrollTimerDone drag:%d doScroll:%d\n", drag, doScroll);
+
+ if (drag != DRAG_OFF && doScroll)
+ {
+ //printf("Canvas::scrollTimerDone drag != DRAG_OFF && doScroll\n");
+
+ bool doHMove = false;
+ bool doVMove = false;
+ int hoff = rmapx(xOffset())+mapx(xorg)-1;
+ int curxpos;
+ switch(hscrollDir)
+ {
+ case HSCROLL_RIGHT:
+ hoff += scrollSpeed;
+ switch(drag)
+ {
+ case DRAG_NEW:
+ case DRAG_RESIZE:
+ case DRAGX_MOVE:
+ case DRAGX_COPY:
+ case DRAGX_CLONE:
+ case DRAGY_MOVE:
+ case DRAGY_COPY:
+ case DRAGY_CLONE:
+ case DRAG_MOVE:
+ case DRAG_COPY:
+ case DRAG_CLONE:
+ emit horizontalScrollNoLimit(hoff);
+ canScrollLeft = true;
+ ev_pos.setX(rmapxDev(rmapx(ev_pos.x()) + scrollSpeed));
+ doHMove = true;
+ break;
+ default:
+ if(canScrollRight)
+ {
+ curxpos = xpos;
+ emit horizontalScroll(hoff);
+ if(xpos <= curxpos)
+ {
+ canScrollRight = false;
+ }
+ else
+ {
+ canScrollLeft = true;
+ ev_pos.setX(rmapxDev(rmapx(ev_pos.x()) + scrollSpeed));
+ doHMove = true;
+ }
+ }
+ else
+ {
+ }
+ break;
+ }
+ break;
+ case HSCROLL_LEFT:
+ if(canScrollLeft)
+ {
+ curxpos = xpos;
+ hoff -= scrollSpeed;
+ emit horizontalScroll(hoff);
+ if(xpos >= curxpos)
+ {
+ canScrollLeft = false;
+ }
+ else
+ {
+ canScrollRight = true;
+ ev_pos.setX(rmapxDev(rmapx(ev_pos.x()) - scrollSpeed));
+ doHMove = true;
+ }
+ }
+ else
+ {
+ }
+ break;
+ default:
+ break;
+ }
+ int voff = rmapy(yOffset())+mapy(yorg);
+ int curypos;
+ switch(vscrollDir)
+ {
+ case VSCROLL_DOWN:
+ if(canScrollDown)
+ {
+ curypos = ypos;
+ voff += scrollSpeed;
+ emit verticalScroll(voff);
+ if(ypos <= curypos)
+ {
+ canScrollDown = false;
+ }
+ else
+ {
+ canScrollUp = true;
+ ev_pos.setY(rmapyDev(rmapy(ev_pos.y()) + scrollSpeed));
+ doVMove = true;
+ }
+ }
+ else
+ {
+ }
+ break;
+ case VSCROLL_UP:
+ if(canScrollUp)
+ {
+ curypos = ypos;
+ voff -= scrollSpeed;
+ emit verticalScroll(voff);
+ if(ypos >= curypos)
+ {
+ canScrollUp = false;
+ }
+ else
+ {
+ canScrollDown = true;
+ ev_pos.setY(rmapyDev(rmapy(ev_pos.y()) - scrollSpeed));
+ doVMove = true;
+ }
+ }
+ else
+ {
+ }
+ break;
+ default:
+ break;
+ }
+
+ //printf("Canvas::scrollTimerDone doHMove:%d doVMove:%d\n", doHMove, doVMove);
+
+ if(!doHMove && !doVMove)
+ {
+ delete scrollTimer;
+ scrollTimer=NULL;
+ doScroll = false;
+ return;
+ }
+ QPoint dist = ev_pos - start;
+ switch(drag)
+ {
+ case DRAG_MOVE:
+ case DRAG_COPY:
+ case DRAG_CLONE:
+ moveItems(ev_pos, 0, false);
+ break;
+ case DRAGX_MOVE:
+ case DRAGX_COPY:
+ case DRAGX_CLONE:
+ moveItems(ev_pos, 1, false);
+ break;
+ case DRAGY_MOVE:
+ case DRAGY_COPY:
+ case DRAGY_CLONE:
+ moveItems(ev_pos, 2, false);
+ break;
+ case DRAG_LASSO:
+ lasso = QRect(start.x(), start.y(), dist.x(), dist.y());
+ redraw();
+ break;
+ case DRAG_NEW:
+ case DRAG_RESIZE:
+ if (dist.x()) {
+ if (dist.x() < 1)
+ curItem->setWidth(1);
+ else
+ curItem->setWidth(dist.x());
+ redraw();
+ }
+ break;
+ default:
+ break;
+ }
+ //printf("Canvas::scrollTimerDone starting scrollTimer: Currently active?%d\n", scrollTimer->isActive());
+
+ // p3.3.43 Make sure to yield to other events (for up to 3 seconds), otherwise other events
+ // take a long time to reach us, causing scrolling to take a painfully long time to stop.
+ // FIXME: Didn't help at all.
+ //qApp->processEvents();
+ // No, try up to 100 ms for each yield.
+ //qApp->processEvents(100);
+ //
+ //scrollTimer->start( 40, TRUE ); // X ms single-shot timer
+ // OK, changing the timeout from 40 to 80 helped.
+ scrollTimer->start( 80, TRUE ); // X ms single-shot timer
+ }
+ else
+ {
+ //printf("Canvas::scrollTimerDone !(drag != DRAG_OFF && doScroll) deleting scrollTimer\n");
+
+ delete scrollTimer;
+ scrollTimer=NULL;
+ }
+}
+
+
+//---------------------------------------------------------
+// viewMouseMoveEvent
+//---------------------------------------------------------
+
+void Canvas::viewMouseMoveEvent(QMouseEvent* event)
+ {
+
+ ev_pos = event->pos();
+ QPoint dist = ev_pos - start;
+ int ax = ABS(rmapx(dist.x()));
+ int ay = ABS(rmapy(dist.y()));
+ bool moving = (ax >= 2) || (ay > 2);
+
+ // set scrolling variables: doScroll, scrollRight
+ if (drag != DRAG_OFF) {
+
+
+ int ex = rmapx(event->x())+mapx(0);
+ if(ex < 40 && canScrollLeft)
+ hscrollDir = HSCROLL_LEFT;
+ else
+ if(ex > (width() - 40))
+ switch(drag)
+ {
+ case DRAG_NEW:
+ case DRAG_RESIZE:
+ case DRAGX_MOVE:
+ case DRAGX_COPY:
+ case DRAGX_CLONE:
+ case DRAGY_MOVE:
+ case DRAGY_COPY:
+ case DRAGY_CLONE:
+ case DRAG_MOVE:
+ case DRAG_COPY:
+ case DRAG_CLONE:
+ hscrollDir = HSCROLL_RIGHT;
+ break;
+ default:
+ if(canScrollRight)
+ hscrollDir = HSCROLL_RIGHT;
+ else
+ hscrollDir = HSCROLL_NONE;
+ break;
+ }
+ else
+ hscrollDir = HSCROLL_NONE;
+ int ey = rmapy(event->y())+mapy(0);
+ if(ey < 15 && canScrollUp)
+ vscrollDir = VSCROLL_UP;
+ else
+ if(ey > (height() - 15) && canScrollDown)
+ vscrollDir = VSCROLL_DOWN;
+ else
+ vscrollDir = VSCROLL_NONE;
+ if(hscrollDir != HSCROLL_NONE || vscrollDir != VSCROLL_NONE)
+ {
+ doScroll=true;
+ if (!scrollTimer)
+ {
+ scrollTimer= new QTimer(this);
+ connect( scrollTimer, SIGNAL(timeout()), SLOT(scrollTimerDone()) );
+ scrollTimer->start( 0, TRUE ); // single-shot timer
+ }
+ }
+ else
+ doScroll=false;
+
+ }
+ else
+ {
+ doScroll=false;
+
+ canScrollLeft = true;
+ canScrollRight = true;
+ canScrollUp = true;
+ canScrollDown = true;
+ }
+
+ switch (drag) {
+ case DRAG_LASSO_START:
+ if (!moving)
+ break;
+ drag = DRAG_LASSO;
+ setCursor();
+ // proceed with DRAG_LASSO:
+
+ case DRAG_LASSO:
+ {
+ lasso = QRect(start.x(), start.y(), dist.x(), dist.y());
+
+ // printf("xorg=%d xmag=%d event->x=%d, mapx(xorg)=%d rmapx0=%d xOffset=%d rmapx(xOffset()=%d\n",
+ // xorg, xmag, event->x(),mapx(xorg), rmapx(0), xOffset(),rmapx(xOffset()));
+
+ }
+ redraw();
+ break;
+
+ case DRAG_MOVE_START:
+ case DRAG_COPY_START:
+ case DRAG_CLONE_START:
+ if (!moving)
+ break;
+ if (keyState & Qt::ControlModifier) {
+ if (ax > ay) {
+ if (drag == DRAG_MOVE_START)
+ drag = DRAGX_MOVE;
+ else if (drag == DRAG_COPY_START)
+ drag = DRAGX_COPY;
+ else
+ drag = DRAGX_CLONE;
+ }
+ else {
+ if (drag == DRAG_MOVE_START)
+ drag = DRAGY_MOVE;
+ else if (drag == DRAG_COPY_START)
+ drag = DRAGY_COPY;
+ else
+ drag = DRAGY_CLONE;
+ }
+ }
+ else {
+ if (drag == DRAG_MOVE_START)
+ drag = DRAG_MOVE;
+ else if (drag == DRAG_COPY_START)
+ drag = DRAG_COPY;
+ else
+ drag = DRAG_CLONE;
+ }
+ setCursor();
+ if (!curItem->isSelected()) {
+ if (drag == DRAG_MOVE)
+ deselectAll();
+ selectItem(curItem, true);
+ updateSelection();
+ redraw();
+ }
+ DragType dt;
+ if (drag == DRAG_MOVE)
+ dt = MOVE_MOVE;
+ else if (drag == DRAG_COPY)
+ dt = MOVE_COPY;
+ else
+ dt = MOVE_CLONE;
+
+ startMoving(ev_pos, dt);
+ break;
+
+ case DRAG_MOVE:
+ case DRAG_COPY:
+ case DRAG_CLONE:
+
+ if(!scrollTimer)
+ moveItems(ev_pos, 0);
+ break;
+
+ case DRAGX_MOVE:
+ case DRAGX_COPY:
+ case DRAGX_CLONE:
+ if(!scrollTimer)
+ moveItems(ev_pos, 1);
+ break;
+
+ case DRAGY_MOVE:
+ case DRAGY_COPY:
+ case DRAGY_CLONE:
+ if(!scrollTimer)
+ moveItems(ev_pos, 2);
+ break;
+
+ case DRAG_NEW:
+ case DRAG_RESIZE:
+ if (dist.x()) {
+ if (dist.x() < 1)
+ curItem->setWidth(1);
+ else
+ curItem->setWidth(dist.x());
+ redraw();
+ }
+ break;
+ case DRAG_DELETE:
+ deleteItem(ev_pos);
+ break;
+
+ case DRAG_OFF:
+ break;
+ }
+
+ mouseMove(ev_pos);
+ }
+
+//---------------------------------------------------------
+// viewMouseReleaseEvent
+//---------------------------------------------------------
+
+void Canvas::viewMouseReleaseEvent(QMouseEvent* event)
+ {
+// printf("release %x %x\n", event->state(), event->button());
+
+ doScroll = false;
+ canScrollLeft = true;
+ canScrollRight = true;
+ canScrollUp = true;
+ canScrollDown = true;
+ if (event->state() & (Qt::LeftButton|Qt::RightButton|Qt::MidButton) & ~(event->button())) {
+ printf("ignore %x %x\n", keyState, event->button());
+ return;
+ }
+
+ QPoint pos = event->pos();
+ bool shift = event->state() & Qt::ShiftModifier;
+ bool redrawFlag = false;
+
+ switch (drag) {
+ case DRAG_MOVE_START:
+ case DRAG_COPY_START:
+ case DRAG_CLONE_START:
+ if (!shift)
+ deselectAll();
+ selectItem(curItem, !(shift && curItem->isSelected()));
+ updateSelection();
+ redrawFlag = true;
+ itemReleased(curItem, curItem->pos());
+ break;
+ case DRAG_COPY:
+ endMoveItems(pos, MOVE_COPY, 0);
+ break;
+ case DRAGX_COPY:
+ endMoveItems(pos, MOVE_COPY, 1);
+ break;
+ case DRAGY_COPY:
+ endMoveItems(pos, MOVE_COPY, 2);
+ break;
+ case DRAG_MOVE:
+ endMoveItems(pos, MOVE_MOVE, 0);
+ break;
+ case DRAGX_MOVE:
+ endMoveItems(pos, MOVE_MOVE, 1);
+ break;
+ case DRAGY_MOVE:
+ endMoveItems(pos, MOVE_MOVE, 2);
+ break;
+ case DRAG_CLONE:
+ endMoveItems(pos, MOVE_CLONE, 0);
+ break;
+ case DRAGX_CLONE:
+ endMoveItems(pos, MOVE_CLONE, 1);
+ break;
+ case DRAGY_CLONE:
+ endMoveItems(pos, MOVE_CLONE, 2);
+ break;
+ case DRAG_OFF:
+ break;
+ case DRAG_RESIZE:
+ resizeItem(curItem, false);
+ break;
+ case DRAG_NEW:
+ newItem(curItem, false);
+ redrawFlag = true;
+ break;
+ case DRAG_LASSO_START:
+ lasso.setRect(-1, -1, -1, -1);
+ if (!shift)
+ deselectAll();
+ updateSelection();
+ redrawFlag = true;
+ break;
+
+ case DRAG_LASSO:
+ if (!shift)
+ deselectAll();
+ lasso = lasso.normalize();
+ selectLasso(shift);
+ updateSelection();
+ redrawFlag = true;
+ break;
+
+ case DRAG_DELETE:
+ break;
+ }
+ //printf("Canvas::viewMouseReleaseEvent setting drag to DRAG_OFF\n");
+
+ drag = DRAG_OFF;
+ if (redrawFlag)
+ redraw();
+ setCursor();
+ }
+
+//---------------------------------------------------------
+// selectLasso
+//---------------------------------------------------------
+
+void Canvas::selectLasso(bool toggle)
+ {
+ int n = 0;
+ if (virt()) {
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (i->second->intersects(lasso)) {
+ selectItem(i->second, !(toggle && i->second->isSelected()));
+ ++n;
+ }
+ }
+ }
+ else {
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ QRect box = i->second->bbox();
+ int x = rmapxDev(box.x());
+ int y = rmapyDev(box.y());
+ int w = rmapxDev(box.width());
+ int h = rmapyDev(box.height());
+ QRect r(x, y, w, h);
+ r.moveBy(i->second->pos().x(), i->second->pos().y());
+ if (r.intersects(lasso)) {
+ selectItem(i->second, !(toggle && i->second->isSelected()));
+ ++n;
+ }
+ }
+ }
+
+
+
+ if (n) {
+ updateSelection();
+ redraw();
+ }
+ }
+
+//---------------------------------------------------------
+// endMoveItems
+// dir = 0 move in all directions
+// 1 move only horizontal
+// 2 move only vertical
+//---------------------------------------------------------
+
+void Canvas::endMoveItems(const QPoint& pos, DragType dragtype, int dir)
+ {
+ startUndo(dragtype);
+
+ int dp = y2pitch(pos.y()) - y2pitch(start.y());
+ int dx = pos.x() - start.x();
+
+ if (dir == 1)
+ dp = 0;
+ else if (dir == 2)
+ dx = 0;
+
+
+
+ int modified = 0;
+
+ // Removed by T356.
+ /*
+ for (iCItem i = moving.begin(); i != moving.end(); ++i) {
+ int x = i->second->pos().x();
+ int y = i->second->pos().y();
+ int nx = x + dx;
+ int ny = pitch2y(y2pitch(y) + dp);
+ QPoint newpos = raster(QPoint(nx, ny));
+ selectItem(i->second, true);
+
+ if (moveItem(i->second, newpos, dragtype, &modified))
+ i->second->move(newpos);
+ if (moving.size() == 1) {
+ itemReleased(curItem, newpos);
+ }
+ if (dragtype == MOVE_COPY || dragtype == MOVE_CLONE)
+ selectItem(i->second, false);
+ }
+ */
+
+ moveCanvasItems(moving, dp, dx, dragtype, &modified);
+
+ endUndo(dragtype, modified);
+ moving.clear();
+ updateSelection();
+ redraw();
+ }
+
+//---------------------------------------------------------
+// getCurrentDrag
+// returns 0 if there is no drag operation
+//---------------------------------------------------------
+
+int Canvas::getCurrentDrag()
+ {
+ printf("getCurrentDrag=%d\n", drag);
+ return drag;
+ }
+
+//---------------------------------------------------------
+// deleteItem
+//---------------------------------------------------------
+
+void Canvas::deleteItem(const QPoint& p)
+ {
+ if (virt()) {
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (i->second->contains(p)) {
+ selectItem(i->second, false);
+ if (!deleteItem(i->second)) {
+ if (drag == DRAG_DELETE)
+ drag = DRAG_OFF;
+ }
+ break;
+ }
+ }
+ }
+ else {
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ QRect box = i->second->bbox();
+ int x = rmapxDev(box.x());
+ int y = rmapyDev(box.y());
+ int w = rmapxDev(box.width());
+ int h = rmapyDev(box.height());
+ QRect r(x, y, w, h);
+ r.moveBy(i->second->pos().x(), i->second->pos().y());
+ if (r.contains(p)) {
+ if (deleteItem(i->second)) {
+ selectItem(i->second, false);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// setTool
+//---------------------------------------------------------
+
+void Canvas::setTool(int t)
+ {
+ if (_tool == Tool(t))
+ return;
+ _tool = Tool(t);
+ setCursor();
+ }
+
+//---------------------------------------------------------
+// setCursor
+//---------------------------------------------------------
+
+void Canvas::setCursor()
+ {
+ switch (drag) {
+ case DRAGX_MOVE:
+ case DRAGX_COPY:
+ case DRAGX_CLONE:
+ QWidget::setCursor(QCursor(Qt::SizeHorCursor));
+ break;
+
+ case DRAGY_MOVE:
+ case DRAGY_COPY:
+ case DRAGY_CLONE:
+ QWidget::setCursor(QCursor(Qt::SizeVerCursor));
+ break;
+
+ case DRAG_MOVE:
+ case DRAG_COPY:
+ case DRAG_CLONE:
+ QWidget::setCursor(QCursor(Qt::SizeAllCursor));
+ break;
+
+ case DRAG_RESIZE:
+ QWidget::setCursor(QCursor(Qt::SizeHorCursor));
+ break;
+
+ case DRAG_DELETE:
+ case DRAG_COPY_START:
+ case DRAG_CLONE_START:
+ case DRAG_MOVE_START:
+ case DRAG_NEW:
+ case DRAG_LASSO_START:
+ case DRAG_LASSO:
+ case DRAG_OFF:
+ switch(_tool) {
+ case PencilTool:
+ QWidget::setCursor(QCursor(*pencilIcon, 4, 15));
+ break;
+ case RubberTool:
+ QWidget::setCursor(QCursor(*deleteIcon, 4, 15));
+ break;
+ case GlueTool:
+ QWidget::setCursor(QCursor(*glueIcon, 4, 15));
+ break;
+ case CutTool:
+ QWidget::setCursor(QCursor(*cutIcon, 4, 15));
+ break;
+ case MuteTool:
+ QWidget::setCursor(QCursor(*editmuteIcon, 4, 15));
+ break;
+ default:
+ QWidget::setCursor(QCursor(Qt::ArrowCursor));
+ break;
+ }
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// keyPress
+//---------------------------------------------------------
+
+void Canvas::keyPress(QKeyEvent* event)
+ {
+ event->ignore();
+ }
+
+//---------------------------------------------------------
+// isSingleSelection
+//---------------------------------------------------------
+
+bool Canvas::isSingleSelection()
+ {
+ return selectionSize() == 1;
+ }
+
+//---------------------------------------------------------
+// selectionSize
+//---------------------------------------------------------
+
+int Canvas::selectionSize()
+ {
+ int n = 0;
+ for (iCItem i = items.begin(); i != items.end(); ++i) {
+ if (i->second->isSelected())
+ ++n;
+ }
+ return n;
+ }
+
+//---------------------------------------------------------
+// genCanvasPopup
+//---------------------------------------------------------
+
+Q3PopupMenu* Canvas::genCanvasPopup()
+ {
+ if (canvasTools == 0)
+ return 0;
+ Q3PopupMenu* canvasPopup = new Q3PopupMenu(this);
+
+ for (unsigned i = 0; i < 9; ++i) {
+ if ((canvasTools & (1 << i))==0)
+ continue;
+ canvasPopup->insertItem(QIcon(**toolList[i].icon), tr(toolList[i].tip), 1<<i); // ddskrjo
+ }
+ canvasPopup->setActiveItem(0);
+ return canvasPopup;
+ }
+
+//---------------------------------------------------------
+// canvasPopup
+//---------------------------------------------------------
+
+void Canvas::canvasPopup(int n)
+ {
+ setTool(n);
+ emit toolChanged(n);
+ }
+
+void Canvas::setCurrentPart(Part* part)
+{
+ curItem = NULL;
+ deselectAll();
+ curPart = part;
+ curPartId = curPart->sn();
+ curPartChanged();
+}
diff --git a/muse2/muse/widgets/canvas.h b/muse2/muse/widgets/canvas.h
new file mode 100644
index 00000000..f25d1b2f
--- /dev/null
+++ b/muse2/muse/widgets/canvas.h
@@ -0,0 +1,185 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: canvas.h,v 1.3.2.8 2009/02/02 21:38:01 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __CANVAS_H__
+#define __CANVAS_H__
+
+#include "citem.h"
+#include "view.h"
+#include "tools.h"
+//Added by qt3to4:
+#include <QWheelEvent>
+#include <QMouseEvent>
+#include <Q3PopupMenu>
+#include <QKeyEvent>
+
+class Q3PopupMenu;
+
+//---------------------------------------------------------
+// Canvas
+//---------------------------------------------------------
+
+class Canvas : public View {
+ Q_OBJECT
+ int canvasTools;
+ QTimer *scrollTimer;
+
+ bool doScroll;
+ int scrollSpeed;
+
+ QPoint ev_pos;
+ bool canScrollLeft;
+ bool canScrollRight;
+ bool canScrollUp;
+ bool canScrollDown;
+ protected:
+ enum DragMode {
+ DRAG_OFF, DRAG_NEW,
+ DRAG_MOVE_START, DRAG_MOVE,
+ DRAG_COPY_START, DRAG_COPY,
+ DRAG_CLONE_START, DRAG_CLONE,
+ DRAGX_MOVE, DRAGY_MOVE,
+ DRAGX_COPY, DRAGY_COPY,
+ DRAGX_CLONE, DRAGY_CLONE,
+ DRAG_DELETE,
+ DRAG_RESIZE, DRAG_LASSO_START, DRAG_LASSO,
+ };
+
+ enum DragType {
+ MOVE_MOVE, MOVE_COPY, MOVE_CLONE
+ };
+
+ enum HScrollDir {
+ HSCROLL_NONE, HSCROLL_LEFT, HSCROLL_RIGHT
+ };
+ enum VScrollDir {
+ VSCROLL_NONE, VSCROLL_UP, VSCROLL_DOWN
+ };
+
+ CItemList items;
+ CItemList moving;
+ CItem* curItem;
+ Part* curPart;
+ int curPartId;
+
+ DragMode drag;
+ QRect lasso;
+ QPoint start;
+ Tool _tool;
+ unsigned pos[3];
+
+ HScrollDir hscrollDir;
+ VScrollDir vscrollDir;
+ int keyState;
+ Q3PopupMenu* itemPopupMenu;
+ Q3PopupMenu* canvasPopupMenu;
+
+ void setCursor();
+ virtual void viewKeyPressEvent(QKeyEvent* event);
+ virtual void viewMousePressEvent(QMouseEvent* event);
+ virtual void viewMouseMoveEvent(QMouseEvent*);
+ virtual void viewMouseReleaseEvent(QMouseEvent*);
+ virtual void draw(QPainter&, const QRect&);
+ virtual void wheelEvent(QWheelEvent* e);
+
+ virtual void mousePress(QMouseEvent*) {}
+ virtual void keyPress(QKeyEvent*);
+ virtual void mouseMove(const QPoint&) = 0;
+ virtual void mouseRelease(const QPoint&) {}
+ virtual void drawCanvas(QPainter&, const QRect&) = 0;
+ virtual void drawItem(QPainter&, const CItem*, const QRect&) = 0;
+ virtual void drawMoving(QPainter&, const CItem*, const QRect&) = 0;
+ virtual void updateSelection() = 0;
+ virtual QPoint raster(const QPoint&) const = 0;
+ virtual int y2pitch(int) const = 0; //CDW
+ virtual int pitch2y(int) const = 0; //CDW
+
+ virtual void moveCanvasItems(CItemList&, int, int, DragType, int*) = 0;
+ // Changed by T356.
+ //virtual bool moveItem(CItem*, const QPoint&, DragType, int*) = 0;
+ virtual bool moveItem(CItem*, const QPoint&, DragType) = 0;
+ virtual CItem* newItem(const QPoint&, int state) = 0;
+ virtual void resizeItem(CItem*, bool noSnap=false) = 0;
+ virtual void newItem(CItem*, bool noSnap=false) = 0;
+ virtual bool deleteItem(CItem*) = 0;
+ virtual void startUndo(DragType) = 0;
+
+ virtual void endUndo(DragType, int flags) = 0;
+ int getCurrentDrag();
+
+ /*!
+ \brief Virtual member
+
+ Implementing class is responsible for creating a popup to be shown when the user rightclicks an item on the Canvas
+ \param item The canvas item that is rightclicked
+ \return A QPopupMenu*
+ */
+ virtual Q3PopupMenu* genItemPopup(CItem* /*item*/) { return 0; }
+
+ /*!
+ \brief Pure virtual member
+
+ Implementing class is responsible for creating a popup to be shown when the user rightclicks an empty region of the canvas
+ \return A QPopupMenu*
+ */
+ Q3PopupMenu* genCanvasPopup();
+
+ /*!
+ \brief Virtual member
+
+ This is the function called when the user has selected an option in the popupmenu generated by genItemPopup()
+ \param item the canvas item the whole thing is about
+ \param n Command type
+ \param pt I think this is the position of the pointer when right mouse button was pressed
+ */
+ virtual void itemPopup(CItem* /*item */, int /*n*/, const QPoint& /*pt*/) {}
+ void canvasPopup(int);
+
+ virtual void startDrag(CItem*, bool) {}
+
+ // selection
+ virtual void deselectAll();
+ virtual void selectItem(CItem* e, bool);
+
+ virtual void deleteItem(const QPoint&);
+
+ // moving
+ void startMoving(const QPoint&, DragType);
+
+ void moveItems(const QPoint&, int dir, bool rasterize = true);
+ void endMoveItems(const QPoint&, DragType, int dir);
+
+ virtual void selectLasso(bool toggle);
+
+ virtual void itemPressed(const CItem*) {}
+ virtual void itemReleased(const CItem*, const QPoint&) {}
+ virtual void itemMoved(const CItem*, const QPoint&) {}
+ virtual void curPartChanged() {}
+
+ public slots:
+ void setTool(int t);
+ void setPos(int, unsigned, bool adjustScrollbar);
+ void scrollTimerDone(void);
+ void redirectedWheelEvent(QWheelEvent*);
+
+ signals:
+ void followEvent(int);
+ void toolChanged(int);
+ void verticalScroll(unsigned);
+ void horizontalScroll(unsigned);
+ void horizontalScrollNoLimit(unsigned);
+ public:
+ Canvas(QWidget* parent, int sx, int sy, const char* name = 0);
+ bool isSingleSelection();
+ int selectionSize();
+ Tool tool() const { return _tool; }
+ Part* part() const { return curPart; }
+ void setCurrentPart(Part*);
+ void setCanvasTools(int n) { canvasTools = n; }
+ };
+#endif
+
diff --git a/muse2/muse/widgets/checkbox.cpp b/muse2/muse/widgets/checkbox.cpp
new file mode 100644
index 00000000..3cded268
--- /dev/null
+++ b/muse2/muse/widgets/checkbox.cpp
@@ -0,0 +1,58 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: checkbox.cpp,v 1.2.2.2 2006/10/29 07:54:52 terminator356 Exp $
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "checkbox.h"
+//Added by qt3to4:
+#include <QMouseEvent>
+
+//---------------------------------------------------------
+// CheckBox
+//---------------------------------------------------------
+
+CheckBox::CheckBox(QWidget* parent, int i, const char* name)
+ : QCheckBox(parent, name)
+ {
+ _id = i;
+ connect(this, SIGNAL(toggled(bool)), SLOT(hasToggled(bool)));
+ }
+
+void CheckBox::hasToggled(bool val)
+ {
+ emit toggleChanged(val, _id);
+ }
+
+//------------------------------------------------------------
+// mousePressEvent
+//------------------------------------------------------------
+
+void CheckBox::mousePressEvent(QMouseEvent *e)
+{
+ if(e->button() == Qt::RightButton)
+ emit checkboxRightClicked(e->globalPos(), _id);
+ else
+ {
+ if(isChecked())
+ setChecked(false);
+ else
+ setChecked(true);
+ emit checkboxPressed(_id);
+ }
+}
+
+//------------------------------------------------------------
+// mouseReleaseEvent
+//------------------------------------------------------------
+
+void CheckBox::mouseReleaseEvent(QMouseEvent *e)
+{
+ if(e->button() == Qt::RightButton)
+ return;
+
+ emit checkboxReleased(_id);
+}
+
+
diff --git a/muse2/muse/widgets/checkbox.h b/muse2/muse/widgets/checkbox.h
new file mode 100644
index 00000000..26209987
--- /dev/null
+++ b/muse2/muse/widgets/checkbox.h
@@ -0,0 +1,45 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: checkbox.h,v 1.2.2.2 2006/10/29 07:54:52 terminator356 Exp $
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __CHECKBOX_H__
+#define __CHECKBOX_H__
+
+#include <qcheckbox.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+
+//---------------------------------------------------------
+// CheckBox
+//---------------------------------------------------------
+
+class CheckBox : public QCheckBox {
+ Q_OBJECT
+ Q_PROPERTY( int id READ id WRITE setId )
+
+ int _id;
+
+ protected:
+ void mousePressEvent(QMouseEvent *e);
+ void mouseReleaseEvent(QMouseEvent *e);
+
+ private slots:
+ void hasToggled(bool val);
+
+ signals:
+ void toggleChanged(bool, int);
+ void checkboxPressed(int);
+ void checkboxReleased(int);
+ void checkboxRightClicked(const QPoint &, int);
+
+ public:
+ CheckBox(QWidget* parent, int i, const char* name = 0);
+ int id() const { return _id; }
+ void setId(int i) { _id = i; }
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/citem.cpp b/muse2/muse/widgets/citem.cpp
new file mode 100644
index 00000000..2974196d
--- /dev/null
+++ b/muse2/muse/widgets/citem.cpp
@@ -0,0 +1,93 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: citem.cpp,v 1.2.2.3 2008/01/26 07:23:21 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "part.h"
+#include "citem.h"
+#include <stdio.h>
+
+//---------------------------------------------------------
+// CItem
+//---------------------------------------------------------
+
+CItem::CItem()
+ {
+ _isMoving = false;
+ }
+
+CItem::CItem(const QPoint&p, const QRect& r)
+ {
+ _pos = p;
+ _bbox = r;
+ _isMoving = false;
+ }
+
+// Changed by Tim. p3.3.20
+//CItem::CItem(Event e, Part* p)
+CItem::CItem(const Event& e, Part* p)
+ {
+ _event = e;
+ _part = p;
+ _isMoving = false;
+ }
+
+//---------------------------------------------------------
+// isSelected
+//---------------------------------------------------------
+
+bool CItem::isSelected() const
+ {
+ return _event.empty() ? _part->selected() : _event.selected();
+ }
+
+//---------------------------------------------------------
+// setSelected
+//---------------------------------------------------------
+
+void CItem::setSelected(bool f)
+ {
+ _event.empty() ? _part->setSelected(f) : _event.setSelected(f);
+ }
+
+//---------------------------------------------------------
+// CItemList
+//---------------------------------------------------------
+
+CItem* CItemList::find(const QPoint& pos) const
+ {
+ rciCItem ius;
+ bool usfound = false;
+ for (rciCItem i = rbegin(); i != rend(); ++i) {
+ if (i->second->contains(pos))
+ {
+ if(i->second->isSelected())
+ return i->second;
+
+ else
+ {
+ if(!usfound)
+ {
+ ius = i;
+ usfound = true;
+ }
+ }
+ }
+ }
+ if(usfound)
+ return ius->second;
+ else
+ return 0;
+ }
+
+//---------------------------------------------------------
+// CItemList
+//---------------------------------------------------------
+
+void CItemList::add(CItem* item)
+ {
+ std::multimap<int, CItem*, std::less<int> >::insert(std::pair<const int, CItem*> (item->bbox().x(), item));
+ }
+
diff --git a/muse2/muse/widgets/citem.h b/muse2/muse/widgets/citem.h
new file mode 100644
index 00000000..c58b6bb1
--- /dev/null
+++ b/muse2/muse/widgets/citem.h
@@ -0,0 +1,90 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: citem.h,v 1.2.2.1 2006/10/04 18:45:35 spamatica Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __CITEM_H__
+#define __CITEM_H__
+
+#include <map>
+#include <qpoint.h>
+#include <qrect.h>
+
+#include "event.h"
+
+class Event;
+class Part;
+
+//---------------------------------------------------------
+// CItem
+// virtuelle Basisklasse fr alle Canvas Item's
+//---------------------------------------------------------
+
+class CItem {
+ private:
+ Event _event;
+ Part* _part;
+
+ protected:
+ bool _isMoving;
+ QPoint moving;
+ QRect _bbox;
+ QPoint _pos;
+
+ public:
+ CItem(const QPoint& p, const QRect& r);
+ CItem();
+ // Changed by Tim. p3.3.20
+ //CItem(Event e, Part* p);
+ CItem(const Event& e, Part* p);
+
+ bool isMoving() const { return _isMoving; }
+ void setMoving(bool f) { _isMoving = f; }
+ bool isSelected() const;
+ void setSelected(bool f);
+
+ int width() const { return _bbox.width(); }
+ void setWidth(int l) { _bbox.setWidth(l); }
+ void setHeight(int l) { _bbox.setHeight(l); }
+ void setMp(const QPoint&p) { moving = p; }
+ const QPoint mp() const { return moving; }
+ int x() const { return _pos.x(); }
+ int y() const { return _pos.y(); }
+ void setY(int y) { _bbox.setY(y); }
+ QPoint pos() const { return _pos; }
+ void setPos(const QPoint& p) { _pos = p; }
+ int height() const { return _bbox.height(); }
+ const QRect& bbox() const { return _bbox; }
+ void setBBox(const QRect& r) { _bbox = r; }
+ void move(const QPoint& tl) {
+ _bbox.moveTopLeft(tl);
+ _pos = tl;
+ }
+ bool contains(const QPoint& p) const { return _bbox.contains(p); }
+ bool intersects(const QRect& r) const { return r.intersects(_bbox); }
+
+ Event event() const { return _event; }
+ void setEvent(Event& e) { _event = e; }
+ Part* part() const { return _part; }
+ void setPart(Part* p) { _part = p; }
+ };
+
+typedef std::multimap<int, CItem*, std::less<int> >::iterator iCItem;
+//typedef std::multimap<int, CItem*, std::less<int> >::const_iterator ciCItem;
+typedef std::multimap<int, CItem*, std::less<int> >::const_reverse_iterator rciCItem;
+
+//---------------------------------------------------------
+// CItemList
+// Canvas Item List
+//---------------------------------------------------------
+
+class CItemList: public std::multimap<int, CItem*, std::less<int> > {
+ public:
+ void add(CItem*);
+ CItem* find(const QPoint& pos) const;
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/cliplisteditorbase.ui b/muse2/muse/widgets/cliplisteditorbase.ui
new file mode 100644
index 00000000..272c578c
--- /dev/null
+++ b/muse2/muse/widgets/cliplisteditorbase.ui
@@ -0,0 +1,168 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>ClipListEditorBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ClipListEditorBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: ClipList</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizeable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Refs</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizeable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Start</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizeable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Len</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizeable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Data</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizeable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>view</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Clip Properties</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Pos:</string>
+ </property>
+ </widget>
+ <widget class="PosEdit">
+ <property name="name">
+ <cstring>start</cstring>
+ </property>
+ <property name="smpte">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Len:</string>
+ </property>
+ </widget>
+ <widget class="PosEdit">
+ <property name="name">
+ <cstring>len</cstring>
+ </property>
+ <property name="smpte">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<includes>
+ <include location="local" impldecl="in declaration">posedit.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/comboQuant.cpp b/muse2/muse/widgets/comboQuant.cpp
new file mode 100644
index 00000000..4a81bc8e
--- /dev/null
+++ b/muse2/muse/widgets/comboQuant.cpp
@@ -0,0 +1,61 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: comboQuant.cpp,v 1.1.1.1 2003/10/27 18:54:52 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <q3listbox.h>
+#include "comboQuant.h"
+
+static int quantTable[] = {
+ 1, 16, 32, 64, 128, 256, 512, 1024,
+ 1, 24, 48, 96, 192, 384, 768, 1536,
+ 1, 36, 72, 144, 288, 576, 1152, 2304
+ };
+
+static const char* quantStrings[] = {
+ QT_TR_NOOP("Off"), "64T", "32T", "16T", "8T", "4T", "2T", "1T",
+ QT_TR_NOOP("Off"), "64", "32", "16", "8", "4", "2", "1",
+ QT_TR_NOOP("Off"), "64.", "32.", "16.", "8.", "4.", "2.", "1."
+ };
+
+//---------------------------------------------------------
+// ComboQuant
+//---------------------------------------------------------
+
+ComboQuant::ComboQuant(QWidget* parent, const char* name)
+ : QComboBox(parent, name)
+ {
+ Q3ListBox* qlist = new Q3ListBox(this);
+ qlist->setMinimumWidth(95);
+ //setListBox(qlist); ddskrjo
+ qlist->setColumnMode(3);
+ for (int i = 0; i < 24; i++)
+ qlist->insertItem(tr(quantStrings[i]), i);
+ connect(this, SIGNAL(activated(int)), SLOT(activated(int)));
+ }
+
+//---------------------------------------------------------
+// activated
+//---------------------------------------------------------
+
+void ComboQuant::activated(int index)
+ {
+ emit valueChanged(quantTable[index]);
+ }
+
+//---------------------------------------------------------
+// setQuant
+//---------------------------------------------------------
+
+void ComboQuant::setValue(int val)
+ {
+ for (int i = 0; i < 24; i++) {
+ if (val == quantTable[i]) {
+ setCurrentItem(i);
+ return;
+ }
+ }
+ }
+
diff --git a/muse2/muse/widgets/comboQuant.h b/muse2/muse/widgets/comboQuant.h
new file mode 100644
index 00000000..0031fa33
--- /dev/null
+++ b/muse2/muse/widgets/comboQuant.h
@@ -0,0 +1,33 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: comboQuant.h,v 1.1.1.1 2003/10/27 18:54:30 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __COMBOQUANT_H__
+#define __COMBOQUANT_H__
+
+#include <qwidget.h>
+#include <qcombobox.h>
+
+//---------------------------------------------------------
+// ComboQuant
+//---------------------------------------------------------
+
+class ComboQuant : public QComboBox {
+ Q_OBJECT
+
+ private slots:
+ void activated(int);
+
+ signals:
+ void valueChanged(int);
+
+ public:
+ ComboQuant(QWidget* parent = 0, const char* name = 0);
+ void setValue(int val);
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/combobox.cpp b/muse2/muse/widgets/combobox.cpp
new file mode 100644
index 00000000..35959636
--- /dev/null
+++ b/muse2/muse/widgets/combobox.cpp
@@ -0,0 +1,74 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: combobox.cpp,v 1.4 2004/05/06 15:08:07 wschweer Exp $
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <q3popupmenu.h>
+#include <qcursor.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <Q3Frame>
+#include <QLabel>
+#include "combobox.h"
+
+//---------------------------------------------------------
+// ComboBox
+//---------------------------------------------------------
+
+ComboBox::ComboBox(QWidget* parent, const char* name)
+ : QLabel(parent, name)
+ {
+ _currentItem = 0;
+ _id = -1;
+ list = new Q3PopupMenu(0, "comboPopup");
+ connect(list, SIGNAL(activated(int)), SLOT(activatedIntern(int)));
+ setFrameStyle(Q3Frame::Panel | Q3Frame::Raised);
+ setLineWidth(2);
+ }
+
+ComboBox::~ComboBox()
+ {
+ delete list;
+ }
+
+//---------------------------------------------------------
+// mousePressEvent
+//---------------------------------------------------------
+
+void ComboBox::mousePressEvent(QMouseEvent*)
+ {
+ list->exec(QCursor::pos());
+ }
+
+//---------------------------------------------------------
+// activated
+//---------------------------------------------------------
+
+void ComboBox::activatedIntern(int n)
+ {
+ _currentItem = n;
+ emit activated(n, _id);
+ setText(list->text(_currentItem));
+ }
+
+//---------------------------------------------------------
+// setCurrentItem
+//---------------------------------------------------------
+
+void ComboBox::setCurrentItem(int i)
+ {
+ _currentItem = i;
+ setText(list->text(list->idAt(_currentItem)));
+ }
+
+//---------------------------------------------------------
+// insertItem
+//---------------------------------------------------------
+
+void ComboBox::insertItem(const QString& s, int id, int idx)
+ {
+ list->insertItem(s, id, idx);
+ }
+
diff --git a/muse2/muse/widgets/combobox.h b/muse2/muse/widgets/combobox.h
new file mode 100644
index 00000000..99bb382c
--- /dev/null
+++ b/muse2/muse/widgets/combobox.h
@@ -0,0 +1,49 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: combobox.h,v 1.3 2004/02/29 12:12:36 wschweer Exp $
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __COMBOBOX_H__
+#define __COMBOBOX_H__
+
+#include <qlabel.h>
+//Added by qt3to4:
+#include <Q3PopupMenu>
+#include <QMouseEvent>
+
+class Q3PopupMenu;
+
+//---------------------------------------------------------
+// ComboBox
+//---------------------------------------------------------
+
+class ComboBox : public QLabel {
+ Q_OBJECT
+ Q_PROPERTY( int id READ id WRITE setId )
+
+ int _id;
+ int _currentItem;
+ Q3PopupMenu* list;
+ virtual void mousePressEvent(QMouseEvent*);
+
+ private slots:
+ void activatedIntern(int);
+
+ signals:
+ void activated(int val, int id);
+
+ public:
+ ComboBox(QWidget* parent, const char* name = 0);
+ ~ComboBox();
+ void setCurrentItem(int);
+ void insertItem(const QString& s, int id = -1, int idx=-1);
+ int id() const { return _id; }
+ void setId(int i) { _id = i; }
+ };
+
+#endif
+
+
+
diff --git a/muse2/muse/widgets/comment.cpp b/muse2/muse/widgets/comment.cpp
new file mode 100644
index 00000000..ef727859
--- /dev/null
+++ b/muse2/muse/widgets/comment.cpp
@@ -0,0 +1,86 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: comment.cpp,v 1.2 2004/02/08 18:30:00 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "comment.h"
+#include "song.h"
+#include "track.h"
+#include <q3multilineedit.h>
+#include <qlabel.h>
+
+//---------------------------------------------------------
+// Comment
+//---------------------------------------------------------
+
+Comment::Comment(QWidget* parent, const char* name)
+ : CommentBase(parent, name)
+ {
+ }
+
+//---------------------------------------------------------
+// textChanged
+//---------------------------------------------------------
+
+void Comment::textChanged()
+ {
+ setText(textentry->text());
+ }
+
+//---------------------------------------------------------
+// TrackComment
+//---------------------------------------------------------
+
+TrackComment::TrackComment(Track* t, QWidget* parent, const char* name)
+ : Comment(parent, name)
+ {
+ setCaption(tr("MusE: Track Comment"));
+ track = t;
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ textentry->setText(track->comment());
+ connect(textentry, SIGNAL(textChanged()), SLOT(textChanged()));
+ label1->setText(tr("Track Comment:"));
+ label2->setText(track->name());
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void TrackComment::songChanged(int flags)
+ {
+ if ((flags & (SC_TRACK_INSERTED|SC_TRACK_REMOVED|SC_TRACK_MODIFIED)) == 0)
+ return;
+
+ // check if track still exists:
+ TrackList* tl = song->tracks();
+ iTrack it;
+ for (it = tl->begin(); it != tl->end(); ++it) {
+ if (track == *it)
+ break;
+ }
+ if (it == tl->end()) {
+ close(true);
+ return;
+ }
+ label2->setText(track->name());
+ if (track->comment() != textentry->text()) {
+ disconnect(textentry, SIGNAL(textChanged()), this, SLOT(textChanged()));
+ textentry->setText(track->comment());
+ textentry->setCursorPosition(1000, 1000);
+ connect(textentry, SIGNAL(textChanged()), this, SLOT(textChanged()));
+ }
+ }
+
+//---------------------------------------------------------
+// setText
+//---------------------------------------------------------
+
+void TrackComment::setText(const QString& s)
+ {
+ track->setComment(s);
+ song->update(SC_TRACK_MODIFIED);
+ }
+
diff --git a/muse2/muse/widgets/comment.h b/muse2/muse/widgets/comment.h
new file mode 100644
index 00000000..f3fbd547
--- /dev/null
+++ b/muse2/muse/widgets/comment.h
@@ -0,0 +1,53 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: comment.h,v 1.2 2004/02/08 18:30:00 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __COMMENT_H__
+#define __COMMENT_H__
+
+#include <qwidget.h>
+#include "commentbase.h"
+
+class Xml;
+class Track;
+
+//---------------------------------------------------------
+// Comment
+//---------------------------------------------------------
+
+class Comment : public CommentBase {
+ Q_OBJECT
+
+ private:
+ virtual void setText(const QString& s) = 0;
+
+ private slots:
+ void textChanged();
+
+ public:
+ Comment(QWidget* parent, const char* name = 0);
+ };
+
+//---------------------------------------------------------
+// TrackComment
+//---------------------------------------------------------
+
+class TrackComment : public Comment {
+ Track* track;
+ Q_OBJECT
+
+ private:
+ virtual void setText(const QString& s);
+
+ private slots:
+ void songChanged(int);
+
+ public:
+ TrackComment(Track*, QWidget*, const char* name = 0);
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/commentbase.ui b/muse2/muse/widgets/commentbase.ui
new file mode 100644
index 00000000..a4bed010
--- /dev/null
+++ b/muse2/muse/widgets/commentbase.ui
@@ -0,0 +1,116 @@
+<!DOCTYPE UI><UI>
+<class>CommentBase</class>
+<widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>CommentBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>387</width>
+ <height>205</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Form1</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>label1</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Track Comment</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>label2</cstring>
+ </property>
+ <property stdset="1">
+ <name>font</name>
+ <font>
+ <pointsize>12</pointsize>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>Box</enum>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>Sunken</enum>
+ </property>
+ <property stdset="1">
+ <name>midLineWidth</name>
+ <number>1</number>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Track 1</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QMultiLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>textentry</cstring>
+ </property>
+ <property stdset="1">
+ <name>font</name>
+ <font>
+ <pointsize>12</pointsize>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>WinPanel</enum>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+</UI>
diff --git a/muse2/muse/widgets/configmidifilebase.ui b/muse2/muse/widgets/configmidifilebase.ui
new file mode 100644
index 00000000..4ba53d7e
--- /dev/null
+++ b/muse2/muse/widgets/configmidifilebase.ui
@@ -0,0 +1,259 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>ConfigMidiFileBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>ConfigMidiFileBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>548</width>
+ <height>353</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Config Midi File Import/Export</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>midiImportGroupBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Import:</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>splitPartsCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Split tracks into &amp;parts</string>
+ </property>
+ <property name="accel">
+ <string>Alt+P</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Split tracks into parts, or one single part</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>midiExportGroupBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Export:</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>copyrightEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>96</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>192</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>384</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>divisionCombo</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>extendedFormat</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Enable extended smf format (currently not implemented)</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>twoByteTimeSigs</cstring>
+ </property>
+ <property name="text">
+ <string>Use &amp;2-byte time signatures instead of standard 4</string>
+ </property>
+ <property name="accel">
+ <string>Alt+2</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Copyright:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Format:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Division:</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="5" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>optNoteOffs</cstring>
+ </property>
+ <property name="text">
+ <string>Save space by replacing note-offs with &amp;zero velocity note-ons</string>
+ </property>
+ <property name="accel">
+ <string>Alt+Z</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <item>
+ <property name="text">
+ <string>0 (single track)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>1 (multiple tracks)</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>formatCombo</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>ConfigMidiFileBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>ConfigMidiFileBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/ctrlcombo.cpp b/muse2/muse/widgets/ctrlcombo.cpp
new file mode 100644
index 00000000..26512639
--- /dev/null
+++ b/muse2/muse/widgets/ctrlcombo.cpp
@@ -0,0 +1,56 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ctrlcombo.cpp,v 1.1.1.1 2003/10/27 18:55:02 wschweer Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "ctrlcombo.h"
+
+//---------------------------------------------------------
+// CtrlComboBox
+//---------------------------------------------------------
+
+CtrlComboBox::CtrlComboBox(QWidget* parent, const char* name)
+ : QComboBox(parent, name)
+ {
+ const char* ctxt[] = {
+ "No Ctrl", "BankSelMSB", "Modulation", "BreathCtrl",
+ "Control 3", "Foot Ctrl", "Porta Time", "DataEntMSB",
+ "MainVolume", "Balance", "Control 9", "Pan",
+ "Expression", "Control 12", "Control 13", "Control 14",
+ "Control 15", "Gen.Purp.1", "Gen.Purp.2", "Gen.Purp.3",
+ "Gen.Purp.4", "Control 20", "Control 21", "Control 22",
+ "Control 23", "Control 24", "Control 25", "Control 26",
+ "Control 27", "Control 28", "Control 29", "Control 30",
+ "Control 31", "BankSelLSB", "Modul. LSB", "BrthCt.LSB",
+ "Control 35", "FootCt.LSB", "Port.T LSB", "DataEntLSB",
+ "MainVolLSB", "BalanceLSB", "Control 41", "Pan LSB",
+ "Expr. LSB", "Control 44", "Control 45", "Control 46",
+ "Control 47", "Gen.P.1LSB", "Gen.P.2LSB", "Gen.P.3LSB",
+ "Gen.P.4LSB", "Control 52", "Control 53", "Control 54",
+ "Control 55", "Control 56", "Control 57", "Control 58",
+ "Control 59", "Control 60", "Control 61", "Control 62",
+ "Control 63", "Sustain", "Porta Ped", "Sostenuto",
+ "Soft Pedal", "Control 68", "Hold 2", "Control 70",
+ "HarmonicCo", "ReleaseTime", "Attack Time", "Brightness",
+ "Control 75", "Control 76", "Control 77", "Control 78",
+ "Control 79", "Gen.Purp.5", "Gen.Purp.6", "Gen.Purp.7",
+ "Gen.Purp.8", "Porta Ctrl", "Control 85", "Control 86",
+ "Control 87", "Control 88", "Control 89", "Control 90",
+ "Effect1Dep", "Effect2Dep", "Effect3Dep", "Effect4Dep",
+ "Phaser Dep", "Data Incr", "Data Decr", "NRPN LSB",
+ "NRPN MSB", "RPN LSB", "RPN MSB", "Control102",
+ "Control103", "Control104", "Control105", "Control106",
+ "Control107", "Control108", "Control109", "Control110",
+ "Control111", "Control112", "Control113", "Control114",
+ "Control115", "Control116", "Control117", "Control118",
+ "Control119", "AllSndOff", "Reset Ctrl", "Local Ctrl",
+ "AllNoteOff", "OmniModOff", "OmniModeOn", "MonoModeOn",
+ "PolyModeOn"
+ };
+ for (unsigned int i = 0; i < sizeof(ctxt)/sizeof(*ctxt); ++i)
+ insertItem(QString(ctxt[i]));
+ }
+
diff --git a/muse2/muse/widgets/ctrlcombo.cw b/muse2/muse/widgets/ctrlcombo.cw
new file mode 100644
index 00000000..f4f5b2ac
--- /dev/null
+++ b/muse2/muse/widgets/ctrlcombo.cw
@@ -0,0 +1,22 @@
+<!DOCTYPE CW><CW>
+<customwidgets>
+ <customwidget>
+ <class>CtrlComboBox</class>
+ <header location="global">ctrlcombo.h</header>
+ <sizehint>
+ <width>50</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ </sizepolicy>
+ <pixmap>
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
+ </pixmap>
+ <signal>activated(int index)</signal>
+ <signal>activated(const QString&amp;)</signal>
+ </customwidget>
+</customwidgets>
+</CW>
diff --git a/muse2/muse/widgets/ctrlcombo.h b/muse2/muse/widgets/ctrlcombo.h
new file mode 100644
index 00000000..8aa134e3
--- /dev/null
+++ b/muse2/muse/widgets/ctrlcombo.h
@@ -0,0 +1,22 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ctrlcombo.h,v 1.1.1.1 2003/10/27 18:54:30 wschweer Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __CTRLGRP_H__
+#define __CTRLGRP_H__
+
+#include <qcombobox.h>
+
+class CtrlComboBox : public QComboBox {
+ Q_OBJECT
+ public:
+ CtrlComboBox(QWidget* parent, const char* name = 0);
+ };
+
+
+#endif
+
diff --git a/muse2/muse/widgets/dentry.cpp b/muse2/muse/widgets/dentry.cpp
new file mode 100644
index 00000000..61c0d096
--- /dev/null
+++ b/muse2/muse/widgets/dentry.cpp
@@ -0,0 +1,243 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: dentry.cpp,v 1.1.1.1.2.3 2008/08/18 00:15:26 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "dentry.h"
+#include <stdio.h>
+#include <qtimer.h>
+#include <qcursor.h>
+//Added by qt3to4:
+#include <QWheelEvent>
+#include <QMouseEvent>
+#include <QContextMenuEvent>
+#include "globals.h"
+
+#define TIMER1 400
+#define TIMER2 200
+#define TIMEC 7
+#define TIMER3 100
+#define TIMEC2 20
+#define TIMER4 50
+
+//---------------------------------------------------------
+// Dentry
+// lineedit double values
+//---------------------------------------------------------
+
+Dentry::Dentry(QWidget* parent, const char* name) : QLineEdit(parent, name)
+ {
+ _slider = 0;
+ _id = -1;
+ drawFrame = false;
+ QLineEdit::setFrame(drawFrame);
+ timer = new QTimer(this);
+ connect(timer, SIGNAL(timeout()), SLOT(repeat()));
+ val = 0.01;
+ connect(this, SIGNAL(returnPressed()), SLOT(endEdit()));
+ setCursor(QCursor(Qt::arrowCursor));
+ evx = 1.0;
+ }
+
+//---------------------------------------------------------
+// contextMenuEvent
+//---------------------------------------------------------
+
+void Dentry::contextMenuEvent(QContextMenuEvent * e)
+{
+ e->accept();
+}
+
+//---------------------------------------------------------
+// setFrame
+//---------------------------------------------------------
+
+void Dentry::setFrame(bool flag)
+ {
+ drawFrame = flag;
+ QLineEdit::setFrame(drawFrame);
+ update();
+ }
+
+//---------------------------------------------------------
+// endEdit
+//---------------------------------------------------------
+
+void Dentry::endEdit()
+ {
+ if (edited()) {
+ if (setSValue(text())) {
+ setString(val);
+ return;
+ }
+ }
+ setString(val);
+ clearFocus();
+ if (!drawFrame)
+ QLineEdit::setFrame(false);
+ }
+
+//---------------------------------------------------------
+// mousePressEvent
+//---------------------------------------------------------
+
+void Dentry::mousePressEvent(QMouseEvent* event)
+ {
+ button = event->button();
+ starty = event->y();
+ evx = double(event->x());
+ timecount = 0;
+ repeat();
+ timer->start(TIMER1);
+ }
+
+//---------------------------------------------------------
+// wheelEvent
+//---------------------------------------------------------
+
+void Dentry::wheelEvent(QWheelEvent* event)
+ {
+ // Avoid unwanted wheel events from outside the control.
+ // Tested: No go, can't seem to determine where event came from.
+ /*
+ const QPoint gp = mapToGlobal(event->pos());
+ const QRect gr = QRect(mapToGlobal(rect().topLeft()), mapToGlobal(rect().bottomRight()));
+ if(!gr.contains(gp))
+ */
+ //if(sender() != this)
+ //{
+ // event->ignore();
+ // return;
+ //}
+
+ event->accept();
+
+ int delta = event->delta();
+
+ if (delta < 0)
+ {
+ if(_slider)
+ _slider->stepPages(-1);
+ else
+ decValue(-1.0);
+ }
+ else if (delta > 0)
+ {
+ if(_slider)
+ _slider->stepPages(1);
+ else
+ incValue(1.0);
+ }
+ }
+
+//---------------------------------------------------------
+// repeat
+//---------------------------------------------------------
+
+void Dentry::repeat()
+ {
+ if (timecount == 1) {
+ ++timecount;
+ timer->stop();
+ timer->start(TIMER2);
+ return;
+ }
+ ++timecount;
+ if (timecount == TIMEC) {
+ timer->stop();
+ timer->start(TIMER3);
+ }
+ if (timecount == TIMEC2) {
+ timer->stop();
+ timer->start(TIMER4);
+ }
+
+ switch (button) {
+ case Qt::LeftButton:
+ return;
+ case Qt::MidButton:
+ if(_slider)
+ _slider->stepPages(-1);
+ else
+ decValue(evx);
+ break;
+ case Qt::RightButton:
+ if(_slider)
+ _slider->stepPages(1);
+ else
+ incValue(evx);
+ break;
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// mouseReleaseEvent
+//---------------------------------------------------------
+
+void Dentry::mouseReleaseEvent(QMouseEvent*)
+ {
+ button = Qt::NoButton;
+ timer->stop();
+ }
+
+//---------------------------------------------------------
+// mouseMoveEvent
+//---------------------------------------------------------
+
+void Dentry::mouseMoveEvent(QMouseEvent*)
+ {
+ switch (button) {
+ case Qt::LeftButton:
+ break;
+ case Qt::MidButton:
+ break;
+ case Qt::RightButton:
+ break;
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// mouseDoubleClickEvent
+//---------------------------------------------------------
+
+void Dentry::mouseDoubleClickEvent(QMouseEvent* event)
+ {
+ if (event->button() != Qt::LeftButton) {
+ mousePressEvent(event);
+ return;
+ }
+ setFocus();
+ QLineEdit::setFrame(true);
+ update();
+ emit doubleClicked(_id);
+ }
+
+//---------------------------------------------------------
+// setValue
+//---------------------------------------------------------
+
+void Dentry::setValue(double v)
+ {
+ if (v == val)
+ return;
+ setString(v);
+#if 0
+ if (setString(v)) {
+ clearFocus();
+ if (!drawFrame)
+ QLineEdit::setFrame(false);
+ setEnabled(false);
+ }
+ else {
+ setEnabled(true);
+ }
+#endif
+ val = v;
+ }
+
diff --git a/muse2/muse/widgets/dentry.h b/muse2/muse/widgets/dentry.h
new file mode 100644
index 00000000..58f1ef6f
--- /dev/null
+++ b/muse2/muse/widgets/dentry.h
@@ -0,0 +1,79 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: dentry.h,v 1.1.1.1.2.3 2008/08/18 00:15:26 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __DENTRY_H__
+#define __DENTRY_H__
+
+#include <qlineedit.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QContextMenuEvent>
+#include <QWheelEvent>
+
+#include "sliderbase.h"
+
+class QTimer;
+
+//---------------------------------------------------------
+// Dentry
+//---------------------------------------------------------
+
+class Dentry : public QLineEdit {
+ Q_OBJECT
+
+ Q_PROPERTY( int id READ id WRITE setId )
+ Q_PROPERTY( double value READ value WRITE setValue )
+ Q_PROPERTY( bool frame READ frame WRITE setFrame )
+
+ SliderBase* _slider;
+ int button;
+ int starty;
+ bool drawFrame;
+ QTimer* timer;
+ double evx;
+ int timecount;
+
+ virtual void wheelEvent(QWheelEvent*);
+ virtual void mousePressEvent(QMouseEvent*);
+ virtual void mouseMoveEvent(QMouseEvent*);
+ virtual void mouseDoubleClickEvent(QMouseEvent*);
+ virtual void mouseReleaseEvent(QMouseEvent*);
+ void contextMenuEvent(QContextMenuEvent*);
+
+ protected:
+ int _id;
+ double val;
+
+ virtual void incValue(double x) = 0;
+ virtual void decValue(double x) = 0;
+ virtual bool setString(double) = 0;
+ virtual bool setSValue(const QString&) = 0;
+
+ private slots:
+ void repeat();
+
+ protected slots:
+ void endEdit();
+
+ signals:
+ void valueChanged(double, int);
+ void doubleClicked(int);
+
+ public slots:
+ virtual void setValue(double);
+
+ public:
+ Dentry(QWidget*, const char* name=0);
+ double value() const { return val; }
+ bool frame() const { return drawFrame; }
+ void setFrame(bool);
+ int id() const { return _id; }
+ void setId(int i) { _id = i; }
+ SliderBase* slider() const { return _slider; }
+ void setSlider(SliderBase* s) { _slider = s; }
+ };
+#endif
diff --git a/muse2/muse/widgets/didyouknow.ui b/muse2/muse/widgets/didyouknow.ui
new file mode 100644
index 00000000..005fa7b6
--- /dev/null
+++ b/muse2/muse/widgets/didyouknow.ui
@@ -0,0 +1,102 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>DidYouKnow</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>DidYouKnow</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>494</width>
+ <height>249</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Did you know?</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTextEdit">
+ <property name="name">
+ <cstring>tipText</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>dontShowCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Don't show on startup</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>121</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>nextButton</cstring>
+ </property>
+ <property name="text">
+ <string>Next tip</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>closeButton</cstring>
+ </property>
+ <property name="text">
+ <string>Close</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>closeButton</sender>
+ <signal>clicked()</signal>
+ <receiver>DidYouKnow</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/dimap.cpp b/muse2/muse/widgets/dimap.cpp
new file mode 100644
index 00000000..1f87358c
--- /dev/null
+++ b/muse2/muse/widgets/dimap.cpp
@@ -0,0 +1,308 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: dimap.cpp,v 1.1.1.1 2003/10/27 18:55:11 wschweer Exp $
+
+// Copyright (C) 1997 Josef Wilgen
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2,
+// as published by the Free Software Foundation.
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <cmath>
+#include "dimap.h"
+#include "mmath.h"
+
+const double DiMap::LogMin = 1.0e-150;
+const double DiMap::LogMax = 1.0e150;
+
+// DiMap - Map a double interval into an integer interval
+//
+// The DiMap class maps an interval of type double into an interval of
+// type integer. It consists
+// of two intervals D = [d1, d2] (double) and I = [i1, i2] (int), which are
+// specified with the @DiMap::setDblRange@ and @DiMap::setIntRange@
+// members. The point d1 is mapped to the point i1, and d2 is mapped to i2.
+// Any point inside or outside D can be mapped to a point inside or outside
+// I using @DiMap::transform@ or @DiMap::limTransform@ or vice versa
+// using @QwtPlot::invTransform@. D can be scaled linearly or
+// logarithmically, as specified with @DiMap::setDblRange@.
+
+//------------------------------------------------------------
+//.F DiMap::DiMap (1)
+// Construct a DiMap instance.
+//
+//.u Syntax
+//.f DiMap::DiMap()
+//
+//.u Description
+// The double and integer intervals are both set to [0,1].
+//------------------------------------------------------------
+
+DiMap::DiMap()
+ {
+ d_x1 = 0.0;
+ d_x2 = 1.0;
+ d_y1 = 0;
+ d_y2 = 1;
+ d_cnv = 1.0;
+ }
+
+//------------------------------------------------------------
+//.F DiMap::DiMap (2)
+// Construct a DiMap instance with initial integer
+// and double intervals
+//
+//.u Syntax
+//.f DiMap::DiMap(int i1, int i2, double d1, double d2, bool logarithmic)
+//
+//.u Parameters
+//.p int i1 -- first border of integer interval
+// int i2 -- second border of integer interval
+// double d1 -- first border of double interval
+// double d2 -- second border of double interval
+// bool logarithmic -- logarithmic mapping, TRUE or FALSE. Defaults
+// to FALSE.
+//------------------------------------------------------------
+
+DiMap::DiMap(int i1, int i2, double d1, double d2, bool logarithmic)
+ {
+ d_log = logarithmic;
+ setIntRange(i1,i2);
+ setDblRange(d1, d2);
+ }
+
+//------------------------------------------------------------
+//.F DiMap::~DiMap
+// Destroy a DiMap instance.
+//
+//.u Syntax
+//.f DiMap::~DiMap()
+//------------------------------------------------------------
+
+DiMap::~DiMap()
+ {
+ }
+
+//------------------------------------------------------------
+//.F DiMap::contains (1)
+// Returns TRUE if a value x lies inside or at the border of the
+// map's double range.
+//
+//.u Syntax
+//.f bool DiMap::contains(double x)
+//
+//.u Parameters
+//.p double x -- value
+//------------------------------------------------------------
+
+bool DiMap::contains(double x) const
+ {
+ return ( (x >= qwtMin(d_x1, d_x1)) && (x <= qwtMax(d_x1, d_x2)));
+ }
+
+//------------------------------------------------------------
+//.F DiMap::contains (2)
+// Returns TRUE if a value x lies inside or at the border of the
+// map's integer range
+//
+//.u Syntax
+//.f bool DiMap::contains(int x)
+//
+//.u Parameters
+//.p int x -- value
+//------------------------------------------------------------
+
+bool DiMap::contains(int x) const
+ {
+ return ( (x >= qwtMin(d_y1, d_y1)) && (x <= qwtMax(d_y1, d_y2)));
+ }
+
+//------------------------------------------------------------
+//.F DiMap::setDblRange
+// Specify the borders of the double interval
+//
+//.u Syntax
+//.f void DiMap::setDblRange(double d1, double d2, bool lg = FALSE)
+//
+//.u Parameters
+//.p double d1 -- first border
+// double d2 -- second border
+// bool lg -- logarithmic (TRUE) or linear (FALSE)
+// scaling. Defaults to FALSE.
+//------------------------------------------------------------
+
+void DiMap::setDblRange(double d1, double d2, bool lg)
+ {
+ if (lg) {
+ d_log = true;
+ if (d1 < LogMin)
+ d1 = LogMin;
+ else if (d1 > LogMax)
+ d1 = LogMax;
+
+ if (d2 < LogMin)
+ d2 = LogMin;
+ else if (d2 > LogMax)
+ d2 = LogMax;
+
+ d_x1 = log(d1);
+ d_x2 = log(d2);
+ }
+ else {
+ d_log = FALSE;
+ d_x1 = d1;
+ d_x2 = d2;
+ }
+ newFactor();
+ }
+
+//------------------------------------------------------------
+//.F DiMap::setIntRange
+// Specify the borders of the integer interval
+//
+//.u Syntax
+//.f void DiMap::setIntRange(int i1, int i2)
+//
+//.u Parameters
+//.p int i1 -- first border
+// int i2 -- second border
+//------------------------------------------------------------
+
+void DiMap::setIntRange(int i1, int i2)
+ {
+ d_y1 = i1;
+ d_y2 = i2;
+ newFactor();
+ }
+
+//------------------------------------------------------------
+//.F DiMap::transform
+// Transform a point in double interval into an point in the
+// integer interval
+//
+//.u Syntax
+//.f int DiMap::transform(double x)
+//
+//.u Parameters
+//.p double x
+//
+//.u Return Value
+//.t
+// linear mapping: -- rint(i1 + (i2 - i1) / (d2 - d1) * (x - d1))
+// logarithmic mapping: -- rint(i1 + (i2 - i1) / log(d2 / d1) * log(x / d1))
+//
+//.u Note
+// The specified point is allowed to lie outside the intervals. If you
+// want to limit the returned value, use @DiMap::limTransform@.
+//------------------------------------------------------------
+
+int DiMap::transform(double x) const
+ {
+ if (d_log)
+ return (d_y1 + int(rint( (log(x) - d_x1) * d_cnv )));
+ else
+ return (d_y1 + int(rint( (x - d_x1) * d_cnv )));
+ }
+
+//------------------------------------------------------------
+//.F DiMap::invTransform
+// Transform an integer value into a double value
+//
+//.u Syntax
+//.f double DiMap::invTransform(int y)
+//
+//.u Parameters
+//.p int y -- integer value to be transformed
+//
+//.u Return Value
+//.t
+// linear mapping: -- d1 + (d2 - d1) / (i2 - i1) * (y - i1)
+// logarithmic mapping: -- d1 + (d2 - d1) / log(i2 / i1) * log(y / i1)
+//------------------------------------------------------------
+
+double DiMap::invTransform(int y) const
+ {
+ if (d_cnv == 0.0)
+ return 0.0;
+ else {
+ if (d_log)
+ return exp(d_x1 + double(y - d_y1) / d_cnv );
+ else
+ return ( d_x1 + double(y - d_y1) / d_cnv );
+ }
+ }
+
+//------------------------------------------------------------
+//.F DiMap::limTransform
+// Transform and limit
+//
+//.u Syntax
+//.f int DiMap::limTransform(double x)
+//
+//.u Parameters
+//.p double x
+//
+//.u Return Value
+// transformed value
+//
+//.u Description
+// The function is similar to @DiMap::transform@, but limits the input value
+// to the nearest border of the map's double interval if it lies outside
+// that interval.
+//------------------------------------------------------------
+
+int DiMap::limTransform(double x) const
+ {
+ if ( x > qwtMax(d_x1, d_x2) )
+ x = qwtMax(d_x1, d_x2);
+ else if ( x < qwtMin(d_x1, d_x2))
+ x = qwtMin(d_x1, d_x2);
+ return transform(x);
+ }
+
+//------------------------------------------------------------
+//.F DiMap::xTransform
+// Exact transformation
+//
+//.u Syntax
+//.f double DiMap::dTransform(double x)
+//
+//.u Parameters
+//.p double x -- value to be transformed
+//
+//.u Return Value
+//.t
+// linear mapping: -- i1 + (i2 - i1) / (d2 - d1) * (x - d1)
+// logarithmic mapping: -- i1 + (i2 - i1) / log(d2 / d1) * log(x / d1)
+//
+//.u Description
+// This function is similar to @DiMap::transform@, but
+// makes the integer interval appear to be double.
+//------------------------------------------------------------
+
+double DiMap::xTransform(double x) const
+ {
+ double rv;
+
+ if (d_log)
+ rv = double(d_y1) + (log(x) - d_x1) * d_cnv;
+ else
+ rv = double(d_y1) + (x - d_x1) * d_cnv;
+ return rv;
+ }
+
+//------------------------------------------------------------
+//.F DiMap::newFactor
+// Re-calculate the conversion factor.
+//------------------------------------------------------------
+
+void DiMap::newFactor()
+ {
+ if (d_x2 != d_x1)
+ d_cnv = double(d_y2 - d_y1) / (d_x2 - d_x1);
+ else
+ d_cnv = 0.0;
+ }
diff --git a/muse2/muse/widgets/dimap.h b/muse2/muse/widgets/dimap.h
new file mode 100644
index 00000000..5e9ac3ee
--- /dev/null
+++ b/muse2/muse/widgets/dimap.h
@@ -0,0 +1,55 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: dimap.h,v 1.1.1.1 2003/10/27 18:54:28 wschweer Exp $
+//
+// Copyright (C) 1997 Josef Wilgen
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2,
+// as published by the Free Software Foundation.
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __DIMAP_H__
+#define __DIMAP_H__
+
+#include <qglobal.h>
+
+class DiMap
+ {
+ double d_x1, d_x2; // double interval boundaries
+ int d_y1,d_y2; // integer interval boundaries
+ double d_cnv; // conversion factor
+ bool d_log; // logarithmic scale?
+
+ void newFactor();
+
+ public:
+ static const double LogMin;
+ static const double LogMax;
+
+ DiMap();
+ DiMap(int, int, double, double, bool lg = FALSE);
+ ~DiMap();
+
+
+ bool contains(double x) const;
+ bool contains(int x) const;
+
+ void setIntRange(int i1, int i2);
+ void setDblRange(double d1, double d2, bool lg = FALSE);
+
+ int transform(double x) const;
+ double invTransform(int i) const;
+ int limTransform(double x) const;
+ double xTransform(double x) const;
+
+ double d1() const { return d_x1;}
+ double d2() const { return d_x2;}
+ int i1() const { return d_y1;}
+ int i2() const { return d_y2;}
+ bool logarithmic() const { return d_log;}
+ };
+
+#endif
diff --git a/muse2/muse/widgets/doublelabel.cpp b/muse2/muse/widgets/doublelabel.cpp
new file mode 100644
index 00000000..c20de1e2
--- /dev/null
+++ b/muse2/muse/widgets/doublelabel.cpp
@@ -0,0 +1,189 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: doublelabel.cpp,v 1.1.1.1.2.2 2008/08/18 00:15:26 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+
+#include "doublelabel.h"
+#include <qvalidator.h>
+#include <qpalette.h>
+#include <stdio.h>
+#include <values.h>
+
+#include "utils.h"
+
+//---------------------------------------------------------
+// DoubleLabel
+//---------------------------------------------------------
+
+DoubleLabel::DoubleLabel(QWidget* parent, const char* name)
+ : Dentry(parent, name), _specialText("---")
+ {
+ min = 0.0;
+ max = 1.0;
+ _off = -1.0;
+ _precision = 3;
+ setValue(0.0);
+ }
+
+DoubleLabel::DoubleLabel(double _val, double m, double mx, QWidget* parent)
+ : Dentry(parent), _specialText("---")
+ {
+ min = m;
+ max = mx;
+ _off = m - 1.0;
+ _precision = 3;
+ setValue(_val);
+ }
+
+//---------------------------------------------------------
+// setOff
+//---------------------------------------------------------
+
+void DoubleLabel::setOff(double v)
+{
+ _off = v;
+ setString(val);
+}
+
+//---------------------------------------------------------
+// calcIncrement()
+//---------------------------------------------------------
+
+double DoubleLabel::calcIncrement() const
+{
+ double dif;
+ if(max - min > 0)
+ dif = max - min;
+ else
+ dif = min - max;
+
+ if(dif <= 10.0)
+ return 0.1;
+ else
+ if(dif <= 100.0)
+ return 1.0;
+ else
+ return 10.0;
+}
+
+//---------------------------------------------------------
+// setString
+//---------------------------------------------------------
+
+bool DoubleLabel::setString(double v)
+ {
+ if(v <= _off || v > max)
+ {
+ setText(_specialText);
+ return true;
+ }
+ else
+ if(v < min)
+ {
+ setText(QString("---"));
+ return true;
+ }
+ else
+ {
+ QString s;
+ s.setNum(v, 'f', _precision);
+ if (!_suffix.isEmpty()) {
+ s += " ";
+ s += _suffix;
+ }
+
+ setText(s);
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// setSValue
+//---------------------------------------------------------
+
+bool DoubleLabel::setSValue(const QString& s)
+ {
+ bool ok;
+ double v = s.toDouble(&ok);
+ if (ok && (v != val)) {
+ if (v < min)
+ v = min;
+ if (v > max)
+ v = max;
+ setValue(v);
+ emit valueChanged(val, _id);
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// incValue
+//---------------------------------------------------------
+
+void DoubleLabel::incValue(double)
+ {
+ if(val >= max)
+ return;
+ double inc = calcIncrement();
+ if(val + inc >= max)
+ setValue(max);
+ else
+ setValue(val + inc);
+ emit valueChanged(val, _id);
+ }
+
+//---------------------------------------------------------
+// decValue
+//---------------------------------------------------------
+
+void DoubleLabel::decValue(double)
+ {
+ if(val <= min)
+ return;
+ double inc = calcIncrement();
+ if(val - inc <= min)
+ setValue(min);
+ else
+ setValue(val - inc);
+ emit valueChanged(val, _id);
+ }
+
+//---------------------------------------------------------
+// setPrecision
+//---------------------------------------------------------
+
+void DoubleLabel::setPrecision(int v)
+ {
+ _precision = v;
+ setString(val);
+ }
+
+//---------------------------------------------------------
+// sizeHint
+//---------------------------------------------------------
+
+QSize DoubleLabel::sizeHint() const
+ {
+ QFontMetrics fm = fontMetrics();
+ int h = fm.height() + 4;
+ int n = _precision + 6;
+#if 0
+ double aval = fabs(val);
+ if (aval >= 10.0)
+ ++n;
+ if (aval >= 100.0)
+ ++n;
+ if (aval >= 1000.0)
+ ++n;
+ if (aval >= 10000.0)
+ ++n;
+ if (aval >= 100000.0)
+ ++n;
+#endif
+ int w = fm.width(QString("-0.")) + fm.width('0') * n + 6;
+ return QSize(w, h);
+ }
diff --git a/muse2/muse/widgets/doublelabel.h b/muse2/muse/widgets/doublelabel.h
new file mode 100644
index 00000000..6698ec57
--- /dev/null
+++ b/muse2/muse/widgets/doublelabel.h
@@ -0,0 +1,60 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: doublelabel.h,v 1.2.2.3 2008/08/18 00:15:26 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __DOUBLELABEL_H__
+#define __DOUBLELABEL_H__
+
+#include "dentry.h"
+
+//---------------------------------------------------------
+// DoubleLabel
+//---------------------------------------------------------
+
+class DoubleLabel : public Dentry {
+ Q_OBJECT
+
+ Q_PROPERTY( double minValue READ minValue WRITE setMinValue )
+ Q_PROPERTY( double maxValue READ maxValue WRITE setMaxValue )
+ Q_PROPERTY( QString specialText READ specialText WRITE setSpecialText )
+ Q_PROPERTY( QString suffix READ suffix WRITE setSuffix )
+ Q_PROPERTY( int precision READ precision WRITE setPrecision )
+
+ double min, max, _off;
+ QString _specialText; // text to show if value outside min,max
+ QString _suffix;
+ int _precision;
+
+ double calcIncrement() const;
+
+ virtual bool setSValue(const QString&);
+ virtual bool setString(double val);
+ virtual void incValue(double);
+ virtual void decValue(double);
+
+ public:
+ DoubleLabel(QWidget*, const char* name = 0);
+ DoubleLabel(double val, double min, double max, QWidget*);
+ virtual QSize sizeHint() const;
+ double minValue() const { return min; }
+ double maxValue() const { return max; }
+ double off() const { return _off; }
+ void setMinValue(double v) { min = v; }
+ void setMaxValue(double v) { max = v; }
+ void setRange(double a, double b) { _off = a - (min - _off); min = a; max = b; }
+ void setOff(double v);
+ int precision() const { return _precision; }
+ void setPrecision(int val);
+ QString specialText() const { return _specialText; }
+ void setSpecialText(const QString& s) {
+ _specialText = s;
+ update();
+ }
+ QString suffix() const { return _suffix; }
+ void setSuffix(const QString& s) { _suffix = s; }
+ };
+
+#endif
diff --git a/muse2/muse/widgets/drange.cpp b/muse2/muse/widgets/drange.cpp
new file mode 100644
index 00000000..5c986403
--- /dev/null
+++ b/muse2/muse/widgets/drange.cpp
@@ -0,0 +1,262 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: drange.cpp,v 1.2.2.1 2009/03/09 02:05:18 terminator356 Exp $
+//
+// Copyright (C) 1997 Josef Wilgen
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2,
+// as published by the Free Software Foundation.
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <cmath>
+#include "mmath.h"
+#include "drange.h"
+
+const double DoubleRange::MinRelStep = 1.0e-10;
+const double DoubleRange::DefaultRelStep = 1.0e-2;
+const double DoubleRange::MinEps = 1.0e-10;
+
+//-----------------------------------------------------------
+// This class is useful as a base class or a member for sliders.
+// It represents an interval of type double within which a value can
+// be moved. The value can be either an arbitrary point inside
+// the interval (see @DoubleRange::setValue@), or it can be fitted
+// into a step raster (see @DoubleRange::fitValue@ and
+// @DoubleRange::incValue@).
+//
+// As a special case, a DoubleRange can be periodic, which means that
+// a value outside the interval will be mapped to a value inside the
+// interval when @DoubleRange::setValue@, @DoubleRange::fitValue@,
+// @DoubleRange::incValue@ or @DoubleRange::incPages@ are called.
+//------------------------------------------------------------
+
+//---------------------------------------------------------
+// doubleRange
+//---------------------------------------------------------
+
+DoubleRange::DoubleRange()
+ {
+ d_minValue = 0;
+ d_maxValue = 100.0;
+ d_prevValue = 0.0;
+ d_exactPrevValue = 0.0;
+ d_exactValue = 0.0;
+ d_value = 0.0;
+ d_step = 0.1;
+ d_periodic = FALSE;
+ }
+
+//---------------------------------------------------------
+// setNewValue
+//---------------------------------------------------------
+
+void DoubleRange::setNewValue(double x, bool align)
+ {
+ d_prevValue = d_value;
+
+ double vmin = qwtMin(d_minValue, d_maxValue);
+ double vmax = qwtMax(d_minValue, d_maxValue);
+
+ // Range check
+
+ if (x < vmin) {
+ if ((d_periodic) && (vmin != vmax))
+ d_value = x + ceil((vmin - x) / (vmax - vmin))
+ * (vmax - vmin);
+ else
+ d_value = vmin;
+ }
+ else if (x > vmax) {
+ if ((d_periodic) && (vmin != vmax))
+ d_value = x - ceil( ( x - vmax) / (vmax - vmin ))
+ * (vmax - vmin);
+ else
+ d_value = vmax;
+ }
+ else
+ d_value = x;
+
+ d_exactPrevValue = d_exactValue;
+ d_exactValue = d_value;
+
+ // align to grid
+ if (align) {
+ if (d_step != 0.0)
+ d_value = d_minValue + rint((d_value - d_minValue) / d_step ) * d_step;
+ else
+ d_value = d_minValue;
+
+ // correct rounding error at the border
+ if (fabs(d_value - d_maxValue) < MinEps * qwtAbs(d_step))
+ d_value = d_maxValue;
+
+ // correct rounding error if value = 0
+ if (fabs(d_value) < MinEps * qwtAbs(d_step))
+ d_value = 0.0;
+ }
+ if (d_prevValue != d_value)
+ valueChange();
+ }
+
+//---------------------------------------------------------
+// fitValue
+// Adjust the value to the closest point in the step
+// raster.
+// The value is clipped when it lies outside the range.
+// When the range is @DoubleRange::periodic@, it will
+// be mapped to a point in the interval such that
+//---------------------------------------------------------
+
+void DoubleRange::fitValue(double x)
+ {
+ setNewValue(x, true);
+ }
+
+//---------------------------------------------------------
+// setValue
+// Set a new value without adjusting to the step raster
+// The value is clipped when it lies outside the range.
+// When the range is @DoubleRange::periodic@, it will
+// be mapped to a point in the interval such that
+//
+// new value := x + n * (max. value - min. value)
+//
+// with an integer number n.
+//---------------------------------------------------------
+
+void DoubleRange::setValue(double x)
+ {
+ setNewValue(x, false);
+ }
+
+//---------------------------------------------------------
+// setRange
+// Specify range and step size
+// - A change of the range changes the value if it lies outside the
+// new range. The current value
+// will *not* be adjusted to the new step raster.
+// - vmax < vmin is allowed.
+// - If the step size is left out or set to zero, it will be
+// set to 1/100 of the interval length.
+// - If the step size has an absurd value, it will be corrected
+// to a better one.
+//---------------------------------------------------------
+
+void DoubleRange::setRange(double vmin, double vmax, double vstep, int pageSize)
+ {
+ bool rchg = ((d_maxValue != vmax) || (d_minValue != vmin));
+
+ if (rchg) {
+ d_minValue = vmin;
+ d_maxValue = vmax;
+ }
+
+ //
+ // look if the step width has an acceptable
+ // value or otherwise change it.
+ //
+ setStep(vstep);
+
+ //
+ // limit page size
+ //
+ d_pageSize = qwtLim(pageSize,0, int(qwtAbs((d_maxValue - d_minValue) / d_step)));
+
+ //
+ // If the value lies out of the range, it
+ // will be changed. Note that it will not be adjusted to
+ // the new step width.
+ setNewValue(d_value, false);
+
+ // call notifier after the step width has been
+ // adjusted.
+ if (rchg)
+ rangeChange();
+ }
+
+//---------------------------------------------------------
+// setStep
+// Change the step raster
+//
+// The value will *not* be adjusted to the new step raster.
+//---------------------------------------------------------
+
+void DoubleRange::setStep(double vstep)
+ {
+ double newStep,intv;
+
+ intv = d_maxValue - d_minValue;
+
+ if (vstep == 0.0)
+ newStep = intv * DefaultRelStep;
+ else {
+ if (((intv > 0) && (vstep < 0)) || ((intv < 0) && (vstep > 0)))
+ newStep = -vstep;
+ else
+ newStep = vstep;
+
+ if ( fabs(newStep) < fabs(MinRelStep * intv) )
+ newStep = MinRelStep * intv;
+ }
+
+ if (newStep != d_step) {
+ d_step = newStep;
+ stepChange();
+ }
+ }
+
+//---------------------------------------------------------
+// setPeriodic
+// Make the range periodic
+//
+// When the range is periodic, the value will be set to a point
+// inside the interval such that
+//
+// point = value + n * width
+//
+// if the user tries to set a new value which is outside the range.
+// If the range is nonperiodic (the default), values outside the
+// range will be clipped.
+//---------------------------------------------------------
+
+void DoubleRange::setPeriodic(bool tf)
+ {
+ d_periodic = tf;
+ }
+
+//------------------------------------------------------------
+// incValue
+// Increment the value by a specified number of steps
+//
+// As a result of this operation, the new value will always be
+// adjusted to the step raster.
+//------------------------------------------------------------
+
+void DoubleRange::incValue(int nSteps)
+ {
+ setNewValue(d_value + double(nSteps) * d_step, true);
+ }
+
+//---------------------------------------------------------
+// incPages
+// Increment the value by a specified number of pages
+//---------------------------------------------------------
+
+void DoubleRange::incPages(int nPages)
+ {
+ setNewValue(d_value + double(nPages) * double(d_pageSize)
+ * d_step, true);
+ }
+
+//---------------------------------------------------------
+// step
+//---------------------------------------------------------
+
+double DoubleRange::step() const
+ {
+ return qwtAbs(d_step);
+ }
+
diff --git a/muse2/muse/widgets/drange.h b/muse2/muse/widgets/drange.h
new file mode 100644
index 00000000..1ee3dd21
--- /dev/null
+++ b/muse2/muse/widgets/drange.h
@@ -0,0 +1,71 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: drange.h,v 1.1.1.1.2.1 2007/01/27 14:52:43 spamatica Exp $
+//
+// Copyright (C) 1997 Josef Wilgen
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2,
+// as published by the Free Software Foundation.
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __DOUBLE_RANGE_H__
+#define __DOUBLE_RANGE_H__
+
+#include <qglobal.h>
+
+//---------------------------------------------------------
+// DoubleRange
+//---------------------------------------------------------
+
+class DoubleRange
+ {
+ static const double MinRelStep;
+ static const double DefaultRelStep;
+ static const double MinEps;
+
+ double d_minValue;
+ double d_maxValue;
+ double d_step;
+ int d_pageSize;
+ double d_value;
+ double d_exactValue;
+ double d_exactPrevValue;
+ double d_prevValue;
+ bool d_periodic;
+
+ void setNewValue(double x, bool align = false);
+
+ protected:
+ double exactValue() const { return d_exactValue; }
+ double exactPrevValue() const { return d_exactPrevValue; }
+ double prevValue() const { return d_prevValue; }
+ virtual void valueChange() {}
+ virtual void stepChange() {}
+ virtual void rangeChange() {}
+
+ public:
+ DoubleRange();
+ virtual ~DoubleRange(){};
+
+ double value() const { return d_value; }
+ virtual void setValue(double);
+
+ virtual void fitValue(double);
+ virtual void incValue(int);
+ virtual void incPages(int);
+ void setPeriodic(bool tf);
+ void setRange(double vmin, double vmax, double vstep = 0.0,
+ int pagesize = 1);
+ void setStep(double);
+
+ double maxValue() const { return d_maxValue; }
+ double minValue() const { return d_minValue; }
+ bool periodic() const { return d_periodic; }
+ int pageSize() const { return d_pageSize; }
+ double step() const;
+ };
+
+#endif
diff --git a/muse2/muse/widgets/editctrl7dialogbase.ui b/muse2/muse/widgets/editctrl7dialogbase.ui
new file mode 100644
index 00000000..6d649555
--- /dev/null
+++ b/muse2/muse/widgets/editctrl7dialogbase.ui
@@ -0,0 +1,214 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>EditCtrl7DialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>EditCtrl7DialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>331</width>
+ <height>160</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Enter Controller</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout12</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout11</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Controller:</string>
+ </property>
+ </widget>
+ <widget class="PosEdit" row="0" column="1">
+ <property name="name">
+ <cstring>PosEdit3</cstring>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="1">
+ <property name="name">
+ <cstring>SpinBox2</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Time Position:</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="1">
+ <property name="name">
+ <cstring>SpinBox3</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Value:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QSlider">
+ <property name="name">
+ <cstring>Slider1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>controller value</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="accel">
+ <number>0</number>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="accel">
+ <number>0</number>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>EditCtrl7DialogBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>EditCtrl7DialogBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in declaration">posedit.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/editmetadialogbase.ui b/muse2/muse/widgets/editmetadialogbase.ui
new file mode 100644
index 00000000..573930b9
--- /dev/null
+++ b/muse2/muse/widgets/editmetadialogbase.ui
@@ -0,0 +1,254 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>EditMetaDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>EditMetaDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>475</width>
+ <height>285</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Enter Meta Event</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QTextEdit" row="2" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>TextEdit1</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="accel">
+ <number>0</number>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="accel">
+ <number>0</number>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="1" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>TextLabel1</string>
+ </property>
+ </widget>
+ <spacer row="0" column="1">
+ <property name="name" stdset="0">
+ <cstring>Spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QToolButton" row="0" column="2">
+ <property name="name">
+ <cstring>saveButton</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="pixmap">
+ <pixmap>image0</pixmap>
+ </property>
+ </widget>
+ <widget class="QToolButton" row="0" column="3">
+ <property name="name">
+ <cstring>loadButton</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="pixmap">
+ <pixmap>image1</pixmap>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>Layout8</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Time Position:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Meta Type:</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>CheckBox1</cstring>
+ </property>
+ <property name="text">
+ <string>Enter Hex</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="1">
+ <property name="name">
+ <cstring>SpinBox1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="2">
+ <property name="name">
+ <cstring>metaTypeLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="PosEdit" row="0" column="1">
+ <property name="name">
+ <cstring>PosEdit1</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="2285">789c8dd35d6fda301406e07b7e05aaefaae934719c9068dac5cabebab60c3668d34dbb308e03edfab11518eda6fdf71d9f7382a02dd3fa16a407bf716c07f676db65ffb8bdbbd79acdedfcdcb5ddd4deb677abc5d5d5fd97af2f7eb776b46ee37fc7b4f5ceb3d6ce60de76eddecdb50f80254245f447ae1b2731d9af5c909dd888abc686fb11398f5c9493278d63f634388e42c89fc9790879dc58f3f8a1b8b9de06eb2884fc536cc431b9d04ef3face82933869f6d3131bf18c5c24b9eca72b76e232d8c42692fd9d8a9bfd9e90adc98d258fc44e7c1b9cea281a1bf2909d46293d0cf8244ec53fc876d5df5fb9227f171bf147765aa47cbf0fe24a7c139ce955ffa2b14bc9d7e25c7cc4cee28cd77345b691737cfd65e38afb07ecacc8f87edf823b491cc9f839bb137712b212a7e277c179a28de7efe3abe0c225a6ae83d5845d1485235b71c586b7c1d6989cfb50909db596fb53b167c3cbe0b1e9c4327fcd1e6b39ef813813bf2657abbe628fad9c675fecc56f825d9a17b29e3b7125d77bb6d37cdeaa126772fef7e4aa903efc62dbe6fec076969f8772622fcf270faed24acbf977c49958937d652b3eef4cecd98a7e7f3ef3da67349e8a337142f6decaf332622f3e0eaeb35ad7dc7f2fcec40b725d5bd9df5c5cb307f3ff0ff74181853138a8f015e257a9251398825af52d9c632ee01b5cc215e61a730137f01d7e606e3133cc74adaf30f3ad593ce8ffc4f6f29ffde593f3dfc13dfcc2f797b0bf91307f77a31fd6bf6deec5a3f534fd57f01adee0eb2dbcc35d6fcebfd93fc06c9bfbfdd6fefe963cec1fc211e6f1bc9c63eaf736fa1f30fd8df67a7ff0a8ff71954f9421660427708a29f12c6770b6d6ff8c8d7fb77bd88fd6fa43e985d12e354227b4ce2096f7f5fe88528286040cbe52c8a00339147887117e5fe28dfe12ef1d52622f8c0f2157007da594ddd23fa574d518df8f7065ebfd9327fa25a58bab2871d743e554a5140cb05f3ed1b7f4fd0bbbd4388e67826d8fed5a4df0d312c737fa74871e9d88c6a746c1b5d46a8afd1e5e71f8b04f6734c5abb627a2dfef9fe7adbfc6a22669</data>
+ </image>
+ <image name="image1">
+ <data format="XPM.GZ" length="2589">789c8dd64b53db481000e03bbfc2c5dca8ad8e3492c652a5727008ef77121c87ad3d8c4663e327066cc0a4f6bf6f4f774b3c422da139f0797aba5b23c9c5878d56eff4a8b5f161ed76611743d77297f6a6b5512da7d3d5dfff7cfab5b6ae750b7f8ba4a5d7ff5a5b3f5bb45cebf86ae603402154443fc1ea869c47291b66c17114b928a7f5153b04792c4ed99091f310e4c7608debbc1fac3817976227f53a6c9d6aae47fd74d1e43f88eb79066c9deb827c2f766c2027b1aee77d64275112d3faa938153b72a1e57ad48c9de4b27e179cc63a97eb5d8aebf9af1af3bc0bb24d22f16670a6b328b5944fd793d9acc8c8908a2bb6ba0e36da64866e9eba255b53889db832bcbf086e97eda25dd2fa9db86203edcf932c92f349d878bb12b226977991737e2eaed86a145ca47843d8cbda454af9b13813b7c9ae280a478ec4155b55c1363555c2f76fc8b6b1ac4f6b5bae7721cec49fc9aed9bf605bcbebeab231f73f117bb69a0497693b4bf9fefe64975ad6cbda25f73b161b718f5c95567cd4b8a2fd73b167c38f6097392d3eaced3272576cc407e4ca59b169ccf5add8b3613fb8ca2a2d3eaf5df1fe3db161ab3ed95756d6bf37e6ef875db117d3797a63ebe7d1b3bd96f59ddade90bf890d5bd1f78df7853cdf70c3b6b1789bedade77a5f83fbd84fd62bb197e77dca2e4d9b9fdf2d765ff7b9ff17b111d3fbd4efe37e9a1fe6ec524bbd8ed88807b5b9be02b1957e7db6d3f27ef9daf23e9d898d7822b6f27e0d6bcbfb32167bf1885d69797faec4867db6f8f3783b1f541defe73fe53eed79daf73aff75cdd77d5ee6ffdebfdef1fff3bf5f1f2c9418f6cfce071c54e0a10f0370efe763f6250c61046398c014357b196fe47bb8c26c0f73b87e23dc6ff913aceee1066e6121b1843bfcfc1ee30156f0585f77933f810e7c864df842b105dbb003bbb007fb7000877004c77082712af96758fd2b563d806f183bf01dcea10b3fa0073fe10222884143022964cdfc73aabe85b9db52fb1c0c56ee61d50b68430e059cd6f3e3600a16ca62ff901f7ae02ce82e1ca9923ae4ca85bb26f53baac2ea21c7d33cbbaa8fd90738d131d58f21518367e713663fc1fe7bb86717a70fd719a6c1eaea520dd50852357eca5713d80cdd69a273d8a7da940d276a8ad3276af6fcfcd5157e5eaa39e67431b30b87f8772f64cbecd7f513c7ff3fa95bccc21d386d0fcf1a4f9b2a2fb076a496ea4edd3fbfbf6aac96d8b38d95ea68438c79233c758dd90f3c7b93bf528f6aa0ee5fc480a243b17af6fcfcfb71ed3f846c790e</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>EditMetaDialogBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>EditMetaDialogBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in declaration">posedit.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/editnotedialogbase.ui b/muse2/muse/widgets/editnotedialogbase.ui
new file mode 100644
index 00000000..e6e01441
--- /dev/null
+++ b/muse2/muse/widgets/editnotedialogbase.ui
@@ -0,0 +1,202 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>EditNoteDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>EditNoteDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>231</width>
+ <height>182</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Enter Note</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="5" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="accel">
+ <number>0</number>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="accel">
+ <number>0</number>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Length:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Time Position:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Pitch:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Velocity On:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Velocity Off:</string>
+ </property>
+ </widget>
+ <widget class="PosEdit" row="0" column="1">
+ <property name="name">
+ <cstring>epos</cstring>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="1">
+ <property name="name">
+ <cstring>il1</cstring>
+ </property>
+ <property name="maxValue">
+ <number>1000000</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="1">
+ <property name="name">
+ <cstring>il2</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="4" column="1">
+ <property name="name">
+ <cstring>il3</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="PitchEdit" row="2" column="1">
+ <property name="name">
+ <cstring>pl</cstring>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>EditNoteDialogBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>EditNoteDialogBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>pos</tabstop>
+ <tabstop>il1</tabstop>
+ <tabstop>pl</tabstop>
+ <tabstop>il2</tabstop>
+ <tabstop>il3</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+<includes>
+ <include location="local" impldecl="in declaration">posedit.h</include>
+ <include location="local" impldecl="in declaration">pitchedit.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/editsysexdialogbase.ui b/muse2/muse/widgets/editsysexdialogbase.ui
new file mode 100644
index 00000000..cfd91cdb
--- /dev/null
+++ b/muse2/muse/widgets/editsysexdialogbase.ui
@@ -0,0 +1,209 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>EditSysexDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>EditSysexDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>433</width>
+ <height>330</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Enter SysEx</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>TimePosition:</string>
+ </property>
+ </widget>
+ <widget class="PosEdit">
+ <property name="name">
+ <cstring>epos</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>saveButton</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="pixmap">
+ <pixmap>image0</pixmap>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>loadButton</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="pixmap">
+ <pixmap>image1</pixmap>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QTextEdit">
+ <property name="name">
+ <cstring>edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Comment:</string>
+ </property>
+ </widget>
+ <widget class="QTextEdit">
+ <property name="name">
+ <cstring>comment</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="accel">
+ <number>0</number>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="accel">
+ <number>0</number>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="2285">789c8dd35d6fda301406e07b7e05aaefaae934719c9068dac5cabebab60c3668d34dbb308e03edfab11518eda6fdf71d9f7382a02dd3fa16a407bf716c07f676db65ffb8bdbbd79acdedfcdcb5ddd4deb677abc5d5d5fd97af2f7eb776b46ee37fc7b4f5ceb3d6ce60de76eddecdb50f80254245f447ae1b2731d9af5c909dd888abc686fb11398f5c9493278d63f634388e42c89fc9790879dc58f3f8a1b8b9de06eb2884fc536cc431b9d04ef3face82933869f6d3131bf18c5c24b9eca72b76e232d8c42692fd9d8a9bfd9e90adc98d258fc44e7c1b9cea281a1bf2909d46293d0cf8244ec53fc876d5df5fb9227f171bf147765aa47cbf0fe24a7c139ce955ffa2b14bc9d7e25c7cc4cee28cd77345b691737cfd65e38afb07ecacc8f87edf823b491cc9f839bb137712b212a7e277c179a28de7efe3abe0c225a6ae83d5845d1485235b71c586b7c1d6989cfb50909db596fb53b167c3cbe0b1e9c4327fcd1e6b39ef813813bf2657abbe628fad9c675fecc56f825d9a17b29e3b7125d77bb6d37cdeaa126772fef7e4aa903efc62dbe6fec076969f8772622fcf270faed24acbf977c49958937d652b3eef4cecd98a7e7f3ef3da67349e8a337142f6decaf332622f3e0eaeb35ad7dc7f2fcec40b725d5bd9df5c5cb307f3ff0ff74181853138a8f015e257a9251398825af52d9c632ee01b5cc215e61a730137f01d7e606e3133cc74adaf30f3ad593ce8ffc4f6f29ffde593f3dfc13dfcc2f797b0bf91307f77a31fd6bf6deec5a3f534fd57f01adee0eb2dbcc35d6fcebfd93fc06c9bfbfdd6fefe963cec1fc211e6f1bc9c63eaf736fa1f30fd8df67a7ff0a8ff71954f9421660427708a29f12c6770b6d6ff8c8d7fb77bd88fd6fa43e985d12e354227b4ce2096f7f5fe88528286040cbe52c8a00339147887117e5fe28dfe12ef1d52622f8c0f2157007da594ddd23fa574d518df8f7065ebfd9327fa25a58bab2871d743e554a5140cb05f3ed1b7f4fd0bbbd4388e67826d8fed5a4df0d312c737fa74871e9d88c6a746c1b5d46a8afd1e5e71f8b04f6734c5abb627a2dfef9fe7adbfc6a22669</data>
+ </image>
+ <image name="image1">
+ <data format="XPM.GZ" length="2589">789c8dd64b53db481000e03bbfc2c5dca8ad8e3492c652a5727008ef77121c87ad3d8c4663e327066cc0a4f6bf6f4f774b3c422da139f0797aba5b23c9c5878d56eff4a8b5f161ed76611743d77297f6a6b5512da7d3d5dfff7cfab5b6ae750b7f8ba4a5d7ff5a5b3f5bb45cebf86ae603402154443fc1ea869c47291b66c17114b928a7f5153b04792c4ed99091f310e4c7608debbc1fac3817976227f53a6c9d6aae47fd74d1e43f88eb79066c9deb827c2f766c2027b1aee77d64275112d3faa938153b72a1e57ad48c9de4b27e179cc63a97eb5d8aebf9af1af3bc0bb24d22f16670a6b328b5944fd793d9acc8c8908a2bb6ba0e36da64866e9eba255b53889db832bcbf086e97eda25dd2fa9db86203edcf932c92f349d878bb12b226977991737e2eaed86a145ca47843d8cbda454af9b13813b7c9ae280a478ec4155b55c1363555c2f76fc8b6b1ac4f6b5bae7721cec49fc9aed9bf605bcbebeab231f73f117bb69a0497693b4bf9fefe64975ad6cbda25f73b161b718f5c95567cd4b8a2fd73b167c38f6097392d3eaced3272576cc407e4ca59b169ccf5add8b3613fb8ca2a2d3eaf5df1fe3db161ab3ed95756d6bf37e6ef875db117d3797a63ebe7d1b3bd96f59ddade90bf890d5bd1f78df7853cdf70c3b6b1789bedade77a5f83fbd84fd62bb197e77dca2e4d9b9fdf2d765ff7b9ff17b111d3fbd4efe37e9a1fe6ec524bbd8ed88807b5b9be02b1957e7db6d3f27ef9daf23e9d898d7822b6f27e0d6bcbfb32167bf1885d69797faec4867db6f8f3783b1f541defe73fe53eed79daf73aff75cdd77d5ee6ffdebfdef1fff3bf5f1f2c9418f6cfce071c54e0a10f0370efe763f6250c61046398c014357b196fe47bb8c26c0f73b87e23dc6ff913aceee1066e6121b1843bfcfc1ee30156f0585f77933f810e7c864df842b105dbb003bbb007fb7000877004c77082712af96758fd2b563d806f183bf01dcea10b3fa0073fe10222884143022964cdfc73aabe85b9db52fb1c0c56ee61d50b68430e059cd6f3e3600a16ca62ff901f7ae02ce82e1ca9923ae4ca85bb26f53baac2ea21c7d33cbbaa8fd90738d131d58f21518367e713663fc1fe7bb86717a70fd719a6c1eaea520dd50852357eca5713d80cdd69a273d8a7da940d276a8ad3276af6fcfcd5157e5eaa39e67431b30b87f8772f64cbecd7f513c7ff3fa95bccc21d386d0fcf1a4f9b2a2fb076a496ea4edd3fbfbf6aac96d8b38d95ea68438c79233c758dd90f3c7b93bf528f6aa0ee5fc480a243b17af6fcfcfb71ed3f846c790e</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>EditSysexDialogBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>EditSysexDialogBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in declaration">posedit.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/fdialogbuttons.ui b/muse2/muse/widgets/fdialogbuttons.ui
new file mode 100644
index 00000000..33c79814
--- /dev/null
+++ b/muse2/muse/widgets/fdialogbuttons.ui
@@ -0,0 +1,204 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>FileDialogButtons</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>FileDialogButtons</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>175</width>
+ <height>438</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>pathGroup</cstring>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>globalButton</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="iconSet">
+ <iconset>image0</iconset>
+ </property>
+ <property name="usesBigPixmap">
+ <bool>true</bool>
+ </property>
+ <property name="usesTextLabel">
+ <bool>true</bool>
+ </property>
+ <property name="textLabel">
+ <string>Global</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>userButton</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="iconSet">
+ <iconset>image1</iconset>
+ </property>
+ <property name="usesBigPixmap">
+ <bool>true</bool>
+ </property>
+ <property name="usesTextLabel">
+ <bool>true</bool>
+ </property>
+ <property name="textLabel">
+ <string>User</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>projectButton</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="iconSet">
+ <iconset>image2</iconset>
+ </property>
+ <property name="usesBigPixmap">
+ <bool>true</bool>
+ </property>
+ <property name="usesTextLabel">
+ <bool>true</bool>
+ </property>
+ <property name="textLabel">
+ <string>Project</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>60</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>loadAllGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Load:</string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>loadAllButton</cstring>
+ </property>
+ <property name="text">
+ <string>Songdata +
+Cofiguration</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>loadSongButton</cstring>
+ </property>
+ <property name="text">
+ <string>only
+Songdata</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>0</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+</widget>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="5310">789cad965b73e2481285dffb57383adf3a3672102021c5c63ed86e5ff10ddfdaee89794824617cc137c0b789fdef9bca3ca5a66dd8d999d9aec6e673294f9dcaca4af8e5cbd2d9c1eed2975f3e8d2732b9cc97f2a13c2e7d29a6a3d1ebafbffdebf74f9f5bed25fd1f7592a5e6e77f7cfadc9b2ce54b7b77b765054c0ad4b07fc603e77623918ae919dceeb48c6f9ce322ed572c6bc669236fa4363f74aee34fc039e213e7b8d1f1f86770ec4ca7ce699cc7c6b715478d6a98bf6fceaae7f1afceaae7fa54b3eb75c0716af3528033677e724e63c98d6f03f7db16ff669c467964fbe307e7a0cfd760e8f30518faf252b3fb49c1c81fad3bd7eb413fcdc0bbce595c783eba15371bd530fd3be7b8403e2681b17e59b3af97392711ce6f1038f3f5cec0b1b3907327ca2c3ff4cd390d7e1ec1c1ef8e731615565fc2c6599279bcdc80839ff3c0d0ffee1cd6e3041c637e2fb0f87ad760e8d37e60ccaf3987f3a51c5cf40be3c2398be07f195cc0ff65c5ad28f895dcb913f2d500073f17e0e0e725b0cfcb2db8c0f30735fbf3abce6904ee83437e2370f0df7456ffc6fc1d1c637ec559e23231be0397d8df57e32abfae0faed72b9db3701fef9d453c9e5a15b7a376a31d99de15b80dbe700ee72702ceb05ecf39cbe0bf012e7c3d3e77ee377d3d3e0becfb61d7135dcffa8d74c1a9331d3a4b04ff78be8eb7f38f9b7123b6e648c7ce69a8f7d839f823ab87583a05fc6f39a7387f8e9c25cefdf901589cc5f493661225b61eef394be9f3bce3dc4ffc7eb1f5af44d250cfd6af3a2d41bd72d3393c2f47c6fd4e86fe543aa791f7031a3bd7fafb6001ef82437d98bfb4d509fde4c039e8c92e38f43fcc6bbcfbb1fca77d9d773f4330fa21df81433fb0fac9da29f22b1bce59b86fe03cd443e004bc06467d8aed2fcbb3507f3be0d08f9e9cfb09ea6dd339c4f33a18f9a0ed8aa52d11cee3158cf397a1731fe74947ce7989fb3732ce05fd487a60c1e74f0a2e31df770e7a72edacfb77bf5bce45e2fa62fefb6d29bd3e64dbb9df44bd5c8213f0917311ee430f9c94beff17b060be6d5c68bcd76b0e1667590797b82f783e477dc92a18f9e43767d5777e059703df8fed2f8f75ff1ebfe29c37715e31389c5fcbb928a187e7cba6b3587fcf0b7ddefd4ec1b89fbc0d0ef771e21ce27939b0fbe33138815fdb4f11e7a87fce9c0b9c978cc1b87f34710ef1fc0816e8399745a8ef6370a8cf1370a8cfa97389f313fb3e512605ea4f46ce25ce5beec1a81fb6ef5f651d4f0c0ee773050ef93d0c0cff53e741c8cf6acd03d3db0427ce6ceb0f923abeeb5cc73f83437e6ec08278fbbc1a0c6abd1138ccf7c103e7dee4ef8f1f3a4c61fc1d1d16eeebc8b9f86b6adee779c0173ce44bbe32b5cb3faf663ad77cc323be35b53b55b9ffe8ed8f766d3a0ffcc8639ef054a39fde790b6ab9be7f5eec137e5ef895df789957f4b5aa11b3de46a6f0555f237bdf5fa8f3c06bbcce1bbcc95baa3851b59fbd6d43ed4ab52ac5aeef748ece0eeff21eeff381aaad73cfbc4dd4d9211fa952ae4ac77cc2a7aa52a9dd7f74643adff88ccff93b373852b5a6a9b9b796aa0dd4519b63554ab8c329677c42fcde91dd27e27312ea534e0595dca0c18cb7095dd0902ee94ab50674adaf1b1af131ddcef34377744f0f9a8f5b7aacd482371af3064d684a4ff44c2fea6cd9f296d02bbdcdcb332dd30aadd2575aa3075ad7517b536707b4c12fb4a9ce5e788526fa7b8bb6a93bd7cf0eedd21eedd381aaf52b35f3e66a3d3ab47d6ed291664df346c7f3fdd0099dd2373aa373fa4e0d555b7de72da2e66cde5467ae1f6a519b624aa8432965c242ea6def83b728e44d64417efcaeebc7a5e4fab54e3ff664b0c09b9d825c2cf2a32a23ab53ad7e19566a7c31e3ed5ddee472be1fb9b29b53d5bcd6aad65897bb72ed6af3bcc9cd423fa32ad655886524a3aa66f59dedf4a7bcedcbaddc2dcccfacca3d9fca833cf0b13cca587fdebbda0f6f32a9fcfcdc41e0e73eb429f752a9e8c8746ccb54a6d59d9227fda6f5aca7f022af959f1f9dad1a9e9fca039fba8a7b511f631d6f3aa6b22c2b36a6aab62a5f7583337e6674d678a84f3d9a8f937a4795974a656a1aebda3d72ce644336e56abe9ff09eaa3da882bdc6418563f5b3255b9ceb8e87b2ad7fefcef7e3990a7f911d5ddd7dd45e54675db3bfab2ac7b2b7c8cfecf9d56afbbabee7055e2a15cddd81f4febb9fd9fe56eff44a63b7b4db1fcba179a954a61ffdcc7e2e7f1cb5b7a91ca8d6b6eea8a73f8fdefb09f5335fe3839a768b4a855e7ff6f3a30e17f999ebed48f6a52b1bc1cfecbdf8638d0f797ba7f2bffb79ffb9f77efcdfbe47fdfb9f9ffe03facd42d6</data>
+ </image>
+ <image name="image1">
+ <data format="XPM.GZ" length="7224">789ca5975973db3a1285dff32b5ce9b7d414ae2889145953f3e07ddf774fcd433748598be54df2a65bf3dfa7893e60ecd83735531386297f017070d06834e13f7e2c5c1cec2efcf8e3db74c6b3a15ff0037e5cf8513e4d266ffffcd73ffefcf6bdd35dd0bfed225b687fffdbb7ef8e17fcc2dedd6d1580dec1e1ec7d8b28502bfc093c0577c177c6dd56c635cb2eb86b4cfbe0bc27a17d05ec7b9d30fe3a70ae0279cdfe119c1bd3a17196143ef01b3835f66b3527ada49b043ff2649cb6f2a02fabe0143c03174537f08bb1ea07f6d63f57bd30bf9c80bdb17b334ecbdcd6f31cd9c6bb7be32c41fb040cbf720b2ec0af91398ca7ccb848ca34700f9c5659e8dfadb9ddaa9fe0f701dc351636ceb03e4e8c7b0987f9b80d8e7eaac836bfec052eda79bb087c0af660328efeb905c6fae9c0b8d1f791a15f820bf8e9804b31bfd0cf13ebcf070d5bff71645f06ee8253314ec1d0a7f5c8a64f6b0d87fe74078ef31f366ced27c69c58fc79a9e64ed2f69d24ecf7a271a7652c621cd7eb5ec1717faf1b367f5d7089f697862d7e7de33c81ff5570f4eb1b36bf1bc645e243feb80c8cf8d043646b27f8672ec379e7edc0badf9db0dfcef48b0e58968d9bfddc01637dee160cff7461dcf8357f4591c0cf7964f8b907c31f97e002ebb17815d236bfb414d9f6c785fedda4e3bbb63f03e36ecb984fc05d633f6ed8ead79a71939f33e3383f4d8ce37c6ccc3a5f18cf9bc63a9f7106863ebf8273cc370063bcdc18f762fd98825363d7332e4ae4ff9331e33cb8d45818fe825edaeee66928fb7c6a9cb68c69cf38477d953730f68b368d39e6530e8ef9f3d8b0ed27e693ac0afb23478175b8d573ee19777d6af158344e0b63bf0e2ed1fe6cacf919e6f3217fb2763c7f3236ce92ccd6b762dc2b2c5ef46a9c235ff9c1389e079e82511fe4ce38c693198cf5f9703e326ee37be85f8c9bf36ffa9ca5f81eee834bb033cef1bda10138d6d391713c8fae30d67cb7f587fad8eb34f30fc0f81efb393837e6c2382bed7bcb67c6bd042cc605f69f5d64e4ffbe715c3faf822bec37fa4b86fc3b890cffc7e0cafcbba38643bb0ff5a327bdc2ee07de834b63be37ce637d5c312e50efe4da58daa8179163be84f179130f5f1ac7f3e847c6bdd2ee079c1be709ee0bc760dc1f68cbb888f5bcd5b0d5bb3370ac77953123df7c381fb9c4f9ddd0388ff97a6b1cfb1319fb58dfb6c088af84f98b6e9a5afef927e33cc5fde60a1cef3bf7c645ccbf6330faf39db1c6d3e667e3389f3b8d6c7e7cf053784d3fbb2f1d1a473fd233d6f369f7416f9c97a83717c64dfe41af88f7870c1cef4b4bc6cd7e0f8c3dea9d84fb84965bf8f19b60dc0ff9c8b8d9bf148cfc924b63c6fd8366c69adf36dfd0d8237ff931b2d53bb76d5cb68d7d381fecd3785e97c029ee9707c6bd14f928c68cf3271be0143c073378135c21ffccbf6fcedbae7119f367a761f317ce9374a33f498d99510f8760e8cb2832f27b6e2c6d7c2f4a7086f62be3983ff4645ce2fbe043be499916c89fc4b888e7c1e62f55dfcefb2218fa7ed6b0b59f8319f57dddd8235fdca5715c3f6d8319fbb704aefa96dfa19ee87695e6cf5d19c77c702330831fc095b1ac1bc7f9fd3318e3651b1cef5f7de312e78ba660363f6e0f1cf36d3932daa15f617d6e2532d663fdcbb81ed93216d4733933f638ffae0d467df78b60064fc118cf6bc625d6434760f8a51de3c6df5a64f89f8133f80df79132cd0a3bbfbe6f9c27761ff5afc645acdfc7c63ed67f06c7ef551519bf5f8d8c4b7c5f09fa65662c8f91719fba05235fa8308eeba12432d6b30fc67adc6ac3fdc0676036f6a65fe529eea7136361dcaf5bc625eebf6e0c8ef5f9001cf3e90d8c7a45a791cd2f9f1b47ffbc0cc6f9a4e7c8e69f7230f2913a0d07ff14c7c77c7c6a38b44b8857a5bf3eda7d4d72638f7ae31e8d63bcfd101cef439b91713ee6e00afbb3631ce34f6370dcbfddc8d6ce1760ac87f71ab6f5c4fed17f380f55e5e3794f8c9b7cee83113f7e01235ff83232f4afc0d077e7c6fd36da058c7cf1217ffb5919eb59c738fa7773708cffa1713fc6a3ddb0cd77038ef979d1b0b5bf80e1d7857ad6ef37e337c0b1ff041cfb57e0bef1e1ccd1fffb065dd69fdebfa28faffffde5ff7ff37ee1a774953e7dd5b96ed4fe473f6ea023076ee8466eac5a3741edbff2f68b9fdacbc4ddba3b77af6a0fee3170ad366dd44af559feeaf3939f997b72cfee45c7bfaada5be36de2e6aa35d5f171d5e2167ffafce467c92dbb157d56dd5a50fbe96dac4aebaab781b7729b414dbef4b3e5b6f5dd71bbaab7e7f67ff1367607aa76a33a87aa74a33f43e9939f2377ec4ef439d567479fdadb993b7717ee527d5db996ba485c5bffedab5a4763552b7df6d375a9cb5ccfe5ae2047440c6fcf24ee8e3c9554519fae6940431ab93e8d43cce4573f744313baa53bbaa7077a54b5139ad2cc9dd2133dd38b2abd8658ddd571235d296165bffaa1455aa2655aa1555aa375daa04db74a5bea8d699b766897f6689f0ee8908e2c6e74fc177e4ee8c49dd3299da9ca395dd0255d510bde6a5709b5a9435dddcf99c6ada2f42ffc64d4a35c7b17ec98982977e7ac171e5a672dc3dce76b1ef0d02d236ed5577e34cac2231ef38d1bf0846ff94ef7fd9caef85e551ef89184a73ce3277eaee316f6f4fc4b3f9af9fcc2affcc6735ee4255ed678e4aab3c2abbca6bed6798356d5db1d6d604fcfbef2c39a9f7ca33bd0e62d3754a56dde51955d7df7546597f7f9a05ea1c66d950feb3d753b7cf4859f327839e6133ed5f72c783ae70b5ee64b7dafb8a537f9367754ad5bdfe1556df0a51ff392718f737d332e6a4f9ab5b5975dedac011211af37db4afab537b9feeca7f6a22a273290a1ebcb4806faf3b8f614cee48daecebcddca8d4ce4b6f6267772ffd14fed8586c1cb5c4f8e56068db57a9287e069122a47e536e451a63293277996177995b78f7e425cb6a2178c3a94f93b4f37561f65d16dca922ccb8aacaadada7b3f7c23ebb2517b91cde0253e732adf7ba2b90cf958b6f4b4eb79976dd991dd0f7e845f65cf2dca3ed53e267220877264754f8ee544f6e454cf75a56f5f867226e7ee814672219b3ac7e54f3fa6a83a575a552a6949a2bf9974825242a974636ce22b67ae2557eabda53a1ff2193a591d1be9492e85779eea0aafff2788cd24be7adf905a457fd1fde007f9b3e8452b5d15eee17d7fed07b51f5fcfb0d17859f7c3da8beee9d88f64e4c7f2e97c453ffec64ffcadbff3f7d18f7ff08f7e5a7bf13359f74faaa25e54e5f9b77e5efcab7f533ff3c60f1effa8df8bb1ee7cbda2b95ff423d5f9540f1b3f2f7ec92ffb155d578ccf4fa555bfc6a77edd8baa78b9fcda0f6fe9be77fc86dff45bfa6ebb0e557af2e5d3a3df08def43bba97bb9fcfd717fddf3f9ffb4cf1363af0f35b9df7dff2afda3fd49fdfa97cba637c6cfffeefbf7ffb0ffbcaf966</data>
+ </image>
+ <image name="image2">
+ <data format="XPM.GZ" length="8120">789ca598d96e23cb0d86efe7298ce1dd4150475b4bdd0872e17d5fe4dd0e7241b25a966ccbabbc0679f7948a3f35b667264890d1e8603e5515fb278bc5629f3fff983bdddb9efbe3cf6f8f139e8c744e87fc30f7477c1a8fdffefe8fbffdf3dbf776676efab768cdb5beffe5dbf7c0733ab7737b5367a00fd09f7c1c9104d4c87f323f823bc6f10d5c36cacc0b606ddaf89d71b301aec19d669eaf87e012fc005670cfb8a5ed6666ac6f378c6505ac1de355e34ec3384e66cc59ffad7337b34470c7380ec0a5cdd7cab9c8619337e75e7bcab4ed5c4a1e873f1db5713d362e8ac2ec9d806337dbd353e36e13cfbf0417c6bae60c7b67cef63c3d07478c5fcfd8c6378c7b4df0c4b9ea647e0217187f0657a5d97b75669bff629cb6cbe66f3a579af533b832fbd20647b1f55bc655c579be369cb5c83c3466c67cc4836b1b977563618d995bc6da8d793c5c642ed3065b3e9abdd2f38f2760e41b5b3ccb76c7f6972d9ea5e78396e0d2f62bbe1b170de4c3c019f13a0257369f768dbb4df33706708578af3adb7a7a0347cc1f19f79a361e09ecfbbf0e8ed84ff8cf8c785e194bcbe2a3b02775cce79bf7a7dc6cb4ca5695b96bece78b3ae0b26de34bc67ebef80ddc317f79138cfc9777638f0f379c2d5f54c105c69be00ae769011cc143e32ef24f8e9d916f47ce96afdc0217164fae8dab66ddcdfe1599d3fea39e5c1bbb7f326f5c20ffc32b389a7e317b697f8df9ddd9e6cb05b8002fced8e66f83715ec2dd8c6d7ccb19fe404f17fb2d9733363d23e31ef24d4e9ced3c91c5a3ac9a960fd40617831c0fcef5a2d5987e32b78dd3fa7cdeb8032ea06fd719faaec138dfbce08cf53be0081e189785ed47ccf169551dc5f952e36e61fe92adaf66cf1f833d3e05385afed39171897850e96ce37c08c679a2ca19fa179dadde9033fca35567c477c519f3efc1a87f7c635cf9f3f7c06effc0989bb61fb40f66e390f3abddf4f3a94d30f2977a60b5f32aafc69e0fe105ec7a4733b6e737c0d1e249985f16d8af0076ff96c1f08f969c31be66ecf9162a30ecd1b133e63f3a233fefc0febc796366ab5f21e747bb727f756c3c3bbfb760b5fb97edf95517f544578c67f79f389b3f72605ce2fcf03318f9129fc0881793b1fb176c3faa547fb35e5a00fb7ee6fea3d3f4fe250c8d5dbfbe833bd68fc82e58d19f60fd6cff0e8d4bdca7746b2c2d7b9ee6fdeaf0cc5e178c7e879c613fdc18fbfed389b1ef07df3a63bf1ec0111c666cf7cdbd3137b17fa5b1429f34c18cfb6a00ae8d25d7a7a2e5f775bc067b7f3631f6fac12bc6b3fb3a800b63da32f6fe451fc1b87fe5d419fb7f67cc5e3f095ca03fb931ae5b8341d697cf5f2a8e0dcb3fb1f5ecfd20bf802be378058e18cff5abdb4afda1f973052e8c65c9d8e34913b0dfef6c2c8cfbee065c9b3ecee7bfcbddcafa1d3e0647f4a3f7c6decfd1e58cad3e3e184b0bf6198ce7c99a7144bec7ec6fafdd6d5a7fc09760f4b7bc0e463f2b6cdcf3f9af60cc27f0acfe88b1742d3fc3b1736df97608463e71aedf3df1fe984fc0de9f75c1e8a7e5ca585aa8df0246becad838c27f2e9d2dde92f3a54cfad1cf457034962de312fd9e3c80bd3f1a1a57b86fe3bcb1f7c3e1085cc3df036385ffd230aebbd093fbb532f967f52c8c8c4bf45f61c338f5d7b63ee743d5f17e93d78c4bf45ff1068cfb5a968d2b8c531fecf7793476fbe1d419fd88b1f6bcbf1163cfbf78615c816507ecf35f8cb9b6faa56cecfb476aacc84f36bdeaf1d1dc4fa4f28878eb8e7185fe4eb7c1dedf3d19b3f77ffbc67e1e381a2bce673871c67d9ffb49d659fde91857decf6d837dbc6fcc35ee778c479c475667dc376733b6fd3f37ae3d3f72fd93e40fdebfda60f40bdc3766ef279b609fff662c2d8c0fc05dac877d7f5fa353e38878874d30ce8be6fc9658a15f8cb63e32fa51d90333c66f8dd3f36dbc04635cfb60e44368187b3cc216d8cf6bbebf53f380faae07c69e3f5280bbc6710cf6f7af0e18efafba68ac58af3760ac0fbbc611e7979e9ca1efd9b86ee17c2f39a39e637e8d7ce28b19db38f40f106fcaf54ca3d78f28e0da584d4f4c7a8defc0a8af1ac0be7e098cfa4a7bc6337f368c5d3fad3bc3bf0918e73fcccfd8f4db7e44d71f72fec5147f7b5e5430ea71b83456bcff867bb0cf7f007bbfe1e30c7dd7c611eb6908f6ffdfb000f6fdd93176bd6111ecf99cf333d6fefead7bc68afe301460d4435d02a3df9567b0afb7e7d7d1d75f81bd9ef6c1de2faf18cffa936cafeeaadfd795b1d70fba00778d95c098af2de3dae78fc1984f6760f81f96c11eaf73e381d723cc1f78bc72fdac937fc8f755b0dfe72d30f62bec813ddfccbfdaf783ec79b53f2f3c817dbf723e0c92bfc8bf36d8fbf575e31af594dec13e7fdf78e0f5f61a8c71da9cb13d2ff71783c12c5f3a608fd700ecf15a339ee97f03fbfa31d8d7d7e081717f12e8fffd66bb9cfef5f12be9a3d3ff7ef9fd3f7c7fa127863a7d06c9cec5ccdaffa8270cd3ca611885cb70956c5d676bff95b62f7aa65ac6e126dc86bb64ed3e3c649e5a7b9c598b4967fcaaf3273d93f0149eb3672fc9daeb4cdb38bc255b8f69bd7b2de1fd87ce9ff4cc8785b01896c27258c92b7e685b4d96d6d22f6ff8d6613d5b935fead9089be9bb15b6c34ed84dd63e6bdb0bfd64e33afdb29fe3f7e6967ed273100ec351380e27e134593bcbdaceb38e46d2d50cadd00e9d50242dddf45b27c56a6ae9673dbd50868a021131092945689beabaa59a067441431ad1255d51da4f1ae798c9573d7443b77447f7f4408f3421726df444cf94bca3d71cabdb69dce82d8ce8dd3cfbaa87e6698116698996698556696da62dd23a6dd0266dd136edd02eed59dca8ff1b3dfb7440877444c7c9ca49b2f651db099dd25958a3736aa41d984f71aba9f91b3d2d6a873bea50415dea51491587646d69aa8d8953eb337d5d0e3b885bfd1b3da905e5417a95bee0218ff892aff89ac77c43ab7c6bdaf88eeff96116b7b5dfe879e4479ef0133ff34bb2f31a86fcc6ef3ccf0b74c48b88db52f214710be7bfd5b394b42cf30aaf263b6bbcce1bbcc95bbccd3bbceb719b6ae3bd69dcc219f77fa587f79396033e4c768ef8984ff834293ae3736ea41ebc15eeb89dbaf1e28736d65fe9e16ed2d2e392ab3440a95b94304a2f752fa2b9571cc8850c6524973fb4c9d5cf7ae47aaa45c67223b772c723b99707794c9626f224cff222aff226efe9332f0bb268da6449963fea911559cd7129654dd66583bab2295bb22d3bd4945dd993be3c4f4f81eccb811cca51b27621c77222a71ff5242b67722e0d69262d2d69875a9ef924f5e13b52240b5d59969e94526950a26b7a4ffd9bc8a1aabca7deef831ead75a0173ad4915eea95a699a96aedc9533a898370afe3a4eb299da9822ef42659bb9567bd0beb7a9fb4c58f7af4411ff55a27faa4cffaa2af9ace1f8f528e0d5375b8d2f730d2791ae882dea4efa22e4919eee93ae9edeb727ac24c0f4f744557754dd7754337754bb7d3beafe573d809631deb8eece8ae2e262d7b494b3f69dc4fbff5434b97f5e0839e433dd2633dd1533dd3736d689347daca3539d94a7e6d693b3d7b493b69dfb296d4a3bf252bddcf7a82684fcbf43a16f43452eab2441751efc6533bbc467dba8afa434bb2b217a314fafe518ffd2bf56903d3142fd2ec40efa9d6d5e93b9cde0c7c42579fb5242b375ff5c0d230691ac54bd98b9aaae7f4165c0bad789547d3ec789de22366258e35c46427de7ed5932ddd4d35c5fbf8903c6ba5bb6140fd1fa3662d75df57f131e552579e3eeb4167903f3c8993f8a47da9e273caa3767cf964c73ee98e88afc9d3e6e7fc41ed714d6ff13dcee75d0ea9a67f5ccf5fb59996afe77d6669212ec6a5e4d93daf7c5cf975dec7cf977af88b191fac7cea313e8f7dffd75fbffd1bbcd1c249</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/filedialog.cpp b/muse2/muse/widgets/filedialog.cpp
new file mode 100644
index 00000000..6ffa6f69
--- /dev/null
+++ b/muse2/muse/widgets/filedialog.cpp
@@ -0,0 +1,534 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: filedialog.cpp,v 1.3.2.3 2005/06/19 06:32:07 lunar_shuttle Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <iostream>
+#include <errno.h>
+#include <qwidget.h>
+#include <q3url.h>
+#include <qpixmap.h>
+#include <qmessagebox.h>
+#include <q3buttongroup.h>
+#include <qtoolbutton.h>
+#include <qradiobutton.h>
+#include <qstringlist.h>
+
+#include "filedialog.h"
+#include "fdialogbuttons.h"
+#include "../globals.h"
+
+MFileDialog::ViewType MFileDialog::lastViewUsed = GLOBAL_VIEW;
+QString MFileDialog::lastUserDir = "";
+QString MFileDialog::lastGlobalDir = "";
+
+//---------------------------------------------------------
+// createDir
+// return true if dir could not created
+//---------------------------------------------------------
+
+static bool createDir(const QString& s)
+ {
+ QString sl("/");
+ QStringList l = QStringList::split(sl, s);
+ QString path(sl);
+ QDir dir;
+ for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
+ dir.setPath(path);
+ if (!QDir(path + sl + *it).exists()) {
+ if (!dir.mkdir(*it)) {
+ printf("mkdir failed: %s %s\n",
+ path.latin1(), (*it).latin1());
+ return true;
+ }
+ }
+ path += sl;
+ path += *it;
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// testDirCreate
+// return true if dir does not exist
+//---------------------------------------------------------
+
+static bool testDirCreate(QWidget* parent, const QString& path)
+ {
+ QDir dir(path);
+ if (!dir.exists()) {
+ int n = QMessageBox::information(parent,
+ QWidget::tr("MusE: get file name"),
+ QWidget::tr("the directory\n") + path
+ + QWidget::tr("\ndoes not exist\ncreate?"),
+ QWidget::tr("&Create"),
+ QWidget::tr("Cancel"),
+ QString::null, 1, 1);
+ if (n == 0) {
+ if (createDir(path)) {
+ QMessageBox::critical(parent,
+ QWidget::tr("MusE: create directory"),
+ QWidget::tr("creating dir failed")
+ );
+ return true;
+ }
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// globalToggled
+//---------------------------------------------------------
+
+void MFileDialog::globalToggled(bool flag)
+ {
+ if (flag) {
+ buttons->userButton->setOn(!flag);
+ buttons->projectButton->setOn(!flag);
+ if (lastGlobalDir.isEmpty())
+ lastGlobalDir = museGlobalShare + QString("/") + baseDir; // Initialize if first time
+ QString dir = lastGlobalDir;
+ setDir(dir);
+ lastViewUsed = GLOBAL_VIEW;
+ }
+ }
+
+//---------------------------------------------------------
+// userToggled
+//---------------------------------------------------------
+
+void MFileDialog::userToggled(bool flag)
+ {
+ if (flag) {
+ buttons->globalButton->setOn(!flag);
+ buttons->projectButton->setOn(!flag);
+
+
+ if (lastUserDir.isEmpty()) {
+ lastUserDir = museUser + QString("/") + baseDir; // Initialize if first time
+ }
+
+ if (testDirCreate(this, lastUserDir))
+ setDir(museUser);
+ else
+ setDir(lastUserDir);
+
+ lastViewUsed = USER_VIEW;
+ }
+ }
+
+//---------------------------------------------------------
+// projectToggled
+//---------------------------------------------------------
+
+void MFileDialog::projectToggled(bool flag)
+ {
+ if (flag) {
+ buttons->globalButton->setOn(!flag);
+ buttons->userButton->setOn(!flag);
+
+ QString s;
+ if (museProject == museProjectInitPath ) {
+ // if project path is uninitialized, meaning it is still set to museProjectInitPath.
+ // then project path is set to current pwd instead.
+ s = QString(getcwd(0,0)) + QString("/");
+ }
+ else
+ s = museProject + QString("/"); // + baseDir;
+
+ if (testDirCreate(this, s))
+ setDir(museProject);
+ else
+ setDir(s);
+ lastViewUsed = PROJECT_VIEW;
+ }
+ }
+
+
+//---------------------------------------------------------
+// MFileDialog
+//---------------------------------------------------------
+
+MFileDialog::MFileDialog(const QString& dir,
+ const QString& filter, QWidget* parent, bool writeFlag)
+ : Q3FileDialog(QString("."), filter, parent, 0, true)
+ {
+ showButtons = false;
+ if (dir.length() > 0 && dir[0] == QChar('/')) {
+ buttons = 0;
+ setDir(dir);
+ }
+ else {
+ baseDir = dir;
+ showButtons = true;
+ buttons = new FileDialogButtons(this, "fdialogbuttons");
+ addLeftWidget(buttons);
+ connect(buttons->globalButton, SIGNAL(toggled(bool)), SLOT(globalToggled(bool)));
+ connect(buttons->userButton, SIGNAL(toggled(bool)), SLOT(userToggled(bool)));
+ connect(buttons->projectButton, SIGNAL(toggled(bool)), SLOT(projectToggled(bool)));
+ connect(this, SIGNAL(dirEntered(const QString&)), SLOT(directoryChanged(const QString&)));
+ if (writeFlag) {
+ buttons->globalButton->setEnabled(false);
+ switch (lastViewUsed) {
+ case GLOBAL_VIEW:
+ case PROJECT_VIEW:
+ buttons->projectButton->setOn(true);
+ break;
+
+ case USER_VIEW:
+ buttons->userButton->setOn(true);
+ break;
+ }
+ }
+ else {
+ switch (lastViewUsed) {
+ case GLOBAL_VIEW:
+ buttons->globalButton->setOn(true);
+ break;
+
+ case PROJECT_VIEW:
+ buttons->projectButton->setOn(true);
+ break;
+
+ case USER_VIEW:
+ buttons->userButton->setOn(true);
+ break;
+ }
+
+ }
+ buttons->loadAllGroup->setShown(false);
+ }
+ }
+
+//---------------------------------------------------------
+// MFileDialog::directoryChanged
+//---------------------------------------------------------
+void MFileDialog::directoryChanged(const QString&)
+ {
+ ViewType currentView = GLOBAL_VIEW;
+ const QDir* ndir = dir();
+ QString newdir = ndir->absPath().latin1();
+ delete ndir; // We're owners of this one so we should delete it
+ if (buttons->projectButton->isOn())
+ currentView = PROJECT_VIEW;
+ else if (buttons->userButton->isOn())
+ currentView = USER_VIEW;
+
+ switch (currentView) {
+ case GLOBAL_VIEW:
+ lastGlobalDir = newdir;
+ break;
+
+ case USER_VIEW:
+ lastUserDir = newdir;
+ break;
+
+ case PROJECT_VIEW: // Do nothing
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// ContentsPreview
+//---------------------------------------------------------
+
+ContentsPreview::~ContentsPreview()
+ {
+ if (bg)
+ delete bg;
+ }
+
+//---------------------------------------------------------
+// ContentsPreview::showPreview
+//---------------------------------------------------------
+
+void ContentsPreview::previewUrl(const Q3Url& url)
+ {
+ if (!url.isLocalFile())
+ return;
+ if (url.path() == path)
+ return;
+ path = url.path();
+ if (bg)
+ delete bg;
+ bg = new QPixmap(path);
+ if (bg)
+ setBackgroundPixmap(*bg);
+ }
+
+//---------------------------------------------------------
+// getFilterExtension
+//---------------------------------------------------------
+
+QString getFilterExtension(const QString &filter)
+{
+ //
+ // Return the first extension found. Must contain at least one * character.
+ //
+
+ int pos = filter.find('*');
+ if(pos == -1)
+ return QString();
+
+ QString filt;
+ int len = filter.length();
+ ++pos;
+ for( ; pos < len; ++pos)
+ {
+ QChar c = filter[pos];
+ if((c == ')') || (c == ';') || (c == ',') || (c == ' '))
+ break;
+ filt += filter[pos];
+ }
+ return filt;
+}
+
+//---------------------------------------------------------
+// getOpenFileName
+//---------------------------------------------------------
+
+QString getOpenFileName(const QString &startWith,
+ //const char** filters, QWidget* parent, const QString& name, bool* all)
+ const QStringList& filters, QWidget* parent, const QString& name, bool* all)
+ {
+ QString initialSelection;
+ MFileDialog *dlg = new MFileDialog(startWith, QString::null, parent, false);
+ dlg->setFilters(filters);
+ dlg->setCaption(name);
+ if (all)
+ dlg->buttons->loadAllGroup->setShown(true);
+ if (!initialSelection.isEmpty())
+ dlg->setSelection(initialSelection);
+ dlg->setMode(Q3FileDialog::ExistingFile);
+ QString result;
+ if (dlg->exec() == QDialog::Accepted) {
+ result = dlg->selectedFile();
+ if (all) {
+ *all = dlg->buttons->loadAllButton->isOn();
+ }
+ }
+ delete dlg;
+ return result;
+ }
+
+//---------------------------------------------------------
+// getSaveFileName
+//---------------------------------------------------------
+
+QString getSaveFileName(const QString &startWith,
+ //const char** filters, QWidget* parent, const QString& name)
+ const QStringList& filters, QWidget* parent, const QString& name)
+ {
+ MFileDialog *dlg = new MFileDialog(startWith, QString::null, parent, true);
+ dlg->setFilters(filters);
+ dlg->setCaption(name);
+ dlg->setMode(Q3FileDialog::AnyFile);
+ QString result;
+ if (dlg->exec() == QDialog::Accepted)
+ result = dlg->selectedFile();
+
+
+ // Added by T356.
+ if(!result.isEmpty())
+ {
+ QString filt = dlg->selectedFilter();
+ filt = getFilterExtension(filt);
+ // Do we have a valid extension?
+ if(!filt.isEmpty())
+ {
+ // If the rightmost characters of the filename do not already contain
+ // the extension, add the extension to the filename.
+ //if(result.right(filt.length()) != filt)
+ if(!result.endsWith(filt))
+ result += filt;
+ }
+ else
+ {
+ // No valid extension, or just * was given. Although it would be nice to allow no extension
+ // or any desired extension by commenting this section out, it's probably not a good idea to do so.
+ //
+ // NOTE: Most calls to this routine getSaveFileName() are followed by fileOpen(),
+ // which can tack on its own extension, but only if the *complete* extension is blank.
+ // So there is some overlap going on. Enabling this actually stops that action,
+ // but only if there are no errors in the list of filters. fileOpen() will act as a 'catchall'.
+ //
+ // Force the filter list to the first one (the preferred one), and then get the filter.
+ dlg->setSelectedFilter(0);
+ filt = dlg->selectedFilter();
+ filt = getFilterExtension(filt);
+
+ // Do we have a valid extension?
+ if(!filt.isEmpty())
+ {
+ // If the rightmost characters of the filename do not already contain
+ // the extension, add the extension to the filename.
+ //if(result.right(filt.length()) != filt)
+ if(!result.endsWith(filt))
+ result += filt;
+ }
+ }
+ }
+
+ delete dlg;
+ return result;
+ }
+
+//---------------------------------------------------------
+// getImageFileName
+//---------------------------------------------------------
+
+QString getImageFileName(const QString& startWith,
+ //const char** filters, QWidget* parent, const QString& name)
+ const QStringList& filters, QWidget* parent, const QString& name)
+ {
+ QString initialSelection;
+ QString* workingDirectory = new QString(QDir::currentDirPath());
+ if (!startWith.isEmpty() ) {
+ QFileInfo fi(startWith);
+ if (fi.exists() && fi.isDir()) {
+ *workingDirectory = startWith;
+ }
+ else if (fi.exists() && fi.isFile()) {
+ *workingDirectory = fi.dirPath(TRUE);
+ initialSelection = fi.absFilePath();
+ }
+ }
+ MFileDialog *dlg = new MFileDialog(*workingDirectory, QString::null,
+ parent);
+
+ dlg->setContentsPreviewEnabled(true);
+ ContentsPreview* preview = new ContentsPreview(dlg);
+ dlg->setContentsPreview(preview, preview);
+ dlg->setPreviewMode(Q3FileDialog::Contents);
+
+ dlg->setCaption(name);
+ dlg->setFilters(filters);
+ dlg->setMode(Q3FileDialog::ExistingFile);
+ QString result;
+ if (!initialSelection.isEmpty())
+ dlg->setSelection( initialSelection);
+ if (dlg->exec() == QDialog::Accepted) {
+ result = dlg->selectedFile();
+ }
+ delete dlg;
+ return result;
+ }
+
+//---------------------------------------------------------
+// fileOpen
+// opens file "name" with extension "ext" in mode "mode"
+// handles "name.ext.bz2" and "name.ext.gz"
+//
+// mode = "r" or "w"
+// popenFlag set to true on return if file was opened
+// with popen() (and therefore must be closed
+// with pclose())
+// noError show no error if file was not found in "r"
+// mode. Has no effect in "w" mode
+// overwriteWarning
+// warn in "w" mode, if file exists
+//---------------------------------------------------------
+
+FILE* fileOpen(QWidget* parent, QString name, const QString& ext,
+ const char* mode, bool& popenFlag, bool noError,
+ bool overwriteWarning)
+ {
+ QFileInfo info(name);
+ QString zip;
+
+ popenFlag = false;
+ if (info.extension(true) == "") {
+ name += ext;
+ info.setFile(name);
+ }
+ else if (info.extension(false) == "gz") {
+ popenFlag = true;
+ zip = QString("gzip");
+ }
+ else if (info.extension(false) == "bz2") {
+ popenFlag = true;
+ zip = QString("bzip2");
+ }
+
+ if (strcmp(mode,"w") == 0 && overwriteWarning && info.exists()) {
+ QString s(QWidget::tr("File\n") + name + QWidget::tr("\nexists"));
+ int rv = QMessageBox::warning(parent,
+ QWidget::tr("MusE: write"),
+ s,
+ QWidget::tr("Overwrite"),
+ QWidget::tr("Quit"), QString::null, 0, 1);
+ switch(rv) {
+ case 0: // overwrite
+ break;
+ case 1: // quit
+ return 0;
+ }
+ }
+ FILE* fp = 0;
+ if (popenFlag) {
+ if (strcmp(mode, "r") == 0)
+ zip += QString(" -d < ");
+ else
+ zip += QString(" > ");
+ zip += name;
+ fp = popen(zip.ascii(), mode);
+ }
+ else {
+ fp = fopen(name.ascii(), mode);
+ }
+ if (fp == 0 && !noError) {
+ QString s(QWidget::tr("Open File\n") + name + QWidget::tr("\nfailed: ")
+ + QString(strerror(errno)));
+ QMessageBox::critical(parent, QWidget::tr("MusE: Open File"), s);
+ return 0;
+ }
+ return fp;
+ }
+
+//---------------------------------------------------------
+// MFile
+//---------------------------------------------------------
+
+MFile::MFile(const QString& _path, const QString& _ext)
+ : path(_path), ext(_ext)
+ {
+ f = 0;
+ isPopen = false;
+ }
+
+MFile::~MFile()
+ {
+ if (f) {
+ if (isPopen)
+ pclose(f);
+ else
+ fclose(f);
+ }
+ }
+
+//---------------------------------------------------------
+// open
+//---------------------------------------------------------
+
+//FILE* MFile::open(const char* mode, const char** pattern,
+FILE* MFile::open(const char* mode, const QStringList& pattern,
+ QWidget* parent, bool noError, bool warnIfOverwrite, const QString& caption)
+ {
+ QString name;
+ if (strcmp(mode, "r") == 0)
+ name = getOpenFileName(path, pattern, parent, caption, 0);
+ else
+ name = getSaveFileName(path, pattern, parent, caption);
+ if (name.isEmpty())
+ return 0;
+ f = fileOpen(parent, name, ext, mode, isPopen, noError,
+ warnIfOverwrite);
+ return f;
+ }
+
diff --git a/muse2/muse/widgets/filedialog.h b/muse2/muse/widgets/filedialog.h
new file mode 100644
index 00000000..2208b5bc
--- /dev/null
+++ b/muse2/muse/widgets/filedialog.h
@@ -0,0 +1,92 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: filedialog.h,v 1.2.2.2 2008/01/19 13:33:46 wschweer Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <q3filedialog.h>
+//Added by qt3to4:
+#include <QPixmap>
+
+class FileDialogButtons;
+class QStringList;
+
+//---------------------------------------------------------
+// MFileDialog
+//---------------------------------------------------------
+
+class MFileDialog : public Q3FileDialog {
+ Q_OBJECT
+
+ enum ViewType { GLOBAL_VIEW, PROJECT_VIEW, USER_VIEW }; //!< The three different viewtypes
+ static ViewType lastViewUsed;
+ static QString lastUserDir, lastGlobalDir;
+ bool showButtons;
+ QString baseDir;
+
+ private slots:
+ void globalToggled(bool);
+ void userToggled(bool);
+ void projectToggled(bool);
+ void directoryChanged(const QString& directory);
+
+ public:
+ FileDialogButtons* buttons;
+ MFileDialog(const QString& dir, const QString& filter = QString::null,
+ QWidget* parent = 0, bool writeFlag = false);
+ };
+
+//---------------------------------------------------------
+// ContentsPreview
+//---------------------------------------------------------
+
+class ContentsPreview : public QWidget, public Q3FilePreview {
+ Q_OBJECT
+
+ virtual void previewUrl(const Q3Url &url);
+ QString path;
+ QPixmap* bg;
+
+ public:
+ ContentsPreview(QWidget* parent, const char* name=0)
+ : QWidget(parent, name) {
+ bg = 0;
+ }
+ ~ContentsPreview();
+ };
+
+//QString getSaveFileName(const QString& startWidth, const char** filter,
+QString getSaveFileName(const QString& startWidth, const QStringList& filters,
+ QWidget* parent, const QString& name);
+//QString getOpenFileName(const QString& startWidth, const char** filter,
+QString getOpenFileName(const QString& startWidth, const QStringList& filters,
+ QWidget* parent, const QString& name, bool* openAll);
+//QString getImageFileName(const QString& startWith, const char** filters,
+QString getImageFileName(const QString& startWith, const QStringList& filters,
+ QWidget* parent, const QString& name);
+
+FILE* fileOpen(QWidget*, QString, const QString&,
+ const char*, bool&, bool = false, bool = false);
+
+
+//---------------------------------------------------------
+// MFile
+// "Muse" File
+//---------------------------------------------------------
+
+class MFile {
+ bool isPopen;
+ FILE* f;
+ QString path;
+ QString ext;
+
+ public:
+ MFile(const QString& path, const QString& ext);
+ ~MFile();
+ //FILE* open(const char* mode, const char** pattern,
+ FILE* open(const char* mode, const QStringList& pattern,
+ QWidget* parent, bool noError,
+ bool warnIfOverwrite, const QString& caption);
+ };
+
diff --git a/muse2/muse/widgets/fontsel.cpp b/muse2/muse/widgets/fontsel.cpp
new file mode 100644
index 00000000..a6808ff1
--- /dev/null
+++ b/muse2/muse/widgets/fontsel.cpp
@@ -0,0 +1,137 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: fontsel.cpp,v 1.1.1.1 2003/10/27 18:55:02 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qlabel.h>
+#include <qspinbox.h>
+#include <qpushbutton.h>
+//#include <qhbuttongroup.h>
+#include <q3buttongroup.h>
+#include <qtoolbutton.h>
+#include <qcombobox.h>
+#include <qlayout.h>
+#include <qfontdialog.h>
+#include <qfontdatabase.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+
+#include "icons.h"
+#include "fontsel.h"
+
+//---------------------------------------------------------
+// FontSel
+//---------------------------------------------------------
+
+FontSel::FontSel(QWidget* parent, const QFont& f, const QString& name)
+ : QWidget(parent)
+ {
+ _font = f;
+ Q3HBoxLayout* box = new Q3HBoxLayout(this);
+
+ cb = new QComboBox(this);
+ cb->setFixedWidth(80);
+ cb->insertItem(QString("arial"));
+ cb->insertItem(QString("avantgarde"));
+ cb->insertItem(QString("charter"));
+ cb->insertItem(QString("garamond"));
+ cb->insertItem(QString("gillsans"));
+ cb->insertItem(QString("helvetica"));
+ cb->insertItem(QString("times"));
+ cb->insertItem(QString("terminal"));
+ cb->insertItem(QString("utopia"));
+ cb->insertItem(QString("new century schoolbook"));
+
+ QLabel* l1 = new QLabel(tr("Size:"), this);
+ s1 = new QSpinBox(8, 48, 1, this);
+
+ fcb1 = new QToolButton(this);
+ fcb1->setToggleButton(true);
+ fcb1->setPixmap(*(boldIcon));
+
+ fcb2 = new QToolButton(this);
+ fcb2->setToggleButton(true);
+ fcb2->setPixmap(*(italicIcon));
+
+ fcb3 = new QToolButton(this);
+ fcb3->setToggleButton(true);
+ fcb3->setPixmap(*(underlinedIcon));
+
+ QToolButton* pb = new QToolButton(this);
+ connect(pb, SIGNAL(pressed()), SLOT(fontSelect()));
+ pb->setText(QString("??"));
+
+ QLabel* l2 = new QLabel(name, this);
+
+ box->addWidget(cb);
+ box->addSpacing(8);
+ box->addWidget(l1);
+ box->addSpacing(5);
+ box->addWidget(s1);
+ box->addSpacing(5);
+ box->addWidget(fcb1);
+ box->addWidget(fcb2);
+ box->addWidget(fcb3);
+ box->addSpacing(2);
+ box->addWidget(pb);
+ box->addSpacing(5);
+ box->addWidget(l2);
+ box->addStretch(100);
+ setFixedHeight(18);
+ setFont();
+ }
+
+//---------------------------------------------------------
+// fontSelect
+//---------------------------------------------------------
+
+void FontSel::fontSelect()
+ {
+ bool ok;
+ QFont f = QFontDialog::getFont(&ok, _font, this);
+ if (ok) {
+ _font = f;
+ setFont();
+ }
+ }
+
+//---------------------------------------------------------
+// setFont
+//---------------------------------------------------------
+
+void FontSel::setFont()
+ {
+ s1->setValue(_font.pointSize());
+ fcb1->setOn(_font.weight() == QFont::Bold);
+ fcb2->setOn(_font.italic());
+ fcb3->setOn(_font.underline());
+ int i;
+ for (i = 0; i < cb->count(); ++i) {
+ QString s = cb->text(i);
+ if (s == _font.family()) {
+ cb->setCurrentItem(i);
+ break;
+ }
+ }
+ if (i == cb->count()) {
+ cb->insertItem(_font.family());
+ cb->setCurrentItem(i);
+ }
+ }
+
+//---------------------------------------------------------
+// font
+//---------------------------------------------------------
+
+const QFont& FontSel::font()
+ {
+ _font.setPointSize(s1->value());
+ _font.setWeight(fcb1->isOn() ? QFont::Bold : QFont::Normal);
+ _font.setItalic(fcb2->isOn());
+ _font.setUnderline(fcb3->isOn());
+ _font.setFamily(cb->currentText());
+ return _font;
+ }
+
diff --git a/muse2/muse/widgets/fontsel.h b/muse2/muse/widgets/fontsel.h
new file mode 100644
index 00000000..1b906aab
--- /dev/null
+++ b/muse2/muse/widgets/fontsel.h
@@ -0,0 +1,45 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: fontsel.h,v 1.1.1.1.2.1 2008/01/19 13:33:46 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __FONTSEL_H__
+#define __FONTSEL_H__
+
+#include <qwidget.h>
+#include "song.h"
+
+class QFont;
+class QSpinBox;
+class QToolButton;
+class QComboBox;
+
+//---------------------------------------------------------
+// FontSel
+//---------------------------------------------------------
+
+class FontSel : public QWidget {
+ Q_OBJECT
+
+ QFont _font;
+ QSpinBox* s1;
+ QToolButton* fcb1;
+ QToolButton* fcb2;
+ QToolButton* fcb3;
+ QComboBox* cb;
+
+ void setFont();
+
+ private slots:
+ void fontSelect();
+
+ public:
+ FontSel(QWidget* parent, const QFont&, const QString&);
+ const QFont& font();
+ };
+
+
+#endif
+
diff --git a/muse2/muse/widgets/gatetime.cpp b/muse2/muse/widgets/gatetime.cpp
new file mode 100644
index 00000000..412d4d4c
--- /dev/null
+++ b/muse2/muse/widgets/gatetime.cpp
@@ -0,0 +1,46 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: gatetime.cpp,v 1.1.1.1 2003/10/27 18:54:37 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <q3buttongroup.h>
+#include <qspinbox.h>
+//#include <qbutton.h>
+#include <QtGui>
+
+#include "gatetime.h"
+
+#include "song.h"
+
+//---------------------------------------------------------
+// GateTime
+//---------------------------------------------------------
+
+GateTime::GateTime(QWidget* parent, const char* name)
+ : GateTimeBase(parent, name, true)
+ {
+ }
+
+//---------------------------------------------------------
+// accept
+//---------------------------------------------------------
+
+void GateTime::accept()
+ {
+ _range = rangeGroup->id(rangeGroup->selected());
+ _rateVal = rate->value();
+ _offsetVal = offset->value();
+ GateTimeBase::accept();
+ }
+
+//---------------------------------------------------------
+// setRange
+//---------------------------------------------------------
+
+void GateTime::setRange(int id)
+ {
+ rangeGroup->setButton(id);
+ }
+
diff --git a/muse2/muse/widgets/gatetime.h b/muse2/muse/widgets/gatetime.h
new file mode 100644
index 00000000..c3e5b883
--- /dev/null
+++ b/muse2/muse/widgets/gatetime.h
@@ -0,0 +1,36 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: gatetime.h,v 1.1.1.1.2.1 2008/01/19 13:33:47 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __GATETIME_H__
+#define __GATETIME_H__
+
+#include "gatetimebase.h"
+
+//---------------------------------------------------------
+// GateTime
+//---------------------------------------------------------
+
+class GateTime : public GateTimeBase {
+ Q_OBJECT
+
+ int _range;
+ int _rateVal;
+ int _offsetVal;
+
+ protected slots:
+ void accept();
+
+ public:
+ GateTime(QWidget* parent, const char* name = 0);
+ void setRange(int id);
+ int range() const { return _range; }
+ int rateVal() const { return _rateVal; }
+ int offsetVal() const { return _offsetVal; }
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/gatetimebase.ui b/muse2/muse/widgets/gatetimebase.ui
new file mode 100644
index 00000000..fe696076
--- /dev/null
+++ b/muse2/muse/widgets/gatetimebase.ui
@@ -0,0 +1,285 @@
+<!DOCTYPE UI><UI>
+<class>GateTimeBase</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GateTimeBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>275</width>
+ <height>266</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>MusE: Modify Gate Time</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>rangeGroup</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Range</string>
+ </property>
+ <property stdset="1">
+ <name>exclusive</name>
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>RadioButton5</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>All Events</string>
+ </property>
+ <property stdset="1">
+ <name>buttonGroupId</name>
+ <number>0</number>
+ </property>
+ </widget>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>RadioButton6</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Selected Events</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>buttonGroupId</name>
+ <number>1</number>
+ </property>
+ </widget>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>RadioButton7</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Looped Events</string>
+ </property>
+ <property stdset="1">
+ <name>buttonGroupId</name>
+ <number>2</number>
+ </property>
+ </widget>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>RadioButton8</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Selected &amp; Looped</string>
+ </property>
+ <property stdset="1">
+ <name>buttonGroupId</name>
+ <number>3</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox3</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Values</string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Rate:</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Offset:</string>
+ </property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>rate</cstring>
+ </property>
+ <property stdset="1">
+ <name>suffix</name>
+ <string>%</string>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>200</number>
+ </property>
+ <property stdset="1">
+ <name>value</name>
+ <number>100</number>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>offset</cstring>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>999</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>-999</number>
+ </property>
+ <property stdset="1">
+ <name>lineStep</name>
+ <number>1</number>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer1</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>okButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>OK</string>
+ </property>
+ <property stdset="1">
+ <name>autoDefault</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>default</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cancelButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>okButton</sender>
+ <signal>clicked()</signal>
+ <receiver>GateTimeBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>GateTimeBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+</UI>
diff --git a/muse2/muse/widgets/genset.cpp b/muse2/muse/widgets/genset.cpp
new file mode 100644
index 00000000..79f190d0
--- /dev/null
+++ b/muse2/muse/widgets/genset.cpp
@@ -0,0 +1,444 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: genset.cpp,v 1.7.2.8 2009/12/01 03:52:40 terminator356 Exp $
+//
+// (C) Copyright 2001-2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <qpushbutton.h>
+#include <qcombobox.h>
+#include <qspinbox.h>
+#include <qlineedit.h>
+#include <q3buttongroup.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+//Added by qt3to4:
+#include <QShowEvent>
+
+#include "genset.h"
+#include "app.h"
+#include "gconfig.h"
+#include "midiseq.h"
+#include "globals.h"
+
+static int rtcResolutions[] = {
+ 1024, 2048, 4096, 8192, 16384, 32768
+ };
+static int divisions[] = {
+ 48, 96, 192, 384, 768, 1536, 3072, 6144, 12288
+ };
+static int dummyAudioBufSizes[] = {
+ 16, 32, 64, 128, 256, 512, 1024, 2048
+ };
+
+//---------------------------------------------------------
+// GlobalSettingsConfig
+//---------------------------------------------------------
+
+GlobalSettingsConfig::GlobalSettingsConfig(QWidget* parent, const char* name)
+ : GlobalSettingsDialogBase(parent, name)
+ {
+ for (unsigned i = 0; i < sizeof(rtcResolutions)/sizeof(*rtcResolutions); ++i) {
+ if (rtcResolutions[i] == config.rtcTicks) {
+ rtcResolutionSelect->setCurrentItem(i);
+ break;
+ }
+ }
+ for (unsigned i = 0; i < sizeof(divisions)/sizeof(*divisions); ++i) {
+ if (divisions[i] == config.division) {
+ midiDivisionSelect->setCurrentItem(i);
+ break;
+ }
+ }
+ for (unsigned i = 0; i < sizeof(divisions)/sizeof(*divisions); ++i) {
+ if (divisions[i] == config.guiDivision) {
+ guiDivisionSelect->setCurrentItem(i);
+ break;
+ }
+ }
+ for (unsigned i = 0; i < sizeof(dummyAudioBufSizes)/sizeof(*dummyAudioBufSizes); ++i) {
+ if (dummyAudioBufSizes[i] == config.dummyAudioBufSize) {
+ dummyAudioSize->setCurrentItem(i);
+ break;
+ }
+ }
+
+ guiRefreshSelect->setValue(config.guiRefresh);
+ minSliderSelect->setValue(int(config.minSlider));
+ minMeterSelect->setValue(config.minMeter);
+ freewheelCheckBox->setChecked(config.freewheelMode);
+ denormalCheckBox->setChecked(config.useDenormalBias);
+ outputLimiterCheckBox->setChecked(config.useOutputLimiter);
+ vstInPlaceCheckBox->setChecked(config.vstInPlace);
+ dummyAudioRate->setValue(config.dummyAudioSampleRate);
+
+ //DummyAudioDevice* dad = dynamic_cast<DummyAudioDevice*>(audioDevice);
+ //dummyAudioRealRate->setText(dad ? QString().setNum(sampleRate) : "---");
+ dummyAudioRealRate->setText(QString().setNum(sampleRate));
+
+ helpBrowser->setText(config.helpBrowser);
+ startSongEntry->setText(config.startSong);
+ startSongGroup->setButton(config.startMode);
+
+ showTransport->setChecked(config.transportVisible);
+ showBigtime->setChecked(config.bigTimeVisible);
+ //showMixer->setChecked(config.mixerVisible);
+ showMixer->setChecked(config.mixer1Visible);
+ showMixer2->setChecked(config.mixer2Visible);
+
+ arrangerX->setValue(config.geometryMain.x());
+ arrangerY->setValue(config.geometryMain.y());
+ arrangerW->setValue(config.geometryMain.width());
+ arrangerH->setValue(config.geometryMain.height());
+
+ transportX->setValue(config.geometryTransport.x());
+ transportY->setValue(config.geometryTransport.y());
+
+ bigtimeX->setValue(config.geometryBigTime.x());
+ bigtimeY->setValue(config.geometryBigTime.y());
+ bigtimeW->setValue(config.geometryBigTime.width());
+ bigtimeH->setValue(config.geometryBigTime.height());
+
+ //mixerX->setValue(config.geometryMixer.x());
+ //mixerY->setValue(config.geometryMixer.y());
+ //mixerW->setValue(config.geometryMixer.width());
+ //mixerH->setValue(config.geometryMixer.height());
+ mixerX->setValue(config.mixer1.geometry.x());
+ mixerY->setValue(config.mixer1.geometry.y());
+ mixerW->setValue(config.mixer1.geometry.width());
+ mixerH->setValue(config.mixer1.geometry.height());
+ mixer2X->setValue(config.mixer2.geometry.x());
+ mixer2Y->setValue(config.mixer2.geometry.y());
+ mixer2W->setValue(config.mixer2.geometry.width());
+ mixer2H->setValue(config.mixer2.geometry.height());
+
+ //setMixerCurrent->setEnabled(muse->mixerWindow());
+ setMixerCurrent->setEnabled(muse->mixer1Window());
+ setMixer2Current->setEnabled(muse->mixer2Window());
+
+ setBigtimeCurrent->setEnabled(muse->bigtimeWindow());
+ setTransportCurrent->setEnabled(muse->transportWindow());
+
+ showSplash->setChecked(config.showSplashScreen);
+ showDidYouKnow->setChecked(config.showDidYouKnow);
+ externalWavEditorSelect->setText(config.externalWavEditor);
+ oldStyleStopCheckBox->setChecked(config.useOldStyleStopShortCut);
+ moveArmedCheckBox->setChecked(config.moveArmedCheckBox);
+
+ //updateSettings(); // TESTING
+
+ connect(applyButton, SIGNAL(clicked()), SLOT(apply()));
+ connect(okButton, SIGNAL(clicked()), SLOT(ok()));
+ connect(cancelButton, SIGNAL(clicked()), SLOT(cancel()));
+ connect(setMixerCurrent, SIGNAL(clicked()), SLOT(mixerCurrent()));
+ connect(setMixer2Current, SIGNAL(clicked()), SLOT(mixer2Current()));
+ connect(setBigtimeCurrent, SIGNAL(clicked()), SLOT(bigtimeCurrent()));
+ connect(setArrangerCurrent, SIGNAL(clicked()), SLOT(arrangerCurrent()));
+ connect(setTransportCurrent, SIGNAL(clicked()), SLOT(transportCurrent()));
+ }
+
+//---------------------------------------------------------
+// updateSettings
+//---------------------------------------------------------
+
+void GlobalSettingsConfig::updateSettings()
+{
+ for (unsigned i = 0; i < sizeof(rtcResolutions)/sizeof(*rtcResolutions); ++i) {
+ if (rtcResolutions[i] == config.rtcTicks) {
+ rtcResolutionSelect->setCurrentItem(i);
+ break;
+ }
+ }
+ for (unsigned i = 0; i < sizeof(divisions)/sizeof(*divisions); ++i) {
+ if (divisions[i] == config.division) {
+ midiDivisionSelect->setCurrentItem(i);
+ break;
+ }
+ }
+ for (unsigned i = 0; i < sizeof(divisions)/sizeof(*divisions); ++i) {
+ if (divisions[i] == config.guiDivision) {
+ guiDivisionSelect->setCurrentItem(i);
+ break;
+ }
+ }
+ for (unsigned i = 0; i < sizeof(dummyAudioBufSizes)/sizeof(*dummyAudioBufSizes); ++i) {
+ if (dummyAudioBufSizes[i] == config.dummyAudioBufSize) {
+ dummyAudioSize->setCurrentItem(i);
+ break;
+ }
+ }
+
+ guiRefreshSelect->setValue(config.guiRefresh);
+ minSliderSelect->setValue(int(config.minSlider));
+ minMeterSelect->setValue(config.minMeter);
+ freewheelCheckBox->setChecked(config.freewheelMode);
+ denormalCheckBox->setChecked(config.useDenormalBias);
+ outputLimiterCheckBox->setChecked(config.useOutputLimiter);
+ vstInPlaceCheckBox->setChecked(config.vstInPlace);
+ dummyAudioRate->setValue(config.dummyAudioSampleRate);
+
+ //DummyAudioDevice* dad = dynamic_cast<DummyAudioDevice*>(audioDevice);
+ //dummyAudioRealRate->setText(dad ? QString().setNum(sampleRate) : "---");
+ dummyAudioRealRate->setText(QString().setNum(sampleRate));
+
+ helpBrowser->setText(config.helpBrowser);
+ startSongEntry->setText(config.startSong);
+ startSongGroup->setButton(config.startMode);
+
+ showTransport->setChecked(config.transportVisible);
+ showBigtime->setChecked(config.bigTimeVisible);
+ //showMixer->setChecked(config.mixerVisible);
+ showMixer->setChecked(config.mixer1Visible);
+ showMixer2->setChecked(config.mixer2Visible);
+
+ arrangerX->setValue(config.geometryMain.x());
+ arrangerY->setValue(config.geometryMain.y());
+ arrangerW->setValue(config.geometryMain.width());
+ arrangerH->setValue(config.geometryMain.height());
+
+ transportX->setValue(config.geometryTransport.x());
+ transportY->setValue(config.geometryTransport.y());
+
+ bigtimeX->setValue(config.geometryBigTime.x());
+ bigtimeY->setValue(config.geometryBigTime.y());
+ bigtimeW->setValue(config.geometryBigTime.width());
+ bigtimeH->setValue(config.geometryBigTime.height());
+
+ //mixerX->setValue(config.geometryMixer.x());
+ //mixerY->setValue(config.geometryMixer.y());
+ //mixerW->setValue(config.geometryMixer.width());
+ //mixerH->setValue(config.geometryMixer.height());
+ mixerX->setValue(config.mixer1.geometry.x());
+ mixerY->setValue(config.mixer1.geometry.y());
+ mixerW->setValue(config.mixer1.geometry.width());
+ mixerH->setValue(config.mixer1.geometry.height());
+ mixer2X->setValue(config.mixer2.geometry.x());
+ mixer2Y->setValue(config.mixer2.geometry.y());
+ mixer2W->setValue(config.mixer2.geometry.width());
+ mixer2H->setValue(config.mixer2.geometry.height());
+
+ //setMixerCurrent->setEnabled(muse->mixerWindow());
+ setMixerCurrent->setEnabled(muse->mixer1Window());
+ setMixer2Current->setEnabled(muse->mixer2Window());
+
+ setBigtimeCurrent->setEnabled(muse->bigtimeWindow());
+ setTransportCurrent->setEnabled(muse->transportWindow());
+
+ showSplash->setChecked(config.showSplashScreen);
+ showDidYouKnow->setChecked(config.showDidYouKnow);
+ externalWavEditorSelect->setText(config.externalWavEditor);
+ oldStyleStopCheckBox->setChecked(config.useOldStyleStopShortCut);
+ moveArmedCheckBox->setChecked(config.moveArmedCheckBox);
+}
+
+//---------------------------------------------------------
+// showEvent
+//---------------------------------------------------------
+
+void GlobalSettingsConfig::showEvent(QShowEvent* e)
+{
+ QDialog::showEvent(e);
+ //updateSettings(); // TESTING
+}
+
+//---------------------------------------------------------
+// apply
+//---------------------------------------------------------
+
+void GlobalSettingsConfig::apply()
+ {
+ int rtcticks = rtcResolutionSelect->currentItem();
+ config.guiRefresh = guiRefreshSelect->value();
+ config.minSlider = minSliderSelect->value();
+ config.minMeter = minMeterSelect->value();
+ config.freewheelMode = freewheelCheckBox->isChecked();
+ config.useDenormalBias = denormalCheckBox->isChecked();
+ config.useOutputLimiter = outputLimiterCheckBox->isChecked();
+ config.vstInPlace = vstInPlaceCheckBox->isChecked();
+ config.rtcTicks = rtcResolutions[rtcticks];
+ config.helpBrowser = helpBrowser->text();
+ config.startSong = startSongEntry->text();
+ config.startMode = startSongGroup->selectedId();
+ int das = dummyAudioSize->currentItem();
+ config.dummyAudioBufSize = dummyAudioBufSizes[das];
+ config.dummyAudioSampleRate = dummyAudioRate->value();
+
+ int div = midiDivisionSelect->currentItem();
+ config.division = divisions[div];
+ div = guiDivisionSelect->currentItem();
+ config.guiDivision = divisions[div];
+
+ config.transportVisible = showTransport->isChecked();
+ config.bigTimeVisible = showBigtime->isChecked();
+ //config.mixerVisible = showMixer->isChecked();
+ config.mixer1Visible = showMixer->isChecked();
+ config.mixer2Visible = showMixer2->isChecked();
+
+ config.geometryMain.setX(arrangerX->value());
+ config.geometryMain.setY(arrangerY->value());
+ config.geometryMain.setWidth(arrangerW->value());
+ config.geometryMain.setHeight(arrangerH->value());
+
+ config.geometryTransport.setX(transportX->value());
+ config.geometryTransport.setY(transportY->value());
+ config.geometryTransport.setWidth(0);
+ config.geometryTransport.setHeight(0);
+
+ config.geometryBigTime.setX(bigtimeX->value());
+ config.geometryBigTime.setY(bigtimeY->value());
+ config.geometryBigTime.setWidth(bigtimeW->value());
+ config.geometryBigTime.setHeight(bigtimeH->value());
+
+ //config.geometryMixer.setX(mixerX->value());
+ //config.geometryMixer.setY(mixerY->value());
+ //config.geometryMixer.setWidth(mixerW->value());
+ //config.geometryMixer.setHeight(mixerH->value());
+ config.mixer1.geometry.setX(mixerX->value());
+ config.mixer1.geometry.setY(mixerY->value());
+ config.mixer1.geometry.setWidth(mixerW->value());
+ config.mixer1.geometry.setHeight(mixerH->value());
+ config.mixer2.geometry.setX(mixer2X->value());
+ config.mixer2.geometry.setY(mixer2Y->value());
+ config.mixer2.geometry.setWidth(mixer2W->value());
+ config.mixer2.geometry.setHeight(mixer2H->value());
+
+ config.showSplashScreen = showSplash->isChecked();
+ config.showDidYouKnow = showDidYouKnow->isChecked();
+ config.externalWavEditor = externalWavEditorSelect->text();
+ config.useOldStyleStopShortCut = oldStyleStopCheckBox->isChecked();
+ config.moveArmedCheckBox = moveArmedCheckBox->isChecked();
+ //muse->showMixer(config.mixerVisible);
+ muse->showMixer1(config.mixer1Visible);
+ muse->showMixer2(config.mixer2Visible);
+
+ muse->showBigtime(config.bigTimeVisible);
+ muse->showTransport(config.transportVisible);
+ QWidget* w = muse->transportWindow();
+ if (w) {
+ w->resize(config.geometryTransport.size());
+ w->move(config.geometryTransport.topLeft());
+ }
+ //w = muse->mixerWindow();
+ //if (w) {
+ // w->resize(config.geometryMixer.size());
+ // w->move(config.geometryMixer.topLeft());
+ // }
+ w = muse->mixer1Window();
+ if (w) {
+ w->resize(config.mixer1.geometry.size());
+ w->move(config.mixer1.geometry.topLeft());
+ }
+ w = muse->mixer2Window();
+ if (w) {
+ w->resize(config.mixer2.geometry.size());
+ w->move(config.mixer2.geometry.topLeft());
+ }
+ w = muse->bigtimeWindow();
+ if (w) {
+ w->resize(config.geometryBigTime.size());
+ w->move(config.geometryBigTime.topLeft());
+ }
+ muse->resize(config.geometryMain.size());
+ muse->move(config.geometryMain.topLeft());
+
+ muse->setHeartBeat(); // set guiRefresh
+ midiSeq->msgSetRtc(); // set midi tick rate
+ muse->changeConfig(true); // save settings
+ }
+
+//---------------------------------------------------------
+// ok
+//---------------------------------------------------------
+
+void GlobalSettingsConfig::ok()
+ {
+ apply();
+ close();
+ }
+
+//---------------------------------------------------------
+// cancel
+//---------------------------------------------------------
+
+void GlobalSettingsConfig::cancel()
+ {
+ close();
+ }
+
+//---------------------------------------------------------
+// mixerCurrent
+//---------------------------------------------------------
+
+void GlobalSettingsConfig::mixerCurrent()
+ {
+ QWidget* w = muse->mixer1Window();
+ if (!w)
+ return;
+ QRect r(w->frameGeometry());
+ mixerX->setValue(r.x());
+ mixerY->setValue(r.y());
+ mixerW->setValue(r.width());
+ mixerH->setValue(r.height());
+ }
+
+//---------------------------------------------------------
+// mixer2Current
+//---------------------------------------------------------
+
+void GlobalSettingsConfig::mixer2Current()
+ {
+ QWidget* w = muse->mixer2Window();
+ if (!w)
+ return;
+ QRect r(w->frameGeometry());
+ mixer2X->setValue(r.x());
+ mixer2Y->setValue(r.y());
+ mixer2W->setValue(r.width());
+ mixer2H->setValue(r.height());
+ }
+
+//---------------------------------------------------------
+// bigtimeCurrent
+//---------------------------------------------------------
+
+void GlobalSettingsConfig::bigtimeCurrent()
+ {
+ QWidget* w = muse->bigtimeWindow();
+ if (!w)
+ return;
+ QRect r(w->frameGeometry());
+ bigtimeX->setValue(r.x());
+ bigtimeY->setValue(r.y());
+ bigtimeW->setValue(r.width());
+ bigtimeH->setValue(r.height());
+ }
+
+//---------------------------------------------------------
+// arrangerCurrent
+//---------------------------------------------------------
+
+void GlobalSettingsConfig::arrangerCurrent()
+ {
+ QRect r(muse->frameGeometry());
+ arrangerX->setValue(r.x());
+ arrangerY->setValue(r.y());
+ arrangerW->setValue(r.width());
+ arrangerH->setValue(r.height());
+ }
+
+//---------------------------------------------------------
+// transportCurrent
+//---------------------------------------------------------
+
+void GlobalSettingsConfig::transportCurrent()
+ {
+ QWidget* w = muse->transportWindow();
+ if (!w)
+ return;
+ QRect r(w->frameGeometry());
+ transportX->setValue(r.x());
+ transportY->setValue(r.y());
+ }
+
diff --git a/muse2/muse/widgets/genset.h b/muse2/muse/widgets/genset.h
new file mode 100644
index 00000000..375cf197
--- /dev/null
+++ b/muse2/muse/widgets/genset.h
@@ -0,0 +1,41 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: genset.h,v 1.3 2004/01/25 09:55:17 wschweer Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __GENSET_H__
+#define __GENSET_H__
+
+#include "gensetbase.h"
+//Added by qt3to4:
+#include <QShowEvent>
+
+//---------------------------------------------------------
+// GlobalSettingsConfig
+//---------------------------------------------------------
+
+class GlobalSettingsConfig : public GlobalSettingsDialogBase {
+ Q_OBJECT
+
+ private slots:
+ void updateSettings();
+ void apply();
+ void ok();
+ void cancel();
+ void mixerCurrent();
+ void mixer2Current();
+ void bigtimeCurrent();
+ void arrangerCurrent();
+ void transportCurrent();
+
+ protected:
+ void showEvent(QShowEvent*);
+
+ public:
+ GlobalSettingsConfig(QWidget* parent=0, const char* name=0);
+ };
+
+#endif
diff --git a/muse2/muse/widgets/gensetbase.ui b/muse2/muse/widgets/gensetbase.ui
new file mode 100644
index 00000000..5de2dbd7
--- /dev/null
+++ b/muse2/muse/widgets/gensetbase.ui
@@ -0,0 +1,1470 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>GlobalSettingsDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>GlobalSettingsDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>494</width>
+ <height>499</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Global Settings</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>TabWidget2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Application</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>groupBox4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Views</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSpinBox" row="1" column="3">
+ <property name="name">
+ <cstring>transportY</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>y-pos</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>showTransport</cstring>
+ </property>
+ <property name="text">
+ <string>show</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="2">
+ <property name="name">
+ <cstring>transportX</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>x-pos</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="5">
+ <property name="name">
+ <cstring>arrangerH</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>height</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="4">
+ <property name="name">
+ <cstring>arrangerW</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>width</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="3">
+ <property name="name">
+ <cstring>arrangerY</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>y-pos</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="2">
+ <property name="name">
+ <cstring>arrangerX</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>x-pos</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="1">
+ <property name="name">
+ <cstring>showBigtime</cstring>
+ </property>
+ <property name="text">
+ <string>show</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="2">
+ <property name="name">
+ <cstring>bigtimeX</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>x-pos</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="3">
+ <property name="name">
+ <cstring>bigtimeY</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>y-pos</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="4">
+ <property name="name">
+ <cstring>bigtimeW</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>width</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="5">
+ <property name="name">
+ <cstring>bigtimeH</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>height</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="1">
+ <property name="name">
+ <cstring>showMixer</cstring>
+ </property>
+ <property name="text">
+ <string>show</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="1">
+ <property name="name">
+ <cstring>showMixer2</cstring>
+ </property>
+ <property name="text">
+ <string>show</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Mixer A</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel4_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Mixer B</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Big Time</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Arranger</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Transport</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="5">
+ <property name="name">
+ <cstring>mixerH</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>height</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="4">
+ <property name="name">
+ <cstring>mixerW</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>width</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="3">
+ <property name="name">
+ <cstring>mixerY</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>y-pos</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="2">
+ <property name="name">
+ <cstring>mixerX</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>x-pos</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="3" column="6">
+ <property name="name">
+ <cstring>setMixerCurrent</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Cur</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>set current values</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="4" column="5">
+ <property name="name">
+ <cstring>mixer2H</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>height</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="4" column="4">
+ <property name="name">
+ <cstring>mixer2W</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>width</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="4" column="3">
+ <property name="name">
+ <cstring>mixer2Y</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>y-pos</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="4" column="2">
+ <property name="name">
+ <cstring>mixer2X</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>x-pos</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="4" column="6">
+ <property name="name">
+ <cstring>setMixer2Current</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Cur</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>set current values</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="6">
+ <property name="name">
+ <cstring>setBigtimeCurrent</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Cur</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>set current values</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="6">
+ <property name="name">
+ <cstring>setArrangerCurrent</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Cur</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>set current values</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="6">
+ <property name="name">
+ <cstring>setTransportCurrent</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Cur</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>set current values</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Start Muse</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>9</number>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>showSplash</cstring>
+ </property>
+ <property name="text">
+ <string>show splash screen</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>showDidYouKnow</cstring>
+ </property>
+ <property name="text">
+ <string>show "Did you know?" dialog</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>spacer7_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>51</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>start song:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>startSongEntry</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QButtonGroup" row="0" column="0">
+ <property name="name">
+ <cstring>startSongGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Start song</string>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>startLastButton</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>13</x>
+ <y>12</y>
+ <width>222</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>start with last song</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>startEmptyButton</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>13</x>
+ <y>38</y>
+ <width>222</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>start with template: default.med</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>startSongButton</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>13</x>
+ <y>64</y>
+ <width>222</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>start with song</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>2</number>
+ </property>
+ </widget>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Audio</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>GroupBox4</cstring>
+ </property>
+ <property name="title">
+ <string>Mixer</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QSpinBox" row="0" column="1">
+ <property name="name">
+ <cstring>minSliderSelect</cstring>
+ </property>
+ <property name="suffix">
+ <string>dB</string>
+ </property>
+ <property name="maxValue">
+ <number>0</number>
+ </property>
+ <property name="minValue">
+ <number>-100</number>
+ </property>
+ <property name="lineStep">
+ <number>10</number>
+ </property>
+ <property name="value">
+ <number>-60</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>min. Meter Value</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>min. Slider Val</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="1">
+ <property name="name">
+ <cstring>minMeterSelect</cstring>
+ </property>
+ <property name="suffix">
+ <string>dB</string>
+ </property>
+ <property name="maxValue">
+ <number>0</number>
+ </property>
+ <property name="minValue">
+ <number>-100</number>
+ </property>
+ <property name="lineStep">
+ <number>10</number>
+ </property>
+ <property name="value">
+ <number>-60</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>freewheelLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Use Jack freewheel mode if possible.
+(Speeds up bounce operations).</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="1">
+ <property name="name">
+ <cstring>denormalCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="1">
+ <property name="name">
+ <cstring>freewheelCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel1_5</cstring>
+ </property>
+ <property name="text">
+ <string>Enable denormal protection</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel1_5_2</cstring>
+ </property>
+ <property name="text">
+ <string>Enable output limiter</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="1">
+ <property name="name">
+ <cstring>outputLimiterCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>vstInPlaceTextLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Enable in-place processing for VST plugins.
+(Requires restart.)</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="5" column="1">
+ <property name="name">
+ <cstring>vstInPlaceCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Turn this off if VST Ladspa effect rack plugins do not work or feedback loudly, even if they are supposed to be in-place capable.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>groupBox13</cstring>
+ </property>
+ <property name="title">
+ <string>External Waveditor</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>External Waveditor command</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer13</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>60</width>
+ <height>23</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>externalWavEditorSelect</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>2</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_6</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>8</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Note: External editor opened from the internal editor.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="2" column="0">
+ <property name="name">
+ <cstring>dummyAudioGroupBox</cstring>
+ </property>
+ <property name="title">
+ <string>Dummy Audio Driver (settings require restart)</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>dummyAudioRateLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Preferred sample rate</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="1">
+ <property name="name">
+ <cstring>dummyAudioRate</cstring>
+ </property>
+ <property name="suffix">
+ <string>Hz</string>
+ </property>
+ <property name="maxValue">
+ <number>200000</number>
+ </property>
+ <property name="minValue">
+ <number>3000</number>
+ </property>
+ <property name="lineStep">
+ <number>10</number>
+ </property>
+ <property name="value">
+ <number>44100</number>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Actual rate used depends on limitations of
+ timer used. If a high rate timer is available,
+ short periods can be used with high sample rates.
+Period affects midi playback resolution.
+Shorter periods are desirable.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>dummyAudioRealRateLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Actual rate used now (dummy or not):</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>dummyAudioRealRate</cstring>
+ </property>
+ <property name="text">
+ <string>---</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>dummyAudioSizeLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Period size (Frames per period):</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="1">
+ <item>
+ <property name="text">
+ <string>16</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>32</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>64</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>128</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>256</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>512</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>1024</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>2048</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>dummyAudioSize</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Midi</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Ticks</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>RTC Resolution
+(Ticks/Sec)</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <item>
+ <property name="text">
+ <string>1024</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>2048</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>4096</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>8192</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>16384</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>32768</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>rtcResolutionSelect</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>midiResLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Midi Resolution
+(Ticks/Quarternote)</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>48</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>96</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>192</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>384</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>768</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>1536</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>3072</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>6144</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>12288</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>midiDivisionSelect</cstring>
+ </property>
+ <property name="currentItem">
+ <number>3</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Displayed Resolution
+(Ticks/Quarternote)</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="1">
+ <item>
+ <property name="text">
+ <string>48</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>96</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>192</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>384</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>768</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>1536</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>3072</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>6144</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>12288</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>guiDivisionSelect</cstring>
+ </property>
+ <property name="currentItem">
+ <number>3</number>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>GUI</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Help Browser:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>GUI Refresh Rate</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="3" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>guiRefreshSelect</cstring>
+ </property>
+ <property name="suffix">
+ <string>/sec</string>
+ </property>
+ <property name="maxValue">
+ <number>100</number>
+ </property>
+ <property name="minValue">
+ <number>2</number>
+ </property>
+ <property name="value">
+ <number>20</number>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>helpBrowser</cstring>
+ </property>
+ </widget>
+ <spacer row="4" column="0">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>240</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="4" column="4">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>240</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QCheckBox" row="2" column="5">
+ <property name="name">
+ <cstring>oldStyleStopCheckBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="5">
+ <property name="name">
+ <cstring>moveArmedCheckBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <spacer row="2" column="2" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>270</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>textLabel1_4</cstring>
+ </property>
+ <property name="text">
+ <string>Use old-style stop shortcut:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>textLabel1_4_2</cstring>
+ </property>
+ <property name="text">
+ <string>Move single armed track with selection</string>
+ </property>
+ </widget>
+ <spacer row="3" column="3" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer7_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>210</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>applyButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Apply</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Ok</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/header.cpp b/muse2/muse/widgets/header.cpp
new file mode 100644
index 00000000..6cbf9c3a
--- /dev/null
+++ b/muse2/muse/widgets/header.cpp
@@ -0,0 +1,62 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: header.cpp,v 1.1.1.1 2003/10/27 18:55:05 wschweer Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "header.h"
+#include "xml.h"
+#include <qstringlist.h>
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void Header::readStatus(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::Text:
+ {
+ QStringList l = QStringList::split(QString(" "), tag);
+ int index = count();
+ for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
+ int section = (*it).toInt();
+ moveSection(section, index);
+ --index;
+ }
+ }
+ break;
+ case Xml::TagStart:
+ xml.unknown("Header");
+ break;
+ case Xml::TagEnd:
+ if (tag == name())
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void Header::writeStatus(int level, Xml& xml) const
+ {
+ //xml.nput(level, "<%s> ", name());
+ xml.nput(level, "<%s> ", Xml::xmlString(name()).latin1());
+ int n = count() - 1;
+ for (int i = n; i >= 0; --i)
+ xml.nput("%d ", mapToSection(i));
+ //xml.put("</%s>", name());
+ xml.put("</%s>", Xml::xmlString(name()).latin1());
+ }
+
diff --git a/muse2/muse/widgets/header.h b/muse2/muse/widgets/header.h
new file mode 100644
index 00000000..11b69b66
--- /dev/null
+++ b/muse2/muse/widgets/header.h
@@ -0,0 +1,30 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: header.h,v 1.1.1.1 2003/10/27 18:55:03 wschweer Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __HEADER_H__
+#define __HEADER_H__
+
+#include <q3header.h>
+
+class Xml;
+
+//---------------------------------------------------------
+// Header
+//---------------------------------------------------------
+
+class Header : public Q3Header {
+ Q_OBJECT
+
+ public:
+ Header(QWidget* parent=0, const char* name=0)
+ : Q3Header(parent, name) {}
+ Header(int sections, QWidget* parent=0, const char* name=0)
+ : Q3Header(sections, parent, name) {}
+ void writeStatus(int level, Xml&) const;
+ void readStatus(Xml&);
+ };
+#endif
diff --git a/muse2/muse/widgets/hitscale.cpp b/muse2/muse/widgets/hitscale.cpp
new file mode 100644
index 00000000..2d7c5267
--- /dev/null
+++ b/muse2/muse/widgets/hitscale.cpp
@@ -0,0 +1,134 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: hitscale.cpp,v 1.3.2.1 2007/01/27 14:52:43 spamatica Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "hitscale.h"
+#include "midieditor.h"
+#include <qpainter.h>
+//Added by qt3to4:
+#include <QEvent>
+#include <QMouseEvent>
+
+#include "song.h"
+
+//---------------------------------------------------------
+// HitScale
+//---------------------------------------------------------
+
+HitScale::HitScale(int* r, QWidget* parent, int xs)
+ : View(parent, xs, 1)
+ {
+ raster = r;
+ pos[0] = song->cpos();
+ pos[1] = song->lpos();
+ pos[2] = song->rpos();
+ button = Qt::NoButton;
+ setMouseTracking(true);
+ connect(song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool)));
+ setFixedHeight(18);
+ }
+
+//---------------------------------------------------------
+// setPos
+//---------------------------------------------------------
+
+void HitScale::setPos(int idx, unsigned val, bool)
+ {
+ if (val == pos[idx])
+ return;
+ unsigned int opos = mapx(pos[idx]); // in order preventing comparison of sigend & unsigned int ??is this OK?
+ pos[idx] = val;
+ if (!isVisible())
+ return;
+ val = mapx(val);
+ int x = -9;
+ int w = 18;
+ if (opos > val) { //here would be the comparison signed/unsigned
+ w += opos - val;
+ x += val;
+ }
+ else {
+ w += val - opos;
+ x += opos;
+ }
+ paint(QRect(x, 0, w, height()));
+ }
+
+void HitScale::viewMousePressEvent(QMouseEvent* event)
+ {
+ button = event->button();
+ viewMouseMoveEvent(event);
+ }
+
+void HitScale::viewMouseReleaseEvent(QMouseEvent*)
+ {
+ button = Qt::NoButton;
+ }
+
+void HitScale::viewMouseMoveEvent(QMouseEvent* event)
+ {
+ int x = sigmap.raster(event->x(), *raster);
+ emit timeChanged(x);
+ int i;
+ switch (button) {
+ case Qt::LeftButton:
+ i = 0;
+ break;
+ case Qt::MidButton:
+ i = 1;
+ break;
+ case Qt::RightButton:
+ i = 2;
+ break;
+ default:
+ return;
+ }
+ Pos p(x, true);
+ song->setPos(i, p);
+ }
+
+//---------------------------------------------------------
+// leaveEvent
+//---------------------------------------------------------
+
+void HitScale::leaveEvent(QEvent*)
+ {
+ emit timeChanged(-1);
+ }
+
+//---------------------------------------------------------
+// draw
+//---------------------------------------------------------
+
+void HitScale::pdraw(QPainter& p, const QRect& r)
+ {
+ int x = r.x();
+ int w = r.width();
+
+// x -= 10;
+// w += 20;
+
+ if (x < 0)
+ x = 0;
+
+ //---------------------------------------------------
+ // draw location marker
+ //---------------------------------------------------
+
+ p.setPen(Qt::red);
+ int xp = mapx(pos[0]);
+ if (xp >= x && xp < x+w)
+ p.drawLine(xp, 0, xp, height());
+ p.setPen(Qt::blue);
+ xp = mapx(pos[1]);
+ if (xp >= x && xp < x+w)
+ p.drawLine(xp, 0, xp, height());
+ xp = mapx(pos[2]);
+ if (xp >= x && xp < x+w)
+ p.drawLine(xp, 0, xp, height());
+ }
+
+
diff --git a/muse2/muse/widgets/hitscale.h b/muse2/muse/widgets/hitscale.h
new file mode 100644
index 00000000..85711e71
--- /dev/null
+++ b/muse2/muse/widgets/hitscale.h
@@ -0,0 +1,50 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: hitscale.h,v 1.2 2004/01/11 18:55:37 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __HITSCALE_H__
+#define __HITSCALE_H__
+
+#include "view.h"
+//Added by qt3to4:
+#include <QEvent>
+#include <QMouseEvent>
+
+class QPainter;
+class MidiEditor;
+
+//---------------------------------------------------------
+// HitScale
+// scale for midi track
+//---------------------------------------------------------
+
+class HitScale : public View {
+ Q_OBJECT
+ int* raster;
+ unsigned pos[3];
+ int button;
+
+ signals:
+// void posChanged(int, int);
+
+ protected:
+ virtual void pdraw(QPainter&, const QRect&);
+ virtual void viewMousePressEvent(QMouseEvent* event);
+ virtual void viewMouseMoveEvent(QMouseEvent* event);
+ virtual void viewMouseReleaseEvent(QMouseEvent* event);
+ virtual void leaveEvent(QEvent*e);
+
+ signals:
+ void timeChanged(int);
+
+ public slots:
+ void setPos(int, unsigned, bool);
+
+ public:
+ HitScale(int* raster, QWidget* parent, int xscale);
+ };
+#endif
+
diff --git a/muse2/muse/widgets/intlabel.cpp b/muse2/muse/widgets/intlabel.cpp
new file mode 100644
index 00000000..8835e79d
--- /dev/null
+++ b/muse2/muse/widgets/intlabel.cpp
@@ -0,0 +1,144 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: intlabel.cpp,v 1.1.1.1.2.1 2008/08/18 00:15:26 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+
+#include "intlabel.h"
+#include <qvalidator.h>
+#include <qpalette.h>
+#include <stdio.h>
+
+#include "utils.h"
+
+//---------------------------------------------------------
+// IntLabel
+//---------------------------------------------------------
+
+IntLabel::IntLabel(int _val, int _min, int _max, QWidget* parent,
+ int _off, const QString& str, int lPos)
+ : Nentry(parent, str, lPos)
+ {
+ specialValue = "off";
+ min = _min;
+ max = _max;
+ val = _val+1; // dont optimize away
+ off = _off;
+ setValue(_val);
+ int len = num2cols(min, max);
+ setSize(len);
+ }
+
+void IntLabel::setSpecialValueText(const QString& s)
+ {
+ specialValue = s;
+ setString(val);
+ }
+
+//---------------------------------------------------------
+// setRange
+//---------------------------------------------------------
+
+void IntLabel::setRange(int mn, int mx)
+{
+ min = mn;
+ max = mx;
+ setSize(num2cols(min, max));
+ int v = val;
+ if(val < mn)
+ v = mn;
+ else
+ if(val > mx)
+ v = mx;
+ setValue(v);
+}
+
+//---------------------------------------------------------
+// setString
+//---------------------------------------------------------
+
+bool IntLabel::setString(int v, bool editable)
+ {
+ if (v < min || v > max) {
+ setText(QString("---"));
+ return true;
+ }
+ else if (v == off) {
+ if (editable)
+ setText(QString(""));
+ else
+ setText(specialValue);
+ }
+ else {
+ QString s;
+ s.setNum(v);
+ if (!editable)
+ s += suffix;
+ setText(s);
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// setSValue
+//---------------------------------------------------------
+
+bool IntLabel::setSValue(const QString& s)
+ {
+ int v;
+ if (s == specialValue)
+ v = off;
+ else {
+ bool ok;
+ v = s.toInt(&ok);
+ if (!ok)
+ return true;
+ if (v < min)
+ v = min;
+ if (v > max)
+ v = max;
+ }
+ if (v != val) {
+ setValue(v);
+ emit valueChanged(val);
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// incValue
+//---------------------------------------------------------
+
+void IntLabel::incValue(int)
+ {
+ if (val < max) {
+ setValue(val+1);
+ emit valueChanged(val);
+ }
+ }
+
+//---------------------------------------------------------
+// decValue
+//---------------------------------------------------------
+
+void IntLabel::decValue(int)
+ {
+ if (val > min) {
+ setValue(val-1);
+ emit valueChanged(val);
+ }
+ }
+
+//---------------------------------------------------------
+// setOff
+//---------------------------------------------------------
+
+void IntLabel::setOff(int v)
+ {
+ off = v;
+ setString(val);
+ }
+
diff --git a/muse2/muse/widgets/intlabel.h b/muse2/muse/widgets/intlabel.h
new file mode 100644
index 00000000..df452891
--- /dev/null
+++ b/muse2/muse/widgets/intlabel.h
@@ -0,0 +1,46 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: intlabel.h,v 1.1.1.1.2.2 2008/08/18 00:15:26 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __INTLABEL_H__
+#define __INTLABEL_H__
+
+#include <values.h>
+#include "nentry.h"
+
+class QString;
+
+//---------------------------------------------------------
+// IntLabel
+//---------------------------------------------------------
+
+class IntLabel : public Nentry {
+ Q_OBJECT
+
+ int min, max, off;
+ QString suffix;
+ QString specialValue;
+
+ void init();
+
+ virtual bool setSValue(const QString&);
+ virtual bool setString(int val, bool editable = false);
+ virtual void incValue(int);
+ virtual void decValue(int);
+
+ signals:
+ void valueChanged(int);
+
+ public:
+ IntLabel(int, int, int, QWidget*, int _off = MAXINT,
+ const QString& = QString(""), int lpos = 0);
+ void setOff(int v);
+ void setSuffix(const QString& s) { suffix = s; }
+ void setSpecialValueText(const QString& s);
+ void setRange(int, int);
+ };
+
+#endif
diff --git a/muse2/muse/widgets/itransformbase.ui b/muse2/muse/widgets/itransformbase.ui
new file mode 100644
index 00000000..1c4a9387
--- /dev/null
+++ b/muse2/muse/widgets/itransformbase.ui
@@ -0,0 +1,1296 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>MidiInputTransformDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MidiInputTransformDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>760</width>
+ <height>587</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Midi Input Transformator</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QGroupBox" row="0" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>GroupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Filter</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QComboBox" row="1" column="0">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Equal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Unequal</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>selEventOp</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="0">
+ <item>
+ <property name="text">
+ <string>Note</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Poly Pressure</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Control Change</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Aftertouch</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Pitch Bend</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>NRPN</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>RPN</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>selType</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Value 2</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Value 1</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Event Type</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>Ignore</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Equal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Unequal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Higher</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Lower</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Inside</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Outside</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>selVal1Op</cstring>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="1">
+ <property name="name">
+ <cstring>selVal1b</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="2">
+ <property name="name">
+ <cstring>selVal2b</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="1">
+ <property name="name">
+ <cstring>selVal1a</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="2">
+ <item>
+ <property name="text">
+ <string>Ignore</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Equal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Unequal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Higher</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Lower</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Inside</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Outside</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>selVal2Op</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="3">
+ <item>
+ <property name="text">
+ <string>Ignore</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Equal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Unequal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Higher</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Lower</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Inside</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Outside</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>selPortOp</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="4">
+ <item>
+ <property name="text">
+ <string>Ignore</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Equal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Unequal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Higher</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Lower</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Inside</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Outside</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>selChannelOp</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="4">
+ <property name="name">
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Channel</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="3">
+ <property name="name">
+ <cstring>TextLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>Port</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="2">
+ <property name="name">
+ <cstring>selVal2a</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="4">
+ <property name="name">
+ <cstring>selChannelVala</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="3">
+ <property name="name">
+ <cstring>selPortVala</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="4">
+ <property name="name">
+ <cstring>selChannelValb</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="3">
+ <property name="name">
+ <cstring>selPortValb</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="1" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>GroupBox5</cstring>
+ </property>
+ <property name="title">
+ <string>Processing</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Event Type</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="0">
+ <item>
+ <property name="text">
+ <string>Keep</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Fix</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>procEventOp</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="0">
+ <item>
+ <property name="text">
+ <string>Poly Pressure</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Control Change</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Aftertouch</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Pitch Bend</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>NRPN</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>RPN</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>procType</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>Keep</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Plus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Minus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Multiply</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Divide</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Fix</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Value 2</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Invert</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>ScaleMap</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Flip</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Dyn</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Random</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>procVal1Op</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>TextLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Value 1</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>TextLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>Value 2</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="1">
+ <property name="name">
+ <cstring>procVal1b</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="2">
+ <property name="name">
+ <cstring>procVal2b</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ </widget>
+ <widget class="SpinBoxFP" row="2" column="1">
+ <property name="name">
+ <cstring>procVal1a</cstring>
+ </property>
+ <property name="maxValue" stdset="0">
+ <number>99999999</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="4">
+ <property name="name">
+ <cstring>procChannelValb</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="3">
+ <property name="name">
+ <cstring>procPortValb</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="3">
+ <property name="name">
+ <cstring>TextLabel1_3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Port</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="2">
+ <item>
+ <property name="text">
+ <string>Keep</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Plus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Minus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Multiply</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Divide</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Fix</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Value 1</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Invert</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Dyn</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Random</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>procVal2Op</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="4">
+ <item>
+ <property name="text">
+ <string>Keep</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Plus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Minus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Multiply</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Divide</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Fix</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Value 1</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Invert</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Dyn</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Random</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>procChannelOp</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="3">
+ <item>
+ <property name="text">
+ <string>Keep</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Plus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Minus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Multiply</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Divide</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Fix</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Value 1</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Invert</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Dyn</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Random</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>procPortOp</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="4">
+ <property name="name">
+ <cstring>TextLabel2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Channel</string>
+ </property>
+ </widget>
+ <widget class="SpinBoxFP" row="2" column="2">
+ <property name="name">
+ <cstring>procVal2a</cstring>
+ </property>
+ <property name="maxValue" stdset="0">
+ <number>99999999</number>
+ </property>
+ </widget>
+ <widget class="SpinBoxFP" row="2" column="3">
+ <property name="name">
+ <cstring>procPortVala</cstring>
+ </property>
+ <property name="maxValue" stdset="0">
+ <number>99999999</number>
+ </property>
+ </widget>
+ <widget class="SpinBoxFP" row="2" column="4">
+ <property name="name">
+ <cstring>procChannelVala</cstring>
+ </property>
+ <property name="maxValue" stdset="0">
+ <number>99999999</number>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="2" column="2">
+ <property name="name">
+ <cstring>GroupBox5_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Modules</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QButtonGroup" row="0" column="0" rowspan="4" colspan="1">
+ <property name="name">
+ <cstring>modulGroup</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>modul1select</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="on">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>modul2select</cstring>
+ </property>
+ <property name="text">
+ <string>2</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>modul3select</cstring>
+ </property>
+ <property name="text">
+ <string>3</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>2</number>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>modul4select</cstring>
+ </property>
+ <property name="text">
+ <string>4</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>3</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QCheckBox" row="0" column="1">
+ <property name="name">
+ <cstring>modul1enable</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>enable modul 1</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>modul2enable</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>enable modul 2</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="1">
+ <property name="name">
+ <cstring>modul3enable</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>enable modul 3</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="1">
+ <property name="name">
+ <cstring>modul4enable</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>enable modul 4</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="2" column="1">
+ <property name="name">
+ <cstring>GroupBox6_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Preset</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout5_3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel13_2</cstring>
+ </property>
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>nameEntry</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel14_2</cstring>
+ </property>
+ <property name="text">
+ <string>Comment:</string>
+ </property>
+ </widget>
+ <widget class="QMultiLineEdit">
+ <property name="name">
+ <cstring>commentEntry</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox" row="2" column="3">
+ <property name="name">
+ <cstring>GroupBox7_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Function</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>funcOp</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonNew</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;New</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>create new preset</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonDelete</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Delete</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>delete preset</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Dismiss</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="0" rowspan="3" colspan="1">
+ <property name="name">
+ <cstring>Layout7</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>PresetList</string>
+ </property>
+ </widget>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>presetList</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>SpinBoxFP</class>
+ <header location="global">spinboxFP.h</header>
+ <sizehint>
+ <width>50</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ <signal>valueChanged(int value)</signal>
+ <signal>valueChanged(const QString&amp;)</signal>
+ <slot access="public" specifier="">setValue(int)</slot>
+ <slot access="public" specifier="">setPrefix(const QString&amp;)</slot>
+ <slot access="public" specifier="">setSuffix(const QString&amp;)</slot>
+ <slot access="public" specifier="">stepUp()</slot>
+ <slot access="public" specifier="">stepDown()</slot>
+ <property type="Int">precision</property>
+ <property type="Int">minValue</property>
+ <property type="Int">maxValue</property>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MidiInputTransformDialogBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>selEventOp</tabstop>
+ <tabstop>selType</tabstop>
+ <tabstop>selVal1Op</tabstop>
+ <tabstop>selVal1a</tabstop>
+ <tabstop>selVal1b</tabstop>
+ <tabstop>selVal2Op</tabstop>
+ <tabstop>selVal2a</tabstop>
+ <tabstop>selVal2b</tabstop>
+ <tabstop>selPortOp</tabstop>
+ <tabstop>selPortVala</tabstop>
+ <tabstop>selPortValb</tabstop>
+ <tabstop>selChannelOp</tabstop>
+ <tabstop>selChannelVala</tabstop>
+ <tabstop>selChannelValb</tabstop>
+ <tabstop>procEventOp</tabstop>
+ <tabstop>procType</tabstop>
+ <tabstop>procVal1Op</tabstop>
+ <tabstop>procVal1b</tabstop>
+ <tabstop>procVal2Op</tabstop>
+ <tabstop>procVal2b</tabstop>
+ <tabstop>procPortOp</tabstop>
+ <tabstop>procPortValb</tabstop>
+ <tabstop>procChannelOp</tabstop>
+ <tabstop>procChannelValb</tabstop>
+ <tabstop>modul1enable</tabstop>
+ <tabstop>modul2enable</tabstop>
+ <tabstop>modul3enable</tabstop>
+ <tabstop>modul4enable</tabstop>
+ <tabstop>funcOp</tabstop>
+ <tabstop>nameEntry</tabstop>
+ <tabstop>commentEntry</tabstop>
+ <tabstop>presetList</tabstop>
+ <tabstop>buttonNew</tabstop>
+ <tabstop>buttonDelete</tabstop>
+ <tabstop>buttonOk</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>spinboxFP.h</includehint>
+</includehints>
+</UI>
diff --git a/muse2/muse/widgets/knob.cpp b/muse2/muse/widgets/knob.cpp
new file mode 100644
index 00000000..bfc46e77
--- /dev/null
+++ b/muse2/muse/widgets/knob.cpp
@@ -0,0 +1,506 @@
+//======================================================================
+// MusE
+// Linux Music Editor
+// $Id: knob.cpp,v 1.3.2.3 2009/03/09 02:05:18 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//
+// Adapted from Qwt Lib:
+// Copyright (C) 1997 Josef Wilgen
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2,
+// as published by the Free Software Foundation.
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//=========================================================
+
+#include <stdio.h>
+#include "knob.h"
+#include <cmath>
+#include "mmath.h"
+
+#include <qpainter.h>
+#include <qpalette.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+#include <QResizeEvent>
+
+//---------------------------------------------------------
+// The QwtKnob widget imitates look and behaviour of a volume knob on a radio.
+// It contains
+// a scale around the knob which is set up automatically or can
+// be configured manually (see @^QwtScaleIf@).
+// Automatic scrolling is enabled when the user presses a mouse
+// button on the scale. For a description of signals, slots and other
+// members, see QwtSliderBase@.
+//---------------------------------------------------------
+
+
+//---------------------------------------------------------
+// Knob
+//---------------------------------------------------------
+
+Knob::Knob(QWidget* parent, const char* name)
+ : SliderBase(parent, name)
+ {
+ hasScale = false;
+
+ d_borderWidth = 2;
+ d_borderDist = 4;
+ d_totalAngle = 270.0;
+ d_scaleDist = 1;
+ d_symbol = Line;
+ d_maxScaleTicks = 11;
+ d_knobWidth = 30;
+ _faceColSel = FALSE;
+ d_faceColor = backgroundColor();
+ d_curFaceColor = d_faceColor;
+ d_altFaceColor = d_faceColor;
+ d_markerColor = foregroundColor();
+ d_dotWidth = 8;
+
+ setMinimumSize(30,30);
+ setUpdateTime(50);
+ }
+
+//------------------------------------------------------------
+// QwtKnob::setTotalAngle
+// Set the total angle by which the knob can be turned
+//
+// Syntax
+// void QwtKnob::setTotalAngle(double angle)
+//
+// Parameters
+// double angle -- angle in degrees.
+//
+// Description
+// The default angle is 270 degrees. It is possible to specify
+// an angle of more than 360 degrees so that the knob can be
+// turned several times around its axis.
+//------------------------------------------------------------
+
+void Knob::setTotalAngle (double angle)
+ {
+ if (angle < 10.0)
+ d_totalAngle = 10.0;
+ else
+ d_totalAngle = angle;
+ d_scale.setAngleRange( -0.5 * d_totalAngle, 0.5 * d_totalAngle);
+ }
+
+//------------------------------------------------------------
+// QwtKnob::drawKnob
+// const QRect &r -- borders of the knob
+//------------------------------------------------------------
+
+void Knob::drawKnob(QPainter* p, const QRect& r)
+ {
+ QRect aRect;
+
+ QColorGroup g = colorGroup();
+ QPen pn;
+ int bw2 = d_borderWidth / 2;
+
+ aRect.setRect(r.x() + bw2,
+ r.y() + bw2,
+ r.width() - 2*bw2,
+ r.height() - 2*bw2);
+
+ //
+ // draw button face
+ //
+ p->setPen(Qt::NoPen);
+ p->setBrush(d_curFaceColor);
+ p->drawEllipse(aRect);
+
+ //
+ // draw button shades
+ //
+ pn.setWidth(d_borderWidth);
+
+
+ pn.setColor(g.light());
+ p->setPen(pn);
+ p->drawArc(aRect, 45*16,180*16);
+
+ pn.setColor(g.dark());
+ p->setPen(pn);
+ p->drawArc(aRect, 225*16,180*16);
+
+ //
+ // draw marker
+ //
+ drawMarker(p, d_angle, d_markerColor);
+ }
+
+//------------------------------------------------------------
+//.F QwtSliderBase::valueChange
+// Notify change of value
+//
+//.u Parameters
+// double x -- new value
+//
+//.u Description
+// Sets the slider's value to the nearest multiple
+// of the step size.
+//------------------------------------------------------------
+
+void Knob::valueChange()
+ {
+ recalcAngle();
+ d_newVal++;
+ repaint(kRect, FALSE);
+ SliderBase::valueChange();
+ }
+
+//------------------------------------------------------------
+//.F QwtKnob::getValue
+// Determine the value corresponding to a specified position
+//
+//.u Parameters:
+// const QPoint &p -- point
+//
+//.u Description:
+// Called by QwtSliderBase
+//------------------------------------------------------------
+
+double Knob::getValue(const QPoint &p)
+ {
+ double newValue;
+ double oneTurn;
+ double eqValue;
+ double arc;
+
+ const QRect& r = rect();
+
+ double dx = double((r.x() + r.width() / 2) - p.x() );
+ double dy = double((r.y() + r.height() / 2) - p.y() );
+
+ arc = atan2(-dx,dy) * 180.0 / M_PI;
+
+ newValue = 0.5 * (minValue() + maxValue())
+ + (arc + d_nTurns * 360.0) * (maxValue() - minValue())
+ / d_totalAngle;
+
+ oneTurn = fabs(maxValue() - minValue()) * 360.0 / d_totalAngle;
+ eqValue = value() + d_mouseOffset;
+
+ if (fabs(newValue - eqValue) > 0.5 * oneTurn)
+ {
+ if (newValue < eqValue)
+ newValue += oneTurn;
+ else
+ newValue -= oneTurn;
+ }
+
+ return newValue;
+
+}
+
+
+
+//------------------------------------------------------------
+//.-
+//.F QwtKnob::setScrollMode
+// Determine the scrolling mode and direction
+// corresponding to a specified position
+//
+//.u Parameters
+// const QPoint &p -- point in question
+//
+//.u Description
+// Called by QwtSliderBase
+//------------------------------------------------------------
+void Knob::getScrollMode( QPoint &p, const Qt::ButtonState &/*button*/, int &scrollMode, int &direction)// prevent compiler warning : unsused parameter
+{
+ int dx, dy, r;
+ double arc;
+
+ /*Qt::ButtonState but= button ;*/ // prevent compiler warning : unsused variable
+ r = kRect.width() / 2;
+
+ dx = kRect.x() + r - p.x();
+ dy = kRect.y() + r - p.y();
+
+ if ( (dx * dx) + (dy * dy) <= (r * r)) // point is inside the knob
+ {
+ scrollMode = ScrMouse;
+ direction = 0;
+ }
+ else // point lies outside
+ {
+ scrollMode = ScrTimer;
+ arc = atan2(double(-dx),double(dy)) * 180.0 / M_PI;
+ if ( arc < d_angle)
+ direction = -1;
+ else if (arc > d_angle)
+ direction = 1;
+ else
+ direction = 0;
+ }
+ return;
+}
+
+
+
+//------------------------------------------------------------
+//.F QwtKnob::rangeChange
+// Notify a change of the range
+//
+//.u Description
+// Called by QwtSliderBase
+//------------------------------------------------------------
+
+void Knob::rangeChange()
+{
+ if (!hasUserScale())
+ {
+ d_scale.setScale(minValue(), maxValue(),
+ d_maxMajor, d_maxMinor);
+ }
+ recalcAngle();
+ resize(size());
+ repaint(FALSE);
+}
+
+//---------------------------------------------------------
+// resizeEvent
+//---------------------------------------------------------
+
+void Knob::resizeEvent(QResizeEvent *)
+ {
+ int width, width_2;
+
+ const QRect& r = rect();
+
+// printf("resize %d %d %d\n", r.height(), r.width(), d_knobWidth);
+
+// width = qwtMin(qwtMin(r.height(), r.width()), d_knobWidth);
+ width = qwtMin(r.height(), r.width());
+ width_2 = width / 2;
+
+ int x = r.x() + r.width() / 2 - width_2;
+ int y = r.y() + r.height() / 2 - width_2;
+
+ kRect.setRect(x, y, width, width);
+
+ x = kRect.x() - d_scaleDist;
+ y = kRect.y() - d_scaleDist;
+ int w = width + 2 * d_scaleDist;
+
+ d_scale.setGeometry(x, y, w, ScaleDraw::Round);
+ }
+
+//------------------------------------------------------------
+// paintEvent
+//------------------------------------------------------------
+
+void Knob::paintEvent(QPaintEvent* e)
+ {
+ QPainter p(this);
+ const QRect &r = e->rect();
+
+ if ((r == kRect) && d_newVal ) { // event from valueChange()
+ if (d_newVal > 1) // lost paintEvents()?
+ drawKnob(&p, kRect);
+ else {
+ drawMarker(&p, d_oldAngle, d_curFaceColor);
+ drawMarker(&p, d_angle, d_markerColor);
+ }
+ }
+ else {
+ p.eraseRect(rect());
+ if (hasScale)
+ d_scale.draw(&p);
+ drawKnob(&p, kRect);
+ }
+ d_newVal = 0;
+ }
+
+//------------------------------------------------------------
+//.-
+//.F QwtKnob::drawMarker
+// Draw the marker at the knob's front
+//
+//.u Parameters
+//.p QPainter *p -- painter
+// double arc -- angle of the marker
+// const QColor &c -- marker color
+//
+//.u Syntax
+// void QwtKnob::drawMarker(QPainter *p)
+//
+//------------------------------------------------------------
+void Knob::drawMarker(QPainter *p, double arc, const QColor &c)
+{
+
+ QPen pn;
+ int radius;
+ double rb,re;
+ double rarc;
+
+ rarc = arc * M_PI / 180.0;
+ double ca = cos(rarc);
+ double sa = - sin(rarc);
+ radius = kRect.width() / 2 - d_borderWidth;
+ if (radius < 3) radius = 3;
+ int ym = kRect.y() + radius + d_borderWidth;
+ int xm = kRect.x() + radius + d_borderWidth;
+
+ switch (d_symbol)
+ {
+ case Dot:
+
+ p->setBrush(c);
+ p->setPen(Qt::NoPen);
+ rb = double(qwtMax(radius - 4 - d_dotWidth / 2, 0));
+ p->drawEllipse(xm - int(rint(sa * rb)) - d_dotWidth / 2,
+ ym - int(rint(ca * rb)) - d_dotWidth / 2,
+ d_dotWidth, d_dotWidth);
+
+ break;
+
+ case Line:
+
+ pn.setColor(c);
+ pn.setWidth(2);
+ p->setPen(pn);
+
+ rb = qwtMax(double((radius - 4) / 3.0), 0.0);
+ re = qwtMax(double(radius - 4), 0.0);
+
+ p->drawLine( xm - int(rint(sa * rb)),
+ ym - int(rint(ca * rb)),
+ xm - int(rint(sa * re)),
+ ym - int(rint(ca * re)));
+
+ break;
+ }
+
+
+}
+
+//------------------------------------------------------------
+//
+//.F QwtKnob::setKnobWidth
+// Change the knob's width.
+//
+//.u Syntax
+//.f void QwtKnob::setKnobWidth(int w)
+//
+//.u Parameters
+//.p int w -- new width
+//
+//.u Description
+// The specified width must be >= 5, or it will be clipped.
+//
+//------------------------------------------------------------
+void Knob::setKnobWidth(int w)
+{
+ d_knobWidth = qwtMax(w,5);
+ resize(size());
+ repaint(FALSE);
+}
+
+//------------------------------------------------------------
+//
+//.F QwtKnob::setBorderWidth
+// Set the knob's border width
+//
+//.u Syntax
+//.f void QwtKnob::setBorderWidth(int bw)
+//
+//.u Parameters
+//.p int bw -- new border width
+//
+//------------------------------------------------------------
+void Knob::setBorderWidth(int bw)
+{
+ d_borderWidth = qwtMax(bw, 0);
+ resize(size());
+ repaint(FALSE);
+}
+
+//------------------------------------------------------------
+//.-
+//.F QwtKnob::recalcAngle
+// Recalculate the marker angle corresponding to the
+// current value
+//
+//.u Syntax
+//.f void QwtKnob::recalcAngle()
+//
+//------------------------------------------------------------
+void Knob::recalcAngle()
+{
+ d_oldAngle = d_angle;
+
+ //
+ // calculate the angle corresponding to the value
+ //
+ if (maxValue() == minValue())
+ {
+ d_angle = 0;
+ d_nTurns = 0;
+ }
+ else
+ {
+ d_angle = (value() - 0.5 * (minValue() + maxValue()))
+ / (maxValue() - minValue()) * d_totalAngle;
+ d_nTurns = floor((d_angle + 180.0) / 360.0);
+ d_angle = d_angle - d_nTurns * 360.0;
+
+ }
+
+}
+
+//------------------------------------------------------------
+// setFaceColor
+//------------------------------------------------------------
+void Knob::setFaceColor(const QColor c)
+{
+ d_faceColor = c;
+ if(!_faceColSel)
+ //update(FALSE);
+ repaint(FALSE);
+}
+
+//------------------------------------------------------------
+// setAltFaceColor
+//------------------------------------------------------------
+void Knob::setAltFaceColor(const QColor c)
+{
+ d_altFaceColor = c;
+ if(_faceColSel)
+ //update(FALSE);
+ repaint(FALSE);
+}
+
+//------------------------------------------------------------
+// selectFaceColor
+//------------------------------------------------------------
+void Knob::selectFaceColor(bool alt)
+{
+ _faceColSel = alt;
+ if(alt)
+ d_curFaceColor = d_altFaceColor;
+ else
+ d_curFaceColor = d_faceColor;
+ //update(FALSE);
+ repaint(FALSE);
+}
+
+//------------------------------------------------------------
+// setMarkerColor
+//------------------------------------------------------------
+void Knob::setMarkerColor(const QColor c)
+{
+ d_markerColor = c;
+ //update(FALSE);
+ repaint(FALSE);
+}
+
diff --git a/muse2/muse/widgets/knob.h b/muse2/muse/widgets/knob.h
new file mode 100644
index 00000000..baaf9a50
--- /dev/null
+++ b/muse2/muse/widgets/knob.h
@@ -0,0 +1,78 @@
+#ifndef QWT_KNOB_H
+#define QWT_KNOB_H
+
+#include <sliderbase.h>
+#include <sclif.h>
+#include <qcolor.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QPaintEvent>
+
+
+//---------------------------------------------------------
+// Knob
+//---------------------------------------------------------
+
+class Knob : public SliderBase, public ScaleIf
+ {
+ Q_OBJECT
+
+ public:
+ enum Symbol { Line, Dot };
+
+ private:
+ bool hasScale;
+
+ int d_borderWidth;
+ int d_borderDist;
+ int d_scaleDist;
+ int d_maxScaleTicks;
+ int d_newVal;
+ int d_knobWidth;
+ int d_dotWidth;
+
+ Symbol d_symbol;
+ double d_angle;
+ double d_oldAngle;
+ double d_totalAngle;
+ double d_nTurns;
+
+ QRect kRect;
+ bool _faceColSel;
+ QColor d_faceColor;
+ QColor d_curFaceColor;
+ QColor d_altFaceColor;
+ QColor d_markerColor;
+
+ void recalcAngle();
+ void valueChange();
+ void rangeChange();
+ void drawKnob(QPainter *p, const QRect &r);
+ void drawMarker(QPainter *p, double arc, const QColor &c);
+
+ void paintEvent(QPaintEvent *e);
+ void resizeEvent(QResizeEvent *e);
+ double getValue(const QPoint &p);
+ void getScrollMode( QPoint &p, const Qt::ButtonState &button, int &scrollMode, int &direction );
+ void scaleChange() { repaint(false); }
+ void fontChange(const QFont &) { repaint(false); }
+
+ public:
+ Knob(QWidget* parent = 0, const char *name = 0);
+ ~Knob() {}
+
+ void setKnobWidth(int w);
+ void setTotalAngle (double angle);
+ void setBorderWidth(int bw);
+ void selectFaceColor(bool alt);
+ bool selectedFaceColor() { return _faceColSel; }
+ QColor faceColor() { return d_faceColor; }
+ void setFaceColor(const QColor c);
+ QColor altFaceColor() { return d_altFaceColor; }
+ void setAltFaceColor(const QColor c);
+ QColor markerColor() { return d_markerColor; }
+ void setMarkerColor(const QColor c);
+ };
+
+
+#endif
diff --git a/muse2/muse/widgets/lcombo.cpp b/muse2/muse/widgets/lcombo.cpp
new file mode 100644
index 00000000..fa647002
--- /dev/null
+++ b/muse2/muse/widgets/lcombo.cpp
@@ -0,0 +1,49 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: lcombo.cpp,v 1.1.1.1.2.3 2009/07/01 22:14:56 spamatica Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "lcombo.h"
+
+#include <qlayout.h>
+#include <q3frame.h>
+#include <qlabel.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+
+//---------------------------------------------------------
+// LabelCombo
+//---------------------------------------------------------
+
+LabelCombo::LabelCombo(const QString& txt, QWidget* parent,
+ const char* name) : QWidget(parent, name)
+ {
+// setFixedHeight(20);
+ Q3HBoxLayout* layout = new Q3HBoxLayout(this);
+ QLabel* label = new QLabel(txt, this);
+ box = new QComboBox(false, this);
+ layout->addStretch();
+ layout->addSpacing(5);
+ layout->addWidget(label);
+ layout->addSpacing(5);
+ layout->addWidget(box);
+ layout->addSpacing(5);
+ layout->addStretch();
+ connect(box, SIGNAL(activated(int)), SIGNAL(activated(int)));
+ }
+
+void LabelCombo::insertItem(const QString& txt, int index)
+ {
+ box->insertItem(txt, index);
+ }
+
+void LabelCombo::clearFocus()
+{
+ box->clearFocus();
+}
+void LabelCombo::setFocusPolicy ( Qt::FocusPolicy fp )
+{
+ box->setFocusPolicy(fp);
+} \ No newline at end of file
diff --git a/muse2/muse/widgets/lcombo.h b/muse2/muse/widgets/lcombo.h
new file mode 100644
index 00000000..f2332847
--- /dev/null
+++ b/muse2/muse/widgets/lcombo.h
@@ -0,0 +1,40 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: lcombo.h,v 1.1.1.1.2.3 2009/07/01 22:14:56 spamatica Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __LCOMBO_H__
+#define __LCOMBO_H__
+
+#include <qwidget.h>
+#include <qcombobox.h>
+
+class QString;
+class Q3ListBox;
+
+//---------------------------------------------------------
+// LabelCombo
+//---------------------------------------------------------
+
+class LabelCombo : public QWidget {
+ QComboBox* box;
+ Q_OBJECT
+
+ signals:
+ void activated(int);
+
+ public slots:
+ void clearFocus();
+ public:
+ LabelCombo(const QString& label, QWidget* parent,
+ const char* name=0);
+ void insertItem(const QString& txt, int index=-1);
+ void setCurrentItem(int i) { box->setCurrentItem(i); }
+ //void setListBox(Q3ListBox* lb) { box->setListBox(lb); } // ddskrjo
+ void setFocusPolicy ( Qt::FocusPolicy fp );
+
+ };
+
+#endif
diff --git a/muse2/muse/widgets/listitem.h b/muse2/muse/widgets/listitem.h
new file mode 100644
index 00000000..56b0f3d4
--- /dev/null
+++ b/muse2/muse/widgets/listitem.h
@@ -0,0 +1,85 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: listitem.h,v 1.1.2.1 2008/08/18 00:15:26 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __LISTITEM_H__
+#define __LISTITEM_H__
+
+//#include <qstring.h>
+//#include <qlistbox.h>
+#include <q3listview.h>
+
+class QString;
+class Q3ListBox;
+class Q3ListBoxText;
+//class QListView;
+//class QListViewItem;
+class ListBoxData;
+class ListViewData;
+
+//---------------------------------------------------------
+// ListBoxData
+//---------------------------------------------------------
+
+class ListBoxData : public Q3ListBoxText
+{
+ void* _data;
+
+ public:
+ ListBoxData(Q3ListBox* listbox, const QString& text = QString::null)
+ : Q3ListBoxText(listbox, text) { _data = 0; }
+ ListBoxData(const QString& text = QString::null) : Q3ListBoxText(text) { _data = 0; }
+ ListBoxData(Q3ListBox* listbox, const QString& text, ListBoxData* after)
+ : Q3ListBoxText(listbox, text, (Q3ListBoxText*)after) { _data = 0; }
+ ~ListBoxData() { }
+
+ virtual void setText(const QString& text) { Q3ListBoxText::setText(text); }
+ void* data() { return _data; }
+ void setData(void* dat) { _data = dat; }
+};
+
+//---------------------------------------------------------
+// ListViewData
+//---------------------------------------------------------
+
+class ListViewData : public Q3ListViewItem
+{
+ void* _data;
+
+ public:
+ ListViewData(Q3ListView* parent) : Q3ListViewItem(parent) { _data = 0; }
+ //ListViewData(ListViewData* parent) : QListViewItem((QListViewItem*)parent) { _data = 0; }
+ ListViewData(ListViewData* parent) : Q3ListViewItem(parent) { _data = 0; }
+ //ListViewData(QListView* parent, ListViewData* after) : QListViewItem(parent, (QListViewItem*)after) { _data = 0; }
+ ListViewData(Q3ListView* parent, ListViewData* after) : Q3ListViewItem(parent, after) { _data = 0; }
+ //ListViewData(ListViewData* parent, ListViewData* after) : QListViewItem((QListViewItem*)parent, (QListViewItem*)after) { _data = 0; }
+ ListViewData(ListViewData* parent, ListViewData* after) : Q3ListViewItem(parent, after) { _data = 0; }
+ ListViewData(Q3ListView* parent, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null,
+ QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null)
+ : Q3ListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) { _data = 0; }
+ ListViewData(ListViewData* parent, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null,
+ QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null)
+ //: QListViewItem((QListViewItem*)parent, label1, label2, label3, label4, label5, label6, label7, label8) { _data = 0; }
+ : Q3ListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) { _data = 0; }
+ ListViewData(Q3ListView* parent, ListViewData* after, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null,
+ QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null)
+ //: QListViewItem(parent, (QListViewItem*)after, label1, label2, label3, label4, label5, label6, label7, label8) { _data = 0; }
+ : Q3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) { _data = 0; }
+ ListViewData(ListViewData* parent, ListViewData* after, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null,
+ QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null)
+ //: QListViewItem((QListViewItem*)parent, (QListViewItem*)after, label1, label2, label3, label4, label5, label6, label7, label8) { _data = 0; }
+ : Q3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) { _data = 0; }
+ ~ListViewData() { }
+
+ void* data() { return _data; }
+ void setData(void* dat) { _data = dat; }
+};
+
+
+
+#endif
+
diff --git a/muse2/muse/widgets/menutitleitem.h b/muse2/muse/widgets/menutitleitem.h
new file mode 100644
index 00000000..5f821512
--- /dev/null
+++ b/muse2/muse/widgets/menutitleitem.h
@@ -0,0 +1,29 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: menutitleitem.h,v 1.1.2.1 2009/06/10 00:34:59 terminator356 Exp $
+// (C) Copyright 1999-2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MENU_TITLE_ITEM_H__
+#define __MENU_TITLE_ITEM_H__
+
+#include <qmenudata.h>
+
+//---------------------------------------------------------
+// MenuTitleItem
+//---------------------------------------------------------
+
+class MenuTitleItem { //: public QCustomMenuItem { ddskrjo
+ QString s;
+ virtual bool fullSpan() const { return true; }
+ virtual bool isSeparator() const { return true; }
+ virtual void paint(QPainter* p, const QColorGroup& cg, bool act,
+ bool, int, int, int, int);
+ virtual QSize sizeHint();
+
+ public:
+ MenuTitleItem(QString s);
+ };
+
+#endif
diff --git a/muse2/muse/widgets/metronome.cpp b/muse2/muse/widgets/metronome.cpp
new file mode 100644
index 00000000..091a8a56
--- /dev/null
+++ b/muse2/muse/widgets/metronome.cpp
@@ -0,0 +1,186 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: metronome.cpp,v 1.2.2.1 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include "metronome.h"
+#include <QtGui>
+#include <qpushbutton.h>
+#include <qspinbox.h>
+#include <qcheckbox.h>
+//Added by qt3to4:
+#include <Q3PopupMenu>
+#include "globals.h"
+#include "song.h"
+#include "track.h"
+#include "audio.h"
+
+//---------------------------------------------------------
+// MetronomeConfig
+//---------------------------------------------------------
+
+MetronomeConfig::MetronomeConfig(QWidget* parent, const char* name)
+ : MetronomeConfigBase(parent, name)
+ {
+ connect(buttonApply, SIGNAL(clicked()), SLOT(apply()));
+ connect(midiClick, SIGNAL(toggled(bool)), SLOT(midiClickChanged(bool)));
+ connect(precountEnable, SIGNAL(toggled(bool)), SLOT(precountEnableChanged(bool)));
+ connect(precountFromMastertrack, SIGNAL(toggled(bool)),
+ SLOT(precountFromMastertrackChanged(bool)));
+ connect(audioBeepRoutesButton, SIGNAL(clicked()), SLOT(audioBeepRoutesClicked()));
+ connect(volumeSlider, SIGNAL(valueChanged(int)), SLOT(beepVolumeChanged(int)));
+
+ measureNote->setValue(measureClickNote);
+ measureVelocity->setValue(measureClickVelo);
+ beatNote->setValue(beatClickNote);
+ beatVelocity->setValue(beatClickVelo);
+ midiChannel->setValue(clickChan+1);
+ midiPort->setValue(clickPort+1);
+
+ /*
+ precountBars->setValue(preMeasures);
+ precountEnable->setChecked(precountEnableFlag);
+ precountFromMastertrack->setChecked(precountFromMastertrackFlag);
+ precountSigZ->setValue(::precountSigZ);
+ precountSigN->setValue(::precountSigN);
+ precountPrerecord->setChecked(::precountPrerecord);
+ precountPreroll->setChecked(::precountPreroll);
+ */
+
+ midiClick->setChecked(midiClickFlag);
+ audioBeep->setChecked(audioClickFlag);
+ }
+
+//---------------------------------------------------------
+// audioBeepRoutesClicked
+//---------------------------------------------------------
+
+void MetronomeConfig::audioBeepRoutesClicked()
+{
+ if(song->outputs()->size() == 0)
+ return;
+
+ //QPopupMenu* pup = new QPopupMenu(audioBeepRoutesButton);
+ Q3PopupMenu* pup = new Q3PopupMenu(this);
+ pup->setCheckable(true);
+
+ OutputList* ol = song->outputs();
+
+ int nn = 0;
+ for(iAudioOutput iao = ol->begin(); iao != ol->end(); ++iao)
+ {
+ int id = pup->insertItem(QT_TR_NOOP((*iao)->name()), nn);
+ if((*iao)->sendMetronome())
+ pup->setItemChecked(id, true);
+ ++nn;
+ }
+
+ int n = pup->exec(QCursor::pos());
+ if(n != -1)
+ {
+ //QString s(pup->text(n));
+ nn = 0;
+ for(iAudioOutput iao = ol->begin(); iao != ol->end(); ++iao)
+ {
+ //if(((*iao)->name() == s) && (n == nn))
+ if(n == nn)
+ {
+ //(*iao)->setSendMetronome();
+ audio->msgSetSendMetronome(*iao, !pup->isItemChecked(n));
+ //song->update(SC_ROUTE);
+ break;
+ }
+ ++nn;
+ }
+ }
+
+ delete pup;
+ audioBeepRoutesButton->setDown(false); // pup->exec() catches mouse release event
+}
+
+//---------------------------------------------------------
+// accept
+//---------------------------------------------------------
+
+void MetronomeConfig::accept()
+ {
+ apply();
+ MetronomeConfigBase::accept();
+ }
+
+//---------------------------------------------------------
+// apply
+//---------------------------------------------------------
+
+void MetronomeConfig::apply()
+ {
+ measureClickNote = measureNote->value();
+ measureClickVelo = measureVelocity->value();
+ beatClickNote = beatNote->value();
+ beatClickVelo = beatVelocity->value();
+ clickChan = midiChannel->value() - 1;
+ clickPort = midiPort->value() - 1;
+ preMeasures = precountBars->value();
+ /*
+ precountEnableFlag = precountEnable->isChecked();
+ precountFromMastertrackFlag = precountFromMastertrack->isChecked();
+ ::precountSigZ = precountSigZ->value();
+ ::precountSigN = precountSigN->value();
+ ::precountPrerecord = precountPrerecord->isChecked();
+ ::precountPreroll = precountPreroll->isChecked();
+ */
+ midiClickFlag = midiClick->isChecked();
+ audioClickFlag = audioBeep->isChecked();
+ //audioVolumeChanged = volumeSlider->value();
+ }
+
+//---------------------------------------------------------
+// reject
+//---------------------------------------------------------
+
+void MetronomeConfig::reject()
+ {
+ MetronomeConfigBase::reject();
+ }
+
+//---------------------------------------------------------
+// midiClickChanged
+//---------------------------------------------------------
+
+void MetronomeConfig::midiClickChanged(bool flag)
+ {
+ measureNote->setEnabled(flag);
+ measureVelocity->setEnabled(flag);
+ beatNote->setEnabled(flag);
+ beatVelocity->setEnabled(flag);
+ midiChannel->setEnabled(flag);
+ midiPort->setEnabled(flag);
+ }
+
+void MetronomeConfig::precountEnableChanged(bool flag)
+ {
+ /*
+ precountBars->setEnabled(flag);
+ precountFromMastertrack->setEnabled(flag);
+ precountSigZ->setEnabled(flag && !precountFromMastertrack->isChecked());
+ precountSigN->setEnabled(flag && !precountFromMastertrack->isChecked());
+ */
+ }
+
+void MetronomeConfig::precountFromMastertrackChanged(bool flag)
+ {
+ /*
+ precountSigZ->setEnabled(!flag);
+ precountSigN->setEnabled(!flag);
+ */
+ }
+
+void MetronomeConfig::beepVolumeChanged(int volume)
+ {
+ // this value is directly applied, not using th Apply button, it just seems more usable this way.
+ audioClickVolume=volume/100.0;
+ }
diff --git a/muse2/muse/widgets/metronome.h b/muse2/muse/widgets/metronome.h
new file mode 100644
index 00000000..200d1875
--- /dev/null
+++ b/muse2/muse/widgets/metronome.h
@@ -0,0 +1,34 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: metronome.h,v 1.1.1.1.2.1 2009/12/20 05:00:35 terminator356 Exp $
+//
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __METRONOME_H__
+#define __METRONOME_H__
+
+#include "metronomebase.h"
+
+//---------------------------------------------------------
+// MetronomeConfig
+//---------------------------------------------------------
+
+class MetronomeConfig : public MetronomeConfigBase {
+ Q_OBJECT
+
+ private slots:
+ virtual void accept();
+ void apply();
+ virtual void reject();
+ virtual void audioBeepRoutesClicked();
+ void midiClickChanged(bool);
+ void precountEnableChanged(bool);
+ void precountFromMastertrackChanged(bool);
+ void beepVolumeChanged(int);
+
+ public:
+ MetronomeConfig(QWidget* parent, const char* name = 0);
+ };
+#endif
diff --git a/muse2/muse/widgets/metronomebase.ui b/muse2/muse/widgets/metronomebase.ui
new file mode 100644
index 00000000..c30f5bf1
--- /dev/null
+++ b/muse2/muse/widgets/metronomebase.ui
@@ -0,0 +1,604 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>MetronomeConfigBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MetronomeConfigBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>557</width>
+ <height>347</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Metronome Config</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout20</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Metronome</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout18</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>audioBeepLayout</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>audioBeep</cstring>
+ </property>
+ <property name="text">
+ <string>Audio Beep</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>audioBeepRoutesButton</cstring>
+ </property>
+ <property name="text">
+ <string>Choose outputs...</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout17</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSlider">
+ <property name="name">
+ <cstring>volumeSlider</cstring>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="maxValue">
+ <number>100</number>
+ </property>
+ <property name="lineStep">
+ <number>1</number>
+ </property>
+ <property name="pageStep">
+ <number>10</number>
+ </property>
+ <property name="value">
+ <number>50</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>volumeLabel</cstring>
+ </property>
+ <property name="text">
+ <string>50</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>% Audio volume</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>midiClick</cstring>
+ </property>
+ <property name="text">
+ <string>MIDI Click</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout10</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="4" column="1">
+ <property name="name">
+ <cstring>TextLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Midi Channel</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Measure Note</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="4" column="0">
+ <property name="name">
+ <cstring>midiChannel</cstring>
+ </property>
+ <property name="maxValue">
+ <number>16</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Measure Velocity</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Beat Velocity</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="5" column="0">
+ <property name="name">
+ <cstring>midiPort</cstring>
+ </property>
+ <property name="maxValue">
+ <number>16</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Beat Note</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="0">
+ <property name="name">
+ <cstring>beatNote</cstring>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="0">
+ <property name="name">
+ <cstring>measureVelocity</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="0">
+ <property name="name">
+ <cstring>measureNote</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="1">
+ <property name="name">
+ <cstring>TextLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Midi Port</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="0">
+ <property name="name">
+ <cstring>beatVelocity</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="0" column="1">
+ <property name="name">
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Precount</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>precountEnable</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>enable</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>precountBars</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="maxValue">
+ <number>10</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>2</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>Bars</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>precountFromMastertrack</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>From Mastertrack</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>precountSigZ</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="maxValue">
+ <number>32</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>4</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>/</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>precountSigN</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="maxValue">
+ <number>64</number>
+ </property>
+ <property name="minValue">
+ <number>2</number>
+ </property>
+ <property name="value">
+ <number>4</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel9</cstring>
+ </property>
+ <property name="text">
+ <string>Signature</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>precountPrerecord</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Prerecord</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>precountPreroll</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Preroll</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout19</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Hint: Enable metronome in Transportpanel</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>8</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonApply</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Apply</string>
+ </property>
+ <property name="accel">
+ <string>Alt+A</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string>Alt+O</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string>Alt+C</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MetronomeConfigBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>MetronomeConfigBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>volumeSlider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>volumeLabel</receiver>
+ <slot>setNum(int)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>audioBeep</tabstop>
+ <tabstop>audioBeepRoutesButton</tabstop>
+ <tabstop>midiClick</tabstop>
+ <tabstop>measureNote</tabstop>
+ <tabstop>measureVelocity</tabstop>
+ <tabstop>beatNote</tabstop>
+ <tabstop>beatVelocity</tabstop>
+ <tabstop>midiChannel</tabstop>
+ <tabstop>midiPort</tabstop>
+ <tabstop>precountEnable</tabstop>
+ <tabstop>precountBars</tabstop>
+ <tabstop>precountFromMastertrack</tabstop>
+ <tabstop>precountSigZ</tabstop>
+ <tabstop>precountPrerecord</tabstop>
+ <tabstop>precountPreroll</tabstop>
+ <tabstop>precountSigN</tabstop>
+ <tabstop>buttonApply</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/midisync.ui b/muse2/muse/widgets/midisync.ui
new file mode 100644
index 00000000..f9c9a816
--- /dev/null
+++ b/muse2/muse/widgets/midisync.ui
@@ -0,0 +1,443 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>MidiSyncConfigBase</class>
+<comment>midi sync
+configuration dialog</comment>
+<author>werner schweer</author>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MidiSyncConfigBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>574</width>
+ <height>419</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Midi Sync</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="2" column="0">
+ <property name="name">
+ <cstring>ApplyOk</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>applyButton</cstring>
+ </property>
+ <property name="text">
+ <string>Apply</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okButton</cstring>
+ </property>
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>GroupBox13</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="title">
+ <string>MTC</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Type:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>24</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>25</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>30D</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>30N</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>mtcSyncType</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Offset:</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>mtcOffH</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="maxValue">
+ <number>23</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>hour</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>h</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>mtcOffM</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="maxValue">
+ <number>59</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>minute</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>m</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>mtcOffS</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="maxValue">
+ <number>59</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>second</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>s</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>mtcOffF</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="maxValue">
+ <number>30</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>frame</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>f</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>mtcOffSf</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>subframe</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>syncGen</cstring>
+ </property>
+ <property name="title">
+ <string>Sync receiving and sending</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>useJackTransportCheckbox</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Use Jack transport</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Send and receive Jack transport</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Send and receive Jack transport information,
+ including stop, start and position.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>jackTransportMasterCheckbox</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Jack transport Timebase Master</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Make MusE the Jack transport Timebase Master</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Make MusE the Jack transport Timebase Master.
+Allows Jack to show time as
+ MusE Bars, Beats, and Ticks.
+MusE will try to become master, but other
+ Jack clients can also take over later.
+You can always click here again for Master.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>extSyncCheckbox</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Slave to external sync</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Control MusE timing by external midi clock or MTC sync</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When in slave mode, tempo is
+ controlled externally.
+MusE can sync to midi clock, or MTC quarter frame sync.
+Enabled inputs in the list will
+ be in effect (RMC, RMMC, RMTC).</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="0">
+ <property name="name">
+ <cstring>syncDelayLayout</cstring>
+ </property>
+ <hbox>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>syncDelaySpinBox</cstring>
+ </property>
+ <property name="suffix">
+ <string>ms</string>
+ </property>
+ <property name="maxValue">
+ <number>60000</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="lineStep">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Send start to first clock delay</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Allows 'slow sync' devices time
+ to synchronize to MusE. This value is the
+ delay from sending start to sending
+ the first clock.</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>syncDelayLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Send sync delay</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignLeft</set>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QListView" row="4" column="0">
+ <property name="name">
+ <cstring>devicesListView</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<tabstops>
+ <tabstop>mtcOffH</tabstop>
+ <tabstop>mtcOffM</tabstop>
+ <tabstop>mtcOffS</tabstop>
+ <tabstop>mtcOffF</tabstop>
+ <tabstop>mtcOffSf</tabstop>
+ <tabstop>applyButton</tabstop>
+ <tabstop>okButton</tabstop>
+ <tabstop>cancelButton</tabstop>
+</tabstops>
+<slots>
+ <slot>mopslot()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/midisyncimpl.cpp b/muse2/muse/widgets/midisyncimpl.cpp
new file mode 100644
index 00000000..e763c62f
--- /dev/null
+++ b/muse2/muse/widgets/midisyncimpl.cpp
@@ -0,0 +1,1294 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midisyncimpl.cpp,v 1.1.1.1.2.4 2009/05/03 04:14:01 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+//#include "midisyncimpl.h"
+//#include "sync.h"
+//#include "globals.h"
+
+#include <qspinbox.h>
+#include <qcombobox.h>
+#include <qcheckbox.h>
+#include <q3buttongroup.h>
+#include <qpushbutton.h>
+#include <qinputdialog.h>
+//#include <qlistview.h>
+#include <q3header.h>
+#include <qtimer.h>
+//#include <qwhatsthis.h>
+#include <qmessagebox.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+
+#include "app.h"
+#include "song.h"
+#include "midiport.h"
+#include "midiseq.h"
+#include "mididev.h"
+#include "icons.h"
+#include "sync.h"
+#include "globals.h"
+#include "midisyncimpl.h"
+#include "driver/audiodev.h"
+#include "audio.h"
+
+enum { DEVCOL_NO = 0, DEVCOL_NAME, DEVCOL_IN, DEVCOL_TICKIN, DEVCOL_MRTIN, DEVCOL_MMCIN, DEVCOL_MTCIN, DEVCOL_MTCTYPE,
+ DEVCOL_RID, DEVCOL_RCLK, DEVCOL_RMRT, DEVCOL_RMMC, DEVCOL_RMTC, DEVCOL_RREWSTART,
+ DEVCOL_TID, DEVCOL_TCLK, DEVCOL_TMRT, DEVCOL_TMMC, DEVCOL_TMTC, /* DEVCOL_TREWSTART, */ };
+
+//MidiSyncInfo tmpMidiSyncPorts[MIDI_PORTS];
+
+//---------------------------------------------------------
+// MSyncHeaderTip::maybeTip
+//---------------------------------------------------------
+
+void MSyncHeaderTip::maybeTip(const QPoint &pos)
+ {
+ Q3Header* w = (Q3Header*)_parent->parentWidget();
+ int section = w->sectionAt(pos.x());
+ if (section == -1)
+ return;
+ QRect r(w->sectionPos(section), 0, w->sectionSize(section),
+ w->height());
+ QString p;
+ switch (section) {
+ case DEVCOL_NO: p = Q3Header::tr("Port Number"); break;
+ case DEVCOL_NAME: p = Q3Header::tr("Name of the midi device associated with"
+ " this port number"); break;
+ case DEVCOL_IN: p = Q3Header::tr("Midi clock input detected"); break;
+ case DEVCOL_TICKIN: p = Q3Header::tr("Midi tick input detected"); break;
+ case DEVCOL_MRTIN: p = Q3Header::tr("Midi real time input detected"); break;
+ case DEVCOL_MMCIN: p = Q3Header::tr("MMC input detected"); break;
+ case DEVCOL_MTCIN: p = Q3Header::tr("MTC input detected"); break;
+ case DEVCOL_MTCTYPE: p = Q3Header::tr("Detected SMPTE format"); break;
+ case DEVCOL_RID: p = Q3Header::tr("Receive id number. 127 = Global. Double click to edit."); break;
+ case DEVCOL_RCLK: p = Q3Header::tr("Accept midi clock input"); break;
+ case DEVCOL_RMRT: p = Q3Header::tr("Accept midi real time input"); break;
+ case DEVCOL_RMMC: p = Q3Header::tr("Accept MMC input"); break;
+ case DEVCOL_RMTC: p = Q3Header::tr("Accept MTC input"); break;
+ case DEVCOL_RREWSTART: p = Q3Header::tr("Receive start rewinds before playing"); break;
+ case DEVCOL_TID: p = Q3Header::tr("Transmit id number. 127 = Global. Double click to edit."); break;
+ case DEVCOL_TCLK: p = Q3Header::tr("Send midi clock output"); break;
+ case DEVCOL_TMRT: p = Q3Header::tr("Send midi realtime output"); break;
+ case DEVCOL_TMMC: p = Q3Header::tr("Send MMC output"); break;
+ case DEVCOL_TMTC: p = Q3Header::tr("Send MTC output"); break;
+ //case DEVCOL_TREWSTART: p = QHeader::tr("Send continue instead of start"); break;
+ default: return;
+ }
+ //tip(r, p); ddskrjo
+ }
+
+//---------------------------------------------------------
+// MSyncWhatsThis::text
+//---------------------------------------------------------
+
+QString MSyncWhatsThis::text(const QPoint& pos)
+{
+ int n = header->cellAt(pos.x());
+ if (n == -1)
+ return QString::null;
+ switch (header->mapToLogical(n)) {
+ case DEVCOL_NO:
+ return Q3Header::tr("Port Number");
+ case DEVCOL_NAME:
+ return Q3Header::tr("Name of the midi device associated with this port number");
+ case DEVCOL_IN:
+ return Q3Header::tr("Midi clock input detected.\n"
+ "Current port actually used is red.\nClick to force a port to be used.");
+ case DEVCOL_TICKIN:
+ return Q3Header::tr("Midi tick input detected");
+ case DEVCOL_MRTIN:
+ return Q3Header::tr("Midi realtime input detected, including\n start/stop/continue, and song position.");
+ case DEVCOL_MMCIN:
+ return Q3Header::tr("MMC input detected, including stop/play/deferred play, and locate.");
+ //"Current port actually used is red. Click to force a port to be current.");
+ case DEVCOL_MTCIN:
+ return Q3Header::tr("MTC input detected, including forward quarter-frame sync and full-frame locate.\n"
+ "Current port actually used is red. Click to force a port to be current.");
+ case DEVCOL_MTCTYPE:
+ return Q3Header::tr("Detected SMPTE format: 24fps, 25fps, 30fps drop frame, or 30fps non-drop\n"
+ "Detects format of MTC quarter and full frame, and MMC locate.");
+ case DEVCOL_RID:
+ return Q3Header::tr("Receive id number. 127 = global receive all, even if not global.");
+ case DEVCOL_RCLK:
+ return Q3Header::tr("Accept midi clock input. Only one input is used for clock.\n"
+ "Auto-acquire: If two or more port realtime inputs are enabled,\n"
+ " the first clock detected is used, until clock is lost,\n"
+ " then another can take over. Best if each turns off its clock\n"
+ " at stop, so MusE can re-acquire the clock from another port.\n"
+ "Click on detect indicator to force another.");
+ case DEVCOL_RMRT:
+ return Q3Header::tr("Accept midi realtime input, including\n start/stop/continue, and song position.\n"
+ "Non-clock events (start,stop etc) are\n accepted by ALL enabled ports.\n"
+ "This means you may have several master\n devices connected, and muse will accept\n"
+ " input from them.");
+ case DEVCOL_RMMC:
+ return Q3Header::tr("Accept MMC input, including stop/play/deferred play, and locate.");
+ case DEVCOL_RMTC:
+ return Q3Header::tr("Accept MTC input, including forward quarter-frame sync and full-frame locate.\n"
+ "See 'rc' column for more help.");
+ case DEVCOL_RREWSTART:
+ return Q3Header::tr("When start is received, rewind before playing.\n"
+ "Note: It may be impossible to rewind fast\n"
+ " enough to synchronize with the external device.");
+ case DEVCOL_TID:
+ return Q3Header::tr("Transmit id number. 127 = global transmit to all.");
+ case DEVCOL_TCLK:
+ return Q3Header::tr("Send midi clock output. If 'Slave to External Sync' is chosen,\n"
+ " muse can re-transmit clock to any other chosen ports.");
+ case DEVCOL_TMRT:
+ return Q3Header::tr("Send midi realtime output, including start/stop/continue,\n"
+ " and song position. If 'Slave to external sync' is chosen,\n"
+ " muse can re-transmit midi realtime input messages to any\n"
+ " other chosen ports. This means you may have several slave\n"
+ " devices connected, and muse can re-send realtime messages\n"
+ " to any or all of them.");
+ case DEVCOL_TMMC:
+ return Q3Header::tr("Send MMC output");
+ case DEVCOL_TMTC:
+ return Q3Header::tr("Send MTC output");
+ //case DEVCOL_TREWSTART:
+ // return QHeader::tr("When transport is starting, send continue instead of start.\n");
+ default:
+ break;
+ }
+ return QString::null;
+}
+
+/*
+//---------------------------------------------------------
+// MidiSyncLViewItem
+// setDevice
+//---------------------------------------------------------
+
+void MidiSyncLViewItem::setDevice(MidiDevice* d)
+{
+ _device = d;
+ if(_device)
+ _syncInfo.copyParams(_device->syncInfo());
+}
+*/
+
+//---------------------------------------------------------
+// MidiSyncLViewItem
+// setPort
+//---------------------------------------------------------
+
+void MidiSyncLViewItem::setPort(int port)
+{
+ _port = port;
+ if(_port < 0 || port > MIDI_PORTS)
+ return;
+
+ //_syncInfo.copyParams(midiPorts[port].syncInfo());
+ copyFromSyncInfo(midiPorts[port].syncInfo());
+}
+
+//---------------------------------------------------------
+// MidiSyncLViewItem
+// copyFromSyncInfo
+//---------------------------------------------------------
+
+void MidiSyncLViewItem::copyFromSyncInfo(const MidiSyncInfo &sp)
+{
+ _idOut = sp.idOut();
+ _idIn = sp.idIn();
+ _sendMC = sp.MCOut();
+ _sendMRT = sp.MRTOut();
+ _sendMMC = sp.MMCOut();
+ _sendMTC = sp.MTCOut();
+ _recMC = sp.MCIn();
+ _recMRT = sp.MRTIn();
+ _recMMC = sp.MMCIn();
+ _recMTC = sp.MTCIn();
+ _recRewOnStart = sp.recRewOnStart();
+ //_sendContNotStart = sp.sendContNotStart();
+}
+
+//---------------------------------------------------------
+// MidiSyncLViewItem
+// copyToSyncInfo
+//---------------------------------------------------------
+
+void MidiSyncLViewItem::copyToSyncInfo(MidiSyncInfo &sp)
+{
+ sp.setIdOut(_idOut);
+ sp.setIdIn(_idIn);
+ sp.setMCOut(_sendMC);
+ sp.setMRTOut(_sendMRT);
+ sp.setMMCOut(_sendMMC);
+ sp.setMTCOut(_sendMTC);
+ sp.setMCIn(_recMC);
+ sp.setMRTIn(_recMRT);
+ sp.setMMCIn(_recMMC);
+ sp.setMTCIn(_recMTC);
+ sp.setRecRewOnStart(_recRewOnStart);
+ //sp.setSendContNotStart(_sendContNotStart);
+}
+
+//---------------------------------------------------------
+// MidiSyncConfig
+// Midi Sync Config
+//---------------------------------------------------------
+
+MidiSyncConfig::MidiSyncConfig(QWidget* parent, const char* name)
+ : MidiSyncConfigBase(parent, name)
+{
+ _synctooltip = 0;
+
+ _dirty = false;
+ applyButton->setEnabled(false);
+
+ //inHeartBeat = true;
+
+ //for(int i = 0; i < MIDI_PORTS; ++i)
+ // tmpMidiSyncPorts[i] = midiSyncPorts[i];
+
+ //bool ext = extSyncFlag.value();
+ //syncMode->setButton(int(ext));
+ //syncChanged(ext);
+// extSyncCheckbox->setChecked(extSyncFlag.value());
+
+// dstDevId->setValue(txDeviceId);
+// srcDevId->setValue(rxDeviceId);
+// srcSyncPort->setValue(rxSyncPort + 1);
+// dstSyncPort->setValue(txSyncPort + 1);
+
+// mtcSync->setChecked(genMTCSync);
+// mcSync->setChecked(genMCSync);
+// midiMachineControl->setChecked(genMMC);
+
+// acceptMTCCheckbox->setChecked(acceptMTC);
+ //acceptMTCCheckbox->setChecked(false);
+// acceptMCCheckbox->setChecked(acceptMC);
+// acceptMMCCheckbox->setChecked(acceptMMC);
+
+// mtcSyncType->setCurrentItem(mtcType);
+
+// mtcOffH->setValue(mtcOffset.h());
+// mtcOffM->setValue(mtcOffset.m());
+// mtcOffS->setValue(mtcOffset.s());
+// mtcOffF->setValue(mtcOffset.f());
+// mtcOffSf->setValue(mtcOffset.sf());
+
+
+
+
+ devicesListView->setSorting(-1);
+ devicesListView->setAllColumnsShowFocus(true);
+ devicesListView->addColumn(tr("Port"));
+ devicesListView->addColumn(tr("Device Name"), 120);
+ devicesListView->addColumn(tr("c"));
+ devicesListView->addColumn(tr("k"));
+ devicesListView->addColumn(tr("r"));
+ devicesListView->addColumn(tr("m"));
+ devicesListView->addColumn(tr("t"));
+ devicesListView->addColumn(tr("type"));
+ devicesListView->addColumn(tr("rid")); // Receive
+ devicesListView->addColumn(tr("rc")); // Receive
+ devicesListView->addColumn(tr("rr")); // Receive
+ devicesListView->addColumn(tr("rm")); // Receive
+ devicesListView->addColumn(tr("rt")); // Receive
+ devicesListView->addColumn(tr("rw")); // Receive
+ devicesListView->addColumn(tr("tid")); // Transmit
+ devicesListView->addColumn(tr("tc")); // Transmit
+ devicesListView->addColumn(tr("tr")); // Transmit
+ devicesListView->addColumn(tr("tm")); // Transmit
+ devicesListView->addColumn(tr("tt")); // Transmit
+ //devicesListView->addColumn(tr("trs")); // Transmit
+ devicesListView->setFocusPolicy(Qt::NoFocus);
+
+ devicesListView->setColumnAlignment(DEVCOL_NO, Qt::AlignHCenter);
+ devicesListView->setColumnAlignment(DEVCOL_IN, Qt::AlignCenter);
+ devicesListView->setColumnAlignment(DEVCOL_TICKIN, Qt::AlignCenter);
+ devicesListView->setColumnAlignment(DEVCOL_MRTIN, Qt::AlignCenter);
+ devicesListView->setColumnAlignment(DEVCOL_MMCIN, Qt::AlignCenter);
+ devicesListView->setColumnAlignment(DEVCOL_MTCIN, Qt::AlignCenter);
+ //devicesListView->setColumnAlignment(DEVCOL_MTCTYPE, AlignCenter);
+ //devicesListView->setColumnAlignment(DEVCOL_RID, AlignCenter);
+ devicesListView->setColumnAlignment(DEVCOL_RCLK, Qt::AlignCenter);
+ devicesListView->setColumnAlignment(DEVCOL_RMRT, Qt::AlignCenter);
+ devicesListView->setColumnAlignment(DEVCOL_RMMC, Qt::AlignCenter);
+ devicesListView->setColumnAlignment(DEVCOL_RMTC, Qt::AlignCenter);
+ devicesListView->setColumnAlignment(DEVCOL_RREWSTART, Qt::AlignCenter);
+ //devicesListView->setColumnAlignment(DEVCOL_TID, AlignCenter);
+ devicesListView->setColumnAlignment(DEVCOL_TCLK, Qt::AlignCenter);
+ devicesListView->setColumnAlignment(DEVCOL_TMRT, Qt::AlignCenter);
+ devicesListView->setColumnAlignment(DEVCOL_TMMC, Qt::AlignCenter);
+ devicesListView->setColumnAlignment(DEVCOL_TMTC, Qt::AlignCenter);
+ //devicesListView->setColumnAlignment(DEVCOL_TREWSTART, AlignCenter);
+ devicesListView->header()->setResizeEnabled(false, DEVCOL_NO);
+ devicesListView->header()->setResizeEnabled(false, DEVCOL_IN);
+ devicesListView->header()->setResizeEnabled(false, DEVCOL_TICKIN);
+ devicesListView->header()->setResizeEnabled(false, DEVCOL_MRTIN);
+ devicesListView->header()->setResizeEnabled(false, DEVCOL_MMCIN);
+ devicesListView->header()->setResizeEnabled(false, DEVCOL_MTCIN);
+ devicesListView->header()->setResizeEnabled(false, DEVCOL_RCLK);
+ devicesListView->header()->setResizeEnabled(false, DEVCOL_RMRT);
+ devicesListView->header()->setResizeEnabled(false, DEVCOL_RMMC);
+ devicesListView->header()->setResizeEnabled(false, DEVCOL_RMTC);
+ devicesListView->header()->setResizeEnabled(false, DEVCOL_RMTC);
+ devicesListView->header()->setResizeEnabled(false, DEVCOL_RREWSTART);
+ devicesListView->header()->setResizeEnabled(false, DEVCOL_TCLK);
+ devicesListView->header()->setResizeEnabled(false, DEVCOL_TMRT);
+ devicesListView->header()->setResizeEnabled(false, DEVCOL_TMMC);
+ //devicesListView->header()->setResizeEnabled(false, DEVCOL_TREWSTART);
+ //devicesListView->setResizeMode(QListView::LastColumn);
+ devicesListView->setResizeMode(Q3ListView::NoColumn);
+
+
+ new MSyncWhatsThis(devicesListView, devicesListView->header());
+ _synctooltip = new MSyncHeaderTip(devicesListView->header());
+ //MSyncHeaderTip::add(devicesListView->header(), QString("Midi sync ports"));
+
+// updateSyncInfoLV();
+
+ songChanged(-1);
+
+ //connect(devicesListView, SIGNAL(pressed(QListViewItem*,const QPoint&,int)),
+ // this, SLOT(dlvClicked(QListViewItem*,const QPoint&,int)));
+ connect(devicesListView, SIGNAL(mouseButtonClicked(int, Q3ListViewItem*,const QPoint&, int)),
+ this, SLOT(dlvClicked(int, Q3ListViewItem*,const QPoint&, int)));
+ connect(devicesListView, SIGNAL(doubleClicked(Q3ListViewItem*,const QPoint&,int)),
+ this, SLOT(dlvDoubleClicked(Q3ListViewItem*,const QPoint&,int)));
+ //connect(devicesListView, SIGNAL(itemRenamed(QListViewItem*, int, const QString&)),
+ // this, SLOT(renameOk(QListViewItem*, int, const QString&)));
+
+ connect(okButton, SIGNAL(clicked()), SLOT(ok()));
+ connect(applyButton, SIGNAL(clicked()), SLOT(apply()));
+ connect(cancelButton, SIGNAL(clicked()), SLOT(cancel()));
+
+ //connect(syncMode, SIGNAL(clicked(int)), SLOT(syncChanged(int)));
+ connect(extSyncCheckbox, SIGNAL(clicked()), SLOT(syncChanged()));
+ connect(mtcSyncType, SIGNAL(activated(int)), SLOT(syncChanged()));
+ connect(useJackTransportCheckbox, SIGNAL(clicked()), SLOT(syncChanged()));
+ connect(jackTransportMasterCheckbox, SIGNAL(clicked()), SLOT(syncChanged()));
+ connect(&extSyncFlag, SIGNAL(valueChanged(bool)), SLOT(extSyncChanged(bool)));
+ connect(syncDelaySpinBox, SIGNAL(valueChanged(int)), SLOT(syncChanged()));
+
+ // Done in show().
+ //connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ //connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat()));
+
+ //inHeartBeat = false;
+}
+
+MidiSyncConfig::~MidiSyncConfig()
+{
+ delete _synctooltip;
+}
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void MidiSyncConfig::songChanged(int flags)
+{
+ // Is it simply a midi controller value adjustment? Forget it. Otherwise, it's mainly midi port/device changes we want.
+ if(flags == SC_MIDI_CONTROLLER ||
+ !(flags & (SC_CONFIG | SC_MASTER | SC_TEMPO | SC_SIG | SC_TRACK_INSERTED | SC_TRACK_REMOVED | SC_TRACK_MODIFIED |
+ SC_PART_INSERTED | SC_PART_REMOVED | SC_PART_MODIFIED | SC_EVENT_INSERTED | SC_EVENT_REMOVED | SC_EVENT_MODIFIED |
+ SC_MIDI_CONTROLLER_ADD)))
+ return;
+
+ // Reset dirty flag, since we're loading new values.
+ _dirty = false;
+ if(applyButton->isEnabled())
+ applyButton->setEnabled(false);
+
+ //for(int i = 0; i < MIDI_PORTS; ++i)
+ // tmpMidiSyncPorts[i] = midiSyncPorts[i];
+
+ extSyncCheckbox->blockSignals(true);
+ useJackTransportCheckbox->blockSignals(true);
+ jackTransportMasterCheckbox->blockSignals(true);
+ syncDelaySpinBox->blockSignals(true);
+ extSyncCheckbox->setChecked(extSyncFlag.value());
+ useJackTransportCheckbox->setChecked(useJackTransport.value());
+ jackTransportMasterCheckbox->setChecked(jackTransportMaster);
+ //jackTransportMasterCheckbox->setEnabled(useJackTransport);
+ syncDelaySpinBox->setValue(syncSendFirstClockDelay);
+ syncDelaySpinBox->blockSignals(false);
+ jackTransportMasterCheckbox->blockSignals(false);
+ useJackTransportCheckbox->blockSignals(false);
+ extSyncCheckbox->blockSignals(false);
+
+ mtcSyncType->setCurrentItem(mtcType);
+
+ mtcOffH->blockSignals(true);
+ mtcOffM->blockSignals(true);
+ mtcOffS->blockSignals(true);
+ mtcOffF->blockSignals(true);
+ mtcOffSf->blockSignals(true);
+ mtcOffH->setValue(mtcOffset.h());
+ mtcOffM->setValue(mtcOffset.m());
+ mtcOffS->setValue(mtcOffset.s());
+ mtcOffF->setValue(mtcOffset.f());
+ mtcOffSf->setValue(mtcOffset.sf());
+ mtcOffH->blockSignals(false);
+ mtcOffM->blockSignals(false);
+ mtcOffS->blockSignals(false);
+ mtcOffF->blockSignals(false);
+ mtcOffSf->blockSignals(false);
+
+ updateSyncInfoLV();
+
+ //selectionChanged();
+}
+
+//---------------------------------------------------------
+// heartBeat
+//---------------------------------------------------------
+
+void MidiSyncConfig::heartBeat()
+{
+ //inHeartBeat = true;
+
+ MidiSyncLViewItem* lvi = (MidiSyncLViewItem*)devicesListView->firstChild();
+ while(lvi)
+ {
+ int port = lvi->port();
+ if(port >= 0 && port < MIDI_PORTS)
+ {
+ bool sdet = midiPorts[port].syncInfo().MCSyncDetect();
+ if(sdet)
+ {
+ if(port == curMidiSyncInPort)
+ {
+ if(!lvi->_curDet)
+ {
+ // Added by Tim. p3.3.6
+ //printf("MidiSyncConfig::heartBeat setting current red icon\n");
+
+ lvi->_curDet = true;
+ lvi->_inDet = false;
+ lvi->setPixmap(DEVCOL_IN, *record1_Icon);
+ }
+ }
+ else
+ if(!lvi->_inDet)
+ {
+ // Added by Tim. p3.3.6
+ //printf("MidiSyncConfig::heartBeat setting non-current green icon\n");
+
+ lvi->_inDet = true;
+ lvi->_curDet = false;
+ lvi->setPixmap(DEVCOL_IN, *dotIcon);
+ }
+ }
+ else
+ {
+ if(lvi->_curDet || lvi->_inDet)
+ {
+ // Added by Tim. p3.3.6
+ //printf("MidiSyncConfig::heartBeat setting off icon\n");
+
+ lvi->_curDet = false;
+ lvi->_inDet = false;
+ lvi->setPixmap(DEVCOL_IN, *dothIcon);
+ }
+ }
+
+ sdet = midiPorts[port].syncInfo().tickDetect();
+ if(sdet)
+ {
+ if(!lvi->_tickDet)
+ {
+ // Added by Tim. p3.3.6
+ //printf("MidiSyncConfig::heartBeat setting tick on icon\n");
+
+ lvi->_tickDet = true;
+ lvi->setPixmap(DEVCOL_TICKIN, *dotIcon);
+ }
+ }
+ else
+ {
+ if(lvi->_tickDet)
+ {
+ // Added by Tim. p3.3.6
+ //printf("MidiSyncConfig::heartBeat setting tick off icon\n");
+
+ lvi->_tickDet = false;
+ lvi->setPixmap(DEVCOL_TICKIN, *dothIcon);
+ }
+ }
+
+ sdet = midiPorts[port].syncInfo().MRTDetect();
+ if(sdet)
+ {
+ if(!lvi->_MRTDet)
+ {
+ // Added by Tim. p3.3.6
+ //printf("MidiSyncConfig::heartBeat setting MRT on icon\n");
+
+ lvi->_MRTDet = true;
+ lvi->setPixmap(DEVCOL_MRTIN, *dotIcon);
+ }
+ }
+ else
+ {
+ if(lvi->_MRTDet)
+ {
+ // Added by Tim. p3.3.6
+ //printf("MidiSyncConfig::heartBeat setting MRT off icon\n");
+
+ lvi->_MRTDet = false;
+ lvi->setPixmap(DEVCOL_MRTIN, *dothIcon);
+ }
+ }
+
+ int type = midiPorts[port].syncInfo().recMTCtype();
+ sdet = midiPorts[port].syncInfo().MMCDetect();
+ bool mtcdet = midiPorts[port].syncInfo().MTCDetect();
+ if(sdet)
+ {
+ if(!lvi->_MMCDet)
+ {
+ // Added by Tim. p3.3.6
+ //printf("MidiSyncConfig::heartBeat setting MMC on icon\n");
+
+ lvi->_MMCDet = true;
+ lvi->setPixmap(DEVCOL_MMCIN, *dotIcon);
+ }
+ // MMC locate command can contain SMPTE format type. Update now.
+ if(!mtcdet && lvi->_recMTCtype != type)
+ {
+ lvi->_recMTCtype = type;
+ switch(type)
+ {
+ case 0:
+ lvi->setText(DEVCOL_MTCTYPE, "24");
+ break;
+ case 1:
+ lvi->setText(DEVCOL_MTCTYPE, "25");
+ break;
+ case 2:
+ lvi->setText(DEVCOL_MTCTYPE, "30D");
+ break;
+ case 3:
+ lvi->setText(DEVCOL_MTCTYPE, "30N");
+ break;
+ default:
+ lvi->setText(DEVCOL_MTCTYPE, "??");
+ break;
+ }
+ }
+ }
+ else
+ {
+ if(lvi->_MMCDet)
+ {
+ // Added by Tim. p3.3.6
+ //printf("MidiSyncConfig::heartBeat setting MMC off icon\n");
+
+ lvi->_MMCDet = false;
+ lvi->setPixmap(DEVCOL_MMCIN, *dothIcon);
+ }
+ }
+
+ if(mtcdet)
+ {
+ if(port == curMidiSyncInPort)
+ {
+ if(!lvi->_curMTCDet)
+ {
+ // Added by Tim. p3.3.6
+ //printf("MidiSyncConfig::heartBeat setting current red icon\n");
+
+ lvi->_curMTCDet = true;
+ lvi->_MTCDet = false;
+ lvi->setPixmap(DEVCOL_MTCIN, *record1_Icon);
+ }
+ }
+ else
+ if(!lvi->_MTCDet)
+ {
+ // Added by Tim. p3.3.6
+ //printf("MidiSyncConfig::heartBeat setting MTC on icon\n");
+
+ lvi->_MTCDet = true;
+ lvi->_curMTCDet = false;
+ lvi->setPixmap(DEVCOL_MTCIN, *dotIcon);
+ }
+
+ if(lvi->_recMTCtype != type)
+ {
+ lvi->_recMTCtype = type;
+ switch(type)
+ {
+ case 0:
+ lvi->setText(DEVCOL_MTCTYPE, "24");
+ break;
+ case 1:
+ lvi->setText(DEVCOL_MTCTYPE, "25");
+ break;
+ case 2:
+ lvi->setText(DEVCOL_MTCTYPE, "30D");
+ break;
+ case 3:
+ lvi->setText(DEVCOL_MTCTYPE, "30N");
+ break;
+ default:
+ lvi->setText(DEVCOL_MTCTYPE, "??");
+ break;
+ }
+ }
+ }
+ else
+ {
+ if(lvi->_curMTCDet || lvi->_MTCDet)
+ {
+ // Added by Tim. p3.3.6
+ //printf("MidiSyncConfig::heartBeat setting MTC off icon\n");
+
+ lvi->_MTCDet = false;
+ lvi->_curMTCDet = false;
+ lvi->setPixmap(DEVCOL_MTCIN, *dothIcon);
+ }
+ }
+ }
+
+ //MidiDevice* dev = lvi->device();
+ //bool sdet = dev->syncInfo().MCSyncDetect();
+ //if(lvi->pixmap(DEVCOL_IN) != (sdet ? *dotIcon : *dothIcon))
+ // lvi->setPixmap(DEVCOL_IN, sdet ? *dotIcon : *dothIcon);
+
+ lvi = (MidiSyncLViewItem*)lvi->nextSibling();
+ }
+
+ //inHeartBeat = false;
+}
+
+//---------------------------------------------------------
+// syncChanged
+// val = 1 - Master Mode
+// 0 - Slave Mode
+//---------------------------------------------------------
+
+void MidiSyncConfig::syncChanged()
+ {
+ setDirty();
+
+ //jackTransportMasterCheckbox->setEnabled(useJackTransport);
+
+ //acceptMTCCheckbox->setEnabled(val);
+// acceptMTCCheckbox->setEnabled(false);
+// acceptMCCheckbox->setEnabled(val);
+// acceptMMCCheckbox->setEnabled(val);
+ }
+
+//---------------------------------------------------------
+// extSyncChanged
+//---------------------------------------------------------
+
+void MidiSyncConfig::extSyncChanged(bool v)
+ {
+ extSyncCheckbox->blockSignals(true);
+ extSyncCheckbox->setChecked(v);
+// if(v)
+// song->setMasterFlag(false);
+ extSyncCheckbox->blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// ok Pressed
+//---------------------------------------------------------
+
+void MidiSyncConfig::ok()
+ {
+ apply();
+ cancel();
+ }
+
+//---------------------------------------------------------
+// cancel Pressed
+//---------------------------------------------------------
+
+void MidiSyncConfig::cancel()
+ {
+ _dirty = false;
+ if(applyButton->isEnabled())
+ applyButton->setEnabled(false);
+
+ close(false);
+ }
+
+//---------------------------------------------------------
+// show
+//---------------------------------------------------------
+
+void MidiSyncConfig::show()
+{
+ songChanged(-1);
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat()));
+ QDialog::show();
+}
+
+//---------------------------------------------------------
+// closeEvent
+//---------------------------------------------------------
+
+void MidiSyncConfig::closeEvent(QCloseEvent* e)
+ {
+ if(_dirty)
+ {
+ int n = QMessageBox::warning(this, tr("MusE"),
+ tr("Settings have changed\n"
+ "Apply sync settings?"),
+ tr("&Apply"), tr("&No"), tr("&Abort"), 0, 2);
+
+ if(n == 2)
+ {
+ e->ignore();
+ return;
+ }
+
+ if(n == 0)
+ apply();
+ }
+
+ //emit deleted((unsigned long)this);
+
+ disconnect(heartBeatTimer, SIGNAL(timeout()), this, SLOT(heartBeat()));
+ disconnect(song, SIGNAL(songChanged(int)), this, SLOT(songChanged(int)));
+
+ e->accept();
+ }
+
+//---------------------------------------------------------
+// apply Pressed
+//---------------------------------------------------------
+
+void MidiSyncConfig::apply()
+{
+// txDeviceId = dstDevId->value();
+// rxDeviceId = srcDevId->value();
+// rxSyncPort = srcSyncPort->value() - 1;
+// txSyncPort = dstSyncPort->value() - 1;
+
+// genMTCSync = mtcSync->isChecked();
+// genMCSync = mcSync->isChecked();
+// genMMC = midiMachineControl->isChecked();
+
+ syncSendFirstClockDelay = syncDelaySpinBox->value();
+
+ mtcType = mtcSyncType->currentItem();
+ //extSyncFlag.setValue(syncMode->id(syncMode->selected()));
+ //extSyncFlag.blockSignals(true);
+ extSyncFlag.setValue(extSyncCheckbox->isChecked());
+// if(extSyncFlag.value())
+// song->setMasterFlag(false);
+ //extSyncFlag.blockSignals(false);
+ useJackTransport.setValue(useJackTransportCheckbox->isChecked());
+// if(useJackTransport)
+ jackTransportMaster = jackTransportMasterCheckbox->isChecked();
+// else
+// jackTransportMaster = false;
+// jackTransportMasterCheckbox->setEnabled(useJackTransport);
+ if(audioDevice)
+ audioDevice->setMaster(jackTransportMaster);
+
+ mtcOffset.setH(mtcOffH->value());
+ mtcOffset.setM(mtcOffM->value());
+ mtcOffset.setS(mtcOffS->value());
+ mtcOffset.setF(mtcOffF->value());
+ mtcOffset.setSf(mtcOffSf->value());
+
+// acceptMC = acceptMCCheckbox->isChecked();
+// acceptMMC = acceptMMCCheckbox->isChecked();
+// acceptMTC = acceptMTCCheckbox->isChecked();
+
+ MidiSyncLViewItem* lvi = (MidiSyncLViewItem*)devicesListView->firstChild();
+ while(lvi)
+ {
+ //MidiDevice* dev = lvi->device();
+ // Does the device really exist?
+ //if(midiDevices.find(dev) != midiDevices.end())
+ // dev->syncInfo().copyParams(lvi->syncInfo());
+ int port = lvi->port();
+ if(port >= 0 && port < MIDI_PORTS)
+ //midiPorts[port].syncInfo().copyParams(lvi->syncInfo());
+ lvi->copyToSyncInfo(midiPorts[port].syncInfo());
+
+ lvi = (MidiSyncLViewItem*)lvi->nextSibling();
+ }
+
+ //muse->changeConfig(true); // save settings
+
+ _dirty = false;
+ if(applyButton->isEnabled())
+ applyButton->setEnabled(false);
+
+ // Do not call this. Causes freeze sometimes. Only will be needed if extra pollfds are used by midi seq thread.
+ //midiSeq->msgUpdatePollFd();
+}
+
+//---------------------------------------------------------
+// updateSyncInfoLV
+//---------------------------------------------------------
+
+void MidiSyncConfig::updateSyncInfoLV()
+ {
+ devicesListView->clear();
+ for(int i = MIDI_PORTS-1; i >= 0; --i)
+ {
+ MidiPort* port = &midiPorts[i];
+ MidiDevice* dev = port->device();
+ // p3.3.31
+ // Don't show if it is a synthesizer device.
+ // Hmm, some synths might support transport commands or even sync?
+ // If anything, the DSSI or VST synths just might...
+ // TODO: Must test to see if it screws any of them up, especially clock out.
+ // Also, if we do this, we must prevent such messages from reaching
+ // those ports at several other places in the code.
+ //if(dev && dev->isSynti())
+ // continue;
+
+ QString s;
+ s.setNum(i+1);
+ MidiSyncLViewItem* lvi = new MidiSyncLViewItem(devicesListView);
+ lvi->setPort(i); // setPort will copy parameters.
+ //MidiSyncInfo& si = lvi->syncInfo();
+ //si.copyParams(port->syncInfo());
+ //lvi.copyFromSyncInfo(port->syncInfo());
+ MidiSyncInfo& portsi = port->syncInfo();
+
+ lvi->setText(DEVCOL_NO, s);
+
+ if (dev)
+ lvi->setText(DEVCOL_NAME, dev->name());
+ else
+ lvi->setText(DEVCOL_NAME, tr("<none>"));
+
+ if(portsi.MCSyncDetect())
+ {
+ if(i == curMidiSyncInPort)
+ {
+ lvi->_curDet = true;
+ lvi->_inDet = false;
+ lvi->setPixmap(DEVCOL_IN, *record1_Icon);
+ }
+ else
+ {
+ lvi->_curDet = false;
+ lvi->_inDet = true;
+ lvi->setPixmap(DEVCOL_IN, *dotIcon);
+ }
+ }
+ else
+ {
+ lvi->_curDet = false;
+ lvi->_inDet = false;
+ lvi->setPixmap(DEVCOL_IN, *dothIcon);
+ }
+
+ if(portsi.tickDetect())
+ {
+ lvi->_tickDet = true;
+ lvi->setPixmap(DEVCOL_TICKIN, *dotIcon);
+ }
+ else
+ {
+ lvi->_tickDet = false;
+ lvi->setPixmap(DEVCOL_TICKIN, *dothIcon);
+ }
+
+ if(portsi.MRTDetect())
+ {
+ lvi->_MRTDet = true;
+ lvi->setPixmap(DEVCOL_MRTIN, *dotIcon);
+ }
+ else
+ {
+ lvi->_MRTDet = false;
+ lvi->setPixmap(DEVCOL_MRTIN, *dothIcon);
+ }
+
+ if(portsi.MMCDetect())
+ {
+ lvi->_MMCDet = true;
+ lvi->setPixmap(DEVCOL_MMCIN, *dotIcon);
+ // MMC locate command can have SMPTE format bits...
+ if(lvi->_recMTCtype != portsi.recMTCtype())
+ {
+ switch(portsi.recMTCtype())
+ {
+ case 0:
+ lvi->setText(DEVCOL_MTCTYPE, "24");
+ break;
+ case 1:
+ lvi->setText(DEVCOL_MTCTYPE, "25");
+ break;
+ case 2:
+ lvi->setText(DEVCOL_MTCTYPE, "30D");
+ break;
+ case 3:
+ lvi->setText(DEVCOL_MTCTYPE, "30N");
+ break;
+ default:
+ lvi->setText(DEVCOL_MTCTYPE, "??");
+ break;
+ }
+ }
+ }
+ else
+ {
+ lvi->_MMCDet = false;
+ lvi->setPixmap(DEVCOL_MMCIN, *dothIcon);
+ }
+
+ if(portsi.MTCDetect())
+ {
+ if(i == curMidiSyncInPort)
+ {
+ lvi->_curMTCDet = true;
+ lvi->_MTCDet = false;
+ lvi->setPixmap(DEVCOL_MTCIN, *record1_Icon);
+ }
+ else
+ {
+ lvi->_curMTCDet = false;
+ lvi->_MTCDet = true;
+ lvi->setPixmap(DEVCOL_MTCIN, *dotIcon);
+ }
+
+ if(lvi->_recMTCtype != portsi.recMTCtype())
+ {
+ switch(portsi.recMTCtype())
+ {
+ case 0:
+ lvi->setText(DEVCOL_MTCTYPE, "24");
+ break;
+ case 1:
+ lvi->setText(DEVCOL_MTCTYPE, "25");
+ break;
+ case 2:
+ lvi->setText(DEVCOL_MTCTYPE, "30D");
+ break;
+ case 3:
+ lvi->setText(DEVCOL_MTCTYPE, "30N");
+ break;
+ default:
+ lvi->setText(DEVCOL_MTCTYPE, "??");
+ break;
+ }
+ }
+ }
+ else
+ {
+ lvi->_curMTCDet = false;
+ lvi->_MTCDet = false;
+ lvi->setPixmap(DEVCOL_MTCIN, *dothIcon);
+ //lvi->setText(DEVCOL_MTCTYPE, "--");
+ }
+
+ //lvi->setText(DEVCOL_RID, QString().setNum(si.idIn()) );
+ //lvi->setRenameEnabled(DEVCOL_RID, true);
+ //lvi->setPixmap(DEVCOL_RCLK, si.MCIn() ? *dotIcon : *dothIcon);
+ //lvi->setPixmap(DEVCOL_RMMC, si.MMCIn() ? *dotIcon : *dothIcon);
+ //lvi->setPixmap(DEVCOL_RMTC, si.MTCIn() ? *dotIcon : *dothIcon);
+ lvi->setText(DEVCOL_RID, QString().setNum(lvi->_idIn) );
+ lvi->setPixmap(DEVCOL_RCLK, lvi->_recMC ? *dotIcon : *dothIcon);
+ lvi->setPixmap(DEVCOL_RMRT, lvi->_recMRT ? *dotIcon : *dothIcon);
+ lvi->setPixmap(DEVCOL_RMMC, lvi->_recMMC ? *dotIcon : *dothIcon);
+ lvi->setPixmap(DEVCOL_RMTC, lvi->_recMTC ? *dotIcon : *dothIcon);
+ lvi->setPixmap(DEVCOL_RREWSTART, lvi->_recRewOnStart ? *dotIcon : *dothIcon);
+
+ //lvi->setText(DEVCOL_TID, QString().setNum(si.idOut()) );
+ //lvi->setRenameEnabled(DEVCOL_TID, true);
+ //lvi->setPixmap(DEVCOL_TCLK, si.MCOut() ? *dotIcon : *dothIcon);
+ //lvi->setPixmap(DEVCOL_TMMC, si.MMCOut() ? *dotIcon : *dothIcon);
+ //lvi->setPixmap(DEVCOL_TMTC, si.MTCOut() ? *dotIcon : *dothIcon);
+ lvi->setText(DEVCOL_TID, QString().setNum(lvi->_idOut) );
+ lvi->setPixmap(DEVCOL_TCLK, lvi->_sendMC ? *dotIcon : *dothIcon);
+ lvi->setPixmap(DEVCOL_TMRT, lvi->_sendMRT ? *dotIcon : *dothIcon);
+ lvi->setPixmap(DEVCOL_TMMC, lvi->_sendMMC ? *dotIcon : *dothIcon);
+ lvi->setPixmap(DEVCOL_TMTC, lvi->_sendMTC ? *dotIcon : *dothIcon);
+ //lvi->setPixmap(DEVCOL_TREWSTART, lvi->_sendContNotStart ? *dotIcon : *dothIcon);
+
+ devicesListView->insertItem(lvi);
+ }
+
+ /*
+ for(iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id)
+ {
+ MidiDevice* dev = *id;
+
+ //MidiPort* port = &midiPorts[i];
+ //MidiDevice* dev = port->device();
+ MidiSyncLViewItem* lvi = new MidiSyncLViewItem(devicesListView);
+ //lvi->setPort(i);
+ // setDevice will copy parameters.
+ lvi->setDevice(dev);
+ MidiSyncInfo& si = lvi->syncInfo();
+ //si.copyParams(dev->syncInfo());
+
+ lvi->setText(DEVCOL_NAME, dev->name());
+
+ lvi->setPixmap(DEVCOL_IN, si.MCSyncDetect() ? *dotIcon : *dothIcon);
+
+ lvi->setText(DEVCOL_RID, QString().setNum(si.idIn()) );
+ lvi->setPixmap(DEVCOL_RCLK, si.MCIn() ? *dotIcon : *dothIcon);
+ lvi->setPixmap(DEVCOL_RMMC, si.MMCIn() ? *dotIcon : *dothIcon);
+ lvi->setPixmap(DEVCOL_RMTC, si.MTCIn() ? *dotIcon : *dothIcon);
+
+ lvi->setText(DEVCOL_TID, QString().setNum(si.idOut()) );
+ lvi->setPixmap(DEVCOL_TCLK, si.MCOut() ? *dotIcon : *dothIcon);
+ lvi->setPixmap(DEVCOL_TMMC, si.MMCOut() ? *dotIcon : *dothIcon);
+ lvi->setPixmap(DEVCOL_TMTC, si.MTCOut() ? *dotIcon : *dothIcon);
+
+ devicesListView->insertItem(lvi);
+ }
+ */
+
+ }
+
+
+//---------------------------------------------------------
+// dlvClicked
+//---------------------------------------------------------
+
+//void MidiSyncConfig::dlvClicked(QListViewItem* item, const QPoint&, int col)
+void MidiSyncConfig::dlvClicked(int /*button*/, Q3ListViewItem* item, const QPoint&, int col)
+{
+ if (item == 0)
+ return;
+
+ MidiSyncLViewItem* lvi = (MidiSyncLViewItem*)item;
+ int no = lvi->port();
+ if (no < 0 || no >= MIDI_PORTS)
+ return;
+ //MidiDevice* dev = lvi->device();
+ // Does the device really exist?
+ //if(midiDevices.find(dev) == midiDevices.end())
+ // return;
+
+ //int n;
+ //MidiPort* port = &midiPorts[no];
+ //MidiDevice* dev = port->device();
+ //int rwFlags = dev ? dev->rwFlags() : 0;
+ //int openFlags = dev ? dev->openFlags() : 0;
+ //MidiSyncInfo& si = lvi->syncInfo();
+ //MidiSyncInfo& portsi = midiPorts[no].syncInfo();
+
+ switch (col)
+ {
+ case DEVCOL_NO:
+ break;
+ case DEVCOL_NAME:
+ break;
+ case DEVCOL_IN:
+ // If this is not the current midi sync in port, and sync in from this port is enabled,
+ // and sync is in fact detected on this port, allow the user to force this port to now be the
+ // current sync in port.
+ //if(no != curMidiSyncInPort && si.MCIn() && midiPorts[no].syncInfo().MCSyncDetect())
+ //if(no != curMidiSyncInPort && lvi->_recMC && midiPorts[no].syncInfo().MCSyncDetect())
+ if(no != curMidiSyncInPort)
+ {
+ if(lvi->_recMC && midiPorts[no].syncInfo().MCSyncDetect())
+ {
+ curMidiSyncInPort = no;
+ lvi->setPixmap(DEVCOL_IN, *record1_Icon);
+ }
+ if(lvi->_recMTC && midiPorts[no].syncInfo().MTCDetect())
+ {
+ curMidiSyncInPort = no;
+ lvi->setPixmap(DEVCOL_MTCIN, *record1_Icon);
+ }
+ }
+ break;
+ case DEVCOL_TICKIN:
+ break;
+ case DEVCOL_MMCIN:
+ break;
+ case DEVCOL_MTCIN:
+ // If this is not the current midi sync in port, and sync in from this port is enabled,
+ // and sync is in fact detected on this port, allow the user to force this port to now be the
+ // current sync in port.
+ //if(no != curMidiSyncInPort && si.MTCIn() && midiPorts[no].syncInfo().MTCDetect())
+ //if(no != curMidiSyncInPort && lvi->_recMTC && midiPorts[no].syncInfo().MTCDetect())
+ if(no != curMidiSyncInPort)
+ {
+ if(lvi->_recMTC && midiPorts[no].syncInfo().MTCDetect())
+ {
+ curMidiSyncInPort = no;
+ lvi->setPixmap(DEVCOL_MTCIN, *record1_Icon);
+ }
+ if(lvi->_recMC && midiPorts[no].syncInfo().MCSyncDetect())
+ {
+ curMidiSyncInPort = no;
+ lvi->setPixmap(DEVCOL_IN, *record1_Icon);
+ }
+ }
+ break;
+ case DEVCOL_MTCTYPE:
+ break;
+ case DEVCOL_RID:
+ break;
+ case DEVCOL_RCLK:
+ //si.setMCIn(si.MCIn() ? false : true);
+ //lvi->setPixmap(DEVCOL_RCLK, si.MCIn() ? *dotIcon : *dothIcon);
+ lvi->_recMC = (lvi->_recMC ? false : true);
+ lvi->setPixmap(DEVCOL_RCLK, lvi->_recMC ? *dotIcon : *dothIcon);
+ setDirty();
+ break;
+ case DEVCOL_RMRT:
+ lvi->_recMRT = (lvi->_recMRT ? false : true);
+ lvi->setPixmap(DEVCOL_RMRT, lvi->_recMRT ? *dotIcon : *dothIcon);
+ setDirty();
+ break;
+ case DEVCOL_RMMC:
+ //si.setMMCIn(si.MMCIn() ? false : true);
+ //lvi->setPixmap(DEVCOL_RMMC, si.MMCIn() ? *dotIcon : *dothIcon);
+ lvi->_recMMC = (lvi->_recMMC ? false : true);
+ lvi->setPixmap(DEVCOL_RMMC, lvi->_recMMC ? *dotIcon : *dothIcon);
+ setDirty();
+ break;
+ case DEVCOL_RMTC:
+ //si.setMTCIn(si.MTCIn() ? false : true);
+ //lvi->setPixmap(DEVCOL_RMTC, si.MTCIn() ? *dotIcon : *dothIcon);
+ lvi->_recMTC = (lvi->_recMTC ? false : true);
+ lvi->setPixmap(DEVCOL_RMTC, lvi->_recMTC ? *dotIcon : *dothIcon);
+ setDirty();
+ break;
+ case DEVCOL_RREWSTART:
+ lvi->_recRewOnStart = (lvi->_recRewOnStart ? false : true);
+ lvi->setPixmap(DEVCOL_RREWSTART, lvi->_recRewOnStart ? *dotIcon : *dothIcon);
+ setDirty();
+ break;
+ case DEVCOL_TID:
+ break;
+ case DEVCOL_TCLK:
+ //si.setMCOut(si.MCOut() ? false : true);
+ //lvi->setPixmap(DEVCOL_TCLK, si.MCOut() ? *dotIcon : *dothIcon);
+ lvi->_sendMC = (lvi->_sendMC ? false : true);
+ lvi->setPixmap(DEVCOL_TCLK, lvi->_sendMC ? *dotIcon : *dothIcon);
+ setDirty();
+ break;
+ case DEVCOL_TMRT:
+ lvi->_sendMRT = (lvi->_sendMRT ? false : true);
+ lvi->setPixmap(DEVCOL_TMRT, lvi->_sendMRT ? *dotIcon : *dothIcon);
+ setDirty();
+ break;
+ case DEVCOL_TMMC:
+ //si.setMMCOut(si.MMCOut() ? false : true);
+ //lvi->setPixmap(DEVCOL_TMMC, si.MMCOut() ? *dotIcon : *dothIcon);
+ lvi->_sendMMC = (lvi->_sendMMC ? false : true);
+ lvi->setPixmap(DEVCOL_TMMC, lvi->_sendMMC ? *dotIcon : *dothIcon);
+ setDirty();
+ break;
+ case DEVCOL_TMTC:
+ //si.setMTCOut(si.MTCOut() ? false : true);
+ //lvi->setPixmap(DEVCOL_TMTC, si.MTCOut() ? *dotIcon : *dothIcon);
+ lvi->_sendMTC = (lvi->_sendMTC ? false : true);
+ lvi->setPixmap(DEVCOL_TMTC, lvi->_sendMTC ? *dotIcon : *dothIcon);
+ setDirty();
+ break;
+ //case DEVCOL_TREWSTART:
+ // lvi->_sendContNotStart = (lvi->_sendContNotStart ? false : true);
+ // lvi->setPixmap(DEVCOL_TREWSTART, lvi->_sendContNotStart ? *dotIcon : *dothIcon);
+ // setDirty();
+ // break;
+ }
+ //songChanged(-1);
+}
+
+//---------------------------------------------------------
+// dlvDoubleClicked
+//---------------------------------------------------------
+
+void MidiSyncConfig::dlvDoubleClicked(Q3ListViewItem* item, const QPoint&, int col)
+{
+ if(!item)
+ return;
+
+ MidiSyncLViewItem* lvi = (MidiSyncLViewItem*)item;
+
+ //if(col == DEVCOL_RID)
+ // lvi->startRename(DEVCOL_RID);
+ //else
+ //if(col == DEVCOL_TID)
+ // lvi->startRename(DEVCOL_TID);
+
+ bool ok = false;
+ if(col == DEVCOL_RID)
+ {
+ //int val = lvi->syncInfo().idIn();
+ int val = lvi->_idIn;
+ int newval = QInputDialog::getInteger("Muse: Sync info" , "Enter new id number (127 = all):", val, 0, 127, 1, &ok, this);
+ if(ok)
+ {
+ //lvi->syncInfo().setIdIn(newval);
+ lvi->_idIn = newval;
+ lvi->setText(DEVCOL_RID, QString().setNum(newval));
+ }
+ }
+ else
+ if(col == DEVCOL_TID)
+ {
+ //int val = lvi->syncInfo().idOut();
+ int val = lvi->_idOut;
+ int newval = QInputDialog::getInteger("Muse: Sync info" , "Enter new id number (127 = global):", val, 0, 127, 1, &ok, this);
+ if(ok)
+ {
+ //lvi->syncInfo().setIdOut(newval);
+ lvi->_idOut = newval;
+ lvi->setText(DEVCOL_TID, QString().setNum(newval));
+ }
+ }
+
+ if(ok)
+ setDirty();
+}
+
+/*
+//---------------------------------------------------------
+// renameOk
+//---------------------------------------------------------
+//void MidiSyncConfig::renameOk(QListViewItem* item, int col)
+void MidiSyncConfig::renameOk(QListViewItem* item, int col, const QString & text)
+{
+ if(!item)
+ return;
+
+ MidiSyncLViewItem* lvi = (MidiSyncLViewItem*)item;
+ QString t = text;
+ bool ok;
+ int id = text.toInt(&ok);
+ if(!ok)
+ {
+ lvi->setText(t);
+ return;
+ }
+ if(col == DEVCOL_RID)
+ {
+ //lvi->syncInfo().setIdIn(id);
+ lvi->_idIn = id;
+ setDirty();
+ }
+ else
+ if(col == DEVCOL_TID)
+ {
+ //lvi->syncInfo().setIdOut(id);
+ lvi->_idOut = id;
+ setDirty();
+ }
+}
+*/
+
+//---------------------------------------------------------
+// MidiSyncConfig::setDirty
+//---------------------------------------------------------
+
+void MidiSyncConfig::setDirty()
+{
+ _dirty = true;
+ if(!applyButton->isEnabled())
+ applyButton->setEnabled(true);
+}
+
diff --git a/muse2/muse/widgets/midisyncimpl.h b/muse2/muse/widgets/midisyncimpl.h
new file mode 100644
index 00000000..a804e85f
--- /dev/null
+++ b/muse2/muse/widgets/midisyncimpl.h
@@ -0,0 +1,150 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: midisyncimpl.h,v 1.1.1.1.2.3 2009/05/03 04:14:01 terminator356 Exp $
+//
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MIDISYNCIMPL_H__
+#define __MIDISYNCIMPL_H__
+
+#include <q3whatsthis.h>
+#include <q3listview.h>
+#include <qtooltip.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+//#include <qheader.h>
+#include "midisync.h"
+#include "sync.h"
+
+//class QWhatsThis;
+//class QListView;
+//class QListViewItem;
+class Q3Header;
+//class MidiDevice;
+
+//----------------------------------------------------------
+// MSyncHeaderTip
+//----------------------------------------------------------
+
+class MSyncHeaderTip /*: public QToolTip ddskrjo*/ {
+ QWidget *_parent;
+ public:
+ MSyncHeaderTip(QWidget * parent) : _parent(parent) {} // ddskrjo
+ virtual ~MSyncHeaderTip() {}
+ protected:
+ void maybeTip(const QPoint &);
+ };
+
+//---------------------------------------------------------
+// MSyncWhatsThis
+//---------------------------------------------------------
+
+class MSyncWhatsThis : public Q3WhatsThis {
+ Q3Header* header;
+
+ protected:
+ QString text(const QPoint&);
+
+ public:
+ MSyncWhatsThis(QWidget* parent, Q3Header* h) : Q3WhatsThis(parent) {
+ header = h;
+ }
+ };
+
+class MidiSyncLViewItem : public Q3ListViewItem
+{
+ //MidiSyncInfo _syncInfo;
+ //MidiDevice* _device;
+ int _port;
+
+ //protected:
+ //int _port;
+
+ public:
+ MidiSyncLViewItem(Q3ListView* parent)
+ : Q3ListViewItem(parent) { _port = -1; _inDet = _curDet = _tickDet = false; }
+ //: QListViewItem(parent) { _device = 0; }
+
+ //MidiSyncLViewItem(QListView* parent, QListViewItem* after)
+ // : QListViewItem(parent, after) { _port = -1; }
+
+ //virtual QString text(int column) const;
+ //virtual unsigned tick() = 0;
+
+ //int _port;
+ bool _inDet;
+ bool _curDet;
+ bool _curMTCDet;
+ bool _tickDet;
+ bool _MRTDet;
+ bool _MMCDet;
+ bool _MTCDet;
+ int _recMTCtype;
+
+ int _idOut;
+ int _idIn;
+
+ bool _sendMC;
+ bool _sendMRT;
+ bool _sendMMC;
+ bool _sendMTC;
+ bool _recMC;
+ bool _recMRT;
+ bool _recMMC;
+ bool _recMTC;
+
+ bool _recRewOnStart;
+ //bool _sendContNotStart;
+
+ int port() const { return _port; }
+ void setPort(int port);
+ //MidiDevice* device() const { return _device; }
+ //void setDevice(MidiDevice* d);
+
+ //MidiSyncInfo& syncInfo() { return _syncInfo; }
+ void copyFromSyncInfo(const MidiSyncInfo &sp);
+ void copyToSyncInfo(MidiSyncInfo &sp);
+};
+
+//---------------------------------------------------------
+// MSConfig
+//---------------------------------------------------------
+
+class MidiSyncConfig : public MidiSyncConfigBase {
+ Q_OBJECT
+ MSyncHeaderTip* _synctooltip;
+
+ bool inHeartBeat;
+ bool _dirty;
+
+ void updateSyncInfoLV();
+ void closeEvent(QCloseEvent*);
+
+ private slots:
+ void heartBeat();
+ void syncChanged();
+ void extSyncChanged(bool v);
+ void ok();
+ void cancel();
+ void apply();
+ //void dlvClicked(QListViewItem*, const QPoint&, int);
+ void dlvClicked(int, Q3ListViewItem*, const QPoint&, int);
+ void dlvDoubleClicked(Q3ListViewItem*, const QPoint&, int);
+ //void renameOk(QListViewItem*, int, const QString&);
+ void songChanged(int);
+
+ //signals:
+ // void deleted(unsigned long);
+
+ public:
+ MidiSyncConfig(QWidget* parent=0, const char* name=0);
+ //MidiSyncConfig();
+ ~MidiSyncConfig();
+ void show();
+ void setDirty();
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/mittransposebase.ui b/muse2/muse/widgets/mittransposebase.ui
new file mode 100644
index 00000000..60cd4d9b
--- /dev/null
+++ b/muse2/muse/widgets/mittransposebase.ui
@@ -0,0 +1,117 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>MITTransposeBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>MITTransposeBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>423</width>
+ <height>50</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Midi Input Plugin: Transpose</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>onCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>On</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>TriggerKey</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="indent">
+ <number>5</number>
+ </property>
+ </widget>
+ <widget class="PitchEdit">
+ <property name="name">
+ <cstring>triggerKeySpinBox</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Transpose:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="indent">
+ <number>5</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>transposeLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </property>
+ <property name="frameShape">
+ <enum>Panel</enum>
+ </property>
+ <property name="lineWidth">
+ <number>2</number>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <property name="midLineWidth">
+ <number>2</number>
+ </property>
+ <property name="text">
+ <string>+0</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="indent">
+ <number>5</number>
+ </property>
+ </widget>
+ </hbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includes>
+ <include location="local" impldecl="in declaration">pitchedit.h</include>
+</includes>
+</UI>
+
diff --git a/muse2/muse/widgets/mixdowndialog.cpp b/muse2/muse/widgets/mixdowndialog.cpp
new file mode 100644
index 00000000..0681ca2e
--- /dev/null
+++ b/muse2/muse/widgets/mixdowndialog.cpp
@@ -0,0 +1,108 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mixdowndialog.cpp,v 1.1.1.1 2003/10/27 18:55:02 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "mixdowndialog.h"
+#include "globals.h"
+#include <qtoolbutton.h>
+#include <qpushbutton.h>
+#include <q3filedialog.h>
+#include <qcombobox.h>
+#include <qlineedit.h>
+#include "wave.h"
+
+//---------------------------------------------------------
+// sndFileOpen
+// sf - old soundfile, used to preset file parameters
+//---------------------------------------------------------
+
+SndFile* getSndFile(const SndFile* sf, QWidget* parent, const char* name)
+ {
+ MixdownFileDialog* dialog = new MixdownFileDialog(sf, parent,
+ name, true);
+ dialog->exec();
+ SndFile* sndFile = dialog->sndFile();
+ delete dialog;
+ return sndFile;
+ }
+
+//---------------------------------------------------------
+// MixdownFileDialog
+//---------------------------------------------------------
+
+MixdownFileDialog::MixdownFileDialog(const SndFile* _sf,
+ QWidget* parent, const char* name, bool /*modal*/, Qt::WFlags fl)
+ : MixdownFileDialogBase(parent, name, true, fl)
+ {
+ sf = 0;
+ connect(buttonPath, SIGNAL(clicked()), SLOT(fdialog()));
+ if (_sf) {
+ int channels = _sf->channels();
+ int format = _sf->format();
+ switch(channels) {
+ case 1: channels = 1; break;
+ case 2: channels = 0; break;
+ case 6: channels = 2; break;
+ }
+ editPath->setText(_sf->path());
+ comboChannel->setCurrentItem(channels);
+ comboFormat->setCurrentItem(format);
+ }
+ }
+
+//---------------------------------------------------------
+// accept
+//---------------------------------------------------------
+
+void MixdownFileDialog::accept()
+ {
+ QString oldpath;
+ unsigned channel = comboChannel->currentItem();
+ unsigned format = comboFormat->currentItem();
+ switch (channel) {
+ case 0: channel = 2; break;
+ case 1: channel = 1; break;
+ case 2: channel = 6; break; // not implemented!
+ }
+ switch (format) {
+ case 0: // 16 bit wave
+ format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
+ break;
+ case 1: // 24 bit wave
+ format = SF_FORMAT_WAV | SF_FORMAT_PCM_24;
+ break;
+ case 2: // 32 bit float wave
+ format = SF_FORMAT_WAV | SF_FORMAT_FLOAT;
+ break;
+ }
+ QString path = editPath->text();
+ if (path.isEmpty()) {
+ sf = 0;
+ reject();
+ return;
+ }
+ if (path.right(4) != ".wav")
+ path += ".wav";
+ sf = new SndFile(path);
+ sf->setFormat(format, channel, sampleRate);
+ done(1);
+ }
+
+//---------------------------------------------------------
+// fdialog
+//---------------------------------------------------------
+
+void MixdownFileDialog::fdialog()
+ {
+ QString oldpath;
+ if (sf)
+ oldpath = sf->path();
+ QString path = Q3FileDialog::getSaveFileName(
+ oldpath, tr("Wave Files (*.wav);;All Files (*)"), this, "MixdownFileDialog");
+ if (!path.isEmpty())
+ editPath->setText(path);
+ }
+
diff --git a/muse2/muse/widgets/mixdowndialog.h b/muse2/muse/widgets/mixdowndialog.h
new file mode 100644
index 00000000..95440b38
--- /dev/null
+++ b/muse2/muse/widgets/mixdowndialog.h
@@ -0,0 +1,37 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mixdowndialog.h,v 1.1.1.1 2003/10/27 18:54:28 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MIXDOWNDIALOG_H__
+#define __MIXDOWNDIALOG_H__
+
+#include "mixdowndialogbase.h"
+
+class SndFile;
+
+extern SndFile* getSndFile(const SndFile* sf, QWidget* parent,
+ const char* name);
+
+//---------------------------------------------------------
+// MixdownFileDialog
+//---------------------------------------------------------
+
+class MixdownFileDialog : public MixdownFileDialogBase {
+ Q_OBJECT
+ SndFile* sf;
+
+ private slots:
+ void fdialog();
+ virtual void accept();
+
+ public:
+ MixdownFileDialog(const SndFile* f, QWidget* parent = 0,
+ const char* name = 0, bool modal = false, Qt::WFlags fl = 0);
+ SndFile* sndFile() { return sf; }
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/mixdowndialogbase.ui b/muse2/muse/widgets/mixdowndialogbase.ui
new file mode 100644
index 00000000..830d2a8e
--- /dev/null
+++ b/muse2/muse/widgets/mixdowndialogbase.ui
@@ -0,0 +1,224 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>MixdownFileDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MixdownFileDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>381</width>
+ <height>116</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Set Mixdown Wavefile</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="5">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>File Path</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Channel</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="1" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>Layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>editPath</cstring>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>buttonPath</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="pixmap">
+ <pixmap>image0</pixmap>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>Stereo</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Mono</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>5.1</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>comboChannel</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="4">
+ <item>
+ <property name="text">
+ <string>wav,16 Bit</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>wav, 24 Bit</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>wav, 32 Bit (float)</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>comboFormat</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="3">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Format</string>
+ </property>
+ </widget>
+ <spacer row="1" column="2">
+ <property name="name" stdset="0">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="469">789c5d8fb10ac2301040f77c45e86d45ac955607f1131447411c2e97141daaa07510f1dfcd256992fadae1de23e9d1aa94c7c34e9695780e385c49d2051fb2d4afbe7f9fcedb8f28ea95b4ef5ad6c54c147349727fbf199ec1ceb070b01a566cb0c68655b3524b4b6a5989551b7e5891b5eb105b64555eb541725b1c60f1536c36b80aa9417636dd1de37fcbcea5cfc71d804a2178625316f4406a90e31b02254203d216f7db06c20ed77c1adb34a516526cd314ce6570fb6ec40ff56a68fe</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MixdownFileDialogBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>MixdownFileDialogBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/mktest b/muse2/muse/widgets/mktest
new file mode 100644
index 00000000..08738898
--- /dev/null
+++ b/muse2/muse/widgets/mktest
@@ -0,0 +1,5 @@
+CPPFLAGS = -I/usr/qt/include -I..
+
+mops: mops.o musewidgetsplug.o
+ g++ -o mops mops.o musewidgetsplug.o -L . -l musewidgetsplugin -L /usr/qt/lib -l qt-mt
+
diff --git a/muse2/muse/widgets/mlabel.cpp b/muse2/muse/widgets/mlabel.cpp
new file mode 100644
index 00000000..a6c1b183
--- /dev/null
+++ b/muse2/muse/widgets/mlabel.cpp
@@ -0,0 +1,17 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mlabel.cpp,v 1.1.1.1 2003/10/27 18:55:03 wschweer Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "mlabel.h"
+//Added by qt3to4:
+#include <QMouseEvent>
+
+
+void MLabel::mousePressEvent(QMouseEvent*)
+ {
+ emit mousePressed();
+ }
+
diff --git a/muse2/muse/widgets/mlabel.h b/muse2/muse/widgets/mlabel.h
new file mode 100644
index 00000000..490e8686
--- /dev/null
+++ b/muse2/muse/widgets/mlabel.h
@@ -0,0 +1,39 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mlabel.h,v 1.1.1.1 2003/10/27 18:55:03 wschweer Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MLABEL_H__
+#define __MLABEL_H__
+
+#include <qlabel.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+
+//---------------------------------------------------------
+// MLabel
+// label widged which sends signal mousePressed
+// on mousePressEvent
+//---------------------------------------------------------
+
+class MLabel : public QLabel {
+
+ Q_OBJECT
+
+ protected:
+ virtual void mousePressEvent(QMouseEvent*);
+
+ signals:
+ void mousePressed();
+
+ public:
+ MLabel(const QString& txt, QWidget* parent, const char* name = 0)
+ : QLabel(txt, parent, name) {};
+
+ MLabel(QWidget* parent, const char* name = 0)
+ : QLabel(parent, name) {};
+ };
+#endif
+
diff --git a/muse2/muse/widgets/mmath.cpp b/muse2/muse/widgets/mmath.cpp
new file mode 100644
index 00000000..acc8e25a
--- /dev/null
+++ b/muse2/muse/widgets/mmath.cpp
@@ -0,0 +1,300 @@
+#include <cmath>
+#include "mmath.h"
+
+// QwtMath - a set of mathematical routines
+//
+// qwtGetMin -- Find the smallest value in an array
+// qwtGetMax -- Find the largest value in an array
+// qwtTwistArray -- invert the order of an array
+// qwtFloor125 -- Find the largest value fitting in a 1-2-5 pattern
+// qwtCeil125 -- Find the smallest value fitting in a 1-2-5 pattern
+// qwtChkMono -- Check for monotony
+// qwtLinSpace -- construct an array of equally spaced values
+// qwtLogSpace -- construct an array of logarithmically equally spaced values
+// qwtMax -- Return the largest of two values
+// qwtMin -- Return the smallest of two values
+// qwtAbs -- return the absolute value
+// qwtSign -- Return the sign of a number
+// qwtSqr -- Return the square of a number
+// qwtCopyArray -- Copy an array into another
+// qwtShiftArray -- Shift an array
+// qwtSwap -- Swap two values
+// qwtSort (1) -- Sort two values
+// qwtSort (2) -- Sort two values
+// qwtInt -- Return nearest integer
+// qwtLim -- Limit a values
+
+
+//------------------------------------------------------------
+//.F qwtGetMin
+// Find the smallest value in an array
+//
+//.u Syntax
+//.f double qwtGetMin(double *array, int size)
+//
+//.u Parameters
+//.p double *array, int size
+//
+//------------------------------------------------------------
+
+double qwtGetMin(double *array, int size)
+{
+ double rv;
+ int i;
+
+ if (size > 0)
+ {
+ rv = array[0];
+ for (i=1; i< size; i++)
+ rv = qwtMin(rv, array[i]);
+ return rv;
+ }
+ else
+ return 0.0;
+
+}
+
+
+//------------------------------------------------------------
+//
+//.F qwtGetMax
+// Find the largest value in an array
+//
+//.u Syntax
+//.f double qwtGetMax(double *array, int size)
+//
+//.u Parameters
+//.p double *array, int size
+//
+//------------------------------------------------------------
+double qwtGetMax(double *array, int size)
+{
+ double rv;
+ int i;
+
+ if (size > 0)
+ {
+ rv = array[0];
+ for (i=1; i< size; i++)
+ rv = qwtMax(rv, array[i]);
+ return rv;
+ }
+ else
+ return 0.0;
+
+}
+
+
+//------------------------------------------------------------
+//
+//.F qwtCeil125
+// Find the smallest value out of {1,2,5}*10^n with an integer number n
+// which is greater than or equal to x
+//
+//.u Syntax
+//.f double qwtCeil125(double x)
+//
+//.u Parameters
+//.p double x
+//
+//------------------------------------------------------------
+double qwtCeil125( double x)
+{
+ double lx, rv;
+ double p10, fr;
+ double sign = ( x > 0) ? 1.0 : -1.0;
+
+ if (x == 0.0) return 0.0;
+
+ lx = log10(fabs(x));
+ p10 = floor(lx);
+ fr = pow(10.0,lx - p10);
+ if (fr <=1.0)
+ fr = 1.0;
+ else if (fr <= 2.0)
+ fr = 2.0;
+ else if (fr <= 5.0)
+ fr = 5.0;
+ else
+ fr = 10.0;
+ rv = fr * pow(10.0,p10);
+ return sign * rv;
+}
+
+
+//------------------------------------------------------------
+//
+//.F qwtFloor125
+// Find the largest value out of {1,2,5}*10^n with an integer number n
+// which is smaller than or equal to x
+//
+//.u Syntax
+//.f double qwtFloor125(double x)
+//
+//.u Parameters
+//.p double x
+//
+//------------------------------------------------------------
+double qwtFloor125( double x)
+{
+ double lx, rv;
+ double p10, fr;
+ double sign = ( x > 0) ? 1.0 : -1.0;
+
+ if (x == 0.0) return 0.0;
+
+ lx = log10(fabs(x));
+ p10 = floor(lx);
+ fr = pow(10.0,lx - p10);
+ if (fr >= 10.0)
+ fr = 10.0;
+ else if (fr >= 5.0)
+ fr = 5.0;
+ else if (fr >= 2.0)
+ fr = 2.0;
+ else
+ fr = 1.0;
+ rv = fr * pow(10.0,p10);
+ return sign * rv;
+}
+
+
+//------------------------------------------------------------
+//
+//.F qwtChkMono
+// Checks if an array is a strictly monotonic sequence
+//
+//.u Syntax
+//.f int qwtChkMono(double *array, int size)
+//
+//.u Parameters
+//.p double *array -- pointer to a double array
+// int size -- size of the array
+//
+//.u Return Value
+//.t 0 -- sequence is not strictly monotonic
+// 1 -- sequence is strictly monotonically increasing
+// -1 -- sequence is strictly monotonically decreasing
+//
+//------------------------------------------------------------
+int qwtChkMono(double *array, int size)
+{
+ int rv, i;
+
+ if (size < 2) return 0;
+
+ rv = qwtSign(array[1] - array[0]);
+ for (i=1;i<size-1;i++)
+ {
+ if ( qwtSign(array[i+1] - array[i]) != rv )
+ {
+ rv = 0;
+ break;
+ }
+ }
+ return rv;
+
+}
+
+//------------------------------------------------------------
+//
+//.F qwtTwistArray
+// Invert the order of array elements
+//
+//.u Syntax
+//.f void qwtTwistArray(double *array, int size)
+//
+//.u Parameters
+//.p double *array, int size
+//
+//------------------------------------------------------------
+void qwtTwistArray(double *array, int size)
+{
+ int itmp;
+ int i, s2;
+ double dtmp;
+
+ s2 = size / 2;
+
+ for (i=0; i < s2; i++)
+ {
+ itmp = size - 1 - i;
+ dtmp = array[i];
+ array[i] = array[itmp];
+ array[itmp] = dtmp;
+ }
+
+}
+
+
+//------------------------------------------------------------
+//
+//.F qwtLinSpace
+// Create an array of equally spaced values
+//
+//.u Syntax
+//.f void qwtLinSpace(double *array, int size, double xmin, double xmax)
+//
+//.u Parameters
+//.p double *array -- where to put the values
+// int size -- size of the array
+// double xmin -- value associated with index 0
+// double xmax -- value associated with index (size-1)
+//
+//------------------------------------------------------------
+void qwtLinSpace(double *array, int size, double xmin, double xmax)
+{
+ int i, imax;
+ imax = size -1;
+ double step;
+
+ if (size > 0)
+ {
+ array[0] = xmin;
+ array[imax] = xmax;
+ step = (xmax - xmin) / double(imax);
+
+ for (i=1;i<imax;i++)
+ array[i] = xmin + double(i) * step;
+ }
+
+}
+
+
+//------------------------------------------------------------
+//
+//.F qwtLogSpace
+// Create an array of logarithmically equally spaced values
+//
+//.u Syntax
+//.f void qwtLogSpace(double *array, int size, double xmin, double xmax)
+//
+//.u Parameters
+//.p double *array -- where to put the values
+// int size -- size of the array
+// double xmin -- value associated with index 0
+// double xmax -- value associated with index (size-1)
+//------------------------------------------------------------
+void qwtLogSpace(double *array, int size, double xmin, double xmax)
+{
+ int i, imax;
+
+ double lxmin,lxmax;
+ double lstep;
+
+ imax = size -1;
+
+ if ((xmin <= 0.0) || (xmax <= 0.0) || (size <= 0))
+ return;
+
+ array[0] = xmin;
+ array[imax] = xmax;
+ lxmin = log(xmin);
+ lxmax = log(xmax);
+
+ lstep = (lxmax - lxmin) / double(imax);
+
+ for (i=1; i<imax;i++)
+ array[i] = exp(lxmin + double(i) * lstep);
+
+}
diff --git a/muse2/muse/widgets/mmath.h b/muse2/muse/widgets/mmath.h
new file mode 100644
index 00000000..51381047
--- /dev/null
+++ b/muse2/muse/widgets/mmath.h
@@ -0,0 +1,77 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mmath.h,v 1.1.1.1 2003/10/27 18:54:47 wschweer Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MATH_H__
+#define __MATH_H__
+
+#define LOG_MIN 1.0e-100
+#define LOG_MAX 1.0e100
+
+double qwtCeil125(double x);
+double qwtFloor125(double x);
+void qwtTwistArray(double *array, int size);
+int qwtChkMono(double *array, int size);
+void qwtLinSpace(double *array, int size, double xmin, double xmax);
+void qwtLogSpace(double *array, int size, double xmin, double xmax);
+
+template <class T>
+inline int qwtSign(const T& x)
+{
+ if (x > T(0))
+ return 1;
+ else if (x < T(0))
+ return (-1);
+ else
+ return 0;
+}
+
+inline int qwtInt(double x)
+{
+ return int(rint(x));
+}
+
+template <class T>
+inline T qwtAbs (const T& x)
+{
+ return( x > T(0) ? x : -x );
+}
+
+template <class T>
+inline const T& qwtMax (const T& x, const T& y)
+{
+ return ( x > y ? x : y );
+}
+
+template <class T>
+inline const T& qwtMin ( const T& x, const T& y)
+{
+ return ( x < y ? x : y );
+}
+
+
+template <class T>
+T qwtLim(const T& x, const T& x1, const T& x2)
+{
+ T rv;
+ T xmin, xmax;
+
+ xmin = qwtMin(x1, x2);
+ xmax = qwtMax(x1, x2);
+
+ if ( x < xmin )
+ rv = xmin;
+ else if ( x > xmax )
+ rv = xmax;
+ else
+ rv = x;
+
+ return rv;
+}
+
+#endif
+
diff --git a/muse2/muse/widgets/moc_aboutbox.cpp b/muse2/muse/widgets/moc_aboutbox.cpp
new file mode 100644
index 00000000..3a5b4311
--- /dev/null
+++ b/muse2/muse/widgets/moc_aboutbox.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+** Meta object code from reading C++ file 'aboutbox.h'
+**
+** Created: Wed Oct 13 19:43:36 2010
+** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#include "aboutbox.h"
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#error "The header file 'aboutbox.h' doesn't include <QObject>."
+#elif Q_MOC_OUTPUT_REVISION != 62
+#error "This file was generated using the moc from 4.6.2. It"
+#error "cannot be used with the include files from this version of Qt."
+#error "(The moc has changed too much.)"
+#endif
+
+QT_BEGIN_MOC_NAMESPACE
+static const uint qt_meta_data_AboutBox[] = {
+
+ // content:
+ 4, // revision
+ 0, // classname
+ 0, 0, // classinfo
+ 1, 14, // methods
+ 0, 0, // properties
+ 0, 0, // enums/sets
+ 0, 0, // constructors
+ 0, // flags
+ 0, // signalCount
+
+ // slots: signature, parameters, type, tag, flags
+ 10, 9, 9, 9, 0x09,
+
+ 0 // eod
+};
+
+static const char qt_meta_stringdata_AboutBox[] = {
+ "AboutBox\0\0languageChange()\0"
+};
+
+const QMetaObject AboutBox::staticMetaObject = {
+ { &QDialog::staticMetaObject, qt_meta_stringdata_AboutBox,
+ qt_meta_data_AboutBox, 0 }
+};
+
+#ifdef Q_NO_DATA_RELOCATION
+const QMetaObject &AboutBox::getStaticMetaObject() { return staticMetaObject; }
+#endif //Q_NO_DATA_RELOCATION
+
+const QMetaObject *AboutBox::metaObject() const
+{
+ return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
+}
+
+void *AboutBox::qt_metacast(const char *_clname)
+{
+ if (!_clname) return 0;
+ if (!strcmp(_clname, qt_meta_stringdata_AboutBox))
+ return static_cast<void*>(const_cast< AboutBox*>(this));
+ if (!strcmp(_clname, "Ui::AboutBox"))
+ return static_cast< Ui::AboutBox*>(const_cast< AboutBox*>(this));
+ return QDialog::qt_metacast(_clname);
+}
+
+int AboutBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+ _id = QDialog::qt_metacall(_c, _id, _a);
+ if (_id < 0)
+ return _id;
+ if (_c == QMetaObject::InvokeMetaMethod) {
+ switch (_id) {
+ case 0: languageChange(); break;
+ default: ;
+ }
+ _id -= 1;
+ }
+ return _id;
+}
+QT_END_MOC_NAMESPACE
diff --git a/muse2/muse/widgets/moc_didyouknow.cpp b/muse2/muse/widgets/moc_didyouknow.cpp
new file mode 100644
index 00000000..45ca9eaa
--- /dev/null
+++ b/muse2/muse/widgets/moc_didyouknow.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+** Meta object code from reading C++ file 'didyouknow.h'
+**
+** Created: Wed Oct 13 19:43:38 2010
+** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#include "didyouknow.h"
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#error "The header file 'didyouknow.h' doesn't include <QObject>."
+#elif Q_MOC_OUTPUT_REVISION != 62
+#error "This file was generated using the moc from 4.6.2. It"
+#error "cannot be used with the include files from this version of Qt."
+#error "(The moc has changed too much.)"
+#endif
+
+QT_BEGIN_MOC_NAMESPACE
+static const uint qt_meta_data_DidYouKnow[] = {
+
+ // content:
+ 4, // revision
+ 0, // classname
+ 0, 0, // classinfo
+ 1, 14, // methods
+ 0, 0, // properties
+ 0, 0, // enums/sets
+ 0, 0, // constructors
+ 0, // flags
+ 0, // signalCount
+
+ // slots: signature, parameters, type, tag, flags
+ 12, 11, 11, 11, 0x09,
+
+ 0 // eod
+};
+
+static const char qt_meta_stringdata_DidYouKnow[] = {
+ "DidYouKnow\0\0languageChange()\0"
+};
+
+const QMetaObject DidYouKnow::staticMetaObject = {
+ { &QDialog::staticMetaObject, qt_meta_stringdata_DidYouKnow,
+ qt_meta_data_DidYouKnow, 0 }
+};
+
+#ifdef Q_NO_DATA_RELOCATION
+const QMetaObject &DidYouKnow::getStaticMetaObject() { return staticMetaObject; }
+#endif //Q_NO_DATA_RELOCATION
+
+const QMetaObject *DidYouKnow::metaObject() const
+{
+ return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
+}
+
+void *DidYouKnow::qt_metacast(const char *_clname)
+{
+ if (!_clname) return 0;
+ if (!strcmp(_clname, qt_meta_stringdata_DidYouKnow))
+ return static_cast<void*>(const_cast< DidYouKnow*>(this));
+ if (!strcmp(_clname, "Ui::DidYouKnow"))
+ return static_cast< Ui::DidYouKnow*>(const_cast< DidYouKnow*>(this));
+ return QDialog::qt_metacast(_clname);
+}
+
+int DidYouKnow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+ _id = QDialog::qt_metacall(_c, _id, _a);
+ if (_id < 0)
+ return _id;
+ if (_c == QMetaObject::InvokeMetaMethod) {
+ switch (_id) {
+ case 0: languageChange(); break;
+ default: ;
+ }
+ _id -= 1;
+ }
+ return _id;
+}
+QT_END_MOC_NAMESPACE
diff --git a/muse2/muse/widgets/moc_songinfo.cpp b/muse2/muse/widgets/moc_songinfo.cpp
new file mode 100644
index 00000000..9b35549c
--- /dev/null
+++ b/muse2/muse/widgets/moc_songinfo.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+** Meta object code from reading C++ file 'songinfo.h'
+**
+** Created: Wed Oct 13 19:43:37 2010
+** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#include "songinfo.h"
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#error "The header file 'songinfo.h' doesn't include <QObject>."
+#elif Q_MOC_OUTPUT_REVISION != 62
+#error "This file was generated using the moc from 4.6.2. It"
+#error "cannot be used with the include files from this version of Qt."
+#error "(The moc has changed too much.)"
+#endif
+
+QT_BEGIN_MOC_NAMESPACE
+static const uint qt_meta_data_SongInfo[] = {
+
+ // content:
+ 4, // revision
+ 0, // classname
+ 0, 0, // classinfo
+ 2, 14, // methods
+ 0, 0, // properties
+ 0, 0, // enums/sets
+ 0, 0, // constructors
+ 0, // flags
+ 0, // signalCount
+
+ // slots: signature, parameters, type, tag, flags
+ 10, 9, 9, 9, 0x0a,
+ 29, 9, 9, 9, 0x09,
+
+ 0 // eod
+};
+
+static const char qt_meta_stringdata_SongInfo[] = {
+ "SongInfo\0\0buttonOk_clicked()\0"
+ "languageChange()\0"
+};
+
+const QMetaObject SongInfo::staticMetaObject = {
+ { &QDialog::staticMetaObject, qt_meta_stringdata_SongInfo,
+ qt_meta_data_SongInfo, 0 }
+};
+
+#ifdef Q_NO_DATA_RELOCATION
+const QMetaObject &SongInfo::getStaticMetaObject() { return staticMetaObject; }
+#endif //Q_NO_DATA_RELOCATION
+
+const QMetaObject *SongInfo::metaObject() const
+{
+ return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
+}
+
+void *SongInfo::qt_metacast(const char *_clname)
+{
+ if (!_clname) return 0;
+ if (!strcmp(_clname, qt_meta_stringdata_SongInfo))
+ return static_cast<void*>(const_cast< SongInfo*>(this));
+ if (!strcmp(_clname, "Ui::SongInfo"))
+ return static_cast< Ui::SongInfo*>(const_cast< SongInfo*>(this));
+ return QDialog::qt_metacast(_clname);
+}
+
+int SongInfo::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+ _id = QDialog::qt_metacall(_c, _id, _a);
+ if (_id < 0)
+ return _id;
+ if (_c == QMetaObject::InvokeMetaMethod) {
+ switch (_id) {
+ case 0: buttonOk_clicked(); break;
+ case 1: languageChange(); break;
+ default: ;
+ }
+ _id -= 2;
+ }
+ return _id;
+}
+QT_END_MOC_NAMESPACE
diff --git a/muse2/muse/widgets/moc_ttoolbar.cpp b/muse2/muse/widgets/moc_ttoolbar.cpp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/muse2/muse/widgets/moc_ttoolbar.cpp
diff --git a/muse2/muse/widgets/mtrackinfobase.ui b/muse2/muse/widgets/mtrackinfobase.ui
new file mode 100644
index 00000000..3d2b274a
--- /dev/null
+++ b/muse2/muse/widgets/mtrackinfobase.ui
@@ -0,0 +1,1067 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>MidiTrackInfoBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>MidiTrackInfoBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>149</width>
+ <height>555</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>MusE: TrackInfo</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string></string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="resizeMode">
+ <enum>Minimum</enum>
+ </property>
+ <widget class="SpinBox" row="2" column="0">
+ <property name="name">
+ <cstring>iOutputChannel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maxValue">
+ <number>16</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>output channel</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>all midi events are sent to this output channel</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>trackNameLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>2</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter | WordBreak</set>
+ </property>
+ </widget>
+ <widget class="SpinBox" row="7" column="0">
+ <property name="name">
+ <cstring>iLen</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="suffix">
+ <string>%</string>
+ </property>
+ <property name="maxValue">
+ <number>200</number>
+ </property>
+ <property name="minValue">
+ <number>25</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>iOutput</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>output port</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="indent">
+ <number>1</number>
+ </property>
+ <property name="text">
+ <string>Out ch</string>
+ </property>
+ </widget>
+ <widget class="SpinBox" row="6" column="0">
+ <property name="name">
+ <cstring>iVerz</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="specialValueText">
+ <string>off</string>
+ </property>
+ <property name="maxValue">
+ <number>1000</number>
+ </property>
+ <property name="minValue">
+ <number>-1000</number>
+ </property>
+ </widget>
+ <widget class="SpinBox" row="8" column="0">
+ <property name="name">
+ <cstring>iAnschl</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ <property name="minValue">
+ <number>-127</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="SpinBox" row="9" column="0">
+ <property name="name">
+ <cstring>iKompr</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="prefix">
+ <string></string>
+ </property>
+ <property name="suffix">
+ <string>%</string>
+ </property>
+ <property name="maxValue">
+ <number>200</number>
+ </property>
+ <property name="minValue">
+ <number>25</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ </widget>
+ <widget class="SpinBox" row="5" column="0">
+ <property name="name">
+ <cstring>iTransp</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="specialValueText">
+ <string>off</string>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ <property name="minValue">
+ <number>-127</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="1">
+ <property name="name">
+ <cstring>TextLabel9</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Transp.</string>
+ </property>
+ <property name="indent">
+ <number>2</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="1">
+ <property name="name">
+ <cstring>TextLabel10</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Delay</string>
+ </property>
+ <property name="indent">
+ <number>2</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="9" column="1">
+ <property name="name">
+ <cstring>TextLabel13</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Compr.</string>
+ </property>
+ <property name="indent">
+ <number>2</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="8" column="1">
+ <property name="name">
+ <cstring>TextLabel12</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Velocity</string>
+ </property>
+ <property name="indent">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="7" column="1">
+ <property name="name">
+ <cstring>TextLabel11</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Length</string>
+ </property>
+ <property name="indent">
+ <number>2</number>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="0">
+ <property name="name">
+ <cstring>routingLayout</cstring>
+ </property>
+ <hbox>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>iRButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>iR</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>input routing</string>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>oRButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>oR</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>output routing</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="1">
+ <property name="name">
+ <cstring>routingLayout2</cstring>
+ </property>
+ <hbox>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>iChanDetectLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>W</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>input detect</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Input detect indicator. Detects all note on-off, controller, aftertouch,
+ program change, and pitchbend (but not sysex or realtime) events
+ on the selected channels, on the selected midi ports.</string>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>recEchoButton</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>14</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toggleButton">
+ <string>true</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Echo recording events to output.</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Echo</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>echoSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Maximum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>4</width>
+ <height>2</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="10" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>4</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>WinPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <property name="lineWidth">
+ <number>1</number>
+ </property>
+ <property name="midLineWidth">
+ <number>1</number>
+ </property>
+ <property name="text">
+ <string>Channel Info</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="11" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>iPatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;unknown&gt;</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Select instrument patch</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="12" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Record:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="12" column="1">
+ <property name="name">
+ <cstring>recLayout</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>recSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Maximum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>4</width>
+ <height>2</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>recordButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>All</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Add all settings to song</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>allRecSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Maximum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>4</width>
+ <height>2</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="SpinBox" row="13" column="0">
+ <property name="name">
+ <cstring>iHBank</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="specialValueText">
+ <string>off</string>
+ </property>
+ <property name="maxValue">
+ <number>128</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Bank Select MSB. Double-click on/off.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="13" column="1">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="lineWidth">
+ <number>1</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="text">
+ <string>H-Bank</string>
+ </property>
+ <property name="indent">
+ <number>2</number>
+ </property>
+ </widget>
+ <widget class="SpinBox" row="14" column="0">
+ <property name="name">
+ <cstring>iLBank</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="specialValueText">
+ <string>off</string>
+ </property>
+ <property name="maxValue">
+ <number>128</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Bank Select LSB. Double-click on/off.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="14" column="1">
+ <property name="name">
+ <cstring>TextLabel5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="lineWidth">
+ <number>1</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="text">
+ <string>L-Bank</string>
+ </property>
+ <property name="indent">
+ <number>2</number>
+ </property>
+ </widget>
+ <widget class="SpinBox" row="15" column="0">
+ <property name="name">
+ <cstring>iProgram</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="specialValueText">
+ <string>off</string>
+ </property>
+ <property name="maxValue">
+ <number>128</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Program. Double-click on/off.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="15" column="1">
+ <property name="name">
+ <cstring>progLayout</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>progSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Maximum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>4</width>
+ <height>2</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>progRecButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Prog.</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Add bank + prog settings to song</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>progRecSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Maximum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>4</width>
+ <height>2</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="SpinBox" row="16" column="0">
+ <property name="name">
+ <cstring>iLautst</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="specialValueText">
+ <string>off</string>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ <property name="minValue">
+ <number>-1</number>
+ </property>
+ <property name="value">
+ <number>-1</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Volume. Double-click on/off.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="16" column="1">
+ <property name="name">
+ <cstring>volLayout</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>volSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Maximum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>4</width>
+ <height>2</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>volRecButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Vol.</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Add vol setting to song</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>volRecSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Maximum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>4</width>
+ <height>2</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="SpinBox" row="17" column="0">
+ <property name="name">
+ <cstring>iPan</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="specialValueText">
+ <string>off</string>
+ </property>
+ <property name="maxValue">
+ <number>63</number>
+ </property>
+ <property name="minValue">
+ <number>-65</number>
+ </property>
+ <property name="value">
+ <number>-65</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Change stereo position. Double-click on/off.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Change stereo position. Double-click on/off.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="17" column="1">
+ <property name="name">
+ <cstring>panLayout</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>panSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Maximum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>4</width>
+ <height>2</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>panRecButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Pan</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Add pan setting to song</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>panRecSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Maximum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>4</width>
+ <height>2</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer row="18" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>SpinBox</class>
+ <header location="global">spinbox.h</header>
+ <sizehint>
+ <width>50</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1002">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003b149444154388dad945f4c5b551cc73fe7dc4b7b4bcba0762d45c43114323599ee6192609c51d883892ce083f1718b3ebb185f8dc91e972cf39d2d2a2f1af664b6f1e0fe3863a0718969700eb0c52142da0242a1bd6d696f7bcff101585203ceb8fd9ece39f99dcff9fe7edf939f88c562ec465f5f9fe609442c161362173c3e3eae7b7a7ac8e7f36432196cdbfe4f907c3e4f2291201e8fe338cec3737357e9e8e828aded1e229d650e1f2d51754b082110124c13a4dc5ea341eb9dc284c0558a853f3ce8cb0677ef500fde7d39d2596679e326597b8e9abb85d7a770ab16ab6983ec5a05b487a70e36f0f4e10afe408d6a558310980108478dba4a1e8233990c5d474b64ed39aa3a8fe5f3317fbf81dbd70bccfeb205947632fd74f6589c1c6ea2f70d03a58ba0c1f2c9bdc1b66de3b8256a6e11cbe7e3ee1d181b590124fe2693aeee08d223c82c3a2c24b7b874bec8f26288774f7bd054504aef0dde6e99c0eb83f9fb266323cb80a27fb0958141836044605a2ee5523393371cc646fee2da37195aa35d0c0c5b4859ac03d7e91712dcaac5adab3650a3ff9d08ef7dd8404bb48869e5d958b5b87dadc4c9a1464e9f0d0326df7ebd86bd2e310cb1bf62d384d59441f2d70a070e1c60e09489929b988681bdd9cc97170bcc4c65595f71f8e0e3301337fc24a7732467831875a47f289652b0be5e4151e6d07316c1b0c0340d8ab92023e76d66a6b2840e36d2fb7a13fee632475e6edc367ea98a90fb98b7dd6310ca0328a44761582e1bab41befabcc0ec940d28bc5e93b68e064cab84e1d9beaeb48934eac1f53b01c1b000fca496aa54b61a99fcde61662a4b4b4b23d1680be9d426173e4df3602a48ea411989a4fd590f52a8fd156b05ed9d350e3defe3cfdf4b4c7ce770ea7d3fb9f520afbe1620daeee5c26735d20b9b9cfb6811a754a439e4e5c5639a4caa1e5caf586bfc0197b78702005cb9b4cae4cd3267ce8638fe964bd72b393e39d74928d242617303a756a37f284447770dcdbffc6384a05a85de1306e9a52057c7527c7131c3c42d3f475eb2303c82d4fc3276d6811db37efeb148723082d9b08f79f97c1e5729109a9a28307cc622d2d6cdf52b2b24efe548dedb00142009862cfa879ee1a71f6cec928353511472fbf4389148b0b0e0c108081412458dfe21c9f11351e67e7358595468246d1d1e5e38a6e9e851bc39d84ab502a669331dafec0d8ec7e3e8cb06e1a881d727d1ae40180a434a8c9db129a54126ad48a7358c2b4c5352c8c374bcccdab2bb37d8719cba79fab8211f9df218e0582c261e95f8bfc04f1a1e8bc5c4dfe0a190172af6a9690000000049454e44ae426082</data>
+ </image>
+</images>
+<tabstops>
+ <tabstop>iOutput</tabstop>
+ <tabstop>iOutputChannel</tabstop>
+ <tabstop>iTransp</tabstop>
+ <tabstop>iVerz</tabstop>
+ <tabstop>iLen</tabstop>
+ <tabstop>iAnschl</tabstop>
+ <tabstop>iKompr</tabstop>
+ <tabstop>iPatch</tabstop>
+ <tabstop>iHBank</tabstop>
+ <tabstop>iLBank</tabstop>
+ <tabstop>iProgram</tabstop>
+ <tabstop>iLautst</tabstop>
+ <tabstop>iPan</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/mtscale.cpp b/muse2/muse/widgets/mtscale.cpp
new file mode 100644
index 00000000..42d04275
--- /dev/null
+++ b/muse2/muse/widgets/mtscale.cpp
@@ -0,0 +1,425 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mtscale.cpp,v 1.8.2.7 2009/05/03 04:14:01 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <values.h>
+
+#include <qpainter.h>
+#include <qtooltip.h>
+#include <qcursor.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <QMouseEvent>
+#include <QEvent>
+#include "mtscale.h"
+#include "midieditor.h"
+#include "globals.h"
+#include "song.h"
+#include "../marker/marker.h"
+#include "../marker/markerview.h"
+#include "icons.h"
+#include "gconfig.h"
+
+//---------------------------------------------------------
+// MTScale
+// Midi Time Scale
+//---------------------------------------------------------
+
+MTScale::MTScale(int* r, QWidget* parent, int xs, bool _mode)
+ : View(parent, xs, 1)
+ {
+ waveMode = _mode;
+ QToolTip::add(this, tr("bar scale"));
+ barLocator = false;
+ raster = r;
+ if (waveMode) {
+ pos[0] = tempomap.tick2frame(song->cpos());
+ pos[1] = tempomap.tick2frame(song->lpos());
+ pos[2] = tempomap.tick2frame(song->rpos());
+ }
+ else {
+ pos[0] = song->cpos();
+ pos[1] = song->lpos();
+ pos[2] = song->rpos();
+ }
+ pos[3] = MAXINT; // do not show
+ button = Qt::NoButton;
+ setMouseTracking(true);
+ connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool)));
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ connect(song, SIGNAL(markerChanged(int)), SLOT(redraw()));
+
+ setFixedHeight(28);
+ setBg(QColor(0xe0, 0xe0, 0xe0));
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void MTScale::songChanged(int type)
+ {
+ if (type & (SC_SIG|SC_TEMPO)) {
+ if ((type & SC_TEMPO) && waveMode) {
+ pos[0] = tempomap.tick2frame(song->cpos());
+ pos[1] = tempomap.tick2frame(song->lpos());
+ pos[2] = tempomap.tick2frame(song->rpos());
+ }
+ redraw();
+ }
+ }
+
+//---------------------------------------------------------
+// setPos
+//---------------------------------------------------------
+
+void MTScale::setPos(int idx, unsigned val, bool)
+ {
+ if (val == MAXINT) {
+ if (idx == 3) {
+ pos[3] = MAXINT;
+ redraw(QRect(0, 0, width(), height()));
+ }
+ return;
+ }
+ if (waveMode)
+ val = tempomap.tick2frame(val);
+ if (val == pos[idx])
+ return;
+ //unsigned opos = mapx(pos[idx] == MAXINT ? val : pos[idx]);
+ int opos = mapx(pos[idx] == MAXINT ? val : pos[idx]);
+ pos[idx] = val;
+ if (!isVisible())
+ return;
+
+ int tval = mapx(val);
+ int x = -9;
+ int w = 18;
+
+ if (tval < 0) { // tval<0 occurs whenever the window is scrolled left, so I switched to signed int (ml)
+ //printf("MTScale::setPos - idx:%d val:%d tval:%d opos:%d w:%d h:%d\n", idx, val, tval, opos, width(), height());
+
+ redraw(QRect(0,0,width(),height()));
+ return;
+ }
+ //if (opos > (unsigned int) tval) { //prevent compiler warning: comparison signed/unsigned
+ if (opos > tval) {
+ w += opos - tval;
+ x += tval;
+ }
+ else {
+ w += tval - opos;
+ x += opos;
+ }
+ //printf("MTScale::setPos idx:%d val:%d tval:%d opos:%d x:%d w:%d h:%d\n", idx, val, tval, opos, x, w, height());
+
+ redraw(QRect(x, 0, w, height()));
+ }
+
+//---------------------------------------------------------
+// viewMousePressEvent
+//---------------------------------------------------------
+
+void MTScale::viewMousePressEvent(QMouseEvent* event)
+ {
+ button = event->button();
+ viewMouseMoveEvent(event);
+ }
+
+//---------------------------------------------------------
+// viewMouseReleaseEvent
+//---------------------------------------------------------
+
+void MTScale::viewMouseReleaseEvent(QMouseEvent*)
+ {
+ button = Qt::NoButton;
+ }
+
+//---------------------------------------------------------
+// viewMouseMoveEvent
+//---------------------------------------------------------
+
+void MTScale::viewMouseMoveEvent(QMouseEvent* event)
+ {
+ if (event->state() & Qt::ShiftModifier )
+ setCursor(QCursor(Qt::PointingHandCursor));
+ else
+ setCursor(QCursor(Qt::ArrowCursor));
+
+ int x = event->x();
+ if (waveMode)
+ x = tempomap.frame2tick(x);
+ x = sigmap.raster(x, *raster);
+ if (x < 0)
+ x = 0;
+ emit timeChanged(x);
+ int i;
+ switch (button) {
+ case Qt::LeftButton:
+ i = 0;
+ break;
+ case Qt::MidButton:
+ i = 1;
+ break;
+ case Qt::RightButton:
+ i = 2;
+ break;
+ default:
+ return; // if no button is pressed the function returns here
+ }
+ Pos p(x, true);
+
+ if(i== 0 && (event->state() & Qt::ShiftModifier )) { // If shift +LMB we add a marker
+ Marker *alreadyExists = song->getMarkerAt(x);
+ if (!alreadyExists) {
+ song->addMarker(QString(""), x, false);
+ // Removed p3.3.43
+ // Song::addMarker() already emits a 'markerChanged'.
+ //emit addMarker(x);
+ }
+ }
+ else if (i== 2 && (event->state() & Qt::ShiftModifier )) { // If shift +RMB we remove a marker
+ Marker *toRemove = song->getMarkerAt(x);
+ if (toRemove)
+ song->removeMarker(toRemove);
+ else
+ printf("No marker to remove\n");
+ }
+ else
+ song->setPos(i, p); // all other cases: relocating one of the locators
+ }
+
+//---------------------------------------------------------
+// leaveEvent
+//---------------------------------------------------------
+
+void MTScale::leaveEvent(QEvent*)
+ {
+ emit timeChanged(MAXINT);
+ }
+
+//---------------------------------------------------------
+// draw
+//---------------------------------------------------------
+
+void MTScale::pdraw(QPainter& p, const QRect& r)
+ {
+ int x = r.x();
+ int w = r.width();
+
+ // Added by Tim. p3.3.6
+ //printf("MTScale::pdraw x:%d w:%d\n", x, w);
+
+ x -= 20;
+ w += 40; // wg. Text
+
+ //---------------------------------------------------
+ // draw Marker
+ //---------------------------------------------------
+
+ int y = 12;
+ p.setPen(Qt::black);
+ p.setFont(config.fonts[4]);
+ p.drawLine(r.x(), y+1, r.x() + r.width(), y+1);
+ QRect tr(r);
+ tr.setHeight(12);
+ MarkerList* marker = song->marker();
+ for (iMarker m = marker->begin(); m != marker->end(); ++m) {
+
+ int xp;
+ if(waveMode)
+ xp = mapx(m->second.frame());
+ else
+ xp = mapx(m->second.tick());
+ if (xp > x+w)
+ break;
+ int xe = r.x() + r.width();
+ iMarker mm = m;
+ ++mm;
+ if (mm != marker->end()) {
+
+ if(waveMode)
+ xe = mapx(tempomap.tick2frame(mm->first));
+ else
+ xe = mapx(mm->first);
+ }
+
+ QRect tr(xp, 0, xe-xp, 13);
+ //if (m->second.current())
+ // p.fillRect(tr, white);
+
+ QRect wr = r.intersect(tr);
+ //if (r.intersects(tr))
+ if(!wr.isEmpty())
+ {
+ if (m->second.current())
+ {
+ //p.fillRect(tr, white);
+ p.fillRect(wr, Qt::white);
+ }
+
+ int x2;
+ //iMarker mm = m;
+ //++mm;
+ if (mm != marker->end())
+ {
+ if(waveMode)
+ x2 = mapx(tempomap.tick2frame(mm->first));
+ else
+ x2 = mapx(mm->first);
+ }
+ else
+ x2 = xp+200;
+
+ //printf("MTScale::pdraw marker %s xp:%d y:%d h:%d r.x:%d r.w:%d\n", m->second.name().latin1(), xp, height(), y, r.x(), r.width());
+
+ // Must be reasonable about very low negative x values! With long songs > 15min
+ // and with high horizontal magnification, 'ghost' drawings appeared,
+ // apparently the result of truncation later (xp = -65006 caused ghosting
+ // at bar 245 with magnification at max.), even with correct clipping region
+ // applied to painter in View::paint(). Tim. Apr 5 2009
+ // Quote: "Warning: Note that QPainter does not attempt to work around
+ // coordinate limitations in the underlying window system. Some platforms may
+ // behave incorrectly with coordinates as small as +/-4000."
+ if(xp >= -32)
+ p.drawPixmap(xp, 0, *flagIconS);
+
+ if(xp >= -1023)
+ {
+ QRect r = QRect(xp+10, 0, x2-xp, 12);
+ p.setPen(Qt::black);
+ p.drawText(r, Qt::AlignLeft|Qt::AlignVCenter, m->second.name());
+ }
+
+ if(xp >= 0)
+ {
+ p.setPen(Qt::green);
+ p.drawLine(xp, y, xp, height());
+ }
+ }
+ }
+
+ //---------------------------------------------------
+ // draw location marker
+ //---------------------------------------------------
+
+ int h = height()-12;
+
+ if (barLocator) {
+ p.setPen(Qt::red);
+ int xp = mapx(pos[0]);
+ if (xp >= x && xp < x+w)
+ p.drawLine(xp, y, xp, h);
+ p.setPen(Qt::blue);
+ xp = mapx(pos[1]);
+ if (xp >= x && xp < x+w)
+ p.drawLine(xp, y, xp, h);
+ xp = mapx(pos[2]);
+ if (xp >= x && xp < x+w)
+ p.drawLine(xp, y, xp, h);
+ }
+ else {
+ for (int i = 0; i < 3; ++i) {
+ int xp = mapx(pos[i]);
+ if (xp >= x && xp < x+w) {
+ QPixmap* pm = markIcon[i];
+ p.drawPixmap(xp - pm->width()/2, y-1, *pm);
+ }
+ }
+ }
+ p.setPen(Qt::black);
+ if (pos[3] != MAXINT) {
+ int xp = mapx(pos[3]);
+ if (xp >= x && xp < x+w)
+ p.drawLine(xp, 0, xp, height());
+ }
+
+ unsigned ctick;
+ int bar1, bar2, beat;
+ unsigned tick;
+
+ if (waveMode) {
+ ctick = tempomap.frame2tick(mapxDev(x));
+ sigmap.tickValues(ctick, &bar1, &beat, &tick);
+ sigmap.tickValues(tempomap.frame2tick(mapxDev(x+w)),
+ &bar2, &beat, &tick);
+ }
+ else {
+ ctick = mapxDev(x);
+ sigmap.tickValues(ctick, &bar1, &beat, &tick);
+ sigmap.tickValues(mapxDev(x+w), &bar2, &beat, &tick);
+ }
+
+//printf("bar %d %d-%d=%d\n", bar, ntick, stick, ntick-stick);
+
+ int stick = sigmap.bar2tick(bar1, 0, 0);
+ int ntick;
+ for (int bar = bar1; bar <= bar2; bar++, stick = ntick) {
+ ntick = sigmap.bar2tick(bar+1, 0, 0);
+ int tpix, a, b=0;
+ if (waveMode) {
+ a = tempomap.tick2frame(ntick);
+ b = tempomap.tick2frame(stick);
+ tpix = rmapx(a - b);
+ }
+ else {
+ tpix = rmapx(ntick - stick);
+ }
+ if (tpix < 64) {
+ // donÃŊÂŋÂ―t show beats if measure is this small
+ int n = 1;
+ if (tpix < 32)
+ n = 2;
+ if (tpix <= 16)
+ n = 4;
+ if (tpix < 8)
+ n = 8;
+ if (tpix <= 4)
+ n = 16;
+ if (tpix <= 2)
+ n = 32;
+ if (bar % n)
+ continue;
+ p.setFont(config.fonts[3]);
+ int x = mapx(waveMode ? b : stick);
+ QString s;
+ s.setNum(bar + 1);
+ p.drawLine(x, y+1, x, y+1+h);
+// QRect r = QRect(x+2, y, 0, h);
+ QRect r = QRect(x+2, y, 1000, h);
+ p.drawText(r, Qt::AlignLeft|Qt::AlignVCenter|Qt::TextDontClip, s);
+ }
+ else {
+ int z, n;
+ sigmap.timesig(stick, z, n);
+ for (int beat = 0; beat < z; beat++) {
+ int xx = sigmap.bar2tick(bar, beat, 0);
+ if (waveMode)
+ xx = tempomap.tick2frame(xx);
+ int xp = mapx(xx);
+ QString s;
+ QRect r(xp+2, y, 1000, h);
+ int y1;
+ int num;
+ if (beat == 0) {
+ num = bar + 1;
+ y1 = y + 1;
+ p.setFont(config.fonts[3]);
+ }
+ else {
+ num = beat + 1;
+ y1 = y + 7;
+ p.setFont(config.fonts[1]);
+ r.setY(y+3);
+ }
+ s.setNum(num);
+ p.drawLine(xp, y1, xp, y+1+h);
+ p.drawText(r, Qt::AlignLeft|Qt::AlignVCenter|Qt::TextDontClip, s);
+ }
+ }
+ }
+ }
+
diff --git a/muse2/muse/widgets/mtscale.h b/muse2/muse/widgets/mtscale.h
new file mode 100644
index 00000000..c632a24b
--- /dev/null
+++ b/muse2/muse/widgets/mtscale.h
@@ -0,0 +1,53 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: mtscale.h,v 1.3 2004/04/27 22:27:06 spamatica Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MTSCALE_H__
+#define __MTSCALE_H__
+
+#include "view.h"
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QEvent>
+
+class QPainter;
+
+//---------------------------------------------------------
+// MTScale
+// scale for midi track
+//---------------------------------------------------------
+
+class MTScale : public View {
+ Q_OBJECT
+ int* raster;
+ unsigned pos[4];
+ int button;
+ bool barLocator;
+ bool waveMode;
+
+ private slots:
+ void songChanged(int);
+
+ protected:
+ virtual void pdraw(QPainter&, const QRect&);
+ virtual void viewMousePressEvent(QMouseEvent* event);
+ virtual void viewMouseMoveEvent(QMouseEvent* event);
+ virtual void viewMouseReleaseEvent(QMouseEvent* event);
+ virtual void leaveEvent(QEvent*e);
+
+ signals:
+ void timeChanged(unsigned);
+ //void addMarker(int);
+
+ public slots:
+ void setPos(int, unsigned, bool);
+
+ public:
+ MTScale(int* raster, QWidget* parent, int xscale, bool f = false);
+ void setBarLocator(bool f) { barLocator = f; }
+ };
+#endif
+
diff --git a/muse2/muse/widgets/musewidgetsplug.cpp b/muse2/muse/widgets/musewidgetsplug.cpp
new file mode 100644
index 00000000..4a7f5f24
--- /dev/null
+++ b/muse2/muse/widgets/musewidgetsplug.cpp
@@ -0,0 +1,539 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: musewidgetsplug.cpp,v 1.9.2.9 2009/12/01 03:52:40 terminator356 Exp $
+// (C) Copyright 2001-2003 Werner Schweer (ws@seh.de)
+//=========================================================
+
+// this file makes some of the MusE widgets available
+// to QT-Designer
+
+#include <qwidgetplugin.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include "posedit.h"
+#include "poslabel.h"
+#include "pitchedit.h"
+#include "pitchlabel.h"
+#include "sig.h"
+#include "tempo.h"
+#include "tempolabel.h"
+#include "sigedit.h"
+#include "slider.h"
+#include "doublelabel.h"
+#include "checkbox.h"
+#include "combobox.h"
+#include "gconfig.h"
+
+int sampleRate = 44100; // some dummy values to get things compiled/linked
+int division = 384;
+int mtcType = 0;
+bool hIsB = false;
+
+static const char* vall[] = {
+ "c","c#","d","d#","e","f","f#","g","g#","a","a#","h"
+ };
+static const char* valu[] = {
+ "C","C#","D","D#","E","F","F#","G","G#","A","A#","H"
+ };
+
+GlobalConfigValues config = {
+ {
+ QColor(0xff, 0xff, 0xff), // palette
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff),
+ QColor(0xff, 0xff, 0xff)
+ },
+ {
+ QColor(255, 232, 140), // part colors
+ QColor(0xff, 0x00, 0x00),
+ QColor(0x00, 0xff, 0x00),
+ QColor(0x00, 0x00, 0xff),
+ QColor(0xff, 0xff, 0x00),
+ QColor(0x00, 0xff, 0xff),
+ QColor(0xff, 0x00, 0xff),
+ QColor(0x9f, 0xc7, 0xef),
+ QColor(0x00, 0xff, 0x7f),
+ QColor(0x7f, 0x00, 0x00),
+ QColor(0x00, 0x7f, 0x00),
+ QColor(0x00, 0x00, 0x7f),
+ QColor(0x7f, 0x7f, 0x3f),
+ QColor(0x00, 0x7f, 0x7f),
+ QColor(0x7f, 0x00, 0x7f),
+ QColor(0x00, 0x7f, 0xff),
+ QColor(0x00, 0x3f, 0x3f)
+ },
+ QColor(0, 0, 255), // transportHandleColor;
+ QColor(255, 0, 0), // bigTimeForegroundColor;
+ QColor(0, 0, 0), // bigTimeBackgroundColor;
+ QColor(200, 200, 200), // waveEditBackgroundColor;
+ {
+ QFont(QString("arial"), 10, QFont::Normal),
+ QFont(QString("arial"), 8, QFont::Normal),
+ QFont(QString("arial"), 10, QFont::Normal),
+ QFont(QString("arial"), 10, QFont::Bold),
+ QFont(QString("arial"), 8, QFont::Bold), // timescale numbers
+ QFont(QString("Lucidatypewriter"), 14, QFont::Bold),
+ QFont(QString("arial"), 8, QFont::Bold, true) // Mixer strip labels. Looks and fits better with bold + italic than bold alone,
+ // at the price of only few more pixels than Normal mode.
+ },
+ QColor(0xff, 0xff, 0xff), // trackBg;
+ QColor(0x80, 0xff, 0x80), // selected track Bg;
+ QColor(0x00, 0x00, 0x00), // selected track Fg;
+ QColor(0xff, 0xff, 0xff), // midiTrackBg;
+ QColor(255, 170, 0), // ctrlGraphFg; Medium orange
+ QColor(0xff, 0xff, 0xff), // drumTrackBg;
+ QColor(0xff, 0xff, 0xff), // waveTrackBg;
+ QColor(0xff, 0xff, 0xff), // outputTrackBg;
+ QColor(0xff, 0xff, 0xff), // inputTrackBg;
+ QColor(0xff, 0xff, 0xff), // groupTrackBg;
+ QColor(0xff, 0xff, 0xff), // auxTrackBg;
+ QColor(0xff, 0xff, 0xff), // synthTrackBg;
+ QColor(98, 124, 168), // part canvas bg
+ QColor(98, 124, 168), // mixerBg;
+
+ 384, // division;
+ 1024, // rtcTicks
+ -60, // int minMeter;
+ -60.0, // double minSlider;
+ false, // use Jack freewheel
+ 20, // int guiRefresh;
+ QString(""), // helpBrowser
+ true, // extendedMidi
+ 384, // division for smf export
+ QString(""), // copyright string for smf export
+ 1, // smf export file format
+ false, // midi export file 2 byte timesigs instead of 4
+ true, // optimize midi export file note offs
+ true, // Split imported tracks into multiple parts.
+ 1, // startMode
+ QString(""), // start song path
+ 384, // gui division
+ QRect(0, 0, 400, 300), // GeometryMain;
+ QRect(0, 0, 200, 100), // GeometryTransport;
+ QRect(0, 0, 600, 200), // GeometryBigTime;
+ QRect(0, 0, 400, 300), // GeometryPianoroll;
+ QRect(0, 0, 400, 300), // GeometryDrumedit;
+ //QRect(0, 0, 300, 500), // GeometryMixer; // Obsolete
+ {
+ QString("Mixer A"),
+ QRect(0, 0, 300, 500), // Mixer1
+ true, true, true, true,
+ true, true, true, true
+ },
+ {
+ QString("Mixer B"),
+ QRect(200, 200, 300, 500), // Mixer2
+ true, true, true, true,
+ true, true, true, true
+ },
+ true, // TransportVisible;
+ false, // BigTimeVisible;
+ false, // mixer1Visible;
+ false, // mixer2Visible;
+
+ false, // markerVisible; // This line was missing 2007-01-08 (willyfoobar)
+ true, // showSplashScreen
+ 1, // canvasShowPartType 1 - names, 2 events
+ 5, // canvasShowPartEvent
+ false, // canvasShowGrid;
+ QString(""), // canvasBgPixmap;
+ QString(""), // style
+ QString(""), // externalWavEditor //this line was missing 2007-01-08 (willyfoobar)
+ false, // useOldStyleStopShortCut
+ true, // moveArmedCheckBox
+ true, // useDenormalBias
+ false, // useOutputLimiter
+ true, // showDidYouKnow
+ false // vstInPlace Enable VST in-place processing
+ 44100, // Dummy audio preferred sample rate
+ 512 // Dummy audio buffer size
+ };
+
+//---------------------------------------------------------
+// pitch2string
+//---------------------------------------------------------
+
+QString pitch2string(int v)
+ {
+ if (v < 0 || v > 127)
+ return QString("----");
+ int octave = (v / 12) - 2;
+ QString o;
+ o.sprintf("%d", octave);
+ int i = v % 12;
+ QString s(octave < 0 ? valu[i] : vall[i]);
+ if (hIsB) {
+ if (s == "h")
+ s = "b";
+ else if (s == "H")
+ s = "B";
+ }
+ return s + o;
+ }
+
+
+/* XPM */
+static const char* slider_pixmap[]={
+"22 22 50 1",
+". c None",
+"f c #004005",
+"g c #004007",
+"h c #004107",
+"m c #004108",
+"j c #00430a",
+"E c #00501f",
+"s c #005021",
+"e c #014006",
+"l c #024006",
+"F c #095e34",
+"D c #0b572a",
+"k c #0b582b",
+"n c #0f5328",
+"u c #12562d",
+"o c #155a35",
+"p c #165c38",
+"q c #165c39",
+"i c #17501a",
+"I c #175522",
+"r c #18603f",
+"N c #18795e",
+"t c #187a60",
+"R c #1e5a29",
+"y c #22633d",
+"O c #307755",
+"B c #408262",
+"v c #439191",
+"G c #468667",
+"d c #4c7a51",
+"H c #4d8a6c",
+"J c #569174",
+"C c #599276",
+"P c #5e967a",
+"A c #63b1c2",
+"V c #659477",
+"Q c #659b80",
+"S c #6da087",
+"w c #70b2bc",
+"x c #72b5c0",
+"z c #74b7c3",
+"K c #79a891",
+"a c #7ea48a",
+"T c #8cb4a0",
+"L c #a3c3b3",
+"M c #b7d8d1",
+"U c #bedcd5",
+"c c #c3d2c3",
+"b c #f1f5f1",
+"# c #ffffff",
+"......................",
+"......................",
+"......................",
+"......................",
+"......................",
+"......###a............",
+"......#bcad...........",
+"......#bcad...........",
+"......#bcad...........",
+"..efgh#bcaihhhhhhhjk..",
+".lmnop#bcaippppppqrst.",
+".huvwx#bcayxxxxxxzABC.",
+".DEFGH#bcaIHHHHHHJKLM.",
+"..NOPQ#bcaRQQQQQQSTU..",
+"......#bcad...........",
+"......#bcad...........",
+"......#bcad...........",
+"......VVVVd...........",
+".......dddd...........",
+"......................",
+"......................",
+"......................"};
+static const char *posedit_pixmap[] = {
+ "22 22 8 1",
+ " c Gray100",
+ ". c Gray97",
+ "X c #4f504f",
+ "o c #00007f",
+ "O c Gray0",
+ "+ c none",
+ "@ c Gray0",
+ "# c Gray0",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++",
+ "+OOOOOOOOOOOOOOOOOOOO+",
+ "OOXXXXXXXXXXXXXXXXXXOO",
+ "OXX. OO OO O",
+ "OX. oo O O",
+ "OX. oo O .O",
+ "OX ooo oooo O O",
+ "OX oo oo oo O O",
+ "OX oooo oo oo O O",
+ "OX oo oo oo oo O O",
+ "OX oo oo oo oo O O",
+ "OX oooo oooo O O",
+ "OX OO OO O",
+ "OO..................OO",
+ "+OOOOOOOOOOOOOOOOOOOO+",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++"
+ };
+
+static const char *pitchedit_pixmap[] = {
+ "22 22 8 1",
+ " c Gray100",
+ ". c Gray97",
+ "X c #4f504f",
+ "o c #00007f",
+ "O c Gray0",
+ "+ c none",
+ "@ c Gray0",
+ "# c Gray0",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++",
+ "+OOOOOOOOOOOOOOOOOOOO+",
+ "OOXXXXXXXXXXXXXXXXXXOO",
+ "OXX. OO OO O",
+ "OX. o O O",
+ "OX. oo O .O",
+ "OX o o O O",
+ "OX o O O",
+ "OX o o O O",
+ "OX oooo O O",
+ "OX o O O",
+ "OX O O",
+ "OX OO OO O",
+ "OO..................OO",
+ "+OOOOOOOOOOOOOOOOOOOO+",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++"
+ };
+
+//---------------------------------------------------------
+// MusEPlugin
+//---------------------------------------------------------
+
+class MusEPlugin : public QWidgetPlugin {
+ public:
+ MusEPlugin() {}
+ ~MusEPlugin() {}
+ QStringList keys() const;
+ QWidget* create(const QString& key, QWidget* parent=0,
+ const char* name = 0);
+ QString group(const QString& key) const;
+ QIcon iconSet(const QString& key) const;
+ QString includeFile(const QString& key) const;
+ QString toolTip(const QString& key) const;
+ QString whatsThis(const QString& key) const;
+ bool isContainer(const QString& key) const;
+ };
+
+//---------------------------------------------------------
+// keys
+//---------------------------------------------------------
+
+QStringList MusEPlugin::keys() const
+ {
+ QStringList list;
+ list << QString("PosEdit")
+ << QString("PitchEdit")
+ << QString("PosLabel")
+ << QString("PitchLabel")
+ << QString("TempoLabel")
+ << QString("TempoEdit")
+ << QString("SigEdit")
+ << QString("Slider")
+ << QString("DoubleLabel")
+ << QString("CheckBox")
+ << QString("ComboBox")
+ ;
+ return list;
+ }
+
+//---------------------------------------------------------
+// create
+//---------------------------------------------------------
+
+QWidget* MusEPlugin::create(const QString& key, QWidget* parent,
+ const char* name)
+ {
+ if (key == QString("PosEdit"))
+ return new PosEdit(parent, name);
+ else if (key == QString("PitchEdit"))
+ return new PitchEdit(parent, name);
+ else if (key == QString("PitchLabel"))
+ return new PitchLabel(parent, name);
+ else if (key == QString("PosLabel"))
+ return new PosLabel(parent, name);
+ else if (key == QString("TempoLabel"))
+ return new TempoLabel(parent, name);
+ else if (key == QString("TempoEdit"))
+ return new TempoEdit(parent, name);
+ else if (key == QString("SigEdit"))
+ return new SigEdit(parent, name);
+ else if (key == QString("Slider"))
+ return new Slider(parent, name);
+ else if (key == QString("DoubleLabel"))
+ return new DoubleLabel(parent, name);
+ else if (key == QString("CheckBox"))
+ return new CheckBox(parent, -1, name);
+ else if (key == QString("ComboBox"))
+ return new ComboBox(parent, name);
+ return 0;
+ }
+
+//---------------------------------------------------------
+// group
+//---------------------------------------------------------
+
+QString MusEPlugin::group(const QString& /*key*/) const
+ {
+ return QString("MusE");
+ }
+
+//---------------------------------------------------------
+// iconSet
+//---------------------------------------------------------
+
+QIcon MusEPlugin::iconSet(const QString& key) const
+ {
+ if (key == "PosEdit" || key == "PosLabel")
+ return QIcon(QPixmap(posedit_pixmap));
+ else if (key == "PitchEdit" || key == "PitchLabel")
+ return QIcon(QPixmap(pitchedit_pixmap));
+ else if (key == "TempoEdit" || key == "TempoLabel")
+ return QIcon(QPixmap(pitchedit_pixmap));
+ else if (key == "SigEdit")
+ return QIcon(QPixmap(pitchedit_pixmap));
+ else if (key == QString("Slider"))
+ return QIcon(QPixmap(slider_pixmap));
+// else if (key == QString("CheckBox"))
+// return QIconSet(QPixmap(slider_pixmap));
+// else if (key == QString("ComboBox"))
+// return QIconSet(QPixmap(slider_pixmap));
+ return QIcon();
+ }
+
+//---------------------------------------------------------
+// includeFile
+//---------------------------------------------------------
+
+QString MusEPlugin::includeFile(const QString& key) const
+ {
+ if (key == QString("PosEdit"))
+ return QString("posedit.h");
+ else if (key == QString("PitchEdit"))
+ return QString("pitchedit.h");
+ else if (key == QString("PitchLabel"))
+ return QString("pitchlabel.h");
+ else if (key == QString("PosLabel"))
+ return QString("poslabel.h");
+ else if (key == QString("TempoLabel"))
+ return QString("tempolabel.h");
+ else if (key == QString("TempoEdit"))
+ return QString("tempolabel.h");
+ else if (key == QString("SigEdit"))
+ return QString("sigedit.h");
+ else if (key == QString("Slider"))
+ return QString("slider.h");
+ else if (key == QString("DoubleLabel"))
+ return QString("dentry.h");
+ else if (key == QString("CheckBox"))
+ return QString("checkbox.h");
+ else if (key == QString("ComboBox"))
+ return QString("combobox.h");
+ return QString::null;
+ }
+
+//---------------------------------------------------------
+// toolTip
+//---------------------------------------------------------
+
+QString MusEPlugin::toolTip (const QString& key) const
+ {
+ if (key == QString("PosEdit"))
+ return QString("midi time position editor");
+ else if (key == QString("PitchEdit"))
+ return QString("midi pitch spinbox");
+ else if (key == QString("PitchLabel"))
+ return QString("midi pitch label");
+ else if (key == QString("PosLabel"))
+ return QString("midi time position label");
+ else if (key == QString("TempoLabel"))
+ return QString("midi tempo label");
+ else if (key == QString("TempoEdit"))
+ return QString("midi tempo spinbox");
+ else if (key == QString("SigEdit"))
+ return QString("midi signature spinbox");
+ else if (key == QString("Slider"))
+ return QString("slider for double values");
+ else if (key == QString("DoubleLabel"))
+ return QString("entry/label for double values");
+ else if (key == QString("CheckBox"))
+ return QString("checkbox with id");
+ else if (key == QString("ComboBox"))
+ return QString("combobox with id");
+ return QString::null;
+ }
+
+//---------------------------------------------------------
+// whatsThis
+//---------------------------------------------------------
+
+QString MusEPlugin::whatsThis (const QString& key) const
+ {
+ if (key == QString("PosEdit"))
+ return QString("midi time position editor");
+ else if (key == QString("PitchEdit"))
+ return QString("midi pitch spinbox");
+ else if (key == QString("PitchLabel"))
+ return QString("midi pitch label");
+ else if (key == QString("PosLabel"))
+ return QString("midi time position label");
+ else if (key == QString("TempoLabel"))
+ return QString("midi tempo label");
+ else if (key == QString("TempoEdit"))
+ return QString("midi tempo spinbox");
+ else if (key == QString("SigEdit"))
+ return QString("midi signature spinbox");
+ else if (key == QString("Slider"))
+ return QString("slider for double values");
+ else if (key == QString("DoubleLabel"))
+ return QString("entry/label for double values");
+ else if (key == QString("CheckBox"))
+ return QString("checkbox with id");
+ else if (key == QString("ComboBox"))
+ return QString("combobox with id");
+ return QString::null;
+ }
+
+//---------------------------------------------------------
+// isContainer
+//---------------------------------------------------------
+
+bool MusEPlugin::isContainer (const QString& /*key*/) const
+ {
+ return false;
+ }
+
+Q_EXPORT_PLUGIN(MusEPlugin)
+
diff --git a/muse2/muse/widgets/nentry.cpp b/muse2/muse/widgets/nentry.cpp
new file mode 100644
index 00000000..c4006112
--- /dev/null
+++ b/muse2/muse/widgets/nentry.cpp
@@ -0,0 +1,407 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: nentry.cpp,v 1.1.1.1.2.1 2008/05/21 00:28:54 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qlayout.h>
+#include <qlabel.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <QContextMenuEvent>
+#include <QWheelEvent>
+#include <Q3Frame>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include "nentry.h"
+#include <stdio.h>
+#include <qtimer.h>
+#include <qevent.h>
+#include "globals.h"
+#include <qapplication.h>
+#include <qcursor.h>
+
+#define TIMER1 400
+#define TIMER2 200
+#define TIMEC 7
+#define TIMER3 100
+#define TIMEC2 20
+#define TIMER4 50
+
+NentryFilter::NentryFilter(QObject* parent)
+ : QObject(parent)
+ {
+ }
+
+void Nentry::setText(const QString& s)
+ {
+ edit->setText(s);
+ }
+
+//---------------------------------------------------------
+// eventFilter
+//---------------------------------------------------------
+
+bool NentryFilter::eventFilter(QObject*, QEvent* event)
+ {
+ Nentry* e = (Nentry*)parent();
+ if (event->type() == QEvent::MouseButtonPress) {
+ e->mousePress((QMouseEvent*)event);
+ return true;
+ }
+ if (event->type() == QEvent::MouseMove) {
+ e->mouseMove((QMouseEvent*)event);
+ return true;
+ }
+ if (event->type() == QEvent::MouseButtonDblClick) {
+ e->mouseDoubleClick((QMouseEvent*)event);
+ return true;
+ }
+ if (event->type() == QEvent::MouseButtonRelease) {
+ e->mouseRelease((QMouseEvent*)event);
+ return true;
+ }
+ if (event->type() == QEvent::Wheel) {
+ e->wheel((QWheelEvent*)event);
+ return true;
+ }
+ if (event->type() == QEvent::KeyPress) {
+ return e->keyPress((QKeyEvent*)event);
+ }
+ if (event->type() == QEvent::ContextMenu) {
+ return e->contextMenu((QContextMenuEvent*)event);
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// Nentry
+// lineedit int values
+//---------------------------------------------------------
+
+Nentry::Nentry(QWidget* parent, const QString& txt,
+ int _lPos, bool dark) : Q3Frame(parent)
+ {
+ focusW = 0;
+ lPos = _lPos;
+ edit = new QLineEdit(this);
+ timer = new QTimer(this);
+ filter = new NentryFilter(this);
+ drawFrame = false;
+ edit->installEventFilter(filter);
+ edit->setFrame(drawFrame);
+
+ connect(timer, SIGNAL(timeout()), SLOT(repeat()));
+ connect(edit, SIGNAL(returnPressed()), SLOT(endEdit()));
+ edit->setCursor(QCursor(Qt::arrowCursor));
+// edit->setFont(font3);
+ val = 0;
+ layout = new Q3HBoxLayout(this);
+ if (txt == "") {
+ layout->addWidget(edit, 1, Qt::AlignHCenter);
+ }
+ else {
+ label = new QLabel(txt, this);
+ if (lPos == 0) {
+ layout->addStretch(5);
+ layout->addSpacing(5);
+ layout->addWidget(label);
+ layout->addSpacing(5);
+ layout->addWidget(edit);
+ layout->addSpacing(5);
+ layout->addStretch(5);
+ }
+ else {
+ label->setAlignment(Qt::AlignLeft);
+ layout->addWidget(edit, 0, Qt::AlignRight);
+ layout->addSpacing(5);
+ layout->addWidget(label, 100, Qt::AlignRight|Qt::AlignVCenter);
+ }
+ }
+ if (dark) {
+ setDark();
+ }
+ edit->setFocusPolicy(Qt::NoFocus);
+ }
+
+void Nentry::setFocusPolicy(Qt::FocusPolicy policy)
+ {
+ edit->setFocusPolicy(policy);
+ }
+
+void Nentry::setDark()
+ {
+ const QPalette& oldpalette = edit->palette();
+ QColorGroup cg1 = oldpalette.active();
+ cg1.setColor(QColorGroup::Base, cg1.background());
+ QPalette newpalette(cg1, cg1, cg1);
+ edit->setPalette(newpalette);
+ }
+
+//---------------------------------------------------------
+// setSize
+//---------------------------------------------------------
+
+void Nentry::setSize(int n)
+ {
+ QString s("0000000000000000");
+ QFontMetrics fm = edit->fontMetrics();
+ int w;
+ if (n <= 16)
+ w = fm.width(s, n);
+ else
+ w = fm.width('0') * n;
+
+ edit->setFixedWidth(w + 14);
+ }
+
+//---------------------------------------------------------
+// setFrame
+//---------------------------------------------------------
+
+void Nentry::setFrame(bool flag)
+ {
+ drawFrame = flag;
+ edit->setFrame(drawFrame);
+ }
+
+//---------------------------------------------------------
+// endEdit
+//---------------------------------------------------------
+
+void Nentry::endEdit()
+ {
+ if (edit->edited()) {
+ if (setSValue(edit->text())) {
+ setString(val, false);
+ return;
+ }
+ edit->setEdited(false);
+ }
+ if (focusW)
+ focusW->setFocus();
+ focusW = 0;
+ edit->clearFocus();
+ if (!drawFrame)
+ edit->setFrame(false);
+ setString(val, false);
+ }
+
+//---------------------------------------------------------
+// contextMenuEvent
+//---------------------------------------------------------
+
+bool Nentry::contextMenu(QContextMenuEvent *e)
+{
+ e->accept();
+ return true;
+}
+//---------------------------------------------------------
+// mousePress
+//---------------------------------------------------------
+
+void Nentry::mousePress(QMouseEvent* event)
+ {
+ button = event->button();
+ starty = event->y();
+ evx = event->x();
+ if (event->button() == Qt::LeftButton) {
+ focusW = qApp->focusWidget();
+ edit->setFocus();
+ edit->setFrame(true);
+ setString(val, true);
+ }
+ else {
+ timecount = 0;
+ repeat();
+ timer->start(TIMER1);
+ }
+ }
+
+//---------------------------------------------------------
+// repeat
+//---------------------------------------------------------
+
+void Nentry::repeat()
+ {
+ if (timecount == 1) {
+ ++timecount;
+ timer->stop();
+ timer->start(TIMER2);
+ return;
+ }
+ ++timecount;
+ if (timecount == TIMEC) {
+ timer->stop();
+ timer->start(TIMER3);
+ }
+ if (timecount == TIMEC2) {
+ timer->stop();
+ timer->start(TIMER4);
+ }
+
+ switch (button) {
+ case Qt::LeftButton:
+ return;
+ case Qt::MidButton:
+ decValue(evx);
+ break;
+ case Qt::RightButton:
+ incValue(evx);
+ break;
+ default:
+ break;
+ }
+ if (focusW)
+ focusW->setFocus();
+ edit->clearFocus();
+ }
+
+//---------------------------------------------------------
+// mouseRelease
+//---------------------------------------------------------
+
+void Nentry::mouseRelease(QMouseEvent* event)
+ {
+ button = Qt::NoButton;
+ timer->stop();
+ if (event->button() != Qt::LeftButton) {
+ if (focusW)
+ focusW->setFocus();
+ edit->clearFocus();
+ }
+ }
+
+//---------------------------------------------------------
+// mouseMove
+//---------------------------------------------------------
+
+void Nentry::mouseMove(QMouseEvent*)
+ {
+ switch (button) {
+ case Qt::LeftButton:
+ break;
+ case Qt::MidButton:
+ break;
+ case Qt::RightButton:
+ break;
+ default:
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// mouseDoubleClick
+//---------------------------------------------------------
+
+void Nentry::mouseDoubleClick(QMouseEvent* event)
+ {
+ if (event->button() != Qt::LeftButton) {
+ mousePress(event);
+ return;
+ }
+ }
+
+//---------------------------------------------------------
+// wheel
+//---------------------------------------------------------
+
+void Nentry::wheel(QWheelEvent* event)
+ {
+ int n = event->delta();
+ if (n > 0)
+ incValue(n);
+ else
+ decValue(-n);
+ event->accept();
+ }
+
+//---------------------------------------------------------
+// setValue
+//---------------------------------------------------------
+
+void Nentry::setValue(int v)
+ {
+ if (v == val)
+ return;
+ if (setString(v)) {
+ if (!drawFrame)
+ edit->setFrame(false);
+ edit->setEnabled(false);
+ }
+ else {
+ edit->setEnabled(true);
+ }
+ val = v;
+ }
+
+//---------------------------------------------------------
+// keyPress
+//---------------------------------------------------------
+
+bool Nentry::keyPress(QKeyEvent* event)
+ {
+ bool shift = event->state() & Qt::ShiftModifier;
+ bool ctrl = event->state() & Qt::ControlModifier;
+ int key = event->key();
+
+ if (shift) {
+ switch(key) {
+ case Qt::Key_Left:
+ case Qt::Key_Right:
+ return false;
+ default:
+ return true;
+ }
+ return true;
+ }
+ if (ctrl) {
+ switch(key) {
+ case Qt::Key_A:
+ case Qt::Key_B:
+ case Qt::Key_C:
+ case Qt::Key_D:
+ case Qt::Key_E:
+ case Qt::Key_F:
+ case Qt::Key_H:
+ case Qt::Key_V:
+ case Qt::Key_X:
+ case Qt::Key_Z:
+ case Qt::Key_Y:
+ return false;
+ default:
+ return true;
+ }
+ return true;
+ }
+ if (event->state())
+ return true;
+ switch (key) {
+ case Qt::Key_Up: incValue(0); return true;
+ case Qt::Key_Down: decValue(0); return true;
+ case 0x30:
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0x36:
+ case 0x37:
+ case 0x38:
+ case 0x39:
+ case Qt::Key_Minus:
+ case Qt::Key_Left:
+ case Qt::Key_Right:
+ case Qt::Key_Backspace:
+ case Qt::Key_Home:
+ case Qt::Key_End:
+ case Qt::Key_Delete:
+ case Qt::Key_Return:
+ return false;
+ default:
+ break;
+ }
+ return true;
+ }
+
diff --git a/muse2/muse/widgets/nentry.h b/muse2/muse/widgets/nentry.h
new file mode 100644
index 00000000..30ddd930
--- /dev/null
+++ b/muse2/muse/widgets/nentry.h
@@ -0,0 +1,93 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: nentry.h,v 1.1.1.1.2.2 2008/05/21 00:28:54 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __NENTRY_H__
+#define __NENTRY_H__
+
+#include <q3frame.h>
+#include <qlineedit.h>
+#include <qstring.h>
+//Added by qt3to4:
+#include <QWheelEvent>
+#include <QEvent>
+#include <Q3HBoxLayout>
+#include <QMouseEvent>
+#include <QLabel>
+#include <QContextMenuEvent>
+#include <QKeyEvent>
+
+class QTimer;
+class Q3HBoxLayout;
+class QLabel;
+
+class NentryFilter : public QObject {
+ Q_OBJECT
+
+ protected:
+ bool eventFilter(QObject* object, QEvent* event);
+ public:
+ NentryFilter(QObject* parent);
+ };
+
+//---------------------------------------------------------
+// Nentry
+// numerical entry widget with optional label
+//---------------------------------------------------------
+
+class Nentry : public Q3Frame {
+ Q_OBJECT
+
+ int button;
+ int starty;
+ bool drawFrame;
+ QTimer* timer;
+ int evx;
+ int timecount;
+ Q3HBoxLayout* layout;
+ QObject* filter;
+ QLabel* label;
+ int lPos; // label Position 0 - left, 1 - right
+ QWidget* focusW;
+
+ protected:
+ QLineEdit* edit;
+ int val;
+ virtual void incValue(int x) = 0;
+ virtual void decValue(int x) = 0;
+ virtual bool setString(int, bool editable = false) = 0;
+ virtual bool setSValue(const QString&) = 0;
+
+ private slots:
+ void repeat();
+
+ protected slots:
+ void endEdit();
+
+ public slots:
+ virtual void setValue(int);
+
+ public:
+ Nentry(QWidget* parent, const QString& txt = QString(""),
+ int lPos = 0, bool dark=false);
+
+ int value() const { return val; }
+ void setFrame(bool);
+ //void setAlignment(int flag) { edit->setAlignment(flag); }
+ void setText(const QString& s);
+ void setSize(int n);
+ void setDark();
+
+ void mousePress(QMouseEvent*);
+ void mouseMove(QMouseEvent*);
+ void mouseDoubleClick(QMouseEvent*);
+ void mouseRelease(QMouseEvent*);
+ void wheel(QWheelEvent*);
+ bool keyPress(QKeyEvent*);
+ void setFocusPolicy(Qt::FocusPolicy);
+ bool contextMenu(QContextMenuEvent*);
+ };
+#endif
diff --git a/muse2/muse/widgets/noteinfo.cpp b/muse2/muse/widgets/noteinfo.cpp
new file mode 100644
index 00000000..59bce4b9
--- /dev/null
+++ b/muse2/muse/widgets/noteinfo.cpp
@@ -0,0 +1,178 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: noteinfo.cpp,v 1.4.2.1 2008/08/18 00:15:26 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "config.h"
+
+#include "noteinfo.h"
+#include <qlayout.h>
+#include <qlabel.h>
+#include "song.h"
+#include "globals.h"
+#include "posedit.h"
+#include "pitchedit.h"
+
+//---------------------------------------------------
+// NoteInfo
+// ToolBar
+// Start, LÃŊÂŋÂ―nge, Note, Velo an, Velo aus, Kanal
+//---------------------------------------------------
+
+NoteInfo::NoteInfo(Q3MainWindow* parent)
+ : Q3ToolBar(tr("Note Info"), parent)
+ {
+ deltaMode = false;
+
+ QLabel* label = new QLabel(tr("Start"), this, "Start");
+ label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ label->setIndent(3);
+ selTime = new PosEdit(this, "Start");
+
+ label = new QLabel(tr("Len"), this, "Len");
+ label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ label->setIndent(3);
+ selLen = new QSpinBox(0, 100000, 1, this);
+
+ label = new QLabel(tr("Pitch"), this, "Pitch");
+ label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ label->setIndent(3);
+ selPitch = new PitchEdit(this, "selPitch");
+
+ label = new QLabel(tr("Velo On"), this, "Velocity On");
+ label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ label->setIndent(3);
+ selVelOn = new QSpinBox(0, 127, 1, this);
+
+ label = new QLabel(tr("Velo Off"), this, "Velocity Off");
+ label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ label->setIndent(3);
+ selVelOff = new QSpinBox(0, 127, 1, this);
+
+ connect(selLen, SIGNAL(valueChanged(int)), SLOT(lenChanged(int)));
+ connect(selPitch, SIGNAL(valueChanged(int)), SLOT(pitchChanged(int)));
+ connect(selVelOn, SIGNAL(valueChanged(int)), SLOT(velOnChanged(int)));
+ connect(selVelOff, SIGNAL(valueChanged(int)), SLOT(velOffChanged(int)));
+ connect(selTime, SIGNAL(valueChanged(const Pos&)), SLOT(timeChanged(const Pos&)));
+ }
+
+//---------------------------------------------------------
+// setDeltaMode
+//---------------------------------------------------------
+
+void NoteInfo::setDeltaMode(bool val)
+ {
+ deltaMode = val;
+ selPitch->setDeltaMode(val);
+ if (val) {
+ selLen->setRange(-100000, 100000);
+ selVelOn->setRange(-127, 127);
+ selVelOff->setRange(-127, 127);
+ }
+ else {
+ selLen->setRange(0, 100000);
+ selVelOn->setRange(0, 127);
+ selVelOff->setRange(0, 127);
+ }
+ }
+
+//---------------------------------------------------------
+// lenChanged
+//---------------------------------------------------------
+
+void NoteInfo::lenChanged(int val)
+ {
+ if (!signalsBlocked())
+ emit valueChanged(VAL_LEN, val);
+ }
+
+//---------------------------------------------------------
+// velOnChanged
+//---------------------------------------------------------
+
+void NoteInfo::velOnChanged(int val)
+ {
+ if (!signalsBlocked())
+ emit valueChanged(VAL_VELON, val);
+ }
+
+//---------------------------------------------------------
+// velOffChanged
+//---------------------------------------------------------
+
+void NoteInfo::velOffChanged(int val)
+ {
+ if (!signalsBlocked())
+ emit valueChanged(VAL_VELOFF, val);
+ }
+
+//---------------------------------------------------------
+// pitchChanged
+//---------------------------------------------------------
+
+void NoteInfo::pitchChanged(int val)
+ {
+ if (!signalsBlocked())
+ emit valueChanged(VAL_PITCH, val);
+ }
+
+//---------------------------------------------------------
+// setValue
+//---------------------------------------------------------
+
+void NoteInfo::setValue(ValType type, int val)
+ {
+ blockSignals(true);
+ switch(type) {
+ case VAL_TIME:
+ selTime->setValue(val);
+ break;
+ case VAL_LEN:
+ selLen->setValue(val);
+ break;
+ case VAL_VELON:
+ selVelOn->setValue(val);
+ break;
+ case VAL_VELOFF:
+ selVelOff->setValue(val);
+ break;
+ case VAL_PITCH:
+ selPitch->setValue(val);
+ break;
+ }
+ blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// setValue
+//---------------------------------------------------------
+
+void NoteInfo::setValues(unsigned tick, int val2, int val3, int val4,
+ int val5)
+ {
+ blockSignals(true);
+ if (selTime->pos().tick() != tick)
+ selTime->setValue(tick);
+ if (selLen->value() != val2)
+ selLen->setValue(val2);
+ if (selPitch->value() != val3)
+ selPitch->setValue(val3);
+ if (selVelOn->value() != val4)
+ selVelOn->setValue(val4);
+ if (selVelOff->value() != val5)
+ selVelOff->setValue(val5);
+ blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// timeChanged
+//---------------------------------------------------------
+
+void NoteInfo::timeChanged(const Pos& pos)
+ {
+ if (!signalsBlocked())
+ emit valueChanged(VAL_TIME, pos.tick());
+ }
+
diff --git a/muse2/muse/widgets/noteinfo.h b/muse2/muse/widgets/noteinfo.h
new file mode 100644
index 00000000..00c798fb
--- /dev/null
+++ b/muse2/muse/widgets/noteinfo.h
@@ -0,0 +1,52 @@
+// MusE
+// Linux Music Editor
+// $Id: noteinfo.h,v 1.3 2004/01/09 17:12:54 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __NOTE_INFO_H__
+#define __NOTE_INFO_H__
+
+#include <q3toolbar.h>
+
+class PosEdit;
+class QSpinBox;
+class PitchEdit;
+class Q3MainWindow;
+class Pos;
+
+//---------------------------------------------------------
+// NoteInfo
+//---------------------------------------------------------
+
+class NoteInfo : public Q3ToolBar {
+ PosEdit* selTime;
+ QSpinBox* selLen;
+ PitchEdit* selPitch;
+ QSpinBox* selVelOn;
+ QSpinBox* selVelOff;
+ bool deltaMode;
+
+ Q_OBJECT
+
+ public:
+ enum ValType {VAL_TIME, VAL_LEN, VAL_VELON, VAL_VELOFF, VAL_PITCH };
+ NoteInfo(Q3MainWindow* parent);
+ void setValues(unsigned, int, int, int, int);
+ void setDeltaMode(bool);
+
+ private slots:
+ void lenChanged(int);
+ void velOnChanged(int);
+ void velOffChanged(int);
+ void pitchChanged(int);
+ void timeChanged(const Pos&);
+
+ public slots:
+ void setValue(ValType, int);
+
+ signals:
+ void valueChanged(NoteInfo::ValType, int);
+ };
+#endif
+
diff --git a/muse2/muse/widgets/pitchedit.cpp b/muse2/muse/widgets/pitchedit.cpp
new file mode 100644
index 00000000..6ecdc4a0
--- /dev/null
+++ b/muse2/muse/widgets/pitchedit.cpp
@@ -0,0 +1,64 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: pitchedit.cpp,v 1.2 2004/01/09 17:12:54 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include "pitchedit.h"
+#include "helper.h"
+
+#include <qstyle.h>
+#include <qapplication.h>
+
+//---------------------------------------------------------
+// PitchEdit
+//---------------------------------------------------------
+
+PitchEdit::PitchEdit(QWidget* parent, const char* name)
+ : QSpinBox(0, 127, 1, parent, name)
+ {
+ deltaMode = false;
+ }
+
+//---------------------------------------------------------
+// mapValueToText
+//---------------------------------------------------------
+
+QString PitchEdit::mapValueToText(int v)
+ {
+ if (deltaMode) {
+ QString s;
+ s.setNum(v);
+ return s;
+ }
+ else
+ return pitch2string(v);
+ }
+
+//---------------------------------------------------------
+// mapTextToValue
+//---------------------------------------------------------
+
+int PitchEdit::mapTextToValue(bool* ok)
+ {
+ printf("PitchEdit: mapTextToValue: not impl.\n");
+ if (ok)
+ *ok = false;
+ return 0;
+ }
+
+//---------------------------------------------------------
+// setDeltaMode
+//---------------------------------------------------------
+
+void PitchEdit::setDeltaMode(bool val)
+ {
+ deltaMode = val;
+ if (deltaMode)
+ setRange(-127, 127);
+ else
+ setRange(0, 127);
+ }
+
diff --git a/muse2/muse/widgets/pitchedit.h b/muse2/muse/widgets/pitchedit.h
new file mode 100644
index 00000000..9c474f08
--- /dev/null
+++ b/muse2/muse/widgets/pitchedit.h
@@ -0,0 +1,33 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: pitchedit.h,v 1.2 2004/01/09 17:12:54 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __PITCHEDIT_H__
+#define __PITCHEDIT_H__
+
+#include <qspinbox.h>
+
+//---------------------------------------------------------
+// PitchEdit
+//---------------------------------------------------------
+
+class PitchEdit : public QSpinBox {
+ Q_OBJECT
+
+ bool deltaMode;
+
+ protected:
+ virtual QString mapValueToText(int v);
+ virtual int mapTextToValue(bool* ok);
+
+ public:
+ PitchEdit(QWidget* parent, const char* name = 0);
+ void setDeltaMode(bool);
+ };
+
+extern QString pitch2string(int v);
+
+#endif
diff --git a/muse2/muse/widgets/pitchlabel.cpp b/muse2/muse/widgets/pitchlabel.cpp
new file mode 100644
index 00000000..f53e6fa5
--- /dev/null
+++ b/muse2/muse/widgets/pitchlabel.cpp
@@ -0,0 +1,95 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: pitchlabel.cpp,v 1.2 2004/05/16 16:55:01 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qapplication.h>
+#include <qstyle.h>
+//Added by qt3to4:
+#include <QLabel>
+#include "pitchedit.h"
+#include "pitchlabel.h"
+#include "helper.h"
+
+//---------------------------------------------------------
+// PitchLabel
+//---------------------------------------------------------
+
+PitchLabel::PitchLabel(QWidget* parent, const char* name)
+ : QLabel(parent, name)
+ {
+ _pitchMode = true;
+ _value = -1;
+ setFrameStyle(WinPanel | Sunken);
+ setLineWidth(2);
+ setMidLineWidth(3);
+ setValue(0);
+ int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, this); // ddskrjo 0
+ setIndent(fw);
+ }
+
+//---------------------------------------------------------
+// setPitchMode
+//---------------------------------------------------------
+
+void PitchLabel::setPitchMode(bool val)
+ {
+ _pitchMode = val;
+ }
+
+//---------------------------------------------------------
+// sizeHint
+//---------------------------------------------------------
+
+QSize PitchLabel::sizeHint() const
+ {
+ QFontMetrics fm(font());
+ int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, this); // ddskrjo 0
+ int h = fm.height() + fw * 2;
+// int w = 2 + fm.width(QString("A#8")) + fw * 4;
+ int w = 2 + fm.width(QString("-9999")) + fw * 4; // must display 14Bit controller values
+ return QSize(w, h).expandedTo(QApplication::globalStrut());
+ }
+
+//---------------------------------------------------------
+// setValue
+//---------------------------------------------------------
+
+void PitchLabel::setValue(int val)
+ {
+ if (val == _value)
+ return;
+ _value = val;
+ QString s;
+ if (_pitchMode)
+ s = pitch2string(_value);
+ else
+ s.sprintf("%d", _value);
+ setText(s);
+ }
+
+//---------------------------------------------------------
+// setInt
+//---------------------------------------------------------
+
+void PitchLabel::setInt(int val)
+ {
+ if (_pitchMode)
+ setPitchMode(false);
+ setValue(val);
+ }
+
+//---------------------------------------------------------
+// setPitch
+//---------------------------------------------------------
+
+void PitchLabel::setPitch(int val)
+ {
+ if (!_pitchMode) {
+ setPitchMode(true);
+ }
+ setValue(val);
+ }
+
diff --git a/muse2/muse/widgets/pitchlabel.h b/muse2/muse/widgets/pitchlabel.h
new file mode 100644
index 00000000..1da83ecc
--- /dev/null
+++ b/muse2/muse/widgets/pitchlabel.h
@@ -0,0 +1,41 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: pitchlabel.h,v 1.1.1.1 2003/10/27 18:54:49 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __PITCHLABEL_H__
+#define __PITCHLABEL_H__
+
+#include <qlabel.h>
+
+//---------------------------------------------------------
+// PitchLabel
+//---------------------------------------------------------
+
+class PitchLabel : public QLabel {
+ bool _pitchMode;
+ int _value;
+ Q_OBJECT
+
+ protected:
+ QSize sizeHint() const;
+
+ public slots:
+ void setValue(int);
+ void setInt(int);
+ void setPitch(int);
+
+ public:
+ PitchLabel(QWidget* parent, const char* name = 0);
+ int value() const { return _value; }
+ void setPitchMode(bool val);
+ bool pitchMode() const { return _pitchMode; }
+ };
+
+
+#endif
+
+
+
diff --git a/muse2/muse/widgets/popupmenu.cpp b/muse2/muse/widgets/popupmenu.cpp
new file mode 100644
index 00000000..05eb64f6
--- /dev/null
+++ b/muse2/muse/widgets/popupmenu.cpp
@@ -0,0 +1,2770 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: popupmenu.cpp,v 1.1.1.1 2010/07/18 03:21:00 terminator356 Exp $
+//
+// (C) Copyright 1999-2010 Werner Schweer (ws@seh.de)
+//
+// PopupMenu sub-class of QPopupMenu created by Tim.
+//=========================================================
+
+
+
+//=========================================================
+//
+// NOTICE: This sub-class of QPopupMenu *automatically* deletes
+// and *clears* any sub popup menus, when clear() is called.
+// Therefore a parent widget is *not* necessary when
+// creating sub popup menus to add to the popup.
+//
+//=========================================================
+
+
+// MusE: want no menu bar here. Can't use, not needed for now anyway.
+#define QT_NO_MENUBAR
+#define QT_NO_WHATSTHIS
+
+#include <qapplication.h>
+//#include <qtimer.h>
+#include <qpointer.h>
+//Added by qt3to4:
+#include <Q3Signal>
+#include <QMouseEvent>
+#include <Q3PopupMenu>
+//#include <qmenubar.h>
+//#include <qstyle.h>
+//#include <qdatetime.h>
+
+#include "popupmenu.h"
+
+// used to provide ONE single-shot timer
+//static QTimer * singleSingleShot = 0;
+//static bool preventAnimation = FALSE;
+// Used to detect motion prior to mouse-release
+static int motion;
+static PopupMenu* active_popup_menu = 0;
+
+/*
+static void cleanup()
+{
+ delete singleSingleShot;
+ singleSingleShot = 0;
+}
+
+static void popupSubMenuLater( int msec, QPopupMenu * receiver ) {
+//static void popupSubMenuLater( int msec, PopupMenu * receiver ) {
+ if ( !singleSingleShot ) {
+ singleSingleShot = new QTimer( qApp, "popup submenu timer" );
+ qAddPostRoutine( cleanup );
+ }
+
+ singleSingleShot->disconnect( SIGNAL(timeout()) );
+ QObject::connect( singleSingleShot, SIGNAL(timeout()),
+ receiver, SLOT(subMenuTimer()) );
+ singleSingleShot->start( msec, TRUE );
+}
+*/
+
+/*
+//======================
+// MenuDataData
+//======================
+
+class QMenuDataData {
+public:
+ QMenuDataData();
+ QGuardedPtr<QWidget> aWidget;
+ int aInt;
+};
+
+//======================
+// QPopupMenuPrivate
+//======================
+
+class QPopupMenuPrivate {
+public:
+ struct Scroll {
+ enum { ScrollNone=0, ScrollUp=0x01, ScrollDown=0x02 };
+ uint scrollable : 2;
+ uint direction : 1;
+ int topScrollableIndex, scrollableSize;
+ QTime lastScroll;
+ QTimer *scrolltimer;
+ } scroll;
+ QSize calcSize;
+ QRegion mouseMoveBuffer;
+};
+*/
+
+//======================
+// PopupMenu
+//======================
+
+PopupMenu::PopupMenu(QWidget* parent, const char* name)
+ : Q3PopupMenu(parent, name)
+{
+ // It's too bad QPopupMenu::d is private.
+ // It will be redundant and this will be our own private member.
+ //d = new QPopupMenuPrivate;
+ //d->scroll.scrollableSize = d->scroll.topScrollableIndex = 0;
+ //d->scroll.scrollable = QPopupMenuPrivate::Scroll::ScrollNone;
+ //d->scroll.scrolltimer = 0;
+}
+
+PopupMenu::~PopupMenu()
+{
+ //if(d->scroll.scrolltimer)
+ // delete d->scroll.scrolltimer;
+
+ //preventAnimation = FALSE;
+ //delete d;
+
+ // Make sure to clear the popup so that any child popups are also deleted !
+ //popup->clear();
+}
+
+void PopupMenu::menuDelPopup(Q3PopupMenu *popup)
+{
+ //printf("PopupMenu::menuDelPopup deleting popup...\n");
+
+ // Make sure to clear the popup so that any child popups are also deleted !
+ // Tested OK. All the popups are deleted.
+ popup->clear();
+
+ popup->disconnect( SIGNAL(activatedRedirect(int)) );
+ popup->disconnect( SIGNAL(highlightedRedirect(int)) );
+ disconnect( popup, SIGNAL(destroyed(QObject*)),
+ this, SLOT(popupDestroyed(QObject*)) );
+ delete popup;
+}
+
+/*
+void PopupMenu::setFirstItemActive()
+{
+ QMenuItemListIt it(*QPopupMenu::mitems);
+ register QMenuItem *mi;
+ int ai = 0;
+ //if(d->scroll.scrollable)
+ // ai = d->scroll.topScrollableIndex;
+ while ( (mi=it.current()) )
+ {
+ ++it;
+ if(!mi->isSeparator() && mi->id() != QMenuData::d->aInt &&
+ (style().styleHint(QStyle::SH_PopupMenu_AllowActiveAndDisabled, this) || mi->isEnabledAndVisible()))
+ {
+ setActiveItem( ai );
+ return;
+ }
+ ai++;
+ }
+ QPopupMenu::actItem = -1;
+}
+*/
+
+/*
+void PopupMenu::hideAllPopups()
+{
+ //register QMenuData *top = this; // find top level popup
+ register MenuData *top = this; // find top level popup
+ if ( !preventAnimation )
+ QTimer::singleShot( 10, this, SLOT(allowAnimation()) );
+ preventAnimation = TRUE;
+
+ if ( !isPopup() )
+ return; // nothing to do
+
+ //while ( top->parentMenu && top->parentMenu->isPopupMenu
+ while ( top->parentMenu && ((MenuData*)top->parentMenu)->isPopupMenu
+ //&& ((QPopupMenu*)top->parentMenu)->isPopup() )
+ && ((PopupMenu*)((MenuData*)top->parentMenu))->isPopup() )
+ //top = top->parentMenu;
+ top = (MenuData*)top->parentMenu;
+ //((QPopupMenu*)top)->hide(); // cascade from top level
+ ((PopupMenu*)top)->hide(); // cascade from top level
+
+#ifndef QT_NO_WHATSTHIS
+ if (whatsThisItem) {
+ qWhatsThisBDH();
+ whatsThisItem = 0;
+ }
+#endif
+
+}
+*/
+
+/*
+void PopupMenu::hidePopups()
+{
+ if ( !preventAnimation )
+ QTimer::singleShot( 10, this, SLOT(allowAnimation()) );
+ preventAnimation = TRUE;
+
+ //QMenuItemListIt it(*mitems);
+ QMenuItemListIt it(*MenuData::mitems);
+ register QMenuItem *mi;
+ while ( (mi=it.current()) ) {
+ ++it;
+ if ( mi->popup() && mi->popup()->parentMenu == this ) //avoid circularity
+ mi->popup()->hide();
+ }
+ popupActive = -1; // no active sub menu
+ if(style().styleHint(QStyle::SH_PopupMenu_SubMenuPopupDelay, this))
+ d->mouseMoveBuffer = QRegion();
+
+ QRect mfrect = itemGeometry( actItem );
+ setMicroFocusHint( mfrect.x(), mfrect.y(), mfrect.width(), mfrect.height(), FALSE );
+}
+*/
+
+bool PopupMenu::tryMenuBar( QMouseEvent *e )
+{
+#if 0 // ddskrjo
+ register QMenuData *top = this; // find top level
+ //register PopupMenu *top = this; // find top level
+ //while ( top->parentMenu )
+ while ( ((PopupMenu*)top)->parentMenu )
+ //top = top->parentMenu;
+ //top = (MenuData*)top->parentMenu;
+ top = ((PopupMenu*)top)->parentMenu;
+#ifndef QT_NO_MENUBAR
+ return top->isMenuBar ?
+ ((QMenuBar *)top)->tryMouseEvent( this, e ) :
+ ((Q3PopupMenu*)top)->tryMouseEvent(this, e );
+#else
+ //return ((QPopupMenu*)top)->tryMouseEvent(this, e );
+ return ((PopupMenu*)top)->tryMouseEvent(this, e );
+#endif
+
+#endif
+ return false; // ddskrjo
+}
+
+//bool PopupMenu::tryMouseEvent( QPopupMenu *p, QMouseEvent * e)
+bool PopupMenu::tryMouseEvent( PopupMenu *p, QMouseEvent * e)
+{
+ if ( p == this )
+ return FALSE;
+ QPoint pos = mapFromGlobal( e->globalPos() );
+ if ( !rect().contains( pos ) ) // outside
+ return FALSE;
+ QMouseEvent ee( e->type(), pos, e->globalPos(), e->button(), e->state() );
+ event( &ee );
+ return TRUE;
+}
+
+/*
+void PopupMenu::byeMenuBar()
+{
+#ifndef QT_NO_MENUBAR
+ //register QMenuData *top = this; // find top level
+ register MenuData *top = this; // find top level
+ while ( top->parentMenu )
+ top = top->parentMenu;
+#endif
+ hideAllPopups();
+#ifndef QT_NO_MENUBAR
+ if ( top->isMenuBar )
+ ((QMenuBar *)top)->goodbye();
+#endif
+}
+*/
+
+void PopupMenu::actSig(int id, bool inwhatsthis)
+{
+ if(!inwhatsthis)
+ {
+ emit activated( id );
+#if defined(QT_ACCESSIBILITY_SUPPORT)
+ if(!fromAccel)
+ QAccessible::updateAccessibility(this, indexOf(id)+1, QAccessible::MenuCommand);
+#endif
+ }
+ else
+ {
+#ifndef QT_NO_WHATSTHIS
+ QRect r(itemGeometry(indexOf(id)));
+ QPoint p(r.center().x(), r.bottom());
+ QString whatsThis = findItem(id)->whatsThis();
+ if(whatsThis.isNull())
+ whatsThis = Q3WhatsThis::textFor(this, p);
+ Q3WhatsThis::leaveWhatsThisMode(whatsThis, mapToGlobal(p), this);
+#endif
+ }
+
+ //emit activatedRedirect(id); ddskrjo
+}
+
+/*
+void PopupMenu::mousePressEvent(QMouseEvent *e)
+{
+ printf("PopupMenu::mousePressEvent\n");
+
+
+ //int sh = style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this);
+ //if (rect().contains(e->pos()) &&
+ // ((d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollUp && e->pos().y() <= sh) || //up
+ // (d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollDown &&
+ // e->pos().y() >= contentsRect().height() - sh))) //down
+ // return;
+
+ mouseBtDn = TRUE; // mouse button down
+ int item = itemAtPos( e->pos() );
+ if ( item == -1 ) {
+ //if ( !rect().contains(e->pos()) && !tryMenuBar(e) ) {
+ // byeMenuBar();
+ //}
+ return;
+ }
+ register QMenuItem *mi = mitems->at(item);
+ ///if ( item != actItem ) // new item activated
+ /// setActiveItem( item );
+
+ QPopupMenu *popup = mi->popup();
+ if(popup)
+ {
+ if(popup->isVisible()) // sub menu already open
+ {
+ //int pactItem = popup->actItem;
+ //popup->actItem = -1;
+ //popup->hidePopups();
+ //popup->updateRow( pactItem );
+ }
+ else // open sub menu
+ {
+ //hidePopups();
+ popupSubMenuLater( 20, this );
+ }
+ }
+ else
+ {
+ //hidePopups();
+ }
+}
+*/
+
+void PopupMenu::mouseReleaseEvent(QMouseEvent *e)
+{
+#if 0 // ddskrjo
+ // do not hide a standalone context menu on press-release, unless
+ // the user moved the mouse significantly
+ //if(!parentMenu && !mouseBtDn && actItem < 0 && motion < 6)
+ // return;
+
+ //mouseBtDn = FALSE;
+ //MenuData::mouseBtDn = FALSE;
+ Q3PopupMenu::mouseBtDn = FALSE;
+
+ // if the user released the mouse outside the menu, pass control
+ // to the menubar or our parent menu
+ //int sh = style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this);
+ if(!rect().contains(e->pos()) && tryMenuBar(e))
+ return;
+ //else
+ //if((d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollUp && e->pos().y() <= sh) || //up
+ // (d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollDown &&
+ // e->pos().y() >= contentsRect().height() - sh)) //down
+ // return;
+
+ if(Q3PopupMenu::actItem < 0)
+ {
+ // we do not have an active item
+ // if the release is inside without motion (happens with
+ // oversized popup menus on small screens), ignore it
+ if(rect().contains(e->pos()) && motion < 6)
+ return;
+ ///else
+ /// byeMenuBar();
+ }
+ else
+ {
+ // selected menu item!
+ register QMenuItem *mi = Q3PopupMenu::mitems->at(Q3PopupMenu::actItem);
+ if(mi->widget())
+ {
+ QWidget* widgetAt = QApplication::widgetAt(e->globalPos(), TRUE);
+ if(widgetAt && widgetAt != this)
+ {
+ QMouseEvent me(e->type(), widgetAt->mapFromGlobal(e->globalPos()),
+ e->globalPos(), e->button(), e->state());
+ QApplication::sendEvent( widgetAt, &me );
+ }
+ }
+ //QPopupMenu *popup = mi->popup();
+ PopupMenu *popup = (PopupMenu*)mi->popup();
+#ifndef QT_NO_WHATSTHIS
+ bool b = Q3WhatsThis::inWhatsThisMode();
+#else
+ const bool b = FALSE;
+#endif
+ if(!mi->isEnabledAndVisible())
+ {
+#ifndef QT_NO_WHATSTHIS
+ if(b)
+ {
+ actItem = -1;
+ updateItem(mi->id());
+ byeMenuBar();
+ actSig(mi->id(), b);
+ }
+#endif
+ }
+ else
+ if(popup)
+ {
+ //popup->setFirstItemActive();
+ }
+ else
+ {
+ // normal menu item
+ ///byeMenuBar(); // deactivate menu bar
+ if(mi->isEnabledAndVisible())
+ {
+ ///QPopupMenu::actItem = -1;
+ Q3PopupMenu::updateItem(mi->id());
+ active_popup_menu = this;
+ QPointer<Q3Signal> signal = mi->signal();
+ actSig(mi->id(), b);
+ if(signal && !b)
+ signal->activate();
+ active_popup_menu = 0;
+ }
+ }
+ }
+#endif
+}
+
+
+
+
+
+
+/****************************************************************************
+**
+** Implementation of QPopupMenu class
+**
+** Created : 941128
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of the widgets module of the Qt GUI Toolkit.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free Qt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** This file may be used under the terms of the Q Public License as
+** defined by Trolltech ASA and appearing in the file LICENSE.QPL
+** included in the packaging of this file. Licensees holding valid Qt
+** Commercial licenses may use this file in accordance with the Qt
+** Commercial License Agreement provided with the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+/*
+#include "popupmenu.h"
+#ifndef QT_NO_POPUPMENU
+#include <qmenubar.h>
+#include <qaccel.h>
+#include <qpainter.h>
+#include <qdrawutil.h>
+#include <qapplication.h>
+#include <qpixmap.h>
+#include <qpixmapcache.h>
+#include <qtimer.h>
+#include <qwhatsthis.h>
+#include <qobjectlist.h>
+#include <qguardedptr.h>
+//#include <qeffects_p.h>
+#include <qcursor.h>
+#include <qstyle.h>
+#include <qtimer.h>
+#include <qdatetime.h>
+#if defined(QT_ACCESSIBILITY_SUPPORT)
+#include <qaccessible.h>
+#endif
+
+//#define ANIMATED_POPUP
+//#define BLEND_POPUP
+
+// Motif style parameters
+
+static const int motifArrowHMargin = 6; // arrow horizontal margin
+static const int motifArrowVMargin = 2; // arrow vertical margin
+
+#if 0
+# define DEBUG_SLOPPY_SUBMENU
+#endif
+
+// used for internal communication
+static PopupMenu * syncMenu = 0;
+static int syncMenuId = 0;
+
+// Used to detect motion prior to mouse-release
+static int motion;
+
+// used to provide ONE single-shot timer
+static QTimer * singleSingleShot = 0;
+
+static bool supressAboutToShow = FALSE;
+
+static void cleanup()
+{
+ delete singleSingleShot;
+ singleSingleShot = 0;
+}
+
+static void popupSubMenuLater( int msec, PopupMenu * receiver ) {
+ if ( !singleSingleShot ) {
+ singleSingleShot = new QTimer( qApp, "popup submenu timer" );
+ qAddPostRoutine( cleanup );
+ }
+
+ singleSingleShot->disconnect( SIGNAL(timeout()) );
+ QObject::connect( singleSingleShot, SIGNAL(timeout()),
+ receiver, SLOT(subMenuTimer()) );
+ singleSingleShot->start( msec, TRUE );
+}
+
+static bool preventAnimation = FALSE;
+
+#ifndef QT_NO_WHATSTHIS
+extern void qWhatsThisBDH();
+static QMenuItem* whatsThisItem = 0;
+#endif
+
+class QMenuDataData {
+ // attention: also defined in qmenudata.cpp
+public:
+ QMenuDataData();
+ QGuardedPtr<QWidget> aWidget;
+ int aInt;
+};
+
+class QPopupMenuPrivate {
+public:
+ struct Scroll {
+ enum { ScrollNone=0, ScrollUp=0x01, ScrollDown=0x02 };
+ uint scrollable : 2;
+ uint direction : 1;
+ int topScrollableIndex, scrollableSize;
+ QTime lastScroll;
+ QTimer *scrolltimer;
+ } scroll;
+ QSize calcSize;
+ QRegion mouseMoveBuffer;
+};
+
+static PopupMenu* active_popup_menu = 0;
+
+PopupMenu::PopupMenu( QWidget *parent, const char *name )
+ : QFrame( parent, name, WType_Popup | WNoAutoErase )
+{
+ d = new QPopupMenuPrivate;
+ d->scroll.scrollableSize = d->scroll.topScrollableIndex = 0;
+ d->scroll.scrollable = QPopupMenuPrivate::Scroll::ScrollNone;
+ d->scroll.scrolltimer = 0;
+ isPopupMenu = TRUE;
+#ifndef QT_NO_ACCEL
+ autoaccel = 0;
+ accelDisabled = FALSE;
+#endif
+ popupActive = -1;
+ snapToMouse = TRUE;
+ tab = 0;
+ checkable = 0;
+ tornOff = 0;
+ pendingDelayedContentsChanges = 0;
+ pendingDelayedStateChanges = 0;
+ maxPMWidth = 0;
+
+ tab = 0;
+ ncols = 1;
+ setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
+ setMouseTracking(style().styleHint(QStyle::SH_PopupMenu_MouseTracking, this));
+ //style().polishPopupMenu( this );
+ style().polishPopupMenu( (QPopupMenu*)this );
+ setBackgroundMode( PaletteButton );
+ connectModalRecursionSafety = 0;
+
+ setFocusPolicy( StrongFocus );
+}
+
+PopupMenu::~PopupMenu()
+{
+ if ( syncMenu == this && qApp ) {
+ qApp->exit_loop();
+ syncMenu = 0;
+ }
+
+ if(d->scroll.scrolltimer)
+ delete d->scroll.scrolltimer;
+
+ if ( isVisible() ) {
+ parentMenu = 0;
+ hidePopups();
+ }
+
+ delete (QWidget*) QMenuData::d->aWidget; // tear-off menu
+
+ preventAnimation = FALSE;
+ delete d;
+}
+
+
+void PopupMenu::updateItem( int id ) // update popup menu item
+{
+ updateRow( indexOf(id) );
+}
+
+
+void PopupMenu::setCheckable( bool enable )
+{
+ if ( isCheckable() != enable ) {
+ checkable = enable;
+ badSize = TRUE;
+ if ( QMenuData::d->aWidget )
+ ( (PopupMenu*)(QWidget*)QMenuData::d->aWidget)->setCheckable( enable );
+ }
+}
+
+bool PopupMenu::isCheckable() const
+{
+ return checkable;
+}
+
+void PopupMenu::menuContentsChanged()
+{
+ // here the part that can't be delayed
+ QMenuData::menuContentsChanged();
+ badSize = TRUE; // might change the size
+#if defined(Q_WS_MAC) && !defined(QMAC_QMENUBAR_NO_NATIVE)
+ mac_dirty_popup = 1;
+#endif
+ if( pendingDelayedContentsChanges )
+ return;
+ pendingDelayedContentsChanges = 1;
+ if( !pendingDelayedStateChanges ) // if the timer hasn't been started yet
+ QTimer::singleShot( 0, this, SLOT(performDelayedChanges()));
+}
+
+void PopupMenu::performDelayedContentsChanged()
+{
+ pendingDelayedContentsChanges = 0;
+ // here the part the can be delayed
+#ifndef QT_NO_ACCEL
+ // if performDelayedStateChanged() will be called too,
+ // it will call updateAccel() too, no need to do it twice
+ if( !pendingDelayedStateChanges )
+ updateAccel( 0 );
+#endif
+ if ( isVisible() ) {
+ if ( tornOff )
+ return;
+ updateSize(TRUE);
+ update();
+ }
+ PopupMenu* p = (PopupMenu*)(QWidget*)QMenuData::d->aWidget;
+ if ( p && p->isVisible() ) {
+ p->updateSize(TRUE);
+ p->update();
+ }
+#if defined(Q_WS_MAC) && !defined(QMAC_QMENUBAR_NO_NATIVE)
+ mac_dirty_popup = 1;
+#endif
+}
+
+
+void PopupMenu::menuStateChanged()
+{
+ // here the part that can't be delayed
+ if( pendingDelayedStateChanges )
+ return;
+ pendingDelayedStateChanges = 1;
+ if( !pendingDelayedContentsChanges ) // if the timer hasn't been started yet
+ QTimer::singleShot( 0, this, SLOT(performDelayedChanges()));
+}
+
+void PopupMenu::performDelayedStateChanged()
+{
+ pendingDelayedStateChanges = 0;
+ // here the part that can be delayed
+#ifndef QT_NO_ACCEL
+ updateAccel( 0 ); // ### when we have a good solution for the accel vs. focus widget problem, remove that. That is only a workaround
+ // if you remove this, see performDelayedContentsChanged()
+#endif
+ update();
+ if ( QMenuData::d->aWidget )
+ QMenuData::d->aWidget->update();
+}
+
+void PopupMenu::performDelayedChanges()
+{
+ if( pendingDelayedContentsChanges )
+ performDelayedContentsChanged();
+ if( pendingDelayedStateChanges )
+ performDelayedStateChanged();
+}
+
+void PopupMenu::menuInsPopup( PopupMenu *popup )
+{
+ connect( popup, SIGNAL(activatedRedirect(int)),
+ SLOT(subActivated(int)) );
+ connect( popup, SIGNAL(highlightedRedirect(int)),
+ SLOT(subHighlighted(int)) );
+ connect( popup, SIGNAL(destroyed(QObject*)),
+ this, SLOT(popupDestroyed(QObject*)) );
+}
+
+void PopupMenu::menuDelPopup( PopupMenu *popup )
+{
+ popup->disconnect( SIGNAL(activatedRedirect(int)) );
+ popup->disconnect( SIGNAL(highlightedRedirect(int)) );
+ disconnect( popup, SIGNAL(destroyed(QObject*)),
+ this, SLOT(popupDestroyed(QObject*)) );
+}
+
+
+void PopupMenu::frameChanged()
+{
+ menuContentsChanged();
+}
+
+void PopupMenu::popup( const QPoint &pos, int indexAtPoint )
+{
+ if ( !isPopup() && isVisible() )
+ hide();
+
+ //avoid circularity
+ if ( isVisible() || !isEnabled() )
+ return;
+
+#if defined(Q_WS_MAC) && !defined(QMAC_QMENUBAR_NO_NATIVE)
+ if( macPopupMenu(pos, indexAtPoint ))
+ return;
+#endif
+
+#if (QT_VERSION-0 >= 0x040000)
+#error "Fix this now"
+ // #### should move to QWidget - anything might need this functionality,
+ // #### since anything can have WType_Popup window flag.
+ // #### This includes stuff in QPushButton and some stuff for setting
+ // #### the geometry of QDialog.
+ // QPopupMenu
+ // ::exec()
+ // ::popup()
+ // QPushButton (shouldn't require QMenuPopup)
+ // ::popupPressed
+ // Some stuff in qwidget.cpp for dialogs... can't remember exactly.
+ // Also the code here indicatets the parameter should be a rect, not a
+ // point.
+#endif
+
+ if(d->scroll.scrollable) {
+ d->scroll.scrollable = QPopupMenuPrivate::Scroll::ScrollNone;
+ d->scroll.topScrollableIndex = d->scroll.scrollableSize = 0;
+ badSize = TRUE;
+ }
+ updateSize();
+
+ QPoint mouse = QCursor::pos();
+ snapToMouse = pos == mouse;
+
+ // have to emit here as a menu might be setup in a slot connected
+ // to aboutToShow which will change the size of the menu
+ bool s = supressAboutToShow;
+ supressAboutToShow = TRUE;
+ if ( !s) {
+ emit aboutToShow();
+ updateSize(TRUE);
+ }
+
+ int screen_num;
+ if (QApplication::desktop()->isVirtualDesktop())
+ screen_num =
+ QApplication::desktop()->screenNumber( QApplication::reverseLayout() ?
+ pos+QPoint(width(),0) : pos );
+ else
+ screen_num = QApplication::desktop()->screenNumber( this );
+#ifdef Q_WS_MAC
+ QRect screen = QApplication::desktop()->availableGeometry( screen_num );
+#else
+ QRect screen = QApplication::desktop()->screenGeometry( screen_num );
+#endif
+ int sw = screen.width(); // screen width
+ int sh = screen.height(); // screen height
+ int sx = screen.x(); // screen pos
+ int sy = screen.y();
+ int x = pos.x();
+ int y = pos.y();
+ if ( indexAtPoint >= 0 ) // don't subtract when < 0
+ y -= itemGeometry( indexAtPoint ).y(); // (would subtract 2 pixels!)
+ int w = width();
+ int h = height();
+
+ if ( snapToMouse ) {
+ if ( qApp->reverseLayout() )
+ x -= w;
+ if ( x+w > sx+sw )
+ x = mouse.x()-w;
+ if ( y+h > sy+sh )
+ y = mouse.y()-h;
+ if ( x < sx )
+ x = mouse.x();
+ if ( y < sy )
+ y = sy;
+ }
+
+ if ( x+w > sx+sw ) // the complete widget must
+ x = sx+sw - w; // be visible
+ if ( y+h > sy+sh )
+ y = sy+sh - h;
+ if ( x < sx )
+ x = sx;
+ if ( y < sy )
+ y = sy;
+
+ if(style().styleHint(QStyle::SH_PopupMenu_Scrollable, this)) {
+ int off_top = 0, off_bottom = 0;
+ if(y+h > sy+sh)
+ off_bottom = (y+h) - (sy+sh);
+ if(y < sy)
+ off_top = sy - y;
+ if(off_bottom || off_top) {
+ int ch = updateSize().height(); //store the old height, before setting scrollable --Sam
+ const int vextra = style().pixelMetric(QStyle::PM_PopupMenuFrameVerticalExtra, this);
+ d->scroll.scrollableSize = h - off_top - off_bottom - 2*vextra;
+ if(off_top) {
+ move( x, y = sy );
+ d->scroll.scrollable = d->scroll.scrollable | QPopupMenuPrivate::Scroll::ScrollUp;
+ }
+ if( off_bottom )
+ d->scroll.scrollable = d->scroll.scrollable | QPopupMenuPrivate::Scroll::ScrollDown;
+ if( off_top != off_bottom && indexAtPoint >= 0 ) {
+ ch -= (vextra * 2);
+ if(ch > sh) //no bigger than the screen!
+ ch = sh;
+ if( ch > d->scroll.scrollableSize )
+ d->scroll.scrollableSize = ch;
+ }
+
+ updateSize(TRUE); //now set the size using the scrollable/scrollableSize as above
+ w = width();
+ h = height();
+ if(indexAtPoint >= 0) {
+ if(off_top) { //scroll to it
+ register QMenuItem *mi = NULL;
+ QMenuItemListIt it(*mitems);
+ for(int tmp_y = 0; tmp_y < off_top && (mi=it.current()); ) {
+ QSize sz = style().sizeFromContents(QStyle::CT_PopupMenuItem, this,
+ QSize(0, itemHeight( mi )),
+ QStyleOption(mi,maxPMWidth,0));
+ tmp_y += sz.height();
+ d->scroll.topScrollableIndex++;
+ }
+ }
+ }
+ }
+ }
+ move( x, y );
+ motion=0;
+ actItem = -1;
+
+#ifndef QT_NO_EFFECTS
+ int hGuess = qApp->reverseLayout() ? QEffects::LeftScroll : QEffects::RightScroll;
+ int vGuess = QEffects::DownScroll;
+ if ( qApp->reverseLayout() ) {
+ if ( snapToMouse && ( x + w/2 > mouse.x() ) ||
+ ( parentMenu && parentMenu->isPopupMenu &&
+ ( x + w/2 > ((PopupMenu*)parentMenu)->x() ) ) )
+ hGuess = QEffects::RightScroll;
+ } else {
+ if ( snapToMouse && ( x + w/2 < mouse.x() ) ||
+ ( parentMenu && parentMenu->isPopupMenu &&
+ ( x + w/2 < ((PopupMenu*)parentMenu)->x() ) ) )
+ hGuess = QEffects::LeftScroll;
+ }
+
+#ifndef QT_NO_MENUBAR
+ if ( snapToMouse && ( y + h/2 < mouse.y() ) ||
+ ( parentMenu && parentMenu->isMenuBar &&
+ ( y + h/2 < ((QMenuBar*)parentMenu)->mapToGlobal( ((QMenuBar*)parentMenu)->pos() ).y() ) ) )
+ vGuess = QEffects::UpScroll;
+#endif
+
+ if ( QApplication::isEffectEnabled( UI_AnimateMenu ) &&
+ preventAnimation == FALSE ) {
+ if ( QApplication::isEffectEnabled( UI_FadeMenu ) )
+ qFadeEffect( this );
+ else if ( parentMenu )
+ qScrollEffect( this, parentMenu->isPopupMenu ? hGuess : vGuess );
+ else
+ qScrollEffect( this, hGuess | vGuess );
+ } else
+#endif
+ {
+ show();
+ }
+#if defined(QT_ACCESSIBILITY_SUPPORT)
+ QAccessible::updateAccessibility( this, 0, QAccessible::PopupMenuStart );
+#endif
+}
+
+void PopupMenu::subActivated( int id )
+{
+ emit activatedRedirect( id );
+}
+
+void PopupMenu::subHighlighted( int id )
+{
+ emit highlightedRedirect( id );
+}
+
+static bool fromAccel = FALSE;
+
+#ifndef QT_NO_ACCEL
+void PopupMenu::accelActivated( int id )
+{
+ QMenuItem *mi = findItem( id );
+ if ( mi && mi->isEnabledAndVisible() ) {
+ QGuardedPtr<QSignal> signal = mi->signal();
+ fromAccel = TRUE;
+ actSig( mi->id() );
+ fromAccel = FALSE;
+ if ( signal )
+ signal->activate();
+ }
+}
+
+void PopupMenu::accelDestroyed() // accel about to be deleted
+{
+ autoaccel = 0; // don't delete it twice!
+}
+#endif //QT_NO_ACCEL
+
+void PopupMenu::popupDestroyed( QObject *o )
+{
+ removePopup( (PopupMenu*)o );
+}
+
+void PopupMenu::actSig( int id, bool inwhatsthis )
+{
+ if ( !inwhatsthis ) {
+ emit activated( id );
+#if defined(QT_ACCESSIBILITY_SUPPORT)
+ if ( !fromAccel )
+ QAccessible::updateAccessibility( this, indexOf(id)+1, QAccessible::MenuCommand );
+#endif
+ } else {
+#ifndef QT_NO_WHATSTHIS
+ QRect r( itemGeometry( indexOf( id ) ) );
+ QPoint p( r.center().x(), r.bottom() );
+ QString whatsThis = findItem( id )->whatsThis();
+ if ( whatsThis.isNull() )
+ whatsThis = QWhatsThis::textFor( this, p );
+ QWhatsThis::leaveWhatsThisMode( whatsThis, mapToGlobal( p ), this );
+#endif
+ }
+
+ emit activatedRedirect( id );
+}
+
+void PopupMenu::hilitSig( int id )
+{
+ emit highlighted( id );
+ emit highlightedRedirect( id );
+
+#if defined(QT_ACCESSIBILITY_SUPPORT)
+ QAccessible::updateAccessibility( this, indexOf(id)+1, QAccessible::Focus );
+ QAccessible::updateAccessibility( this, indexOf(id)+1, QAccessible::Selection );
+#endif
+}
+
+void PopupMenu::setFirstItemActive()
+{
+ QMenuItemListIt it(*mitems);
+ register QMenuItem *mi;
+ int ai = 0;
+ if(d->scroll.scrollable)
+ ai = d->scroll.topScrollableIndex;
+ while ( (mi=it.current()) ) {
+ ++it;
+ if ( !mi->isSeparator() && mi->id() != QMenuData::d->aInt &&
+ ( style().styleHint( QStyle::SH_PopupMenu_AllowActiveAndDisabled, this ) || mi->isEnabledAndVisible() )) {
+ setActiveItem( ai );
+ return;
+ }
+ ai++;
+ }
+ actItem = -1;
+}
+
+void PopupMenu::hideAllPopups()
+{
+ register QMenuData *top = this; // find top level popup
+ if ( !preventAnimation )
+ QTimer::singleShot( 10, this, SLOT(allowAnimation()) );
+ preventAnimation = TRUE;
+
+ if ( !isPopup() )
+ return; // nothing to do
+
+ while ( top->parentMenu && top->parentMenu->isPopupMenu
+ && ((PopupMenu*)top->parentMenu)->isPopup() )
+ top = top->parentMenu;
+ ((PopupMenu*)top)->hide(); // cascade from top level
+
+#ifndef QT_NO_WHATSTHIS
+ if (whatsThisItem) {
+ qWhatsThisBDH();
+ whatsThisItem = 0;
+ }
+#endif
+
+}
+
+void PopupMenu::hidePopups()
+{
+ if ( !preventAnimation )
+ QTimer::singleShot( 10, this, SLOT(allowAnimation()) );
+ preventAnimation = TRUE;
+
+ QMenuItemListIt it(*mitems);
+ register QMenuItem *mi;
+ while ( (mi=it.current()) ) {
+ ++it;
+ if ( mi->popup() && mi->popup()->parentMenu == this ) //avoid circularity
+ mi->popup()->hide();
+ }
+ popupActive = -1; // no active sub menu
+ if(style().styleHint(QStyle::SH_PopupMenu_SubMenuPopupDelay, this))
+ d->mouseMoveBuffer = QRegion();
+
+ QRect mfrect = itemGeometry( actItem );
+ setMicroFocusHint( mfrect.x(), mfrect.y(), mfrect.width(), mfrect.height(), FALSE );
+}
+
+bool PopupMenu::tryMenuBar( QMouseEvent *e )
+{
+ register QMenuData *top = this; // find top level
+ while ( top->parentMenu )
+ top = top->parentMenu;
+#ifndef QT_NO_MENUBAR
+ return top->isMenuBar ?
+ ((QMenuBar *)top)->tryMouseEvent( this, e ) :
+ ((PopupMenu*)top)->tryMouseEvent(this, e );
+#else
+ return ((PopupMenu*)top)->tryMouseEvent(this, e );
+#endif
+}
+
+bool PopupMenu::tryMouseEvent( PopupMenu *p, QMouseEvent * e)
+{
+ if ( p == this )
+ return FALSE;
+ QPoint pos = mapFromGlobal( e->globalPos() );
+ if ( !rect().contains( pos ) ) // outside
+ return FALSE;
+ QMouseEvent ee( e->type(), pos, e->globalPos(), e->button(), e->state() );
+ event( &ee );
+ return TRUE;
+}
+
+void PopupMenu::byeMenuBar()
+{
+#ifndef QT_NO_MENUBAR
+ register QMenuData *top = this; // find top level
+ while ( top->parentMenu )
+ top = top->parentMenu;
+#endif
+ hideAllPopups();
+#ifndef QT_NO_MENUBAR
+ if ( top->isMenuBar )
+ ((QMenuBar *)top)->goodbye();
+#endif
+}
+
+int PopupMenu::itemAtPos( const QPoint &pos, bool ignoreSeparator ) const
+{
+ if ( !contentsRect().contains(pos) )
+ return -1;
+
+ int row = 0;
+ int x = contentsRect().x();
+ int y = contentsRect().y();
+ QMenuItem *mi;
+ QMenuItemListIt it( *mitems );
+ if(d->scroll.scrollable) {
+ if(d->scroll.topScrollableIndex) {
+ for( ; (mi = it.current()) && row < d->scroll.topScrollableIndex; row++)
+ ++it;
+ if(!mi) {
+ row = 0;
+ it.toFirst();
+ }
+ y += style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this);
+ }
+ }
+ int itemw = contentsRect().width() / ncols;
+ QSize sz;
+ while ( (mi=it.current()) ) {
+ if(d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollDown &&
+ y >= contentsRect().height() - style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this))
+ return -1;
+ ++it;
+ if ( !mi->isVisible() ) {
+ ++row;
+ continue;
+ }
+ int itemh = itemHeight( mi );
+
+ sz = style().sizeFromContents(QStyle::CT_PopupMenuItem, this,
+ QSize(0, itemh),
+ QStyleOption(mi,maxPMWidth));
+ sz = sz.expandedTo(QSize(itemw, sz.height()));
+ itemw = sz.width();
+ itemh = sz.height();
+
+ if ( ncols > 1 && y + itemh > contentsRect().bottom() ) {
+ y = contentsRect().y();
+ x +=itemw;
+ }
+ if ( QRect( x, y, itemw, itemh ).contains( pos ) )
+ break;
+ y += itemh;
+ ++row;
+ }
+
+ if ( mi && ( !ignoreSeparator || !mi->isSeparator() ) )
+ return row;
+ return -1;
+}
+
+QRect PopupMenu::itemGeometry( int index )
+{
+ QMenuItem *mi;
+ QSize sz;
+ int row = 0, scrollh = 0;
+ int x = contentsRect().x();
+ int y = contentsRect().y();
+ QMenuItemListIt it( *mitems );
+ if(d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollUp) {
+ scrollh = style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this);
+ y += scrollh;
+ if(d->scroll.topScrollableIndex) {
+ for( ; (mi = it.current()) && row < d->scroll.topScrollableIndex; row++)
+ ++it;
+ if(!mi) {
+ row = 0;
+ it.toFirst();
+ }
+ }
+ }
+ int itemw = contentsRect().width() / ncols;
+ while ( (mi=it.current()) ) {
+ if(d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollDown &&
+ y >= contentsRect().height() - scrollh)
+ break;
+ ++it;
+ if ( !mi->isVisible() ) {
+ ++row;
+ continue;
+ }
+ int itemh = itemHeight( mi );
+
+ sz = style().sizeFromContents(QStyle::CT_PopupMenuItem, this,
+ QSize(0, itemh),
+ QStyleOption(mi,maxPMWidth));
+ sz = sz.expandedTo(QSize(itemw, sz.height()));
+ itemw = sz.width();
+ itemh = sz.height();
+ if(d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollDown &&
+ (y + itemh > contentsRect().height() - scrollh))
+ itemh -= (y + itemh) - (contentsRect().height() - scrollh);
+ if ( ncols > 1 && y + itemh > contentsRect().bottom() ) {
+ y = contentsRect().y();
+ x +=itemw;
+ }
+ if ( row == index )
+ return QRect( x,y,itemw,itemh );
+ y += itemh;
+ ++row;
+ }
+
+ return QRect(0,0,0,0);
+}
+
+QSize PopupMenu::updateSize(bool force_update, bool do_resize)
+{
+ polish();
+ if ( count() == 0 ) {
+ QSize ret = QSize( 50, 8 );
+ if(do_resize)
+ setFixedSize( ret );
+ badSize = TRUE;
+ return ret;
+ }
+
+ int scrheight = 0;
+ if(d->scroll.scrollableSize) {
+ if(d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollUp)
+ scrheight += style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this);
+ if(d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollDown)
+ scrheight += style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this);
+ }
+
+ if(badSize || force_update) {
+#ifndef QT_NO_ACCEL
+ updateAccel( 0 );
+#endif
+ int height = 0;
+ int max_width = 0, max_height = 0;
+ QFontMetrics fm = fontMetrics();
+ register QMenuItem *mi;
+ maxPMWidth = 0;
+ int maxWidgetWidth = 0;
+ tab = 0;
+
+ for ( QMenuItemListIt it( *mitems ); it.current(); ++it ) {
+ mi = it.current();
+ QWidget *miw = mi->widget();
+ if (miw) {
+ if ( miw->parentWidget() != this )
+ miw->reparent( this, QPoint(0,0), TRUE );
+ // widget items musn't propgate mouse events
+ ((PopupMenu*)miw)->setWFlags(WNoMousePropagation);
+ }
+ if ( mi->custom() )
+ mi->custom()->setFont( font() );
+ if ( mi->iconSet() != 0)
+ maxPMWidth = QMAX( maxPMWidth,
+ mi->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 4 );
+ }
+
+ int dh = QApplication::desktop()->height();
+ ncols = 1;
+
+ for ( QMenuItemListIt it2( *mitems ); it2.current(); ++it2 ) {
+ mi = it2.current();
+ if ( !mi->isVisible() )
+ continue;
+ int w = 0;
+ int itemHeight = PopupMenu::itemHeight( mi );
+
+ if ( mi->widget() ) {
+ QSize s( mi->widget()->sizeHint() );
+ s = s.expandedTo( mi->widget()->minimumSize() );
+ mi->widget()->resize( s );
+ if ( s.width() > maxWidgetWidth )
+ maxWidgetWidth = s.width();
+ itemHeight = s.height();
+ } else {
+ if( ! mi->isSeparator() ) {
+ if ( mi->custom() ) {
+ if ( mi->custom()->fullSpan() ) {
+ maxWidgetWidth = QMAX( maxWidgetWidth,
+ mi->custom()->sizeHint().width() );
+ } else {
+ QSize s ( mi->custom()->sizeHint() );
+ w += s.width();
+ }
+ }
+
+ w += maxPMWidth;
+
+ if (! mi->text().isNull()) {
+ QString s = mi->text();
+ int t;
+ if ( (t = s.find('\t')) >= 0 ) { // string contains tab
+ w += fm.width( s, t );
+ w -= s.contains('&') * fm.width('&');
+ w += s.contains("&&") * fm.width('&');
+ int tw = fm.width( s.mid(t + 1) );
+ if ( tw > tab)
+ tab = tw;
+ } else {
+ w += fm.width( s );
+ w -= s.contains('&') * fm.width('&');
+ w += s.contains("&&") * fm.width('&');
+ }
+ } else if (mi->pixmap())
+ w += mi->pixmap()->width();
+ } else {
+ if ( mi->custom() ) {
+ QSize s ( mi->custom()->sizeHint() );
+ w += s.width();
+ } else {
+ w = itemHeight = 2;
+ }
+ }
+
+ QSize sz = style().sizeFromContents(QStyle::CT_PopupMenuItem, this,
+ QSize(w, itemHeight),
+ QStyleOption(mi,maxPMWidth));
+
+ w = sz.width();
+ itemHeight = sz.height();
+
+#if defined(QT_CHECK_NULL)
+ if ( mi->text().isNull() && !mi->pixmap() && !mi->iconSet() &&
+ !mi->isSeparator() && !mi->widget() && !mi->custom() )
+ qWarning( "PopupMenu: (%s) Popup has invalid menu item",
+ name( "unnamed" ) );
+#endif
+ }
+ height += itemHeight;
+ if(style().styleHint(QStyle::SH_PopupMenu_Scrollable, this)) {
+ if(scrheight && height >= d->scroll.scrollableSize - scrheight) {
+ height = d->scroll.scrollableSize - scrheight;
+ break;
+ }
+ } else if( height + 2*frameWidth() >= dh ) {
+ ncols++;
+ max_height = QMAX(max_height, height - itemHeight);
+ height = itemHeight;
+ }
+ if ( w > max_width )
+ max_width = w;
+ }
+ if( ncols == 1 && !max_height )
+ max_height = height;
+
+ if(style().styleHint(QStyle::SH_PopupMenu_Scrollable, this)) {
+ height += scrheight;
+ setMouseTracking(TRUE);
+ }
+
+ if ( tab )
+ tab -= fontMetrics().minRightBearing();
+ else
+ max_width -= fontMetrics().minRightBearing();
+
+ if ( max_width + tab < maxWidgetWidth )
+ max_width = maxWidgetWidth - tab;
+
+ const int fw = frameWidth();
+ int extra_width = (fw+style().pixelMetric(QStyle::PM_PopupMenuFrameHorizontalExtra, this)) * 2,
+ extra_height = (fw+style().pixelMetric(QStyle::PM_PopupMenuFrameVerticalExtra, this)) * 2;
+ if ( ncols == 1 )
+ d->calcSize = QSize( QMAX( minimumWidth(), max_width + tab + extra_width ),
+ QMAX( minimumHeight() , height + extra_height ) );
+ else
+ d->calcSize = QSize( QMAX( minimumWidth(), (ncols*(max_width + tab)) + extra_width ),
+ QMAX( minimumHeight(), QMIN( max_height + extra_height + 1, dh ) ) );
+ badSize = FALSE;
+ }
+
+ {
+ // Position the widget items. It could be done in drawContents
+ // but this way we get less flicker.
+ QSize sz;
+ int x = contentsRect().x();
+ int y = contentsRect().y();
+ int itemw = contentsRect().width() / ncols;
+ for(QMenuItemListIt it(*mitems); it.current(); ++it) {
+ QMenuItem *mi = it.current();
+ if ( !mi->isVisible() )
+ continue;
+
+ int itemh = itemHeight( mi );
+
+ sz = style().sizeFromContents(QStyle::CT_PopupMenuItem, this,
+ QSize(0, itemh), QStyleOption(mi,maxPMWidth));
+ sz = sz.expandedTo(QSize(itemw, sz.height()));
+ itemw = sz.width();
+ itemh = sz.height();
+
+ if ( ncols > 1 && y + itemh > contentsRect().bottom() ) {
+ y = contentsRect().y();
+ x +=itemw;
+ }
+ if ( mi->widget() )
+ mi->widget()->setGeometry( x, y, itemw, mi->widget()->height() );
+ y += itemh;
+ }
+ }
+
+ if( do_resize && size() != d->calcSize ) {
+ setMaximumSize( d->calcSize );
+ d->calcSize = maximumSize(); //let the max size adjust it (virtual)
+ resize( d->calcSize );
+ }
+ return d->calcSize;
+}
+
+#ifndef QT_NO_ACCEL
+void PopupMenu::updateAccel( QWidget *parent )
+{
+ QMenuItemListIt it(*mitems);
+ register QMenuItem *mi;
+
+ if ( parent ) {
+ delete autoaccel;
+ autoaccel = 0;
+ } else if ( !autoaccel ) {
+ // we have no parent. Rather than ignoring any accelerators we try to find this popup's main window
+ if ( tornOff ) {
+ parent = this;
+ } else {
+ QWidget *w = (QWidget *) this;
+ parent = w->parentWidget();
+ while ( (!w->testWFlags(WType_TopLevel) || !w->testWFlags(WType_Popup)) && parent ) {
+ w = parent;
+ parent = parent->parentWidget();
+ }
+ }
+ }
+
+ if ( parent == 0 && autoaccel == 0 )
+ return;
+
+ if ( autoaccel ) // build it from scratch
+ autoaccel->clear();
+ else {
+ // create an autoaccel in any case, even if we might not use
+ // it immediately. Maybe the user needs it later.
+ autoaccel = new QAccel( parent, this );
+ connect( autoaccel, SIGNAL(activated(int)),
+ SLOT(accelActivated(int)) );
+ connect( autoaccel, SIGNAL(activatedAmbiguously(int)),
+ SLOT(accelActivated(int)) );
+ connect( autoaccel, SIGNAL(destroyed()),
+ SLOT(accelDestroyed()) );
+ if ( accelDisabled )
+ autoaccel->setEnabled( FALSE );
+ }
+ while ( (mi=it.current()) ) {
+ ++it;
+ QKeySequence k = mi->key();
+ if ( (int)k ) {
+ int id = autoaccel->insertItem( k, mi->id() );
+#ifndef QT_NO_WHATSTHIS
+ autoaccel->setWhatsThis( id, mi->whatsThis() );
+#endif
+ }
+ if ( !mi->text().isNull() || mi->custom() ) {
+ QString s = mi->text();
+ int i = s.find('\t');
+
+ // Note: Only looking at the first key in the sequence!
+ if ( (int)k && (int)k != Key_unknown ) {
+ QString t = (QString)mi->key();
+ if ( i >= 0 )
+ s.replace( i+1, s.length()-i, t );
+ else {
+ s += '\t';
+ s += t;
+ }
+ } else if ( !k ) {
+ if ( i >= 0 )
+ s.truncate( i );
+ }
+ if ( s != mi->text() ) {
+ mi->setText( s );
+ badSize = TRUE;
+ }
+ }
+ if ( mi->popup() && parent ) { // call recursively
+ // reuse
+ PopupMenu* popup = mi->popup();
+ if (!popup->avoid_circularity) {
+ popup->avoid_circularity = 1;
+ popup->updateAccel( parent );
+ popup->avoid_circularity = 0;
+ }
+ }
+ }
+}
+
+void PopupMenu::enableAccel( bool enable )
+{
+ if ( autoaccel )
+ autoaccel->setEnabled( enable );
+ accelDisabled = !enable; // rememeber when updateAccel
+ QMenuItemListIt it(*mitems);
+ register QMenuItem *mi;
+ while ( (mi=it.current()) ) { // do the same for sub popups
+ ++it;
+ if ( mi->popup() ) // call recursively
+ mi->popup()->enableAccel( enable );
+ }
+}
+#endif
+
+void PopupMenu::setFont( const QFont &font )
+{
+ QWidget::setFont( font );
+ badSize = TRUE;
+ if ( isVisible() ) {
+ updateSize();
+ update();
+ }
+}
+
+void PopupMenu::show()
+{
+ if ( !isPopup() && isVisible() )
+ hide();
+
+ if ( isVisible() ) {
+ supressAboutToShow = FALSE;
+ QWidget::show();
+ return;
+ }
+ if (!supressAboutToShow)
+ emit aboutToShow();
+ else
+ supressAboutToShow = FALSE;
+ performDelayedChanges();
+ updateSize(TRUE);
+ QWidget::show();
+ popupActive = -1;
+ if(style().styleHint(QStyle::SH_PopupMenu_SubMenuPopupDelay, this))
+ d->mouseMoveBuffer = QRegion();
+}
+
+void PopupMenu::hide()
+{
+ if ( syncMenu == this && qApp ) {
+ qApp->exit_loop();
+ syncMenu = 0;
+ }
+
+ if ( !isVisible() ) {
+ QWidget::hide();
+ return;
+ }
+ emit aboutToHide();
+
+ actItem = popupActive = -1;
+ if(style().styleHint(QStyle::SH_PopupMenu_SubMenuPopupDelay, this))
+ d->mouseMoveBuffer = QRegion();
+ mouseBtDn = FALSE; // mouse button up
+#if defined(QT_ACCESSIBILITY_SUPPORT)
+ QAccessible::updateAccessibility( this, 0, QAccessible::PopupMenuEnd );
+#endif
+ parentMenu = 0;
+ hidePopups();
+ QWidget::hide();
+}
+
+int PopupMenu::itemHeight( int row ) const
+{
+ return itemHeight( mitems->at( row ) );
+}
+
+int PopupMenu::itemHeight( QMenuItem *mi ) const
+{
+ if ( mi->widget() )
+ return mi->widget()->height();
+ if ( mi->custom() && mi->custom()->fullSpan() )
+ return mi->custom()->sizeHint().height();
+
+ QFontMetrics fm(fontMetrics());
+ int h = 0;
+ if ( mi->isSeparator() ) // separator height
+ h = 2;
+ else if ( mi->pixmap() ) // pixmap height
+ h = mi->pixmap()->height();
+ else // text height
+ h = fm.height();
+
+ if ( !mi->isSeparator() && mi->iconSet() != 0 )
+ h = QMAX(h, mi->iconSet()->pixmap( QIconSet::Small,
+ QIconSet::Normal ).height());
+ if ( mi->custom() )
+ h = QMAX(h, mi->custom()->sizeHint().height());
+
+ return h;
+}
+
+void PopupMenu::drawItem( QPainter* p, int tab_, QMenuItem* mi,
+ bool act, int x, int y, int w, int h)
+{
+ QStyle::SFlags flags = QStyle::Style_Default;
+ if (isEnabled() && mi->isEnabledAndVisible() && (!mi->popup() || mi->popup()->isEnabled()) )
+ flags |= QStyle::Style_Enabled;
+ if (act)
+ flags |= QStyle::Style_Active;
+ if (mouseBtDn)
+ flags |= QStyle::Style_Down;
+
+ const QColorGroup &cg = ((flags&QStyle::Style_Enabled) ? colorGroup() : palette().disabled() );
+
+ if ( mi->custom() && mi->custom()->fullSpan() ) {
+ QMenuItem dummy;
+ style().drawControl(QStyle::CE_PopupMenuItem, p, this, QRect(x, y, w, h), cg,
+ flags, QStyleOption(&dummy,maxPMWidth,tab_));
+ mi->custom()->paint( p, cg, act, flags&QStyle::Style_Enabled, x, y, w, h );
+ } else
+ style().drawControl(QStyle::CE_PopupMenuItem, p, this, QRect(x, y, w, h), cg,
+ flags, QStyleOption(mi,maxPMWidth,tab_));
+}
+
+void PopupMenu::drawContents( QPainter* p )
+{
+ QMenuItemListIt it(*mitems);
+ QMenuItem *mi = 0;
+ int row = 0;
+ int x = contentsRect().x();
+ int y = contentsRect().y();
+ if(d->scroll.scrollable) {
+ if(d->scroll.topScrollableIndex) {
+ for( ; (mi = it.current()) && row < d->scroll.topScrollableIndex; row++)
+ ++it;
+ if(!mi)
+ it.toFirst();
+ }
+ if(d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollUp) {
+ QRect rect(x, y, contentsRect().width(),
+ style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this));
+ if(!p->hasClipping() || p->clipRegion().contains(rect)) {
+ QStyle::SFlags flags = QStyle::Style_Up;
+ if (isEnabled())
+ flags |= QStyle::Style_Enabled;
+ style().drawControl(QStyle::CE_PopupMenuScroller, p, this, rect,
+ colorGroup(), flags, QStyleOption(maxPMWidth));
+ }
+ y += rect.height();
+ }
+ }
+
+ int itemw = contentsRect().width() / ncols;
+ QSize sz;
+ QStyle::SFlags flags;
+ while ( (mi=it.current()) ) {
+ if(d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollDown &&
+ y >= contentsRect().height() - style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this))
+ break;
+ ++it;
+ if ( !mi->isVisible() ) {
+ ++row;
+ continue;
+ }
+ int itemh = itemHeight( mi );
+ sz = style().sizeFromContents(QStyle::CT_PopupMenuItem, this,
+ QSize(0, itemh),
+ QStyleOption(mi,maxPMWidth,0)
+ );
+ sz = sz.expandedTo(QSize(itemw, sz.height()));
+ itemw = sz.width();
+ itemh = sz.height();
+
+ if ( ncols > 1 && y + itemh > contentsRect().bottom() ) {
+ if ( y < contentsRect().bottom() ) {
+ QRect rect(x, y, itemw, contentsRect().bottom() - y);
+ if(!p->hasClipping() || p->clipRegion().contains(rect)) {
+ flags = QStyle::Style_Default;
+ if (isEnabled() && mi->isEnabledAndVisible())
+ flags |= QStyle::Style_Enabled;
+ style().drawControl(QStyle::CE_PopupMenuItem, p, this, rect,
+ colorGroup(), flags, QStyleOption((QMenuItem*)0,maxPMWidth));
+ }
+ }
+ y = contentsRect().y();
+ x +=itemw;
+ }
+ if (!mi->widget() && (!p->hasClipping() || p->clipRegion().contains(QRect(x, y, itemw, itemh))))
+ drawItem( p, tab, mi, row == actItem, x, y, itemw, itemh );
+ y += itemh;
+ ++row;
+ }
+ if ( y < contentsRect().bottom() ) {
+ QRect rect(x, y, itemw, contentsRect().bottom() - y);
+ if(!p->hasClipping() || p->clipRegion().contains(rect)) {
+ flags = QStyle::Style_Default;
+ if ( isEnabled() )
+ flags |= QStyle::Style_Enabled;
+ style().drawControl(QStyle::CE_PopupMenuItem, p, this, rect,
+ colorGroup(), flags, QStyleOption((QMenuItem*)0,maxPMWidth));
+ }
+ }
+ if( d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollDown ) {
+ int sh = style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this);
+ QRect rect(x, contentsRect().height() - sh, contentsRect().width(), sh);
+ if(!p->hasClipping() || p->clipRegion().contains(rect)) {
+ QStyle::SFlags flags = QStyle::Style_Down;
+ if (isEnabled())
+ flags |= QStyle::Style_Enabled;
+ style().drawControl(QStyle::CE_PopupMenuScroller, p, this, rect,
+ colorGroup(), flags, QStyleOption(maxPMWidth));
+ }
+ }
+#if defined( DEBUG_SLOPPY_SUBMENU )
+ if ( style().styleHint(QStyle::SH_PopupMenu_SloppySubMenus, this )) {
+ p->setClipRegion( d->mouseMoveBuffer );
+ p->fillRect( d->mouseMoveBuffer.boundingRect(), colorGroup().brush( QColorGroup::Highlight ) );
+ }
+#endif
+}
+
+void PopupMenu::paintEvent( QPaintEvent *e )
+{
+ QFrame::paintEvent( e );
+}
+
+void PopupMenu::closeEvent( QCloseEvent * e) {
+ e->accept();
+ byeMenuBar();
+}
+
+void PopupMenu::mousePressEvent( QMouseEvent *e )
+{
+ int sh = style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this);
+ if (rect().contains(e->pos()) &&
+ ((d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollUp && e->pos().y() <= sh) || //up
+ (d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollDown &&
+ e->pos().y() >= contentsRect().height() - sh))) //down
+ return;
+
+ mouseBtDn = TRUE; // mouse button down
+ int item = itemAtPos( e->pos() );
+ if ( item == -1 ) {
+ if ( !rect().contains(e->pos()) && !tryMenuBar(e) ) {
+ byeMenuBar();
+ }
+ return;
+ }
+ register QMenuItem *mi = mitems->at(item);
+ if ( item != actItem ) // new item activated
+ setActiveItem( item );
+
+ PopupMenu *popup = mi->popup();
+ if ( popup ) {
+ if ( popup->isVisible() ) { // sub menu already open
+ int pactItem = popup->actItem;
+ popup->actItem = -1;
+ popup->hidePopups();
+ popup->updateRow( pactItem );
+ } else { // open sub menu
+ hidePopups();
+ popupSubMenuLater( 20, this );
+ }
+ } else {
+ hidePopups();
+ }
+}
+
+void PopupMenu::mouseReleaseEvent( QMouseEvent *e )
+{
+ // do not hide a standalone context menu on press-release, unless
+ // the user moved the mouse significantly
+ if ( !parentMenu && !mouseBtDn && actItem < 0 && motion < 6 )
+ return;
+
+ mouseBtDn = FALSE;
+
+ // if the user released the mouse outside the menu, pass control
+ // to the menubar or our parent menu
+ int sh = style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this);
+ if ( !rect().contains( e->pos() ) && tryMenuBar(e) )
+ return;
+ else if((d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollUp && e->pos().y() <= sh) || //up
+ (d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollDown &&
+ e->pos().y() >= contentsRect().height() - sh)) //down
+ return;
+
+ if ( actItem < 0 ) { // we do not have an active item
+ // if the release is inside without motion (happens with
+ // oversized popup menus on small screens), ignore it
+ if ( rect().contains( e->pos() ) && motion < 6 )
+ return;
+ else
+ byeMenuBar();
+ } else { // selected menu item!
+ register QMenuItem *mi = mitems->at(actItem);
+ if ( mi ->widget() ) {
+ QWidget* widgetAt = QApplication::widgetAt( e->globalPos(), TRUE );
+ if ( widgetAt && widgetAt != this ) {
+ QMouseEvent me( e->type(), widgetAt->mapFromGlobal( e->globalPos() ),
+ e->globalPos(), e->button(), e->state() );
+ QApplication::sendEvent( widgetAt, &me );
+ }
+ }
+ PopupMenu *popup = mi->popup();
+#ifndef QT_NO_WHATSTHIS
+ bool b = QWhatsThis::inWhatsThisMode();
+#else
+ const bool b = FALSE;
+#endif
+ if ( !mi->isEnabledAndVisible() ) {
+#ifndef QT_NO_WHATSTHIS
+ if ( b ) {
+ actItem = -1;
+ updateItem( mi->id() );
+ byeMenuBar();
+ actSig( mi->id(), b);
+ }
+#endif
+ } else if ( popup ) {
+ popup->setFirstItemActive();
+ } else { // normal menu item
+ byeMenuBar(); // deactivate menu bar
+ if ( mi->isEnabledAndVisible() ) {
+ actItem = -1;
+ updateItem( mi->id() );
+ active_popup_menu = this;
+ QGuardedPtr<QSignal> signal = mi->signal();
+ actSig( mi->id(), b );
+ if ( signal && !b )
+ signal->activate();
+ active_popup_menu = 0;
+ }
+ }
+ }
+}
+
+void PopupMenu::mouseMoveEvent( QMouseEvent *e )
+{
+ motion++;
+
+ if ( parentMenu && parentMenu->isPopupMenu ) {
+ PopupMenu* p = (PopupMenu*)parentMenu;
+ int myIndex;
+
+ p->findPopup( this, &myIndex );
+ QPoint pPos = p->mapFromParent( e->globalPos() );
+ if ( p->actItem != myIndex && !p->rect().contains( pPos ) )
+ p->setActiveItem( myIndex );
+
+ if ( style().styleHint(QStyle::SH_PopupMenu_SloppySubMenus, this )) {
+ p->d->mouseMoveBuffer = QRegion();
+#ifdef DEBUG_SLOPPY_SUBMENU
+ p->repaint();
+#endif
+ }
+ }
+
+ if ( (e->state() & Qt::MouseButtonMask) == 0 &&
+ !hasMouseTracking() )
+ return;
+
+ if(d->scroll.scrollable && e->pos().x() >= rect().x() && e->pos().x() <= rect().width()) {
+ int sh = style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this);
+ if((d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollUp && e->pos().y() <= sh) ||
+ (d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollDown && e->pos().y() >= height()-sh)) {
+ if(!d->scroll.scrolltimer) {
+ d->scroll.scrolltimer = new QTimer(this, "popup scroll timer");
+ QObject::connect( d->scroll.scrolltimer, SIGNAL(timeout()),
+ this, SLOT(subScrollTimer()) );
+ }
+ if(!d->scroll.scrolltimer->isActive())
+ d->scroll.scrolltimer->start(40);
+ return;
+ }
+ }
+
+ int item = itemAtPos( e->pos() );
+ if ( item == -1 ) { // no valid item
+ int lastActItem = actItem;
+ actItem = -1;
+ if ( lastActItem >= 0 )
+ updateRow( lastActItem );
+ if ( lastActItem > 0 ||
+ ( !rect().contains( e->pos() ) && !tryMenuBar( e ) ) ) {
+ popupSubMenuLater(style().styleHint(QStyle::SH_PopupMenu_SubMenuPopupDelay,
+ this), this);
+ }
+ } else { // mouse on valid item
+ // but did not register mouse press
+ if ( (e->state() & Qt::MouseButtonMask) && !mouseBtDn )
+ mouseBtDn = TRUE; // so mouseReleaseEvent will pop down
+
+ register QMenuItem *mi = mitems->at( item );
+
+ if ( mi->widget() ) {
+ QWidget* widgetAt = QApplication::widgetAt( e->globalPos(), TRUE );
+ if ( widgetAt && widgetAt != this ) {
+ QMouseEvent me( e->type(), widgetAt->mapFromGlobal( e->globalPos() ),
+ e->globalPos(), e->button(), e->state() );
+ QApplication::sendEvent( widgetAt, &me );
+ }
+ }
+
+ if ( actItem == item )
+ return;
+
+ if ( style().styleHint(QStyle::SH_PopupMenu_SloppySubMenus, this) &&
+ d->mouseMoveBuffer.contains( e->pos() ) ) {
+ actItem = item;
+ popupSubMenuLater( style().styleHint(QStyle::SH_PopupMenu_SubMenuPopupDelay, this) * 6,
+ this );
+ return;
+ }
+
+ if ( mi->popup() || ( popupActive >= 0 && popupActive != item ))
+ popupSubMenuLater( style().styleHint(QStyle::SH_PopupMenu_SubMenuPopupDelay, this),
+ this );
+ else if ( singleSingleShot )
+ singleSingleShot->stop();
+
+ if ( item != actItem )
+ setActiveItem( item );
+ }
+}
+
+void PopupMenu::keyPressEvent( QKeyEvent *e )
+{
+ QMenuItem *mi = 0;
+ PopupMenu *popup;
+ int dy = 0;
+ bool ok_key = TRUE;
+
+ int key = e->key();
+ if ( QApplication::reverseLayout() ) {
+ // in reverse mode opening and closing keys for submenues are reversed
+ if ( key == Key_Left )
+ key = Key_Right;
+ else if ( key == Key_Right )
+ key = Key_Left;
+ }
+
+ switch ( key ) {
+ case Key_Tab:
+ // ignore tab, otherwise it will be passed to the menubar
+ break;
+
+ case Key_Up:
+ dy = -1;
+ break;
+
+ case Key_Down:
+ dy = 1;
+ break;
+
+ case Key_Alt:
+ if ( style().styleHint(QStyle::SH_MenuBar_AltKeyNavigation, this) )
+ byeMenuBar();
+ break;
+
+ case Key_Escape:
+ if ( tornOff ) {
+ close();
+ return;
+ }
+ // just hide one
+ {
+ QMenuData* p = parentMenu;
+ hide();
+#ifndef QT_NO_MENUBAR
+ if ( p && p->isMenuBar )
+ ((QMenuBar*) p)->goodbye( TRUE );
+#endif
+ }
+ break;
+
+ case Key_Left:
+ if ( ncols > 1 && actItem >= 0 ) {
+ QRect r( itemGeometry( actItem ) );
+ int newActItem = itemAtPos( QPoint( r.left() - 1, r.center().y() ) );
+ if ( newActItem >= 0 ) {
+ setActiveItem( newActItem );
+ break;
+ }
+ }
+ if ( parentMenu && parentMenu->isPopupMenu ) {
+ ((PopupMenu *)parentMenu)->hidePopups();
+ if ( singleSingleShot )
+ singleSingleShot->stop();
+ break;
+ }
+
+ ok_key = FALSE;
+ break;
+
+ case Key_Right:
+ if ( actItem >= 0 && ( mi=mitems->at(actItem) )->isEnabledAndVisible() && (popup=mi->popup()) ) {
+ hidePopups();
+ if ( singleSingleShot )
+ singleSingleShot->stop();
+ // ### The next two lines were switched to fix the problem with the first item of the
+ // submenu not being highlighted...any reason why they should have been the other way??
+ subMenuTimer();
+ popup->setFirstItemActive();
+ break;
+ } else if ( actItem == -1 && ( parentMenu && !parentMenu->isMenuBar )) {
+ dy = 1;
+ break;
+ }
+ if ( ncols > 1 && actItem >= 0 ) {
+ QRect r( itemGeometry( actItem ) );
+ int newActItem = itemAtPos( QPoint( r.right() + 1, r.center().y() ) );
+ if ( newActItem >= 0 ) {
+ setActiveItem( newActItem );
+ break;
+ }
+ }
+ ok_key = FALSE;
+ break;
+
+ case Key_Space:
+ if (! style().styleHint(QStyle::SH_PopupMenu_SpaceActivatesItem, this))
+ break;
+ // for motif, fall through
+
+ case Key_Return:
+ case Key_Enter:
+ {
+ if ( actItem < 0 )
+ break;
+#ifndef QT_NO_WHATSTHIS
+ bool b = QWhatsThis::inWhatsThisMode();
+#else
+ const bool b = FALSE;
+#endif
+ mi = mitems->at( actItem );
+ if ( !mi->isEnabled() && !b )
+ break;
+ popup = mi->popup();
+ if ( popup ) {
+ hidePopups();
+ popupSubMenuLater( 20, this );
+ popup->setFirstItemActive();
+ } else {
+ actItem = -1;
+ updateItem( mi->id() );
+ byeMenuBar();
+ if ( mi->isEnabledAndVisible() || b ) {
+ active_popup_menu = this;
+ QGuardedPtr<QSignal> signal = mi->signal();
+ actSig( mi->id(), b );
+ if ( signal && !b )
+ signal->activate();
+ active_popup_menu = 0;
+ }
+ }
+ }
+ break;
+#ifndef QT_NO_WHATSTHIS
+ case Key_F1:
+ if ( actItem < 0 || e->state() != ShiftButton)
+ break;
+ mi = mitems->at( actItem );
+ if ( !mi->whatsThis().isNull() ){
+ if ( !QWhatsThis::inWhatsThisMode() )
+ QWhatsThis::enterWhatsThisMode();
+ QRect r( itemGeometry( actItem) );
+ QWhatsThis::leaveWhatsThisMode( mi->whatsThis(), mapToGlobal( r.bottomLeft()) );
+ }
+ //fall-through!
+#endif
+ default:
+ ok_key = FALSE;
+
+ }
+ if ( !ok_key &&
+ ( !e->state() || e->state() == AltButton || e->state() == ShiftButton ) &&
+ e->text().length()==1 ) {
+ QChar c = e->text()[0].upper();
+
+ QMenuItemListIt it(*mitems);
+ QMenuItem* first = 0;
+ QMenuItem* currentSelected = 0;
+ QMenuItem* firstAfterCurrent = 0;
+
+ register QMenuItem *m;
+ mi = 0;
+ int indx = 0;
+ int clashCount = 0;
+ while ( (m=it.current()) ) {
+ ++it;
+ QString s = m->text();
+ if ( !s.isEmpty() ) {
+ int i = s.find( '&' );
+ while ( i >= 0 && i < (int)s.length() - 1 ) {
+ if ( s[i+1].upper() == c ) {
+ ok_key = TRUE;
+ clashCount++;
+ if ( !first )
+ first = m;
+ if ( indx == actItem )
+ currentSelected = m;
+ else if ( !firstAfterCurrent && currentSelected )
+ firstAfterCurrent = m;
+ break;
+ } else if ( s[i+1] == '&' ) {
+ i = s.find( '&', i+2 );
+ } else {
+ break;
+ }
+ }
+ }
+ if ( mi )
+ break;
+ indx++;
+ }
+
+ if ( 1 == clashCount ) { // No clashes, continue with selection
+ mi = first;
+ popup = mi->popup();
+ if ( popup ) {
+ setActiveItem( indexOf(mi->id()) );
+ hidePopups();
+ popupSubMenuLater( 20, this );
+ popup->setFirstItemActive();
+ } else {
+ byeMenuBar();
+#ifndef QT_NO_WHATSTHIS
+ bool b = QWhatsThis::inWhatsThisMode();
+#else
+ const bool b = FALSE;
+#endif
+ if ( mi->isEnabledAndVisible() || b ) {
+ active_popup_menu = this;
+ QGuardedPtr<QSignal> signal = mi->signal();
+ actSig( mi->id(), b );
+ if ( signal && !b )
+ signal->activate();
+ active_popup_menu = 0;
+ }
+ }
+ } else if ( clashCount > 1 ) { // Clashes, highlight next...
+ // If there's clashes and no one is selected, use first one
+ // or if there is no clashes _after_ current, use first one
+ if ( !currentSelected || (currentSelected && !firstAfterCurrent))
+ dy = indexOf( first->id() ) - actItem;
+ else
+ dy = indexOf( firstAfterCurrent->id() ) - actItem;
+ }
+ }
+#ifndef QT_NO_MENUBAR
+ if ( !ok_key ) { // send to menu bar
+ register QMenuData *top = this; // find top level
+ while ( top->parentMenu )
+ top = top->parentMenu;
+ if ( top->isMenuBar ) {
+ int beforeId = top->actItem;
+ ((QMenuBar*)top)->tryKeyEvent( this, e );
+ if ( beforeId != top->actItem )
+ ok_key = TRUE;
+ }
+ }
+#endif
+ if ( actItem < 0 ) {
+ if ( dy > 0 ) {
+ setFirstItemActive();
+ } else if ( dy < 0 ) {
+ QMenuItemListIt it(*mitems);
+ it.toLast();
+ register QMenuItem *mi;
+ int ai = count() - 1;
+ while ( (mi=it.current()) ) {
+ --it;
+ if ( !mi->isSeparator() && mi->id() != QMenuData::d->aInt ) {
+ setActiveItem( ai );
+ return;
+ }
+ ai--;
+ }
+ actItem = -1;
+ }
+ return;
+ }
+
+ if ( dy ) { // highlight next/prev
+ register int i = actItem;
+ int c = mitems->count();
+ for(int n = c; n; n--) {
+ i = i + dy;
+ if(d->scroll.scrollable) {
+ if(d->scroll.scrolltimer)
+ d->scroll.scrolltimer->stop();
+ if(i < 0)
+ i = 0;
+ else if(i >= c)
+ i = c - 1;
+ } else {
+ if ( i == c )
+ i = 0;
+ else if ( i < 0 )
+ i = c - 1;
+ }
+ mi = mitems->at( i );
+ if ( !mi || !mi->isVisible() )
+ continue;
+
+ if ( !mi->isSeparator() &&
+ ( style().styleHint(QStyle::SH_PopupMenu_AllowActiveAndDisabled, this)
+ || mi->isEnabledAndVisible() ) )
+ break;
+ }
+ if ( i != actItem )
+ setActiveItem( i );
+ if(d->scroll.scrollable) { //need to scroll to make it visible?
+ QRect r = itemGeometry(actItem);
+ if(r.isNull() || r.height() < itemHeight(mitems->at(actItem))) {
+ bool refresh = FALSE;
+ if(d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollUp && dy == -1) { //up
+ if(d->scroll.topScrollableIndex >= 0) {
+ d->scroll.topScrollableIndex--;
+ refresh = TRUE;
+ }
+ } else if(d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollDown) { //down
+ QMenuItemListIt it(*mitems);
+ int sh = style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this);
+ for(int i = 0, y = ((d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollUp) ? sh : 0); it.current(); i++, ++it) {
+ if(i >= d->scroll.topScrollableIndex) {
+ int itemh = itemHeight(it.current());
+ QSize sz = style().sizeFromContents(QStyle::CT_PopupMenuItem, this,
+ QSize(0, itemh),
+ QStyleOption(it.current(),maxPMWidth,0));
+ y += sz.height();
+ if(y > (contentsRect().height()-sh)) {
+ if(sz.height() > sh || !it.atLast())
+ d->scroll.topScrollableIndex++;
+ refresh = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ if(refresh) {
+ updateScrollerState();
+ update();
+ }
+ }
+ }
+ }
+
+#ifdef Q_OS_WIN32
+ if ( !ok_key &&
+ !( e->key() == Key_Control || e->key() == Key_Shift || e->key() == Key_Meta ) )
+ qApp->beep();
+#endif // Q_OS_WIN32
+}
+
+void PopupMenu::timerEvent( QTimerEvent *e )
+{
+ QFrame::timerEvent( e );
+}
+
+void PopupMenu::leaveEvent( QEvent * )
+{
+ if ( testWFlags( WStyle_Tool ) && style().styleHint(QStyle::SH_PopupMenu_MouseTracking, this) ) {
+ int lastActItem = actItem;
+ actItem = -1;
+ if ( lastActItem >= 0 )
+ updateRow( lastActItem );
+ }
+}
+
+void PopupMenu::styleChange( QStyle& old )
+{
+ QFrame::styleChange( old );
+ setMouseTracking(style().styleHint(QStyle::SH_PopupMenu_MouseTracking, this));
+ style().polishPopupMenu( this );
+ updateSize(TRUE);
+}
+
+void PopupMenu::enabledChange( bool )
+{
+ if ( QMenuData::d->aWidget ) // torn-off menu
+ QMenuData::d->aWidget->setEnabled( isEnabled() );
+}
+
+int PopupMenu::columns() const
+{
+ return ncols;
+}
+
+// This private slot handles the scrolling popupmenu
+void PopupMenu::subScrollTimer() {
+ QPoint pos = QCursor::pos();
+ if(!d->scroll.scrollable || !isVisible()) {
+ if(d->scroll.scrolltimer)
+ d->scroll.scrolltimer->stop();
+ return;
+ } else if(pos.x() > x() + width() || pos.x() < x()) {
+ return;
+ }
+ int sh = style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this);
+ if(!d->scroll.lastScroll.isValid()) {
+ d->scroll.lastScroll = QTime::currentTime();
+ } else {
+ int factor=0;
+ if(pos.y() < y())
+ factor = y() - pos.y();
+ else if(pos.y() > y() + height())
+ factor = pos.y() - (y() + height());
+ int msecs = 250 - ((factor / 10) * 40);
+ if(d->scroll.lastScroll.msecsTo(QTime::currentTime()) < QMAX(0, msecs))
+ return;
+ d->scroll.lastScroll = QTime::currentTime();
+ }
+ if(d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollUp && pos.y() <= y() + sh) { //up
+ if(d->scroll.topScrollableIndex > 0) {
+ d->scroll.topScrollableIndex--;
+ updateScrollerState();
+ update(contentsRect());
+ }
+ } else if(d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollDown &&
+ pos.y() >= (y() + contentsRect().height()) - sh) { //down
+ QMenuItemListIt it(*mitems);
+ for(int i = 0, y = contentsRect().y() + sh; it.current(); i++, ++it) {
+ if(i >= d->scroll.topScrollableIndex) {
+ int itemh = itemHeight(it.current());
+ QSize sz = style().sizeFromContents(QStyle::CT_PopupMenuItem, this, QSize(0, itemh),
+ QStyleOption(it.current(),maxPMWidth,0));
+ y += sz.height();
+ if(y > contentsRect().height() - sh) {
+ d->scroll.topScrollableIndex++;
+ updateScrollerState();
+ update(contentsRect());
+ break;
+ }
+ }
+ }
+ }
+}
+
+// This private slot handles the delayed submenu effects
+
+void PopupMenu::subMenuTimer() {
+
+ if ( !isVisible() || (actItem < 0 && popupActive < 0) || actItem == popupActive )
+ return;
+
+ if ( popupActive >= 0 ) {
+ hidePopups();
+ popupActive = -1;
+ }
+
+ // hidePopups() may change actItem etc.
+ if ( !isVisible() || actItem < 0 || actItem == popupActive )
+ return;
+
+ QMenuItem *mi = mitems->at(actItem);
+ if ( !mi || !mi->isEnabledAndVisible() )
+ return;
+
+ PopupMenu *popup = mi->popup();
+ if ( !popup || !popup->isEnabled() )
+ return;
+
+ //avoid circularity
+ if ( popup->isVisible() )
+ return;
+
+ Q_ASSERT( popup->parentMenu == 0 );
+ popup->parentMenu = this; // set parent menu
+
+ emit popup->aboutToShow();
+ supressAboutToShow = TRUE;
+
+
+ QRect r( itemGeometry( actItem ) );
+ QPoint p;
+ QSize ps = popup->sizeHint();
+ if( QApplication::reverseLayout() ) {
+ p = QPoint( r.left() + motifArrowHMargin - ps.width(), r.top() + motifArrowVMargin );
+ p = mapToGlobal( p );
+
+ bool right = FALSE;
+ if ( ( parentMenu && parentMenu->isPopupMenu &&
+ ((PopupMenu*)parentMenu)->geometry().x() < geometry().x() ) ||
+ p.x() < 0 )
+ right = TRUE;
+ if ( right && (ps.width() > QApplication::desktop()->width() - mapToGlobal( r.topRight() ).x() ) )
+ right = FALSE;
+ if ( right )
+ p.setX( mapToGlobal( r.topRight() ).x() );
+ } else {
+ p = QPoint( r.right() - motifArrowHMargin, r.top() + motifArrowVMargin );
+ p = mapToGlobal( p );
+
+ bool left = FALSE;
+ if ( ( parentMenu && parentMenu->isPopupMenu &&
+ ((PopupMenu*)parentMenu)->geometry().x() > geometry().x() ) ||
+ p.x() + ps.width() > QApplication::desktop()->width() )
+ left = TRUE;
+ if ( left && (ps.width() > mapToGlobal( r.topLeft() ).x() ) )
+ left = FALSE;
+ if ( left )
+ p.setX( mapToGlobal( r.topLeft() ).x() - ps.width() );
+ }
+ QRect pr = popup->itemGeometry(popup->count() - 1);
+ if (p.y() + ps.height() > QApplication::desktop()->height() &&
+ p.y() - ps.height() + (QCOORD) pr.height() >= 0)
+ p.setY( p.y() - ps.height() + (QCOORD) pr.height());
+
+ if ( style().styleHint(QStyle::SH_PopupMenu_SloppySubMenus, this )) {
+ QPoint cur = QCursor::pos();
+ if ( r.contains( mapFromGlobal( cur ) ) ) {
+ QPoint pts[4];
+ pts[0] = QPoint( cur.x(), cur.y() - 2 );
+ pts[3] = QPoint( cur.x(), cur.y() + 2 );
+ if ( p.x() >= cur.x() ) {
+ pts[1] = QPoint( geometry().right(), p.y() );
+ pts[2] = QPoint( geometry().right(), p.y() + ps.height() );
+ } else {
+ pts[1] = QPoint( p.x() + ps.width(), p.y() );
+ pts[2] = QPoint( p.x() + ps.width(), p.y() + ps.height() );
+ }
+ QPointArray points( 4 );
+ for( int i = 0; i < 4; i++ )
+ points.setPoint( i, mapFromGlobal( pts[i] ) );
+ d->mouseMoveBuffer = QRegion( points );
+ repaint();
+ }
+ }
+
+ popupActive = actItem;
+ popup->popup( p );
+}
+
+void PopupMenu::allowAnimation()
+{
+ preventAnimation = FALSE;
+}
+
+void PopupMenu::updateRow( int row )
+{
+ if ( !isVisible() )
+ return;
+
+ if ( badSize ) {
+ updateSize();
+ update();
+ return;
+ }
+ updateSize();
+ QRect r = itemGeometry( row );
+ if ( !r.isNull() ) // can happen via the scroller
+ repaint( r );
+}
+
+int PopupMenu::exec( const QPoint & pos, int indexAtPoint )
+{
+ snapToMouse = TRUE;
+ if ( !qApp )
+ return -1;
+
+ PopupMenu* priorSyncMenu = syncMenu;
+
+ syncMenu = this;
+ syncMenuId = -1;
+
+ QGuardedPtr<PopupMenu> that = this;
+ connectModal( that, TRUE );
+ popup( pos, indexAtPoint );
+ qApp->enter_loop();
+ connectModal( that, FALSE );
+
+ syncMenu = priorSyncMenu;
+ return syncMenuId;
+}
+
+
+
+// Connect the popup and all its submenus to modalActivation() if
+// \a doConnect is true, otherwise disconnect.
+void PopupMenu::connectModal( PopupMenu* receiver, bool doConnect )
+{
+ if ( !receiver )
+ return;
+
+ connectModalRecursionSafety = doConnect;
+
+ if ( doConnect )
+ connect( this, SIGNAL(activated(int)),
+ receiver, SLOT(modalActivation(int)) );
+ else
+ disconnect( this, SIGNAL(activated(int)),
+ receiver, SLOT(modalActivation(int)) );
+
+ QMenuItemListIt it(*mitems);
+ register QMenuItem *mi;
+ while ( (mi=it.current()) ) {
+ ++it;
+ if ( mi->popup() && mi->popup() != receiver
+ && (bool)(mi->popup()->connectModalRecursionSafety) != doConnect )
+ mi->popup()->connectModal( receiver, doConnect ); //avoid circular
+ }
+}
+
+int PopupMenu::exec()
+{
+ return exec(mapToGlobal(QPoint(0,0)));
+}
+
+
+// Internal slot used for exec().
+
+void PopupMenu::modalActivation( int id )
+{
+ syncMenuId = id;
+}
+
+void PopupMenu::setActiveItem( int i )
+{
+ int lastActItem = actItem;
+ actItem = i;
+ if ( lastActItem >= 0 )
+ updateRow( lastActItem );
+ if ( i >= 0 && i != lastActItem )
+ updateRow( i );
+ QMenuItem *mi = mitems->at( actItem );
+ if ( !mi )
+ return;
+
+ if ( mi->widget() && mi->widget()->isFocusEnabled() ) {
+ mi->widget()->setFocus();
+ } else {
+ setFocus();
+ QRect mfrect = itemGeometry( actItem );
+ setMicroFocusHint( mfrect.x(), mfrect.y(), mfrect.width(), mfrect.height(), FALSE );
+ }
+ if ( mi->id() != -1 )
+ hilitSig( mi->id() );
+#ifndef QT_NO_WHATSTHIS
+ if (whatsThisItem && whatsThisItem != mi) {
+ qWhatsThisBDH();
+ }
+ whatsThisItem = mi;
+#endif
+}
+
+QSize PopupMenu::sizeHint() const
+{
+ constPolish();
+ PopupMenu* that = (PopupMenu*) this;
+ //We do not need a resize here, just the sizeHint..
+ return that->updateSize(FALSE, FALSE).expandedTo( QApplication::globalStrut() );
+}
+
+int PopupMenu::idAt( const QPoint& pos ) const
+{
+ return idAt( itemAtPos( pos ) );
+}
+
+bool PopupMenu::customWhatsThis() const
+{
+ return TRUE;
+}
+
+bool PopupMenu::focusNextPrevChild( bool next )
+{
+ register QMenuItem *mi;
+ int dy = next? 1 : -1;
+ if ( dy && actItem < 0 ) {
+ setFirstItemActive();
+ } else if ( dy ) { // highlight next/prev
+ register int i = actItem;
+ int c = mitems->count();
+ int n = c;
+ while ( n-- ) {
+ i = i + dy;
+ if ( i == c )
+ i = 0;
+ else if ( i < 0 )
+ i = c - 1;
+ mi = mitems->at( i );
+ if ( mi && !mi->isSeparator() &&
+ ( ( style().styleHint(QStyle::SH_PopupMenu_AllowActiveAndDisabled, this)
+ && mi->isVisible() )
+ || mi->isEnabledAndVisible() ) )
+ break;
+ }
+ if ( i != actItem )
+ setActiveItem( i );
+ }
+ return TRUE;
+}
+
+void PopupMenu::focusInEvent( QFocusEvent * )
+{
+}
+
+void PopupMenu::focusOutEvent( QFocusEvent * )
+{
+}
+
+class QTearOffMenuItem : public QCustomMenuItem
+{
+public:
+ QTearOffMenuItem()
+ {
+ }
+ ~QTearOffMenuItem()
+ {
+ }
+ void paint( QPainter* p, const QColorGroup& cg, bool,
+ bool, int x, int y, int w, int h )
+ {
+ p->setPen( QPen( cg.dark(), 1, DashLine ) );
+ p->drawLine( x+2, y+h/2-1, x+w-4, y+h/2-1 );
+ p->setPen( QPen( cg.light(), 1, DashLine ) );
+ p->drawLine( x+2, y+h/2, x+w-4, y+h/2 );
+ }
+ bool fullSpan() const
+ {
+ return TRUE;
+ }
+
+ QSize sizeHint()
+ {
+ return QSize( 20, 6 );
+ }
+};
+
+int PopupMenu::insertTearOffHandle( int id, int index )
+{
+ int myid = insertItem( new QTearOffMenuItem, id, index );
+ connectItem( myid, this, SLOT( toggleTearOff() ) );
+ QMenuData::d->aInt = myid;
+ return myid;
+}
+
+void PopupMenu::toggleTearOff()
+{
+ if ( active_popup_menu && active_popup_menu->tornOff ) {
+ active_popup_menu->close();
+ } else if (QMenuData::d->aWidget ) {
+ delete (QWidget*) QMenuData::d->aWidget; // delete the old one
+ } else {
+ // create a tear off menu
+ PopupMenu* p = new PopupMenu( parentWidget(), "tear off menu" );
+ connect( p, SIGNAL( activated(int) ), this, SIGNAL( activated(int) ) );
+ connect( p, SIGNAL( highlighted(int) ), this, SIGNAL( highlighted(int) ) );
+#ifndef QT_NO_WIDGET_TOPEXTRA
+ p->setCaption( caption() );
+#endif
+ p->setCheckable( isCheckable() );
+ p->reparent( parentWidget(), WType_TopLevel | WStyle_Tool |
+ WNoAutoErase | WDestructiveClose,
+ geometry().topLeft(), FALSE );
+ p->mitems->setAutoDelete( FALSE );
+ p->tornOff = TRUE;
+ for ( QMenuItemListIt it( *mitems ); it.current(); ++it ) {
+ if ( it.current()->id() != QMenuData::d->aInt && !it.current()->widget() )
+ p->mitems->append( it.current() );
+ }
+ p->show();
+ QMenuData::d->aWidget = p;
+ }
+}
+
+void PopupMenu::activateItemAt( int index )
+{
+ if ( index >= 0 && index < (int) mitems->count() ) {
+ QMenuItem *mi = mitems->at( index );
+ if ( index != actItem ) // new item activated
+ setActiveItem( index );
+ PopupMenu *popup = mi->popup();
+ if ( popup ) {
+ if ( popup->isVisible() ) { // sub menu already open
+ int pactItem = popup->actItem;
+ popup->actItem = -1;
+ popup->hidePopups();
+ popup->updateRow( pactItem );
+ } else { // open sub menu
+ hidePopups();
+ actItem = index;
+ subMenuTimer();
+ popup->setFirstItemActive();
+ }
+ } else {
+ byeMenuBar(); // deactivate menu bar
+
+#ifndef QT_NO_WHATSTHIS
+ bool b = QWhatsThis::inWhatsThisMode();
+#else
+ const bool b = FALSE;
+#endif
+ if ( !mi->isEnabledAndVisible() ) {
+#ifndef QT_NO_WHATSTHIS
+ if ( b ) {
+ actItem = -1;
+ updateItem( mi->id() );
+ byeMenuBar();
+ actSig( mi->id(), b);
+ }
+#endif
+ } else {
+ byeMenuBar(); // deactivate menu bar
+ if ( mi->isEnabledAndVisible() ) {
+ actItem = -1;
+ updateItem( mi->id() );
+ active_popup_menu = this;
+ QGuardedPtr<QSignal> signal = mi->signal();
+ actSig( mi->id(), b );
+ if ( signal && !b )
+ signal->activate();
+ active_popup_menu = 0;
+ }
+ }
+ }
+ } else {
+ if ( tornOff ) {
+ close();
+ } else {
+ QMenuData* p = parentMenu;
+ hide();
+#ifndef QT_NO_MENUBAR
+ if ( p && p->isMenuBar )
+ ((QMenuBar*) p)->goodbye( TRUE );
+#endif
+ }
+ }
+
+}
+
+void
+PopupMenu::updateScrollerState()
+{
+ uint old_scrollable = d->scroll.scrollable;
+ d->scroll.scrollable = QPopupMenuPrivate::Scroll::ScrollNone;
+ if(!style().styleHint(QStyle::SH_PopupMenu_Scrollable, this))
+ return;
+
+ QMenuItem *mi;
+ QMenuItemListIt it( *mitems );
+ if(d->scroll.topScrollableIndex) {
+ for(int row = 0; (mi = it.current()) && row < d->scroll.topScrollableIndex; row++)
+ ++it;
+ if(!mi)
+ it.toFirst();
+ }
+ int y = 0, sh = style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this);
+ if(!it.atFirst()) {
+ // can't use |= because of a bug/feature in IBM xlC 5.0.2
+ d->scroll.scrollable = d->scroll.scrollable | QPopupMenuPrivate::Scroll::ScrollUp;
+ y += sh;
+ }
+ while ( (mi=it.current()) ) {
+ ++it;
+ int myheight = contentsRect().height();
+ QSize sz = style().sizeFromContents(QStyle::CT_PopupMenuItem, this,
+ QSize(0, itemHeight( mi )),
+ QStyleOption(mi,maxPMWidth));
+ if(y + sz.height() >= myheight) {
+ d->scroll.scrollable = d->scroll.scrollable | QPopupMenuPrivate::Scroll::ScrollDown;
+ break;
+ }
+ y += sz.height();
+ }
+ if((d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollUp) &&
+ !(old_scrollable & QPopupMenuPrivate::Scroll::ScrollUp))
+ d->scroll.topScrollableIndex++;
+}
+
+#endif // QT_NO_POPUPMENU
+
+*/
diff --git a/muse2/muse/widgets/popupmenu.h b/muse2/muse/widgets/popupmenu.h
new file mode 100644
index 00000000..138e45e1
--- /dev/null
+++ b/muse2/muse/widgets/popupmenu.h
@@ -0,0 +1,303 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: popupmenu.h,v 1.1.1.1 2010/07/18 03:18:00 terminator356 Exp $
+//
+// (C) Copyright 1999-2010 Werner Schweer (ws@seh.de)
+//
+// PopupMenu sub-class of QPopupMenu created by Tim.
+//=========================================================
+
+
+
+//=========================================================
+//
+// NOTICE: This sub-class of QPopupMenu *automatically* deletes
+// and *clears* any sub popup menus, when clear() is called.
+// Therefore a parent widget is *not* necessary when
+// creating sub popup menus to add to the popup.
+//
+//=========================================================
+
+
+
+#ifndef __POPUPMENU_H__
+#define __POPUPMENU_H__
+
+#include <q3popupmenu.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+//#include <qmenudata.h>
+
+class QWidget;
+class QMouseEvent;
+
+//class MenuData : public QMenuData
+//{
+ //friend class QMenuBar;
+// friend class QPopupMenu;
+// friend class PopupMenu;
+
+// Q_OBJECT
+ //private:
+//};
+
+/*
+// Internal class to get access to protected QMenuData members.
+class MenuData : public QMenuData
+{
+ friend class QPopupMenu;
+ friend class QMenuData;
+ friend class PopupMenu;
+
+private:
+
+public:
+ MenuData() : QMenuData() { }
+ virtual ~MenuData() { }
+};
+*/
+
+//class Q_EXPORT PopupMenu : public QPopupMenu
+class PopupMenu : public Q3PopupMenu
+//class PopupMenu : public QPopupMenu, public MenuData
+{
+ friend class QMenuData;
+ //friend class QMenuBar;
+ friend class Q3PopupMenu;
+ friend class QMenuBar;
+ //friend class MenuData;
+
+ Q_OBJECT
+ private:
+ // QPopupMenu::d is private, so this is our own private.
+ //QPopupMenuPrivate *d;
+
+ //virtual void setFirstItemActive();
+ //void hideAllPopups();
+ //void hidePopups();
+ bool tryMenuBar(QMouseEvent *);
+ //bool tryMouseEvent(QPopupMenu *, QMouseEvent *);
+ bool tryMouseEvent(PopupMenu *, QMouseEvent *);
+ //void byeMenuBar();
+ void actSig(int, bool = FALSE);
+ virtual void menuDelPopup(Q3PopupMenu *);
+
+ protected:
+ //int actItem;
+
+ //void mousePressEvent(QMouseEvent *);
+ void mouseReleaseEvent(QMouseEvent *);
+
+ public:
+ PopupMenu(QWidget* parent=0, const char* name=0);
+ ~PopupMenu();
+};
+
+#endif
+
+
+
+
+/****************************************************************************
+**
+** Definition of QPopupMenu class
+**
+** Created : 941128
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of the widgets module of the Qt GUI Toolkit.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free Qt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** This file may be used under the terms of the Q Public License as
+** defined by Trolltech ASA and appearing in the file LICENSE.QPL
+** included in the packaging of this file. Licensees holding valid Qt
+** Commercial licenses may use this file in accordance with the Qt
+** Commercial License Agreement provided with the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+/*
+#ifndef __POPUPMENU_H__
+#define __POPUPMENU_H__
+
+#ifndef QT_H
+#include <qframe.h>
+#include <qmenudata.h>
+#endif // QT_H
+
+#ifndef QT_NO_POPUPMENU
+class QPopupMenuPrivate;
+
+class Q_EXPORT PopupMenu : public QFrame, public QMenuData
+{
+ Q_OBJECT
+ Q_PROPERTY( bool checkable READ isCheckable WRITE setCheckable )
+public:
+ PopupMenu( QWidget* parent=0, const char* name=0 );
+ ~PopupMenu();
+
+ void popup( const QPoint & pos, int indexAtPoint = -1 ); // open
+ void updateItem( int id );
+
+ virtual void setCheckable( bool );
+ bool isCheckable() const;
+
+ void setFont( const QFont & );
+ void show();
+ void hide();
+
+ int exec();
+ int exec( const QPoint & pos, int indexAtPoint = 0 ); // modal
+
+ virtual void setActiveItem( int );
+ QSize sizeHint() const;
+
+ int idAt( int index ) const { return QMenuData::idAt( index ); }
+ int idAt( const QPoint& pos ) const;
+
+ bool customWhatsThis() const;
+
+ int insertTearOffHandle( int id=-1, int index=-1 );
+
+ void activateItemAt( int index );
+ QRect itemGeometry( int index );
+
+
+signals:
+ void activated( int itemId );
+ void highlighted( int itemId );
+ void activatedRedirect( int itemId ); // to parent menu
+ void highlightedRedirect( int itemId );
+ void aboutToShow();
+ void aboutToHide();
+
+protected:
+ int itemHeight( int ) const;
+ int itemHeight( QMenuItem* mi ) const;
+ void drawItem( QPainter* p, int tab, QMenuItem* mi,
+ bool act, int x, int y, int w, int h);
+
+ void drawContents( QPainter * );
+
+ void closeEvent( QCloseEvent *e );
+ void paintEvent( QPaintEvent * );
+ void mousePressEvent( QMouseEvent * );
+ void mouseReleaseEvent( QMouseEvent * );
+ void mouseMoveEvent( QMouseEvent * );
+ void keyPressEvent( QKeyEvent * );
+ void focusInEvent( QFocusEvent * );
+ void focusOutEvent( QFocusEvent * );
+ void timerEvent( QTimerEvent * );
+ void leaveEvent( QEvent * );
+ void styleChange( QStyle& );
+ void enabledChange( bool );
+ int columns() const;
+
+ bool focusNextPrevChild( bool next );
+
+ int itemAtPos( const QPoint &, bool ignoreSeparator = TRUE ) const;
+
+private slots:
+ void subActivated( int itemId );
+ void subHighlighted( int itemId );
+#ifndef QT_NO_ACCEL
+ void accelActivated( int itemId );
+ void accelDestroyed();
+#endif
+ void popupDestroyed( QObject* );
+ void modalActivation( int );
+
+ void subMenuTimer();
+ void subScrollTimer();
+ void allowAnimation();
+ void toggleTearOff();
+
+ void performDelayedChanges();
+
+private:
+ void updateScrollerState();
+ void menuContentsChanged();
+ void menuStateChanged();
+ void performDelayedContentsChanged();
+ void performDelayedStateChanged();
+ void menuInsPopup( PopupMenu * );
+ void menuDelPopup( PopupMenu * );
+ void frameChanged();
+
+ void actSig( int, bool = FALSE );
+ void hilitSig( int );
+ virtual void setFirstItemActive();
+ void hideAllPopups();
+ void hidePopups();
+ bool tryMenuBar( QMouseEvent * );
+ void byeMenuBar();
+
+ QSize updateSize(bool force_recalc=FALSE, bool do_resize=TRUE);
+ void updateRow( int row );
+#ifndef QT_NO_ACCEL
+ void updateAccel( QWidget * );
+ void enableAccel( bool );
+#endif
+ QPopupMenuPrivate *d;
+#ifndef QT_NO_ACCEL
+ QAccel *autoaccel;
+#endif
+
+#if defined(Q_WS_MAC) && !defined(QMAC_QMENUBAR_NO_NATIVE)
+ bool macPopupMenu(const QPoint &, int);
+ uint mac_dirty_popup : 1;
+#endif
+
+ int popupActive;
+ int tab;
+ uint accelDisabled : 1;
+ uint checkable : 1;
+ uint connectModalRecursionSafety : 1;
+ uint tornOff : 1;
+ uint pendingDelayedContentsChanges : 1;
+ uint pendingDelayedStateChanges : 1;
+ int maxPMWidth;
+ int ncols;
+ bool snapToMouse;
+ bool tryMouseEvent( PopupMenu *, QMouseEvent * );
+
+ friend class QMenuData;
+ friend class QMenuBar;
+
+ void connectModal(PopupMenu* receiver, bool doConnect);
+
+private: // Disabled copy constructor and operator=
+#if defined(Q_DISABLE_COPY)
+ PopupMenu( const PopupMenu & );
+ PopupMenu &operator=( const PopupMenu & );
+#endif
+};
+
+
+#endif // QT_NO_POPUPMENU
+
+#endif // QPOPUPMENU_H
+*/ \ No newline at end of file
diff --git a/muse2/muse/widgets/posedit.cpp b/muse2/muse/widgets/posedit.cpp
new file mode 100644
index 00000000..9fad1a6f
--- /dev/null
+++ b/muse2/muse/widgets/posedit.cpp
@@ -0,0 +1,875 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: posedit.cpp,v 1.3.2.2 2008/05/21 00:28:54 terminator356 Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <q3rangecontrol.h>
+#include <qapplication.h>
+#include <qpixmap.h>
+#include <qapplication.h>
+#include <q3valuelist.h>
+#include <qstring.h>
+#include <qstyle.h>
+//Added by qt3to4:
+#include <QTimerEvent>
+#include <QKeyEvent>
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <QEvent>
+#include <QPaintEvent>
+#include <values.h>
+#include <qpainter.h>
+#include <qtimer.h>
+
+#include "posedit.h"
+#include "sig.h"
+
+extern int mtcType;
+
+//---------------------------------------------------------
+// QNumberSection
+//---------------------------------------------------------
+
+class QNumberSection
+ {
+ int selstart;
+ int selend;
+
+ public:
+ QNumberSection(int selStart = 0, int selEnd = 0)
+ : selstart(selStart), selend(selEnd ) {}
+ int selectionStart() const { return selstart; }
+ void setSelectionStart(int s) { selstart = s; }
+ int selectionEnd() const { return selend; }
+ void setSelectionEnd( int s ) { selend = s; }
+ int width() const { return selend - selstart; }
+ };
+
+//---------------------------------------------------------
+// PosEditor
+//---------------------------------------------------------
+
+class PosEditor : public QWidget
+ {
+ PosEdit* cw;
+ bool frm;
+ QPixmap *pm;
+ int focusSec;
+ Q3ValueList<QNumberSection> sections;
+ QString sep;
+ int offset;
+
+ int section(const QPoint&);
+
+ protected:
+ void init();
+ bool event(QEvent *e);
+ void resizeEvent(QResizeEvent*);
+ void paintEvent(QPaintEvent*);
+ void mousePressEvent(QMouseEvent *e);
+
+ void applyFocusSelection() {}
+
+ public:
+ PosEditor(PosEdit* Q_PARENT, const char * Q_NAME );
+ ~PosEditor();
+
+ void setControlWidget(PosEdit * widget);
+ PosEdit* controlWidget() const;
+
+ void setSeparator(const QString& s) { sep = s; }
+ QString separator() const { return sep; }
+ int focusSection() const { return focusSec; }
+
+ bool setFocusSection(int s);
+ void appendSection(const QNumberSection& sec);
+ void clearSections();
+ void setSectionSelection(int sec, int selstart, int selend);
+ bool eventFilter(QObject *o, QEvent *e);
+ };
+
+//---------------------------------------------------------
+// section
+//---------------------------------------------------------
+
+int PosEditor::section(const QPoint& pt)
+ {
+ if (pm->isNull())
+ return -1;
+ QPainter p(pm);
+ int fw = frm ? style()->pixelMetric(QStyle::PM_DefaultFrameWidth) : 0;
+ int x = 2 + fw;
+ int y = 0;
+ int w = width();
+ int h = height();
+ for (unsigned int i = 0; i < sections.count(); ++i) {
+ QString s = cw->sectionFormattedText(i);
+ QRect bb = p.boundingRect(x, y, w, h, Qt::AlignVCenter|Qt::AlignLeft, s);
+ int nx = bb.x() + bb.width();
+ if (pt.x() >= x && pt.x() < nx)
+ return i;
+ x = nx;
+ if (i < sections.count()-1) {
+ QString s = sep;
+ p.drawText(x, y, w, h, Qt::AlignVCenter|Qt::AlignLeft, s, -1, &bb);
+ x = bb.x() + bb.width();
+ }
+ }
+ return -1;
+ }
+
+//---------------------------------------------------------
+// PosEditor
+//---------------------------------------------------------
+
+PosEditor::PosEditor(PosEdit* parent, const char* name)
+ : QWidget(parent, name), sep(".")
+ {
+ cw = parent;
+ frm = true;
+ focusSec = 0;
+ pm = new QPixmap;
+ offset = 0;
+ init();
+ }
+
+//---------------------------------------------------------
+// ~PosEditor
+//---------------------------------------------------------
+
+PosEditor::~PosEditor()
+ {
+ delete pm;
+ }
+
+//---------------------------------------------------------
+// init
+//---------------------------------------------------------
+
+void PosEditor::init()
+ {
+ setBackgroundMode(Qt::PaletteBase);
+ setFocusSection(-1);
+ setKeyCompression(true);
+ installEventFilter(this);
+ setFocusPolicy(Qt::WheelFocus);
+ }
+
+//---------------------------------------------------------
+// event
+//---------------------------------------------------------
+
+bool PosEditor::event(QEvent *e)
+ {
+ if (e->type() == QEvent::FocusIn || e->type() == QEvent::FocusOut) {
+ repaint( rect(), false);
+ }
+ else if (e->type() == QEvent::ShortcutOverride) {
+ QKeyEvent* ke = (QKeyEvent*) e;
+ switch (ke->key()) {
+ case Qt::Key_Delete:
+ case Qt::Key_Backspace:
+ case Qt::Key_Up:
+ case Qt::Key_Down:
+ case Qt::Key_Left:
+ case Qt::Key_Right:
+ ke->accept();
+ default:
+ break;
+ }
+ }
+ return QWidget::event(e);
+ }
+
+void PosEditor::resizeEvent(QResizeEvent *e)
+ {
+ pm->resize(e->size());
+ QWidget::resizeEvent(e);
+ }
+
+//---------------------------------------------------------
+// paintEvent
+//---------------------------------------------------------
+
+void PosEditor::paintEvent(QPaintEvent *)
+ {
+ if (pm->isNull())
+ return;
+
+ const QColorGroup & cg = colorGroup();
+ QPainter p(pm);
+ p.setPen(colorGroup().text());
+ QBrush bg = cg.brush(QColorGroup::Base);
+
+ int fw = frm ? style()->pixelMetric(QStyle::PM_DefaultFrameWidth) : 0;
+ int x = 2 + fw;
+ int y = 0;
+ int w = width();
+ int h = height();
+ p.fillRect(0, 0, w, h, bg);
+
+ for (unsigned int i = 0; i < sections.count(); ++i) {
+ QRect bb;
+ QString s = cw->sectionFormattedText(i);
+
+ if (hasFocus() && (int(i) == focusSec)) {
+ QBrush bg = cg.brush(QColorGroup::Highlight);
+ QRect r = p.boundingRect(x, y, w, h, Qt::AlignVCenter|Qt::AlignLeft, s, -1);
+ p.setPen(colorGroup().highlightedText());
+ p.fillRect(r, bg);
+ }
+ else
+ p.setPen(colorGroup().text());
+ p.drawText(x, y, w, h, Qt::AlignVCenter|Qt::AlignLeft, s, -1, &bb);
+ x = bb.x() + bb.width();
+ if (i < sections.count()-1) {
+ QString s = sep;
+ p.drawText(x, y, w, h, Qt::AlignVCenter|Qt::AlignLeft, s, -1, &bb);
+ x = bb.x() + bb.width();
+ }
+ }
+ p.end();
+ bitBlt(this, 0, 0, pm);
+ }
+
+//---------------------------------------------------------
+// mousePressEvent
+//---------------------------------------------------------
+
+void PosEditor::mousePressEvent(QMouseEvent *e)
+ {
+ QPoint p(e->pos().x(), 0);
+ int sec = section(p);
+ if (sec != -1) {
+ cw->setFocusSection(sec);
+ repaint(rect(), false);
+ }
+ }
+
+//---------------------------------------------------------
+// eventFilter
+//---------------------------------------------------------
+
+bool PosEditor::eventFilter(QObject *o, QEvent *e)
+ {
+ if (o != this)
+ return false;
+ if (e->type() != QEvent::KeyPress )
+ return false;
+
+ QKeyEvent *ke = (QKeyEvent*)e;
+ switch (ke->key()) {
+ case Qt::Key_Right:
+ if (unsigned(focusSec) <= sections.count()) {
+ if (cw->setFocusSection(focusSec+1))
+ repaint(rect(), false);
+ }
+ return true;
+ case Qt::Key_Left:
+ if (focusSec > 0 ) {
+ if (cw->setFocusSection(focusSec-1))
+ repaint(rect(), false);
+ }
+ return true;
+ case Qt::Key_Up:
+ cw->stepUp();
+ return true;
+ case Qt::Key_Down:
+ cw->stepDown();
+ return true;
+ case Qt::Key_Backspace:
+ case Qt::Key_Delete:
+ cw->removeLastNumber(focusSec);
+ return true;
+ case Qt::Key_Return:
+ cw->enterPressed();
+ return true;
+ default:
+ QString txt = ke->text();
+ if (!txt.isEmpty() && !sep.isEmpty() && txt[0] == sep[0]) {
+ // do the same thing as KEY_RIGHT when the user presses the separator key
+ if (unsigned(focusSec) < sections.count()) {
+ if (cw->setFocusSection(focusSec+1))
+ repaint(rect(), false);
+ }
+ return true;
+ }
+ int num = txt[0].digitValue();
+ if (num != -1) {
+ cw->addNumber(focusSec, num);
+ return true;
+ }
+ }
+ return false;
+ }
+
+void PosEditor::appendSection(const QNumberSection& sec)
+ {
+ sections.append(sec);
+ }
+void PosEditor::clearSections()
+ {
+ sections.clear();
+ }
+
+//---------------------------------------------------------
+// setSectionSelection
+//---------------------------------------------------------
+
+void PosEditor::setSectionSelection(int secNo, int selstart, int selend)
+ {
+ if (secNo < 0 || secNo > (int)sections.count())
+ return;
+ sections[secNo].setSelectionStart(selstart);
+ sections[secNo].setSelectionEnd(selend);
+ }
+
+//---------------------------------------------------------
+// setFocusSection
+//---------------------------------------------------------
+
+bool PosEditor::setFocusSection(int idx)
+ {
+ if (idx > (int)sections.count()-1 || idx < 0)
+ return false;
+ if (idx != focusSec) {
+ focusSec = idx;
+ applyFocusSelection();
+ return true;
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// PosEdit
+//---------------------------------------------------------
+
+PosEdit::PosEdit(QWidget* parent, const char* name)
+ : QWidget(parent, name)
+ {
+ init();
+ updateButtons();
+ }
+
+PosEdit::PosEdit(const Pos& time, QWidget* parent, const char* name)
+ : QWidget(parent, name)
+ {
+ init();
+ setValue(time);
+ updateButtons();
+ }
+
+PosEdit::~PosEdit()
+ {
+ }
+
+//---------------------------------------------------------
+// init
+//---------------------------------------------------------
+
+void PosEdit::init()
+ {
+ ed = new PosEditor(this, "pos editor");
+ controls = new Q3SpinWidget(this, "pos edit controls");
+ controls->setEditWidget(ed);
+ setFocusProxy(ed);
+ connect(controls, SIGNAL(stepUpPressed()), SLOT(stepUp()));
+ connect(controls, SIGNAL(stepDownPressed()), SLOT(stepDown()));
+ connect(this, SIGNAL(valueChanged(const Pos&)),SLOT(updateButtons()));
+
+ overwrite = false;
+ timerId = 0;
+ typing = false;
+ min = Pos(0);
+ max = Pos(MAX_TICK);
+ changed = false;
+ adv = false;
+
+
+ static Section s_midiSections[3] = { // measure, beat, tick
+ { 0, 4, 1, 0 },
+ { 5, 2, 1, 0 },
+ { 8, 3, 0, 0 }
+ };
+ static Section s_smpteSections[4] = { // minute second frame subframe
+ { 0, 3, 0, 0 },
+ { 4, 2, 0, 0 },
+ { 7, 2, 0, 0 },
+ { 10, 2, 0, 0 }
+ };
+ memcpy(midiSections, s_midiSections, sizeof(s_midiSections));
+ memcpy(smpteSections, s_smpteSections, sizeof(s_smpteSections));
+
+ _smpte = false; // show position in smpte format
+ sec = midiSections;
+ setSections();
+ setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
+ }
+
+//---------------------------------------------------------
+// setSetions
+//---------------------------------------------------------
+
+void PosEdit::setSections()
+ {
+ ed->clearSections();
+ ed->appendSection(QNumberSection(0,0));
+ ed->appendSection(QNumberSection(0,0));
+ ed->appendSection(QNumberSection(0,0));
+ if (_smpte) {
+ ed->appendSection(QNumberSection(0,0));
+ ed->setSeparator(QString(":"));
+ }
+ else {
+ ed->setSeparator(QString("."));
+ }
+ }
+
+//---------------------------------------------------------
+// smpte
+//---------------------------------------------------------
+
+bool PosEdit::smpte() const
+ {
+ return _smpte;
+ }
+
+//---------------------------------------------------------
+// setSmpte
+//---------------------------------------------------------
+
+void PosEdit::setSmpte(bool f)
+ {
+ _smpte = f;
+ sec = f ? smpteSections : midiSections;
+ setSections();
+ ed->repaint(ed->rect(), false);
+ }
+
+//---------------------------------------------------------
+// minValue
+//---------------------------------------------------------
+
+Pos PosEdit::minValue() const
+ {
+ return min;
+ }
+
+//---------------------------------------------------------
+// maxValue
+//---------------------------------------------------------
+
+Pos PosEdit::maxValue() const
+ {
+ return max;
+ }
+
+//---------------------------------------------------------
+// setRange
+//---------------------------------------------------------
+
+void PosEdit::setRange(const Pos& _min, const Pos& _max)
+ {
+ if (min.isValid())
+ min = _min;
+ if (max.isValid())
+ max = _max;
+ }
+
+//---------------------------------------------------------
+// setValue
+//---------------------------------------------------------
+
+void PosEdit::setValue(const Pos& time)
+ {
+ if (time > maxValue() || time < minValue())
+ return;
+ if (_smpte)
+ time.msf(&(sec[0].val), &(sec[1].val), &(sec[2].val),
+ &(sec[3].val));
+ else
+ time.mbt(&(sec[0].val), &(sec[1].val), &(sec[2].val));
+ changed = false;
+
+ updateButtons();
+ ed->repaint(ed->rect(), false);
+ }
+
+void PosEdit::setValue(const QString& s)
+ {
+ Pos time(s);
+ setValue(time);
+ }
+
+void PosEdit::setValue(int t)
+ {
+ Pos time(t);
+ setValue(time);
+ }
+
+Pos PosEdit::pos() const
+ {
+ if (_smpte) {
+ if (Pos::isValid(sec[0].val, sec[1].val, sec[2].val, sec[3].val))
+ return Pos(sec[0].val, sec[1].val, sec[2].val, sec[3].val);
+ }
+ else {
+ if (Pos::isValid(sec[0].val, sec[1].val, sec[2].val))
+ return Pos(sec[0].val, sec[1].val, sec[2].val);
+ }
+ return Pos();
+ }
+
+void PosEdit::setSeparator(const QString& s)
+ {
+ ed->setSeparator(s);
+ }
+
+QString PosEdit::separator() const
+ {
+ return ed->separator();
+ }
+
+bool PosEdit::event(QEvent *e)
+ {
+ if (e->type() == QEvent::FocusOut) {
+ typing = false;
+ if (changed) {
+ emit valueChanged(pos() );
+ changed = false;
+ }
+ }
+ return QWidget::event(e);
+ }
+
+void PosEdit::timerEvent(QTimerEvent *)
+ {
+ overwrite = true;
+ }
+
+//---------------------------------------------------------
+// stepUp
+//---------------------------------------------------------
+
+void PosEdit::stepUp()
+ {
+ int secNo = ed->focusSection();
+ bool accepted = false;
+
+ if (!outOfRange(secNo, sec[secNo].val+1)) {
+ accepted = true;
+ setSec(secNo, sec[secNo].val+1);
+ }
+ if (accepted) {
+ changed = true;
+ Pos p = pos();
+ emit valueChanged(p);
+ }
+ ed->repaint(ed->rect(), false);
+ }
+
+//---------------------------------------------------------
+// stepDown
+//---------------------------------------------------------
+
+void PosEdit::stepDown()
+ {
+ int secNo = ed->focusSection();
+ bool accepted = false;
+ if (!outOfRange(secNo, sec[secNo].val-1)) {
+ accepted = true;
+ setSec(secNo, sec[secNo].val-1);
+ }
+ if (accepted) {
+ changed = true;
+ emit valueChanged(pos());
+ }
+ ed->repaint(ed->rect(), false);
+ }
+
+//---------------------------------------------------------
+// sectionFormattedText
+// Returns the formatted number for section sec.
+//---------------------------------------------------------
+
+QString PosEdit::sectionFormattedText(int secNo)
+ {
+ QString txt = sectionText(secNo);
+ int so = sec[secNo].offset;
+ int len = sec[secNo].len;
+ int eo = so + len;
+
+ if (typing && secNo == ed->focusSection())
+ ed->setSectionSelection(secNo, eo - txt.length(), eo);
+ else
+ ed->setSectionSelection(secNo, so, eo);
+ txt = txt.rightJustify(len, '0');
+ return txt;
+ }
+
+//---------------------------------------------------------
+// setFocusSection
+//---------------------------------------------------------
+
+bool PosEdit::setFocusSection(int s)
+ {
+ if (s != ed->focusSection()) {
+ killTimer(timerId);
+ overwrite = true;
+ typing = false;
+ int so = sec[s].offset;
+ int eo = so + sec[s].len;
+ ed->setSectionSelection(s, so, eo);
+ if (changed) {
+ emit valueChanged(pos());
+ changed = false;
+ }
+ }
+ return ed->setFocusSection(s);
+ }
+
+//---------------------------------------------------------
+// setSec
+//---------------------------------------------------------
+
+void PosEdit::setSec(int secNo, int val)
+ {
+ if (val < 0)
+ val = 0;
+ if (_smpte) {
+ switch(secNo) {
+ case 0:
+ break;
+ case 1:
+ if (val > 59)
+ val = 59;
+ break;
+ case 2:
+ switch(mtcType) {
+ case 0: // 24 frames sec
+ if (val > 23)
+ val = 23;
+ break;
+ case 1:
+ if (val > 24)
+ val = 24;
+ break;
+ case 2: // 30 drop frame
+ case 3: // 30 non drop frame
+ if (val > 29)
+ val = 29;
+ break;
+ }
+ break;
+ case 3:
+ if (val > 99)
+ val = 99;
+ }
+ }
+ else {
+ switch(secNo) {
+ case 0:
+ break;
+ case 1:
+ {
+ int z, n;
+ int tick = sigmap.bar2tick(sec[0].val, val, sec[2].val);
+ sigmap.timesig(tick, z, n);
+ if (val >= n)
+ val = n-1;
+ }
+ break;
+ case 2:
+ {
+ int tick = sigmap.bar2tick(sec[0].val, sec[1].val, val);
+ int tb = sigmap.ticksBeat(tick);
+ if (val >= tb)
+ val = tb-1;
+ }
+ break;
+ }
+ }
+ sec[secNo].val = val;
+ }
+
+//---------------------------------------------------------
+// sectionText
+// Returns the text of section \a sec.
+//---------------------------------------------------------
+
+QString PosEdit::sectionText(int secNo)
+ {
+ return QString::number(sec[secNo].val + sec[secNo].voff);
+ }
+
+//---------------------------------------------------------
+// outOfRange
+// return true if out of range
+//---------------------------------------------------------
+
+bool PosEdit::outOfRange(int secNo, int val) const
+ {
+ if (val < 0)
+ return true;
+ int limit = MAXINT;
+ if (_smpte) {
+ switch(secNo) {
+ case 0:
+ break;
+ case 1:
+ limit = 59;
+ break;
+ case 2:
+ switch(mtcType) {
+ case 0: // 24 frames sec
+ limit = 23;
+ break;
+ case 1:
+ limit = 24;
+ break;
+ case 2: // 30 drop frame
+ case 3: // 30 non drop frame
+ limit = 29;
+ break;
+ }
+ break;
+ case 3:
+ limit = 99;
+ break;
+ }
+ }
+ else {
+ switch(secNo) {
+ case 0:
+ break;
+ case 1:
+ {
+ int z;
+ int tick = sigmap.bar2tick(sec[0].val, val, sec[2].val);
+ sigmap.timesig(tick, z, limit);
+ limit -= 1;
+ }
+ break;
+ case 2:
+ int tick = sigmap.bar2tick(sec[0].val, sec[1].val, val);
+ limit = sigmap.ticksBeat(tick) - 1;
+ break;
+ }
+ }
+ return val > limit;
+ }
+
+//---------------------------------------------------------
+// addNumber
+//---------------------------------------------------------
+
+void PosEdit::addNumber(int secNo, int num)
+ {
+ if (secNo == -1)
+ return;
+ killTimer(timerId);
+ bool accepted = false;
+ typing = true;
+ int voff = sec[secNo].voff;
+
+ QString txt = sectionText(secNo);
+
+ if (txt.length() == sec[secNo].len) {
+ if (!outOfRange(secNo, num - voff)) {
+ accepted = true;
+ sec[secNo].val = num - voff;
+ }
+ }
+ else {
+ txt += QString::number(num);
+ int temp = txt.toInt() - voff;
+ if (outOfRange(secNo, temp))
+ txt = sectionText(secNo);
+ else {
+ accepted = true;
+ sec[secNo].val = temp;
+ }
+ if (adv && (txt.length() == sec[secNo].len)) {
+ setFocusSection(ed->focusSection() + 1);
+ }
+ }
+ changed = accepted;
+ if (accepted)
+ emit valueChanged(pos());
+ timerId = startTimer(qApp->doubleClickInterval()*4);
+ ed->repaint(ed->rect(), false);
+ }
+
+//---------------------------------------------------------
+// removeLastNumber
+//---------------------------------------------------------
+
+void PosEdit::removeLastNumber(int secNo)
+ {
+ if (secNo == -1)
+ return;
+ QString txt = QString::number(sec[secNo].val);
+ txt = txt.mid(0, txt.length() - 1);
+ sec[secNo].val = txt.toInt() - sec[secNo].voff;
+ ed->repaint(ed->rect(), false);
+ }
+
+//---------------------------------------------------------
+// resizeEvent
+//---------------------------------------------------------
+
+void PosEdit::resizeEvent(QResizeEvent *)
+ {
+ controls->resize(width(), height());
+ }
+
+//---------------------------------------------------------
+// sizeHint
+//---------------------------------------------------------
+
+QSize PosEdit::sizeHint() const
+ {
+ QFontMetrics fm(font());
+ int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth,0, this); // ddskrjo 0
+ int h = fm.height() + fw * 2;
+ int w = 4 + controls->upRect().width() + fw * 4;
+ if (_smpte)
+ w += fm.width('9') * 10 + fm.width(ed->separator()) * 3;
+ else
+ w += fm.width('9') * 10 + fm.width(ed->separator()) * 2;
+ return QSize(w, h).expandedTo(QApplication::globalStrut());
+ }
+
+//---------------------------------------------------------
+// updateButtons
+//---------------------------------------------------------
+
+void PosEdit::updateButtons()
+ {
+ bool upEnabled = isEnabled() && (pos() < maxValue());
+ bool downEnabled = isEnabled() && (pos() > minValue());
+
+ //printf("PosEdit::updateButtons smpte:%d upEnabled:%d downEnabled:%d\n", smpte(), upEnabled, downEnabled);
+
+ controls->setUpEnabled(upEnabled);
+ controls->setDownEnabled(downEnabled);
+ }
+
+//---------------------------------------------------------
+// enterPressed
+//---------------------------------------------------------
+void PosEdit::enterPressed()
+ {
+ emit returnPressed();
+ }
+
+//---------------------------------------------------------
+// setEnabled
+//---------------------------------------------------------
+void PosEdit::setEnabled(bool v)
+{
+ QWidget::setEnabled(v);
+ updateButtons();
+}
diff --git a/muse2/muse/widgets/posedit.h b/muse2/muse/widgets/posedit.h
new file mode 100644
index 00000000..163746ad
--- /dev/null
+++ b/muse2/muse/widgets/posedit.h
@@ -0,0 +1,106 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: posedit.h,v 1.1.1.1.2.1 2004/12/27 19:47:25 lunar_shuttle Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __POSEDIT_H__
+#define __POSEDIT_H__
+
+#include <qwidget.h>
+#include <qstring.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QEvent>
+#include <QTimerEvent>
+#include "pos.h"
+
+class PosEditor;
+class Q3SpinWidget;
+
+#include "section.h"
+
+//---------------------------------------------------------
+// PosEdit
+//---------------------------------------------------------
+
+class PosEdit : public QWidget
+ {
+ Q_OBJECT
+ Q_PROPERTY(QString separator READ separator WRITE setSeparator)
+ Q_PROPERTY(bool smpte READ smpte WRITE setSmpte)
+
+ void init();
+ void setSections();
+ QString sectionText(int sec);
+ Section midiSections[3];
+ Section smpteSections[4];
+ Section* sec;
+
+ bool _smpte;
+
+ bool adv;
+ bool overwrite;
+ int timerId;
+ bool typing;
+ Pos min;
+ Pos max;
+ bool changed;
+ PosEditor *ed;
+ Q3SpinWidget* controls;
+
+ private slots:
+ void stepUp();
+ void stepDown();
+
+ signals:
+ void valueChanged(const Pos&);
+ void returnPressed();
+
+ protected:
+ bool event(QEvent *e );
+ void timerEvent(QTimerEvent* e);
+ void resizeEvent(QResizeEvent*);
+ QString sectionFormattedText(int sec);
+ void addNumber(int sec, int num);
+ void removeLastNumber(int sec);
+ bool setFocusSection(int s);
+
+ virtual bool outOfRange(int, int) const;
+ virtual void setSec(int, int);
+ friend class PosEditor;
+
+ protected slots:
+ void updateButtons();
+
+ public slots:
+ virtual void setValue(const Pos& time);
+ void setValue(int t);
+ void setValue(const QString& s);
+ // Added p3.3.43
+ virtual void setEnabled(bool);
+
+ public:
+ PosEdit(QWidget*, const char* = 0);
+ PosEdit(const Pos& time, QWidget*, const char* = 0);
+ ~PosEdit();
+
+ QSize sizeHint() const;
+ Pos pos() const;
+ virtual void setAutoAdvance(bool advance) { adv = advance; }
+ bool autoAdvance() const { return adv; }
+
+ virtual void setMinValue(const Pos& d) { setRange(d, maxValue()); }
+ Pos minValue() const;
+ virtual void setMaxValue( const Pos& d ) { setRange(minValue(), d ); }
+ Pos maxValue() const;
+ virtual void setRange(const Pos& min, const Pos& max);
+ QString separator() const;
+ virtual void setSeparator(const QString& s);
+ void setSmpte(bool);
+ bool smpte() const;
+ void enterPressed();
+ };
+
+#endif
diff --git a/muse2/muse/widgets/poslabel.cpp b/muse2/muse/widgets/poslabel.cpp
new file mode 100644
index 00000000..3066b640
--- /dev/null
+++ b/muse2/muse/widgets/poslabel.cpp
@@ -0,0 +1,152 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: poslabel.cpp,v 1.2.2.2 2009/04/06 01:24:55 terminator356 Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdlib.h>
+#include <cmath>
+#include <qapplication.h>
+#include <qstyle.h>
+//Added by qt3to4:
+#include <QLabel>
+
+#include "poslabel.h"
+#include "sig.h"
+#include "tempo.h"
+#include "globals.h"
+
+extern int mtcType;
+
+//---------------------------------------------------------
+// PosLabel
+//---------------------------------------------------------
+
+PosLabel::PosLabel(QWidget* parent, const char* name)
+ : QLabel(parent, name)
+ {
+ _tickValue = 0;
+ _sampleValue = 0;
+ _smpte = false;
+ setFrameStyle(WinPanel | Sunken);
+ setLineWidth(2);
+ setMidLineWidth(3);
+ int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, this); // ddskrjo 0
+ setIndent(fw);
+ updateValue();
+ }
+
+//---------------------------------------------------------
+// sizeHint
+//---------------------------------------------------------
+
+QSize PosLabel::sizeHint() const
+ {
+ QFontMetrics fm(font());
+ int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, this); // ddskrjo 0
+ int h = fm.height() + fw * 2;
+ int w;
+ if (_smpte)
+ w = 2 + fm.width('9') * 9 + fm.width(':') * 3 + fw * 4;
+ else
+ w = 2 + fm.width('9') * 9 + fm.width('.') * 2 + fw * 4;
+ return QSize(w, h).expandedTo(QApplication::globalStrut());
+ }
+
+//---------------------------------------------------------
+// updateValue
+//---------------------------------------------------------
+
+void PosLabel::updateValue()
+ {
+ QString s;
+ if (_smpte) {
+ double time = double(_sampleValue) / double(sampleRate);
+ int min = int(time) / 60;
+ int sec = int(time) % 60;
+ double rest = time - (min * 60 + sec);
+ switch(mtcType) {
+ case 0: // 24 frames sec
+ rest *= 24;
+ break;
+ case 1: // 25
+ rest *= 25;
+ break;
+ case 2: // 30 drop frame
+ rest *= 30;
+ break;
+ case 3: // 30 non drop frame
+ rest *= 30;
+ break;
+ }
+ int frame = int(rest);
+ int subframe = int((rest-frame)*100);
+ s.sprintf("%03d:%02d:%02d:%02d", min, sec, frame, subframe);
+ }
+ else {
+ int bar, beat;
+ unsigned tick;
+ sigmap.tickValues(_tickValue, &bar, &beat, &tick);
+ //s.sprintf("%04d.%02d.%03ud", bar+1, beat+1, tick);
+ s.sprintf("%04d.%02d.%03u", bar+1, beat+1, tick);
+ }
+ setText(s);
+ }
+
+//---------------------------------------------------------
+// setSampleValue
+//---------------------------------------------------------
+
+void PosLabel::setSampleValue(unsigned val)
+ {
+ if (val == _sampleValue)
+ return;
+ _sampleValue = val;
+ updateValue();
+ }
+
+//---------------------------------------------------------
+// setTickValue
+//---------------------------------------------------------
+
+void PosLabel::setTickValue(unsigned val)
+ {
+ if (val == _tickValue)
+ return;
+ if (val >= MAX_TICK)
+ abort();
+ _tickValue = val;
+ updateValue();
+ }
+
+//---------------------------------------------------------
+// setValue
+//---------------------------------------------------------
+
+void PosLabel::setValue(unsigned val)
+ {
+ unsigned oval = _smpte ? _sampleValue : _tickValue;
+ if (val == oval)
+ return;
+ if (_smpte)
+ _sampleValue = val;
+ else
+ _tickValue = val;
+ updateValue();
+ }
+
+//---------------------------------------------------------
+// setSmpte
+//---------------------------------------------------------
+
+void PosLabel::setSmpte(bool val)
+ {
+ _smpte = val;
+ if (val)
+ _sampleValue = tempomap.tick2frame(_tickValue);
+ else
+ _tickValue = tempomap.frame2tick(_sampleValue);
+ updateValue();
+ }
+
diff --git a/muse2/muse/widgets/poslabel.h b/muse2/muse/widgets/poslabel.h
new file mode 100644
index 00000000..06cd0b09
--- /dev/null
+++ b/muse2/muse/widgets/poslabel.h
@@ -0,0 +1,45 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: poslabel.h,v 1.2 2004/01/11 18:55:37 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __POSLABEL_H__
+#define __POSLABEL_H__
+
+#include <qlabel.h>
+
+//---------------------------------------------------------
+// PosLabel
+//---------------------------------------------------------
+
+class PosLabel : public QLabel {
+ bool _smpte;
+ unsigned _tickValue;
+ unsigned _sampleValue;
+ Q_OBJECT
+
+ void updateValue();
+
+ protected:
+ QSize sizeHint() const;
+
+ public slots:
+ void setTickValue(unsigned);
+ void setSampleValue(unsigned);
+ void setValue(unsigned);
+
+ public:
+ PosLabel(QWidget* parent, const char* name = 0);
+ unsigned value() const { return _smpte ? _sampleValue : _tickValue; }
+ unsigned tickValue() const { return _tickValue; }
+ unsigned sampleValue() const { return _sampleValue; }
+ void setSmpte(bool);
+ bool smpte() const { return _smpte; }
+ };
+
+
+#endif
+
+
diff --git a/muse2/muse/widgets/scldiv.cpp b/muse2/muse/widgets/scldiv.cpp
new file mode 100644
index 00000000..a0b0e628
--- /dev/null
+++ b/muse2/muse/widgets/scldiv.cpp
@@ -0,0 +1,652 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: scldiv.cpp,v 1.1.1.1 2003/10/27 18:54:32 wschweer Exp $
+//
+// Copyright (C) 1997 Josef Wilgen
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2,
+// as published by the Free Software Foundation.
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <cmath>
+#include "scldiv.h"
+#include "mmath.h"
+//Added by qt3to4:
+#include <Q3MemArray>
+
+// ScaleDiv - A class for building scale divisions
+//
+// The ScaleDiv class can build
+// linear and logarithmic scale divisions for specified
+// intervals. It uses an adjustable algorithm to
+// generate the major and minor step widths automatically.
+// A scale division has a minimum value, a maximum value,
+// a vector of major marks, and a vector of minor marks.
+//
+// ScaleDiv uses implicit sharing for the mark vectors.
+//
+// Build a logarithmic scale division from 0.01 to 1000
+// and print out the major and minor marks.
+//.c
+// #include <scldiv.h>
+// #include <iostream.h>
+//
+// main()
+// {
+// int i,k;
+// ScaleDiv sd;
+//
+// sd.rebuild(0.01, 100, 10, 10, TRUE, 0.0);
+//
+// k=0;
+// for (i=0;i<sd.majCnt();i++)
+// {
+// while(k < sd.minCnt())
+// {
+// if(sd.minMark(k) < sd.majMark(i))
+// {
+// cout << " - " << sd.minMark(i) << "\n";
+// k++;
+// }
+// else
+// break;
+// }
+// cout << "-- " << sd.majMark(i) << "\n";
+// }
+// while(k < sd.minCnt())
+// {
+// cout << " - " << sd.minMark(i) << "\n";
+// k++;
+// }
+// }
+//
+//------------------------------------------------------------
+
+static const double step_eps = 1.0e-3;
+static const double border_eps = 1.0e-10;
+
+static bool limRange(double &val, double v1, double v2, double eps_rel = 0.0,
+ double eps_abs = 0.0)
+ {
+
+ bool rv = TRUE;
+ double vmin = qwtMin(v1, v2);
+ double vmax = qwtMax(v1, v2);
+ double delta_min = qwtMax(qwtAbs(eps_rel * vmin), qwtAbs(eps_abs));
+ double delta_max = qwtMax(qwtAbs(eps_rel * vmax), qwtAbs(eps_abs));
+
+ if (val < vmin)
+ {
+ if (val < vmin - delta_min) rv = FALSE;
+ val = vmin;
+ }
+ else if (val > vmax)
+ {
+ if (val > vmax + delta_max) rv = FALSE;
+ val = vmax;
+ }
+ return rv;
+
+}
+
+//------------------------------------------------------------
+//.F ScaleDiv::ScaleDiv
+// Construct a ScaleDiv instance.
+//
+//.u Syntax
+//.f ScaleDiv::ScaleDiv()
+//------------------------------------------------------------
+
+ScaleDiv::ScaleDiv()
+ {
+ d_lBound = 0.0;
+ d_hBound = 0.0;
+ d_majStep = 0.0;
+ d_log = FALSE;
+ }
+
+//------------------------------------------------------------
+//.F ScaleDiv::~ScaleDiv
+// Destroy a ScaleDiv instance.
+//
+//.u Syntax
+//.f ScaleDiv::~ScaleDiv()
+//------------------------------------------------------------
+
+ScaleDiv::~ScaleDiv()
+ {
+ }
+
+//------------------------------------------------------------
+//.F ScaleDiv::ScaleDiv
+// Copy Constructor
+//
+//.u Syntax
+//.f ScaleDiv::ScaleDiv(const ScaleDiv &s)
+//
+//.u Parameters
+//.p const ScaleDiv &s -- scale division to be copied
+//------------------------------------------------------------
+
+ScaleDiv::ScaleDiv(const ScaleDiv &s)
+ {
+ copy(s);
+ }
+
+//------------------------------------------------------------
+//.F ScaleDiv::operator=
+// Assignment operator
+//
+//.u Syntax
+//.f ScaleDiv & ScaleDiv::operator=(const ScaleDiv &s)
+//
+//.u Parameters
+//.p const ScaleDiv &s -- scale divison to be assigned
+//------------------------------------------------------------
+
+ScaleDiv& ScaleDiv::operator=(const ScaleDiv &s)
+ {
+ copy(s);
+ return *this;
+ }
+
+//------------------------------------------------------------
+//.F ScaleDiv::copy
+// Copy member data from another ScaleDiv instance.
+//
+//.u Syntax
+//.f void ScaleDiv::copy(const ScaleDiv &s)
+//
+//.u Parameters
+//.p const ScaleDiv &s
+//------------------------------------------------------------
+
+void ScaleDiv::copy(const ScaleDiv &s)
+ {
+ d_lBound = s.d_lBound;
+ d_hBound = s.d_hBound;
+ d_log = s.d_log;
+ d_majStep = s.d_majStep;
+ d_minMarks = s.d_minMarks;
+ d_majMarks = s.d_majMarks;
+ }
+
+//------------------------------------------------------------
+//.F ScaleDiv::rebuild
+// Build a scale width major and minor divisions
+//
+//.p
+// double x1 -- first boundary value
+// double x2 -- second boundary value
+// int maxMajSteps -- max. number of major step intervals
+// int maxMinSteps -- max. number of minor step intervals
+// bool log -- logarithmic division (TRUE/FALSE)
+// double step -- fixed major step width. Defaults to 0.0.
+// bool ascend -- if TRUE, sort in ascending order from min(x1, x2)
+// to max(x1, x2). If FALSE, sort in the direction
+// from x1 to x2. Defaults to TRUE.
+//
+//.u Return Value
+// True if the arrays have been allocated successfully.
+//
+//.u Description
+// If no fixed step width is specified or if it is set to 0, the
+// major step width will be calculated automatically according to the
+// the value of maxMajSteps. The maxMajSteps parameter has no effect
+// if a fixed step size is specified. The minor step width is always
+// calculated automatically.
+// If the step width is to be calculated automatically, the algorithm
+// tries to find reasonable values fitting into the scheme {1,2,5}*10^n
+// with an integer number n for linear scales.
+// For logarithmic scales, there are three different cases:
+//.i
+// -- If the major step width is one decade, the minor marks
+// will fit into one of the schemes {1,2,...9}, {2,4,6,8}, {2,5} or {5},
+// depending on the maxMinSteps parameter.
+// -- If the major step size spans
+// more than one decade, the minor step size will be {1,2,5}*10^n decades
+// with a natural number n.
+// -- If the whole range is less than one decade, a linear scale
+// division will be built
+//
+//.u Note
+// For logarithmic scales, the step width is measured in decades.
+//------------------------------------------------------------
+
+bool ScaleDiv::rebuild(double x1, double x2, int maxMajSteps, int maxMinSteps,
+ bool log, double step, bool ascend)
+{
+
+ int rv;
+
+ d_lBound = qwtMin(x1, x2);
+ d_hBound = qwtMax(x1, x2);
+ d_log = log;
+
+ if (d_log)
+ rv = buildLogDiv(maxMajSteps,maxMinSteps,step);
+ else
+ rv = buildLinDiv(maxMajSteps, maxMinSteps, step);
+
+ if ((!ascend) && (x2 < x1))
+ {
+ d_lBound = x1;
+ d_hBound = x2;
+ qwtTwistArray(d_majMarks.data(), d_majMarks.size());
+ qwtTwistArray(d_minMarks.data(), d_minMarks.size());
+ }
+
+ return rv;
+
+}
+
+//------------------------------------------------------------
+//.F ScaleDiv::buildLinDiv
+// Build a linear scale division in ascending order
+//
+//.u Syntax
+//.f bool ScaleDiv::buildLinDiv(int majSteps, int minSteps, double step)
+//
+//.u Parameters
+//.p int maxSteps -- max. number of step intervals
+// double step -- fixed step width
+//
+//.u Return Value
+// TRUE if array has been successfully resized
+//
+//.u Description
+// If the 'step' parameter is set to 0.0, this function
+// cal[culates the step width automatically according to
+// the value of 'maxSteps'. MaxSteps must be greater than or
+// equal to 2. It will be guessed if an invalid value is specified.
+// The maximum possible number of steps is limited to 10000.
+// The maxSteps parameter has no effect if a fixed step width is
+// specified.
+//
+//.u Note
+// This function uses the data members d_lBound and d_hBound and assumes
+// that d_hBound > d_lBound.
+//------------------------------------------------------------
+
+bool ScaleDiv::buildLinDiv(int maxMajSteps, int maxMinSteps, double step)
+ {
+
+ int nMaj, nMin, minSize, i0,i,k;
+ double val, mval;
+ double firstTick, lastTick;
+ double minStep;
+ Q3MemArray<double> buffer;
+ bool rv = TRUE;
+
+ // parameter range check
+ maxMajSteps = qwtMax(1, maxMajSteps);
+ maxMinSteps = qwtMax(0, maxMinSteps);
+ step = qwtAbs(step);
+
+ // detach arrays
+ d_majMarks.duplicate(0,0);
+ d_minMarks.duplicate(0,0);
+
+ if (d_lBound == d_hBound) return TRUE;
+
+ //
+ // Set up major divisions
+ //
+ if (step == 0.0)
+ d_majStep = qwtCeil125(qwtAbs(d_hBound - d_lBound) * 0.999999
+ / double(maxMajSteps));
+ else
+ d_majStep = step;
+
+ if (d_majStep == 0.0) return TRUE;
+
+ firstTick = ceil( (d_lBound - step_eps * d_majStep) / d_majStep) * d_majStep;
+ lastTick = floor( (d_hBound + step_eps * d_majStep) / d_majStep) * d_majStep;
+
+ nMaj = qwtMin(10000, int(rint((lastTick - firstTick) / d_majStep)) + 1);
+
+ if ((rv = d_majMarks.resize(nMaj)))
+ qwtLinSpace(d_majMarks.data(), d_majMarks.size(), firstTick, lastTick);
+ else
+ return FALSE;
+
+ //
+ // Set up minor divisions
+ //
+ if (maxMinSteps < 1) // no minor divs
+ return TRUE;
+
+ minStep = qwtCeil125( d_majStep / double(maxMinSteps) );
+
+ if (minStep == 0.0) return TRUE;
+
+ nMin = qwtAbs(int(rint(d_majStep / minStep))) - 1; // # minor steps per interval
+
+ // Do the minor steps fit into the interval?
+ if ( qwtAbs(double(nMin + 1) * minStep - d_majStep) > step_eps * d_majStep)
+ {
+ nMin = 1;
+ minStep = d_majStep * 0.5;
+ }
+
+ // Are there minor ticks below the first major tick?
+ if (d_majMarks[0] > d_lBound )
+ i0 = -1;
+ else
+ i0 = 0;
+
+ // resize buffer to the maximum possible number of minor ticks
+ rv = buffer.resize(nMin * (nMaj + 1));
+
+ // calculate minor ticks
+ if (rv)
+ {
+ minSize = 0;
+ for (i = i0; i < (int)d_majMarks.size(); i++)
+ {
+ if (i >= 0)
+ val = d_majMarks[i];
+ else
+ val = d_majMarks[0] - d_majStep;
+
+ for (k=0; k< nMin; k++)
+ {
+ mval = (val += minStep);
+ if (limRange(mval, d_lBound, d_hBound, border_eps))
+ {
+ buffer[minSize] = mval;
+ minSize++;
+ }
+ }
+ }
+ d_minMarks.duplicate(buffer.data(), minSize);
+ }
+
+ return rv;
+ }
+
+//------------------------------------------------------------
+//.F ScaleDiv::buildLogDiv
+// Build a logarithmic scale division
+//
+//.u Syntax
+//.f bool ScaleDiv::buildLogDiv(int maxMajSteps, int maxMinSteps, int majStep)
+//
+//.u Parameters
+//.p int maxMajSteps, int maxMinSteps, int majStep
+//
+//.u Return Value
+// True if memory has been successfully allocated
+//
+//.u Note
+// This function uses the data members d_lBound and d_hBound and assumes
+// that d_hBound > d_lBound.
+//------------------------------------------------------------
+
+bool ScaleDiv::buildLogDiv(int maxMajSteps, int maxMinSteps, double majStep)
+ {
+ double firstTick, lastTick;
+ double lFirst, lLast;
+ double val, sval, minStep, minFactor;
+ int nMaj, nMin, minSize, i, k, k0, kstep, kmax, i0;
+ int rv = TRUE;
+ double width;
+
+ Q3MemArray<double> buffer;
+
+
+ // Parameter range check
+ maxMajSteps = qwtMax(1, qwtAbs(maxMajSteps));
+ maxMinSteps = qwtMax(0, qwtAbs(maxMinSteps));
+ majStep = qwtAbs(majStep);
+
+ // boundary check
+ limRange(d_hBound, LOG_MIN, LOG_MAX);
+ limRange(d_lBound, LOG_MIN, LOG_MAX);
+
+ // detach arrays
+ d_majMarks.duplicate(0,0);
+ d_minMarks.duplicate(0,0);
+
+ if (d_lBound == d_hBound) return TRUE;
+
+ // scale width in decades
+ width = log10(d_hBound) - log10(d_lBound);
+
+ // scale width is less than one decade -> build linear scale
+ if (width < 1.0)
+ {
+ rv = buildLinDiv(maxMajSteps, maxMinSteps, 0.0);
+ // convert step width to decades
+ if (d_majStep > 0)
+ d_majStep = log10(d_majStep);
+
+ return rv;
+ }
+
+ //
+ // Set up major scale divisions
+ //
+ if (majStep == 0.0)
+ d_majStep = qwtCeil125( width * 0.999999 / double(maxMajSteps));
+ else
+ d_majStep = majStep;
+
+ // major step must be >= 1 decade
+ d_majStep = qwtMax(d_majStep, 1.0);
+
+
+ lFirst = ceil((log10(d_lBound) - step_eps * d_majStep) / d_majStep) * d_majStep;
+ lLast = floor((log10(d_hBound) + step_eps * d_majStep) / d_majStep) * d_majStep;
+
+ firstTick = pow(10.0, lFirst);
+ lastTick = pow(10.0, lLast);
+
+ nMaj = qwtMin(10000, int(rint(qwtAbs(lLast - lFirst) / d_majStep)) + 1);
+
+ if (d_majMarks.resize(nMaj))
+ qwtLogSpace(d_majMarks.data(), d_majMarks.size(), firstTick, lastTick);
+ else
+ return FALSE;
+
+
+ //
+ // Set up minor scale divisions
+ //
+
+ if ((d_majMarks.size() < 1) || (maxMinSteps < 1)) return TRUE; // no minor marks
+
+ if (d_majStep < 1.1) // major step width is one decade
+ {
+ if (maxMinSteps >= 8)
+ {
+ k0 = 2;
+ kmax = 9;
+ kstep = 1;
+ minSize = (d_majMarks.size() + 1) * 8;
+ }
+ else if (maxMinSteps >= 4)
+ {
+ k0 = 2;
+ kmax = 8;
+ kstep = 2;
+ minSize = (d_majMarks.size() + 1) * 4;
+ }
+ else if (maxMinSteps >= 2)
+ {
+ k0 = 2;
+ kmax = 5;
+ kstep = 3;
+ minSize = (d_majMarks.size() + 1) * 2;
+ }
+ else
+ {
+ k0 = 5;
+ kmax = 5;
+ kstep = 1;
+ minSize = (d_majMarks.size() + 1);
+ }
+
+ // resize buffer to the max. possible number of minor marks
+ buffer.resize(minSize);
+
+ // Are there minor ticks below the first major tick?
+ if ( d_lBound < firstTick )
+ i0 = -1;
+ else
+ i0 = 0;
+
+ minSize = 0;
+ for (i = i0; i< (int)d_majMarks.size(); i++)
+ {
+ if (i >= 0)
+ val = d_majMarks[i];
+ else
+ val = d_majMarks[0] / pow(10.0, d_majStep);
+
+ for (k=k0; k<= kmax; k+=kstep)
+ {
+ sval = val * double(k);
+ if (limRange(sval, d_lBound, d_hBound, border_eps))
+ {
+ buffer[minSize] = sval;
+ minSize++;
+ }
+ }
+ }
+
+ // copy values into the minMarks array
+ d_minMarks.duplicate(buffer.data(), minSize);
+
+ }
+ else // major step > one decade
+ {
+
+ // substep width in decades, at least one decade
+ minStep = qwtCeil125( (d_majStep - step_eps * (d_majStep / double(maxMinSteps)))
+ / double(maxMinSteps) );
+ minStep = qwtMax(1.0, minStep);
+
+ // # subticks per interval
+ nMin = int(rint(d_majStep / minStep)) - 1;
+
+ // Do the minor steps fit into the interval?
+ if ( qwtAbs( double(nMin + 1) * minStep - d_majStep) > step_eps * d_majStep)
+ nMin = 0;
+
+ if (nMin < 1) return TRUE; // no subticks
+
+ // resize buffer to max. possible number of subticks
+ buffer.resize((d_majMarks.size() + 1) * nMin );
+
+ // substep factor = 10^substeps
+ minFactor = qwtMax(pow(10,minStep), 10.0);
+
+ // Are there minor ticks below the first major tick?
+ if ( d_lBound < firstTick )
+ i0 = -1;
+ else
+ i0 = 0;
+
+ minSize = 0;
+ for (i = i0; i< (int)d_majMarks.size(); i++)
+ {
+ if (i >= 0)
+ val = d_majMarks[i];
+ else
+ val = firstTick / pow(10.0, d_majStep);
+
+ for (k=0; k< nMin; k++)
+ {
+ sval = (val *= minFactor);
+ if (limRange(sval, d_lBound, d_hBound, border_eps))
+ {
+ buffer[minSize] = sval;
+ minSize++;
+ }
+ }
+ }
+ d_minMarks.duplicate(buffer.data(), minSize);
+ }
+
+ return rv;
+}
+
+//------------------------------------------------------------
+//.F ScaleDiv::operator==
+// Equality operator
+//
+//.u Syntax
+//.f int ScaleDiv::operator==(const ScaleDiv &s)
+//
+//.u Parameters
+//.p const ScaleDiv &s
+//
+//.u Return Value
+// TRUE if this instance is equal to s
+//------------------------------------------------------------
+
+int ScaleDiv::operator==(const ScaleDiv &s) const
+ {
+ if (d_lBound != s.d_lBound)
+ return 0;
+ if (d_hBound != s.d_hBound)
+ return 0;
+ if (d_log != s.d_log)
+ return 0;
+ if (d_majStep != s.d_majStep)
+ return 0;
+ if (d_majMarks != s.d_majMarks)
+ return 0;
+ return (d_minMarks == s.d_minMarks);
+ }
+
+//------------------------------------------------------------
+//.F ScaleDiv::operator!=
+// Inequality
+//
+//.u Syntax
+//.f int ScaleDiv::operator!=(const ScaleDiv &s)
+//
+//.u Parameters
+//.p const ScaleDiv &s
+//
+//.u Return Value
+// TRUE if this instance is not equal to s
+//------------------------------------------------------------
+
+int ScaleDiv::operator!=(const ScaleDiv &s) const
+ {
+ return (!(*this == s));
+ }
+
+//------------------------------------------------------------
+//.F ScaleDiv::reset
+// Detach the shared data and set everything to zero.
+//
+//.u Syntax
+//.f void ScaleDiv::reset()
+//------------------------------------------------------------
+
+void ScaleDiv::reset()
+ {
+ // detach arrays
+ d_majMarks.duplicate(0,0);
+ d_minMarks.duplicate(0,0);
+
+ d_lBound = 0.0;
+ d_hBound = 0.0;
+ d_majStep = 0.0;
+ d_log = FALSE;
+ }
+
+
+
+
+
+
+
+
diff --git a/muse2/muse/widgets/scldiv.h b/muse2/muse/widgets/scldiv.h
new file mode 100644
index 00000000..fcb4951c
--- /dev/null
+++ b/muse2/muse/widgets/scldiv.h
@@ -0,0 +1,57 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: scldiv.h,v 1.1.1.1 2003/10/27 18:54:43 wschweer Exp $
+//
+// Copyright (C) 1997 Josef Wilgen
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2,
+// as published by the Free Software Foundation.
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SCLDIV_H__
+#define __SCLDIV_H__
+
+#include <qglobal.h>
+#include <q3memarray.h>
+
+class ScaleDiv
+ {
+ double d_lBound;
+ double d_hBound;
+ double d_majStep;
+ bool d_log;
+
+ Q3MemArray<double> d_majMarks;
+ Q3MemArray<double> d_minMarks;
+
+ void copy(const ScaleDiv &s);
+
+ bool buildLinDiv(int maxMajMark, int maxMinMark, double step = 0.0);
+ bool buildLogDiv(int maxMajMark, int maxMinMark, double step = 0.0);
+
+ public:
+ ScaleDiv ();
+ virtual ~ScaleDiv();
+ ScaleDiv(const ScaleDiv& s);
+
+ ScaleDiv& operator= (const ScaleDiv &s);
+ int operator== (const ScaleDiv &s) const;
+ int operator!= (const ScaleDiv &s) const;
+
+ double lBound() const { return d_lBound; }
+ double hBound() const { return d_hBound; }
+ int minCnt() const { return d_minMarks.size(); }
+ int majCnt() const { return d_majMarks.size(); }
+ bool logScale() const { return d_log; }
+ double majMark(int i) const { return d_majMarks[i]; }
+ double minMark(int i) const { return d_minMarks[i]; }
+ double majStep() const { return d_majStep; }
+ void reset();
+ bool rebuild(double lBound, double hBound, int maxMaj, int maxMin,
+ bool log, double step = 0.0, bool ascend = TRUE);
+ };
+
+#endif
diff --git a/muse2/muse/widgets/scldraw.cpp b/muse2/muse/widgets/scldraw.cpp
new file mode 100644
index 00000000..b72d1000
--- /dev/null
+++ b/muse2/muse/widgets/scldraw.cpp
@@ -0,0 +1,881 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: scldraw.cpp,v 1.1.1.1 2003/10/27 18:54:36 wschweer Exp $
+//
+// Copyright (C) 1997 Josef Wilgen
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2,
+// as published by the Free Software Foundation.
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <cmath>
+#include "scldraw.h"
+#include <qpainter.h>
+#include <qfontmetrics.h>
+#include <qrect.h>
+#include "mmath.h"
+
+
+int const ScaleDraw::minLen = 10;
+
+const double step_eps = 1.0e-6;
+static const double WorstCase = -8.8888888888888888888888e-88;
+
+//------------------------------------------------------------
+//.H ScaleDraw | 3 | 30/08/97 | Qwt Widget Library | Qwt Programmer's Manual
+//.I scldraw Different Scales
+//.U NAME
+// ScaleDraw - A class for drawing scales
+//
+//.U SYNOPSIS
+// #include <qwt_scldraw.h>
+//
+//.U DESCRIPTION
+// ScaleDraw can be used to draw linear or logarithmic scales.
+// A scale has an origin,
+// an orientation and a length, which all can be specified with
+// @ScaleDraw::setGeometry@.
+// After a scale division has been specified as a @^QwtScaleDiv@ object
+// using @ScaleDraw::setScale (1)@
+// or determined internally using @ScaleDraw::setScale (2)@,
+// the scale can be drawn with the @QwtScaleDiv::draw@ member.
+//
+//.U INHERITED CLASSES
+// @QwtDiMap@
+//
+//.U PUBLIC MEMBERS
+//.R
+// ScaleDraw::ScaleDraw -- constructor
+// ScaleDraw::setScale (1) -- set scale using QwtScaleDiv
+// ScaleDraw::setScale (2) -- set scale directly
+// ScaleDraw::setGeometry -- specify geometry
+// ScaleDraw::setAngleRange -- specify angle range for round scales
+// ScaleDraw::setLabelFormat -- set number format
+// ScaleDraw::scalediv -- return scale division
+// ScaleDraw::orientation -- return orientation
+// ScaleDraw::maxBoundingRect -- return maximum bounding rectangle
+// ScaleDraw::maxWidth -- return maximum width
+// ScaleDraw::maxHeight -- return maximum height
+// ScaleDraw::maxLabelWidth -- return maximum width of the number labels
+// ScaleDraw::draw -- draw the scale
+//
+//.U STATIC DATA MEMBERS
+//.t
+// enum ScaleDraw::Orientation { Left, Right, Top, Bottom, Round } --
+// Scale orientation
+//------------------------------------------------------------
+
+//------------------------------------------------------------
+//.U MEMBER FUNCTION DESCRIPTION
+//------------------------------------------------------------
+
+//------------------------------------------------------------
+//
+//.F ScaleDraw::ScaleDraw
+//
+// Constructor
+//.u Description
+// The range of the scale is initialized to [0, 100],
+// the angle range is set to [-135, 135], the geometry
+// is initialized such that the origin is at (0,0), the
+// length is 100, and the orientation is ScaleDraw::Bottom.
+//
+//------------------------------------------------------------
+ScaleDraw::ScaleDraw()
+{
+/* d_hpad = 6;
+ d_vpad = 3;
+ d_majLen = 8;
+ d_medLen = 6;
+ d_minLen = 4;
+ */
+
+ d_hpad = 3;
+ d_vpad = 1;
+ d_majLen = 4;
+ d_medLen = 3;
+ d_minLen = 2;
+
+ d_minAngle = -135 * 16;
+ d_maxAngle = 135 * 16;
+ d_fmt = 'g';
+ d_prec = 4;
+
+ // initialize scale and geometry
+ setGeometry(0,0,100,Bottom);
+ setScale(0,100,0,0,10);
+}
+
+
+//------------------------------------------------------------
+//
+//.F ScaleDraw::setScale (1)
+// Adjust the range of the scale
+//
+//.u Syntax
+//.f void ScaleDraw::setScale(double x1, double x2, double step, int logscale)
+//
+//.u Parameters
+//.p double x1 -- value at the left/low endpoint of the scale
+// double x2 -- value at the right/high endpoint of the scale
+// double step -- step size (default : 0.0)
+// int logscale -- logarithmic scale (default : 0)
+//
+//.u Description
+// If step == 0.0, the step width is calculated automatically
+// dependent on the maximal number of scale ticks.
+//
+//------------------------------------------------------------
+void ScaleDraw::setScale(double x1, double x2, int maxMajIntv,
+ int maxMinIntv, double step, int logscale)
+{
+ d_scldiv.rebuild( x1, x2, maxMajIntv, maxMinIntv, logscale, step, FALSE );
+ setDblRange( d_scldiv.lBound(), d_scldiv.hBound(), d_scldiv.logScale());
+}
+
+
+//------------------------------------------------------------
+//
+//.F ScaleDraw::setScale (2)
+// Change the scale division
+//
+//.u Syntax
+//.f void ScaleDraw::setScale(QwtAutoScale &as)
+//
+//.u Parameters
+//.p const QwtScaleDiv& sd -- new scale division
+//
+//------------------------------------------------------------
+
+void ScaleDraw::setScale(const ScaleDiv &s)
+{
+ d_scldiv = s;
+ setDblRange(d_scldiv.lBound(),d_scldiv.hBound(),d_scldiv.logScale());
+}
+
+
+
+//------------------------------------------------------------
+//.F ScaleDraw::draw
+// Draw the scale
+//.u Parameters
+//.p QPainter *p -- the painter
+//------------------------------------------------------------
+
+void ScaleDraw::draw(QPainter *p) const
+ {
+ double val,hval,majTick;
+
+ int i,k,kmax;
+
+ for (i=0; i< d_scldiv.majCnt(); i++)
+ {
+ val = d_scldiv.majMark(i);
+ drawTick(p, val, d_majLen);
+ drawLabel(p, val);
+ }
+
+ if (d_scldiv.logScale())
+ {
+ for (i=0; i< d_scldiv.minCnt(); i++)
+ {
+ drawTick(p,d_scldiv.minMark(i),d_minLen);
+ }
+ }
+ else
+ {
+ k = 0;
+ kmax = d_scldiv.majCnt() - 1;
+ if (kmax > 0)
+ {
+ majTick = d_scldiv.majMark(0);
+ hval = majTick - 0.5 * d_scldiv.majStep();
+
+ for (i=0; i< d_scldiv.minCnt(); i++)
+ {
+ val = d_scldiv.minMark(i);
+ if (val > majTick)
+ {
+ if (k < kmax)
+ {
+ k++;
+ majTick = d_scldiv.majMark(k);
+ }
+ else
+ {
+ majTick += d_scldiv.majMark(kmax) + d_scldiv.majStep();
+ }
+ hval = majTick - 0.5 * d_scldiv.majStep();
+
+ }
+ if (qwtAbs(val-hval) < step_eps * d_scldiv.majStep())
+ drawTick(p, val, d_medLen);
+ else
+ drawTick(p, val, d_minLen);
+ }
+ }
+ }
+
+ //
+ // draw backbone
+ //
+ //if (d_baseEnabled)
+ drawBackbone(p);
+
+}
+
+
+//------------------------------------------------------------
+//.F ScaleDraw::drawTick
+// Draws a singls scale tick
+//
+//.u Parameters
+//.p QPainter *p, double val, int len
+//------------------------------------------------------------
+
+void ScaleDraw::drawTick(QPainter *p, double val, int len) const
+ {
+ int tval = transform(val);
+ double arc;
+ int x1, x2, y1, y2;
+
+ switch(d_orient)
+ {
+ case Right:
+
+ p->drawLine(d_xorg, tval, d_xorg + len, tval);
+ break;
+
+ case Bottom:
+
+ p->drawLine(tval, d_yorg, tval, d_yorg + len);
+ break;
+
+ case Left:
+
+ p->drawLine(d_xorg, tval, d_xorg - len, tval);
+ break;
+
+ case Round:
+
+ if ((tval <= d_minAngle + 359 * 16) || (tval >= d_minAngle - 359 * 16))
+ {
+ arc = double(tval) / 16.0 * M_PI / 180.0;
+ x1 = qwtInt(d_xCenter + sin(arc) * d_radius);
+ x2 = qwtInt(d_xCenter + sin(arc) * (d_radius + double(len)));
+ y1 = qwtInt(d_yCenter - cos(arc) * d_radius);
+ y2 = qwtInt(d_yCenter - cos(arc) * (d_radius + double(len)));
+ p->drawLine(x1, y1, x2, y2);
+ }
+ break;
+
+ case Top:
+ default:
+
+ p->drawLine(tval, d_yorg, tval, d_yorg - len);
+ break;
+
+
+ }
+
+}
+
+
+
+
+//------------------------------------------------------------
+//.-
+//.F ScaleDraw::drawLabel
+// Draws the number label for a major scale tick
+//
+//.u Parameters
+//.p QPainter *p, double val
+//
+//------------------------------------------------------------
+void ScaleDraw::drawLabel(QPainter *p, double val) const
+{
+
+ static QString label;
+ static double pi_4 = M_PI * 0.25;
+ static double pi_75 = M_PI * 0.75;
+
+ double arc;
+ int xpos, ypos;
+ int tval;
+
+ QFontMetrics fm = p->fontMetrics();
+
+ tval = transform(val);
+
+ // correct rounding errors if val = 0
+ if ((!d_scldiv.logScale()) && (qwtAbs(val) < qwtAbs(step_eps * d_scldiv.majStep())))
+ val = 0.0;
+
+ label.setNum(val, d_fmt, d_prec);
+
+ switch(d_orient)
+ {
+ case Right:
+ p->drawText(d_xorg + d_majLen + d_hpad,
+ tval + (fm.ascent()-1) / 2,
+ label);
+ break;
+ case Left:
+ p->drawText(d_xorg - d_majLen - d_hpad - fm.width(label),
+ tval + (fm.ascent() -1) / 2,
+ label);
+ break;
+ case Bottom:
+ p->drawText(tval - (fm.width(label)-1) / 2, d_yorg + d_majLen + d_vpad + fm.ascent(), label);
+ break;
+ case Round:
+
+ if ((tval > d_minAngle + 359 * 16) || (tval < d_minAngle - 359 * 16))
+ break;
+
+ arc = double(tval) / 16.0 * M_PI / 180.0;
+
+ // Map arc into the interval -pi <= arc <= pi
+ if ((arc < -M_PI) || (arc > M_PI))
+ arc -= floor((arc + M_PI) / M_PI * 0.5) * 2.0 * M_PI;
+
+ xpos = 1 + qwtInt(d_xCenter + (d_radius + double(d_majLen + d_vpad)) * sin(arc));
+ ypos = qwtInt(d_yCenter - (d_radius + double(d_majLen + d_vpad)) * cos(arc));
+
+ if (arc < -pi_75)
+ {
+ p->drawText(xpos - qwtInt(double(fm.width(label))
+ * (1.0 + (arc + pi_75) * M_2_PI) ),
+ ypos + fm.ascent() - 1,
+ label);
+ }
+ else if (arc < -M_PI_4)
+ {
+ p->drawText(xpos - fm.width(label),
+
+
+ ypos - qwtInt(double(fm.ascent() - 1)
+ * (arc + M_PI_4) * M_2_PI),
+ label);
+ }
+ else if (arc < pi_4)
+ {
+ p->drawText(xpos + qwtInt(double(fm.width(label))
+ * ( arc - M_PI_4 ) * M_2_PI ),
+ ypos,
+ label);
+ }
+ else if (arc < pi_75)
+ {
+ p->drawText(xpos,
+ ypos + qwtInt(double(fm.ascent() - 1)
+ * (arc - M_PI_4) * M_2_PI),
+ label);
+ }
+ else
+ {
+ p->drawText(xpos - qwtInt(double(fm.width(label))
+ * ( arc - pi_75) * M_2_PI ),
+ ypos + fm.ascent() - 1,
+ label);
+ }
+ break;
+ case Top:
+ default:
+ p->drawText(tval - (fm.width(label)-1) / 2, d_yorg - d_majLen - d_vpad, label);
+ break;
+ }
+
+
+
+}
+
+//------------------------------------------------------------
+//.-
+//.F ScaleDraw::drawBackbone
+// Draws the baseline of the scale
+//
+//
+//.u Parameters
+//.p QPainter *p
+//
+//------------------------------------------------------------
+void ScaleDraw::drawBackbone(QPainter *p) const
+{
+ int bw2;
+ int a1, a2;
+ bw2 = p->pen().width() / 2;
+
+
+ switch(d_orient)
+ {
+ case Left:
+ p->drawLine(d_xorg - bw2, d_yorg, d_xorg - bw2, d_yorg + d_len - 1);
+ break;
+ case Right:
+ p->drawLine(d_xorg + bw2, d_yorg, d_xorg + bw2, d_yorg + d_len - 1);
+ break;
+ case Round:
+
+ a1 = qwtMin(i1(), i2()) - 90 * 16;
+ a2 = qwtMax(i1(), i2()) - 90 * 16;
+
+ p->drawArc(d_xorg, d_yorg, d_len,
+ d_len,
+ -a2, a2 - a1 + 1); // counterclockwise
+
+ break;
+
+ case Top:
+ p->drawLine(d_xorg, d_yorg - bw2, d_xorg + d_len - 1, d_yorg-bw2);
+ break;
+ case Bottom:
+ p->drawLine(d_xorg, d_yorg+bw2, d_xorg + d_len - 1, d_yorg+bw2);
+ break;
+ default:
+ p->drawLine(d_xorg, d_yorg, d_xorg + d_len - 1, d_yorg);
+ break;
+ }
+
+}
+
+
+//------------------------------------------------------------
+//
+//.F ScaleDraw::setGeometry
+// Specify the geometry of the scale
+//
+//
+//.u Parameters
+//.p int xorigin -- x coordinate of the origin
+// int yorigin -- y coordinate of the origin
+// int length -- length or diameter of the scale
+// Orientation o -- The orientation
+//
+//.u Description
+//
+// The parameters xorigin, yorigin and length have different meanings,
+// dependent on the
+// orientation:
+//.t
+// ScaleDraw::Left -- The origin is the topmost point of the
+// baseline. The baseline is a vertical line with the
+// specified length. Scale marks and labels are drawn
+// at the left of the baseline.
+//
+// ScaleDraw::Right -- The origin is the topmost point of the
+// baseline. The baseline is a vertical line with the
+// specified length. Scale marks and labels are drawn
+// at the right of the baseline.
+//
+// ScaleDraw::Top -- The origin is the leftmost point of the
+// baseline. The baseline is a horizontal line with the
+// specified length. Scale marks and labels are drawn
+// above the baseline.
+//
+// ScaleDraw::Bottom -- The origin is the leftmost point of the
+// baseline. The baseline is a horizontal line with the
+// specified length. Scale marks and labels are drawn
+// below the baseline.
+//
+// ScaleDraw::Round -- The origin is the top left corner of the
+// bounding rectangle of the baseline circle. The baseline
+// is the segment of a circle with a diameter of the specified length.
+// Scale marks and labels are drawn outside the baseline
+// circle.
+//
+//------------------------------------------------------------
+void ScaleDraw::setGeometry(int xorigin, int yorigin, int length, OrientationX o)
+{
+
+ d_xorg = xorigin;
+ d_yorg = yorigin;
+ d_radius = double(length) * 0.5;
+ d_xCenter = double(xorigin) + double(length) * 0.5;
+ d_yCenter = double(yorigin) + double(length) * 0.5;
+
+ if (length > minLen)
+ d_len = length;
+ else
+ d_len = minLen;
+
+ d_orient = o;
+
+ switch(d_orient)
+ {
+ case Left:
+ case Right:
+ setIntRange(d_yorg + d_len - 1, d_yorg);
+ break;
+ case Round:
+ setIntRange(d_minAngle, d_maxAngle);
+ break;
+ case Top:
+ case Bottom:
+ default:
+ setIntRange(d_xorg, d_xorg + d_len - 1);
+ break;
+ }
+}
+
+
+
+//------------------------------------------------------------
+//
+//.F ScaleDraw::maxWidth
+// Return the maximum width of the scale for a specified QPainter
+//
+//.u Syntax
+//.f int ScaleDraw::maxWidth(QPainter *p)
+//
+//.u Parameters
+//.p QPainter *p -- painter
+// bool worst -- if TRUE, assume the worst possible case. If FALSE,
+// calculate the real maximum width, which is more
+// CPU intensive.
+//
+//------------------------------------------------------------
+int ScaleDraw::maxWidth(QPainter *p, bool worst) const
+{
+ int rv = 0;
+ int bw = p->pen().width();
+
+ QString s;
+
+ QFontMetrics fm = p->fontMetrics();
+
+ rv = maxLabelWidth(p,worst);
+
+ switch (d_orient)
+ {
+ case Left:
+ case Right:
+ rv += (bw + d_hpad + d_majLen);
+ break;
+ case Round:
+ rv += (bw + d_vpad + d_majLen);
+ break;
+ case Top:
+ case Bottom:
+ default:
+ rv += d_len;
+ }
+
+ return rv;
+
+}
+
+//------------------------------------------------------------
+//
+//.F ScaleDraw::maxHeight
+// Return the maximum height of the scale for the
+// specified painter
+//
+//.u Syntax
+//.f int ScaleDraw::maxHeight(QPainter *p)
+//
+//.u Parameters
+//.p QPainter *p
+//
+//------------------------------------------------------------
+int ScaleDraw::maxHeight(QPainter *p) const
+{
+
+ int rv = 0;
+ int bw = p->pen().width();
+
+ p->save();
+ QFontMetrics fm = p->fontMetrics();
+
+ switch (d_orient)
+ {
+ case Top:
+ case Bottom:
+ case Round:
+ rv = bw + d_vpad + d_majLen + fm.height();
+ break;
+ case Left:
+ case Right:
+ default:
+ rv = d_len + ((fm.height() + 1) / 2);
+ }
+
+ return rv;
+
+}
+
+//------------------------------------------------------------
+//
+//.F ScaleDraw:maxBoundingRect
+// Return the maximum bounding rectangle of the scale
+// for a specified painter
+//
+//.u Parameters
+//.p QPainter *p -- painter
+//
+//.u Description
+// The bounding rectangle is not very exact for round scales
+// with strange angle ranges.
+//
+//------------------------------------------------------------
+QRect ScaleDraw::maxBoundingRect(QPainter *p) const
+{
+ int i, wl,h,wmax;
+ int a, ar, amin, amax;
+ double arc;
+
+ QRect r;
+
+ QFontMetrics fm = p->fontMetrics();
+
+ wl = maxLabelWidth(p, TRUE);
+ h = fm.height();
+
+ switch(d_orient)
+ {
+ case Left:
+
+ r = QRect( d_xorg - d_hpad - d_majLen - wl,
+ d_yorg - fm.ascent(),
+ d_majLen + d_hpad + wl,
+ d_len + fm.height());
+ break;
+
+ case Right:
+
+ r = QRect( d_xorg,
+ d_yorg - fm.ascent(),
+ d_majLen + d_hpad + wl,
+ d_len + fm.height());
+ break;
+
+ case Top:
+
+ r = QRect ( d_xorg - wl / 2,
+ d_yorg - d_majLen - fm.ascent(),
+ d_len + wl,
+ d_majLen + d_vpad + fm.ascent());
+ break;
+
+ case Bottom:
+
+ r = QRect ( d_xorg - wl / 2,
+ d_yorg,
+ d_len + wl,
+ d_majLen + d_vpad + fm.height());
+ break;
+
+ case Round:
+
+ amin = 2880;
+ amax = 0;
+ ar = 0;
+
+ for (i=0; i< d_scldiv.majCnt(); i++)
+ {
+ a = transform(d_scldiv.majMark(i));
+
+ while (a > 2880) a -= 5760;
+ while (a < - 2880) a += 5760;
+
+ ar = qwtAbs(a);
+
+ if (ar < amin) amin = ar;
+ if (ar > amax) amax = ar;
+
+ }
+
+ for (i=0; i< d_scldiv.minCnt(); i++)
+ {
+ a = transform(d_scldiv.majMark(i));
+
+ while (a > 2880) a -= 5760;
+ while (a < - 2880) a += 5760;
+
+ ar = qwtAbs(a);
+
+ if (ar < amin) amin = ar;
+ if (ar > amax) amax = ar;
+ }
+
+ arc = double(amin) / 16.0 * M_PI / 180.0;
+ r.setTop(qwtInt(d_yCenter - (d_radius + double(d_majLen + d_vpad)) * cos(arc))
+ + fm.ascent() );
+
+ arc = double(amax) / 16.0 * M_PI / 180.0;
+ r.setBottom(qwtInt(d_yCenter - (d_radius + double(d_majLen + d_vpad)) * cos(arc))
+ + fm.height() );
+
+ wmax = d_len + d_majLen + d_hpad + wl;
+
+ r.setLeft(d_xorg - d_majLen - d_hpad - wl);
+ r.setWidth(d_len + 2*(d_majLen + d_hpad + wl));
+ break;
+ }
+
+ return r;
+
+}
+
+//------------------------------------------------------------
+//
+//.F ScaleDraw::setAngleRange
+// Adjust the baseline circle segment for round scales.
+//
+//.u Syntax
+//.f void ScaleDraw::setAngleRange(double angle1, double angle2)
+//
+//.u Parameters
+//.p double angle1, double angle2
+// boundaries of the angle interval in degrees.
+//
+//.u Description
+// The baseline will be drawn from min(angle1,angle2) to max(angle1, angle2).
+// The settings have no effect if the scale orientation is not set to
+// ScaleDraw::Round. The default setting is [ -135, 135 ].
+// An angle of 0 degrees corresponds to the 12 o'clock position,
+// and positive angles count in a clockwise direction.
+//
+//.u Note
+//.i
+// -- The angle range is limited to [-360, 360] degrees. Angles exceeding
+// this range will be clipped.
+// -- For angles more than 359 degrees above or below min(angle1, angle2),
+// scale marks will not be drawn.
+// -- If you need a counterclockwise scale, use @QwtScaleDiv::setRange (1)@
+// or @QwtScaleDiv::setRange (2)@.
+//------------------------------------------------------------
+void ScaleDraw::setAngleRange(double angle1, double angle2)
+{
+ int amin, amax;
+
+ angle1 = qwtLim(angle1, -360.0, 360.0);
+ angle2 = qwtLim(angle2, -360.0, 360.0);
+ amin = int(rint(qwtMin(angle1, angle2) * 16.0));
+ amax = int(rint(qwtMax(angle1, angle2) * 16.0));
+
+ if (amin == amax)
+ {
+ amin -= 1;
+ amax += 1;
+ }
+
+ d_minAngle = amin;
+ d_maxAngle = amax;
+ setIntRange(d_minAngle, d_maxAngle);
+
+}
+
+
+//------------------------------------------------------------
+//
+//.F ScaleDraw::setLabelFormat
+// Set the number format for the major scale labels
+//
+//.u Syntax
+//.f void ScaleDraw::setLabelFormat(char f, int prec)
+//
+//.u Parameters
+//.p char f -- format character
+// int prec -- precision
+//
+//.u Description
+// Format character and precision have the same meaning as for the
+// QString class.
+//
+//.u See also
+// QString::setNum in the Qt manual
+//
+//------------------------------------------------------------
+void ScaleDraw::setLabelFormat(char f, int prec)
+{
+ d_fmt = f;
+ d_prec = prec;
+}
+
+//------------------------------------------------------------
+//
+//.F ScaleDraw::maxLabelWidth
+// Return the maximum width of a label
+//
+//.u Syntax
+//.f int ScaleDraw::maxLabelWidth(QPainter *p, int worst)
+//
+//.u Parameters
+//.p QPainter *p -- painter
+// int worst -- If TRUE, take the worst case. If FALSE, take
+// the actual width of the largest label.
+//
+//------------------------------------------------------------
+int ScaleDraw::maxLabelWidth(QPainter *p, int worst) const
+{
+
+ int i,rv = 0;
+ double val;
+ QString s;
+
+
+ QFontMetrics fm = p->fontMetrics();
+
+ if (worst) // worst case
+ {
+ s.setNum(WorstCase, d_fmt, d_prec);
+ rv = fm.width(s);
+ }
+ else // actual width
+ {
+ for (i=0;i<d_scldiv.majCnt(); i++)
+ {
+ val = d_scldiv.majMark(i);
+ // correct rounding errors if val = 0
+ if ((!d_scldiv.logScale()) && (qwtAbs(val) < step_eps * qwtAbs(d_scldiv.majStep())))
+ val = 0.0;
+ s.setNum(val, d_fmt, d_prec);
+ rv = qwtMax(rv,fm.width(s));
+ }
+ }
+
+
+ return rv;
+
+}
+
+
+//------------------------------------------------------------
+//
+//.F ScaleDraw::scaleDiv
+// Return the scale division
+//
+//.u Syntax
+//.f const QwtScaleDiv & ScaleDraw::scaleDiv() const
+//
+//.u See also
+// @^QwtScaleDiv@
+//------------------------------------------------------------
+
+//------------------------------------------------------------
+//
+//.F ScaleDraw::orientation
+// Return the orientation
+//
+//.u Syntax
+//.f int ScaleDraw::orientation() const
+//
+//.u See also
+// @ScaleDraw::setGeometry@
+//
+//------------------------------------------------------------
+
+
+
+
+
+
+
+
+
+
+
diff --git a/muse2/muse/widgets/scldraw.h b/muse2/muse/widgets/scldraw.h
new file mode 100644
index 00000000..8ba85600
--- /dev/null
+++ b/muse2/muse/widgets/scldraw.h
@@ -0,0 +1,89 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: scldraw.h,v 1.1.1.1 2003/10/27 18:55:08 wschweer Exp $
+//
+// Copyright (C) 1997 Josef Wilgen
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2,
+// as published by the Free Software Foundation.
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SCLDRAW_H__
+#define __SCLDRAW_H__
+
+#include <qglobal.h>
+#include <qstring.h>
+#include "dimap.h"
+#include "scldiv.h"
+#include <qfont.h>
+#include <qrect.h>
+#include <qcolor.h>
+
+class QPainter;
+class AutoScale;
+
+class ScaleDraw : public DiMap {
+ public:
+ enum OrientationX { Bottom, Top, Left, Right, Round };
+
+ private:
+ ScaleDiv d_scldiv;
+ static const int minLen;
+ OrientationX d_orient;
+
+ int d_xorg;
+ int d_yorg;
+ int d_len;
+
+ int d_hpad;
+ int d_vpad;
+
+ int d_medLen;
+ int d_majLen;
+ int d_minLen;
+
+ int d_minAngle;
+ int d_maxAngle;
+
+ double d_xCenter;
+ double d_yCenter;
+ double d_radius;
+
+ char d_fmt;
+ int d_prec;
+
+ void drawTick(QPainter *p, double val, int len) const;
+ void drawBackbone(QPainter *p) const;
+ void drawLabel(QPainter *p, double val) const;
+
+ public:
+
+ ScaleDraw();
+
+ void setScale(const ScaleDiv &s);
+ void setScale(double vmin, double vmax, int maxMajIntv, int maxMinIntv,
+ double step = 0.0, int logarithmic = 0);
+ void setGeometry(int xorigin, int yorigin, int length, OrientationX o);
+ void setAngleRange(double angle1, double angle2);
+ void setLabelFormat(char f, int prec);
+
+ const ScaleDiv& scaleDiv() const { return d_scldiv; }
+ OrientationX orientation() const { return d_orient; }
+ QRect maxBoundingRect(QPainter *p) const;
+ int maxWidth(QPainter *p, bool worst = TRUE) const;
+ int maxHeight(QPainter *p) const;
+ int maxLabelWidth(QPainter *p, int worst = TRUE) const;
+ void draw(QPainter *p) const;
+ };
+
+#endif
+
+
+
+
+
+
+
diff --git a/muse2/muse/widgets/sclif.cpp b/muse2/muse/widgets/sclif.cpp
new file mode 100644
index 00000000..8740bc53
--- /dev/null
+++ b/muse2/muse/widgets/sclif.cpp
@@ -0,0 +1,205 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: sclif.cpp,v 1.1.1.1 2003/10/27 18:55:10 wschweer Exp $
+
+// Copyright (C) 1997 Josef Wilgen
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2,
+// as published by the Free Software Foundation.
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "sclif.h"
+
+// ScaleIf - An interface class for widgets containing a scale
+//
+// This interface class is used to provide classes
+// with a protected ScaleDraw member and a public
+// interface to access that scale.
+//
+// The primary purpose of this class is to define
+// a common interface for classes which are supposed to
+// contain a ScaleDraw class. It provides a protected
+// ScaleDraw member
+// called d_scale and a couple of public member functions
+// which allow direct but restricted access
+// to this scale by the user.
+// Widgets derived from this class have
+// to implement the member function scaleChange(),
+// which is called to notify changes of the
+// scale parameters and usually requires repainting or
+// resizing respectively.
+// In general, a class derived from ScaleIf is
+// expected to manage the division and the position of its scale internally
+// when no user-defined scale is set. It should take the d_maxMinor
+// and d_maxMajor members into account, which can be set by the user.
+// An implementation can check if a user-defined scale is set by calling the
+// @ScaleIf::hasUserScale@ member.
+
+//------------------------------------------------------------
+// ScaleIf::ScaleIf
+// Construct a ScaleIf instance
+//
+// Syntax
+// ScaleIf::ScaleIf()
+//------------------------------------------------------------
+
+ScaleIf::ScaleIf()
+ {
+ d_userScale = FALSE;
+ d_maxMajor = 5;
+ d_maxMinor = 3;
+ d_scale.setScale(0.0,100.0,d_maxMajor, d_maxMinor);
+ }
+
+//------------------------------------------------------------
+// ScaleIf::setScale (1)
+// Specify a user-defined scale.
+//
+// Syntax
+// void ScaleIf::setScale(double vmin, double vmax, int logarithmic)
+//
+// Parameters
+// double vmin, double vmax -- boundary values
+// int logarithmic -- If != 0, Build a logarithmic scale
+//
+// Description
+// By default, the widget is supposed to control the range of its scale
+// automatically, but sometimes it is desirable to have a user-defined
+// scale which is not in sync with
+// the widget's range, e.g. if a logarithmic scale is needed
+// (sliders don't support that) or if the scale is required
+// to have a fixed range (say 0...100%), independent of the
+// widget's range.
+//
+// See also
+// @ScaleIf::autoScale@
+//------------------------------------------------------------
+
+void ScaleIf::setScale(double vmin, double vmax, int logarithmic)
+ {
+ setScale(vmin,vmax,0.0,logarithmic);
+ }
+
+//------------------------------------------------------------
+// ScaleIf::setScale (2)
+// Specify a user-defined scale.
+//
+// Syntax
+// void ScaleIf::setScale(double vmin, double vmax, int logarithmic)
+//
+// Parameters
+// double vmin, double vmax -- interval boundaries
+// int step -- major step size
+// int logarithmic -- If != 0, build a logarithmic scale
+//
+// Description
+// By default, the widget is supposed to control the range of its scale
+// automatically, but sometimes it is desirable to have a user-defined
+// scale which is not in sync with
+// the widget's range, e.g. if a logarithmic scale is needed
+// (sliders don't support that) or if the scale is required
+// to have a fixed range (say 0...100%), independent of the
+// widget's range.
+//------------------------------------------------------------
+
+void ScaleIf::setScale(double vmin, double vmax, double step, int logarithmic)
+ {
+ ScaleDiv oldscl(d_scale.scaleDiv());
+
+ d_scale.setScale(vmin, vmax, d_maxMajor, d_maxMinor, step, logarithmic);
+ d_userScale = TRUE;
+ if (oldscl != d_scale.scaleDiv())
+ scaleChange();
+ }
+
+//------------------------------------------------------------
+// Scale::setScale
+// Assign a user-defined scale division
+//
+// Syntax
+// void Scale::setScale(const ScaleDiv &s)
+//
+// Parameters
+// const ScaleDiv &s -- scale division
+//------------------------------------------------------------
+
+void ScaleIf::setScale(const ScaleDiv &s)
+ {
+ d_scale.setScale(s);
+ scaleChange();
+ }
+
+//------------------------------------------------------------
+// ScaleIf::autoScale
+// Advise the widget to control the scale range
+// internally.
+// Syntax
+// void ScaleIf::autoScale
+//
+// Description
+// Autoscaling is on by default.
+//------------------------------------------------------------
+
+void ScaleIf::autoScale()
+ {
+ if (!d_userScale) {
+ d_userScale = FALSE;
+ scaleChange();
+ }
+ }
+
+//------------------------------------------------------------
+// ScaleIf::setScaleMaxMajor
+// Set the maximum number of major tick intervals.
+//
+// Syntax
+// void ScaleIf::setScaleMaxMajor(int ticks)
+//
+// Parameters
+// int ticks -- maximal number of major ticks.
+//
+// Description
+// The scale's major ticks are calculated automatically such that
+// the number of major intervals does not exceed <ticks>.
+// The default value is 5.
+//------------------------------------------------------------
+
+void ScaleIf::setScaleMaxMajor(int ticks)
+ {
+ if (ticks != d_maxMajor) {
+ d_maxMajor = ticks;
+ d_scale.setScale(d_scale.scaleDiv().lBound(), d_scale.scaleDiv().hBound(),
+ d_maxMajor, d_maxMinor, 0.0,d_scale.scaleDiv().logScale());
+ scaleChange();
+ }
+ }
+
+//------------------------------------------------------------
+// ScaleIf::setScaleMaxMinor
+// Set the maximum number of minor tick intervals
+//
+// Syntax
+// void ScaleIf::setScaleMaxMinor(int ticks)
+//
+// Parameters
+// int ticks
+//
+// Description
+// The scale's minor ticks are calculated automatically such that
+// the number of minor intervals does not exceed <ticks>.
+// The default value is 3.
+//------------------------------------------------------------
+
+void ScaleIf::setScaleMaxMinor(int ticks)
+ {
+ if ( ticks != d_maxMinor) {
+ d_maxMinor = ticks;
+ d_scale.setScale(d_scale.scaleDiv().lBound(), d_scale.scaleDiv().hBound(),
+ d_maxMajor, d_maxMinor, 0.0, d_scale.scaleDiv().logScale());
+ scaleChange();
+ }
+ }
+
diff --git a/muse2/muse/widgets/sclif.h b/muse2/muse/widgets/sclif.h
new file mode 100644
index 00000000..86c0ecb6
--- /dev/null
+++ b/muse2/muse/widgets/sclif.h
@@ -0,0 +1,51 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: sclif.h,v 1.1.1.1 2003/10/27 18:54:33 wschweer Exp $
+
+// Copyright (C) 1997 Josef Wilgen
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2,
+// as published by the Free Software Foundation.
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SCALE_IF_H__
+#define __SCALE_IF_H__
+
+#include <qglobal.h>
+#include "scldraw.h"
+
+//---------------------------------------------------------
+// ScaleIf
+//---------------------------------------------------------
+
+class ScaleIf
+ {
+ bool d_userScale;
+
+ protected:
+ ScaleDraw d_scale;
+ int d_maxMajor;
+ int d_maxMinor;
+ bool hasUserScale() {return d_userScale;}
+ virtual void scaleChange() = 0;
+
+ public:
+ ScaleIf();
+ virtual ~ScaleIf() {};
+
+ void setScale (double vmin, double vmax, int logarithmic = 0);
+ void setScale (double vmin, double vmax, double step, int logarithmic = 0);
+ void setScale(const ScaleDiv &s);
+ void setScaleMaxMajor( int ticks);
+ void setScaleMaxMinor( int ticks);
+ void autoScale();
+
+ int scaleMaxMinor() const {return d_maxMinor;}
+ int scaleMaxMajor() const {return d_maxMinor;}
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/scrollscale.cpp b/muse2/muse/widgets/scrollscale.cpp
new file mode 100644
index 00000000..1ff22c6a
--- /dev/null
+++ b/muse2/muse/widgets/scrollscale.cpp
@@ -0,0 +1,499 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: scrollscale.cpp,v 1.2.2.2 2009/11/04 17:43:25 lunar_shuttle Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <cmath>
+#include <qslider.h>
+#include <qscrollbar.h>
+#include <qlayout.h>
+#include <qtoolbutton.h>
+#include <qtooltip.h>
+#include <qlabel.h>
+//Added by qt3to4:
+#include <Q3BoxLayout>
+#include <QResizeEvent>
+
+// #include "globals.h"
+#include "scrollscale.h"
+#include "icons.h"
+
+//---------------------------------------------------------
+// setScale
+// "val" - slider value in range 0-1024
+//---------------------------------------------------------
+
+void ScrollScale::setScale ( int val )
+{
+ int off = offset();
+ if ( invers )
+ val = 1024 - val;
+ double min, max;
+ if ( scaleMin < 0 )
+ min = 1.0/ ( -scaleMin );
+ else
+ min = double ( scaleMin );
+
+ if ( scaleMax < 0 )
+ max = 1.0/ ( -scaleMax );
+ else
+ max = double ( scaleMax );
+
+ double diff = max-min;
+ double fkt = double ( val ) /1024.0;
+ double v = ( pow ( logbase, fkt )-1 ) / ( logbase-1 );
+ double scale;
+ if ( invers )
+ scale = max - v * diff;
+ else
+ scale = min + v * diff;
+
+ if ( scale < 1.0 )
+ scaleVal = - ( int ( 1.0 / scale ) );
+ else
+ scaleVal = int ( scale );
+ if ( scaleVal == -1 ) // nur so
+ scaleVal = 1;
+
+#if 0
+ if ( scaleMax > scaleMin )
+ {
+ if ( scale < scaleMin )
+ scale = scaleMin;
+ else if ( scale > scaleMax )
+ scale = scaleMax;
+ }
+ else
+ {
+ if ( scale < scaleMax )
+ scale = scaleMax;
+ else if ( scale > scaleMin )
+ scale = scaleMin;
+ }
+#endif
+
+ emit scaleChanged ( scaleVal );
+ if ( !noScale )
+ setRange ( minVal, maxVal );
+
+ int i = ( scroll->orientation() == Qt::Horizontal ) ? width() : height();
+ int pos, pmax;
+ if ( scaleVal < 1 )
+ {
+ pos = ( off-scaleVal/2 ) / ( -scaleVal );
+ pmax = ( maxVal-scaleVal-1 ) / ( -scaleVal ) - i;
+ }
+ else
+ {
+ pos = off * scaleVal;
+ pmax = maxVal * scaleVal - i;
+ }
+ if(pos > pmax)
+ pos = pmax;
+ setPos(pos);
+}
+
+//---------------------------------------------------------
+// setMag
+//---------------------------------------------------------
+
+void ScrollScale::setMag ( int cs )
+{
+ scale->setValue ( cs );
+ setScale ( cs );
+}
+
+//---------------------------------------------------------
+// setRange
+// min,max ticks
+//---------------------------------------------------------
+
+void ScrollScale::setRange ( int min, int max )
+{
+// if ((min != minVal) && (max != maxVal))
+// return;
+ minVal = min;
+ maxVal = max;
+ int i = ( scroll->orientation() == Qt::Horizontal ) ? width() : height();
+
+ if ( !noScale )
+ {
+ if ( scaleVal < 1 )
+ {
+ min = minVal / ( -scaleVal );
+ max = ( maxVal-scaleVal-1 ) / ( -scaleVal ) - i;
+ }
+ else
+ {
+ min = minVal * scaleVal;
+ max = maxVal * scaleVal - i;
+ }
+ }
+ else
+ max -= i;
+ if ( max < 0 )
+ max = 0;
+ if ( min < 0 )
+ min = 0;
+ if ( min > max )
+ max = min;
+
+ scroll->setRange ( min, max );
+
+ // qt doesn't check this...
+ if ( scroll->value() < min )
+ scroll->setValue ( min );
+ if ( scroll->value() > max )
+ scroll->setValue ( max );
+ scroll->setSteps ( 20, i );
+}
+
+//---------------------------------------------------------
+// setPos
+// pos in pixel
+//---------------------------------------------------------
+
+void ScrollScale::setPos ( unsigned pos )
+{
+
+ scroll->setValue ( pos );
+}
+
+//---------------------------------------------------------
+// setPosNoLimit
+// pos in pixel
+//---------------------------------------------------------
+
+void ScrollScale::setPosNoLimit ( unsigned pos )
+{
+ //printf ( "ScrollScale::setPosNoLimit pos:%d scaleVal:%d offset ticks:%d\n", pos, scaleVal, pos2offset ( pos ) );
+
+ if((int)pos > scroll->maxValue())
+ scroll->setMaxValue(pos);
+ scroll->setValue(pos);
+}
+
+//---------------------------------------------------------
+// resizeEvent
+//---------------------------------------------------------
+
+void ScrollScale::resizeEvent ( QResizeEvent* )
+{
+ setScale ( scale->value() );
+}
+
+//---------------------------------------------------------
+// ScrollScale
+//---------------------------------------------------------
+
+ScrollScale::ScrollScale ( int s1, int s2, int cs, int max_, Qt::Orientation o,
+ QWidget* parent, int min_, bool inv, double bas )
+ : QWidget ( parent )
+{
+ noScale = false;
+ _page = 0;
+ _pages = 1;
+ pageButtons = false;
+ showMagFlag = true;
+ scaleMin = s1;
+ scaleMax = s2;
+ minVal = min_;
+ maxVal = max_;
+ up = 0;
+ down = 0;
+ logbase = bas;
+ invers = inv;
+
+ double min, max;
+ if ( scaleMin < 0 )
+ min = 1.0/ ( -scaleMin );
+ else
+ min = double ( scaleMin );
+
+ if ( scaleMax < 0 )
+ max = 1.0/ ( -scaleMax );
+ else
+ max = double ( scaleMax );
+
+ double cmag = ( cs < 0 ) ? ( 1.0/ ( -cs ) ) : double ( cs );
+ double diff = max-min;
+
+ //
+ // search initial value for slider
+ //
+ int cur = 512;
+ int delta = 256;
+ for ( int i = 0; i < 8; ++i )
+ {
+ int tryVal = invers ? 1025 - cur : cur;
+ double fkt = double ( tryVal ) /1024.0;
+ double v = ( pow ( logbase, fkt )-1 ) / ( logbase-1 );
+ double scale = invers ? ( max - v * diff ) : ( min + v * diff );
+ if ( scale == cmag ) // not very likely
+ break;
+ //printf("iteration %d invers:%d soll %f(cur:%d) - ist %f\n", i, invers, scale, cur, cmag);
+ int dd = invers ? -delta : delta;
+ cur += ( scale < cmag ) ? dd : -dd;
+ delta/=2;
+ }
+
+ scale = new QSlider ( 0, 1024, 1, cur, o, this );
+ scroll = new QScrollBar ( o, this );
+ setScale ( cur );
+
+ if ( o == Qt::Horizontal )
+ {
+ box = new Q3BoxLayout ( this, Q3BoxLayout::LeftToRight );
+ scale->setMaximumWidth ( 70 );
+ scroll->setMinimumWidth ( 50 );
+ }
+ else
+ {
+ box = new Q3BoxLayout ( this, Q3BoxLayout::Down );
+ scroll->setMinimumHeight ( 50 );
+ scale->setMaximumHeight ( 70 );
+ }
+ box->addWidget ( scroll, 10 );
+ box->addWidget ( scale, 5 );
+ connect ( scale, SIGNAL ( valueChanged ( int ) ), SLOT ( setScale ( int ) ) );
+ connect ( scale, SIGNAL ( valueChanged ( int ) ), SIGNAL ( lscaleChanged ( int ) ) );
+ connect ( scroll, SIGNAL ( valueChanged ( int ) ), SIGNAL ( scrollChanged ( int ) ) );
+}
+
+//---------------------------------------------------------
+// setPageButtons
+//---------------------------------------------------------
+
+void ScrollScale::setPageButtons ( bool flag )
+{
+ if ( flag == pageButtons )
+ return;
+
+ if ( flag )
+ {
+ if ( up == 0 )
+ {
+ up = new QToolButton ( this );
+ up->setPixmap ( * ( upIcon ) );
+ down = new QToolButton ( this );
+ down->setPixmap ( * ( downIcon ) );
+ pageNo = new QLabel ( this );
+ QString s;
+ s.setNum ( _page+1 );
+ pageNo->setText ( s );
+ QToolTip::add ( down, tr ( "next page" ) );
+ QToolTip::add ( up, tr ( "previous page" ) );
+ QToolTip::add ( pageNo, tr ( "current page number" ) );
+ box->insertWidget ( 1, up );
+ box->insertWidget ( 2, down );
+ box->insertSpacing ( 3, 5 );
+ box->insertWidget ( 4, pageNo );
+ box->insertSpacing ( 5, 5 );
+ connect ( up, SIGNAL ( clicked() ), SLOT ( pageUp() ) );
+ connect ( down, SIGNAL ( clicked() ), SLOT ( pageDown() ) );
+ }
+ up->show();
+ down->show();
+ pageNo->show();
+ if ( _page == ( _pages-1 ) )
+ down->setEnabled ( false );
+ if ( _page == 0 )
+ up->setEnabled ( false );
+ }
+ else
+ {
+ up->hide();
+ down->hide();
+ }
+ pageButtons = flag;
+}
+
+//---------------------------------------------------------
+// showMag
+//---------------------------------------------------------
+
+void ScrollScale::showMag ( bool flag )
+{
+ showMagFlag = flag;
+ if ( flag )
+ scale->show();
+ else
+ scale->hide();
+ box->activate();
+}
+
+//---------------------------------------------------------
+// offset
+//---------------------------------------------------------
+int ScrollScale::offset()
+{
+ return pos2offset ( scroll->value() );
+}
+
+//---------------------------------------------------------
+// pos2offset
+//---------------------------------------------------------
+int ScrollScale::pos2offset ( int pos )
+{
+ if ( scaleVal < 1 )
+ return pos * ( -scaleVal ) + scaleVal/2;
+ else
+ return pos / scaleVal;
+}
+
+//---------------------------------------------------------
+// setOffset
+// val in tick
+//---------------------------------------------------------
+
+void ScrollScale::setOffset ( int val )
+{
+ int i = ( scroll->orientation() == Qt::Horizontal ) ? width() : height();
+ int pos, max;
+
+ if ( scaleVal < 1 )
+ {
+ pos = ( val-scaleVal/2 ) / ( -scaleVal );
+ max = ( maxVal-scaleVal-1 ) / ( -scaleVal ) - i;
+ }
+ else
+ {
+ pos = val * scaleVal;
+ max = maxVal * scaleVal - i;
+ }
+ if ( pos > max )
+ {
+ int min;
+ if ( scaleVal < 1 )
+ {
+ maxVal = ( pos + width() ) * ( -scaleVal );
+ min = ( minVal-scaleVal/2 ) / ( -scaleVal );
+ max = ( maxVal-scaleVal/2 ) / ( -scaleVal ) - i;
+ }
+ else
+ {
+ maxVal = ( pos + width() + scaleVal/2 ) /scaleVal;
+ min = minVal * scaleVal;
+ max = maxVal * scaleVal - i;
+ }
+
+ if ( max < 0 )
+ max = 0;
+ if ( min < 0 )
+ min = 0;
+ if ( min > max )
+ max = min;
+ scroll->setRange ( min, max );
+ }
+
+ setPos ( pos );
+}
+
+//---------------------------------------------------------
+// pageUp
+// goto previous page
+//---------------------------------------------------------
+
+void ScrollScale::pageUp()
+{
+ if ( _page )
+ {
+ --_page;
+ emit newPage ( _page );
+ QString s;
+ s.setNum ( _page+1 );
+ pageNo->setText ( s );
+ if ( _page == 0 )
+ up->setEnabled ( false );
+ if ( _page == ( _pages-2 ) )
+ down->setEnabled ( true );
+ }
+}
+
+//---------------------------------------------------------
+// pageDown
+// goto next page
+//---------------------------------------------------------
+
+void ScrollScale::pageDown()
+{
+ if ( _page + 1 < _pages )
+ {
+ ++_page;
+ emit newPage ( _page );
+ QString s;
+ s.setNum ( _page+1 );
+ pageNo->setText ( s );
+ if ( _page == ( _pages-1 ) )
+ down->setEnabled ( false );
+ if ( _page == 1 )
+ up->setEnabled ( true );
+ }
+}
+
+//---------------------------------------------------------
+// setPages
+//---------------------------------------------------------
+
+void ScrollScale::setPages ( int n )
+{
+ _pages = n;
+ if ( _page >= _pages )
+ {
+ _page = _pages-1;
+ emit newPage ( _page );
+ QString s;
+ s.setNum ( _page+1 );
+ pageNo->setText ( s );
+ }
+ up->setEnabled ( _page );
+ down->setEnabled ( _page < ( _pages-1 ) );
+}
+
+int ScrollScale::pos() const
+{
+ return scroll->value();
+}
+
+int ScrollScale::mag() const
+{
+ return scale->value();
+}
+
+/**
+ * Hardcoded hackish function that corresponds to the values used for the scrollscales in PianoRoll and DrumEditor
+ * since I couldn't easily create any inverse function from the [0,1024]-range to detect where a zoom actually occurs
+ * (mg)
+ */
+int ScrollScale::getQuickZoomLevel(int mag)
+{
+ if (mag == 0)
+ return 0;
+
+ for (int i=0; i<24; i++) {
+ int val1 = ScrollScale::convertQuickZoomLevelToMag(i);
+ int val2 = ScrollScale::convertQuickZoomLevelToMag(i + 1);
+ if (mag > val1 && mag <= val2)
+ return i + 1;
+ }
+
+ return -1;
+
+}
+
+/**
+ * Function returning the boundary values for a zoom change, hardcoded corresponding to the values used in PianoRoll
+ * and DrumEditor
+ */
+int ScrollScale::convertQuickZoomLevelToMag(int zoomlevel)
+{
+ int vals[] = { 0, 1, 15, 30, 46, 62, 80, 99, 119, 140, 163,
+ 187, 214, 242, 274, 308, 346, 388, 436, 491, 555, 631,
+ 726, 849, 1024 };
+
+ return vals[zoomlevel];
+}
+
diff --git a/muse2/muse/widgets/scrollscale.h b/muse2/muse/widgets/scrollscale.h
new file mode 100644
index 00000000..572e5906
--- /dev/null
+++ b/muse2/muse/widgets/scrollscale.h
@@ -0,0 +1,90 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: scrollscale.h,v 1.2.2.3 2009/11/04 17:43:26 lunar_shuttle Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SCROLLSCALE_H__
+#define __SCROLLSCALE_H__
+
+#include <qwidget.h>
+#include <qslider.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <Q3BoxLayout>
+#include <QLabel>
+
+// class QSlider;
+class QScrollBar;
+class Q3BoxLayout;
+class QToolButton;
+class QLabel;
+
+//---------------------------------------------------------
+// ScrollScale
+//---------------------------------------------------------
+
+class ScrollScale : public QWidget {
+ QSlider* scale;
+ QScrollBar* scroll;
+ int minVal, maxVal;
+ int scaleVal, scaleMin, scaleMax;
+ bool showMagFlag;
+ Q3BoxLayout* box;
+ bool noScale;
+ bool pageButtons;
+ int _page;
+ int _pages;
+ QToolButton* up;
+ QToolButton* down;
+ QLabel* pageNo;
+ bool invers;
+ double logbase;
+
+ virtual void resizeEvent(QResizeEvent*);
+ Q_OBJECT
+
+ private slots:
+ void pageUp();
+ void pageDown();
+
+ public slots:
+ void setPos(unsigned);
+ void setPosNoLimit(unsigned);
+ void setMag(int);
+ void setOffset(int val);
+ void setScale(int);
+
+ signals:
+ void scaleChanged(int);
+ void lscaleChanged(int);
+ void scrollChanged(int);
+ void newPage(int);
+
+ public:
+ ScrollScale(int, int, int, int max, Qt::Orientation,
+ QWidget*, int min = 0, bool i=false, double vv = 10.0);
+ int xmag() const { return scale->value(); }
+ void setXmag(int val) { scale->setValue(val); }
+ void setRange(int, int);
+ void showMag(bool);
+ void setNoScale(bool flag) { noScale = flag; }
+ void setPageButtons(bool flag);
+ void setPage(int n) { _page = n; }
+ int page() const { return _page; }
+ int pages() const { return _pages; }
+ void setPages(int n);
+ int pos() const;
+ int mag() const;
+ int getScaleValue() const { return scaleVal; }
+ void range(int* b, int* e) const { *b = minVal; *e = maxVal; }
+
+ int offset();
+ int pos2offset(int pos);
+ static int getQuickZoomLevel(int mag);
+ static int convertQuickZoomLevelToMag(int zoomlvl);
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/section.h b/muse2/muse/widgets/section.h
new file mode 100644
index 00000000..7aaa4778
--- /dev/null
+++ b/muse2/muse/widgets/section.h
@@ -0,0 +1,19 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: section.h,v 1.1.1.1 2003/10/27 18:54:27 wschweer Exp $
+// (C) Copyright 2002 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SECTION_H__
+#define __SECTION_H__
+
+struct Section {
+ int offset;
+ unsigned len;
+ int voff;
+ int val;
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/shortcutcapturedialog.cpp b/muse2/muse/widgets/shortcutcapturedialog.cpp
new file mode 100644
index 00000000..c33b32bf
--- /dev/null
+++ b/muse2/muse/widgets/shortcutcapturedialog.cpp
@@ -0,0 +1,87 @@
+//
+// C++ Implementation: shortcutcapturedialog
+//
+// Description:
+// Dialog window for capturing keyboard shortcuts
+//
+// Author: Mathias Lundgren <lunar_shuttle@users.sourceforge.net>, (C) 2003
+//
+// Copyright: Mathias Lundgren (lunar_shuttle@users.sourceforge.net) (C) 2003
+//
+//
+#include "shortcutcapturedialog.h"
+#include "shortcuts.h"
+#include <qkeysequence.h>
+#include <qlabel.h>
+#include <qevent.h>
+#include <qpushbutton.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+
+ShortcutCaptureDialog::ShortcutCaptureDialog(QWidget* parent, const char* name, int index)
+ : ShortcutCaptureDialogBase(parent, name, true)
+ {
+ QKeySequence q = QKeySequence(shortcuts[index].key);
+ oshrtLabel->setText(q);
+ connect(okButton, SIGNAL( clicked() ), this, SLOT( apply() ) );
+ connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancel()));
+ shortcutindex = index;
+ grabKeyboard();
+ okButton->setText(tr("Ok"));
+ cancelButton->setText(tr("Cancel"));
+ }
+
+ShortcutCaptureDialog::~ShortcutCaptureDialog()
+ {
+ releaseKeyboard();
+ }
+
+void ShortcutCaptureDialog::keyPressEvent(QKeyEvent* e)
+ {
+ bool shift, alt, ctrl, conflict = false, realkey = false;
+ QString msgString = "";
+ int temp_key;
+ shift = e->state() & Qt::ShiftModifier;
+ ctrl = e->state() & Qt::ControlModifier;
+ alt = e->state() & Qt::AltModifier;
+ //printf("Key total: %d, alt: %d, ctrl: %d shift: %d\n",e->key(), alt, ctrl, shift);
+ temp_key = e->key();
+ temp_key += (shift ? Qt::SHIFT : 0);
+ temp_key += (ctrl ? Qt::CTRL : 0);
+ temp_key += (alt ? Qt::ALT : 0);
+ //printf("Final key assembled: %d\n",temp_key);
+
+ // Check if this is a "real" key that completes a valid shortcut:
+ int k = e->key();
+ if (k < 256 || k == Qt::Key_Enter || k == Qt::Key_Return || (k >= Qt::Key_F1 && k <= Qt::Key_F12) || k == Qt::Key_Home || k == Qt::Key_PageUp
+ || k == Qt::Key_PageDown || k == Qt::Key_End || k == Qt::Key_Insert || k == Qt::Key_Delete) {
+ key = temp_key;
+ realkey = true;
+ QKeySequence q = QKeySequence(key);
+ QString keyString = q;
+ if (keyString != QString::null)
+ nshrtLabel->setText(q);
+
+ // Check against conflicting shortcuts
+ for (int i=0; i < SHRT_NUM_OF_ELEMENTS; i++) {
+ if (shortcuts[i].key == key && (shortcuts[i].type & (shortcuts[shortcutindex].type | GLOBAL_SHRT | INVIS_SHRT))) {
+ msgString = tr("Shortcut conflicts with ") + QString(shortcuts[i].descr);
+ conflict = true;
+ break;
+ }
+ }
+ }
+ messageLabel->setText(msgString);
+ okButton->setEnabled(conflict == false && realkey);
+ if (!realkey)
+ nshrtLabel->setText(tr("Undefined"));
+
+
+ }
+
+void ShortcutCaptureDialog::apply()
+ {
+ //return the shortcut to configurator widget:
+ done(key);
+ }
+
diff --git a/muse2/muse/widgets/shortcutcapturedialog.h b/muse2/muse/widgets/shortcutcapturedialog.h
new file mode 100644
index 00000000..5a16a90f
--- /dev/null
+++ b/muse2/muse/widgets/shortcutcapturedialog.h
@@ -0,0 +1,35 @@
+//
+// C++ Interface: shortcutcapturedialog
+//
+// Description:
+// Dialog window for capturing keyboard shortcuts
+//
+// Author: Mathias Lundgren <lunar_shuttle@users.sourceforge.net>, (C) 2003
+//
+// Copyright: Mathias Lundgren (lunar_shuttle@users.sourceforge.net) (C) 2003
+//
+//
+
+#include "shortcuts.h"
+#include "filedialog.h"
+#include "shortcutcapturedialogbase.h"
+//Added by qt3to4:
+#include <QKeyEvent>
+
+class ShortcutCaptureDialog : public ShortcutCaptureDialogBase
+ {
+ Q_OBJECT
+ private:
+ int shortcutindex;
+ void keyPressEvent(QKeyEvent* e);
+ int key;
+
+ private slots:
+ void apply();
+ void cancel() { reject(); };
+
+ public:
+ ShortcutCaptureDialog(QWidget* parent, const char* name = 0, int index=0);
+ ~ShortcutCaptureDialog();
+ };
+
diff --git a/muse2/muse/widgets/shortcutcapturedialogbase.ui b/muse2/muse/widgets/shortcutcapturedialogbase.ui
new file mode 100644
index 00000000..031c86e1
--- /dev/null
+++ b/muse2/muse/widgets/shortcutcapturedialogbase.ui
@@ -0,0 +1,134 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>ShortcutCaptureDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>ShortcutCaptureDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>323</width>
+ <height>285</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Enter shortcut sequence</string>
+ </property>
+ <property name="modal">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>descrLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Press keys to enter shortcut sequence!</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>messageLabel</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>oshrtTextLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Old shortcut:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>oshrtLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Undefined</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>nshrtTextLabel</cstring>
+ </property>
+ <property name="text">
+ <string>New shortcut:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>nshrtLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Undefined</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/shortcutconfig.cpp b/muse2/muse/widgets/shortcutconfig.cpp
new file mode 100644
index 00000000..b3288e6d
--- /dev/null
+++ b/muse2/muse/widgets/shortcutconfig.cpp
@@ -0,0 +1,115 @@
+//
+// C++ Implementation: shortcutconfig
+//
+// Description:
+// Dialog for configuring keyboard shortcuts
+//
+// Author: Mathias Lundgren <lunar_shuttle@users.sourceforge.net>, (C) 2003
+//
+// Copyright: Mathias Lundgren (lunar_shuttle@users.sourceforge.net) (C) 2003
+//
+//
+#include <qpushbutton.h>
+#include <qkeysequence.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+#include "shortcutconfig.h"
+#include "shortcutcapturedialog.h"
+#include "shortcuts.h"
+
+ShortcutConfig::ShortcutConfig(QWidget* parent, const char* name)
+ : ShortcutConfigBase(parent, name, true)
+ {
+ connect(cgListView, SIGNAL(selectionChanged(Q3ListViewItem* )),
+ this, SLOT(categorySelChanged(Q3ListViewItem*)));
+ connect(scListView, SIGNAL(selectionChanged(Q3ListViewItem* )),
+ this, SLOT(shortcutSelChanged(Q3ListViewItem*)));
+ connect(defineButton, SIGNAL(pressed()), this, SLOT(assignShortcut()));
+ connect(clearButton, SIGNAL(pressed()), this, SLOT(clearShortcut()));
+ connect(applyButton, SIGNAL(pressed()), this, SLOT(assignAll()));
+
+ current_category = ALL_SHRT;
+ cgListView->setSorting(SHRT_CATEGORY_COL, -1);
+ _config_changed = false;
+
+ //Fill up category listview:
+ SCListViewItem* newItem;
+ for (int i=0; i < SHRT_NUM_OF_CATEGORIES; i++) {
+ newItem = new SCListViewItem(cgListView, i);
+ newItem->setText(SHRT_CATEGORY_COL, shortcut_category[i].name);
+ cgListView->insertItem(newItem);
+ }
+ updateSCListView();
+ }
+
+void ShortcutConfig::updateSCListView(int category)
+ {
+ scListView->clear();
+ SCListViewItem* newItem;
+ for (int i=0; i < SHRT_NUM_OF_ELEMENTS; i++) {
+ if (shortcuts[i].type & category) {
+ newItem = new SCListViewItem(scListView, i);
+ newItem->setText(SHRT_DESCR_COL, tr(shortcuts[i].descr));
+ QKeySequence key = QKeySequence(shortcuts[i].key);
+ newItem->setText(SHRT_SHRTCUT_COL, key);
+ }
+ }
+ }
+
+void ShortcutConfig::assignShortcut()
+ {
+ SCListViewItem* active = (SCListViewItem*) scListView->selectedItem();
+ int shortcutindex = active->getIndex();
+ ShortcutCaptureDialog* sc = new ShortcutCaptureDialog(this, "sccapture", shortcutindex);
+ int key = sc->exec();
+ delete(sc);
+ if (key != Rejected) {
+ shortcuts[shortcutindex].key = key;
+ QKeySequence keySequence = QKeySequence(key);
+ active->setText(SHRT_SHRTCUT_COL, keySequence);
+ _config_changed = true;
+ }
+ clearButton->setEnabled(true);
+ defineButton->setDown(false);
+ }
+
+void ShortcutConfig::clearShortcut()
+ {
+ SCListViewItem* active = (SCListViewItem*) scListView->selectedItem();
+ int shortcutindex = active->getIndex();
+ shortcuts[shortcutindex].key = 0; //Cleared
+ active->setText(SHRT_SHRTCUT_COL,"");
+ clearButton->setDown(false);
+ clearButton->setEnabled(false);
+ _config_changed = true;
+ }
+
+void ShortcutConfig::categorySelChanged(Q3ListViewItem* i)
+ {
+ SCListViewItem* item = (SCListViewItem*) i;
+ current_category = shortcut_category[item->getIndex()].id_flag;
+ updateSCListView(current_category);
+ }
+
+void ShortcutConfig::shortcutSelChanged(Q3ListViewItem* in_item)
+ {
+ defineButton->setEnabled(true);
+ SCListViewItem* active = (SCListViewItem*) in_item;
+ int index = active->getIndex();
+ if (shortcuts[index].key != 0)
+ clearButton->setEnabled(true);
+ else
+ clearButton->setEnabled(false);
+ }
+
+void ShortcutConfig::closeEvent(QCloseEvent* /*e*/) // prevent compiler warning : unused variable
+ {
+ done(_config_changed);
+ }
+
+
+void ShortcutConfig::assignAll()
+ {
+ applyButton->setDown(false);
+ done(_config_changed);
+ }
diff --git a/muse2/muse/widgets/shortcutconfig.h b/muse2/muse/widgets/shortcutconfig.h
new file mode 100644
index 00000000..b1f2857f
--- /dev/null
+++ b/muse2/muse/widgets/shortcutconfig.h
@@ -0,0 +1,61 @@
+//
+// C++ Interface: shortcutconfig
+//
+// Description:
+// Dialog for configuring keyboard shortcuts
+//
+// Author: Mathias Lundgren <lunar_shuttle@users.sourceforge.net>, (C) 2003
+//
+// Copyright: Mathias Lundgren (lunar_shuttle@users.sourceforge.net) (C) 2003
+//
+//
+#ifndef __SHORTCUTCONFIG_H
+#define __SHORTCUTCONFIG_H
+
+#include "shortcutconfigbase.h"
+#include <q3listview.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+
+#define SHRT_CATEGORY_COL 0
+enum
+ {
+ SHRT_DESCR_COL = 0,
+ SHRT_SHRTCUT_COL
+ };
+
+class SCListViewItem : public Q3ListViewItem {
+ private:
+ int index;
+
+ public:
+ SCListViewItem(Q3ListView* parent, int i)
+ : Q3ListViewItem(parent), index(i) { }
+ int getIndex() { return index; }
+
+};
+
+
+class ShortcutConfig : public ShortcutConfigBase {
+ Q_OBJECT
+ private:
+ int current_category;
+ void updateSCListView(int category);
+ void updateSCListView() { updateSCListView(current_category); }
+ void closeEvent(QCloseEvent *e);
+
+ private slots:
+ void categorySelChanged(Q3ListViewItem*);
+ void shortcutSelChanged(Q3ListViewItem*);
+ void assignShortcut();
+ void clearShortcut();
+ void assignAll();
+
+
+ public:
+ ShortcutConfig(QWidget* parent, const char* name = 0);
+ bool _config_changed;
+
+};
+
+#endif
diff --git a/muse2/muse/widgets/shortcutconfigbase.ui b/muse2/muse/widgets/shortcutconfigbase.ui
new file mode 100644
index 00000000..2947106c
--- /dev/null
+++ b/muse2/muse/widgets/shortcutconfigbase.ui
@@ -0,0 +1,207 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>ShortcutConfigBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>ShortcutConfigBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>466</width>
+ <height>403</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Configure Keyboard Shortcuts</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="midLineWidth">
+ <number>0</number>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>3</number>
+ </property>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Shortcut Category</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>cgListView</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>105</width>
+ <height>200</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Description</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Shortcut</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>scListView</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>2</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>170</width>
+ <height>230</height>
+ </size>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>150</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>clearButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Clear</string>
+ </property>
+ <property name="accel">
+ <string>Alt+C</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>defineButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Define</string>
+ </property>
+ <property name="accel">
+ <string>Alt+D</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>applyButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Apply</string>
+ </property>
+ <property name="accel">
+ <string>Alt+A</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/sigedit.cpp b/muse2/muse/widgets/sigedit.cpp
new file mode 100644
index 00000000..4d8c30b4
--- /dev/null
+++ b/muse2/muse/widgets/sigedit.cpp
@@ -0,0 +1,755 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: sigedit.cpp,v 1.1.1.1.2.1 2004/12/28 23:23:51 lunar_shuttle Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "sigedit.h"
+
+#include <stdio.h>
+#include <q3rangecontrol.h>
+#include <qapplication.h>
+#include <qpixmap.h>
+#include <qapplication.h>
+#include <q3valuelist.h>
+#include <qstring.h>
+#include <qstyle.h>
+//Added by qt3to4:
+#include <QTimerEvent>
+#include <QPaintEvent>
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QEvent>
+#include <values.h>
+#include <qpainter.h>
+#include <qtimer.h>
+#include "sig.h"
+
+extern int mtcType;
+
+bool Sig::isValid() const
+{
+ if((z < 1) || (z > 63))
+ return false;
+
+ switch(n)
+ {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 8:
+ case 16:
+ case 32:
+ case 64:
+ case 128:
+ return true;
+ default:
+ return false;
+ }
+}
+
+
+//---------------------------------------------------------
+// NumberSection
+//---------------------------------------------------------
+
+class NumberSection
+ {
+ int selstart;
+ int selend;
+
+ public:
+ NumberSection(int selStart = 0, int selEnd = 0)
+ : selstart(selStart), selend(selEnd ) {}
+ int selectionStart() const { return selstart; }
+ void setSelectionStart(int s) { selstart = s; }
+ int selectionEnd() const { return selend; }
+ void setSelectionEnd( int s ) { selend = s; }
+ int width() const { return selend - selstart; }
+ };
+
+//---------------------------------------------------------
+// SigEditor
+//---------------------------------------------------------
+
+class SigEditor : public QWidget
+ {
+ SigEdit* cw;
+ bool frm;
+ QPixmap *pm;
+ int focusSec;
+ Q3ValueList<NumberSection> sections;
+ int offset;
+
+ int section(const QPoint&);
+
+ protected:
+ void init();
+ bool event(QEvent *e);
+ void resizeEvent(QResizeEvent*);
+ void paintEvent(QPaintEvent*);
+ void mousePressEvent(QMouseEvent *e);
+ void applyFocusSelection() {}
+
+ public:
+ SigEditor(SigEdit* parent, const char* name);
+ ~SigEditor();
+
+ void setControlWidget(SigEdit * widget);
+ SigEdit* controlWidget() const;
+
+ int focusSection() const { return focusSec; }
+
+ bool setFocusSection(int s);
+ void appendSection(const NumberSection& sec);
+ void clearSections();
+ void setSectionSelection(int sec, int selstart, int selend);
+ bool eventFilter(QObject *o, QEvent *e);
+ };
+
+//---------------------------------------------------------
+// section
+//---------------------------------------------------------
+
+int SigEditor::section(const QPoint& pt)
+ {
+ if (pm->isNull())
+ return -1;
+ QPainter p(pm);
+ int fw = frm ? style()->pixelMetric(QStyle::PM_DefaultFrameWidth) : 0;
+ int x = 2 + fw;
+ int y = 0;
+ int w = width();
+ int h = height();
+ for (unsigned int i = 0; i < sections.count(); ++i) {
+ QString s = cw->sectionFormattedText(i);
+ QRect bb = p.boundingRect(x, y, w, h, Qt::AlignVCenter|Qt::AlignLeft, s);
+ int nx = bb.x() + bb.width();
+ if (pt.x() >= x && pt.x() < nx)
+ return i;
+ x = nx;
+ if (i < sections.count()-1) {
+ QString s("/");
+ p.drawText(x, y, w, h, Qt::AlignVCenter|Qt::AlignLeft, s, -1, &bb);
+ x = bb.x() + bb.width();
+ }
+ }
+ return -1;
+ }
+
+//---------------------------------------------------------
+// SigEditor
+//---------------------------------------------------------
+
+SigEditor::SigEditor(SigEdit* parent, const char* name)
+ : QWidget(parent, name)
+ {
+ cw = parent;
+ frm = true;
+ focusSec = 0;
+ pm = new QPixmap;
+ offset = 0;
+ init();
+ }
+
+//---------------------------------------------------------
+// ~SigEditor
+//---------------------------------------------------------
+
+SigEditor::~SigEditor()
+ {
+ delete pm;
+ }
+
+//---------------------------------------------------------
+// init
+//---------------------------------------------------------
+
+void SigEditor::init()
+ {
+ setBackgroundMode(Qt::PaletteBase);
+ setFocusSection(-1);
+ setKeyCompression(true);
+ installEventFilter(this);
+ setFocusPolicy(Qt::WheelFocus);
+ }
+
+//---------------------------------------------------------
+// event
+//---------------------------------------------------------
+
+bool SigEditor::event(QEvent *e)
+ {
+ if (e->type() == QEvent::FocusIn || e->type() == QEvent::FocusOut) {
+ repaint( rect(), false);
+ }
+ else if (e->type() == QEvent::ShortcutOverride) {
+ QKeyEvent* ke = (QKeyEvent*) e;
+ switch (ke->key()) {
+ case Qt::Key_Delete:
+ case Qt::Key_Backspace:
+ case Qt::Key_Up:
+ case Qt::Key_Down:
+ case Qt::Key_Left:
+ case Qt::Key_Right:
+ ke->accept();
+ default:
+ break;
+ }
+ }
+ return QWidget::event(e);
+ }
+
+void SigEditor::resizeEvent(QResizeEvent *e)
+ {
+ pm->resize(e->size());
+ QWidget::resizeEvent(e);
+ }
+
+//---------------------------------------------------------
+// paintEvent
+//---------------------------------------------------------
+
+void SigEditor::paintEvent(QPaintEvent *)
+ {
+ if (pm->isNull())
+ return;
+
+ const QColorGroup & cg = colorGroup();
+ QPainter p(pm);
+ p.setPen(colorGroup().text());
+ QBrush bg = cg.brush(QColorGroup::Base);
+
+ int fw = frm ? style()->pixelMetric(QStyle::PM_DefaultFrameWidth) : 0;
+ int x = 2 + fw;
+ int y = 0;
+ int w = width();
+ int h = height();
+ p.fillRect(0, 0, w, h, bg);
+
+ for (unsigned int i = 0; i < sections.count(); ++i) {
+ QRect bb;
+ QString s = cw->sectionFormattedText(i);
+
+ if (hasFocus() && (int(i) == focusSec)) {
+ QBrush bg = cg.brush(QColorGroup::Highlight);
+ QRect r = p.boundingRect(x, y, w, h, Qt::AlignVCenter|Qt::AlignLeft, s, -1);
+ p.setPen(colorGroup().highlightedText());
+ p.fillRect(r, bg);
+ }
+ else
+ p.setPen(colorGroup().text());
+ p.drawText(x, y, w, h, Qt::AlignVCenter|Qt::AlignLeft, s, -1, &bb);
+ x = bb.x() + bb.width();
+ if (i < sections.count()-1) {
+ QString s("/");
+ p.drawText(x, y, w, h, Qt::AlignVCenter|Qt::AlignLeft, s, -1, &bb);
+ x = bb.x() + bb.width();
+ }
+ }
+ p.end();
+ bitBlt(this, 0, 0, pm);
+ }
+
+//---------------------------------------------------------
+// mousePressEvent
+//---------------------------------------------------------
+
+void SigEditor::mousePressEvent(QMouseEvent *e)
+ {
+ QPoint p(e->pos().x(), 0);
+ int sec = section(p);
+ if (sec != -1) {
+ cw->setFocusSection(sec);
+ repaint(rect(), false);
+ }
+ }
+
+//---------------------------------------------------------
+// eventFilter
+//---------------------------------------------------------
+
+bool SigEditor::eventFilter(QObject *o, QEvent *e)
+ {
+ if (o != this)
+ return false;
+ if (e->type() != QEvent::KeyPress )
+ return false;
+
+ QKeyEvent *ke = (QKeyEvent*)e;
+ switch (ke->key()) {
+ case Qt::Key_Right:
+ if (unsigned(focusSec) <= sections.count()) {
+ if (cw->setFocusSection(focusSec+1))
+ repaint(rect(), false);
+ }
+ return true;
+ case Qt::Key_Left:
+ if (focusSec > 0 ) {
+ if (cw->setFocusSection(focusSec-1))
+ repaint(rect(), false);
+ }
+ return true;
+ case Qt::Key_Up:
+ cw->stepUp();
+ return true;
+ case Qt::Key_Down:
+ cw->stepDown();
+ return true;
+ case Qt::Key_Backspace:
+ case Qt::Key_Delete:
+ cw->removeLastNumber(focusSec);
+ return true;
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ cw->enterPressed();
+ return true;
+ default:
+ QString txt = ke->text();
+ if (!txt.isEmpty() && txt[0] == '/') {
+ // do the same thing as KEY_RIGHT when the user presses the separator key
+ if (focusSec < (signed)(sections.count())) {
+ if (cw->setFocusSection(focusSec+1))
+ repaint(rect(), false);
+ }
+ return true;
+ }
+ int num = txt[0].digitValue();
+
+ //printf("SigEditor::eventFilter num:%d\n", num);
+
+ if (num != -1) {
+ cw->addNumber(focusSec, num);
+ return true;
+ }
+ }
+ return false;
+ }
+
+void SigEditor::appendSection(const NumberSection& sec)
+ {
+ sections.append(sec);
+ }
+void SigEditor::clearSections()
+ {
+ sections.clear();
+ }
+
+//---------------------------------------------------------
+// setSectionSelection
+//---------------------------------------------------------
+
+void SigEditor::setSectionSelection(int secNo, int selstart, int selend)
+ {
+ if (secNo < 0 || secNo > (int)sections.count())
+ return;
+ sections[secNo].setSelectionStart(selstart);
+ sections[secNo].setSelectionEnd(selend);
+ }
+
+//---------------------------------------------------------
+// setFocusSection
+//---------------------------------------------------------
+
+bool SigEditor::setFocusSection(int idx)
+ {
+ if (idx > (int)sections.count()-1 || idx < 0)
+ return false;
+ if (idx != focusSec) {
+ focusSec = idx;
+ applyFocusSelection();
+ return true;
+ }
+ return false;
+ }
+
+//---------------------------------------------------------
+// SigEdit
+//---------------------------------------------------------
+
+SigEdit::SigEdit(QWidget* parent, const char* name)
+ : QWidget(parent, name)
+ {
+ init();
+ updateButtons();
+ }
+
+SigEdit::~SigEdit()
+ {
+ }
+
+//---------------------------------------------------------
+// init
+//---------------------------------------------------------
+
+void SigEdit::init()
+ {
+ ed = new SigEditor(this, "pos editor");
+ controls = new Q3SpinWidget(this, "pos edit controls");
+ controls->setEditWidget(ed);
+ setFocusProxy(ed);
+ connect(controls, SIGNAL(stepUpPressed()), SLOT(stepUp()));
+ connect(controls, SIGNAL(stepDownPressed()), SLOT(stepDown()));
+ connect(this, SIGNAL(valueChanged(int,int)),SLOT(updateButtons()));
+
+ overwrite = false;
+ timerId = 0;
+ typing = false;
+ changed = false;
+ adv = false;
+
+ sec[0].offset = 0;
+ sec[0].len = 2;
+ sec[0].val = 4;
+ sec[0].voff = 0;
+ sec[1].offset = 3;
+ sec[1].len = 3;
+ sec[1].val = 4;
+ sec[1].voff = 0;
+ ed->clearSections();
+ ed->appendSection(NumberSection(0,0));
+ ed->appendSection(NumberSection(0,0));
+ setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
+ }
+
+//---------------------------------------------------------
+// setValue
+//---------------------------------------------------------
+
+void SigEdit::setValue(const Sig& sig)
+ {
+ sec[0].val = sig.z;
+ sec[1].val = sig.n;
+ changed = false;
+ ed->repaint(ed->rect(), false);
+ }
+
+void SigEdit::setValue(const QString& s)
+ {
+ int z, n;
+ sscanf(s.latin1(), "%d/%d", &z, &n);
+ Sig sig(z, n);
+ setValue(sig);
+ }
+
+Sig SigEdit::sig() const
+ {
+ Sig sig(sec[0].val, sec[1].val);
+ return sig;
+ }
+
+bool SigEdit::event(QEvent *e)
+ {
+ if (e->type() == QEvent::FocusOut) {
+ typing = false;
+ if (changed) {
+ emit valueChanged(sig().z, sig().n);
+ changed = false;
+ }
+ }
+ return QWidget::event(e);
+ }
+
+void SigEdit::timerEvent(QTimerEvent *)
+ {
+ overwrite = true;
+ }
+
+//---------------------------------------------------------
+// stepUp
+//---------------------------------------------------------
+
+void SigEdit::stepUp()
+ {
+ bool accepted = false;
+ int secNo = ed->focusSection();
+ int val = sec[secNo].val;
+ if (secNo == 0) {
+ if (val < 63) {
+ ++val;
+ accepted = true;
+ }
+ }
+ else {
+ accepted = true;
+ switch(val) {
+ case 1: val = 2; break;
+ case 2: val = 3; break;
+ case 3: val = 4; break;
+ case 4: val = 8; break;
+ case 8: val = 16; break;
+ case 16: val = 32; break;
+ case 32: val = 64; break;
+ case 64: val = 128; break;
+ case 128: accepted = false; break;
+ }
+ }
+ if (accepted) {
+ setSec(secNo, val);
+ changed = true;
+ emit valueChanged(sec[0].val, sec[1].val);
+ }
+ ed->repaint(ed->rect(), false);
+ }
+
+//---------------------------------------------------------
+// stepDown
+//---------------------------------------------------------
+
+void SigEdit::stepDown()
+ {
+ bool accepted = false;
+ int secNo = ed->focusSection();
+ int val = sec[secNo].val;
+ if (secNo == 0) {
+ if (val > 1) {
+ --val;
+ accepted = true;
+ }
+ }
+ else {
+ accepted = true;
+ switch(val) {
+ case 1: accepted = false; break;
+ case 2: val = 1; break;
+ case 3: val = 2; break;
+ case 4: val = 3; break;
+ case 8: val = 4; break;
+ case 16: val = 8; break;
+ case 32: val = 16; break;
+ case 64: val = 32; break;
+ case 128: val = 64; break;
+ }
+ }
+ if (accepted) {
+ setSec(secNo, val);
+ changed = true;
+ emit valueChanged(sec[0].val, sec[1].val);
+ }
+ ed->repaint(ed->rect(), false);
+ }
+
+//---------------------------------------------------------
+// sectionFormattedText
+// Returns the formatted number for section sec.
+//---------------------------------------------------------
+
+QString SigEdit::sectionFormattedText(int secNo)
+ {
+ QString txt = sectionText(secNo);
+
+ int so = sec[secNo].offset;
+ int len = sec[secNo].len;
+ int eo = so + len;
+
+ if (typing && secNo == ed->focusSection())
+ ed->setSectionSelection(secNo, eo - txt.length(), eo);
+ else
+ ed->setSectionSelection(secNo, so, eo);
+ if (secNo == 0)
+ txt = txt.rightJustify(len, ' ');
+// else
+// txt = txt.leftJustify(len, ' ');
+ return txt;
+ }
+
+//---------------------------------------------------------
+// setFocusSection
+//---------------------------------------------------------
+
+bool SigEdit::setFocusSection(int s)
+ {
+ if (s != ed->focusSection()) {
+ killTimer(timerId);
+ overwrite = true;
+ typing = false;
+ int so = sec[s].offset;
+ int eo = so + sec[s].len;
+ ed->setSectionSelection(s, so, eo);
+ if (changed) {
+ emit valueChanged(sig().z, sig().n);
+ changed = false;
+ }
+ }
+ return ed->setFocusSection(s);
+ }
+
+//---------------------------------------------------------
+// setSec
+//---------------------------------------------------------
+
+void SigEdit::setSec(int secNo, int val)
+ {
+ sec[secNo].val = val;
+ }
+
+//---------------------------------------------------------
+// sectionText
+// Returns the text of section \a sec.
+//---------------------------------------------------------
+
+QString SigEdit::sectionText(int secNo)
+ {
+ return QString::number(sec[secNo].val + sec[secNo].voff);
+ }
+
+//---------------------------------------------------------
+// outOfRange
+// return true if out of range
+//---------------------------------------------------------
+
+bool SigEdit::outOfRange(int secNo, int val) const
+ {
+ if (secNo == 0)
+ return ((val < 1) || (val > 63));
+ switch (val) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 8:
+ case 16:
+ case 32:
+ case 64:
+ case 128:
+ // Changed p3.3.43
+ //return true;
+ return false;
+ default:
+ // Changed p3.3.43
+ //return false;
+ return true;
+ }
+ }
+
+//---------------------------------------------------------
+// addNumber
+//---------------------------------------------------------
+
+void SigEdit::addNumber(int secNo, int num)
+ {
+ if (secNo == -1)
+ return;
+ killTimer(timerId);
+ bool accepted = false;
+ typing = true;
+ int voff = sec[secNo].voff;
+
+ QString txt = sectionText(secNo);
+
+ //printf("SigEdit::addNumber secNo:%d num:%d voff:%d txt:%s\n", secNo, num, voff, txt.latin1());
+
+ if (txt.length() == sec[secNo].len) {
+ //printf("SigEdit::addNumber txt.length() == sec[secNo].len (%d)\n", sec[secNo].len);
+
+ if (!outOfRange(secNo, num - voff)) {
+ //printf("SigEdit::addNumber accepted\n");
+
+ accepted = true;
+ sec[secNo].val = num - voff;
+ }
+ }
+ else {
+ //printf("SigEdit::addNumber txt.length() != sec[secNo].len (%d)\n", sec[secNo].len);
+
+ txt += QString::number(num);
+ int temp = txt.toInt() - voff;
+ if (outOfRange(secNo, temp))
+ {
+ //printf("SigEdit::addNumber not accepted secNo:%d txt:%s temp:%d\n", secNo, txt.latin1(), temp);
+
+ txt = sectionText(secNo);
+ }
+ else {
+ //printf("SigEdit::addNumber accepted\n");
+
+ accepted = true;
+ sec[secNo].val = temp;
+ }
+ if (adv && (txt.length() == sec[secNo].len)) {
+ setFocusSection(ed->focusSection() + 1);
+ }
+ }
+ changed = accepted;
+ if (accepted)
+ emit valueChanged(sig().z, sig().n);
+ timerId = startTimer(qApp->doubleClickInterval()*4);
+ ed->repaint(ed->rect(), false);
+ }
+
+//---------------------------------------------------------
+// removeLastNumber
+//---------------------------------------------------------
+
+void SigEdit::removeLastNumber(int secNo)
+ {
+ if (secNo == -1)
+ return;
+ QString txt = QString::number(sec[secNo].val);
+ txt = txt.mid(0, txt.length() - 1);
+ sec[secNo].val = txt.toInt() - sec[secNo].voff;
+ ed->repaint(ed->rect(), false);
+ }
+
+//---------------------------------------------------------
+// resizeEvent
+//---------------------------------------------------------
+
+void SigEdit::resizeEvent(QResizeEvent *)
+ {
+ controls->resize(width(), height());
+ }
+
+//---------------------------------------------------------
+// sizeHint
+//---------------------------------------------------------
+
+QSize SigEdit::sizeHint() const
+ {
+ QFontMetrics fm(font());
+ int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, this); // ddskrjo
+ int h = fm.height() + fw * 2;
+ int w = 2 + controls->upRect().width() + fw * 4;
+ w += fm.width('9') * 5 + fm.width('/');
+ return QSize(w, h).expandedTo(QApplication::globalStrut());
+ }
+
+//---------------------------------------------------------
+// updateButtons
+//---------------------------------------------------------
+
+void SigEdit::updateButtons()
+ {
+ int secNo = ed->focusSection();
+ int val = sec[secNo].val;
+
+ bool upEnabled;
+ bool downEnabled;
+
+ if (secNo == 0) {
+ upEnabled = val < 63;
+ downEnabled = val > 1;
+ }
+ else {
+ upEnabled = true;
+ downEnabled = true;
+ switch (val) {
+ case 1: downEnabled = false; break;
+ case 128: upEnabled = false; break;
+ }
+ }
+ controls->setUpEnabled(isEnabled() && upEnabled);
+ controls->setDownEnabled(isEnabled() && downEnabled);
+ }
+
+//---------------------------------------------------------
+// enterPressed
+//! emit returnPressed
+//---------------------------------------------------------
+void SigEdit::enterPressed()
+ {
+ emit returnPressed();
+ }
diff --git a/muse2/muse/widgets/sigedit.h b/muse2/muse/widgets/sigedit.h
new file mode 100644
index 00000000..f600c44f
--- /dev/null
+++ b/muse2/muse/widgets/sigedit.h
@@ -0,0 +1,90 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: sigedit.h,v 1.1.1.1.2.1 2004/12/28 23:23:51 lunar_shuttle Exp $
+// (C) Copyright 2002 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SIGEDIT_H__
+#define __SIGEDIT_H__
+
+#include <qwidget.h>
+#include <qstring.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QTimerEvent>
+#include <QEvent>
+
+class SigEditor;
+class Q3SpinWidget;
+
+struct Sig {
+ int z;
+ int n;
+ public:
+ Sig(int _z, int _n) : z(_z), n(_n) {}
+ bool isValid() const;
+ };
+
+#include "section.h"
+
+//---------------------------------------------------------
+// SigEdit
+//---------------------------------------------------------
+
+class SigEdit : public QWidget
+ {
+ Q_OBJECT
+ void init();
+
+ QString sectionText(int sec);
+ Section sec[2];
+
+ bool adv;
+ bool overwrite;
+ int timerId;
+ bool typing;
+ bool changed;
+ SigEditor *ed;
+ Q3SpinWidget* controls;
+
+ private slots:
+ void stepUp();
+ void stepDown();
+
+ signals:
+ void valueChanged(int, int);
+ void returnPressed();
+
+ protected:
+ bool event(QEvent *e );
+ void timerEvent(QTimerEvent* e);
+ void resizeEvent(QResizeEvent*);
+ QString sectionFormattedText(int sec);
+ void addNumber(int sec, int num);
+ void removeLastNumber(int sec);
+ bool setFocusSection(int s);
+
+ virtual bool outOfRange(int, int) const;
+ virtual void setSec(int, int);
+ friend class SigEditor;
+
+ protected slots:
+ void updateButtons();
+
+ public slots:
+ virtual void setValue(const Sig& sig);
+ void setValue(const QString& s);
+
+ public:
+ SigEdit(QWidget*, const char* = 0);
+ ~SigEdit();
+
+ QSize sizeHint() const;
+ Sig sig() const;
+ virtual void setAutoAdvance(bool advance) { adv = advance; }
+ bool autoAdvance() const { return adv; }
+ void enterPressed();
+ };
+
+#endif
diff --git a/muse2/muse/widgets/siglabel.cpp b/muse2/muse/widgets/siglabel.cpp
new file mode 100644
index 00000000..54338ab6
--- /dev/null
+++ b/muse2/muse/widgets/siglabel.cpp
@@ -0,0 +1,157 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: siglabel.cpp,v 1.1.1.1 2003/10/27 18:54:28 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "siglabel.h"
+#include <stdio.h>
+
+#define TIMER1 400
+#define TIMER2 200
+#define TIMEC 7
+#define TIMER3 100
+#define TIMEC2 20
+#define TIMER4 50
+
+#include "globals.h"
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QWheelEvent>
+#include <QLabel>
+
+//---------------------------------------------------------
+// SigLabel
+// edit Signature Values (4/4)
+//---------------------------------------------------------
+
+SigLabel::SigLabel(int a, int b, QWidget* parent) : QLabel(parent)
+ {
+ z = n = 0;
+ setFocusPolicy(Qt::NoFocus);
+ setAlignment(Qt::AlignCenter);
+ setValue(a, b);
+ }
+
+//---------------------------------------------------------
+// mousePressEvent
+//---------------------------------------------------------
+
+void SigLabel::mousePressEvent(QMouseEvent* event)
+ {
+ int button = event->button();
+ bool zaehler = event->x() < width() /2;
+
+ int zz = z, nn = n;
+ switch (button) {
+ case Qt::LeftButton:
+ return;
+ case Qt::MidButton:
+ incValue(zaehler, false, zz, nn);
+ break;
+ case Qt::RightButton:
+ incValue(zaehler, true, zz, nn);
+ break;
+ default:
+ break;
+ }
+ if ((zz != z) || (nn != n)) {
+ setValue(zz, nn);
+ emit valueChanged(zz, nn);
+ }
+ }
+
+//---------------------------------------------------------
+// incValue
+//---------------------------------------------------------
+
+void SigLabel::incValue(bool zaehler, bool up, int& zz, int& nn)
+ {
+ if (!up) {
+ if (zaehler) {
+ --zz;
+ if (zz < 1)
+ zz = 1;
+ }
+ else {
+ switch (nn) {
+ case 1: break;
+ case 2: nn = 1; break;
+ case 4: nn = 2; break;
+ case 8: nn = 4; break;
+ case 16: nn = 8; break;
+ case 32: nn = 16; break;
+ case 64: nn = 32; break;
+ case 128: nn = 64; break;
+ }
+ }
+ }
+ else {
+ if (zaehler) {
+ ++zz;
+ if (zz > 16)
+ zz = 16;
+ }
+ else {
+ switch (nn) {
+ case 1: nn = 2; break;
+ case 2: nn = 4; break;
+ case 4: nn = 8; break;
+ case 8: nn = 16; break;
+ case 16: nn = 32; break;
+ case 32: nn = 64; break;
+ case 64: nn = 128; break;
+ case 128: break;
+ }
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// wheelEvent
+//---------------------------------------------------------
+
+void SigLabel::wheelEvent(QWheelEvent* event)
+ {
+ bool zaehler = event->x() < width() /2;
+ int delta = event->delta();
+ int zz = z, nn = n;
+
+ bool inc = delta >= 0;
+ incValue(zaehler, inc, zz, nn);
+ if ((zz != z) || (nn != n)) {
+ setValue(zz, nn);
+ emit valueChanged(zz, nn);
+ }
+ }
+
+//---------------------------------------------------------
+// setValue
+//---------------------------------------------------------
+
+void SigLabel::setValue(int a, int b)
+ {
+ if (a == z && b == n)
+ return;
+ z = a;
+ n = b;
+ QString sa;
+ sa.setNum(a);
+
+ QString sb;
+ sb.setNum(b);
+
+ QString s = sa + QString("/") + sb;
+ setText(s);
+ }
+
+//---------------------------------------------------------
+// setFrame
+//---------------------------------------------------------
+
+void SigLabel::setFrame(bool flag)
+ {
+ setFrameStyle(flag ? Panel | Sunken : NoFrame);
+ setLineWidth(2);
+ }
diff --git a/muse2/muse/widgets/siglabel.h b/muse2/muse/widgets/siglabel.h
new file mode 100644
index 00000000..4f93a7b8
--- /dev/null
+++ b/muse2/muse/widgets/siglabel.h
@@ -0,0 +1,42 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: siglabel.h,v 1.1.1.1 2003/10/27 18:54:56 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SIGLABEL_H__
+#define __SIGLABEL_H__
+
+#include <qlabel.h>
+//Added by qt3to4:
+#include <QWheelEvent>
+#include <QMouseEvent>
+
+//---------------------------------------------------------
+// SigLabel
+// show/edit time signature
+//---------------------------------------------------------
+
+class SigLabel : public QLabel {
+ Q_OBJECT
+ virtual void mousePressEvent(QMouseEvent*);
+ virtual void wheelEvent(QWheelEvent*);
+ void incValue(bool zaehler, bool inc, int&, int&);
+
+ protected:
+ int z, n;
+
+ signals:
+ void valueChanged(int, int);
+
+ public slots:
+ virtual void setValue(int, int);
+
+ public:
+ SigLabel(int z, int n, QWidget*);
+ void value(int& a, int& b) const { a = z; b = n; }
+ void setFrame(bool);
+ };
+#endif
+
diff --git a/muse2/muse/widgets/sigscale.cpp b/muse2/muse/widgets/sigscale.cpp
new file mode 100644
index 00000000..2735d8d2
--- /dev/null
+++ b/muse2/muse/widgets/sigscale.cpp
@@ -0,0 +1,152 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: sigscale.cpp,v 1.6 2004/04/11 13:03:32 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <values.h>
+
+#include <qpainter.h>
+#include <qtooltip.h>
+//Added by qt3to4:
+#include <QEvent>
+#include <QMouseEvent>
+
+#include "globals.h"
+#include "midieditor.h"
+#include "sigscale.h"
+#include "song.h"
+#include "gconfig.h"
+
+//---------------------------------------------------------
+// SigScale
+//---------------------------------------------------------
+
+SigScale::SigScale(int* r, QWidget* parent, int xs)
+ : View(parent, xs, 1)
+ {
+ QToolTip::add(this, tr("signature scale"));
+ raster = r;
+ pos[0] = song->cpos();
+ pos[1] = song->lpos();
+ pos[2] = song->rpos();
+ button = Qt::NoButton;
+ setMouseTracking(true);
+ connect(song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool)));
+ setFixedHeight(18);
+ }
+
+//---------------------------------------------------------
+// setPos
+//---------------------------------------------------------
+
+void SigScale::setPos(int idx, unsigned val, bool)
+ {
+ if (val == pos[idx])
+ return;
+ unsigned opos = mapx(pos[idx]);
+ pos[idx] = val;
+ if (!isVisible())
+ return;
+ val = mapx(val);
+ int x = -9;
+ int w = 18;
+ if (opos > val) {
+ w += opos - val;
+ x += val;
+ }
+ else {
+ w += val - opos;
+ x += opos;
+ }
+ redraw(QRect(x, 0, w, height()));
+ }
+
+void SigScale::viewMousePressEvent(QMouseEvent* event)
+ {
+ button = event->button();
+ viewMouseMoveEvent(event);
+ }
+
+void SigScale::viewMouseReleaseEvent(QMouseEvent*)
+ {
+ button = Qt::NoButton;
+ }
+
+void SigScale::viewMouseMoveEvent(QMouseEvent* event)
+ {
+ int x = sigmap.raster(event->x(), *raster);
+ emit timeChanged(x);
+ int i;
+ switch (button) {
+ case Qt::LeftButton:
+ i = 0;
+ break;
+ case Qt::MidButton:
+ i = 1;
+ break;
+ case Qt::RightButton:
+ i = 2;
+ break;
+ default:
+ return;
+ }
+ Pos p(x, true);
+ song->setPos(i, p);
+ }
+
+//---------------------------------------------------------
+// leaveEvent
+//---------------------------------------------------------
+
+void SigScale::leaveEvent(QEvent*)
+ {
+// emit timeChanged(MAXINT);
+ }
+
+//---------------------------------------------------------
+// draw
+//---------------------------------------------------------
+
+void SigScale::pdraw(QPainter& p, const QRect& r)
+ {
+ int x = r.x();
+ int w = r.width();
+ int h = height();
+
+ if (x < 0)
+ x = 0;
+ p.setFont(config.fonts[3]);
+ for (ciSigEvent si = sigmap.begin(); si != sigmap.end(); ++si) {
+ SigEvent* e = si->second;
+ int xp = mapx(e->tick);
+ if (xp > x+w)
+ break;
+ if (xp+40 < x)
+ continue;
+ p.drawLine(xp, 0, xp, h/2);
+ p.drawLine(xp, h/2, xp+5, h/2);
+ QString s;
+ s.sprintf("%d/%d", e->z, e->n);
+ p.drawText(xp+8, h-6, s);
+ }
+
+ //---------------------------------------------------
+ // draw location marker
+ //---------------------------------------------------
+
+ p.setPen(Qt::red);
+ int xp = mapx(pos[0]);
+ if (xp >= x && xp < x+w)
+ p.drawLine(xp, 0, xp, h);
+ p.setPen(Qt::blue);
+ xp = mapx(pos[1]);
+ if (xp >= x && xp < x+w)
+ p.drawLine(xp, 0, xp, h);
+ xp = mapx(pos[2]);
+ if (xp >= x && xp < x+w)
+ p.drawLine(xp, 0, xp, h);
+ }
+
+
diff --git a/muse2/muse/widgets/sigscale.h b/muse2/muse/widgets/sigscale.h
new file mode 100644
index 00000000..d66d9a73
--- /dev/null
+++ b/muse2/muse/widgets/sigscale.h
@@ -0,0 +1,50 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: sigscale.h,v 1.2 2004/01/11 18:55:37 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SIGSCALE_H__
+#define __SIGSCALE_H__
+
+#include "view.h"
+//Added by qt3to4:
+#include <QEvent>
+#include <QMouseEvent>
+
+class QPainter;
+class MidiEditor;
+
+//---------------------------------------------------------
+// SigScale
+// Time Signature Scale
+//---------------------------------------------------------
+
+class SigScale : public View {
+ Q_OBJECT
+ int* raster;
+ unsigned pos[3];
+ int button;
+
+ signals:
+ void posChanged(unsigned, unsigned);
+
+ protected:
+ virtual void pdraw(QPainter&, const QRect&);
+ virtual void viewMousePressEvent(QMouseEvent* event);
+ virtual void viewMouseMoveEvent(QMouseEvent* event);
+ virtual void viewMouseReleaseEvent(QMouseEvent* event);
+ virtual void leaveEvent(QEvent*e);
+
+ signals:
+ void timeChanged(unsigned);
+
+ public slots:
+ void setPos(int, unsigned, bool);
+
+ public:
+ SigScale(int* raster, QWidget* parent, int xscale);
+ };
+#endif
+
diff --git a/muse2/muse/widgets/slider.cpp b/muse2/muse/widgets/slider.cpp
new file mode 100644
index 00000000..f93cadc1
--- /dev/null
+++ b/muse2/muse/widgets/slider.cpp
@@ -0,0 +1,930 @@
+#include <cmath>
+#include "mmath.h"
+#include <qdrawutil.h>
+#include <qpainter.h>
+#include <qcursor.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+#include <QResizeEvent>
+
+#include "slider.h"
+
+//-------------------------------------------------------------
+// Slider - The Slider Widget
+//
+// Slider is a slider widget which operates on an interval
+// of type double. Slider supports different layouts as
+// well as a scale.
+//------------------------------------------------------------
+
+//------------------------------------------------------------
+//.F Slider::Slider
+//
+// Constructor
+//
+//.u Syntax:
+//.f Slider::Slider(QWidget *parent, const char *name, Orientation orient = Horizontal, ScalePos scalePos = None, int bgStyle = BgTrough)
+//
+//.u Parameters
+//.p
+// QWidget *parent -- parent widget
+// const char *name -- The Widget's name. Default = 0.
+// Orientation Orient -- Orientation of the slider. Can be Slider::Horizontal
+// or Slider::Vertical.
+// Defaults to Horizontal.
+// ScalePos scalePos -- Position of the scale. Can be Slider::None,
+// Slider::Left, Slider::Right, Slider::Top,
+// or Slider::Bottom. Defaults to Slider::None.
+// int bgStyle -- Background style. Slider::BgTrough draws the
+// slider button in a trough, Slider::BgSlot draws
+// a slot underneath the button. An or-combination of both
+// may also be used. The default is Slider::BgTrough.
+//------------------------------------------------------------
+
+Slider::Slider(QWidget *parent, const char *name,
+ Qt::Orientation orient, ScalePos scalePos, int bgStyle)
+ : SliderBase(parent,name)
+ {
+ if (bgStyle == BgSlot) {
+ d_thumbLength = 16;
+ d_thumbHalf = 8;
+ d_thumbWidth = 30;
+ }
+ else {
+ d_thumbLength = 30;
+ d_thumbHalf = 15;
+ d_thumbWidth = 16;
+ }
+
+ d_borderWidth = 2;
+ d_scaleDist = 4;
+ d_scaleStep = 0.0;
+ d_scalePos = scalePos;
+ d_xMargin = 0;
+ d_yMargin = 0;
+ d_bgStyle = bgStyle;
+
+ if (bgStyle & BgTrough)
+ d_bwTrough = d_borderWidth;
+ else
+ d_bwTrough = 0;
+
+ d_sliderRect.setRect(0, 0, 8, 8);
+ setOrientation(orient);
+ }
+
+//------------------------------------------------------------
+//.F Slider::~Slider
+// Destructor
+//.u Syntax
+//.f Slider::~Slider()
+//------------------------------------------------------------
+
+Slider::~Slider()
+ {
+ }
+
+//------------------------------------------------------------
+//
+//.F Slider::setBorderWidth
+// Change the slider's border width
+//
+//.u Syntax
+//.f void Slider::setBorderWidth(int bd)
+//
+//.u Parameters
+//.p int bd -- border width
+//
+//------------------------------------------------------------
+
+void Slider::setBorderWidth(int bd)
+{
+ d_borderWidth = qwtMin(qwtMax(bd,0),10);
+ if (d_bgStyle & BgTrough)
+ d_bwTrough = d_borderWidth;
+ else
+ d_bwTrough = 0;
+}
+
+//----------------------------------------------------
+//
+//.F Slider::setThumbLength
+//
+// Set the slider's thumb length
+//
+//.u Syntax
+// void Slider::setThumbLength(int l)
+//
+//.u Parameters
+//.p int l -- new length
+//
+//-----------------------------------------------------
+void Slider::setThumbLength(int l)
+{
+ d_thumbLength = qwtMax(l,8);
+ d_thumbHalf = d_thumbLength / 2;
+ resize(size());
+}
+
+//------------------------------------------------------------
+//
+//.F Slider::setThumbWidth
+// Change the width of the thumb
+//
+//.u Syntax
+//.p void Slider::setThumbWidth(int w)
+//
+//.u Parameters
+//.p int w -- new width
+//
+//------------------------------------------------------------
+void Slider::setThumbWidth(int w)
+{
+ d_thumbWidth = qwtMax(w,4);
+ resize(size());
+}
+
+
+//------------------------------------------------------------
+//.-
+//.F Slider::scaleChange
+// Notify changed scale
+//
+//.u Syntax
+//.f void Slider::scaleChange()
+//
+//.u Description
+// Called by QwtScaledWidget
+//
+//------------------------------------------------------------
+void Slider::scaleChange()
+{
+ if (!hasUserScale())
+ d_scale.setScale(minValue(), maxValue(), d_maxMajor, d_maxMinor);
+ update();
+}
+
+
+//------------------------------------------------------------
+//.-
+//.F Slider::fontChange
+// Notify change in font
+//
+//.u Syntax
+//.f Slider::fontChange(const QFont &oldFont)
+//
+//------------------------------------------------------------
+void Slider::fontChange(const QFont & /*oldFont*/)
+{
+ repaint(FALSE);
+}
+
+//------------------------------------------------------------
+// drawSlider
+// Draw the slider into the specified rectangle.
+//------------------------------------------------------------
+
+void Slider::drawSlider(QPainter *p, const QRect &r)
+ {
+ QColorGroup g = colorGroup();
+ QBrush brBack(g.background());
+ QBrush brMid;
+ QBrush brDark(g.dark());
+
+ QRect cr;
+
+ int ipos,dist1;
+ double rpos;
+ int lineDist;
+
+ if (d_bwTrough > 0) {
+ qDrawShadePanel(p, r.x(), r.y(),
+ r.width(), r.height(),
+ g, TRUE, d_bwTrough,0);
+ cr.setRect(r.x() + d_bwTrough,
+ r.y() + d_bwTrough,
+ r.width() - 2*d_bwTrough,
+ r.height() - 2*d_bwTrough);
+ brMid = QBrush(g.mid());
+ }
+ else {
+ cr = r;
+ brMid = brBack;
+ }
+
+ rpos = (value() - minValue()) / (maxValue() - minValue());
+
+ lineDist = d_borderWidth - 1;
+ if (lineDist < 1) lineDist = 1;
+
+ if (d_orient == Qt::Horizontal)
+ {
+
+ dist1 = int(double(cr.width() - d_thumbLength) * rpos);
+ ipos = cr.x() + dist1;
+ markerPos = ipos + d_thumbHalf;
+
+ //
+ // draw background
+ //
+ if (d_bgStyle & BgSlot)
+ {
+ drawHsBgSlot(p, cr, QRect(ipos, cr.y(), d_thumbLength, cr.height()), brMid);
+ }
+ else
+ {
+ p->fillRect(cr.x(),cr.y(),dist1,cr.height(),brMid);
+ p->fillRect(ipos + d_thumbLength, cr.y(),
+ cr.width() - d_thumbLength - dist1, cr.height(),brMid);
+ }
+
+ //
+ // Draw thumb
+ //
+ qDrawShadePanel(p,ipos, cr.y(), d_thumbLength, cr.height(),
+ colorGroup(), FALSE, d_borderWidth, &brBack);
+
+ if (lineDist > 1)
+ qDrawShadeLine(p,markerPos, cr.y() + lineDist , markerPos,
+ cr.y() + cr.height() - lineDist,
+ colorGroup(), TRUE, 1);
+ else
+ {
+ p->setPen(g.dark());
+ p->drawLine(markerPos -1 , cr.y() + lineDist, markerPos -1,
+ cr.y() + cr.height() - lineDist - 1);
+ p->setPen(g.light());
+ p->drawLine(markerPos, cr.y() + lineDist, markerPos,
+ cr.y() + cr.height() - lineDist - 1);
+ }
+
+
+ }
+ else
+ {
+ dist1 = int(double(cr.height() - d_thumbLength) * (1.0 - rpos));
+ ipos = cr.y() + dist1;
+ markerPos = ipos + d_thumbHalf;
+
+ if ( d_bgStyle & BgSlot)
+ {
+ drawVsBgSlot(p, cr, QRect(cr.left(), ipos, cr.width(),
+ d_thumbLength), brMid);
+ }
+ else
+ {
+ p->fillRect(cr.x(),cr.y(),cr.width(),ipos,brMid);
+ p->fillRect(cr.x(), ipos + d_thumbLength, cr.width(),
+ cr.height() - d_thumbLength - dist1, brMid);
+ }
+
+ qDrawShadePanel(p,cr.x(),ipos , cr.width(), d_thumbLength,
+ colorGroup(),FALSE,d_borderWidth, &brBack);
+ if (lineDist > 1)
+ qDrawShadeLine(p, cr.x() + lineDist , markerPos,
+ cr.x() + cr.width() - lineDist, markerPos,
+ colorGroup(), TRUE, 1);
+ else {
+
+ p->setPen(g.dark());
+ p->drawLine(cr.x() + lineDist, markerPos - 1 ,
+ cr.x() + cr.width() - lineDist - 1, markerPos - 1);
+ p->setPen(g.light());
+ p->drawLine(cr.x() + lineDist, markerPos,
+ cr.x() + cr.width() - lineDist - 1 , markerPos);
+ }
+ }
+
+}
+
+//------------------------------------------------------------
+//.-
+//.F Slider::drawSlotBg
+//
+//
+//.u Syntax
+//.f void Slider::drawSlotBg(QPainter *p, const QRect &rBound, const QRect &rThumb, const QRect &rSlot, const QBrush &brBack)
+//
+//.u Parameters
+//.p QPainter *p, const QRect &rBound, const QRect &rThumb, const QRect &rSlot, const QBrush &brBack
+//
+//------------------------------------------------------------
+void Slider::drawHsBgSlot(QPainter *p, const QRect &rBound, const QRect &rThumb, const QBrush &brBack)
+{
+ int ws, ds, dLeft;
+ int lPos, rPos;
+ QRect rSlot;
+ const QColorGroup &g = colorGroup();
+
+ ws = rBound.height();
+ if ((ws / 2) * 2 != ws)
+ ws = 5;
+ else
+ ws = 4;
+
+ ds = qwtMax(1, d_thumbLength/2 - 4);
+ dLeft = rThumb.left() - rBound.left();
+
+ rSlot = QRect(rBound.x() + ds, rBound.y() + (rBound.height() - ws) / 2,
+ rBound.width() - 2 * ds, ws);
+
+ rPos = qwtMin(rSlot.x(), rThumb.left());
+
+ if (rThumb.left() > rBound.x())
+ {
+ p->fillRect(rBound.x(),rBound.y(),dLeft, rSlot.top() - rBound.top(), brBack);
+ p->fillRect(rBound.x(),rSlot.bottom() + 1,dLeft,
+ rBound.bottom() - rSlot.bottom(),brBack);
+ if (rPos > rBound.left())
+ p->fillRect(rBound.x(),rSlot.y(),
+ rPos - rBound.left(),ws,brBack);
+
+ p->setPen(g.dark());
+ if (rSlot.x() < rThumb.left())
+ p->drawLine(rSlot.x(), rSlot.bottom(), rSlot.x(), rSlot.top());
+ if (rSlot.x() < rThumb.left() - 1)
+ {
+ p->drawLine(rSlot.x(), rSlot.top(), rThumb.left() - 1, rSlot.top());
+ p->setPen(g.light());
+ p->drawLine(rSlot.x() + 1, rSlot.bottom(),
+ rThumb.left() - 1, rSlot.bottom());
+
+ p->fillRect(rSlot.x() + 1, rSlot.y() + 1, dLeft - ds -1,
+ rSlot.height() -2, QBrush(Qt::black));
+
+ }
+ }
+
+ lPos = qwtMax(rSlot.right(), rThumb.right()) + 1;
+ if (rThumb.right() < rBound.right())
+ {
+ p->fillRect(rThumb.right() + 1,rBound.y(),rBound.right() - rThumb.right(),
+ rSlot.top() - rBound.top(), brBack);
+ p->fillRect(rThumb.right() + 1,rSlot.bottom() + 1,
+ rBound.right() - rThumb.right(),
+ rBound.bottom() - rSlot.bottom(),brBack);
+ if (lPos <= rBound.right())
+ p->fillRect(lPos, rSlot.y() , rBound.right() - lPos + 1, ws ,brBack);
+
+ p->setPen(g.dark());
+ if (rSlot.right() > rThumb.right())
+ {
+ p->drawLine(rThumb.right() + 1, rSlot.top(), rSlot.right(), rSlot.top());
+ p->setPen(g.light());
+ p->drawLine(rSlot.right(), rSlot.bottom(), rSlot.right(), rSlot.top() + 1);
+ }
+
+ if (rSlot.right() > rThumb.right() + 1)
+ {
+ p->setPen(g.light());
+ p->drawLine(rThumb.right() + 1, rSlot.bottom(),
+ rSlot.right() -1, rSlot.bottom());
+ p->fillRect(rThumb.right() + 1, rSlot.y() + 1,
+ rSlot.right() - rThumb.right() - 1,
+ rSlot.height() -2, QBrush(Qt::black));
+ }
+ }
+
+}
+
+//------------------------------------------------------------
+//.-
+//.F Slider::drawVsBgSlot
+//
+//
+//.u Syntax
+//.f void Slider::drawVsBgSlot(QPainter *p, const QRect &rBound, const QRect &rThumb, const QBrush &brBack)
+//
+//.u Parameters
+//.p QPainter *p, const QRect &rBound, const QRect &rThumb, const QBrush &brBack
+//
+//.u Return Value
+//
+//.u Description
+//
+//------------------------------------------------------------
+void Slider::drawVsBgSlot(QPainter *p, const QRect &rBound, const QRect &rThumb, const QBrush &brBack)
+{
+
+ int ws, ds, dTop;
+ int lPos, hPos;
+ QRect rSlot;
+ const QColorGroup &g = colorGroup();
+
+ ws = rBound.width();
+ if ((ws / 2) * 2 != ws)
+ ws = 5;
+ else
+ ws = 4;
+
+ ds = qwtMax(1, d_thumbLength/2 - 4);
+ dTop = rThumb.top() - rBound.top();
+
+ rSlot = QRect(rBound.x() + (rBound.width() - ws) / 2, rBound.y() + ds,
+ ws, rBound.height() - 2 * ds);
+
+ hPos = qwtMin(rSlot.y(), rThumb.top());
+
+ if (rThumb.top() > rBound.top())
+ {
+ p->fillRect(rBound.x(),rBound.y(), rSlot.left() - rBound.left(),dTop, brBack);
+ p->fillRect(rSlot.right() + 1, rBound.y(),
+ rBound.right() - rSlot.right(), dTop,brBack);
+ if (hPos > rBound.top())
+ p->fillRect(rSlot.x(),rBound.y(), ws,
+ hPos - rBound.top(),brBack);
+
+ p->setPen(g.dark());
+ if (rSlot.top() < rThumb.top())
+ p->drawLine(rSlot.left(), rSlot.top(), rSlot.right(), rSlot.top());
+
+
+ if (rSlot.top() < rThumb.top() - 1)
+ {
+ p->drawLine(rSlot.left(), rThumb.top() - 1, rSlot.left(), rSlot.top());
+ p->setPen(g.light());
+ p->drawLine(rSlot.right(), rSlot.top() + 1, rSlot.right(),
+ rThumb.top() - 1);
+
+ p->fillRect(rSlot.x() + 1, rSlot.y() + 1, rSlot.width() - 2,
+ dTop - ds -1, QBrush(Qt::black));
+
+ }
+ }
+
+ lPos = qwtMax(rSlot.bottom(), rThumb.bottom()) + 1;
+ if (rThumb.bottom() < rBound.bottom())
+ {
+ p->fillRect(rBound.left(), rThumb.bottom() + 1,
+ rSlot.left() - rBound.left(),
+ rBound.bottom() - rThumb.bottom(), brBack);
+ p->fillRect(rSlot.right() + 1, rThumb.bottom() + 1,
+ rBound.right() - rSlot.right(),
+ rBound.bottom() - rThumb.bottom(), brBack);
+ if (lPos <= rBound.bottom())
+ p->fillRect(rSlot.left(), lPos, ws, rBound.bottom() - lPos + 1, brBack);
+
+ p->setPen(g.dark());
+ if (rSlot.bottom() > rThumb.bottom())
+ {
+ p->drawLine(rSlot.left(), rThumb.bottom() + 1, rSlot.left(), rSlot.bottom());
+ p->setPen(g.light());
+ p->drawLine(rSlot.left() * 1, rSlot.bottom(), rSlot.right(), rSlot.bottom());
+ }
+
+ if (rSlot.bottom() > rThumb.bottom() + 1)
+ {
+ p->setPen(g.light());
+ p->drawLine(rSlot.right(), rThumb.bottom() + 1, rSlot.right(),
+ rSlot.bottom());
+ p->fillRect(rSlot.left() + 1, rThumb.bottom() + 1,
+ rSlot.width() - 2, rSlot.bottom() - rThumb.bottom() - 1,
+ QBrush(Qt::black));
+ }
+ }
+
+}
+
+//------------------------------------------------------------
+//.-
+//.F Slider::getValue
+// Determine the value corresponding to a specified
+// mouse location.
+//
+//.u Syntax
+//.f double Slider::getValue(const QPoint &p)
+//
+//.u Parameters
+//.p const QPoint &p --
+//
+//.u Description
+// Called by SliderBase
+//------------------------------------------------------------
+double Slider::getValue( const QPoint &p)
+{
+ double rv;
+ int pos;
+ QRect r = d_sliderRect;
+
+ r.setLeft(r.left() + d_bwTrough);
+ r.setRight(r.right() - d_bwTrough);
+ r.setTop(r.top() - d_bwTrough);
+ r.setBottom(r.bottom() - d_bwTrough);
+
+ if (d_orient == Qt::Horizontal)
+ {
+
+ if (r.width() <= d_thumbLength)
+ {
+ rv = 0.5 * (minValue() + maxValue());
+ }
+ else
+ {
+ pos = p.x() - r.x() - d_thumbHalf;
+ rv = minValue() +
+ rint( (maxValue() - minValue()) * double(pos)
+ / double(r.width() - d_thumbLength)
+ / step() ) * step();
+ }
+
+ }
+ else
+ {
+ if (r.height() <= d_thumbLength)
+ {
+ rv = 0.5 * (minValue() + maxValue());
+ }
+ else
+ {
+ pos = p.y() - r.y() - d_thumbHalf;
+ rv = minValue() +
+ rint( (maxValue() - minValue()) *
+ (1.0 - double(pos)
+ / double(r.height() - d_thumbLength))
+ / step() ) * step();
+ }
+
+ }
+
+ return(rv);
+}
+
+
+//------------------------------------------------------------
+//.-
+//.F Slider::getScrollMode
+// Determine scrolling mode and direction
+//
+//.u Syntax
+//.f void Slider::getScrollMode( const QPoint &p, int &scrollMode, int &direction )
+//
+//.u Parameters
+//.p const QPoint &p -- point
+//
+//.u Description
+// Called by SliderBase
+//
+//------------------------------------------------------------
+void Slider::getScrollMode( QPoint &p, const Qt::ButtonState &button, int &scrollMode, int &direction )
+{
+ if(cursorHoming() && button == Qt::LeftButton)
+ {
+ if(d_sliderRect.contains(p))
+ {
+ scrollMode = ScrMouse;
+ direction = 0;
+
+ int mp = 0;
+ QRect cr;
+ QPoint cp;
+ int ipos,dist1;
+ double rpos;
+ int lineDist;
+
+ if(d_bwTrough > 0)
+ cr.setRect(d_sliderRect.x() + d_bwTrough,
+ d_sliderRect.y() + d_bwTrough,
+ d_sliderRect.width() - 2*d_bwTrough,
+ d_sliderRect.height() - 2*d_bwTrough);
+ else
+ cr = d_sliderRect;
+
+ rpos = (value() - minValue()) / (maxValue() - minValue());
+
+ lineDist = d_borderWidth - 1;
+ if(lineDist < 1) lineDist = 1;
+
+ if(d_orient == Qt::Horizontal)
+ {
+ dist1 = int(double(cr.width() - d_thumbLength) * rpos);
+ ipos = cr.x() + dist1;
+ mp = ipos + d_thumbHalf;
+
+ p.setX(mp);
+ cp = mapToGlobal( QPoint(mp, p.y()) );
+ }
+ else
+ {
+ dist1 = int(double(cr.height() - d_thumbLength) * (1.0 - rpos));
+ ipos = cr.y() + dist1;
+ mp = ipos + d_thumbHalf;
+ p.setY(mp);
+ cp = mapToGlobal( QPoint(p.x(), mp) );
+ }
+ cursor().setPos(cp.x(), cp.y());
+ }
+ }
+ else
+ {
+ int currentPos;
+ if (d_orient == Qt::Horizontal)
+ currentPos = p.x();
+ else
+ currentPos = p.y();
+
+ if (d_sliderRect.contains(p))
+ {
+ if ((currentPos > markerPos - d_thumbHalf)
+ && (currentPos < markerPos + d_thumbHalf))
+ {
+ scrollMode = ScrMouse;
+ direction = 0;
+ }
+ else
+ {
+ scrollMode = ScrPage;
+ if (((currentPos > markerPos) && (d_orient == Qt::Horizontal))
+ || ((currentPos <= markerPos) && (d_orient != Qt::Horizontal)))
+ direction = 1;
+ else
+ direction = -1;
+ }
+ }
+ else
+ {
+ scrollMode = ScrNone;
+ direction = 0;
+ }
+
+ }
+}
+
+//------------------------------------------------------------
+//.F Slider::paintEvent
+// Qt paint event
+//
+//.u Syntax
+//.f void Slider::paintEvent(QPaintEvent *e)
+//------------------------------------------------------------
+
+void Slider::paintEvent(QPaintEvent* /*e*/)
+ {
+ QPainter p;
+
+ if (p.begin(this)) {
+ if (d_scalePos != None) {
+ p.fillRect(this->rect(), this->backgroundColor());
+ d_scale.draw(&p);
+ }
+ drawSlider(&p, d_sliderRect);
+ }
+ p.end();
+ }
+
+//------------------------------------------------------------
+//.F Slider::resizeEvent
+// Qt resize event
+//
+//.u Parameters
+//.p QResizeEvent *e
+//
+//.u Syntax
+//.f void Slider::resizeEvent(QResizeEvent *e)
+//------------------------------------------------------------
+
+void Slider::resizeEvent(QResizeEvent *e)
+{
+
+ d_resized = TRUE;
+ QSize s = e->size();
+ int sliderWidth = d_thumbWidth + 2 * d_bwTrough;
+
+ // reposition slider
+ if(d_orient == Qt::Horizontal)
+ {
+ switch(d_scalePos)
+ {
+ case Top:
+
+ d_sliderRect.setRect(this->rect().x() + d_xMargin,
+ this->rect().y() + s.height() - 1
+ - d_yMargin - sliderWidth,
+ s.width() - 2 * d_xMargin,
+ sliderWidth);
+ d_scale.setGeometry(d_sliderRect.x() + d_bwTrough + d_thumbHalf,
+ d_sliderRect.y() - d_scaleDist,
+ d_sliderRect.width() - d_thumbLength - 2*d_bwTrough,
+ ScaleDraw::Top);
+
+ break;
+
+ case Bottom:
+
+ d_sliderRect.setRect(this->rect().x() + d_xMargin,
+ this->rect().y() + d_yMargin,
+ s.width() - 2*d_xMargin,
+ sliderWidth);
+ d_scale.setGeometry(d_sliderRect.x() + d_bwTrough + d_thumbHalf,
+ d_sliderRect.y() + d_sliderRect.height() + d_scaleDist,
+ d_sliderRect.width() - d_thumbLength - 2*d_bwTrough,
+ ScaleDraw::Bottom);
+
+ break;
+
+ default:
+ d_sliderRect.setRect(this->rect().x(), this->rect().x(),
+ s.width(), s.height());
+ break;
+ }
+ }
+ else
+ {
+ switch(d_scalePos)
+ {
+ case Left:
+ d_sliderRect.setRect(this->rect().x() + s.width()
+ - sliderWidth - 1 - d_xMargin,
+ this->rect().y() + d_yMargin,
+ sliderWidth,
+ s.height() - 2 * d_yMargin);
+ d_scale.setGeometry(d_sliderRect.x() - d_scaleDist,
+ d_sliderRect.y() + d_thumbHalf + d_bwTrough,
+ s.height() - d_thumbLength - 2*d_bwTrough,
+ ScaleDraw::Left);
+
+ break;
+ case Right:
+ d_sliderRect.setRect(this->rect().x() + d_xMargin,
+ this->rect().y() + d_yMargin,
+ sliderWidth,
+ s.height() - 2* d_yMargin);
+ d_scale.setGeometry(this->rect().x() + d_sliderRect.width()
+ + d_scaleDist,
+ d_sliderRect.y() + d_thumbHalf + d_bwTrough,
+ s.height() - d_thumbLength - 2*d_bwTrough,
+ ScaleDraw::Right);
+ break;
+ default:
+ d_sliderRect.setRect(this->rect().x(), this->rect().x(),
+ s.width(), s.height());
+ break;
+ }
+ }
+
+}
+
+//------------------------------------------------------------
+//.-
+//.F Slider::valueChange
+// Notify change of value
+//
+//.u Syntax
+//.f void Slider::valueChange()
+//
+//------------------------------------------------------------
+
+void Slider::valueChange()
+ {
+ QPainter p;
+
+ p.begin(this);
+ drawSlider(&p, d_sliderRect);
+ p.end();
+
+ SliderBase::valueChange();
+ }
+
+//------------------------------------------------------------
+//.-
+//.F Slider::rangeChange
+// Notify change of range
+//
+//.u Description
+//
+//.u Syntax
+//.f void Slider::rangeChange()
+//
+//------------------------------------------------------------
+void Slider::rangeChange()
+{
+ if (!hasUserScale())
+ d_scale.setScale(minValue(), maxValue(), d_maxMajor, d_maxMinor);
+ SliderBase::rangeChange();
+ repaint(FALSE);
+}
+
+//------------------------------------------------------------
+//
+//.F Slider::setMargins
+// Set distances between the widget's border and
+// internals.
+//
+//.u Syntax
+//.f void Slider::setMargins(int hor, int vert)
+//
+//.u Parameters
+//.p int hor, int vert -- Margins
+//
+//------------------------------------------------------------
+void Slider::setMargins(int hor, int vert)
+{
+ d_xMargin = qwtMax(0, hor);
+ d_yMargin = qwtMin(0, vert);
+ resize(this->size());
+}
+
+//------------------------------------------------------------
+//
+//.F Slider::sizeHint
+// Return a recommended size
+//
+//.u Syntax
+//.f QSize Slider::sizeHint() const
+//
+//.u Note
+// The return value of sizeHint() depends on the font and the
+// scale.
+//------------------------------------------------------------
+
+QSize Slider::sizeHint() //const ddskrjo
+ {
+ QPainter p;
+ int msWidth = 0, msHeight = 0;
+
+ int w = 40;
+ int h = 40;
+ if (d_scalePos != None) {
+ if (p.begin(this)) {
+ msWidth = d_scale.maxWidth(&p, FALSE);
+ msHeight = d_scale.maxHeight(&p);
+ }
+ p.end();
+
+ switch(d_orient) {
+ case Qt::Vertical:
+ w = 2*d_xMargin + d_thumbWidth + 2*d_bwTrough + msWidth + d_scaleDist + 2;
+ break;
+ case Qt::Horizontal:
+ h = 2*d_yMargin + d_thumbWidth + 2*d_bwTrough + msHeight + d_scaleDist;
+ break;
+ }
+ }
+ else { // no scale
+ switch(d_orient) {
+ case Qt::Vertical:
+ w = 16 + 2 * d_bwTrough;
+ break;
+ case Qt::Horizontal:
+ h = 16 + 2 * d_bwTrough;
+ break;
+ }
+ }
+ return QSize(w, h);
+ }
+
+//---------------------------------------------------------
+// setOrientation
+//---------------------------------------------------------
+
+void Slider::setOrientation(Qt::Orientation o)
+ {
+ d_orient = o;
+ ScaleDraw::OrientationX so = ScaleDraw::Bottom;
+ switch(d_orient) {
+ case Qt::Vertical:
+ if (d_scalePos == Right)
+ so = ScaleDraw::Right;
+ else
+ so = ScaleDraw::Left;
+ break;
+ case Qt::Horizontal:
+ if (d_scalePos == Bottom)
+ so = ScaleDraw::Bottom;
+ else
+ so = ScaleDraw::Top;
+ break;
+ }
+
+ d_scale.setGeometry(0, 0, 40, so);
+ if (d_orient == Qt::Vertical)
+ setMinimumSize(10,20);
+ else
+ setMinimumSize(20,10);
+ QRect r = geometry();
+ setGeometry(r.x(), r.y(), r.height(), r.width());
+ update();
+ }
+
+Qt::Orientation Slider::orientation() const
+ {
+ return d_orient;
+ }
+
+double Slider::lineStep() const
+ {
+ return 1.0;
+ }
+
+double Slider::pageStep() const
+ {
+ return 1.0;
+ }
+
+void Slider::setLineStep(double)
+ {
+ }
+
+void Slider::setPageStep(double)
+ {
+ }
+
diff --git a/muse2/muse/widgets/slider.h b/muse2/muse/widgets/slider.h
new file mode 100644
index 00000000..499229e1
--- /dev/null
+++ b/muse2/muse/widgets/slider.h
@@ -0,0 +1,98 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: slider.h,v 1.3.2.2 2008/01/19 13:33:47 wschweer Exp $
+//
+// Copyright (C) 1997 Josef Wilgen
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2,
+// as published by the Free Software Foundation.
+//
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SLIDER_H__
+#define __SLIDER_H__
+
+#include "sclif.h"
+#include "sliderbase.h"
+#include "scldraw.h"
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QPaintEvent>
+
+//---------------------------------------------------------
+// Slider
+//---------------------------------------------------------
+
+class Slider : public SliderBase, public ScaleIf
+ {
+ Q_OBJECT
+
+ public:
+ enum ScalePos { None, Left, Right, Top, Bottom };
+ enum { BgTrough = 0x1, BgSlot = 0x2 };
+
+ private:
+ Q_PROPERTY( double lineStep READ lineStep WRITE setLineStep )
+ Q_PROPERTY( double pageStep READ pageStep WRITE setPageStep )
+ Q_PROPERTY( Qt::Orientation orientation READ orientation WRITE setOrientation )
+
+ QRect d_sliderRect;
+
+ int d_thumbLength;
+ int d_thumbHalf;
+ int d_thumbWidth;
+ int d_borderWidth;
+ int d_bwTrough;
+ int d_scaleDist;
+ int d_xMargin;
+ int d_yMargin;
+
+ int d_resized;
+ bool d_autoResize;
+ double d_scaleStep;
+
+ Qt::Orientation d_orient;
+ ScalePos d_scalePos;
+ int d_bgStyle;
+ int markerPos;
+
+ void drawHsBgSlot(QPainter *, const QRect&, const QRect&,const QBrush&);
+ void drawVsBgSlot(QPainter *, const QRect&, const QRect&,const QBrush&);
+
+ protected:
+ virtual void drawSlider (QPainter *p, const QRect &r);
+ double getValue(const QPoint &p);
+ void getScrollMode( QPoint &p, const Qt::ButtonState &button, int &scrollMode, int &direction);
+ void resizeEvent(QResizeEvent *e);
+ void paintEvent (QPaintEvent *e);
+ void valueChange();
+ void rangeChange();
+ void scaleChange();
+ void fontChange(const QFont &oldFont);
+
+ public:
+ Slider(QWidget *parent, const char *name = 0,
+ Qt::Orientation orient = Qt::Vertical,
+ ScalePos scalePos = None,
+ int bgStyle = BgTrough);
+
+ ~Slider();
+ void setThumbLength(int l);
+ void setThumbWidth(int w);
+
+ void setOrientation(Qt::Orientation o);
+ Qt::Orientation orientation() const;
+
+ double lineStep() const;
+ double pageStep() const;
+
+ void setLineStep(double);
+ void setPageStep(double);
+
+ void setBorderWidth(int bw);
+ void setMargins(int x, int y);
+ QSize sizeHint(); // const;
+ };
+#endif
diff --git a/muse2/muse/widgets/sliderbase.cpp b/muse2/muse/widgets/sliderbase.cpp
new file mode 100644
index 00000000..0d814d3c
--- /dev/null
+++ b/muse2/muse/widgets/sliderbase.cpp
@@ -0,0 +1,726 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: sliderbase.cpp,v 1.4.2.4 2007/01/27 14:52:43 spamatica Exp $
+
+// Copyright (C) 1997 Josef Wilgen
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2,
+// as published by the Free Software Foundation.
+//
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <cmath>
+#include "sliderbase.h"
+#include "mmath.h"
+//Added by qt3to4:
+#include <QWheelEvent>
+#include <QMouseEvent>
+#include <QTimerEvent>
+
+// DESCRIPTION
+// SliderBase is a base class for
+// slider widgets. QwtSliderBase handles the mouse events
+// and updates the slider's value accordingly. Derived classes
+// only have to implement the @QwtSliderBase::getValue@ and
+// @QwtSliderBase::getScrollMode@ members, and should react to a
+// @QwtSliderbase::valueChange@, which normally requires repainting.
+
+//------------------------------------------------------------
+//.F SliderBase::SliderBase
+// Constructor
+//
+//.u Syntax
+//.f SliderBase::SliderBase(QWidget *parent, const char *name)
+//
+//.u Parameters
+//.p QWidget *parent, const char *name
+//
+//------------------------------------------------------------
+
+SliderBase::SliderBase(QWidget *parent, const char *name)
+: QWidget(parent, name)
+ {
+ _id = -1;
+ _cursorHoming = false;
+ _ignoreMouseMove = false;
+ d_tmrID = 0;
+ d_updTime = 150;
+ d_mass = 0.0;
+ d_tracking = true;
+ d_mouseOffset = 0.0;
+ d_scrollMode = ScrNone;
+ setRange(0.0, 1.0, 0.1);
+ }
+
+//------------------------------------------------------------
+//.F SliderBase::~SliderBase
+// Destructor
+//
+//.u Syntax
+//.f SliderBase::~SliderBase()
+//------------------------------------------------------------
+
+SliderBase::~SliderBase()
+ {
+ if (d_tmrID)
+ killTimer(d_tmrID);
+ }
+
+
+//------------------------------------------------------------
+//.F void SliderBase::wheelEvent(QWheelEvent *e)
+// Add wheel event handling
+//
+//.u Syntax
+//.f void SliderBase::wheelEvent(QWheelEvent *e)
+//------------------------------------------------------------
+void SliderBase::wheelEvent(QWheelEvent *e)
+{
+ // Avoid unwanted wheel events from outside the control.
+ // Just in case it grabs focus somehow.
+ // Tested: No go, can't seem to determine where event came from.
+ /*
+ const QPoint gp = mapToGlobal(e->pos());
+ const QRect gr = QRect(mapToGlobal(rect().topLeft()), mapToGlobal(rect().bottomRight()));
+ if(!gr.contains(gp))
+ {
+ e->ignore();
+ return;
+ } */
+
+ e->accept();
+
+ float inc = (maxValue() - minValue()) / 40;
+ if (e->state() == Qt::ShiftModifier)
+ inc = inc / 10;
+
+ if(inc < step())
+ inc = step();
+
+ if(e->delta() > 0)
+ setValue(value()+inc);
+ else
+ setValue(value()-inc);
+
+ emit sliderMoved(value(), _id);
+}
+
+
+//------------------------------------------------------------
+//.F SliderBase::stopMoving
+// Stop updating if automatic scrolling is active
+//
+//.u Syntax
+//.f void SliderBase::stopMoving()
+//------------------------------------------------------------
+
+void SliderBase::stopMoving()
+ {
+ if(d_tmrID) {
+ killTimer(d_tmrID);
+ d_tmrID = 0;
+ }
+ }
+
+//------------------------------------------------------------
+//.F SliderBase::setUpdateTime
+// Specify the update interval for automatic scrolling
+//
+//.u Syntax
+//.f void SliderBase::setUpdateTime(int t)
+//
+//.u Parameters
+//.p int t -- update interval in milliseconds
+//
+//.u See also
+// @SliderBase::getScrollMode@
+//------------------------------------------------------------
+
+void SliderBase::setUpdateTime(int t)
+ {
+ if (t < 50)
+ t = 50;
+ d_updTime = t;
+ }
+
+//------------------------------------------------------------
+//.F SliderBase::mousePressEvent
+// Mouse press event handler
+//
+//.u Syntax
+//.f void SliderBase::mousePressEvent(QMouseEvent *e)
+//
+//.u Parameters
+//.p QMouseEvent *e -- Qt Mouse press event
+//------------------------------------------------------------
+
+void SliderBase::mousePressEvent(QMouseEvent *e)
+ {
+ QPoint p = e->pos();
+ const Qt::ButtonState button = e->button();
+ d_timerTick = 0;
+
+ getScrollMode(p, button, d_scrollMode, d_direction);
+ stopMoving();
+
+ switch(d_scrollMode) {
+ case ScrPage:
+ case ScrTimer:
+ d_mouseOffset = 0;
+ DoubleRange::incPages(d_direction);
+ emit sliderMoved(value(), _id);
+ d_tmrID = startTimer(qwtMax(250, 2 * d_updTime));
+ break;
+
+ case ScrMouse:
+ d_speed = 0;
+ if(button == Qt::RightButton)
+ {
+ emit sliderRightClicked(e->globalPos(), _id);
+ break;
+ }
+ d_time.start();
+ if(_cursorHoming && button == Qt::LeftButton)
+ {
+ _ignoreMouseMove = true;
+ d_mouseOffset = 0.0;
+ }
+ else
+ d_mouseOffset = getValue(p) - value();
+
+ emit sliderPressed(_id);
+ break;
+
+ default:
+ d_mouseOffset = 0;
+ d_direction = 0;
+ break;
+ }
+ }
+
+
+//------------------------------------------------------------
+//.-
+//.F SliderBase::buttonRelease
+// Emit a valueChanged() signal if necessary
+//
+//.u Syntax
+//.f void SliderBase::buttonReleased()
+//
+//------------------------------------------------------------
+void SliderBase::buttonReleased()
+{
+ if ((!d_tracking) || (value() != prevValue()))
+ emit valueChanged(value(), _id);
+}
+
+
+//------------------------------------------------------------
+//
+//.F SliderBase::mouseReleaseEvent
+// Mouse Release Event handler
+//
+//.u Syntax
+//.f void SliderBase::mouseReleaseEvent(QMouseEvent *e)
+//
+//.u Parameters
+//.p QMouseEvent *e -- Qt Mouse Event
+//
+//------------------------------------------------------------
+void SliderBase::mouseReleaseEvent(QMouseEvent *e)
+{
+ int ms = 0;
+ /*double inc = step(); */ // prevent compiler warning: unused variable
+ _ignoreMouseMove = false;
+ const Qt::ButtonState button = e->button();
+
+ switch(d_scrollMode)
+ {
+
+ case ScrMouse:
+
+ if(button == Qt::RightButton)
+ {
+ d_scrollMode = ScrNone;
+ break;
+ }
+ if(_cursorHoming && button == Qt::LeftButton)
+ d_scrollMode = ScrNone;
+ else
+ {
+ setPosition(e->pos());
+ d_direction = 0;
+ d_mouseOffset = 0;
+ if (d_mass > 0.0)
+ {
+ ms = d_time.elapsed();
+ if ((fabs(d_speed) > 0.0) && (ms < 50))
+ d_tmrID = startTimer(d_updTime);
+ }
+ else
+ {
+ d_scrollMode = ScrNone;
+ buttonReleased();
+ }
+ }
+ emit sliderReleased(_id);
+
+ break;
+
+ case ScrDirect:
+
+ setPosition(e->pos());
+ d_direction = 0;
+ d_mouseOffset = 0;
+ d_scrollMode = ScrNone;
+ buttonReleased();
+ break;
+
+ case ScrPage:
+ stopMoving();
+ d_timerTick = 0;
+ buttonReleased();
+ d_scrollMode = ScrNone;
+ break;
+
+ case ScrTimer:
+ stopMoving();
+ d_timerTick = 0;
+ buttonReleased();
+ d_scrollMode = ScrNone;
+ break;
+
+ default:
+ d_scrollMode = ScrNone;
+ buttonReleased();
+ }
+}
+
+
+//------------------------------------------------------------
+//
+//.F SliderBase::setPosition
+// Move the slider to a specified point, adjust the value
+// and emit signals if necessary
+//
+//.u Syntax
+//.f void SliderBase::setPosition(const QPoint &p)
+//
+//.u Parameters
+//.p const QPoint &p
+//
+//------------------------------------------------------------
+void SliderBase::setPosition(const QPoint &p)
+{
+ DoubleRange::fitValue(getValue(p) - d_mouseOffset);
+}
+
+
+//------------------------------------------------------------
+//
+//.F SliderBase::setTracking
+//
+// Enables or disables tracking.
+//
+//.u Syntax
+//.f void SliderBase::setTracking(bool enable)
+//
+//.u Parameters
+//.p bool enable -- enable (TRUE) or disable (FALSE) tracking
+//
+//.u Description
+//
+// If tracking is enabled, the slider emits a
+// valueChanged() signal whenever its value
+// changes (the default behaviour). If tracking
+// is disabled, the value changed() signal will only
+// be emitted if
+//.i -- the user releases the mouse
+// button and the value has changed or
+// -- at the end of automatic scrolling.
+//.P
+// Tracking is enabled by default.
+//------------------------------------------------------------
+void SliderBase::setTracking(bool enable)
+{
+ d_tracking = enable;
+}
+
+//------------------------------------------------------------
+//.-
+//.F SliderBase::mouseMoveEvent
+// Mouse Move Event handler
+//
+//.u Syntax
+//.f void SliderBase::mouseMoveEvent(QMouseEvent *e)
+//
+//.u Parameters
+//.p QMouseEvent *e -- Qt Mouse Move Event
+//
+//------------------------------------------------------------
+void SliderBase::mouseMoveEvent(QMouseEvent *e)
+{
+ if(_ignoreMouseMove)
+ {
+ _ignoreMouseMove = false;
+ return;
+ }
+
+ double ms = 0.0;
+ if (d_scrollMode == ScrMouse )
+ {
+ setPosition(e->pos());
+ if (d_mass > 0.0)
+ {
+ ms = double(d_time.elapsed());
+ if (ms < 1.0) ms = 1.0;
+ d_speed = (exactValue() - exactPrevValue()) / ms;
+ d_time.start();
+ }
+ if (value() != prevValue())
+ emit sliderMoved(value(), _id);
+ }
+
+}
+
+
+
+//------------------------------------------------------------
+//
+//.F SliderBase::timerEvent
+// Timer event handler
+//
+//.u Syntax
+//.f void SliderBase::timerEvent(QTimerEvent *e)
+//
+//.u Parameters
+//.p QTimerEvent *e -- Qt timer event
+//
+//------------------------------------------------------------
+
+void SliderBase::timerEvent(QTimerEvent*)
+{
+ double newval;
+ double inc = step();
+
+ switch (d_scrollMode)
+ {
+ case ScrMouse:
+ if (d_mass > 0.0)
+ {
+ d_speed *= exp( - double(d_updTime) * 0.001 / d_mass );
+ newval = exactValue() + d_speed * double(d_updTime);
+ DoubleRange::fitValue(newval);
+ // stop if d_speed < one step per second
+ if (fabs(d_speed) < 0.001 * fabs(step()))
+ {
+ d_speed = 0;
+ stopMoving();
+ buttonReleased();
+ }
+
+ }
+ else
+ stopMoving();
+
+ break;
+
+ case ScrPage:
+ DoubleRange::incPages(d_direction);
+
+ if (value() != prevValue())
+ emit sliderMoved(value(), _id);
+
+ if (!d_timerTick)
+ {
+ killTimer(d_tmrID);
+ d_tmrID = startTimer(d_updTime);
+ }
+ break;
+ case ScrTimer:
+ DoubleRange::fitValue(value() + double(d_direction) * inc);
+
+ if (value() != prevValue())
+ emit sliderMoved(value(), _id);
+
+ if (!d_timerTick)
+ {
+ killTimer(d_tmrID);
+ d_tmrID = startTimer(d_updTime);
+ }
+ break;
+ default:
+ stopMoving();
+ break;
+ }
+
+ d_timerTick = 1;
+}
+
+
+//------------------------------------------------------------
+//
+//.F SliderBase::valueChange
+// Notify change of value
+//
+//.u Syntax
+//.f void SliderBase::valueChange()
+//
+//.u Parameters
+//.p double x -- new value
+//
+//.u Description
+// This function can be reimplemented by derived classes
+// in order to keep track of changes, i.e. repaint the widget.
+// The default implementation emits a valueChanged() signal
+// if tracking is enabled.
+//
+//------------------------------------------------------------
+void SliderBase::valueChange()
+{
+ if (d_tracking)
+ emit valueChanged(value(), _id);
+}
+
+//------------------------------------------------------------
+//
+//.F SliderBase::setMass
+// Set the slider's mass for flywheel effect.
+//
+//.u Syntax
+//.f void SliderBase::setMass(double val)
+//
+//.u Parameters
+//.p double val -- new mass in kg
+//
+//.u Description
+//
+// If the slider's mass is greater then 0, it will continue
+// to move after the mouse button has been released. Its speed
+// decreases with time at a rate depending on the slider's mass.
+// A large mass means that it will continue to move for a
+// long time.
+//
+// Limits: If the mass is smaller than 1g, it is set to zero.
+// The maximal mass is limited to 100kg.
+//
+// Derived widgets may overload this function to make it public.
+//
+//------------------------------------------------------------
+void SliderBase::setMass(double val)
+{
+ if (val < 0.001)
+ d_mass = 0.0;
+ else if (val > 100.0)
+ d_mass = 100.0;
+ else
+ d_mass = val;
+}
+
+
+//------------------------------------------------------------
+//
+//.F SliderBase::setValue
+// Move the slider to a specified value
+//
+//.u Syntax
+//.f void SliderBase::setValue(double val)
+//
+//.u Parameters
+//.p double val -- new value
+//
+//.u Description
+// This function can be used to move the slider to a value
+// which is not an integer multiple of the step size.
+//
+//.u See also
+// @SliderBase::fitValue@
+//------------------------------------------------------------
+
+void SliderBase::setValue(double val)
+ {
+ if (d_scrollMode == ScrMouse)
+ stopMoving();
+ DoubleRange::setValue(val);
+ }
+
+
+//------------------------------------------------------------
+//
+//.F QSlider::fitValue
+// Set the slider's value to the nearest integer multiple
+// of the step size.
+//
+//.u Syntax
+//.f void SliderBase::fitValue(double val)
+//
+//.u See also:
+// @SliderBase::setValue@
+//------------------------------------------------------------
+void SliderBase::fitValue(double val)
+{
+ if (d_scrollMode == ScrMouse) stopMoving();
+ DoubleRange::fitValue(val);
+}
+
+
+//------------------------------------------------------------
+//
+//.F SliderBase::incValue
+// Increment the value by a specified number of steps
+//
+//.u Syntax
+//.f void SliderBase::incValue(int steps)
+//
+//.u Parameters
+//.p int steps -- number of steps
+//
+//------------------------------------------------------------
+void SliderBase::incValue(int steps)
+{
+ if (d_scrollMode == ScrMouse) stopMoving();
+ DoubleRange::incValue(steps);
+}
+
+
+//------------------------------------------------------------
+//
+//.F SliderBase::stepPage
+// Increment the value by a specified number of steps
+//
+//.u Syntax
+//.f void SliderBase::stepPages(int pages)
+//
+//.u Parameters
+//.p int pages -- +/- number of pages
+//
+//.u Description
+// Steps the control as if pager was clicked.
+// Designed to be called from outside (like from a buddy label), rather than from
+// the control itself. Calls DoubleRange::incPages, which normally causes valueChange()
+// (and emits valueChanged), but also emits sliderMoved.
+//
+//------------------------------------------------------------
+void SliderBase::stepPages(int pages)
+{
+ DoubleRange::incPages(pages);
+ emit sliderMoved(value(), _id);
+}
+
+
+//------------------------------------------------------------
+//
+//.F SliderBase::getValue
+// Determine the value corresponding to a specified poind
+//
+//.u Syntax
+//.f void SliderBase::getValue(const QPoint &p)
+//
+//.u Parameters
+//.p const QPoint &p -- point
+//
+//.u Description
+// This is an abstract virtual function which is called when
+// the user presses or releases a mouse button or moves the
+// mouse. It has to be implemented by the derived class.
+//
+//------------------------------------------------------------
+
+//------------------------------------------------------------
+//
+//.F SliderBase::getScrollMode
+// Determine what to do when the user presses a mouse button.
+//
+//.u Syntax
+//.f void SliderBase::getScrollMode(const QPoint &p, int &scrollMode, int &direction)
+//
+//.u Input Parameters
+//.p const QPoint &p -- point where the mouse was pressed
+//
+//.u Output parameters
+// int &scrollMode -- The scrolling mode
+// int &direction -- direction: 1, 0, or -1.
+//
+//.u Description
+// This function is abstract and has to be implemented by derived classes.
+// It is called on a mousePress event. The derived class can determine
+// what should happen next in dependence of the position where the mouse
+// was pressed by returning scrolling mode and direction. SliderBase
+// knows the following modes:
+//.t
+// SliderBase::ScrNone -- Scrolling switched off. Don't change the value.
+// SliderBase::ScrMouse -- Change the value while the user keeps the
+// button pressed and moves the mouse.
+// SliderBase::ScrTimer -- Automatic scrolling. Increment the value
+// in the specified direction as long as
+// the user keeps the button pressed.
+// SliderBase::ScrPage -- Automatic scrolling. Same as ScrTimer, but
+// increment by page size.
+//
+//
+//------------------------------------------------------------
+
+//------------------------------------------------------------
+//
+//.F SliderBase::valueChanged
+// Notify a change of value.
+//
+//.u Syntax
+//.f void SliderBase::valueChanged(double value, int id)
+//
+//.u Parameters
+//.p double value -- new value
+//
+//.u Description
+// In the default setting
+// (tracking enabled), this signal will be emitted every
+// time the value changes ( see setTracking() ).
+//------------------------------------------------------------
+
+//------------------------------------------------------------
+//
+//.F SliderBase::sliderPressed
+// This signal is emitted when the user presses the
+// movable part of the slider (start ScrMouse Mode).
+//
+//.u Syntax
+//.f void SliderBase::sliderPressed()
+//
+//------------------------------------------------------------
+
+//------------------------------------------------------------
+//
+//.F SliderBase::SliderReleased
+// This signal is emitted when the user releases the
+// movable part of the slider.
+//
+//.u Syntax
+//.f void QwtSliderbase::SliderReleased()
+//
+//------------------------------------------------------------
+
+
+//------------------------------------------------------------
+//
+//.F SliderBase::sliderMoved
+// This signal is emitted when the user moves the
+// slider with the mouse.
+//
+//.u Syntax
+//.f void SliderBase::sliderMoved(double value, int _id)
+//
+//.u Parameters
+//.p double value -- new value
+//
+//------------------------------------------------------------
+
+
+
+
+
+
+
+
+
diff --git a/muse2/muse/widgets/sliderbase.h b/muse2/muse/widgets/sliderbase.h
new file mode 100644
index 00000000..d2de6f7c
--- /dev/null
+++ b/muse2/muse/widgets/sliderbase.h
@@ -0,0 +1,107 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: sliderbase.h,v 1.4.2.3 2006/11/14 06:28:37 terminator356 Exp $
+
+// Copyright (C) 1997 Josef Wilgen
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2,
+// as published by the Free Software Foundation.
+//
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SLIDERBASE_H__
+#define __SLIDERBASE_H__
+
+#include "drange.h"
+#include <q3frame.h>
+#include <qpixmap.h>
+#include <qdatetime.h>
+//#include <qbutton.h>
+#include <QtGui>
+//Added by qt3to4:
+#include <QWheelEvent>
+#include <QMouseEvent>
+#include <QTimerEvent>
+
+//---------------------------------------------------------
+// SliderBase
+//---------------------------------------------------------
+
+class SliderBase : public QWidget, public DoubleRange
+ {
+ Q_OBJECT
+ Q_PROPERTY( int id READ id WRITE setId )
+ Q_PROPERTY( double minValue READ minValue WRITE setMinValue )
+ Q_PROPERTY( double maxValue READ maxValue WRITE setMaxValue )
+ Q_PROPERTY( double value READ value WRITE setValue )
+
+ int _id;
+ int d_tmrID;
+ int d_updTime;
+ int d_timerTick;
+ QTime d_time;
+ double d_speed;
+ double d_mass;
+ bool _cursorHoming;
+ bool _ignoreMouseMove;
+
+ void buttonReleased();
+
+ protected:
+ int d_scrollMode;
+ double d_mouseOffset;
+ int d_direction;
+ int d_tracking;
+
+ virtual void setMass(double val);
+ void setPosition(const QPoint &p);
+ virtual void valueChange();
+ virtual double mass() const { return d_mass; }
+
+ void wheelEvent(QWheelEvent *e);
+ void timerEvent(QTimerEvent *e);
+ void mousePressEvent(QMouseEvent *e);
+ void mouseReleaseEvent(QMouseEvent *e);
+ void mouseMoveEvent(QMouseEvent *e);
+ virtual double getValue(const QPoint & p) = 0;
+ virtual void getScrollMode( QPoint &p, const Qt::ButtonState &button,
+ int &scrollMode, int &direction) = 0;
+
+ public slots:
+ void setValue(double val);
+ void fitValue(double val);
+ void incValue(int steps);
+
+ signals:
+ void valueChanged(double value, int id);
+ void sliderPressed(int id);
+ void sliderReleased(int id);
+ void sliderMoved(double value, int id);
+ void sliderRightClicked(const QPoint &p, int id);
+
+ public:
+ enum { ScrNone, ScrMouse, ScrTimer, ScrDirect, ScrPage };
+
+ SliderBase( QWidget *parent = 0, const char *name = 0 );
+ ~SliderBase();
+
+ bool cursorHoming() const { return _cursorHoming; }
+ void setCursorHoming(bool b) { _cursorHoming = b; }
+ void setUpdateTime(int t);
+ // void incValue(double nSteps);
+ void stopMoving();
+ void setTracking(bool enable);
+
+ double value() const { return DoubleRange::value(); }
+ void stepPages(int pages);
+ double minValue() const { return DoubleRange::minValue(); }
+ double maxValue() const { return DoubleRange::maxValue(); }
+ void setMinValue(double v) { DoubleRange::setRange(v, maxValue(), 0.0, 1); }
+ void setMaxValue(double v) { DoubleRange::setRange(minValue(), v, 0.0, 1); }
+ int id() const { return _id; }
+ void setId(int i) { _id = i; }
+ };
+
+#endif
diff --git a/muse2/muse/widgets/songinfo.ui b/muse2/muse/widgets/songinfo.ui
new file mode 100644
index 00000000..2e4e7e80
--- /dev/null
+++ b/muse2/muse/widgets/songinfo.ui
@@ -0,0 +1,115 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>SongInfo</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>SongInfo</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>403</width>
+ <height>274</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Song Information</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QTextEdit">
+ <property name="name">
+ <cstring>songInfoText</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>311</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string>Alt+C</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Ok</string>
+ </property>
+ <property name="accel">
+ <string>Alt+O</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>SongInfo</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>SongInfo</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">songinfo.ui.h</include>
+</includes>
+<slots>
+ <slot>buttonOk_clicked()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/spinbox.cpp b/muse2/muse/widgets/spinbox.cpp
new file mode 100644
index 00000000..6eed0ba6
--- /dev/null
+++ b/muse2/muse/widgets/spinbox.cpp
@@ -0,0 +1,83 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: spinbox.cpp,v 1.1.2.3 2009/07/09 18:27:11 terminator356 Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+#include <qlineedit.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include <QEvent>
+#include "spinbox.h"
+
+//---------------------------------------------------------
+// SpinBox
+//---------------------------------------------------------
+
+SpinBox::SpinBox(QWidget* parent, const char* name)
+ : QSpinBox(parent, name)
+{
+ _clearFocus = true;
+}
+
+SpinBox::SpinBox(int minValue, int maxValue, int step, QWidget* parent, const char* name)
+ : QSpinBox(minValue, maxValue, step, parent, name)
+{
+ _clearFocus = true;
+}
+
+bool SpinBox::eventFilter(QObject* o, QEvent* ev)
+{
+ // if (o != (QObject*)editor()) ddskrjo can't find editor()
+ // return QSpinBox::eventFilter(o,ev);
+
+ bool retval = FALSE;
+ if(ev->type() == QEvent::KeyPress)
+ {
+ QKeyEvent* k = (QKeyEvent*)ev;
+ if(k->key() == Qt::Key_Up || k->key() == Qt::Key_Down)
+ {
+ // stepUp/stepDown will be called. Set this now.
+ _clearFocus = false;
+ }
+ else if (k->key() == Qt::Key_Enter || k->key() == Qt::Key_Return)
+ {
+ // With this line, two enter presses after an edit will clear focus.
+ // Without, just one enter press clears the focus.
+ //if(!editor()->isModified())
+ {
+ clearFocus();
+ return TRUE;
+ }
+ }
+ }
+ else
+ if(ev->type() == QEvent::MouseButtonDblClick)
+ {
+ emit doubleClicked();
+ return TRUE;
+ }
+
+ retval = QSpinBox::eventFilter(o, ev);
+
+ return retval;
+}
+
+void SpinBox::stepUp()
+{
+ QSpinBox::stepUp();
+ if(_clearFocus)
+ clearFocus();
+ else
+ _clearFocus = true;
+}
+
+void SpinBox::stepDown()
+{
+ QSpinBox::stepDown();
+ if(_clearFocus)
+ clearFocus();
+ else
+ _clearFocus = true;
+}
+
diff --git a/muse2/muse/widgets/spinbox.h b/muse2/muse/widgets/spinbox.h
new file mode 100644
index 00000000..6eaa2da7
--- /dev/null
+++ b/muse2/muse/widgets/spinbox.h
@@ -0,0 +1,44 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: spinbox.h,v 1.1.2.2 2009/02/02 21:38:01 terminator356 Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+// SpinBox:
+// Click up/down, or mousewheel, or hit enter with un-modified text (which means enter TWICE for modified text),
+// and the control will give up focus, thereby allowing you to use global shortcut keys afterwards.
+// Up/down keys still keep the focus.
+#ifndef __SPINBOX_H__
+#define __SPINBOX_H__
+
+#include <qspinbox.h>
+//Added by qt3to4:
+#include <QEvent>
+
+//---------------------------------------------------------
+// SpinBox
+//---------------------------------------------------------
+
+class SpinBox : public QSpinBox {
+ Q_OBJECT
+
+ bool _clearFocus;
+
+ protected:
+ bool eventFilter(QObject* obj, QEvent* ev);
+
+ public slots:
+ virtual void stepUp();
+ virtual void stepDown();
+
+ signals:
+ void doubleClicked();
+
+ public:
+ SpinBox(QWidget* parent=0, const char* name = 0);
+ SpinBox(int minValue, int maxValue, int step = 1, QWidget* parent=0, const char* name = 0);
+};
+
+#endif
+
diff --git a/muse2/muse/widgets/spinboxFP.cpp b/muse2/muse/widgets/spinboxFP.cpp
new file mode 100644
index 00000000..c2906940
--- /dev/null
+++ b/muse2/muse/widgets/spinboxFP.cpp
@@ -0,0 +1,80 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: spinboxFP.cpp,v 1.1.1.1 2003/10/27 18:55:03 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <cmath>
+
+//#include <qvalidator.h>
+#include <QtGui>
+#include "spinboxFP.h"
+
+//---------------------------------------------------------
+// SpinBoxFP
+//---------------------------------------------------------
+
+SpinBoxFP::SpinBoxFP(QWidget* parent, const char* name)
+ : QSpinBox(parent, name)
+ {
+ _precision = 0;
+ //setValidator(new QDoubleValidator(this)); ddskrjo
+ }
+
+SpinBoxFP::SpinBoxFP(int minValue, int maxValue, int step, QWidget* parent, const char* name)
+ : QSpinBox(minValue, maxValue, step, parent, name)
+ {
+ _precision = 0;
+ //setValidator(new QDoubleValidator(this)); ddskrjo
+ }
+
+//---------------------------------------------------------
+// setPrecision
+//---------------------------------------------------------
+
+void SpinBoxFP::setPrecision(int val)
+ {
+ _precision = val;
+ //updateDisplay(); ddskrjo
+ }
+
+//---------------------------------------------------------
+// mapValueToText
+//---------------------------------------------------------
+
+QString SpinBoxFP::mapValueToText(int value)
+ {
+ if (_precision) {
+ QString s;
+ int div = int(exp10(_precision));
+// printf("val %d, prec %d, div %d\n", value, _precision, div);
+ s.sprintf("%d.%0*d", value/div, _precision, value%div);
+ return s;
+ }
+ return textFromValue(value); // ddskrjo
+ }
+
+//---------------------------------------------------------
+// mapTextToValue
+//---------------------------------------------------------
+/* ddskrjo
+int SpinBoxFP::mapTextToValue(bool* ok)
+ {
+ QString qs = cleanText();
+ if (_precision) {
+ const char* s = qs.latin1();
+ int a, b;
+ int n = sscanf(s, "%d.%d", &a, &b);
+ if (n != 2) {
+ *ok = false;
+ return 0;
+ }
+ int div = int(exp10(_precision));
+ return a * div + b;
+ }
+ return QSpinBox::mapTextToValue(ok);
+ }
+
+*/
diff --git a/muse2/muse/widgets/spinboxFP.h b/muse2/muse/widgets/spinboxFP.h
new file mode 100644
index 00000000..760a7d06
--- /dev/null
+++ b/muse2/muse/widgets/spinboxFP.h
@@ -0,0 +1,35 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: spinboxFP.h,v 1.1.1.1.2.1 2008/05/21 00:28:54 terminator356 Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SPINBOXFP_H__
+#define __SPINBOXFP_H__
+
+#include <qspinbox.h>
+
+//---------------------------------------------------------
+// SpinBoxFP
+//---------------------------------------------------------
+
+class SpinBoxFP : public QSpinBox {
+ Q_OBJECT
+ Q_PROPERTY( int precision READ precision WRITE setPrecision )
+
+ int _precision;
+
+ protected:
+ virtual QString mapValueToText(int value);
+ //virtual int mapTextToValue(bool* ok);
+
+ public:
+ SpinBoxFP(QWidget* parent=0, const char* name = 0);
+ SpinBoxFP(int minValue, int maxValue, int step = 1, QWidget* parent=0, const char* name = 0);
+ void setPrecision(int val);
+ int precision() const { return _precision; }
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/splitter.cpp b/muse2/muse/widgets/splitter.cpp
new file mode 100644
index 00000000..d1f9cfd9
--- /dev/null
+++ b/muse2/muse/widgets/splitter.cpp
@@ -0,0 +1,77 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: splitter.cpp,v 1.1.1.1 2003/10/27 18:54:59 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "splitter.h"
+#include "xml.h"
+#include <qstringlist.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+
+//---------------------------------------------------------
+// Splitter
+//---------------------------------------------------------
+
+Splitter::Splitter(Qt::Orientation o, QWidget* parent, const char* name)
+ : QSplitter(o, parent, name)
+ {
+ setOpaqueResize(true);
+ }
+
+//---------------------------------------------------------
+// saveConfiguration
+//---------------------------------------------------------
+
+void Splitter::writeStatus(int level, Xml& xml)
+ {
+ Q3ValueList<int> vl = sizes();
+ //xml.nput(level++, "<%s>", name());
+ xml.nput(level++, "<%s>", Xml::xmlString(name()).latin1());
+ Q3ValueListIterator<int> ivl = vl.begin();
+ for (; ivl != vl.end(); ++ivl) {
+ xml.nput("%d ", *ivl);
+ }
+ //xml.nput("</%s>\n", name());
+ xml.nput("</%s>\n", Xml::xmlString(name()).latin1());
+ }
+
+//---------------------------------------------------------
+// loadConfiguration
+//---------------------------------------------------------
+
+void Splitter::readStatus(Xml& xml)
+ {
+ Q3ValueList<int> vl;
+
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ xml.unknown("Splitter");
+ break;
+ case Xml::Text:
+ {
+ QStringList sl = QStringList::split(' ', tag);
+ for (QStringList::Iterator it = sl.begin(); it != sl.end(); ++it) {
+ int val = (*it).toInt();
+ vl.append(val);
+ }
+ }
+ break;
+ case Xml::TagEnd:
+ if (tag == name()) {
+ setSizes(vl);
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
diff --git a/muse2/muse/widgets/splitter.h b/muse2/muse/widgets/splitter.h
new file mode 100644
index 00000000..8be4da5b
--- /dev/null
+++ b/muse2/muse/widgets/splitter.h
@@ -0,0 +1,29 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: splitter.h,v 1.1.1.1 2003/10/27 18:54:51 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SPLITTER_H__
+#define __SPLITTER_H__
+
+#include <qsplitter.h>
+
+class Xml;
+
+//---------------------------------------------------------
+// Splitter
+//---------------------------------------------------------
+
+class Splitter : public QSplitter {
+ Q_OBJECT
+
+ public:
+ Splitter(Qt::Orientation o, QWidget* parent, const char* name);
+ void writeStatus(int level, Xml&);
+ void readStatus(Xml&);
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/swidget.cpp b/muse2/muse/widgets/swidget.cpp
new file mode 100644
index 00000000..29cece1e
--- /dev/null
+++ b/muse2/muse/widgets/swidget.cpp
@@ -0,0 +1,20 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: swidget.cpp,v 1.1.1.1 2003/10/27 18:54:27 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "swidget.h"
+//Added by qt3to4:
+#include <QResizeEvent>
+
+//---------------------------------------------------------
+// resizeEvent
+//---------------------------------------------------------
+
+void SWidget::resizeEvent(QResizeEvent* ev)
+ {
+ emit heightChanged(ev->size().height());
+ }
+
diff --git a/muse2/muse/widgets/swidget.h b/muse2/muse/widgets/swidget.h
new file mode 100644
index 00000000..806fe538
--- /dev/null
+++ b/muse2/muse/widgets/swidget.h
@@ -0,0 +1,33 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: swidget.h,v 1.1.1.1 2003/10/27 18:54:49 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __SWIDGET_H__
+#define __SWIDGET_H__
+
+#include <qwidget.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+
+//---------------------------------------------------------
+// SWidget
+// a simple widget which emits a heighChanged signal
+// on received ResizeEventīs
+//---------------------------------------------------------
+
+class SWidget : public QWidget {
+ virtual void resizeEvent(QResizeEvent*);
+ Q_OBJECT
+
+ signals:
+ void heightChanged(int);
+
+ public:
+ SWidget(QWidget* parent) : QWidget(parent) {}
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/synthconfigbase.ui b/muse2/muse/widgets/synthconfigbase.ui
new file mode 100644
index 00000000..761c8fb8
--- /dev/null
+++ b/muse2/muse/widgets/synthconfigbase.ui
@@ -0,0 +1,247 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>SynthConfigBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>SynthConfigBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>630</width>
+ <height>492</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Synth Configuration</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="1" column="1">
+ <property name="name">
+ <cstring>GroupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Instances</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Midi Port</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>instanceList</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>removeInstance</cstring>
+ </property>
+ <property name="text">
+ <string>Remove Instance</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>113</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>groupBox10</cstring>
+ </property>
+ <property name="title">
+ <string>Midi connections</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView">
+ <property name="name">
+ <cstring>mdevView</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>GroupBoxPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="title">
+ <string>Soft Synthesizer</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>addInstance</cstring>
+ </property>
+ <property name="text">
+ <string>Add Instance</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>File</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Inst</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Version</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Description</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>synthList</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>list of available software synthesizers</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/synthwizardbase.h b/muse2/muse/widgets/synthwizardbase.h
new file mode 100644
index 00000000..61d3985c
--- /dev/null
+++ b/muse2/muse/widgets/synthwizardbase.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+** Form interface generated from reading ui file 'synthwizardbase.ui'
+**
+** Created: Wed Nov 12 10:38:24 2003
+** by: The User Interface Compiler ($Id: synthwizardbase.h,v 1.5 2003/11/12 18:55:06 wschweer Exp $)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#ifndef SYNTHCONFIGBASE_H
+#define SYNTHCONFIGBASE_H
+
+#include <qvariant.h>
+#include <q3wizard.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+
+class Q3VBoxLayout;
+class Q3HBoxLayout;
+class Q3GridLayout;
+class QWidget;
+class Q3GroupBox;
+class Q3ListView;
+class Q3ListViewItem;
+class QPushButton;
+
+class SynthConfigBase : public Q3Wizard
+{
+ Q_OBJECT
+
+public:
+ SynthConfigBase( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
+ ~SynthConfigBase();
+
+ QWidget* WizardPage;
+ Q3GroupBox* GroupBox2;
+ Q3ListView* synthList;
+ QPushButton* addInstance;
+ Q3GroupBox* GroupBox3;
+ Q3ListView* instanceList;
+ QPushButton* removeInstance;
+ QWidget* WizardPage_2;
+
+protected:
+ Q3VBoxLayout* WizardPageLayout;
+ Q3VBoxLayout* GroupBox2Layout;
+ Q3HBoxLayout* Layout1;
+ Q3VBoxLayout* GroupBox3Layout;
+ Q3HBoxLayout* Layout3;
+
+protected slots:
+ virtual void languageChange();
+
+};
+
+#endif // SYNTHCONFIGBASE_H
diff --git a/muse2/muse/widgets/tb1.cpp b/muse2/muse/widgets/tb1.cpp
new file mode 100644
index 00000000..8aa6225f
--- /dev/null
+++ b/muse2/muse/widgets/tb1.cpp
@@ -0,0 +1,225 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: tb1.cpp,v 1.3.2.2 2007/01/04 00:35:17 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <assert.h>
+#include <stdio.h>
+#include <values.h>
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <q3listbox.h>
+#include <qtoolbutton.h>
+
+#include "config.h"
+#include "lcombo.h"
+#include "tb1.h"
+#include "globals.h"
+#include "poslabel.h"
+#include "pitchlabel.h"
+
+static int rasterTable[] = {
+ //------ 8 4 2
+ 1, 4, 8, 16, 32, 64, 128, 256, 512, 1024,
+ 1, 6, 12, 24, 48, 96, 192, 384, 768, 1536,
+ 1, 9, 18, 36, 72, 144, 288, 576, 1152, 2304
+ };
+
+static const char* rasterStrings[] = {
+ QT_TR_NOOP("Off"), "2pp", "5pp", "64T", "32T", "16T", "8T", "4T", "2T", "1T",
+ QT_TR_NOOP("Off"), "3pp", "6pp", "64", "32", "16", "8", "4", "2", "1",
+ QT_TR_NOOP("Off"), "4pp", "7pp", "64.", "32.", "16.", "8.", "4.", "2.", "1."
+ };
+
+static int quantTable[] = {
+ 1, 16, 32, 64, 128, 256, 512, 1024,
+ 1, 24, 48, 96, 192, 384, 768, 1536,
+ 1, 36, 72, 144, 288, 576, 1152, 2304
+ };
+
+static const char* quantStrings[] = {
+ QT_TR_NOOP("Off"), "64T", "32T", "16T", "8T", "4T", "2T", "1T",
+ QT_TR_NOOP("Off"), "64", "32", "16", "8", "4", "2", "1",
+ QT_TR_NOOP("Off"), "64.", "32.", "16.", "8.", "4.", "2.", "1."
+ };
+
+//---------------------------------------------------------
+// genToolbar
+// solo time pitch raster quant
+//---------------------------------------------------------
+
+Toolbar1::Toolbar1(Q3MainWindow* parent, int r, int q, bool sp)
+ : Q3ToolBar(QString("Qant'n'Snap-tools"), parent)
+ {
+ showPitch = sp;
+ setHorizontalStretchable(false);
+
+ solo = new QToolButton(this);
+ solo->setText(tr("Solo"));
+ solo->setToggleButton(true);
+
+ //---------------------------------------------------
+ // Cursor Position
+ //---------------------------------------------------
+
+ QLabel* label = new QLabel(tr("Cursor"), this, "Cursor");
+ label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ label->setIndent(3);
+ pos = new PosLabel(this, "pos");
+ if (showPitch) {
+ pitch = new PitchLabel(this);
+ pitch->setEnabled(false);
+ }
+
+ //---------------------------------------------------
+ // Raster, Quant.
+ //---------------------------------------------------
+
+ raster = new LabelCombo(tr("Snap"), this);
+ quant = new LabelCombo(tr("Quantize"), this);
+
+ Q3ListBox* rlist = new Q3ListBox(this);
+ Q3ListBox* qlist = new Q3ListBox(this);
+ rlist->setMinimumWidth(95);
+ qlist->setMinimumWidth(95);
+ //raster->setListBox(rlist); ddskrjo
+ //quant->setListBox(qlist); ddskrjo
+ rlist->setColumnMode(3);
+ qlist->setColumnMode(3);
+ for (int i = 0; i < 30; i++)
+ rlist->insertItem(tr(rasterStrings[i]), i);
+ for (int i = 0; i < 24; i++)
+ qlist->insertItem(tr(quantStrings[i]), i);
+ setRaster(r);
+ setQuant(q);
+
+ //---------------------------------------------------
+ // To Menu
+ //---------------------------------------------------
+
+ LabelCombo* to = new LabelCombo(tr("To"), this);
+ Q3ListBox* toList = new Q3ListBox(this);
+ //to->setListBox(toList); ddskrjo
+ toList->insertItem(tr("All Events"), 0);
+ toList->insertItem(tr("Looped Ev."), CMD_RANGE_LOOP);
+ toList->insertItem(tr("Selected Ev."), CMD_RANGE_SELECTED);
+ toList->insertItem(tr("Looped+Sel."), CMD_RANGE_LOOP | CMD_RANGE_SELECTED);
+
+ connect(raster, SIGNAL(activated(int)), SLOT(_rasterChanged(int)));
+ connect(quant, SIGNAL(activated(int)), SLOT(_quantChanged(int)));
+ connect(to, SIGNAL(activated(int)), SIGNAL(toChanged(int)));
+ connect(solo, SIGNAL(toggled(bool)), SIGNAL(soloChanged(bool)));
+ pos->setEnabled(false);
+ }
+
+//---------------------------------------------------------
+// rasterChanged
+//---------------------------------------------------------
+
+void Toolbar1::_rasterChanged(int index)
+ {
+ emit rasterChanged(rasterTable[index]);
+ }
+
+//---------------------------------------------------------
+// quantChanged
+//---------------------------------------------------------
+
+void Toolbar1::_quantChanged(int index)
+ {
+ emit quantChanged(quantTable[index]);
+ }
+
+//---------------------------------------------------------
+// setPitch
+//---------------------------------------------------------
+
+void Toolbar1::setPitch(int val)
+ {
+ if (showPitch) {
+ pitch->setEnabled(val != -1);
+ pitch->setPitch(val);
+ }
+ }
+
+void Toolbar1::setInt(int val)
+ {
+ if (showPitch) {
+ pitch->setEnabled(val != -1);
+ pitch->setInt(val);
+ }
+ }
+
+//---------------------------------------------------------
+// setTime
+//---------------------------------------------------------
+
+void Toolbar1::setTime(unsigned val)
+ {
+ if (!pos->isVisible()) {
+ printf("NOT visible\n");
+ return;
+ }
+ if (val == MAXINT)
+ pos->setEnabled(false);
+ else {
+ pos->setEnabled(true);
+ pos->setValue(val);
+ }
+ }
+
+//---------------------------------------------------------
+// setRaster
+//---------------------------------------------------------
+
+void Toolbar1::setRaster(int val)
+ {
+ for (unsigned i = 0; i < sizeof(rasterTable)/sizeof(*rasterTable); i++) {
+ if (val == rasterTable[i]) {
+ raster->setCurrentItem(i);
+ return;
+ }
+ }
+ printf("setRaster(%d) not defined\n", val);
+ raster->setCurrentItem(0);
+ }
+
+//---------------------------------------------------------
+// setQuant
+//---------------------------------------------------------
+
+void Toolbar1::setQuant(int val)
+ {
+ for (unsigned i = 0; i < sizeof(quantTable)/sizeof(*quantTable); i++) {
+ if (val == quantTable[i]) {
+ quant->setCurrentItem(i);
+ return;
+ }
+ }
+ printf("setQuant(%d) not defined\n", val);
+ quant->setCurrentItem(0);
+ }
+
+//---------------------------------------------------------
+// setSolo
+//---------------------------------------------------------
+
+void Toolbar1::setSolo(bool flag)
+ {
+ solo->blockSignals(true);
+ solo->setOn(flag);
+ solo->blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// setPitchMode
+//---------------------------------------------------------
+
+void Toolbar1::setPitchMode(bool /*flag*/)
+ {
+// pitch->setPitchMode(flag);
+ }
+
diff --git a/muse2/muse/widgets/tb1.h b/muse2/muse/widgets/tb1.h
new file mode 100644
index 00000000..b6d7860a
--- /dev/null
+++ b/muse2/muse/widgets/tb1.h
@@ -0,0 +1,57 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: tb1.h,v 1.2 2004/01/11 18:55:37 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __TB1_H__
+#define __TB1_H__
+
+#include <qwidget.h>
+#include <q3toolbar.h>
+
+class PosLabel;
+class PitchLabel;
+class Track;
+class LabelCombo;
+class QToolButton;
+
+//---------------------------------------------------------
+// Toolbar1
+//---------------------------------------------------------
+
+class Toolbar1 : public Q3ToolBar {
+ QToolButton* solo;
+ PosLabel* pos;
+ PitchLabel* pitch;
+ LabelCombo* quant;
+ LabelCombo* raster;
+ bool showPitch;
+ Q_OBJECT
+
+ private slots:
+ void _rasterChanged(int);
+ void _quantChanged(int);
+
+ public slots:
+ void setTime(unsigned);
+ void setPitch(int);
+ void setInt(int);
+ void setRaster(int);
+ void setQuant(int);
+
+ signals:
+ void rasterChanged(int);
+ void quantChanged(int);
+ void soloChanged(bool);
+ void toChanged(int);
+
+ public:
+ Toolbar1(Q3MainWindow* parent, int r=96,
+ int q=96, bool showPitch=true);
+ void setSolo(bool val);
+ void setPitchMode(bool flag);
+ };
+
+#endif
diff --git a/muse2/muse/widgets/tempolabel.cpp b/muse2/muse/widgets/tempolabel.cpp
new file mode 100644
index 00000000..35f75b09
--- /dev/null
+++ b/muse2/muse/widgets/tempolabel.cpp
@@ -0,0 +1,126 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: tempolabel.cpp,v 1.1.1.1 2003/10/27 18:54:29 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qapplication.h>
+#include <qstyle.h>
+#include <qvalidator.h>
+//Added by qt3to4:
+#include <QLabel>
+#include "tempolabel.h"
+
+//---------------------------------------------------------
+// TempoLabel
+//---------------------------------------------------------
+
+TempoLabel::TempoLabel(QWidget* parent, const char* name)
+ : QLabel(parent, name)
+ {
+ setFrameStyle(WinPanel | Sunken);
+ setLineWidth(2);
+ setMidLineWidth(3);
+ _value = 1.0;
+ setValue(0.0);
+ setIndent(3);
+ setMinimumSize(sizeHint());
+ }
+
+//---------------------------------------------------------
+// setVal
+//---------------------------------------------------------
+
+void TempoLabel::setValue(int val)
+ {
+ setValue(double(val/1000.0));
+ }
+
+void TempoLabel::setValue(double val)
+ {
+ if (val == _value)
+ return;
+ _value = val;
+ QString s = QString("%1").arg(val, 3, 'f', 2);
+ setText(s);
+ }
+
+//---------------------------------------------------------
+// sizeHint
+//---------------------------------------------------------
+
+QSize TempoLabel::sizeHint() const
+ {
+ QFontMetrics fm(font());
+ int fw = 4;
+ int h = fm.height() + fw * 2;
+ int w = 6 + fm.width(QString("000.00")) + fw * 2; // 6=indent
+ return QSize(w, h).expandedTo(QApplication::globalStrut());
+ }
+
+//---------------------------------------------------------
+// TempoSpinBox
+//---------------------------------------------------------
+
+TempoEdit::TempoEdit(QWidget* parent, const char* name)
+ : QSpinBox(parent, name)
+ {
+ setLineStep(100);
+ setMaxValue(60000);
+ setMinValue(3000);
+ //setValidator(new QDoubleValidator(this)); ddskrjo
+ connect(this, SIGNAL(valueChanged(int)), SLOT(tempoChanged(int)));
+ }
+
+//---------------------------------------------------------
+// sizeHint
+//---------------------------------------------------------
+
+QSize TempoEdit::sizeHint() const
+ {
+ QFontMetrics fm(font());
+ int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth,0, this); // ddskrjo
+ int h = fm.height() + fw * 2;
+ int w = 2 + fm.width(QString("000.00")) + fw * 4 + 30;
+ return QSize(w, h).expandedTo(QApplication::globalStrut());
+ }
+
+//---------------------------------------------------------
+// mapValueToText
+//---------------------------------------------------------
+
+QString TempoEdit::mapValueToText(int val)
+ {
+ double v = val / 100.0;
+ return QString("%1").arg(v, 3, 'f', 2);
+ }
+
+//---------------------------------------------------------
+// mapTextToValue
+//---------------------------------------------------------
+
+int TempoEdit::mapTextToValue(bool* ok)
+ {
+ double v = text().toDouble(ok);
+ return int(v * 100);
+ }
+
+//---------------------------------------------------------
+// tempoChanged
+//---------------------------------------------------------
+
+void TempoEdit::tempoChanged(int val)
+ {
+ emit valueChanged(double(val)/100.0);
+ }
+
+//---------------------------------------------------------
+// setValue
+//---------------------------------------------------------
+
+void TempoEdit::setValue(double val)
+ {
+ QSpinBox::setValue(int(val*100));
+ }
+
diff --git a/muse2/muse/widgets/tempolabel.h b/muse2/muse/widgets/tempolabel.h
new file mode 100644
index 00000000..587938d7
--- /dev/null
+++ b/muse2/muse/widgets/tempolabel.h
@@ -0,0 +1,60 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: tempolabel.h,v 1.1.1.1 2003/10/27 18:55:05 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __TEMPOLABEL_H__
+#define __TEMPOLABEL_H__
+
+#include <qlabel.h>
+#include <qspinbox.h>
+
+//---------------------------------------------------------
+// TempoLabel
+//---------------------------------------------------------
+
+class TempoLabel : public QLabel {
+ double _value;
+
+ Q_OBJECT
+
+ protected:
+ QSize sizeHint() const;
+
+ public slots:
+ void setValue(int);
+ void setValue(double);
+
+ public:
+ TempoLabel(QWidget*, const char* name = 0);
+ };
+
+//---------------------------------------------------------
+// TempoEdit
+//---------------------------------------------------------
+
+class TempoEdit : public QSpinBox {
+ Q_OBJECT
+
+ protected:
+ QSize sizeHint() const;
+ virtual QString mapValueToText(int);
+ virtual int mapTextToValue(bool*);
+
+ private slots:
+ void tempoChanged(int);
+
+ public slots:
+ void setValue(double);
+
+ signals:
+ void valueChanged(double);
+
+ public:
+ TempoEdit(QWidget*, const char* name = 0);
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/tools.cpp b/muse2/muse/widgets/tools.cpp
new file mode 100644
index 00000000..7816f632
--- /dev/null
+++ b/muse2/muse/widgets/tools.cpp
@@ -0,0 +1,139 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: tools.cpp,v 1.2 2004/04/28 21:56:13 spamatica Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "tools.h"
+#include <qpixmap.h>
+#include <q3buttongroup.h>
+#include <qtoolbutton.h>
+#include <qtooltip.h>
+#include <q3whatsthis.h>
+#include <q3mainwindow.h>
+//Added by qt3to4:
+#include <Q3ActionGroup>
+
+#include "icons.h"
+#include "action.h"
+
+const char* infoPointer = QT_TR_NOOP("select Pointer Tool:\n"
+ "with the pointer tool you can:\n"
+ " select parts\n"
+ " move parts\n"
+ " copy parts");
+const char* infoPencil = QT_TR_NOOP("select Pencil Tool:\n"
+ "with the pencil tool you can:\n"
+ " create new parts\n"
+ " modify length of parts");
+const char* infoDel = QT_TR_NOOP("select Delete Tool:\n"
+ "with the delete tool you can delete parts");
+const char* infoCut = QT_TR_NOOP("select Cut Tool:\n"
+ "with the cut tool you can split a part");
+const char* infoGlue = QT_TR_NOOP("select Glue Tool:\n"
+ "with the glue tool you can glue two parts");
+const char* infoScore = QT_TR_NOOP("select Score Tool:\n");
+const char* infoQuant = QT_TR_NOOP("select Quantize Tool:\n"
+ "insert display quantize event");
+const char* infoDraw = QT_TR_NOOP("select Drawing Tool");
+const char* infoMute = QT_TR_NOOP("select Muting Tool:\n"
+ "click on part to mute/unmute");
+
+ToolB toolList[] = {
+ {&pointerIcon, QT_TR_NOOP("pointer"), infoPointer },
+ {&pencilIcon, QT_TR_NOOP("pencil"), infoPencil },
+ {&deleteIcon, QT_TR_NOOP("eraser"), infoDel },
+ {&cutIcon, QT_TR_NOOP("cutter"), infoCut },
+ {&note1Icon, QT_TR_NOOP("score"), infoScore },
+ {&glueIcon, QT_TR_NOOP("glue"), infoGlue },
+ {&quantIcon, QT_TR_NOOP("quantize"), infoQuant },
+ {&drawIcon, QT_TR_NOOP("draw"), infoDraw },
+ {&editmuteIcon, QT_TR_NOOP("mute parts"), infoMute },
+ };
+
+//---------------------------------------------------------
+// EditToolBar
+//---------------------------------------------------------
+
+EditToolBar::EditToolBar(Q3MainWindow* parent, int tools, const char*)
+ : Q3ToolBar(tr("Edit Tools"), parent)
+ {
+ Q3ActionGroup* action = new Q3ActionGroup(parent, "editaction", true);
+
+ nactions = 0;
+ for (unsigned i = 0; i < sizeof(toolList)/sizeof(*toolList); ++i) {
+ if ((tools & (1 << i))==0)
+ continue;
+ ++nactions;
+ }
+ actions = new Action*[nactions];
+ bool first = true;
+ int n = 0;
+ for (unsigned i = 0; i < sizeof(toolList)/sizeof(*toolList); ++i) {
+ if ((tools & (1 << i))==0)
+ continue;
+ ToolB* t = &toolList[i];
+
+ Action* a = new Action(action, 1<<i, t->tip, true);
+ actions[n] = a;
+ a->setIconSet(QIcon(**(t->icon)));
+ a->setToolTip(tr(t->tip));
+ a->setWhatsThis(tr(t->ltip));
+ if (first) {
+ a->setOn(true);
+ first = false;
+ }
+ ++n;
+ }
+ action->addTo(this);
+ connect(action, SIGNAL(selected(Q3Action*)), SLOT(toolChanged(QAction*)));
+ }
+
+//---------------------------------------------------------
+// toolChanged
+//---------------------------------------------------------
+
+void EditToolBar::toolChanged(Q3Action* action)
+ {
+ emit toolChanged(((Action*)action)->id());
+ }
+
+//---------------------------------------------------------
+// ~EditToolBar
+//---------------------------------------------------------
+
+EditToolBar::~EditToolBar()
+ {
+ delete actions;
+ }
+
+//---------------------------------------------------------
+// set
+//---------------------------------------------------------
+
+void EditToolBar::set(int id)
+ {
+ for (int i = 0; i < nactions; ++i) {
+ Action* action = actions[i];
+ if (action->id() == id) {
+ action->setOn(true);
+ return;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// curTool
+//---------------------------------------------------------
+
+int EditToolBar::curTool()
+ {
+ for (int i = 0; i < nactions; ++i) {
+ Action* action = actions[i];
+ if (action->isOn())
+ return action->id();
+ }
+ return -1;
+ }
+
diff --git a/muse2/muse/widgets/tools.h b/muse2/muse/widgets/tools.h
new file mode 100644
index 00000000..efe5d57c
--- /dev/null
+++ b/muse2/muse/widgets/tools.h
@@ -0,0 +1,57 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: tools.h,v 1.1.1.1 2003/10/27 18:54:49 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __TOOLS_H__
+#define __TOOLS_H__
+
+#include <q3toolbar.h>
+//Added by qt3to4:
+#include <QPixmap>
+
+class Q3Action;
+class Action;
+class Q3MainWindow;
+
+enum Tool { PointerTool=1, PencilTool=2, RubberTool=4, CutTool=8,
+ ScoreTool=16, GlueTool=32, QuantTool=64, DrawTool=128, MuteTool=256};
+
+const int arrangerTools = PointerTool | PencilTool | RubberTool | CutTool | GlueTool | MuteTool;
+
+struct ToolB {
+ QPixmap** icon;
+ const char* tip;
+ const char* ltip;
+ };
+
+extern ToolB toolList[];
+
+//---------------------------------------------------------
+// EditToolBar
+//---------------------------------------------------------
+
+class EditToolBar : public Q3ToolBar {
+ Q_OBJECT
+ Action** actions;
+ int nactions;
+
+ private slots:
+ void toolChanged(Q3Action* action);
+
+ signals:
+ void toolChanged(int);
+
+ public slots:
+ void set(int id);
+
+ public:
+ EditToolBar(Q3MainWindow*, int, const char* name = 0);
+ ~EditToolBar();
+ int curTool();
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/transformbase.ui b/muse2/muse/widgets/transformbase.ui
new file mode 100644
index 00000000..06aea442
--- /dev/null
+++ b/muse2/muse/widgets/transformbase.ui
@@ -0,0 +1,1146 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>MidiTransformDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MidiTransformDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>636</width>
+ <height>521</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Midi Transformator</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonNew</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;New</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonDelete</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Delete</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonApply</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Apply</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="0" rowspan="3" colspan="1">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>PresetList</string>
+ </property>
+ </widget>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>presetList</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox" row="1" column="1">
+ <property name="name">
+ <cstring>GroupBox5</cstring>
+ </property>
+ <property name="title">
+ <string>Processing</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Event Type</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="0">
+ <item>
+ <property name="text">
+ <string>Keep</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Fix</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>procEventOp</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="0">
+ <item>
+ <property name="text">
+ <string>Note</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Poly Pressure</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Control Change</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Aftertouch</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Pitch Bend</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>NRPN</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>RPN</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>procType</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>Keep</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Plus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Minus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Multiply</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Divide</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Fix</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Value 2</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Invert</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>ScaleMap</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Flip</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Dyn</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Random</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>procVal1Op</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>TextLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Value 1</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>TextLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>Value 2</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="3">
+ <property name="name">
+ <cstring>TextLabel10_2</cstring>
+ </property>
+ <property name="text">
+ <string>Length</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="4">
+ <property name="name">
+ <cstring>TextLabel12</cstring>
+ </property>
+ <property name="text">
+ <string>Position</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="2">
+ <item>
+ <property name="text">
+ <string>Keep</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Plus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Minus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Multiply</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Divide</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Fix</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Value 1</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Invert</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Dyn</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Random</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>procVal2Op</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="3">
+ <item>
+ <property name="text">
+ <string>Keep</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Plus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Minus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Multiply</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Divide</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Fix</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>procLenOp</cstring>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="1">
+ <property name="name">
+ <cstring>procVal1b</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="2">
+ <property name="name">
+ <cstring>procVal2b</cstring>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ </widget>
+ <widget class="SpinBoxFP" row="2" column="1">
+ <property name="name">
+ <cstring>procVal1a</cstring>
+ </property>
+ <property name="maxValue" stdset="0">
+ <number>99999999</number>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="4">
+ <item>
+ <property name="text">
+ <string>Keep</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Plus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Minus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Multiply</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Divide</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>procPosOp</cstring>
+ </property>
+ </widget>
+ <widget class="SpinBoxFP" row="2" column="2">
+ <property name="name">
+ <cstring>procVal2a</cstring>
+ </property>
+ <property name="maxValue" stdset="0">
+ <number>99999999</number>
+ </property>
+ </widget>
+ <widget class="SpinBoxFP" row="2" column="3">
+ <property name="name">
+ <cstring>procLenA</cstring>
+ </property>
+ <property name="maxValue" stdset="0">
+ <number>99999999</number>
+ </property>
+ </widget>
+ <widget class="SpinBoxFP" row="2" column="4">
+ <property name="name">
+ <cstring>procPosA</cstring>
+ </property>
+ <property name="maxValue" stdset="0">
+ <number>99999999</number>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="0" column="1">
+ <property name="name">
+ <cstring>GroupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Filter</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QComboBox" row="1" column="0">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Equal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Unequal</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>selEventOp</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="0">
+ <item>
+ <property name="text">
+ <string>Note</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Poly Pressure</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Control Change</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Aftertouch</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Pitch Bend</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>NRPN</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>RPN</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>selType</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Value 2</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Value 1</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Event Type</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>Ignore</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Equal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Unequal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Higher</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Lower</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Inside</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Outside</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>selVal1Op</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="3">
+ <property name="name">
+ <cstring>TextLabel10</cstring>
+ </property>
+ <property name="text">
+ <string>Length</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="4">
+ <property name="name">
+ <cstring>TextLabel11</cstring>
+ </property>
+ <property name="text">
+ <string>Bar Range</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="2">
+ <item>
+ <property name="text">
+ <string>Ignore</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Equal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Unequal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Higher</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Lower</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Inside</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Outside</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>selVal2Op</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="3">
+ <item>
+ <property name="text">
+ <string>Ignore</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Equal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Unequal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Higher</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Lower</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Inside</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Outside</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>selLenOp</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="4">
+ <item>
+ <property name="text">
+ <string>Ignore</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Equal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Unequal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Higher</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Lower</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Inside</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Outside</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>selRangeOp</cstring>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="1">
+ <property name="name">
+ <cstring>selVal1b</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="3">
+ <property name="name">
+ <cstring>selLenA</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="3">
+ <property name="name">
+ <cstring>selLenB</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="2">
+ <property name="name">
+ <cstring>selVal2a</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="3" column="2">
+ <property name="name">
+ <cstring>selVal2b</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="1">
+ <property name="name">
+ <cstring>selVal1a</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="SpinBoxFP" row="3" column="4">
+ <property name="name">
+ <cstring>selBarB</cstring>
+ </property>
+ <property name="precision" stdset="0">
+ <number>3</number>
+ </property>
+ </widget>
+ <widget class="SpinBoxFP" row="2" column="4">
+ <property name="name">
+ <cstring>selBarA</cstring>
+ </property>
+ <property name="minValue" stdset="0">
+ <number>1000</number>
+ </property>
+ <property name="precision" stdset="0">
+ <number>3</number>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="1">
+ <property name="name">
+ <cstring>Layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox6_2</cstring>
+ </property>
+ <property name="title">
+ <string>Preset</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout5_3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel13_2</cstring>
+ </property>
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>nameEntry</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel14_2</cstring>
+ </property>
+ <property name="text">
+ <string>Comment:</string>
+ </property>
+ </widget>
+ <widget class="QMultiLineEdit">
+ <property name="name">
+ <cstring>commentEntry</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox5_2</cstring>
+ </property>
+ <property name="title">
+ <string>Range</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>processAll</cstring>
+ </property>
+ <property name="text">
+ <string>process all events</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>selectedTracks</cstring>
+ </property>
+ <property name="text">
+ <string>selected tracks</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>insideLoop</cstring>
+ </property>
+ <property name="text">
+ <string>inside loop</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox7_2</cstring>
+ </property>
+ <property name="title">
+ <string>Function</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>Select</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Quantize</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Delete</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Transform</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Insert</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Copy</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Extract</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>funcOp</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel9_2</cstring>
+ </property>
+ <property name="text">
+ <string>Quantize Value</string>
+ </property>
+ </widget>
+ <widget class="ComboQuant">
+ <property name="name">
+ <cstring>funcQuantVal</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>SpinBoxFP</class>
+ <header location="global">spinboxFP.h</header>
+ <sizehint>
+ <width>50</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ <signal>valueChanged(int value)</signal>
+ <signal>valueChanged(const QString&amp;)</signal>
+ <slot access="public" specifier="">setValue(int)</slot>
+ <slot access="public" specifier="">setPrefix(const QString&amp;)</slot>
+ <slot access="public" specifier="">setSuffix(const QString&amp;)</slot>
+ <slot access="public" specifier="">stepUp()</slot>
+ <slot access="public" specifier="">stepDown()</slot>
+ <property type="Int">precision</property>
+ <property type="Int">minValue</property>
+ <property type="Int">maxValue</property>
+ </customwidget>
+ <customwidget>
+ <class>ComboQuant</class>
+ <header location="local">comboQuant.h</header>
+ <sizehint>
+ <width>50</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ <signal>valueChanged(int)</signal>
+ <slot access="public" specifier="">setValue(int)</slot>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MidiTransformDialogBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>MidiTransformDialogBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>selEventOp</tabstop>
+ <tabstop>selType</tabstop>
+ <tabstop>selVal1Op</tabstop>
+ <tabstop>selVal1a</tabstop>
+ <tabstop>selVal1b</tabstop>
+ <tabstop>selVal2Op</tabstop>
+ <tabstop>selVal2a</tabstop>
+ <tabstop>selVal2b</tabstop>
+ <tabstop>selLenOp</tabstop>
+ <tabstop>selLenA</tabstop>
+ <tabstop>selLenB</tabstop>
+ <tabstop>selRangeOp</tabstop>
+ <tabstop>procEventOp</tabstop>
+ <tabstop>procType</tabstop>
+ <tabstop>procVal1Op</tabstop>
+ <tabstop>procVal1b</tabstop>
+ <tabstop>procVal2Op</tabstop>
+ <tabstop>procVal2b</tabstop>
+ <tabstop>procLenOp</tabstop>
+ <tabstop>procPosOp</tabstop>
+ <tabstop>nameEntry</tabstop>
+ <tabstop>commentEntry</tabstop>
+ <tabstop>processAll</tabstop>
+ <tabstop>selectedTracks</tabstop>
+ <tabstop>insideLoop</tabstop>
+ <tabstop>funcOp</tabstop>
+ <tabstop>presetList</tabstop>
+ <tabstop>buttonNew</tabstop>
+ <tabstop>buttonDelete</tabstop>
+ <tabstop>buttonApply</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/transposebase.ui b/muse2/muse/widgets/transposebase.ui
new file mode 100644
index 00000000..caca7a35
--- /dev/null
+++ b/muse2/muse/widgets/transposebase.ui
@@ -0,0 +1,252 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>TransposeDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>TransposeDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>289</width>
+ <height>317</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Midi Transpose</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Value</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>delta</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minValue">
+ <number>-99</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>halftones</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ButtonGroup1</cstring>
+ </property>
+ <property name="title">
+ <string>Time</string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>time_all</cstring>
+ </property>
+ <property name="text">
+ <string>all</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>time_selected</cstring>
+ </property>
+ <property name="text">
+ <string>between markers</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ButtonGroup2</cstring>
+ </property>
+ <property name="title">
+ <string>Parts</string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>parts_all</cstring>
+ </property>
+ <property name="text">
+ <string>all</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>parts_selected</cstring>
+ </property>
+ <property name="caption">
+ <string></string>
+ </property>
+ <property name="text">
+ <string>all in selected tracks</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okButton</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>okButton</sender>
+ <signal>clicked()</signal>
+ <receiver>TransposeDialogBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>TransposeDialogBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/ttoolbar.cpp b/muse2/muse/widgets/ttoolbar.cpp
new file mode 100644
index 00000000..fe15f885
--- /dev/null
+++ b/muse2/muse/widgets/ttoolbar.cpp
@@ -0,0 +1,24 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ttoolbar.cpp,v 1.1.1.1 2003/10/27 18:54:46 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qaction.h>
+#include "globals.h"
+
+//---------------------------------------------------------
+// syncChanged
+//---------------------------------------------------------
+
+void syncChanged(bool flag)
+ {
+ startAction->setEnabled(!flag);
+ forwardAction->setEnabled(!flag);
+ rewindAction->setEnabled(!flag);
+ stopAction->setEnabled(!flag);
+ playAction->setEnabled(!flag);
+ }
+
+
diff --git a/muse2/muse/widgets/ttoolbar.h b/muse2/muse/widgets/ttoolbar.h
new file mode 100644
index 00000000..b7d34b2d
--- /dev/null
+++ b/muse2/muse/widgets/ttoolbar.h
@@ -0,0 +1,9 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ttoolbar.h,v 1.1.1.1 2003/10/27 18:54:52 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+extern void syncChanged(bool flag);
+
diff --git a/muse2/muse/widgets/ttoolbutton.cpp b/muse2/muse/widgets/ttoolbutton.cpp
new file mode 100644
index 00000000..bf9234c6
--- /dev/null
+++ b/muse2/muse/widgets/ttoolbutton.cpp
@@ -0,0 +1,30 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ttoolbutton.cpp,v 1.1 2004/02/21 16:53:50 wschweer Exp $
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <qpainter.h>
+//Added by qt3to4:
+#include <QPixmap>
+
+#include "ttoolbutton.h"
+#include "gconfig.h"
+#include "icons.h"
+
+//---------------------------------------------------------
+// drawButton
+//---------------------------------------------------------
+
+void TransparentToolButton::drawButton(QPainter* p)
+ {
+ int w = width();
+ int h = height();
+ QIcon::Mode mode = isEnabled() ? QIcon::Normal : QIcon::Disabled;
+ QIcon::State state = isOn() ? QIcon::On : QIcon::Off;
+ const QPixmap pm(iconSet().pixmap(QIcon::Automatic, mode, state));
+ p->drawPixmap(QPoint((w - pm.width())/2, (h - pm.height())/2), pm);
+ }
+
+
diff --git a/muse2/muse/widgets/ttoolbutton.h b/muse2/muse/widgets/ttoolbutton.h
new file mode 100644
index 00000000..381f3f18
--- /dev/null
+++ b/muse2/muse/widgets/ttoolbutton.h
@@ -0,0 +1,28 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: ttoolbutton.h,v 1.1 2004/02/21 16:53:51 wschweer Exp $
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __TTOOLBUTTON_H__
+#define __TTOOLBUTTON_H__
+
+#include <qtoolbutton.h>
+
+//---------------------------------------------------------
+// TransparentToolButton
+//---------------------------------------------------------
+
+class TransparentToolButton : public QToolButton {
+ Q_OBJECT
+
+ virtual void drawButton(QPainter*);
+
+ public:
+ TransparentToolButton(QWidget* parent, const char* name = 0)
+ : QToolButton(parent, name) {}
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/utils.cpp b/muse2/muse/widgets/utils.cpp
new file mode 100644
index 00000000..2a4852f3
--- /dev/null
+++ b/muse2/muse/widgets/utils.cpp
@@ -0,0 +1,358 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: utils.cpp,v 1.1.1.1.2.3 2009/11/14 03:37:48 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "utils.h"
+#include <math.h>
+#include <q3frame.h>
+#include <sys/time.h>
+
+// Quick bit-shift lookup table
+const unsigned int bitShiftLU[32] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80,
+ 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000,
+ 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, 0x800000,
+ 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000 };
+
+//---------------------------------------------------------
+// curTime
+//---------------------------------------------------------
+
+double curTime()
+ {
+ struct timeval t;
+ gettimeofday(&t, 0);
+ return (double)((double)t.tv_sec + (t.tv_usec / 1000000.0));
+ }
+
+//---------------------------------------------------------
+// dump
+// simple debug output
+//---------------------------------------------------------
+
+void dump(const unsigned char* p, int n)
+ {
+ printf("dump %d\n", n);
+ for (int i = 0; i < n; ++i) {
+ printf("%02x ", *p++);
+ if ((i > 0) && (i % 16 == 0) && (i+1 < n))
+ printf("\n");
+ }
+ printf("\n");
+ }
+
+//---------------------------------------------------------
+// num2cols
+//---------------------------------------------------------
+
+int num2cols(int min, int max)
+ {
+ int amin = abs(min);
+ int amax = abs(max);
+ int l = amin > amax ? amin : amax;
+ return int(log10(l)) + 1;
+ }
+
+//---------------------------------------------------------
+// hLine
+//---------------------------------------------------------
+
+Q3Frame* hLine(QWidget* w)
+ {
+ Q3Frame* delim = new Q3Frame(w);
+ delim->setFrameStyle(Q3Frame::HLine | Q3Frame::Sunken);
+ return delim;
+ }
+
+//---------------------------------------------------------
+// vLine
+//---------------------------------------------------------
+
+Q3Frame* vLine(QWidget* w)
+ {
+ Q3Frame* delim = new Q3Frame(w);
+ delim->setFrameStyle(Q3Frame::VLine | Q3Frame::Sunken);
+ return delim;
+ }
+
+//---------------------------------------------------------
+// bitmap2String
+// 5c -> 1-4 1-6
+//
+// 01011100
+//
+//---------------------------------------------------------
+
+QString bitmap2String(int bm)
+ {
+ QString s;
+//printf("bitmap2string: bm %04x", bm);
+ if (bm == 0xffff)
+ s = "all";
+ else if (bm == 0)
+ s = "none";
+ else {
+ bool range = false;
+ int first = 0;
+ bool needSpace = false;
+ bm &= 0xffff;
+ //for (int i = 0; i < 17; ++i) {
+ for (int i = 0; i < 16; ++i) {
+ if ((1 << i) & bm) {
+ if (!range) {
+ range = true;
+ first = i;
+ }
+ }
+ else {
+ if (range) {
+ if (needSpace)
+ s += " ";
+ QString ns;
+ if (first == i-1)
+ ns.sprintf("%d", first+1);
+ else
+ ns.sprintf("%d-%d", first+1, i);
+ s += ns;
+ needSpace = true;
+ }
+ range = false;
+ }
+ }
+ }
+//printf(" -> <%s>\n", s.latin1());
+ return s;
+ }
+
+//---------------------------------------------------------
+// u32bitmap2String
+//---------------------------------------------------------
+// Added by Tim. p3.3.8
+
+QString u32bitmap2String(unsigned int bm)
+ {
+ QString s;
+//printf("bitmap2string: bm %04x", bm);
+ //if (bm == 0xffff)
+ if (bm == 0xffffffff)
+ s = "all";
+ else if (bm == 0)
+ s = "none";
+ else {
+ bool range = false;
+ int first = 0;
+ //unsigned int first = 0;
+ bool needSpace = false;
+ //bm &= 0xffff;
+ //for (int i = 0; i < 17; ++i) {
+ for (int i = 0; i < 33; ++i) {
+ if ((i < 32) && ((1U << i) & bm)) {
+ if (!range) {
+ range = true;
+ first = i;
+ }
+ }
+ else {
+ if (range) {
+ if (needSpace)
+ s += " ";
+ QString ns;
+ if (first == i-1)
+ ns.sprintf("%d", first+1);
+ //ns.sprintf("%u", first+1);
+ else
+ ns.sprintf("%d-%d", first+1, i);
+ //ns.sprintf("%u-%u", first+1, i);
+ s += ns;
+ needSpace = true;
+ }
+ range = false;
+ }
+ }
+ }
+//printf(" -> <%s>\n", s.latin1());
+ return s;
+ }
+
+//---------------------------------------------------------
+// string2bitmap
+//---------------------------------------------------------
+
+int string2bitmap(const QString& str)
+ {
+ int val = 0;
+ QString ss = str.simplifyWhiteSpace();
+ const char* s = ss.latin1();
+//printf("string2bitmap <%s>\n", s);
+
+ if (s == 0)
+ return 0;
+ if (strcmp(s, "all") == 0)
+ return 0xffff;
+ if (strcmp(s, "none") == 0)
+ return 0;
+// printf("str2bitmap: <%s> ", str.latin1);
+ int tval = 0;
+ bool range = false;
+ int sval = 0;
+ while (*s == ' ')
+ ++s;
+ while (*s) {
+ if (*s >= '0' && *s <= '9') {
+ tval *= 10;
+ tval += *s - '0';
+ }
+ else if (*s == ' ' || *s == ',') {
+ if (range) {
+ for (int i = sval-1; i < tval; ++i)
+ val |= (1 << i);
+ range = false;
+ }
+ else {
+ val |= (1 << (tval-1));
+ }
+ tval = 0;
+ }
+ else if (*s == '-') {
+ range = true;
+ sval = tval;
+ tval = 0;
+ }
+ ++s;
+ }
+ if (range && tval) {
+ for (int i = sval-1; i < tval; ++i)
+ val |= (1 << i);
+ }
+ else if (tval) {
+ val |= (1 << (tval-1));
+ }
+ return val & 0xffff;
+ }
+
+//---------------------------------------------------------
+// string2u32bitmap
+//---------------------------------------------------------
+// Added by Tim. p3.3.8
+
+unsigned int string2u32bitmap(const QString& str)
+ {
+ //int val = 0;
+ unsigned int val = 0;
+ QString ss = str.simplifyWhiteSpace();
+ const char* s = ss.latin1();
+//printf("string2bitmap <%s>\n", s);
+
+ if (s == 0)
+ return 0;
+ if (strcmp(s, "all") == 0)
+ //return 0xffff;
+ return 0xffffffff;
+ if (strcmp(s, "none") == 0)
+ return 0;
+// printf("str2bitmap: <%s> ", str.latin1);
+ int tval = 0;
+ //unsigned int tval = 0;
+ bool range = false;
+ int sval = 0;
+ //unsigned int sval = 0;
+ while (*s == ' ')
+ ++s;
+ while (*s) {
+ if (*s >= '0' && *s <= '9') {
+ tval *= 10;
+ tval += *s - '0';
+ }
+ else if (*s == ' ' || *s == ',') {
+ if (range) {
+ for (int i = sval-1; i < tval; ++i)
+ //for (unsigned int i = sval-1; i < tval; ++i)
+ val |= (1U << i);
+ range = false;
+ }
+ else {
+ val |= (1U << (tval-1));
+ }
+ tval = 0;
+ }
+ else if (*s == '-') {
+ range = true;
+ sval = tval;
+ tval = 0;
+ }
+ ++s;
+ }
+ if (range && tval) {
+ for (int i = sval-1; i < tval; ++i)
+ //for (unsigned int i = sval-1; i < tval; ++i)
+ val |= (1U << i);
+ }
+ else if (tval) {
+ val |= (1U << (tval-1));
+ }
+ //return val & 0xffff;
+ return val;
+ }
+
+//---------------------------------------------------------
+// autoAdjustFontSize
+// w: Widget to auto adjust font size
+// s: String to fit
+// ignoreWidth: Set if dealing with a vertically constrained widget - one which is free to resize horizontally.
+// ignoreHeight: Set if dealing with a horizontally constrained widget - one which is free to resize vertically.
+//---------------------------------------------------------
+// Added by Tim. p3.3.8
+
+bool autoAdjustFontSize(Q3Frame* w, const QString& s, bool ignoreWidth, bool ignoreHeight, int max, int min)
+{
+ // In case the max or min was obtained from QFont::pointSize() which returns -1
+ // if the font is a pixel font, or if min is greater than max...
+ if(!w || (min < 0) || (max < 0) || (min > max))
+ return false;
+
+ // Limit the minimum and maximum sizes to something at least readable.
+ if(max < 4)
+ max = 4;
+ if(min < 4)
+ min = 4;
+
+ QRect cr = w->contentsRect();
+ QRect r;
+ QFont fnt = w->font();
+ // An extra amount just to be sure - I found it was still breaking up two words which would fit on one line.
+ int extra = 4;
+ // Allow at least one loop. min can be equal to max.
+ for(int i = max; i >= min; --i)
+ {
+ fnt.setPointSize(i);
+ QFontMetrics fm(fnt);
+ r = fm.boundingRect(s);
+ // Would the text fit within the widget?
+ if((ignoreWidth || (r.width() <= (cr.width() - extra))) && (ignoreHeight || (r.height() <= cr.height())))
+ break;
+ }
+ // Added by Tim. p3.3.9
+ //printf("autoAdjustFontSize: ptsz:%d widget:%s before setFont x:%d y:%d w:%d h:%d\n", fnt.pointSize(), w->name(), w->x(), w->y(), w->width(), w->height());
+
+ // Here we will always have a font ranging from min to max point size.
+ w->setFont(fnt);
+ // Added by Tim. p3.3.9
+ //printf("autoAdjustFontSize: ptsz:%d widget:%s x:%d y:%d w:%d h:%d frame w:%d rw:%d rh:%d\n", fnt.pointSize(), w->name(), w->x(), w->y(), w->width(), w->height(), w->frameWidth(), cr.width(), cr.height());
+
+ // Force minimum height. Use the expected height for the highest given point size.
+ // This way the mixer strips aren't all different label heights, but can be larger if necessary.
+ // Only if ignoreHeight is set (therefore the height is adjustable).
+ if(ignoreHeight)
+ {
+ fnt.setPointSize(max);
+ QFontMetrics fm(fnt);
+ // Set the label's minimum height equal to the height of the font.
+ w->setMinimumHeight(fm.height() + 2 * w->frameWidth());
+ }
+
+ return true;
+}
diff --git a/muse2/muse/widgets/utils.h b/muse2/muse/widgets/utils.h
new file mode 100644
index 00000000..aaf501f0
--- /dev/null
+++ b/muse2/muse/widgets/utils.h
@@ -0,0 +1,33 @@
+//Added by qt3to4:
+#include <Q3Frame>
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: utils.h,v 1.1.1.1.2.3 2009/11/14 03:37:48 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __UTILS_H__
+#define __UTILS_H__
+
+class Q3Frame;
+class QWidget;
+
+#include <qstring.h>
+
+extern QString bitmap2String(int bm);
+extern int string2bitmap(const QString& str);
+extern QString u32bitmap2String(unsigned int bm);
+extern unsigned int string2u32bitmap(const QString& str);
+extern bool autoAdjustFontSize(Q3Frame* w, const QString& s, bool ignoreWidth = false, bool ignoreHeight = false, int max = 10, int min = 4);
+
+extern int num2cols(int min, int max);
+extern Q3Frame* hLine(QWidget* parent);
+extern Q3Frame* vLine(QWidget* parent);
+extern void dump(const unsigned char* p, int n);
+extern double curTime();
+
+extern const unsigned int bitShiftLU[32];
+
+#endif
+
diff --git a/muse2/muse/widgets/velocity.cpp b/muse2/muse/widgets/velocity.cpp
new file mode 100644
index 00000000..42eed7c9
--- /dev/null
+++ b/muse2/muse/widgets/velocity.cpp
@@ -0,0 +1,46 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: velocity.cpp,v 1.1.1.1 2003/10/27 18:55:04 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <q3buttongroup.h>
+#include <qspinbox.h>
+//#include <qbutton.h>
+#include <QtGui>
+
+#include "velocity.h"
+
+#include "song.h"
+
+//---------------------------------------------------------
+// Velocity
+//---------------------------------------------------------
+
+Velocity::Velocity(QWidget* parent, const char* name)
+ : VelocityBase(parent, name, true)
+ {
+ }
+
+//---------------------------------------------------------
+// accept
+//---------------------------------------------------------
+
+void Velocity::accept()
+ {
+ _range = rangeGroup->id(rangeGroup->selected());
+ _rateVal = rate->value();
+ _offsetVal = offset->value();
+ VelocityBase::accept();
+ }
+
+//---------------------------------------------------------
+// setRange
+//---------------------------------------------------------
+
+void Velocity::setRange(int id)
+ {
+ rangeGroup->setButton(id);
+ }
+
diff --git a/muse2/muse/widgets/velocity.h b/muse2/muse/widgets/velocity.h
new file mode 100644
index 00000000..6d2ca60a
--- /dev/null
+++ b/muse2/muse/widgets/velocity.h
@@ -0,0 +1,36 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: velocity.h,v 1.1.1.1 2003/10/27 18:54:51 wschweer Exp $
+// (C) Copyright 2001 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __VELOCITY_H__
+#define __VELOCITY_H__
+
+#include "velocitybase.h"
+
+//---------------------------------------------------------
+// Velocity
+//---------------------------------------------------------
+
+class Velocity : public VelocityBase {
+ int _range;
+ int _rateVal;
+ int _offsetVal;
+
+ Q_OBJECT
+
+ protected slots:
+ void accept();
+
+ public:
+ Velocity(QWidget* parent, const char* name = 0);
+ void setRange(int id);
+ int range() const { return _range; }
+ int rateVal() const { return _rateVal; }
+ int offsetVal() const { return _offsetVal; }
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/velocitybase.ui b/muse2/muse/widgets/velocitybase.ui
new file mode 100644
index 00000000..e1510348
--- /dev/null
+++ b/muse2/muse/widgets/velocitybase.ui
@@ -0,0 +1,232 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>VelocityBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>VelocityBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>275</width>
+ <height>274</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MusE: Modify Velocity</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>rangeGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Range</string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>RadioButton5</cstring>
+ </property>
+ <property name="text">
+ <string>All Events</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>RadioButton6</cstring>
+ </property>
+ <property name="text">
+ <string>Selected Events</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>RadioButton7</cstring>
+ </property>
+ <property name="text">
+ <string>Looped Events</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>2</number>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>RadioButton8</cstring>
+ </property>
+ <property name="text">
+ <string>Selected &amp; Looped</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>3</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Values</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Rate:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Offset:</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="1">
+ <property name="name">
+ <cstring>rate</cstring>
+ </property>
+ <property name="suffix">
+ <string>%</string>
+ </property>
+ <property name="maxValue">
+ <number>200</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="1">
+ <property name="name">
+ <cstring>offset</cstring>
+ </property>
+ <property name="maxValue">
+ <number>127</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="lineStep">
+ <number>1</number>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okButton</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>okButton</sender>
+ <signal>clicked()</signal>
+ <receiver>VelocityBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>VelocityBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/view.cpp b/muse2/muse/widgets/view.cpp
new file mode 100644
index 00000000..75116415
--- /dev/null
+++ b/muse2/muse/widgets/view.cpp
@@ -0,0 +1,514 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: view.cpp,v 1.3.2.2 2009/04/06 01:24:55 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "view.h"
+#include <cmath>
+#include <stdio.h>
+#include <QPainter>
+//Added by qt3to4:
+#include <QPixmap>
+#include <QResizeEvent>
+#include <QDropEvent>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QPaintEvent>
+
+//---------------------------------------------------------
+// View::View
+// double xMag = (xmag < 0) ? 1.0/-xmag : double(xmag)
+//---------------------------------------------------------
+
+View::View(QWidget* w, int xm, int ym, const char* name)
+ : QWidget(w, name, Qt::WNoAutoErase | Qt::WResizeNoErase)
+ {
+ xmag = xm;
+ ymag = ym;
+ xpos = 0;
+ ypos = 0;
+ xorg = 0;
+ yorg = 0;
+ _virt = true;
+ setBackgroundMode(Qt::NoBackground);
+ brush.setStyle(Qt::SolidPattern);
+ brush.setColor(Qt::lightGray);
+ pmValid = false;
+ }
+
+//---------------------------------------------------------
+// setOrigin
+//---------------------------------------------------------
+
+void View::setOrigin(int x, int y)
+ {
+ xorg = x;
+ yorg = y;
+ redraw();
+ }
+
+//---------------------------------------------------------
+// setXMag
+//---------------------------------------------------------
+
+void View::setXMag(int xs)
+ {
+ xmag = xs;
+ redraw();
+ }
+
+//---------------------------------------------------------
+// seqYMag
+//---------------------------------------------------------
+
+void View::setYMag(int ys)
+ {
+ ymag = ys;
+ redraw();
+ }
+
+//---------------------------------------------------------
+// setXPos
+// x - phys offset
+//---------------------------------------------------------
+
+void View::setXPos(int x)
+ {
+ int delta = xpos - x; // - -> shift left
+ xpos = x;
+ if (pm.isNull())
+ return;
+ if (!pmValid) {
+ //printf("View::setXPos !pmValid x:%d width:%d delta:%d\n", x, width(), delta);
+ redraw();
+ return;
+ }
+ int w = width();
+ int h = height();
+
+ QRect r;
+ if (delta >= w || delta <= -w)
+ r = QRect(0, 0, w, h);
+ else if (delta < 0) { // shift left
+ bitBlt(&pm, 0, 0, &pm, -delta, 0, w + delta, h, true); //CopyROP, true); // ddskrjo
+ r = QRect(w + delta, 0, -delta, h);
+ }
+ else { // shift right
+ bitBlt(&pm, delta, 0, &pm, 0, 0, w-delta, h, true); //CopyROP, true); // ddskrjo
+ r = QRect(0, 0, delta, h);
+ }
+ QRect olr = overlayRect();
+ QRect olr1(olr);
+ olr1.moveBy(delta, 0);
+
+ r |= olr;
+ r |= olr1;
+
+ //printf("View::setXPos x:%d w:%d delta:%d r.x:%d r.w:%d\n", x, w, delta, r.x(), r.width());
+
+ paint(r);
+ update();
+ }
+
+//---------------------------------------------------------
+// setYPos
+//---------------------------------------------------------
+
+void View::setYPos(int y)
+ {
+ int delta = ypos - y; // - -> shift up
+ ypos = y;
+ if (pm.isNull())
+ return;
+ if (!pmValid) {
+ //printf("View::setYPos !pmValid y:%d height:%d delta:%d\n", y, height(), delta);
+
+ redraw();
+ return;
+ }
+ int w = width();
+ int h = height();
+ QRect r;
+ if (delta >= h || delta <= -h)
+ r = QRect(0, 0, w, h);
+ else if (delta < 0) { // shift up
+ bitBlt(&pm, 0, 0, &pm, 0, -delta, w, h + delta, true); //CopyROP, true); ddskrjo
+ r = QRect(0, h + delta, w, -delta);
+ }
+ else { // shift down
+ bitBlt(&pm, 0, delta, &pm, 0, 0, w, h-delta, true); // CopyROP, true); ddskrjo
+
+ // NOTE: June 2 2010: On my machine with an old NV V8200 + prop drivers (curr 96.43.11),
+ // this is a problem. There is severe graphical corruption in some of the view-based windows.
+ // Not just here but several other windows (ex. ladspa browser).
+ // I believe (?) I saw other QT3 apps exhibit this problem, too. QT4 apps don't do it.
+ // Neither does it happen when xorg drivers used.
+ //
+ // However, there is one type of MusE corruption which ALL drivers seem to show, and that is
+ // the arranger 'grey' non-part-based tracks (Input, Output, Group etc.).
+ // It is also observed on another machine with an ATI card and a different linux distro.
+ // This change also fixes that problem, although the fact that xorg drivers show the problem
+ // had long made me believe that it was our drawing technique, not particularly this line.
+ // Meaning that perhaps this line is not the right way to fix that problem.
+ //
+ // On the other hand the two problems may be related, and only one shows with xorg drivers...
+ // Ultimately it could just be my NV card, as a request for similar experience in mail list
+ // returned all negative.
+ //
+ // FIXME: This change cures it for me, but we shouldn't leave this in - shouldn't need to do this...
+ //
+ //r = QRect(0, 0, w, delta);
+ // Changed p3.3.43
+ r = QRect(0, 0, w, h);
+
+ }
+ QRect olr = overlayRect();
+ QRect olr1(olr);
+ olr1.moveBy(0, delta);
+
+ r |= olr;
+ r |= olr1;
+ paint(r);
+ update();
+ }
+
+//---------------------------------------------------------
+// resizeEvent
+//---------------------------------------------------------
+
+void View::resizeEvent(QResizeEvent* ev)
+ {
+ pm.resize(ev->size());
+ pmValid = false;
+ }
+
+//---------------------------------------------------------
+// paintEvent
+//---------------------------------------------------------
+
+void View::paintEvent(QPaintEvent* ev)
+ {
+ //printf("View::paintEvent pmValid:%d x:%d width:%d y:%d height:%d\n", pmValid, ev->rect().x(), ev->rect().width(), ev->rect().y(), ev->rect().height());
+ if (!pmValid)
+ paint(ev->rect());
+ bitBlt(this, ev->rect().topLeft(), &pm, ev->rect(), true); // CopyROP, true); ddskrjo
+ }
+
+//---------------------------------------------------------
+// redraw
+//---------------------------------------------------------
+
+void View::redraw()
+ {
+ QRect r(0, 0, pm.width(), pm.height());
+ //printf("View::redraw() r.x:%d r.w:%d\n", r.x(), r.width());
+ paint(r);
+ update();
+ }
+
+//---------------------------------------------------------
+// redraw
+//---------------------------------------------------------
+
+void View::redraw(const QRect& r)
+ {
+ //printf("View::redraw(QRect& r) r.x:%d r.w:%d\n", r.x(), r.width());
+ paint(r);
+ update(r);
+ }
+
+//---------------------------------------------------------
+// paint
+// r - phys coord system
+//---------------------------------------------------------
+
+void View::paint(const QRect& r)
+ {
+ if (pm.isNull())
+ return;
+ QRect rr(r);
+ if (!pmValid) {
+ pmValid = true;
+ rr = QRect(0, 0, pm.width(), pm.height());
+ }
+ QPainter p(&pm);
+ if (bgPixmap.isNull())
+ p.fillRect(rr, brush);
+ else
+ p.drawTiledPixmap(rr, bgPixmap, QPoint(xpos + rmapx(xorg)
+ + rr.x(), ypos + rmapy(yorg) + rr.y()));
+ p.setClipRegion(rr);
+ //printf("View::paint r.x:%d w:%d\n", rr.x(), rr.width());
+ pdraw(p, rr); // draw into pixmap
+
+ p.resetXForm();
+ drawOverlay(p);
+ }
+
+//---------------------------------------------------------
+// keyPressEvent
+//---------------------------------------------------------
+
+void View::keyPressEvent(QKeyEvent* event)
+ {
+ viewKeyPressEvent(event);
+ }
+
+//---------------------------------------------------------
+// viewKeyPressEvent
+//---------------------------------------------------------
+
+void View::viewKeyPressEvent(QKeyEvent* event)
+ {
+ event->ignore();
+ }
+
+//---------------------------------------------------------
+// mousePressEvent
+//---------------------------------------------------------
+
+void View::mousePressEvent(QMouseEvent* ev)
+ {
+ QMouseEvent e(ev->type(), mapDev(ev->pos()),
+ ev->globalPos(), ev->button(), ev->state());
+ viewMousePressEvent(&e);
+ }
+
+//---------------------------------------------------------
+// mouseDoubleClickEvent
+//---------------------------------------------------------
+
+void View::mouseDoubleClickEvent(QMouseEvent* ev)
+ {
+ QMouseEvent e(ev->type(), mapDev(ev->pos()),
+ ev->globalPos(), ev->button(), ev->state());
+ viewMouseDoubleClickEvent(&e);
+ }
+
+//---------------------------------------------------------
+// mouseMoveEvent
+//---------------------------------------------------------
+
+void View::mouseMoveEvent(QMouseEvent* ev)
+ {
+ QMouseEvent e(ev->type(), mapDev(ev->pos()),
+ ev->globalPos(), ev->button(), ev->state());
+ viewMouseMoveEvent(&e);
+ }
+
+//---------------------------------------------------------
+// mouseReleaseEvent
+//---------------------------------------------------------
+
+void View::mouseReleaseEvent(QMouseEvent* ev)
+ {
+ QMouseEvent e(ev->type(), mapDev(ev->pos()),
+ ev->globalPos(), ev->button(), ev->state());
+ viewMouseReleaseEvent(&e);
+ }
+
+//---------------------------------------------------------
+// dropEvent
+//---------------------------------------------------------
+
+void View::dropEvent(QDropEvent* ev)
+ {
+ ev->setPoint(mapDev(ev->pos()));
+ viewDropEvent(ev);
+ }
+
+//---------------------------------------------------------
+// setBg
+//---------------------------------------------------------
+
+void View::setBg(const QPixmap& bgpm)
+ {
+ bgPixmap = bgpm;
+ redraw();
+ }
+
+//---------------------------------------------------------
+// pdraw
+// r - phys coords
+//---------------------------------------------------------
+
+void View::pdraw(QPainter& p, const QRect& r)
+ {
+ if (virt()) {
+ setPainter(p);
+ int x = r.x();
+ int y = r.y();
+ int w = r.width();
+ int h = r.height();
+ if (xmag <= 0) {
+ x -= 1;
+ w += 2;
+ x = (x + xpos + rmapx(xorg)) * (-xmag);
+ w = w * (-xmag);
+ }
+ else {
+ x = (x + xpos + rmapx(xorg)) / xmag;
+ w = (w + xmag - 1) / xmag;
+ x -= 1;
+ w += 2;
+ }
+ if (ymag <= 0) {
+ y -= 1;
+ h += 2;
+ y = (y + ypos + rmapy(yorg)) * (-ymag);
+ h = h * (-ymag);
+ }
+ else {
+ y = (y + ypos + rmapy(yorg)) / ymag;
+ h = (h + ymag - 1) / ymag;
+ y -= 1;
+ h += 2;
+ }
+
+ if (x < 0)
+ x = 0;
+ if (y < 0)
+ y = 0;
+ draw(p, QRect(x, y, w, h));
+ }
+ else
+ draw(p, r);
+ }
+
+//---------------------------------------------------------
+// setPainter
+//---------------------------------------------------------
+
+void View::setPainter(QPainter& p)
+ {
+ p.resetXForm();
+ p.translate(double(-(xpos+rmapx(xorg))), double(-(ypos+rmapy(yorg))));
+ double xMag = (xmag < 0) ? 1.0/(-xmag) : double(xmag);
+ double yMag = (ymag < 0) ? 1.0/(-ymag) : double(ymag);
+ p.scale(xMag, yMag);
+ }
+
+//---------------------------------------------------------
+// map
+//---------------------------------------------------------
+
+QRect View::map(const QRect& r) const
+ {
+ int x, y, w, h;
+ if (xmag < 0) {
+ x = r.x()/(-xmag) - (xpos + rmapx(xorg)); // round down
+ w = (r.width()-xmag-1) / (-xmag); // round up
+ }
+ else {
+ x = r.x()*xmag - (xpos + rmapx(xorg));
+ w = r.width() * xmag;
+ }
+ if (ymag < 0) {
+ y = r.y()/-ymag - (ypos + rmapy(yorg));
+ h = (r.height()-ymag-1) / (-ymag);
+ }
+ else {
+ y = r.y() * ymag - (ypos + rmapy(yorg));
+ h = r.height() * ymag;
+ }
+ return QRect(x, y, w, h);
+ }
+
+QPoint View::map(const QPoint& p) const
+ {
+ int x, y;
+ if (xmag < 0) {
+ x = p.x()/(-xmag) - (xpos + rmapx(xorg)); // round down
+ }
+ else {
+ x = p.x()*xmag - (xpos + rmapx(xorg));
+ }
+ if (ymag < 0) {
+ y = p.y()/-ymag - (ypos + rmapy(yorg));
+ }
+ else {
+ y = p.y() * ymag - (ypos + rmapy(yorg));
+ }
+ return QPoint(x, y);
+ }
+
+QRect View::mapDev(const QRect& r) const
+ {
+ return QRect(mapxDev(r.x()), mapyDev(r.y()),
+ rmapxDev(r.width()), rmapyDev(r.height()));
+ }
+
+QPoint View::mapDev(const QPoint& r) const
+ {
+ return QPoint(mapxDev(r.x()), mapyDev(r.y()));
+ }
+
+int View::mapx(int x) const
+ {
+ if (xmag < 0) {
+ return (x-xmag/2)/(-xmag) - (xpos + rmapx(xorg)); // round
+ }
+ else {
+ return (x * xmag) - (xpos + rmapx(xorg));
+ }
+ }
+int View::mapy(int y) const
+ {
+ if (ymag < 0) {
+ return (y-ymag/2)/(-ymag) - (ypos + rmapy(yorg)); // round
+ }
+ else {
+ return (y * ymag) - (ypos + rmapy(yorg));
+ }
+ }
+int View::mapxDev(int x) const
+ {
+ int val;
+ if (xmag <= 0)
+ val = (x + xpos + rmapx(xorg)) * (-xmag);
+ else
+ val = (x + xpos + rmapx(xorg) + xmag / 2) / xmag;
+ if (val < 0) // DEBUG
+ val = 0;
+ return val;
+ }
+
+int View::mapyDev(int y) const
+ {
+ if (ymag <= 0)
+ return (y + ypos + rmapy(yorg)) * (-ymag);
+ else
+ return (y + ypos + rmapy(yorg) + ymag / 2) / ymag;
+ }
+
+int View::rmapx(int x) const
+ {
+ if (xmag < 0)
+ return (x-xmag/2) / (-xmag);
+ else
+ return x * xmag;
+ }
+int View::rmapy(int y) const
+ {
+ if (ymag < 0)
+ return (y-ymag/2) / (-ymag);
+ else
+ return y * ymag;
+ }
+int View::rmapxDev(int x) const
+ {
+ if (xmag <= 0)
+ return x * (-xmag);
+ else
+ return (x + xmag/2) / xmag;
+ }
+int View::rmapyDev(int y) const
+ {
+ if (ymag <= 0)
+ return y * (-ymag);
+ else
+ return (y + ymag/2) / ymag;
+ }
+
diff --git a/muse2/muse/widgets/view.h b/muse2/muse/widgets/view.h
new file mode 100644
index 00000000..5eaf761f
--- /dev/null
+++ b/muse2/muse/widgets/view.h
@@ -0,0 +1,108 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: view.h,v 1.2.2.1 2008/01/26 07:23:21 terminator356 Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __VIEW_H__
+#define __VIEW_H__
+
+#include <qwidget.h>
+#include <qpixmap.h>
+#include <qmatrix.h>
+#include <qpainter.h>
+#include <qbrush.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QDropEvent>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QPaintEvent>
+
+//---------------------------------------------------------
+// View
+// horizontal View with double buffering
+//---------------------------------------------------------
+
+class View : public QWidget {
+ QPixmap pm; // for double buffering
+ bool pmValid;
+ QPixmap bgPixmap; // background Pixmap
+ QBrush brush;
+ bool _virt;
+ Q_OBJECT
+
+ protected:
+ int xorg;
+ int yorg;
+ int xpos, ypos;
+ int xmag, ymag;
+
+ virtual void keyPressEvent(QKeyEvent* event);
+ virtual void mousePressEvent(QMouseEvent* event);
+ virtual void mouseDoubleClickEvent(QMouseEvent* event);
+ virtual void mouseMoveEvent(QMouseEvent* event);
+ virtual void mouseReleaseEvent(QMouseEvent* event);
+ virtual void dropEvent(QDropEvent* event);
+
+ virtual void draw(QPainter&, const QRect&) {}
+ virtual void drawOverlay(QPainter&) {}
+ virtual QRect overlayRect() const { return QRect(0, 0, 0, 0); }
+
+ virtual void pdraw(QPainter&, const QRect&);
+
+ virtual void paintEvent(QPaintEvent* ev);
+ void redraw(const QRect&);
+
+ void paint(const QRect& r);
+
+ virtual void resizeEvent(QResizeEvent*);
+ virtual void viewKeyPressEvent(QKeyEvent*);
+ virtual void viewMousePressEvent(QMouseEvent*) {}
+ virtual void viewMouseDoubleClickEvent(QMouseEvent*) {}
+ virtual void viewMouseMoveEvent(QMouseEvent*) {}
+ virtual void viewMouseReleaseEvent(QMouseEvent*) {}
+ virtual void viewDropEvent(QDropEvent*) {}
+
+ QRect map(const QRect&) const;
+ QPoint map(const QPoint&) const;
+ QRect mapDev(const QRect&) const;
+ QPoint mapDev(const QPoint&) const;
+
+ int mapx(int x) const;
+ int mapy(int y) const;
+ int mapyDev(int y) const;
+ int mapxDev(int x) const;
+ int rmapy(int y) const;
+ int rmapyDev(int y) const;
+
+ void setPainter(QPainter& p);
+
+ public slots:
+ void setXPos(int);
+ void setYPos(int);
+ void setXMag(int xs);
+ void setYMag(int ys);
+ void redraw();
+
+ public:
+ View(QWidget*, int, int, const char* name = 0);
+ void setBg(const QPixmap& pm);
+ void setBg(const QColor& color) { brush.setColor(color); redraw(); }
+ void setXOffset(int v) { setXPos(mapx(v)); }
+ int xOffset() const { return mapxDev(xpos)-xorg; }
+ int xOffsetDev() const { return xpos-rmapx(xorg); }
+
+ int yOffset() const { return mapyDev(ypos)-yorg; }
+ int getXScale() const { return xmag; }
+ int getYScale() const { return ymag; }
+ void setOrigin(int x, int y);
+ void setVirt(bool flag) { _virt = flag; }
+ bool virt() const { return _virt; }
+ int rmapxDev(int x) const;
+ int rmapx(int x) const;
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/vscale.cpp b/muse2/muse/widgets/vscale.cpp
new file mode 100644
index 00000000..c0679882
--- /dev/null
+++ b/muse2/muse/widgets/vscale.cpp
@@ -0,0 +1,27 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: vscale.cpp,v 1.1.1.1 2003/10/27 18:54:41 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "vscale.h"
+#include <qpainter.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+
+//---------------------------------------------------------
+// paintEvent
+//---------------------------------------------------------
+
+void VScale::paintEvent(QPaintEvent*)
+ {
+ int h = height();
+ int w = width();
+ QPainter p(this);
+ p.drawLine(w/2, h/4, w, h/4);
+ p.drawLine(0, h/2, w, h/2);
+ p.drawLine(w/2, (3*h)/4, w, (3*h)/4);
+ setFixedWidth(18);
+ }
+
diff --git a/muse2/muse/widgets/vscale.h b/muse2/muse/widgets/vscale.h
new file mode 100644
index 00000000..b6b381ac
--- /dev/null
+++ b/muse2/muse/widgets/vscale.h
@@ -0,0 +1,29 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: vscale.h,v 1.1.1.1.2.1 2008/01/19 13:33:47 wschweer Exp $
+// (C) Copyright 1999 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __VSCALE_H__
+#define __VSCALE_H__
+
+#include <qwidget.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+
+//---------------------------------------------------------
+// VScale
+//---------------------------------------------------------
+
+class VScale : public QWidget {
+ Q_OBJECT
+
+ virtual void paintEvent(QPaintEvent*);
+
+ public:
+ VScale(QWidget* parent) : QWidget(parent) {}
+ };
+
+#endif
+
diff --git a/muse2/muse/widgets/wtrackinfobase.ui b/muse2/muse/widgets/wtrackinfobase.ui
new file mode 100644
index 00000000..a429398a
--- /dev/null
+++ b/muse2/muse/widgets/wtrackinfobase.ui
@@ -0,0 +1,224 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>WaveTrackInfoBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>WaveTrackInfoBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>120</width>
+ <height>548</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>MusE: TrackInfo</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string></string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>WinPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <property name="lineWidth">
+ <number>1</number>
+ </property>
+ <property name="midLineWidth">
+ <number>0</number>
+ </property>
+ <property name="text">
+ <string>Track Info</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>iName</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Track Name</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Track Name</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Output Route:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>outputRoute</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Input Route:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>inputRoute</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Ports:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>Mono</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Stereo</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>ports</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>371</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<tabstops>
+ <tabstop>iName</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/muse2/muse/widgets/wtscale.cpp b/muse2/muse/widgets/wtscale.cpp
new file mode 100644
index 00000000..5976670e
--- /dev/null
+++ b/muse2/muse/widgets/wtscale.cpp
@@ -0,0 +1,289 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: wtscale.cpp,v 1.3 2004/04/11 13:03:32 wschweer Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <values.h>
+
+#include <qpainter.h>
+#include <qtooltip.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <QMouseEvent>
+#include <QEvent>
+
+#include "wtscale.h"
+#include "midieditor.h"
+#include "globals.h"
+#include "song.h"
+#include "../marker/marker.h"
+#include "icons.h"
+
+//---------------------------------------------------------
+// WTScale
+// Wave Time Scale
+//---------------------------------------------------------
+
+WTScale::WTScale(int* r, QWidget* parent, int xs)
+ : View(parent, xs, 1)
+ {
+ QToolTip::add(this, tr("bar scale"));
+ barLocator = false;
+ raster = r;
+ pos[0] = int(song->tempomap()->tick2time(song->cpos()) * sampleRate);
+ pos[1] = int(song->tempomap()->tick2time(song->lpos()) * sampleRate);
+ pos[2] = int(song->tempomap()->tick2time(song->rpos()) * sampleRate);
+ pos[3] = -1; // do not show
+ button = Qt::NoButton;
+ setMouseTracking(true);
+ connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool)));
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ connect(song, SIGNAL(markerChanged(int)), SLOT(redraw()));
+ setFixedHeight(28);
+ setBg(QColor(0xe0, 0xe0, 0xe0));
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void WTScale::songChanged(int /*type*/)
+ {
+ }
+
+//---------------------------------------------------------
+// setPos
+//---------------------------------------------------------
+
+void WTScale::setPos(int idx, unsigned val, bool adjustScrollbar)
+ {
+ val = int(song->tempomap()->tick2time(val) * sampleRate);
+ if (val == pos[idx])
+ return;
+ int opos = mapx(pos[idx] == -1 ? val : pos[idx]);
+ pos[idx] = val;
+ if (!isVisible())
+ return;
+ val = mapx(val);
+ int x = -9;
+ int w = 18;
+ if (opos > val) {
+ w += opos - val;
+ x += val;
+ }
+ else {
+ w += val - opos;
+ x += opos;
+ }
+ redraw(QRect(x, 0, w, height()));
+ }
+
+//---------------------------------------------------------
+// viewMousePressEvent
+//---------------------------------------------------------
+
+void WTScale::viewMousePressEvent(QMouseEvent* event)
+ {
+ button = event->button();
+ viewMouseMoveEvent(event);
+ }
+
+//---------------------------------------------------------
+// viewMouseReleaseEvent
+//---------------------------------------------------------
+
+void WTScale::viewMouseReleaseEvent(QMouseEvent* event)
+ {
+ button = Qt::NoButton;
+ }
+
+//---------------------------------------------------------
+// viewMouseMoveEvent
+//---------------------------------------------------------
+
+void WTScale::viewMouseMoveEvent(QMouseEvent* event)
+ {
+ int x= song->tempomap()->time2tick(double(event->x())/double(sampleRate));
+ x = song->raster(x, *raster);
+ if (x < 0)
+ x = 0;
+ emit timeChanged(x);
+ int i;
+ switch (button) {
+ case Qt::LeftButton:
+ i = 0;
+ break;
+ case Qt::MidButton:
+ i = 1;
+ break;
+ case Qt::RightButton:
+ i = 2;
+ break;
+ default:
+ return;
+ }
+ song->setPos(i, x);
+ }
+
+//---------------------------------------------------------
+// leaveEvent
+//---------------------------------------------------------
+
+void WTScale::leaveEvent(QEvent*)
+ {
+// emit timeChanged(MAXINT);
+ }
+
+//---------------------------------------------------------
+// draw
+//---------------------------------------------------------
+
+void WTScale::pdraw(QPainter& p, const QRect& r)
+ {
+ int x = r.x();
+ int w = r.width();
+
+ x -= 20;
+ w += 40; // wg. Text
+
+ //
+ // draw Marker
+ //
+ int y = 12;
+ p.setPen(Qt::black);
+ p.setFont(font4);
+ p.drawLine(r.x(), y+1, r.x() + r.width(), y+1);
+ QRect tr(r);
+ tr.setHeight(12);
+ MarkerList* marker = song->marker();
+ for (iMarker m = marker->begin(); m != marker->end(); ++m) {
+ int xp = mapx(int(m->second.time() * sampleRate));
+ if (xp > x+w)
+ break;
+ int xe = r.x() + r.width();
+ iMarker mm = m;
+ ++mm;
+ if (mm != marker->end()) {
+ xe = mapx(mm->first);
+ }
+ QRect tr(xp, 0, xe-xp, 13);
+ if (m->second.current()) {
+ p.fillRect(tr, Qt::white);
+ }
+ if (r.intersects(tr)) {
+ int x2;
+ iMarker mm = m;
+ ++mm;
+ if (mm != marker->end())
+ x2 = mapx(mm->first);
+ else
+ x2 = xp+200;
+ QRect r = QRect(xp+10, 0, x2-xp, 12);
+ p.drawPixmap(xp, 0, *flagIconS);
+ p.drawText(r, Qt::AlignLeft|Qt::AlignVCenter, m->second.name());
+ }
+ }
+
+ //---------------------------------------------------
+ // draw location marker
+ //---------------------------------------------------
+
+ int h = height()-12;
+
+ if (barLocator) {
+ p.setPen(Qt::red);
+ int xp = mapx(pos[0]);
+ if (xp >= x && xp < x+w)
+ p.drawLine(xp, y, xp, h);
+ p.setPen(Qt::blue);
+ xp = mapx(pos[1]);
+ if (xp >= x && xp < x+w)
+ p.drawLine(xp, y, xp, h);
+ xp = mapx(pos[2]);
+ if (xp >= x && xp < x+w)
+ p.drawLine(xp, y, xp, h);
+ }
+ else {
+ for (int i = 0; i < 3; ++i) {
+ int xp = mapx(pos[i]);
+ if (xp >= x && xp < x+w) {
+ QPixmap* pm = markIcon[i];
+ p.drawPixmap(xp - pm->width()/2, y-1, *pm);
+ }
+ }
+ }
+ p.setPen(Qt::black);
+ if (pos[3] != -1) {
+ int xp = mapx(pos[3]);
+ if (xp >= x && xp < x+w)
+ p.drawLine(xp, 0, xp, height());
+ }
+
+ int ctick = song->samples2tick(mapxDev(x));
+ int bar1, bar2, beat, tick;
+ song->tickValues(ctick, &bar1, &beat, &tick);
+ song->tickValues(song->samples2tick(mapxDev(x+w)), &bar2, &beat, &tick);
+
+//printf("bar %d %d-%d=%d\n", bar, ntick, stick, ntick-stick);
+
+ int stick = song->bar2tick(bar1, 0, 0);
+ int ntick;
+ for (int bar = bar1; bar <= bar2; bar++, stick = ntick) {
+ ntick = song->bar2tick(bar+1, 0, 0);
+ int a = song->tick2samples(ntick);
+ int b = song->tick2samples(stick);
+ int tpix = rmapx(a - b);
+ if (tpix < 64) {
+ // donīt show beats if measure is this small
+ int n = 1;
+ if (tpix < 32)
+ n = 2;
+ if (tpix <= 16)
+ n = 4;
+ if (tpix < 8)
+ n = 8;
+ if (tpix <= 4)
+ n = 16;
+ if (tpix <= 2)
+ n = 32;
+ if (bar % n)
+ continue;
+ p.setFont(font3);
+ int x = mapx(b);
+ QString s;
+ s.setNum(bar + 1);
+ p.drawLine(x, y+1, x, y+1+h);
+ QRect r = QRect(x+2, y, 0, h);
+ p.drawText(r, Qt::AlignLeft|Qt::AlignVCenter|Qt::TextDontClip, s);
+ }
+ else {
+ int z, n;
+ song->timesig(stick, z, n);
+ for (int beat = 0; beat < z; beat++) {
+ int xx = song->tick2samples(song->bar2tick(bar, beat, 0));
+ int xp = mapx(xx);
+ QString s;
+ QRect r(xp+2, y, 0, h);
+ int y1;
+ int num;
+ if (beat == 0) {
+ num = bar + 1;
+ y1 = y + 1;
+ p.setFont(font3);
+ }
+ else {
+ num = beat + 1;
+ y1 = y + 7;
+ p.setFont(font1);
+ r.setY(y+3);
+ }
+ s.setNum(num);
+ p.drawLine(xp, y1, xp, y+1+h);
+ p.drawText(r, Qt::AlignLeft|Qt::AlignVCenter|Qt::TextDontClip, s);
+ }
+ }
+ }
+ }
+
diff --git a/muse2/muse/widgets/wtscale.h b/muse2/muse/widgets/wtscale.h
new file mode 100644
index 00000000..ab378296
--- /dev/null
+++ b/muse2/muse/widgets/wtscale.h
@@ -0,0 +1,51 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: wtscale.h,v 1.2 2004/01/11 18:55:37 wschweer Exp $
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __MTSCALE_H__
+#define __MTSCALE_H__
+
+#include "view.h"
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QEvent>
+
+class QPainter;
+
+//---------------------------------------------------------
+// WTScale
+// scale for wave track
+//---------------------------------------------------------
+
+class WTScale : public View {
+ Q_OBJECT
+ int* raster;
+ unsigned pos[4];
+ int button;
+ bool barLocator;
+
+ private slots:
+ void songChanged(int);
+
+ protected:
+ virtual void pdraw(QPainter&, const QRect&);
+ virtual void viewMousePressEvent(QMouseEvent* event);
+ virtual void viewMouseMoveEvent(QMouseEvent* event);
+ virtual void viewMouseReleaseEvent(QMouseEvent* event);
+ virtual void leaveEvent(QEvent*e);
+
+ signals:
+ void timeChanged(unsigned);
+
+ public slots:
+ void setPos(int, unsigned, bool);
+
+ public:
+ WTScale(int* raster, QWidget* parent, int xscale);
+ void setBarLocator(bool f) { barLocator = f; }
+ };
+#endif
+
diff --git a/muse2/muse/xml.cpp b/muse2/muse/xml.cpp
new file mode 100644
index 00000000..88251cc8
--- /dev/null
+++ b/muse2/muse/xml.cpp
@@ -0,0 +1,733 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: xml.cpp,v 1.17.2.6 2009/12/07 20:48:45 spamatica Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <qstring.h>
+#include <qcolor.h>
+#include <qwidget.h>
+#include <qrect.h>
+
+#include "xml.h"
+
+//---------------------------------------------------------
+// Note:
+// this code is a Q/D hack for reading/parsing and
+// writing XML-Files
+// - can only handle the XML subset used by MusE
+// - may not handle misformed XML (eg. when manually
+// editing MusE output)
+
+//---------------------------------------------------------
+// Xml
+//---------------------------------------------------------
+
+Xml::Xml(FILE* _f)
+ {
+ f = _f;
+ _line = 0;
+ _col = 0;
+ level = 0;
+ inTag = false;
+ inComment = false;
+ lbuffer[0] = 0;
+ bufptr = lbuffer;
+ _minorVersion = -1;
+ _majorVersion = -1;
+ }
+
+Xml::Xml(const char* buf)
+ {
+ f = 0;
+ _line = 0;
+ _col = 0;
+ level = 0;
+ inTag = false;
+ inComment = false;
+ bufptr = buf;
+ _minorVersion = -1;
+ _majorVersion = -1;
+ }
+
+//---------------------------------------------------------
+// next
+//---------------------------------------------------------
+
+void Xml::next()
+ {
+ if (*bufptr == 0) {
+ if (f == 0 || fgets(lbuffer, 512, f) == 0) {
+ c = EOF;
+ return;
+ }
+ bufptr = lbuffer;
+ }
+ c = *bufptr++;
+ if (c == '\n') {
+ ++_line;
+ _col = -1;
+ }
+ ++_col;
+ }
+
+//---------------------------------------------------------
+// nextc
+// get next non space character
+//---------------------------------------------------------
+
+void Xml::nextc()
+ {
+ next();
+ while (c == ' ' || c == '\t' || c == '\n')
+ next();
+ }
+
+//---------------------------------------------------------
+// token
+// read token into _s2
+//---------------------------------------------------------
+
+void Xml::token(int cc)
+ {
+ char buffer[512];
+ int i = 0;
+ for (; i < 511;) {
+ if (c == ' ' || c == '\t' || c == cc || c == '\n' || c == EOF)
+ break;
+ buffer[i++] = c;
+ next();
+ }
+ buffer[i] = 0;
+ _s2 = buffer; // deep copy !?
+ }
+
+//---------------------------------------------------------
+// stoken
+// read string token into _s2
+//---------------------------------------------------------
+
+void Xml::stoken()
+ {
+ char buffer[1024*4];
+ int i = 0;
+ buffer[i] = c;
+ ++i;
+ next();
+ for (;i < 1024*4-1;) {
+ if (c == '"') {
+ buffer[i++] = c;
+ next();
+ break;
+ }
+ if (c == '&') {
+ char entity[6];
+ int k = 0;
+ for (; k < 6; ++k) {
+ next();
+ if (c == EOF)
+ break;
+ else if (c == ';') {
+ entity[k] = 0;
+ if (strcmp(entity, "quot") == 0)
+ c = '"';
+ else if (strcmp(entity, "amp") == 0)
+ c = '&';
+ else if (strcmp(entity, "lt") == 0)
+ c = '<';
+ else if (strcmp(entity, "gt") == 0)
+ c = '>';
+ else if (strcmp(entity, "apos") == 0)
+ c = '\\';
+ else
+ entity[k] = c;
+ break;
+ }
+ else
+ entity[k] = c;
+ }
+ if (c == EOF || k == 6) {
+ // dump entity
+ int n = 0;
+ buffer[i++] = '&';
+ for (;(i < 511) && (n < k); ++i, ++n)
+ buffer[i] = entity[n];
+ }
+ else
+ buffer[i++] = c;
+ }
+ else if(c != EOF)
+ buffer[i++] = c;
+ if (c == EOF)
+ break;
+ next();
+ }
+ buffer[i] = 0;
+ _s2 = buffer;
+ }
+
+//---------------------------------------------------------
+// strip
+// strip `"` from string
+//---------------------------------------------------------
+
+QString Xml::strip(const QString& s)
+ {
+ int l = s.length();
+ if (l >= 2 && s[0] == '"')
+ return s.mid(1, l-2);
+ return s;
+ }
+
+//---------------------------------------------------------
+// parse
+//---------------------------------------------------------
+
+Xml::Token Xml::parse()
+ {
+ char buffer[1024*1024]; // increase buffer -rj
+ char* p;
+
+ again:
+ bool endFlag = false;
+ nextc();
+ if (c == EOF) {
+ printf("unexpected EOF reading *.med file at level %d, line %d, <%s><%s><%s>\n",
+ level, _line, _tag.latin1(), _s1.latin1(), _s2.latin1());
+ return level == 0 ? End : Error;
+ }
+
+ _s1 = QString("");
+ if (inTag) {
+ //-------------------
+ // parse Attributes
+ //-------------------
+ if (c == '/') {
+ nextc();
+ token('>');
+ if (c != '>') {
+ printf("Xml: unexpected char '%c', expected '>'\n", c);
+ goto error;
+ }
+ _s1 = _tag;
+ inTag = false;
+ --level;
+ return TagEnd;
+ }
+ _s2 = QString("");
+ token('=');
+ _s1 = _s2;
+ nextc(); // skip space
+ if (c == '"')
+ stoken();
+ else
+ token('>');
+ if (c == '>')
+ inTag = false;
+ else
+ --bufptr;
+ _s2 = strip(_s2);
+ return Attribut;
+ }
+ if (c == '<') {
+ //--------------
+ // parse Tag
+ //--------------
+ next();
+ if (c == '/') {
+ endFlag = true;
+ next();
+ }
+ if (c == '?') {
+ next();
+ p = buffer;
+ for (;;) {
+ if (c == '?' || c == EOF || c == '>')
+ break;
+ *p++ = c;
+ // TODO: check overflow
+ next();
+ }
+ *p = 0;
+ _s1 = QString(buffer);
+ if (c == EOF) {
+ fprintf(stderr, "XML: unexpected EOF\n");
+ goto error;
+ }
+ nextc();
+ if (c != '>') {
+ fprintf(stderr, "XML: '>' expected\n");
+ goto error;
+ }
+ next();
+ return Proc;
+ }
+ else if (c == '!') { // process comment
+ bool endc = false;
+ for(;;) {
+ next();
+ if (c == '>' && endc)
+ break;
+ endc = c == '-';
+ if (c == EOF) {
+ fprintf(stderr, "XML: unexpected EOF in comment\n");
+ goto error;
+ }
+ }
+ goto again;
+ }
+ p = buffer;
+ for (;;) {
+ if (c == '/' || c == ' ' || c == '\t' || c == '>' || c == '\n' || c == EOF)
+ break;
+ // TODO: check overflow
+ *p++ = c;
+ next();
+ }
+ *p = 0;
+ _s1 = QString(buffer);
+ // skip white space:
+ while (c == ' ' || c == '\t' || c == '\n')
+ next();
+ if (c == '/') {
+ nextc();
+ if (c == '>')
+ return Flag;
+ fprintf(stderr, "XML: '>' expected\n");
+ goto error;
+ }
+ if (c == '?') {
+ nextc();
+ if (c == '>')
+ return Proc;
+ fprintf(stderr, "XML: '>' expected\n");
+ goto error;
+ }
+ if (c == '>') {
+ if (endFlag) {
+ --level;
+ return TagEnd;
+ }
+ else {
+ ++level;
+ return TagStart;
+ }
+ }
+ else {
+ _tag = _s1;
+ --bufptr;
+ inTag = true;
+ ++level;
+ if (!endFlag) {
+ return TagStart;
+ }
+ fprintf(stderr, "XML: endFlag expected\n");
+ goto error;
+ }
+ }
+ else {
+ //--------------
+ // parse Text
+ //--------------
+ if (level == 0) {
+ fprintf(stderr, "XML: level = 0\n");
+ goto error;
+ }
+ p = buffer;
+ for (;;) {
+ if (c == EOF || c == '<')
+ break;
+ if (c == '&') {
+ next();
+ if (c == '<') { // be tolerant with old muse files
+ *p++ = '&';
+ continue;
+ }
+ char name[32];
+ char* dp = name;
+ *dp++ = c;
+ for (; dp-name < 31;) {
+ next();
+ if (c == ';')
+ break;
+ *dp++ = c;
+ }
+ *dp = 0;
+ if (strcmp(name, "lt") == 0)
+ c = '<';
+ else if (strcmp(name, "gt") == 0)
+ c = '>';
+ else if (strcmp(name, "apos") == 0)
+ c = '\\';
+ else if (strcmp(name, "quot") == 0)
+ c = '"';
+ else if (strcmp(name, "amp") == 0)
+ c = '&';
+ else
+ c = '?';
+ }
+ *p++ = c;
+ next();
+ }
+ *p = 0;
+ _s1 = QString(buffer);
+
+ if (c == '<')
+ --bufptr;
+ return Text;
+ }
+error:
+ fprintf(stderr, "XML Parse Error at line %d col %d\n", _line, _col+1);
+ return Error;
+ }
+
+//---------------------------------------------------------
+// parse(QString)
+//---------------------------------------------------------
+
+QString Xml::parse(const QString& tag)
+ {
+ QString a;
+
+ for (;;) {
+ switch (parse()) {
+ case Error:
+ case End:
+ return a;
+ default:
+ case TagStart:
+ case Attribut:
+ break;
+ case Text:
+ a = _s1;
+ break;
+ case TagEnd:
+ if (_s1 == tag)
+ return a;
+ break;
+ }
+ }
+ return a;
+ }
+
+//---------------------------------------------------------
+// parse1
+//---------------------------------------------------------
+
+QString Xml::parse1()
+ {
+ return parse(_s1.simplifyWhiteSpace());
+ }
+
+//---------------------------------------------------------
+// parseInt
+//---------------------------------------------------------
+
+int Xml::parseInt()
+ {
+ QString s(parse1().simplifyWhiteSpace());
+ bool ok;
+ int base = 10;
+ if (s.startsWith("0x") || s.startsWith("0X")) {
+ base = 16;
+ s = s.mid(2);
+ }
+ int n = s.toInt(&ok, base);
+ return n;
+ }
+
+//---------------------------------------------------------
+// parseUInt
+//---------------------------------------------------------
+// Added by Tim. p3.3.8
+
+unsigned int Xml::parseUInt()
+ {
+ QString s(parse1().simplifyWhiteSpace());
+ bool ok;
+ int base = 10;
+ if (s.startsWith("0x") || s.startsWith("0X")) {
+ base = 16;
+ s = s.mid(2);
+ }
+ unsigned int n = s.toUInt(&ok, base);
+ return n;
+ }
+
+//---------------------------------------------------------
+// parseFloat
+//---------------------------------------------------------
+
+float Xml::parseFloat()
+ {
+ QString s(parse1().simplifyWhiteSpace());
+ return s.toFloat();
+ }
+
+//---------------------------------------------------------
+// parseDouble
+//---------------------------------------------------------
+
+double Xml::parseDouble()
+ {
+ QString s(parse1().simplifyWhiteSpace());
+ return s.toDouble();
+ }
+
+//---------------------------------------------------------
+// unknown
+//---------------------------------------------------------
+
+void Xml::unknown(const char* s)
+ {
+ printf("%s: unknown tag <%s> at line %d\n",
+ s, _s1.latin1(), _line+1);
+ parse1();
+ }
+
+//---------------------------------------------------------
+// header
+//---------------------------------------------------------
+
+void Xml::header()
+ {
+ fprintf(f, "<?xml version=\"1.0\"?>\n");
+ }
+
+//---------------------------------------------------------
+// put
+//---------------------------------------------------------
+
+void Xml::put(const char* format, ...)
+ {
+ va_list args;
+ va_start(args, format);
+
+ vfprintf(f, format, args);
+ va_end(args);
+ putc('\n', f);
+ }
+
+void Xml::put(int level, const char* format, ...)
+ {
+ va_list args;
+ va_start(args, format);
+ putLevel(level);
+ vfprintf(f, format, args);
+ va_end(args);
+ putc('\n', f);
+ }
+
+//---------------------------------------------------------
+// nput
+//---------------------------------------------------------
+
+void Xml::nput(int level, const char* format, ...)
+ {
+ va_list args;
+ va_start(args, format);
+ putLevel(level);
+ vfprintf(f, format, args);
+ va_end(args);
+ }
+
+void Xml::nput(const char* format, ...)
+ {
+ va_list args;
+ va_start(args, format);
+ vfprintf(f, format, args);
+ va_end(args);
+ }
+
+//---------------------------------------------------------
+// tag
+//---------------------------------------------------------
+
+void Xml::tag(int level, const char* format, ...)
+ {
+ va_list args;
+ va_start(args, format);
+ putLevel(level);
+ putc('<', f);
+ vfprintf(f, format, args);
+ va_end(args);
+ putc('>', f);
+ putc('\n', f);
+ }
+
+//---------------------------------------------------------
+// etag
+//---------------------------------------------------------
+
+void Xml::etag(int level, const char* format, ...)
+ {
+ va_list args;
+ va_start(args, format);
+ putLevel(level);
+ putc('<', f);
+ putc('/', f);
+ vfprintf(f, format, args);
+ va_end(args);
+ putc('>', f);
+ putc('\n', f);
+ }
+
+void Xml::putLevel(int n)
+ {
+ for (int i = 0; i < n*2; ++i)
+ putc(' ', f);
+ }
+
+void Xml::intTag(int level, const char* name, int val)
+ {
+ putLevel(level);
+ fprintf(f, "<%s>%d</%s>\n", name, val, name);
+ }
+
+void Xml::uintTag(int level, const char* name, unsigned int val)
+ {
+ putLevel(level);
+ fprintf(f, "<%s>%u</%s>\n", name, val, name);
+ }
+
+void Xml::floatTag(int level, const char* name, float val)
+ {
+ putLevel(level);
+ QString s("<%1>%2</%3>\n");
+ fprintf(f, "%s", s.arg(name).arg(val).arg(name).latin1());
+ }
+
+void Xml::doubleTag(int level, const char* name, double val)
+ {
+ putLevel(level);
+ QString s("<%1>%2</%3>\n");
+ fprintf(f, "%s", s.arg(name).arg(val).arg(name).latin1());
+ }
+
+void Xml::strTag(int level, const char* name, const char* val)
+ {
+ putLevel(level);
+ fprintf(f, "<%s>", name);
+ if (val) {
+ while (*val) {
+ switch(*val) {
+ case '&': fprintf(f, "&amp;"); break;
+ case '<': fprintf(f, "&lt;"); break;
+ case '>': fprintf(f, "&gt;"); break;
+ case '\\': fprintf(f, "&apos;"); break;
+ case '"': fprintf(f, "&quot;"); break;
+ default: fputc(*val, f); break;
+ }
+ ++val;
+ }
+ }
+ fprintf(f, "</%s>\n", name);
+ }
+
+//---------------------------------------------------------
+// colorTag
+//---------------------------------------------------------
+
+void Xml::colorTag(int level, const char* name, const QColor& color)
+ {
+ putLevel(level);
+ fprintf(f, "<%s r=\"%d\" g=\"%d\" b=\"%d\"></%s>\n",
+ name, color.red(), color.green(), color.blue(), name);
+ }
+
+//---------------------------------------------------------
+// geometryTag
+//---------------------------------------------------------
+
+void Xml::geometryTag(int level, const char* name, const QWidget* g)
+ {
+ qrectTag(level, name, QRect(g->pos(), g->size()));
+ }
+
+//---------------------------------------------------------
+// qrectTag
+//---------------------------------------------------------
+
+void Xml::qrectTag(int level, const char* name, const QRect& r)
+ {
+ putLevel(level);
+ fprintf(f, "<%s x=\"%d\" y=\"%d\" w=\"%d\" h=\"%d\"></%s>\n",
+ name, r.x(), r.y(), r.width(), r.height(), name);
+ }
+
+//---------------------------------------------------------
+// strTag
+//---------------------------------------------------------
+
+void Xml::strTag(int level, const char* name, const QString& val)
+ {
+ strTag(level, name, val.latin1());
+ }
+
+//---------------------------------------------------------
+// Xml::skip
+//---------------------------------------------------------
+
+void Xml::skip(const QString& etag)
+ {
+ for (;;) {
+ Token token = parse();
+ const QString& tag = s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::Text:
+ break;
+ case Xml::TagEnd:
+ if (tag == etag)
+ return;
+ break;
+ case Xml::TagStart:
+ skip(tag);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// xmlString
+//---------------------------------------------------------
+
+QString Xml::xmlString(const char* s)
+ {
+ return Xml::xmlString(QString(s));
+ }
+
+//---------------------------------------------------------
+// xmlString
+//---------------------------------------------------------
+
+QString Xml::xmlString(const QString& ss)
+ {
+ QString s(ss);
+ s.replace('&', "&amp;");
+ s.replace('<', "&lt;");
+ s.replace('>', "&gt;");
+ s.replace('\'', "&apos;");
+ s.replace('"', "&quot;");
+ return s;
+ }
+
+void Xml::dump(QString &dump)
+ {
+ if (f == 0)
+ return;
+ fpos_t pos;
+ fgetpos(f, &pos);
+ rewind(f);
+ while(fgets(lbuffer, 512, f) != 0)
+ dump.append(lbuffer);
+ fsetpos(f, &pos);
+ }
diff --git a/muse2/muse/xml.h b/muse2/muse/xml.h
new file mode 100644
index 00000000..912ddb4a
--- /dev/null
+++ b/muse2/muse/xml.h
@@ -0,0 +1,95 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: xml.h,v 1.8.2.3 2009/11/09 20:28:28 terminator356 Exp $
+//
+// (C) Copyright 2000 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#ifndef __XML_H__
+#define __XML_H__
+
+#include <stdio.h>
+#include <qstring.h>
+
+class QColor;
+class QWidget;
+class QRect;
+
+//---------------------------------------------------------
+// Xml
+// very simple XML-like parser
+//---------------------------------------------------------
+
+class Xml {
+ FILE* f;
+ int _line;
+ int _col;
+ QString _s1, _s2, _tag;
+ int level;
+ bool inTag;
+ bool inComment;
+ int _minorVersion;
+ int _majorVersion;
+
+ int c; // current char
+ char lbuffer[512];
+ const char* bufptr;
+
+ void next();
+ void nextc();
+ void token(int);
+ void stoken();
+ QString strip(const QString& s);
+ void putLevel(int n);
+
+ public:
+ enum Token {Error, TagStart, TagEnd, Flag,
+ Proc, Text, Attribut, End};
+ int majorVersion() const { return _majorVersion; }
+ int minorVersion() const { return _minorVersion; }
+ void setVersion(int maj, int min) {
+ _minorVersion = min;
+ _majorVersion = maj;
+ }
+ Xml(FILE*);
+ Xml(const char*);
+ Token parse();
+ QString parse(const QString&);
+ QString parse1();
+ int parseInt();
+ unsigned int parseUInt();
+ float parseFloat();
+ double parseDouble();
+ void unknown(const char*);
+ int line() const { return _line; } // current line
+ int col() const { return _col; } // current col
+ const QString& s1() { return _s1; }
+ const QString& s2() { return _s2; }
+ void dump(QString &dump);
+
+ void header();
+ void put(const char* format, ...);
+ void put(int level, const char* format, ...);
+ void nput(int level, const char* format, ...);
+ void nput(const char* format, ...);
+ void tag(int level, const char* format, ...);
+ void etag(int level, const char* format, ...);
+ void intTag(int level, const char* const name, int val);
+ void uintTag(int level, const char* const name, unsigned int val);
+ void doubleTag(int level, const char* const name, double val);
+ void floatTag(int level, const char* const name, float val);
+ void strTag(int level, const char* const name, const char* val);
+ void strTag(int level, const char* const name, const QString& s);
+ void colorTag(int level, const char* name, const QColor& color);
+ void geometryTag(int level, const char* name, const QWidget* g);
+ void qrectTag(int level, const char* name, const QRect& r);
+ static QString xmlString(const QString&);
+ static QString xmlString(const char*);
+
+ void skip(const QString& tag);
+ };
+
+extern QRect readGeometry(Xml&, const QString&);
+#endif
+